Skip to content

Commit

Permalink
fix(blocklist): Show selected block words if balloon is opened with k…
Browse files Browse the repository at this point in the history
…eyboard shortcut.
  • Loading branch information
JensDallmann committed Nov 1, 2023
1 parent cf65d08 commit 0dc2a58
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
4 changes: 2 additions & 2 deletions itest/src/BlocklistExpandedKeyboard.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ describe("Blocklist", () => {
await expect(input).not.waitToBeVisible();

await useOpenBlocklistShortcut();
await expect(input).waitToBeVisible();
await expect(view.body.balloonPanel.blocklistActionsView).waitToBeVisible();
const allBlockedWords = await blocklistActionsView.allBlockedWords;
await expect(allBlockedWords.length).toBe(2);
await expect(allBlockedWords).toContain(blockedWord.toLowerCase());
Expand All @@ -66,5 +66,5 @@ const useOpenBlocklistShortcut = async () => {
// Open Blocklist Balloon via Shortcut
await page.keyboard.down(await ctrlOrMeta());
await page.keyboard.down("Shift");
await page.keyboard.press("B");
await page.keyboard.press("b");
};
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 @@ -303,6 +303,14 @@ export default class Blocklistui extends Plugin {
cancel();

if (editor.commands.get(BLOCKLIST_COMMAND_NAME)?.isEnabled) {
const blockedWords = this.#getSelectedBlocklistWords();
if (!blockedWords || blockedWords.length === 0) {
this.#showBlocklistBalloon(true);
return;
}

// Set the currently selected words in the blocklist command
this.blocklistCommand?.set("value", blockedWords);
this.#showBlocklistBalloon(true);
}
});
Expand Down

0 comments on commit 0dc2a58

Please sign in to comment.