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 1d6babdfe5b1cec9eb2da9b6302d855204d9a83e
parent 41361380c1208af52a830e48fc4e15fd446495a4
Author: Henry Unite <unitehenry@gmail.com>
Date:   Wed, 23 Sep 2020 16:51:06 -0400

Merge branch 'dev' of https://github.com/striven-erp/striven-editor into dev

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()) {