Correspond to <input> and <textarea>

This commit is contained in:
sienori 2017-10-30 09:06:22 +09:00 committed by GitHub
parent 969895b488
commit 4565f4716b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -15,7 +15,13 @@ window.addEventListener("mouseup", Select, false);
function Select(e) {
hidePanel(e);
setTimeout(function () { //誤動作防止の為ディレイを設ける
//selectionWord = String(window.getSelection());
if (e.target.tagName == "INPUT" || e.target.tagName == "TEXTAREA") {
selectionWord = e.target.value.substring(e.target.selectionStart, e.target.selectionEnd);
} else {
selectionWord = String(window.getSelection());
}
if ((selectionWord.length !== 0) && (e.button == 0) && (e.target.id !== "simple-translate-panel") && (e.target.parentElement.id !== "simple-translate-panel")) { //選択範囲が存在かつ左クリックかつパネル以外のとき
clickPosition = e;
if (S.get().ifShowButton) { //ボタンを表示