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(attributes): a toolbar above the cards for adding, pasting and the selection
Elian Doran7f13ba0834a9
diff --git a/apps/client/src/widgets/sidebar/AttributeList.css b/apps/client/src/widgets/sidebar/AttributeList.cssindex 79f9f87082..356c38a78f 100644--- a/apps/client/src/widgets/sidebar/AttributeList.css+++ b/apps/client/src/widgets/sidebar/AttributeList.css@@ -116,47 +116,34 @@display: none;}-/*- * Sticky at the bottom of the scrolled tab, so it stays in view however far the selected rows are- * scrolled. The background lays the card fill over the opaque app surface, so rows scrolling under the- * bar do not show through it.- */-.attribute-selection-bar {+/* A fixed height, so that a selection starting or ending does not move the cards below. Sticky so that+ it stays in view on a phone, where the whole sheet scrolls. */+.attribute-toolbar {position: sticky;- bottom: 0;+ top: 0;z-index: 1;+ flex-shrink: 0;display: flex;align-items: center;gap: 2px;- padding: 2px 3px 2px 10px;- margin: 6px 4px 4px;- border: 1px solid var(--card-border-color, var(--main-border-color));- border-radius: 10px;- box-shadow: var(--card-box-shadow, none);+ height: 34px;+ padding-inline: 4px;+ border-bottom: 1px solid var(--main-border-color);background-color: var(--main-background-color);- background-image: linear-gradient(- var(--card-background-color, var(--accented-background-color)),- var(--card-background-color, var(--accented-background-color)));-}+ --icon-button-size: 26px;-/* A phone's cards already paint the card fill, which would make the bar the same color as them. */-body.mobile .attribute-selection-bar {- background-image: none;-}+ .attribute-selection-count {+ color: var(--muted-text-color);+ font-size: 0.85em;+ white-space: nowrap;+ }-.attribute-selection-bar .attribute-selection-count {- /* Pushes the buttons to the trailing edge, where the values read from. */- margin-inline-end: auto;- color: var(--muted-text-color);- font-size: 0.85em;-}--/* At the compact size the row's own actions keep, the two rows of buttons reading as one kind. */-.attribute-selection-bar .icon-action {- --icon-button-size: 24px;- --icon-button-icon-ratio: 0.8;-- border-radius: 50%;+ .attribute-toolbar-actions {+ display: flex;+ align-items: center;+ gap: 2px;+ margin-inline-start: auto;+ }}/* The card titles are uppercase and letter-spaced; the count is not. */@@ -325,7 +312,7 @@ body.mobile .attribute-selection-bar {/* Not while editing: the actions — later in the DOM — would paint over the very overlay thatreplaces them. Nor while rows are being picked out: a row's own actions are about the one row,- which is not what is being done then, and the foot of the card carries what is. */+ which is not what is being done then, and the toolbar carries what is. */.attribute-list-panel:not(.selecting) .attribute-row:not(.editing):is(:hover, .active) .attribute-row-actions {display: flex;}diff --git a/apps/client/src/widgets/sidebar/AttributeList.mobile.spec.tsx b/apps/client/src/widgets/sidebar/AttributeList.mobile.spec.tsxindex ba1f1254ba..d78f2566e2 100644--- a/apps/client/src/widgets/sidebar/AttributeList.mobile.spec.tsx+++ b/apps/client/src/widgets/sidebar/AttributeList.mobile.spec.tsx@@ -69,12 +69,13 @@ describe("AttributeList on a phone", () => {expect(section("attributes-owned").querySelector(".attribute-row")?.className).toContain("dropdown-item");});- it("keeps the ways in on the cards' own headers, there being no row to hover for one", () => {+ it("adds from the toolbar and the cards' own headers, there being no row to hover for one", () => {renderPanel(noteWithRuns());- // The panel's own two ride on the first card, there being no header above the cards; the- // menu is also the only way to a relation here, whose creation editor is a pointer's.- expect(iconsIn(header("attributes-owned"))).toEqual([ "bx bx-help-circle", "bx bx-plus" ]);+ // The toolbar's menu adds any kind; it is also the only way to a relation here, whose creation+ // editor is a pointer's.+ expect(iconsIn(toolbar())).toEqual([ "bx bx-plus" ]);+ expect(iconsIn(header("attributes-owned"))).toEqual([ "bx bx-help-circle" ]);// Each card has its own help. A run that can be added to also has an add button, definitions// included; the inherited run, whose attributes belong to another note, has none.expect(iconsIn(header("attributes-definitions"))).toEqual([ "bx bx-help-circle", "bx bx-plus" ]);@@ -96,25 +97,22 @@ describe("AttributeList on a phone", () => {expect(sectionIds()).toEqual([ "attributes-owned" ]);});- it("offers pasting from the first card's header, which is a phone's only way to it", async () => {- // Nothing copied, nothing offered — as the row menu and the selection's bar do.+ it("offers pasting from the toolbar, which is a phone's only way to it", async () => {+ // Nothing copied, nothing offered, as in the row menu.renderPanel(noteWithRuns());- expect(iconsIn(header("attributes-owned"))).not.toContain("bx bx-paste");+ expect(iconsIn(toolbar())).not.toContain("bx bx-paste");- // The note that most wants pasting into is the one carrying nothing, and it is exactly the- // note where every other way in is gone: no row to hold down, so no selection and no bar,- // and the list a press beside the rows would land on has no rows to give it a height. The- // header stands whatever the run holds, which is why the way in belongs there.+ // A note with no attributes has no row to hold down or press beside, so the toolbar is the+ // only way to paste onto it.render(null, container);holdAttributes([ { type: "label", name: "author", value: "Elian", isInheritable: false } ]);renderPanel(buildNote({ id: "phone-bare", title: "Bare" }));expect(container.querySelectorAll(".attribute-row")).toHaveLength(0);- expect(container.querySelector(".attribute-selection-bar")).toBeNull();- expect(iconsIn(header("attributes-owned"))).toEqual([ "bx bx-help-circle", "bx bx-paste", "bx bx-plus" ]);+ expect(iconsIn(toolbar())).toEqual([ "bx bx-paste", "bx bx-plus" ]);// The button opens the clipboard menu, whose Paste row pastes.- const toggle = header("attributes-owned")?.querySelector<HTMLElement>(".attribute-clipboard > button");+ const toggle = toolbar()?.querySelector<HTMLElement>(".attribute-clipboard > button");expect(toggle).not.toBeNull();act(() => toggle?.click());const paste = document.querySelector(".tn-dropdown-portal .bx-paste")?.closest<HTMLElement>("[role=menuitem]");@@ -125,12 +123,12 @@ describe("AttributeList on a phone", () => {expect(url).toBe("notes/phone-bare/attributes");expect(saved).toEqual([ { type: "label", name: "author", value: "Elian", isInheritable: false } ]);- // A note that cannot be edited has no paste button, even with attributes held.+ // A note that cannot be edited has nothing to paste or add, so it has no toolbar.render(null, container);const locked = buildNote({ id: "phone-locked", title: "Locked" });locked.isContentWritable = false;renderPanel(locked);- expect(iconsIn(header("attributes-owned"))).toEqual([ "bx bx-help-circle" ]);+ expect(toolbar()).toBeNull();});it("still picks rows out, by the press held down, and says what can be done with them", () => {@@ -150,12 +148,10 @@ describe("AttributeList on a phone", () => {expect(row?.querySelector(".bx-check")).not.toBeNull();expect(container.querySelector(".attribute-list-panel")?.className).toContain("selecting");- // The bar stands after the cards, the rows it acts on being picked out among any of them.- const bar = container.querySelector(".attribute-selection-bar");- expect(bar).not.toBeNull();- expect(iconsIn(bar)).toEqual([ "bx bx-copy", "bx bx-trash", "bx bx-x" ]);- expect(bar?.compareDocumentPosition(section("attributes-definitions")))- .toBe(Node.DOCUMENT_POSITION_PRECEDING);+ // The toolbar above the cards turns over to the selection.+ expect(iconsIn(toolbar())).toEqual([ "bx bx-x", "bx bx-copy", "bx bx-trash", "bx bx-plus" ]);+ expect(toolbar()?.compareDocumentPosition(section("attributes-owned")))+ .toBe(Node.DOCUMENT_POSITION_FOLLOWING);});function renderPanel(note: FNote) {@@ -168,6 +164,10 @@ describe("AttributeList on a phone", () => {.map((el) => [ ...el.classList ].find((name) => name.startsWith("attributes-")));}+ function toolbar() {+ return container.querySelector<HTMLElement>(".attribute-toolbar");+ }+function section(id: string) {const el = container.querySelector<HTMLElement>(`.options-section.${id}`);expect(el, id).not.toBeNull();diff --git a/apps/client/src/widgets/sidebar/AttributeList.spec.tsx b/apps/client/src/widgets/sidebar/AttributeList.spec.tsxindex 61e847c617..1279036805 100644--- a/apps/client/src/widgets/sidebar/AttributeList.spec.tsx+++ b/apps/client/src/widgets/sidebar/AttributeList.spec.tsx@@ -375,7 +375,7 @@ describe("AttributeList", () => {// One list, so one button, and it offers every kind: the definitions had a button of their// own while they had a card of their own, which offered nothing this one does not.- const addButton = container.querySelector<HTMLElement>(".card-header-buttons .bx-plus");+ const addButton = container.querySelector<HTMLElement>(".attribute-toolbar .bx-plus");act(() => addButton?.click());// Four kinds and the rule setting the definitions apart from what they define.@@ -420,7 +420,7 @@ describe("AttributeList", () => {it("creates a label straight in its row, and a draft left nameless not at all", async () => {renderPanel(noteWithAttributes());- const ownedMenu = container.querySelector<HTMLElement>(".card-header-buttons .bx-plus");+ const ownedMenu = container.querySelector<HTMLElement>(".attribute-toolbar .bx-plus");act(() => ownedMenu?.click());act(() => showContextMenu.mock.calls[0][0].items[0].handler?.());@@ -520,7 +520,7 @@ describe("AttributeList", () => {buildNote({ id: "target-note", title: "Target" });renderPanel(noteWithAttributes());- act(() => container.querySelector<HTMLElement>(".card-header-buttons .bx-plus")?.click());+ act(() => container.querySelector<HTMLElement>(".attribute-toolbar .bx-plus")?.click());act(() => showContextMenu.mock.calls[0][0].items[1].handler?.());const editor = container.querySelector<HTMLElement>(".attribute-creation-editor");@@ -919,7 +919,7 @@ describe("AttributeList", () => {expect(document.querySelector(".attr-detail")).toBeNull();// With none picked out it is the one attribute it landed on again.- act(() => barButton("bx bx-x")?.click());+ act(() => toolbarButton("bx bx-x")?.click());act(() => rows()[1].click());expect(selectedNames()).toEqual([]);expect(document.querySelector(".attr-detail")).not.toBeNull();@@ -1100,44 +1100,57 @@ describe("AttributeList", () => {checkbox(0).click();expect(selectedNames()).toEqual([ "template" ]);++ // The theme draws the box on the label, over the input, so that is where a press lands. A+ // browser would pass it on to the input as a second click, after re-rendering, which toggled+ // the row straight back; the label's press is the only one.+ const part = (selector: string) =>+ container.querySelectorAll(".attribute-kind-check")[1]?.querySelector<HTMLElement>(selector);+ expect(part("label")).not.toBeNull();+ const inputClicks = vi.fn();+ part("input")?.addEventListener("click", inputClicks);++ act(() => part("label")?.click());+ expect(selectedNames()).toEqual([ "cssClass", "template" ]);+ act(() => part("label")?.click());+ expect(selectedNames()).toEqual([ "template" ]);+ expect(inputClicks).not.toHaveBeenCalled();});- it("stands a bar at the foot of the list saying what can be done to the rows picked out", async () => {+ it("turns the toolbar over to the selected rows, keeping paste and add where they were", async () => {+ writeAttributes(null, []);renderPanel(noteWithAttributes());- // Nothing picked out: no bar, and the list says it is not picking rows out — which is what- // draws the checkboxes.- expect(container.querySelector(".attribute-selection-bar")).toBeNull();+ // Nothing selected: the toolbar holds adding alone, nothing being held to paste, and the list+ // draws no checkboxes.+ expect(toolbarIcons()).toEqual([ "bx bx-plus" ]);expect(firstPanel().className).not.toContain("selecting");checkbox(0).click();- const bar = container.querySelector(".attribute-selection-bar");- expect(bar).not.toBeNull();+ checkbox(1).click();expect(firstPanel().className).toContain("selecting");- // The bar follows the cards rather than sitting in one, since a selection can span several.- expect(bar?.closest(".card")).toBeNull();- // Adding an attribute stays on offer beside the note's own rows; the bar took nothing over.- expect(container.querySelector(".attribute-add-row")).not.toBeNull();+ // Above the cards rather than in one, since a selection can span several.+ const toolbar = container.querySelector(".attribute-toolbar");+ expect(toolbar?.closest(".card")).toBeNull();// Only that the count has a slot: the wording is translated, and translations stay unloaded.- expect(bar?.querySelector(".attribute-selection-count")).not.toBeNull();-- // Copy, delete and the way out, the note owning the one row picked out; nothing to paste yet.- writeAttributes(null, []);- checkbox(1).click();- expect(barIcons()).toEqual([ "bx bx-copy", "bx bx-trash", "bx bx-x" ]);+ expect(toolbar?.querySelector(".attribute-selection-count")).not.toBeNull();+ expect(container.querySelector(".attribute-add-row")).not.toBeNull();+ // Clearing, copying and deleting go ahead of adding, which stays at the end.+ expect(toolbarIcons()).toEqual([ "bx bx-x", "bx bx-copy", "bx bx-trash", "bx bx-plus" ]);- // Copying from the bar holds the attributes, which is what puts pasting on offer.- await act(async () => barButton("bx bx-copy")?.click());- expect(barIcons()).toEqual([ "bx bx-copy", "bx bx-paste", "bx bx-trash", "bx bx-x" ]);+ // Copying holds the attributes, which puts pasting on offer, also at the end.+ await act(async () => toolbarButton("bx bx-copy")?.click());+ expect(toolbarIcons()).toEqual([ "bx bx-x", "bx bx-copy", "bx bx-trash", "bx bx-paste", "bx bx-plus" ]);- // An inherited row is the source note's to delete, so the lot cannot be.+ // An inherited row is the source note's to delete, so the selection cannot be deleted.checkbox(3).click();- expect(barIcons()).not.toContain("bx bx-trash");+ expect(toolbarIcons()).not.toContain("bx bx-trash");- // The way out is letting every row go, which takes the bar with it.- act(() => barButton("bx bx-x")?.click());+ // Clearing the selection leaves pasting and adding where they were.+ act(() => toolbarButton("bx bx-x")?.click());expect(selectedNames()).toEqual([]);- expect(container.querySelector(".attribute-selection-bar")).toBeNull();+ expect(container.querySelector(".attribute-selection-count")).toBeNull();+ expect(toolbarIcons()).toEqual([ "bx bx-paste", "bx bx-plus" ]);expect(firstPanel().className).not.toContain("selecting");});@@ -1147,10 +1160,10 @@ describe("AttributeList", () => {writeAttributes(null, [ plain("tag") ]);renderPanel(note);- // The selection bar offers copying and the way out only.+ // The toolbar offers clearing and copying only: no paste, delete or add.checkbox(0).click();checkbox(1).click();- expect(barIcons()).toEqual([ "bx bx-copy", "bx bx-x" ]);+ expect(toolbarIcons()).toEqual([ "bx bx-x", "bx bx-copy" ]);// So does the row menu, over rows the note owns.rightPress(0);@@ -1239,14 +1252,14 @@ describe("AttributeList", () => {}/** An action button wears its icon as classes of its own, rather than around a glyph of one. */- function barIcons() {- return [ ...container.querySelectorAll(".attribute-selection-bar .icon-action") ]+ function toolbarIcons() {+ return [ ...container.querySelectorAll(".attribute-toolbar .icon-action") ].map((button) => [ ...button.classList ].filter((name) => name.startsWith("bx")).join(" "));}- function barButton(icon: string) {+ function toolbarButton(icon: string) {return container.querySelector<HTMLElement>(- `.attribute-selection-bar .icon-action.${icon.split(" ").join(".")}`);+ `.attribute-toolbar .icon-action.${icon.split(" ").join(".")}`);}function selectedNames() {diff --git a/apps/client/src/widgets/sidebar/AttributeList.tsx b/apps/client/src/widgets/sidebar/AttributeList.tsxindex edb0a3bcc9..3a8a85f293 100644--- a/apps/client/src/widgets/sidebar/AttributeList.tsx+++ b/apps/client/src/widgets/sidebar/AttributeList.tsx@@ -333,8 +333,8 @@ export default function AttributeList() {/*** Whether rows are being picked out, which is the panel's second standing: every row shows the- * checkbox only the pointed-at one shows otherwise, the actions over the rows picked out are at- * the foot of the card, and a row's own — its pencil, its trash — are put away, being about the+ * checkbox only the pointed-at one shows otherwise, the toolbar shows the actions on the+ * selected rows, and a row's own — its pencil, its trash — are put away, being about the* one row. There is no mode to turn on and off beside the selection itself: picking the first* row out is what starts it, and letting the last one go is what ends it.*/@@ -502,7 +502,7 @@ export default function AttributeList() {// the panel offering to copy three rows while the menu deleted a fourth. With none// picked out there is no such contradiction — and picking this one out to make the// point would turn the whole panel over to a standing it was never asked for, every row- // grown a checkbox and stripped of its own buttons, the bar up at the foot, all for a+ // grown a checkbox and stripped of its own buttons, the toolbar turned over, all for a// menu about the one row under the pointer. A press asking what can be done to a row is// not a press picking it out.if (isSelecting) {@@ -736,16 +736,22 @@ export default function AttributeList() {// here rather than at each use so that one render offers the same thing everywhere in itself.const heldAttributes = getHeldAttributes();- // After the cards rather than inside one, since a selection can span several cards.- const selectionBar = note && isSelecting && (- <AttributeSelectionBar- count={selection.size}+ // Above the cards rather than in one, since a selection can span several cards.+ const toolbar = note && (canEdit || isSelecting) && (+ <AttributeToolbar+ selectionCount={selection.size}+ held={canEdit ? heldAttributes : []}+ canAdd={canEdit}canDelete={canEdit && selectedAttributes().every((candidate) => owned.current.includes(candidate))}- canPaste={canEdit && heldAttributes.length > 0}+ onAdd={addAttribute}onCopy={() => void copyPickedAttributes(selectedAttributes())}onPaste={() => void applyPaste(heldAttributes)}+ onClearClipboard={() => {+ holdAttributes([]);+ rerender();+ }}onDelete={() => void deleteSelection(selectedAttributes())}- onClear={clearSelection}+ onClearSelection={clearSelection}/>);@@ -761,6 +767,8 @@ export default function AttributeList() {// A card per run. With a single card, there is nothing to collapse it in favor of.const sectionList = (<CollapsibleWidgets.Provider value={runs.length > 1}>+ {toolbar}+{runs.map((run, index) => (<AttributeSectionkey={run.id}@@ -772,27 +780,6 @@ export default function AttributeList() {<>{run.help && <SidebarHelp section={run.help} />}- {/* The only paste control that is visible on every note, and the only- one on a phone or a note with no rows to right-click. */}- {index === 0 && canEdit && heldAttributes.length > 0 && (- <AttributeClipboardDropdown- held={heldAttributes}- onPaste={() => void applyPaste(heldAttributes)}- onClear={() => {- holdAttributes([]);- rerender();- }}- />- )}-- {index === 0 && canEdit && (- <AddAttributeButton- text={t("attribute_editor.add_a_new_attribute")}- attrTypes={ALL_ATTRIBUTE_KINDS}- onSelect={addAttribute}- />- )}-{/* A phone has no hover, so it adds from the header instead of the add row. */}{index > 0 && IS_MOBILE && run.add && (<ActionButton@@ -828,8 +815,6 @@ export default function AttributeList() {</div></AttributeSection>))}-- {selectionBar}</CollapsibleWidgets.Provider>);@@ -1518,11 +1503,7 @@ const KIND_TITLES: Record<AttributeKind, string> = {"relation-definition": t("attribute_list_panel.type_relation_definition")};-/**- * A card's add button: it offers the kinds the card is about, so the definitions card offers the two- * definitions alone while the note's own attributes are added from the top of the panel, whether or not- * a definitions card exists yet to add one from.- */+/** The toolbar's add button, which opens a menu of the given kinds. */function AddAttributeButton({ text, attrTypes, onSelect }: {text: string;attrTypes: AttributeKind[];@@ -1533,8 +1514,6 @@ function AddAttributeButton({ text, attrTypes, onSelect }: {icon="bx bx-plus"text={text}onClick={(e) => {- // Keep the press from reaching the card header, which would collapse the card.- e.stopPropagation();showAddMenu(e, attrTypes, (attrType) => onSelect(attrType, e));}}/>@@ -1542,7 +1521,7 @@ function AddAttributeButton({ text, attrTypes, onSelect }: {}/**- * The attributes held for pasting, in the first card's header. The menu lists them, each with its kind+ * The attributes held for pasting, in the toolbar. The menu lists them, each with its kind* icon and value, then pastes them onto the note or clears them.*/function AttributeClipboardDropdown({ held, onPaste, onClear }: {@@ -1595,63 +1574,73 @@ function getClipboardValue(attribute: Attribute) {}/**- * What can be done to the rows picked out, at the foot of the card holding them: how many they are,- * and the three things there are to do with them. It stands where the add row stands and takes its- * turn (see the card above), so that picking rows out costs the list no room of its own — and it- * says in words what the keys and the row menu offer without saying anything.+ * The panel's toolbar, above the cards. It always holds pasting and adding; while rows are selected, it+ * also holds the selection's count and actions. Its height stays the same either way, so starting or+ * ending a selection moves nothing.*- * Deleting is offered only where every picked row is the note's own, an inherited attribute being the- * source note's to delete; pasting only where something has been copied to paste.+ * Paste and add stay at the trailing end in both states, and the selection's actions go before them.+ * Deleting is offered only when every selected row is the note's own.*/-function AttributeSelectionBar({ count, canDelete, canPaste, onCopy, onPaste, onDelete, onClear }: {- count: number;+function AttributeToolbar({ selectionCount, held, canAdd, canDelete, onAdd, onCopy, onPaste, onClearClipboard, onDelete, onClearSelection }: {+ selectionCount: number;+ /** What there is to paste; empty when nothing is held or the note cannot be edited. */+ held: Attribute[];+ canAdd: boolean;canDelete: boolean;- canPaste: boolean;+ onAdd: (attrType: AttributeKind, e: MouseEvent) => void;onCopy: () => void;onPaste: () => void;+ onClearClipboard: () => void;onDelete: () => void;- onClear: () => void;+ onClearSelection: () => void;}) {- /** Kept from the card, whose own handler would close the form the button is not about. */- const act = (action: () => void) => (e: MouseEvent) => {- e.stopPropagation();- action();- };+ const isSelecting = selectionCount > 0;return (- <div class="attribute-selection-bar">- <span class="attribute-selection-count">{t("attribute_list_panel.selected", { count })}</span>+ <div class={clsx("attribute-toolbar", isSelecting && "selecting")} role="toolbar">+ {isSelecting && (+ <>+ <ActionButton+ icon="bx bx-x"+ text={t("attribute_list_panel.clear_selection")}+ onClick={onClearSelection}+ />+ <span class="attribute-selection-count">+ {t("attribute_list_panel.selected", { count: selectionCount })}+ </span>+ </>+ )}- <ActionButton- icon="bx bx-copy"- text={t("attribute_list_panel.copy", { count })}- onClick={act(onCopy)}- />+ <div class="attribute-toolbar-actions">+ {isSelecting && (+ <ActionButton+ icon="bx bx-copy"+ text={t("attribute_list_panel.copy", { count: selectionCount })}+ onClick={onCopy}+ />+ )}- {canPaste && (- <ActionButton- icon="bx bx-paste"- text={t("attribute_list_panel.paste", { count: getHeldAttributes().length })}- onClick={act(onPaste)}- />- )}+ {isSelecting && canDelete && (+ <ActionButton+ className="attribute-delete-button"+ icon="bx bx-trash"+ text={t("attribute_list_panel.delete_selection", { count: selectionCount })}+ onClick={onDelete}+ />+ )}- {canDelete && (- <ActionButton- className="attribute-delete-button"- icon="bx bx-trash"- text={t("attribute_list_panel.delete_selection", { count })}- onClick={act(onDelete)}- />- )}+ {held.length > 0 && (+ <AttributeClipboardDropdown held={held} onPaste={onPaste} onClear={onClearClipboard} />+ )}- {/* The way out, which is letting every row go: there is no mode standing apart from the- selection to be turned off (see `isSelecting`). */}- <ActionButton- icon="bx bx-x"- text={t("attribute_list_panel.clear_selection")}- onClick={act(onClear)}- />+ {canAdd && (+ <AddAttributeButton+ text={t("attribute_editor.add_a_new_attribute")}+ attrTypes={ALL_ATTRIBUTE_KINDS}+ onSelect={onAdd}+ />+ )}+ </div></div>);}@@ -1662,7 +1651,7 @@ function AttributeSelectionBar({ count, canDelete, canPaste, onCopy, onPaste, on* reached. A label for the note's own attributes, switched to a relation from the creation editor's* own name box or kind icon (see AttributeCreationEditor); a label definition for the definitions,* switched to a relation definition from the form's own list of field types, which offers "relation"- * among them. The panel header's menu stays the way to any kind from anywhere.+ * among them. The toolbar's add menu offers every kind.*/function AddAttributeRow({ text, onAdd }: { text: string; onAdd: (e: MouseEvent) => void }) {return (