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 79782e067555eb7a320e13d7645d0d479dba0c07
parent 3175b821c326135b81d33a64ee921229cad085a4
Author: sanjogs <sanjogsharma@gmail.com>
Date:   Fri, 26 May 2023 15:08:49 -0400

enabled ctrl+ click to open links inside the editor #157

Diffstat:
Msrc/striveneditor.js | 11+++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/src/striveneditor.js b/src/striveneditor.js @@ -2955,8 +2955,15 @@ export default class StrivenEditor { }; link.onclick = e => { - - if (!link.querySelector('.se-link-options')) { + if(e.ctrlKey || e.metaKey){ + const anchor = document.createElement('a'); + anchor.setAttribute('href', link.getAttribute('href')); + anchor.setAttribute('target', '_blank'); + document.body.append(anchor); + anchor.click(); + anchor.remove(); + } + else if (!link.querySelector('.se-link-options')) { const linkOptions = document.createElement('span'); linkOptions.setAttribute('class', 'se-link-options'); linkOptions.setAttribute('contenteditable', false);