Skip to content

Commit ac1b175

Browse files
committed
Editor: fix Tab intercept timing for Firefox
1 parent 2b3eb75 commit ac1b175

1 file changed

Lines changed: 12 additions & 10 deletions

File tree

editor/index.html

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -241,16 +241,18 @@
241241
});
242242

243243
// Fix Tab in Firefox: intercept on the CM textarea directly
244-
const cmTextarea = document.querySelector('.CodeMirror textarea');
245-
if (cmTextarea) {
246-
cmTextarea.addEventListener('keydown', e => {
247-
if (e.key === 'Tab') {
248-
e.preventDefault();
249-
e.stopPropagation();
250-
editor.replaceSelection(' ');
251-
}
252-
}, true);
253-
}
244+
setTimeout(() => {
245+
const cmTextarea = document.querySelector('.CodeMirror textarea');
246+
if (cmTextarea) {
247+
cmTextarea.addEventListener('keydown', e => {
248+
if (e.key === 'Tab') {
249+
e.preventDefault();
250+
e.stopPropagation();
251+
editor.replaceSelection(' ');
252+
}
253+
}, true);
254+
}
255+
}, 100);
254256
</script>
255257
</div>
256258
</div>

0 commit comments

Comments
 (0)