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 12ff34c3404dd989b49d82f039bc6bb2c4981cea
parent 40744dcf092f4943f435ad79d739f163321b5d26
Author: unitehenry <unitehenry@gmail.com>
Date:   Thu,  3 Sep 2020 14:41:11 -0400

Merge branch 'dev'

Diffstat:
Mpackage-lock.json | 2+-
Mpackage.json | 2+-
Msrc/striveneditor.css | 4++++
Msrc/striveneditor.js | 34+++++++++++++++++++++++-----------
4 files changed, 29 insertions(+), 13 deletions(-)

diff --git a/package-lock.json b/package-lock.json @@ -1,6 +1,6 @@ { "name": "@striven-erp/striven-editor", - "version": "3.5.3", + "version": "3.6.1", "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.6.1", + "version": "3.6.2", "description": "The editor used for the Striven ERP system.", "main": "./dist", "scripts": { diff --git a/src/striveneditor.css b/src/striveneditor.css @@ -34,6 +34,10 @@ color: #777; } +.striven-editor .se-body table { + width: max-content; +} + .striven-editor .se-body .se-file-drop-dropzone { height: 90%; width: 95%; diff --git a/src/striveneditor.js b/src/striveneditor.js @@ -873,7 +873,11 @@ export default class StrivenEditor { body.style.height = this.editor.style.height; body.style.minHeight = this.editor.style.minHeight; body.style.maxHeight = this.editor.style.maxHeight; - + + this.editor.setAttribute('height', this.editor.style.height); + this.editor.setAttribute('min-height', this.editor.style.minHeight); + this.editor.setAttribute('max-height', this.editor.style.maxHeight); + this.editor.style.height = 'auto'; this.editor.style.minHeight = 'auto'; this.editor.style.maxHeight = 'auto'; @@ -2807,7 +2811,11 @@ export default class StrivenEditor { se.overflow(); se.editor.style.maxHeight = null; - se.body.style.height = se.editor.style.height; + + se.body.style.height = se.editor.getAttribute('height'); + se.body.style.minHeight = se.editor.getAttribute('min-height'); + se.body.style.maxHeight = se.editor.getAttribute('max-height'); + opt.removeAttribute('data-fullscreen'); } else { blowUpElement(se.editor, '#fff', e => { @@ -2916,33 +2924,37 @@ export default class StrivenEditor { } break; case 'insertOrderedList': - if(!this.range && !this.getContent()) { + if(!se.body.textContent) { const list = document.createElement('ol'); - list.append(document.createElement('li')); + const item = document.createElement('li'); + list.append(item); this.body.append(list); - const r = new Range(); + const r = se.range || new Range(); + window.getSelection().removeAllRanges(); window.getSelection().addRange(r); - r.selectNode(list); + r.selectNode(item); return false; } if (this.browser.isFirefox() || this.browser.isEdge()) { - document.execCommand(command); + document.execCommand(command, false); } else { document.execCommand(command); } break; case 'insertUnorderedList': - if(!this.range && !this.getContent()) { + if(!se.body.textContent) { const list = document.createElement('ul'); - list.append(document.createElement('li')); + const item = document.createElement('li'); + list.append(item); this.body.append(list); - const r = new Range(); + const r = se.range || new Range(); + window.getSelection().removeAllRanges(); window.getSelection().addRange(r); r.selectNode(list); @@ -2950,7 +2962,7 @@ export default class StrivenEditor { } if (this.browser.isFirefox() || this.browser.isEdge()) { - document.execCommand(command); + document.execCommand(command, false); } else { document.execCommand(command); }