aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorShin'ya Ueoka <ueokande@i-beam.org>2017-10-12 21:18:52 +0900
committerShin'ya Ueoka <ueokande@i-beam.org>2017-10-12 21:18:52 +0900
commit4646e8b18d05e7b97db1857981baef5a23903db6 (patch)
treeeca17efeb34904a5b788faa679d4d926b69d4b86 /src
parent10beccfab2361e97a25628e017662dee70c079a9 (diff)
fix follow for contenteditable
Diffstat (limited to 'src')
-rw-r--r--src/content/components/follow.js9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/content/components/follow.js b/src/content/components/follow.js
index c87424d..eb453a5 100644
--- a/src/content/components/follow.js
+++ b/src/content/components/follow.js
@@ -4,6 +4,10 @@ import Hint from 'content/hint';
import HintKeyProducer from 'content/hint-key-producer';
const DEFAULT_HINT_CHARSET = 'abcdefghijklmnopqrstuvwxyz';
+const TARGET_SELECTOR = [
+ 'a', 'button', 'input', 'textarea',
+ '[contenteditable=true]', '[contenteditable=""]'
+].join(',');
const inWindow = (window, element) => {
let {
@@ -130,6 +134,9 @@ export default class FollowComponent {
return element.focus();
case 'button':
return element.click();
+ default:
+ // it may contenteditable
+ return element.focus();
}
}
@@ -154,7 +161,7 @@ export default class FollowComponent {
}
static getTargetElements(doc) {
- let all = doc.querySelectorAll('a,button,input,textarea');
+ let all = doc.querySelectorAll(TARGET_SELECTOR);
let filtered = Array.prototype.filter.call(all, (element) => {
let style = window.getComputedStyle(element);
return style.display !== 'none' &&