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 f996050dc102b7e0e08ac3b2951fa9a4d946c0bc
parent 1014e728122d4f52490e8b4cf366bfb528e72b8b
Author: unitehenry <unitehenry@gmail.com>
Date:   Wed, 11 Dec 2019 16:43:22 -0500

resize observer

Diffstat:
Mdemo/src/App.vue | 9+++++----
Mpackage-lock.json | 2+-
Msrc/striveneditor.js | 9+++------
3 files changed, 9 insertions(+), 11 deletions(-)

diff --git a/demo/src/App.vue b/demo/src/App.vue @@ -14,6 +14,7 @@ style="min-height: 300px; width: 800px;" :meta-url="metaUrl" :on-enter="submitOnEnter" + :toolbar-template="customButton" ></striven-editor> <!-- TESTING --> @@ -21,10 +22,10 @@ <!-- <button @click="chromeOut">isChrome</button> --> <!-- <button @click="insertList">insertUnorderedList</button> --> - <!-- <div v-html="content"></div> --> - <!-- <div ref="customButton" style="display: flex; align-items: flex-end;"> --> - <!-- <div class="custom-button" @click="sendContent">Send</div> --> - <!-- </div> --> + <div v-html="content"></div> + <div ref="customButton" style="display: flex; align-items: flex-end;"> + <div class="custom-button" @click="sendContent">Send</div> + </div> </div> </template> diff --git a/package-lock.json b/package-lock.json @@ -1,6 +1,6 @@ { "name": "@striven-erp/striven-editor", - "version": "2.7.9", + "version": "2.8.0", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/src/striveneditor.js b/src/striveneditor.js @@ -1113,8 +1113,7 @@ export default class StrivenEditor { responsiveMinimal(false); } - const windowResize = window.onresize; - window.onresize = () => { + const ro = new ResizeObserver(e => { this.closeAllMenus(); if (this.editor.offsetWidth < 300) { @@ -1122,10 +1121,8 @@ export default class StrivenEditor { } else { responsiveMinimal(false); } - - windowResize && windowResize(); - } - + }); + ro.observe(this.editor); } }