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 33af65c39b574545dca8847c0cd2a8851b6ab0e7
parent 12efdd09c786d3d81c6ad80c5e4750ba07c667b9
Author: sanjogs <sanjogsharma@gmail.com>
Date:   Mon,  3 Mar 2025 07:00:41 -0500

added overflow on image resize and image wrapper is removed before editor content is grabbed

Diffstat:
Msrc/striveneditor.js | 18++++++++++++++----
1 file changed, 14 insertions(+), 4 deletions(-)

diff --git a/src/striveneditor.js b/src/striveneditor.js @@ -2137,7 +2137,11 @@ export default class StrivenEditor { //remove any link and image options [...body.querySelectorAll('.se-link-options')].forEach((lOpt) => lOpt.remove()); - [...body.querySelectorAll('.se-image-options')].forEach((iOpt) => iOpt.remove()); + [...body.querySelectorAll('.se-image-wrapper')].forEach((iwrap) => { + //find image inside the wrapper and replace the wrapper with image + const img = iwrap.querySelector('img'); + iwrap.parentNode.replaceChild(img,iwrap); + }); if (body.textContent || se.body.getElementsByTagName('img').length || se.body.getElementsByTagName('iframe').length) { return body.innerHTML; @@ -3490,20 +3494,20 @@ export default class StrivenEditor { }) .catch((err) => { console.error(err); - // Replace the temporary image with the uploaded image + // Remove temp image tempImg.remove(); se._isImageUploading = false; }); }) .catch((err) => { console.error(err); - // Replace the temporary image with the uploaded image + // Remove temp image tempImg.remove(); se._isImageUploading = false; }); }).catch((err) => { console.error(err); - // Replace the temporary image with the uploaded image + // Remove Temp Image tempImg.remove(); se._isImageUploading = false; }); @@ -3644,6 +3648,7 @@ export default class StrivenEditor { } startImageResize(e, resizeMarker, handlePosition, img) { + const se=this; e.preventDefault && e.preventDefault(); let startX = e.clientX; @@ -3719,6 +3724,11 @@ export default class StrivenEditor { resizeMarker.style.left = 0; resizeMarker.style.top = 0; + //recompute overflow style + setTimeout(function () { + se.overflow(); + }, 0); + document.removeEventListener('mousemove', mouseMoveHandler); document.removeEventListener('mouseup', mouseUpHandler); }