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 9ba89bbea5b1c7784d10698069c7b0327177dca3
parent 0b954f7fd369a5fb2bd585b19e3d727a76857d64
Author: Eric Butler <ebutler@striven.com>
Date:   Mon, 17 Feb 2025 11:58:06 -0500

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

Diffstat:
Msrc/striveneditor.js | 68+++++++++++++++++++++++++++++++++-----------------------------------
1 file changed, 33 insertions(+), 35 deletions(-)

diff --git a/src/striveneditor.js b/src/striveneditor.js @@ -2190,13 +2190,12 @@ export default class StrivenEditor { [...body.querySelectorAll('.se-link-options')].forEach((lOpt) => lOpt.remove()); [...body.querySelectorAll('.se-image-options')].forEach((iOpt) => iOpt.remove()); - if (body.textContent || se.body.getElementsByTagName('img').length) { - // const htmlView = !!se.editor.querySelector('.se-html'); - return body.innerHTML; - } else { - return null; - } + if (body.textContent || se.body.getElementsByTagName('img').length || se.body.getElementsByTagName('iframe').length) { + return body.innerHTML; + } else { + return null; } + } /** * Get the range of the window @@ -3098,36 +3097,35 @@ export default class StrivenEditor { }); } - /** - * Creates links - * @parma {HTMLElement} Element to convert links in - */ - createLinks(el) { - const se = this; - linkify( - el || se.body, - { - target: { - url: '_blank' - }, - className: 'linkified', - validate: { - email: function (value) { - return false; - } - } - }, - document - ); - - var links = []; - if (el) { - const linkElements = el.getElementsByTagName('a'); - if (linkElements.length > 0) { - links = [...linkElements]; + /** + * Creates links + * @parma {HTMLElement} Element to convert links in + */ + createLinks(el) { + const se = this; + const htmlView = !!se.editor.querySelector('.se-html'); + if (!htmlView) { + linkify(el || se.body, + { + target: { + url: '_blank' + }, + className: 'linkified', + validate: { + email: function (value) { + return false; } - } - this.makeLinksClickable(links); + } + }, document); + } + var links = []; + if (el) { + const linkElements = el.getElementsByTagName('a'); + if (linkElements.length > 0) { + links = [...linkElements]; + } + } + this.makeLinksClickable(links); // Trigger input event let inpEvent = new Event('input', { cancelable: true, bubbles: true });