Skip to content

Commit

Permalink
fix #747
Browse files Browse the repository at this point in the history
  • Loading branch information
jhchen committed Jul 14, 2016
1 parent 004f725 commit a6de7fe
Showing 1 changed file with 13 additions and 15 deletions.
28 changes: 13 additions & 15 deletions ui/link-tooltip.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,24 +26,22 @@ class LinkTooltip {
event.preventDefault();
}
});
['mousedown', 'touchstart'].forEach((name) => {
this.container.querySelector('a.ql-action').addEventListener(name, (event) => {
if (this.container.classList.contains('ql-editing')) {
this.save();
event.preventDefault();
} else {
this.edit();
event.preventDefault();
}
});
this.container.querySelector('a.ql-remove').addEventListener(name, (event) => {
this.remove();
this.container.querySelector('a.ql-action').addEventListener('click', (event) => {
if (this.container.classList.contains('ql-editing')) {
this.save();
event.preventDefault();
} else {
this.edit();
event.preventDefault();
});
}
});
this.container.querySelector('a.ql-remove').addEventListener('click', (event) => {
this.remove();
event.preventDefault();
});
quill.on(Quill.events.SELECTION_CHANGE, (range) => {
if (range == null && document.activeElement == this.textbox) return;
if (range != null && range.length === 0) {
if (range == null) return;
if (range.length === 0) {
let offset;
[this.link, offset] = this.quill.scroll.descendant(LinkBlot, range.index);
if (this.link != null) {
Expand Down

0 comments on commit a6de7fe

Please sign in to comment.