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 2ffffce0d2f66e0a6954c5c5fe708172c9551fb5
parent c1cf0f1919ef290599d2ff416561c1b467928fec
Author: unitehenry <unitehenry@gmail.com>
Date:   Wed, 23 Oct 2019 13:40:44 -0400

prune scripts

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

diff --git a/src/striveneditor.js b/src/striveneditor.js @@ -1096,7 +1096,7 @@ export default class StrivenEditor { } getContent() { - return this.body.innerHTML; + return this.pruneScripts(this.body).innerHTML; } getRange() { @@ -1142,6 +1142,13 @@ export default class StrivenEditor { : (body.style.overflowX = "hidden"); } + pruneScripts (el) { + const scripts = el.querySelectorAll('script'); + scripts.forEach(script => script.remove()); + + return el; + } + formatBytes(bytes, decimals = 2) { if (bytes === 0) return '0 Bytes';