Anyway to override the tab behavior on full composer?
Solved
General Discussion
-
GDScript is an important topic in my forum, and it's a tab based programming language. However pressing tab in moves the focus to another elements instead of adding tab to the code. Is there a way to override this? At least when the users is doing a full reply
-
Put this in your Custom Javascript in the ACP:
$(() => app.require('hooks').then((hooks) => { hooks.on('action:composer.enhanced', ({ postContainer }) => { postContainer.find('textarea.write').on('keydown', function (e) { if (e.key == 'Tab') { e.preventDefault(); var start = this.selectionStart; var end = this.selectionEnd; // set textarea value to: text before caret + tab + text after caret this.value = this.value.substring(0, start) + "\t" + this.value.substring(end); // put caret at right position again this.selectionStart = this.selectionEnd = start + 1; } }); }); }));
-
Put this in your Custom Javascript in the ACP:
$(() => app.require('hooks').then((hooks) => { hooks.on('action:composer.enhanced', ({ postContainer }) => { postContainer.find('textarea.write').on('keydown', function (e) { if (e.key == 'Tab') { e.preventDefault(); var start = this.selectionStart; var end = this.selectionEnd; // set textarea value to: text before caret + tab + text after caret this.value = this.value.substring(0, start) + "\t" + this.value.substring(end); // put caret at right position again this.selectionStart = this.selectionEnd = start + 1; } }); }); }));
-
-
Copyright © 2024 NodeBB | Contributors