Skip to content

Commit

Permalink
only show tooltips on user initiated range change
Browse files Browse the repository at this point in the history
closes #1193
  • Loading branch information
jhchen committed Jan 1, 2017
1 parent 2df72b2 commit 45f8b02
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions themes/bubble.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
4 changes: 2 additions & 2 deletions themes/snow.js
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down

0 comments on commit 45f8b02

Please sign in to comment.