Skip to content

Commit 6ec845f

Browse files
committed
Editor: use same simple Tab fix as homepage
1 parent b6cb6bf commit 6ec845f

1 file changed

Lines changed: 1 addition & 19 deletions

File tree

editor/index.html

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@
109109
tabSize: 2,
110110
indentWithTabs: false,
111111
autofocus: true,
112-
extraKeys: { Tab: cm => cm.execCommand('indentMore'), 'Shift-Tab': cm => cm.execCommand('indentLess'), Backspace: cm => cm.execCommand('delCharBefore') },
112+
extraKeys: { Tab: function(cm) { cm.replaceSelection(' '); } },
113113
});
114114
editor.setValue(DEFAULT);
115115
editor.setSize('100%', '100%');
@@ -240,24 +240,6 @@
240240
if ((e.ctrlKey||e.metaKey) && e.key==='Enter') { e.preventDefault(); runSketch(); }
241241
});
242242

243-
// Fix Tab in Firefox
244-
setTimeout(() => {
245-
const cmEl = document.querySelector('.CodeMirror');
246-
const cmTextarea = document.querySelector('.CodeMirror textarea');
247-
if (cmEl) cmEl.setAttribute('tabindex', '-1');
248-
if (cmTextarea) {
249-
cmTextarea.setAttribute('tabindex', '0');
250-
cmTextarea.addEventListener('keydown', e => {
251-
if (e.key === 'Tab') {
252-
e.preventDefault();
253-
e.stopPropagation();
254-
e.stopImmediatePropagation();
255-
editor.replaceSelection(' ');
256-
cmTextarea.focus();
257-
}
258-
}, true);
259-
}
260-
}, 100);
261243
</script>
262244
</div>
263245
</div>

0 commit comments

Comments
 (0)