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(bulk_actions): label rows by action title, arrow between fields
Elian Dorana1550e539ff1
diff --git a/apps/client/src/translations/en/translation.json b/apps/client/src/translations/en/translation.jsonindex e3da197391..d961d8bf12 100644--- a/apps/client/src/translations/en/translation.json+++ b/apps/client/src/translations/en/translation.json@@ -892,7 +892,6 @@"add_label": "Add label","label_name_placeholder": "label name","label_name_title": "Alphanumeric characters, underscore and colon are allowed characters.",- "to_value": "to value","new_value_placeholder": "new value","description": "Adds the label to each note, with the given value or none. It is added even if the note already has the label, so the note ends up with it twice."},@@ -904,9 +903,7 @@},"rename_label": {"rename_label": "Rename label",- "rename_label_from": "Rename label from","old_name_placeholder": "old name",- "to": "To","new_name_placeholder": "new name","name_title": "Alphanumeric characters, underscore and colon are allowed characters.","description": "Renames the label on each note that has it directly, keeping its value."@@ -915,13 +912,11 @@"update_label_value": "Update label value","label_name_placeholder": "label name","label_name_title": "Alphanumeric characters, underscore and colon are allowed characters.",- "to_value": "to value","new_value_placeholder": "new value","description": "Sets the value of the label on each note that has it directly. Inherited labels are not changed."},"delete_note": {"delete_note": "Delete note",- "delete_matched_notes": "Delete matched notes","description": "Deletes each note, including its clones and any child notes that are not cloned elsewhere. Deleted notes can be restored from Recent changes until they are erased."},"save_revision": {@@ -935,13 +930,11 @@},"move_note": {"move_note": "Move note",- "to": "to","target_parent_note": "target parent note","description": "Moves each note under the target note. A note with several parents is cloned there instead, and one that cannot go there, such as a parent of the target, stays where it is."},"convert_note": {"convert_note": "Convert",- "convert_note_to": "Convert note","choose_conversion": "(choose a conversion)","conversion_htmlToMarkdown": "Text Notes → Markdown Notes (lossy)","conversion_markdownToHtml": "Markdown Notes → Text Notes",@@ -951,7 +944,6 @@},"rename_note": {"rename_note": "Rename note",- "rename_note_title_to": "Rename note title to","new_note_title": "new note title","description": "Sets the title of each note. The title is a JavaScript template string, so ${note.title} stands for the current title."},@@ -959,7 +951,6 @@"add_relation": "Add relation","relation_name": "relation name","allowed_characters": "Alphanumeric characters, underscore and colon are allowed characters.",- "to": "to","target_note": "target note","description": "Adds a relation from each note to the target note. It is added even if the note already has a relation of that name."},@@ -971,18 +962,14 @@},"rename_relation": {"rename_relation": "Rename relation",- "rename_relation_from": "Rename relation from","old_name": "old name",- "to": "To","new_name": "new name","allowed_characters": "Alphanumeric characters, underscore and colon are allowed characters.","description": "Renames the relation on each note that has it directly, keeping its target."},"update_relation_target": {- "update_relation": "Update relation","relation_name": "relation name","allowed_characters": "Alphanumeric characters, underscore and colon are allowed characters.",- "to": "to","target_note": "target note","update_relation_target": "Update relation target","description": "Points the relation on each note that has it directly to the target note."diff --git a/apps/client/src/widgets/bulk_actions/BulkAction.css b/apps/client/src/widgets/bulk_actions/BulkAction.cssindex 987d33c324..c71632a751 100644--- a/apps/client/src/widgets/bulk_actions/BulkAction.css+++ b/apps/client/src/widgets/bulk_actions/BulkAction.css@@ -51,3 +51,23 @@.bulk-action-marker-convert::after {content: "\ec0e"; /* bx-shuffle */}++.bulk-action-row {+ display: flex;+ align-items: center;+ gap: 10px;+}++.bulk-action-label {+ white-space: nowrap;+}++.bulk-action-arrow {+ flex-shrink: 0;+ font-size: 1.2em;+ color: var(--muted-text-color);+}++body[dir=rtl] .bulk-action-arrow {+ transform: scaleX(-1);+}diff --git a/apps/client/src/widgets/bulk_actions/BulkAction.tsx b/apps/client/src/widgets/bulk_actions/BulkAction.tsxindex c357854af5..1257f52f91 100644--- a/apps/client/src/widgets/bulk_actions/BulkAction.tsx+++ b/apps/client/src/widgets/bulk_actions/BulkAction.tsx@@ -8,25 +8,19 @@ import HelpRemoveButtons from "../react/HelpRemoveButtons";import Icon from "../react/Icon";interface BulkActionProps {- label: string | ComponentChildren;children?: ComponentChildren;bulkAction: AbstractBulkAction;}-// Define styles as constants to prevent recreation-const flexContainerStyle = { display: "flex", alignItems: "center" } as const;-const labelStyle = { marginInlineEnd: "10px" } as const;-const textStyle = { marginInlineEnd: "10px", marginInlineStart: "10px" } as const;--const BulkAction = memo(({ label, children, bulkAction }: BulkActionProps) => {- const { actionIcon } = bulkAction.constructor as typeof AbstractBulkAction;+const BulkAction = memo(({ children, bulkAction }: BulkActionProps) => {+ const { actionIcon, actionTitle } = bulkAction.constructor as typeof AbstractBulkAction;return (<tr><td colSpan={2}>- <div style={flexContainerStyle}>- <div style={labelStyle} className="text-nowrap">- {actionIcon && <Icon icon={actionIcon} className="bulk-action-icon" />}{" "}{label}+ <div className="bulk-action-row">+ <div className="bulk-action-label">+ {actionIcon && <Icon icon={actionIcon} className="bulk-action-icon" />}{" "}{actionTitle}</div>{children}@@ -42,12 +36,7 @@ const BulkAction = memo(({ label, children, bulkAction }: BulkActionProps) => {export default BulkAction;-export const BulkActionText = memo(({ text }: { text: string }) => {- return (- <div- style={textStyle}- className="text-nowrap">- {text}- </div>- );-});+/** Separates a row's source field from its target field, in place of a word such as "to". */+export function BulkActionArrow() {+ return <Icon icon="bx bx-right-arrow-alt" className="bulk-action-arrow" />;+}diff --git a/apps/client/src/widgets/bulk_actions/abstract_bulk_action.ts b/apps/client/src/widgets/bulk_actions/abstract_bulk_action.tsindex d7e449c423..61dd708bb6 100644--- a/apps/client/src/widgets/bulk_actions/abstract_bulk_action.ts+++ b/apps/client/src/widgets/bulk_actions/abstract_bulk_action.ts@@ -43,6 +43,11 @@ export default abstract class AbstractBulkAction {return "";}+ /** The action's name, shown in the add menu and as the label of its row. */+ static get actionTitle() {+ return "";+ }+/*** The action's icon, shown in the add menu and on its row: a boxicons class for what it acts on,* plus a `bulk-action-marker-*` class for the corner glyph saying what it does.diff --git a/apps/client/src/widgets/bulk_actions/execute_script.tsx b/apps/client/src/widgets/bulk_actions/execute_script.tsxindex 854deb59c0..e869daa507 100644--- a/apps/client/src/widgets/bulk_actions/execute_script.tsx+++ b/apps/client/src/widgets/bulk_actions/execute_script.tsx@@ -13,7 +13,6 @@ function ExecuteScriptBulkActionComponent({ bulkAction, actionDef }: { bulkActioreturn (<BulkActionbulkAction={bulkAction}- label={t("execute_script.execute_script")}><FormTextBoxplaceholder="note.title = note.title + '- suffix';"diff --git a/apps/client/src/widgets/bulk_actions/label/add_label.tsx b/apps/client/src/widgets/bulk_actions/label/add_label.tsxindex a14355e552..3694fe0708 100644--- a/apps/client/src/widgets/bulk_actions/label/add_label.tsx+++ b/apps/client/src/widgets/bulk_actions/label/add_label.tsx@@ -2,7 +2,7 @@ import { useEffect, useState } from "preact/hooks";import { t } from "../../../services/i18n";import FormTextBox from "../../react/FormTextBox";import AbstractBulkAction, { ActionDefinition } from "../abstract_bulk_action";-import BulkAction, { BulkActionText } from "../BulkAction";+import BulkAction, { BulkActionArrow } from "../BulkAction";import { useSpacedUpdate } from "../../react/hooks";function AddLabelBulkActionComponent({ bulkAction, actionDef }: { bulkAction: AbstractBulkAction, actionDef: ActionDefinition }) {@@ -14,7 +14,6 @@ function AddLabelBulkActionComponent({ bulkAction, actionDef }: { bulkAction: Abreturn (<BulkActionbulkAction={bulkAction}- label={t("add_label.add_label")}><FormTextBoxplaceholder={t("add_label.label_name_placeholder")}@@ -22,7 +21,7 @@ function AddLabelBulkActionComponent({ bulkAction, actionDef }: { bulkAction: Abtitle={t("add_label.label_name_title")}currentValue={labelName} onChange={setLabelName}/>- <BulkActionText text={t("add_label.to_value")} />+ <BulkActionArrow /><FormTextBoxplaceholder={t("add_label.new_value_placeholder")}currentValue={labelValue} onChange={setLabelValue}diff --git a/apps/client/src/widgets/bulk_actions/label/delete_label.tsx b/apps/client/src/widgets/bulk_actions/label/delete_label.tsxindex 83c5c7e897..5501a952dc 100644--- a/apps/client/src/widgets/bulk_actions/label/delete_label.tsx+++ b/apps/client/src/widgets/bulk_actions/label/delete_label.tsx@@ -13,7 +13,6 @@ function DeleteLabelBulkActionComponent({ bulkAction, actionDef }: { bulkAction:return (<BulkActionbulkAction={bulkAction}- label={t("delete_label.delete_label")}><FormTextBoxpattern="[\\p{L}\\p{N}_:]+"diff --git a/apps/client/src/widgets/bulk_actions/label/rename_label.tsx b/apps/client/src/widgets/bulk_actions/label/rename_label.tsxindex a6cbd3d1df..c4531ffc25 100644--- a/apps/client/src/widgets/bulk_actions/label/rename_label.tsx+++ b/apps/client/src/widgets/bulk_actions/label/rename_label.tsx@@ -2,7 +2,7 @@ import { useEffect, useState } from "preact/hooks";import { t } from "../../../services/i18n.js";import FormTextBox from "../../react/FormTextBox.jsx";import AbstractBulkAction, { ActionDefinition } from "../abstract_bulk_action.js";-import BulkAction, { BulkActionText } from "../BulkAction.jsx";+import BulkAction, { BulkActionArrow } from "../BulkAction.jsx";import { useSpacedUpdate } from "../../react/hooks.jsx";function RenameLabelBulkActionComponent({ bulkAction, actionDef }: { bulkAction: AbstractBulkAction, actionDef: ActionDefinition}) {@@ -14,7 +14,6 @@ function RenameLabelBulkActionComponent({ bulkAction, actionDef }: { bulkAction:return (<BulkActionbulkAction={bulkAction}- label={t("rename_label.rename_label_from")}><FormTextBoxplaceholder={t("rename_label.old_name_placeholder")}@@ -23,7 +22,7 @@ function RenameLabelBulkActionComponent({ bulkAction, actionDef }: { bulkAction:currentValue={oldLabelName} onChange={setOldLabelName}/>- <BulkActionText text={t("rename_label.to")} />+ <BulkActionArrow /><FormTextBoxplaceholder={t("rename_label.new_name_placeholder")}diff --git a/apps/client/src/widgets/bulk_actions/label/update_label_value.tsx b/apps/client/src/widgets/bulk_actions/label/update_label_value.tsxindex 3d0f3770d0..e5ecbc1a81 100644--- a/apps/client/src/widgets/bulk_actions/label/update_label_value.tsx+++ b/apps/client/src/widgets/bulk_actions/label/update_label_value.tsx@@ -1,7 +1,7 @@import { t } from "../../../services/i18n.js";import AbstractBulkAction, { ActionDefinition } from "../abstract_bulk_action.js";import FormTextBox from "../../react/FormTextBox.jsx";-import BulkAction, { BulkActionText } from "../BulkAction.jsx";+import BulkAction, { BulkActionArrow } from "../BulkAction.jsx";import { useSpacedUpdate } from "../../react/hooks.jsx";import { useEffect, useState } from "preact/hooks";@@ -14,7 +14,6 @@ function UpdateLabelValueComponent({ bulkAction, actionDef }: { bulkAction: Abstreturn (<BulkActionbulkAction={bulkAction}- label={t("update_label_value.update_label_value")}><FormTextBoxplaceholder={t("update_label_value.label_name_placeholder")}@@ -22,7 +21,7 @@ function UpdateLabelValueComponent({ bulkAction, actionDef }: { bulkAction: Absttitle={t("update_label_value.label_name_title")}currentValue={labelName} onChange={setLabelName}/>- <BulkActionText text={t("update_label_value.to_value")} />+ <BulkActionArrow /><FormTextBoxplaceholder={t("update_label_value.new_value_placeholder")}currentValue={labelValue} onChange={setLabelValue}diff --git a/apps/client/src/widgets/bulk_actions/note/convert_note.tsx b/apps/client/src/widgets/bulk_actions/note/convert_note.tsxindex 40a32cc544..5a0047643f 100644--- a/apps/client/src/widgets/bulk_actions/note/convert_note.tsx+++ b/apps/client/src/widgets/bulk_actions/note/convert_note.tsx@@ -27,7 +27,6 @@ function ConvertNoteBulkActionComponent({ bulkAction, actionDef }: { bulkAction:return (<BulkActionbulkAction={bulkAction}- label={t("convert_note.convert_note_to")}><FormSelectvalues={conversionOptions}diff --git a/apps/client/src/widgets/bulk_actions/note/delete_note.tsx b/apps/client/src/widgets/bulk_actions/note/delete_note.tsxindex b42a3119fb..dad91f768f 100644--- a/apps/client/src/widgets/bulk_actions/note/delete_note.tsx+++ b/apps/client/src/widgets/bulk_actions/note/delete_note.tsx@@ -1,13 +1,11 @@import { t } from "../../../services/i18n.js";import AbstractBulkAction from "../abstract_bulk_action.js";import BulkAction from "../BulkAction.jsx";-import Icon from "../../react/Icon.jsx";function DeleteNoteBulkActionComponent({ bulkAction }: { bulkAction: AbstractBulkAction }) {return (<BulkActionbulkAction={bulkAction}- label={<><Icon icon="bx bx-trash" /> {t("delete_note.delete_matched_notes")}</>}/>);}diff --git a/apps/client/src/widgets/bulk_actions/note/delete_revisions.tsx b/apps/client/src/widgets/bulk_actions/note/delete_revisions.tsxindex a9e2022fd8..8ff9043d17 100644--- a/apps/client/src/widgets/bulk_actions/note/delete_revisions.tsx+++ b/apps/client/src/widgets/bulk_actions/note/delete_revisions.tsx@@ -1,5 +1,4 @@import { t } from "../../../services/i18n.js";-import Icon from "../../react/Icon.jsx";import AbstractBulkAction from "../abstract_bulk_action.js";import BulkAction from "../BulkAction.jsx";@@ -7,7 +6,6 @@ function DeleteRevisionsBulkActionComponent({ bulkAction }: { bulkAction: Abstrareturn (<BulkActionbulkAction={bulkAction}- label={<><Icon icon="bx bx-trash" /> {t("delete_revisions.delete_note_revisions")}</>}/>)}diff --git a/apps/client/src/widgets/bulk_actions/note/move_note.tsx b/apps/client/src/widgets/bulk_actions/note/move_note.tsxindex eb5dede603..66312ff214 100644--- a/apps/client/src/widgets/bulk_actions/note/move_note.tsx+++ b/apps/client/src/widgets/bulk_actions/note/move_note.tsx@@ -1,6 +1,6 @@import { t } from "../../../services/i18n.js";import AbstractBulkAction from "../abstract_bulk_action.js";-import BulkAction, { BulkActionText } from "../BulkAction.jsx";+import BulkAction from "../BulkAction.jsx";import NoteAutocomplete from "../../react/NoteAutocomplete.jsx";import { useEffect, useState } from "preact/hooks";import { useSpacedUpdate } from "../../react/hooks.jsx";@@ -15,9 +15,7 @@ function MoveNoteBulkActionComponent({ bulkAction }: { bulkAction: AbstractBulkAreturn (<BulkActionbulkAction={bulkAction}- label={t("move_note.move_note")}>- <BulkActionText text={t("move_note.to")} /><NoteAutocompleteplaceholder={t("move_note.target_parent_note")}diff --git a/apps/client/src/widgets/bulk_actions/note/rename_note.tsx b/apps/client/src/widgets/bulk_actions/note/rename_note.tsxindex 93a996240c..6e50575695 100644--- a/apps/client/src/widgets/bulk_actions/note/rename_note.tsx+++ b/apps/client/src/widgets/bulk_actions/note/rename_note.tsx@@ -13,7 +13,6 @@ function RenameNoteBulkActionComponent({ bulkAction, actionDef }: { bulkAction:return (<BulkActionbulkAction={bulkAction}- label={t("rename_note.rename_note_title_to")}><FormTextBoxplaceholder={t("rename_note.new_note_title")}diff --git a/apps/client/src/widgets/bulk_actions/note/save_revision.tsx b/apps/client/src/widgets/bulk_actions/note/save_revision.tsxindex ac618114a2..804f3faf27 100644--- a/apps/client/src/widgets/bulk_actions/note/save_revision.tsx+++ b/apps/client/src/widgets/bulk_actions/note/save_revision.tsx@@ -2,7 +2,6 @@ import { useState } from "preact/hooks";import { t } from "../../../services/i18n.js";import FormTextBox from "../../react/FormTextBox.jsx";import { useSpacedUpdate } from "../../react/hooks.jsx";-import Icon from "../../react/Icon.jsx";import AbstractBulkAction, { ActionDefinition } from "../abstract_bulk_action.js";import BulkAction from "../BulkAction.jsx";@@ -21,7 +20,6 @@ function SaveRevisionBulkActionComponent({ bulkAction, actionDef }: { bulkActionreturn (<BulkActionbulkAction={bulkAction}- label={<><Icon icon="bx bx-save" /> {t("save_revision.save_revision")}</>}><FormTextBoxplaceholder={t("save_revision.revision_name_placeholder")}diff --git a/apps/client/src/widgets/bulk_actions/relation/add_relation.tsx b/apps/client/src/widgets/bulk_actions/relation/add_relation.tsxindex d046e2f1d2..4f9ad91d66 100644--- a/apps/client/src/widgets/bulk_actions/relation/add_relation.tsx+++ b/apps/client/src/widgets/bulk_actions/relation/add_relation.tsx@@ -1,6 +1,6 @@import AbstractBulkAction, { ActionDefinition } from "../abstract_bulk_action.js";import { t } from "../../../services/i18n.js";-import BulkAction, { BulkActionText } from "../BulkAction.jsx";+import BulkAction, { BulkActionArrow } from "../BulkAction.jsx";import NoteAutocomplete from "../../react/NoteAutocomplete.jsx";import FormTextBox from "../../react/FormTextBox.jsx";import { useEffect, useState } from "preact/hooks";@@ -15,7 +15,6 @@ function AddRelationBulkActionComponent({ bulkAction, actionDef }: { bulkAction:return (<BulkActionbulkAction={bulkAction}- label={t("add_relation.add_relation")}><FormTextBoxplaceholder={t("add_relation.relation_name")}@@ -25,7 +24,7 @@ function AddRelationBulkActionComponent({ bulkAction, actionDef }: { bulkAction:currentValue={relationName} onChange={setRelationName}/>- <BulkActionText text={t("add_relation.to")} />+ <BulkActionArrow /><NoteAutocompleteplaceholder={t("add_relation.target_note")}diff --git a/apps/client/src/widgets/bulk_actions/relation/delete_relation.tsx b/apps/client/src/widgets/bulk_actions/relation/delete_relation.tsxindex cc8d0d2b7b..682673d3dc 100644--- a/apps/client/src/widgets/bulk_actions/relation/delete_relation.tsx+++ b/apps/client/src/widgets/bulk_actions/relation/delete_relation.tsx@@ -13,7 +13,6 @@ function DeleteRelationBulkActionComponent({ bulkAction, actionDef }: { bulkActireturn (<BulkActionbulkAction={bulkAction}- label={t("delete_relation.delete_relation")}><FormTextBoxpattern="[\\p{L}\\p{N}_:]+"diff --git a/apps/client/src/widgets/bulk_actions/relation/rename_relation.tsx b/apps/client/src/widgets/bulk_actions/relation/rename_relation.tsxindex 0ad451c6a8..171c575b6f 100644--- a/apps/client/src/widgets/bulk_actions/relation/rename_relation.tsx+++ b/apps/client/src/widgets/bulk_actions/relation/rename_relation.tsx@@ -1,6 +1,6 @@import AbstractBulkAction, { ActionDefinition } from "../abstract_bulk_action.js";import { t } from "../../../services/i18n.js";-import BulkAction, { BulkActionText } from "../BulkAction.jsx";+import BulkAction, { BulkActionArrow } from "../BulkAction.jsx";import FormTextBox from "../../react/FormTextBox.jsx";import { useEffect, useState } from "preact/hooks";import { useSpacedUpdate } from "../../react/hooks.jsx";@@ -14,7 +14,6 @@ function RenameRelationBulkActionComponent({ bulkAction, actionDef }: { bulkActireturn (<BulkActionbulkAction={bulkAction}- label={t("rename_relation.rename_relation_from")}><FormTextBoxplaceholder={t("rename_relation.old_name")}@@ -23,7 +22,7 @@ function RenameRelationBulkActionComponent({ bulkAction, actionDef }: { bulkActicurrentValue={oldRelationName} onChange={setOldRelationName}/>- <BulkActionText text={t("rename_relation.to")} />+ <BulkActionArrow /><FormTextBoxplaceholder={t("rename_relation.new_name")}diff --git a/apps/client/src/widgets/bulk_actions/relation/update_relation_target.tsx b/apps/client/src/widgets/bulk_actions/relation/update_relation_target.tsxindex c3ba2cb952..c0b9c547f2 100644--- a/apps/client/src/widgets/bulk_actions/relation/update_relation_target.tsx+++ b/apps/client/src/widgets/bulk_actions/relation/update_relation_target.tsx@@ -1,6 +1,6 @@import AbstractBulkAction, { ActionDefinition } from "../abstract_bulk_action.js";import { t } from "../../../services/i18n.js";-import BulkAction, { BulkActionText } from "../BulkAction.jsx";+import BulkAction, { BulkActionArrow } from "../BulkAction.jsx";import FormTextBox from "../../react/FormTextBox.jsx";import NoteAutocomplete from "../../react/NoteAutocomplete.jsx";import { useEffect, useState } from "preact/hooks";@@ -15,7 +15,6 @@ function UpdateRelationTargetComponent({ bulkAction, actionDef }: { bulkAction:return (<BulkActionbulkAction={bulkAction}- label={t("update_relation_target.update_relation")}><FormTextBoxplaceholder={t("update_relation_target.relation_name")}@@ -25,7 +24,7 @@ function UpdateRelationTargetComponent({ bulkAction, actionDef }: { bulkAction:currentValue={relationName} onChange={setRelationName}/>- <BulkActionText text={t("update_relation_target.to")} />+ <BulkActionArrow /><NoteAutocompleteplaceholder={t("update_relation_target.target_note")}diff --git a/apps/client/src/widgets/dialogs/bulk_actions.spec.tsx b/apps/client/src/widgets/dialogs/bulk_actions.spec.tsxindex 4e4ef4de15..3ee87aaef0 100644--- a/apps/client/src/widgets/dialogs/bulk_actions.spec.tsx+++ b/apps/client/src/widgets/dialogs/bulk_actions.spec.tsx@@ -2,6 +2,8 @@ import { act } from "preact/test-utils";import { beforeEach, describe, expect, it, vi } from "vitest";import Component from "../../components/component";+import bulk_action from "../../services/bulk_action";+import noteAttributeCache from "../../services/note_attribute_cache";import { buildNote } from "../../test/easy-froca";import { renderInto } from "../../test/render";import { ParentComponent } from "../react/react_utils";@@ -28,6 +30,7 @@ describe("BulkActionsDialog", () => {beforeEach(() => {vi.clearAllMocks();server.post.mockResolvedValue({ affectedNoteCount: 0 });+ delete noteAttributeCache.attributes._bulkAction;buildNote({ id: "_bulkAction", title: "Bulk action" });host = new Component();container = renderInto(@@ -106,6 +109,29 @@ describe("BulkActionsDialog", () => {expect(container.querySelector(".bulk-existing-action-list .help-dropdown")).toBeNull();});+ it("names each chosen action by its menu title alone, with an arrow only between two fields", async () => {+ buildNote({+ id: "_bulkAction",+ title: "Bulk action",+ "#action": bulk_action.ACTION_CLASSES.map(({ actionName }) => JSON.stringify({ name: actionName }))+ });+ await open([ "n1" ]);+ const rows = [ ...container.querySelectorAll<HTMLTableRowElement>(".bulk-existing-action-list tr") ];+ expect(rows).toHaveLength(bulk_action.ACTION_CLASSES.length);++ for (const [ index, ActionClass ] of bulk_action.ACTION_CLASSES.entries()) {+ const row = rows[index];+ const content = row.cells[0].cloneNode(true) as HTMLElement;+ for (const select of content.querySelectorAll("select")) select.remove();+ expect(content.textContent?.trim(), ActionClass.actionName).toBe(ActionClass.actionTitle);+ expect(row.querySelectorAll(".tn-icon:not(.bulk-action-arrow)"), ActionClass.actionName).toHaveLength(1);++ const arrow = row.querySelector(".bulk-action-arrow");+ const fieldCount = row.querySelectorAll("input:not([type=hidden]), select").length;+ expect(!!arrow, ActionClass.actionName).toBe(fieldCount === 2);+ }+ });+it("drops a removed chip from the notes the actions apply to, keeping the last one", async () => {await open([ "n1", "n2" ]);expect(lastAffectedNotesRequest()).toStrictEqual({ noteIds: [ "n1", "n2" ], includeDescendants: false });