diff --git a/themes/bubble.js b/themes/bubble.js index 266a12391a..8a759bce28 100644 --- a/themes/bubble.js +++ b/themes/bubble.js @@ -46,9 +46,9 @@ BubbleTheme.DEFAULTS = extend(true, {}, BaseTheme.DEFAULTS, { class BubbleTooltip extends BaseTooltip { constructor(quill, bounds) { super(quill, bounds); - this.quill.on(Emitter.events.EDITOR_CHANGE, (type, range) => { + this.quill.on(Emitter.events.EDITOR_CHANGE, (type, range, oldRange, source) => { if (type !== Emitter.events.SELECTION_CHANGE) return; - if (range != null && range.length > 0) { + if (range != null && range.length > 0 && source === Quill.sources.USER) { this.show(); // Lock our width so we will expand beyond our offsetParent boundaries this.root.style.left = '0px'; diff --git a/themes/snow.js b/themes/snow.js index 7028b72f35..5158b21453 100644 --- a/themes/snow.js +++ b/themes/snow.js @@ -83,9 +83,9 @@ class SnowTooltip extends BaseTooltip { event.preventDefault(); this.hide(); }); - this.quill.on(Emitter.events.SELECTION_CHANGE, (range) => { + this.quill.on(Emitter.events.SELECTION_CHANGE, (range, oldRange, source) => { if (range == null) return; - if (range.length === 0) { + if (range.length === 0 && source === Quill.sources.USER) { let [link, offset] = this.quill.scroll.descendant(LinkBlot, range.index); if (link != null) { this.linkRange = new Range(range.index - offset, link.length());