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
client/text editor: fix some issues
Adorian Doranab36cd8e5602
diff --git a/apps/client/src/stylesheets/style.css b/apps/client/src/stylesheets/style.cssindex 748bfb1b10..5dca8cb2a3 100644--- a/apps/client/src/stylesheets/style.css+++ b/apps/client/src/stylesheets/style.css@@ -2583,9 +2583,9 @@ body.zen:not(.experimental-feature-new-layout) {transition: opacity 100ms linear;}- /* A group's submenu pins its panel outside the note split, where `:focus-within` cannot see it. */+ /* An open dropdown holds the toolbar up: hovering its submenu takes focus out of the split. */.note-split:focus-within .ribbon-container,- &:has(.ck-toolbar-group-menu__panel) .ribbon-container {+ .ribbon-container:has(.ck-dropdown__panel-visible) {opacity: 1; /* Show when the note split is focused */}@@ -2609,7 +2609,7 @@ body.zen:not(.experimental-feature-new-layout) {}.note-split:focus-within .ribbon-container .classic-toolbar-widget,- &:has(.ck-toolbar-group-menu__panel) .ribbon-container .classic-toolbar-widget {+ .ribbon-container:has(.ck-dropdown__panel-visible) .classic-toolbar-widget {pointer-events: all;}@@ -2654,10 +2654,10 @@ body.zen.experimental-feature-new-layout {backdrop-filter: blur(6px);}- /* A group's submenu pins its panel outside the note split, where `:focus-within` cannot see it. */+ /* An open dropdown holds the toolbar up: hovering its submenu takes focus out of the split. */#root-widget:has(.note-split.type-text:focus-within) .classic-toolbar-widget,.classic-toolbar-widget:focus-within,- &:has(.ck-toolbar-group-menu__panel) .classic-toolbar-widget {+ .classic-toolbar-widget:has(.ck-dropdown__panel-visible) {opacity: 1; /* Show when the note split is focused */pointer-events: all;}diff --git a/packages/ckeditor5/src/plugins/toolbar_group_menu.spec.ts b/packages/ckeditor5/src/plugins/toolbar_group_menu.spec.tsindex bb2f919da0..32f3f8ef33 100644--- a/packages/ckeditor5/src/plugins/toolbar_group_menu.spec.ts+++ b/packages/ckeditor5/src/plugins/toolbar_group_menu.spec.ts@@ -143,8 +143,7 @@ describe("ToolbarGroupMenu", () => {const submenu = openSubmenu(dropdown);expect(submenu.buttonView.label).toBe("Insert sample");expect(submenu.buttonView.icon).toBe("<svg />");- // The panel is pinned into the editor's body, so the client's stylesheet finds it by this- // class alone — Zen mode reads it to keep the toolbar up while the submenu is open.+ // `toolbar_group_menu.css` sizes the icons of a panel pinned into the body by this class.expect(submenu.panelView.class).toBe("ck-toolbar-group-menu__panel");expect(itemLabels(submenu.listView.items)).toStrictEqual(["Flowchart", "Sequence"]);});@@ -265,14 +264,14 @@ describe("ToolbarGroupMenu", () => {const dropdown = openDropdown(getToolbar(editor), "Insert");- // The group of the list holds rows the menu has no place for, so it is left out; the- // unnamed row is drawn all the same, since its view is what runs.+ // `listEntriesOf()` skips a `ListItemGroupView`, and `labelOf()` names an unlabeled+ // button "", which still runs on execute.const rows = itemLabels(openSubmenu(dropdown).listView.items);expect(rows).toStrictEqual(["First", "—", ""]);});- // A rule at the very head is CKEditor's to drop, so the only way one reaches the menu with- // nothing drawn before it is behind an item the menu passed over.+ // `_cleanSeparatorsAndLineBreaks()` drops a leading `|`, so `plan.definition` can only be+ // empty at a separator when `planGroupMenu()` skipped the item before it.it("passes over an item it has no row for, and the rule that follows it", async () => {const editor = await createTestEditor(PLUGINS, {toolbar: {diff --git a/packages/ckeditor5/src/plugins/toolbar_group_menu.ts b/packages/ckeditor5/src/plugins/toolbar_group_menu.tsindex 8f42bdbbc9..511bbf6897 100644--- a/packages/ckeditor5/src/plugins/toolbar_group_menu.ts+++ b/packages/ckeditor5/src/plugins/toolbar_group_menu.ts@@ -212,9 +212,7 @@ export default class ToolbarGroupMenu extends Plugin {}/**- * Puts a control that carries a panel of its own into the row held for it, in place of the button- * standing there. The control keeps its panel and opens it from inside the menu; a row merely- * firing it would open that panel on the strip the menu replaced, where nothing can reach it.+ * Replaces the button in `id`'s row with `source`, so it opens its own panel from the menu.*/function mountControl(menuView: DropdownMenuRootListView, plan: MenuPlan, id: string, source: DropdownView@@ -373,11 +371,8 @@ function describeRow(plan: MenuPlan, id: string, view: SourceButton) {}/**- * Describes a dropdown of the group as a submenu over the rows of its own list. Where the dropdown- * is a split button, pressing the opener runs the action of its button half and the submenu stays- * the way to the rest, as a row of the note tree's context menu does.- *- * The submenu is described empty and drawn on the way open, by `ToolbarGroupMenu#fillSubmenu`.+ * Describes `dropdown` as a submenu, which `ToolbarGroupMenu#fillSubmenu()` draws on the way open.+ * A `SplitButtonView` opener also runs its own action, as a note tree context menu row does.*/function planSubmenu(plan: MenuPlan, takeId: () => string, dropdown: DropdownView) {const opener = dropdown.buttonView;