striven-editor

Maintained and contributed to an open source WYSIWYG editor as an internship project that made it to production and was adopted by the company I was working at.
git clone https://unitehenry.com/git/striven-editor.git
Log | Files | Refs | README | LICENSE

commit b632522dbd4fb4b2a20b8c6cb8ad748fcaea9bc3
parent 26e279bfc71dd0784841fd615e518aa8a20abc59
Author: unitehenry <unitehenry@gmail.com>
Date:   Wed, 23 Sep 2020 16:50:26 -0400

tab editor via window event

Diffstat:
Msrc/striveneditor.js | 20+++++++++++++-------
1 file changed, 13 insertions(+), 7 deletions(-)

diff --git a/src/striveneditor.js b/src/striveneditor.js @@ -1115,6 +1115,19 @@ export default class StrivenEditor { se.toolbarState(); }; + addEventListener('keyup', (e) => { + const tab = (e.key === 'Tab' || e.keyCode === 9); + + if(tab && document.activeElement === 9) { + const r = se.getRange(); + + if(r) { + r.selectNodeContents(se.body); + r.collapse(); + } + } + }) + const bodyFocus = body.onfocus; body.onfocus = e => { !se.browser.isEdge() && se.setRange(); @@ -1137,13 +1150,6 @@ export default class StrivenEditor { } - } else { - const r = se.getRange(); - - if(r) { - r.selectNodeContents(se.body); - r.collapse(); - } } if (se.scrollPosition && !se.browser.isEdge()) {