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 7f584777eba49ab97aaa0e68b7b92385aa67624b
parent 4dfa8ffbe425a8e9f943e3568491f7ff1eceb5bc
Author: unitehenry <unitehenry@gmail.com>
Date:   Tue,  4 Aug 2020 16:00:57 -0400

3.5.4 onPaste

Diffstat:
Mpackage-lock.json | 2+-
Mpackage.json | 2+-
Msrc/striveneditor.js | 14++++++++++++--
3 files changed, 14 insertions(+), 4 deletions(-)

diff --git a/package-lock.json b/package-lock.json @@ -1,6 +1,6 @@ { "name": "@striven-erp/striven-editor", - "version": "3.5.02", + "version": "3.5.3", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json @@ -1,7 +1,7 @@ { "name": "@striven-erp/striven-editor", "private": false, - "version": "3.5.3", + "version": "3.5.4", "description": "The editor used for the Striven ERP system.", "main": "./dist", "scripts": { diff --git a/src/striveneditor.js b/src/striveneditor.js @@ -895,6 +895,17 @@ export default class StrivenEditor { // Paste Handler body.onpaste = e => { + + // Editor Paste Handler + if(this.options.onPaste) { + const content = this.options.onPaste(e); + if(content) { + e.preventDefault(); + this.executeCommand('insertHTML', content); + return true; + } + } + // Convert envoding to file function dataURLtoFile(dataurl, filename) { var arr = dataurl.split(','), @@ -1012,8 +1023,7 @@ export default class StrivenEditor { } } - // Editor Paste Handler - this.options.onPaste && this.options.onPaste(e); + // After the paste setTimeout(() => {