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 54967931fbe1460b33315d0d44f72ae617f5c2fd
parent e9a62da0962ec2ce9783736912e321ecd493935c
Author: Eric Butler <ebutler@striven.com>
Date:   Mon, 10 Mar 2025 11:46:36 -0400

changed promise handlers for insertImages

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

diff --git a/src/striveneditor.js b/src/striveneditor.js @@ -392,7 +392,7 @@ export default class StrivenEditor { toolbar.onclick = (ev) => { se.body.focus(); - ev.stopPropagation(); + }; // Append Font Options @@ -923,9 +923,9 @@ export default class StrivenEditor { }; // Paste image logic - if (e.clipboardData.files && e.clipboardData.files.length > 0 && e.clipboardData.files[0].type.includes('image')) { + if (e.clipboardData.files && e.clipboardData.files.length > 0 ) { e.preventDefault(); - + se.insertImages(e.clipboardData.files).finally(() => { afterPaste(); }); @@ -3437,18 +3437,19 @@ export default class StrivenEditor { if (!file.type.includes('image')) { continue; } - p = p.then(() => se.insertImage(file, currentRange)); + p = p.finally(() => se.insertImage(file, currentRange)); } // Add the resolve to the end of the promise chain - p.then(() => { - resolve(); + p.finally(() => { // Remove busy class se.editor.classList.remove('se-image-uploading'); se._isImageUploading = false; // Check image overflow setTimeout(() => se.overflow(), 500); + + resolve(); }); }); }