commit ed31fb773460ee73abc66f9d1ee21ef8915be075 parent aae01f0487a58435c0199121593b6caf96d021c5 Author: unitehenry <unitehenry@gmail.com> Date: Thu, 31 Oct 2019 13:33:49 -0400 edge fix Diffstat:
| M | src/striveneditor.js | | | 21 | ++++++++++++--------- |
1 file changed, 12 insertions(+), 9 deletions(-)
diff --git a/src/striveneditor.js b/src/striveneditor.js @@ -148,6 +148,7 @@ export default class StrivenEditor { this.body.onblur = () => { bodyBlur && bodyBlur(); this.overflow(); + setTimeout(() => { if ( this.linkMenu.dataset.active !== "true" @@ -549,7 +550,7 @@ export default class StrivenEditor { const bodyFocus = body.onfocus; body.onfocus = () => { - this.setRange(); + !this.browser.isEdge() && this.setRange(); body.textContent && this.toolbarState(); bodyFocus && bodyFocus(); } @@ -621,14 +622,16 @@ export default class StrivenEditor { } // insert link on no selection - if (this.browser.isFirefox() && this.range.startOffset === this.range.endOffset) { - const link = document.createElement('a'); - link.href = linkValue; - link.textContent = linkValue; - - this.range.insertNode(link); - this.range.selectNode(link); - this.range.collapse(); + if (this.browser.isFirefox() || this.browser.isEdge()) { + if (this.range.startOffset === this.range.endOffset) { + const link = document.createElement('a'); + link.href = linkValue; + link.textContent = linkValue; + + this.range.insertNode(link); + this.range.selectNode(link); + this.range.collapse(); + } } const bodyLinks = this.body.querySelectorAll("a");