Build your personal knowledge base with Trilium Notes
TypeScript electronelectron-appknowledge-baseknowledge-graphknowledge-managementknowledge-management-graphlocal-firstnote-managmentnote-takernote-takingnotebooknotesnotes-apppersonal-knowledge-basepersonal-wikiscriptableself-hostedself-hostingwiki
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.tsindex 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.tsindex 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): SlashCommandDefinitioid: "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"},