Skip to content

Build your personal knowledge base with Trilium Notes

feat(slash commands): find the collapsible block by more names

Elian Doran82702c430868
diff --git a/packages/ckeditor5/src/plugins/mention/slash_commands.spec.ts b/packages/ckeditor5/src/plugins/mention/slash_commands.spec.ts
index cb6bc0084e..68ad48e821 100644
--- a/packages/ckeditor5/src/plugins/mention/slash_commands.spec.ts
+++ b/packages/ckeditor5/src/plugins/mention/slash_commands.spec.ts
@@ -555,6 +555,20 @@ describe("buildTriliumSlashCommands", () => {
expect(executeSpy).toHaveBeenCalledWith("alignment", { value });
});
+ it("finds the collapsible block under the names other editors give it", () => {
+ const definitions = buildTriliumSlashCommands(editor);
+
+ // "collapse" earns its place among the aliases: the title starts with "collapsi", so
+ // a fully typed "collapse" matches neither its prefix nor a substring of it.
+ for (const query of [
+ "details", "fold", "toggle", "collapse", "expand", "accordion", "spoiler",
+ "summary", "disclosure", "hide"
+ ]) {
+ expect(matchSlashCommands(definitions, query).map((entry) => entry.id))
+ .toContain("collapsible");
+ }
+ });
+
it("defines one entry per admonition type, each applying its own type", () => {
const { fake, executeSpy } = makeFakeEditor();
diff --git a/packages/ckeditor5/src/plugins/mention/slash_commands.ts b/packages/ckeditor5/src/plugins/mention/slash_commands.ts
index eff6fda7a5..058b8f07fa 100644
--- a/packages/ckeditor5/src/plugins/mention/slash_commands.ts
+++ b/packages/ckeditor5/src/plugins/mention/slash_commands.ts
@@ -329,7 +329,10 @@ export function buildTriliumSlashCommands(editor: Editor): SlashCommandDefinitio
id: "collapsible",
title: t("Collapsible block"),
description: t("Insert a toggleable section that hides/shows content on click."),
- aliases: [ "details", "fold", "toggle" ],
+ aliases: [
+ "details", "fold", "toggle", "collapse", "expand", "accordion", "spoiler",
+ "summary", "disclosure", "hide"
+ ],
icon: collapsibleIcon,
commandName: "collapsible"
},