Skip to content

Commit

Permalink
fix(blocklist): Open balloon only for collapsed selections when click…
Browse files Browse the repository at this point in the history
…ing in the editor.
  • Loading branch information
JensDallmann committed Nov 1, 2023
1 parent 5de4720 commit 634fbeb
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions packages/ckeditor5-coremedia-blocklist/src/blocklistui.ts
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,14 @@ export default class Blocklistui extends Plugin {

// Handle click on view document and show panel when selection is placed inside a blocked element.
this.listenTo<ViewDocumentClickEvent>(viewDocument, "click", () => {
const view = this.editor.editing.view;
const selection = view.document.selection;
if (!selection.isCollapsed) {
// If an author is selecting a range of text, we suppose that the authors intention
// is not to open the blocked words balloon even if blocked words are part of the selection.
return;
}

const blockedWords = this.#getSelectedBlocklistWords();
if (!blockedWords || blockedWords.length === 0) {
return;
Expand Down

0 comments on commit 634fbeb

Please sign in to comment.