From 45f8b02b5d2cd15c99607b202c70da4612a468a9 Mon Sep 17 00:00:00 2001 From: Jason Chen Date: Sun, 1 Jan 2017 14:08:58 -0800 Subject: [PATCH] only show tooltips on user initiated range change closes #1193 --- themes/bubble.js | 4 ++-- themes/snow.js | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) 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());