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 125dec1318b7bb0b4192c5eb6b28dcec4d0628d8
parent 6bd33703582ec6430cfc70036afa02164f9dc304
Author: Eric Butler <ebutler@striven.com>
Date:   Fri, 26 Sep 2025 16:57:00 -0400

Fix for issue #169 - all text on page up to the editor is selected on focus when editor is empty

Diffstat:
Msrc/striveneditor.js | 8+++++++-
1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/src/striveneditor.js b/src/striveneditor.js @@ -1067,8 +1067,14 @@ export default class StrivenEditor { se.editor.classList.add('se-focus'); if (se.body.textContent.trim() === '') { - se.placeCaretAtEnd(se.body); + const selNode = document.createTextNode(''); + se.body.append(selNode); + setTimeout(() => { + se.placeCaretAtEnd(se.body); + selNode.remove(); + }, 0); + } if (se.scrollPosition && !se.browser.isEdge()) {