Skip to content

Commit

Permalink
fix #1633
Browse files Browse the repository at this point in the history
  • Loading branch information
jhchen committed Aug 27, 2017
1 parent ec02e8f commit c7a05cb
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions core/selection.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,16 +110,18 @@ class Selection {
}

handleEmbedSelection() {
this.root.addEventListener('click', (e) => {
const blot = Parchment.find(e.target, true);
this.emitter.on(Emitter.events.SELECTION_CHANGE, () => {
const selectedNode = document.querySelector('.ql-embed-selected');
if (selectedNode) {
selectedNode.classList.remove('ql-embed-selected');
}
});
this.root.addEventListener('click', (e) => {
const blot = Parchment.find(e.target, true);
if (blot instanceof Parchment.Embed) {
blot.domNode.classList.add('ql-embed-selected');
const range = new Range(blot.offset(scroll), blot.length());
this.setRange(range, Emitter.sources.USER);
blot.domNode.classList.add('ql-embed-selected');
}
});
}
Expand Down

0 comments on commit c7a05cb

Please sign in to comment.