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
refactor(react): rename formatting toolbar for clarity
Elian Doran2f9b2f0e8f2b
diff --git a/apps/client/src/layouts/layout_commons.tsx b/apps/client/src/layouts/layout_commons.tsxindex dee74927a4..15e97ea2dc 100644--- a/apps/client/src/layouts/layout_commons.tsx+++ b/apps/client/src/layouts/layout_commons.tsx@@ -30,7 +30,7 @@ import NoteDetailWidget from "../widgets/note_detail.js";import NoteListWidget from "../widgets/note_list.js";import CallToActionDialog from "../widgets/dialogs/call_to_action.jsx";import NoteTitleWidget from "../widgets/note_title.jsx";-import FormattingTab from "../widgets/ribbon/FormattingTab.js";+import FormattingToolbar from "../widgets/ribbon/FormattingToolbar.js";export function applyModals(rootContainer: RootContainer) {rootContainer@@ -63,7 +63,7 @@ export function applyModals(rootContainer: RootContainer) {.cssBlock(".title-row > * { margin: 5px; }").child(<NoteIconWidget />).child(<NoteTitleWidget />))- .child(<FormattingTab />)+ .child(<FormattingToolbar />).child(new PromotedAttributesWidget()).child(new NoteDetailWidget()).child(new NoteListWidget(true)))diff --git a/apps/client/src/widgets/ribbon/FormattingTab.tsx b/apps/client/src/widgets/ribbon/FormattingToolbar.tsxsimilarity index 79%rename from apps/client/src/widgets/ribbon/FormattingTab.tsxrename to apps/client/src/widgets/ribbon/FormattingToolbar.tsxindex 555bd4529f..57edaa1060 100644--- a/apps/client/src/widgets/ribbon/FormattingTab.tsx+++ b/apps/client/src/widgets/ribbon/FormattingToolbar.tsx@@ -7,8 +7,10 @@ import { useTriliumOption } from "../react/hooks";* This toolbar is only enabled if the user has selected the classic CKEditor.** The ribbon item is active by default for text notes, as long as they are not in read-only mode.+ *+ * ! The toolbar is not only used in the ribbon, but also in the quick edit feature.*/-export default function FormattingTab({ hidden }) {+export default function FormattingToolbar({ hidden }: { hidden?: boolean }) {const [ textNoteEditorType ] = useTriliumOption("textNoteEditorType");const style: CSSProperties = {};diff --git a/apps/client/src/widgets/ribbon/Ribbon.tsx b/apps/client/src/widgets/ribbon/Ribbon.tsxindex a4debbca56..bf1b310aad 100644--- a/apps/client/src/widgets/ribbon/Ribbon.tsx+++ b/apps/client/src/widgets/ribbon/Ribbon.tsx@@ -4,7 +4,7 @@ import { useNoteContext, useTriliumEvents } from "../react/hooks";import "./style.css";import { VNode } from "preact";import BasicPropertiesTab from "./BasicPropertiesTab";-import FormattingTab from "./FormattingTab";+import FormattingToolbar from "./FormattingToolbar";import { numberObjectsInPlace } from "../../services/utils";import { TabContext } from "./ribbon-interface";import options from "../../services/options";@@ -32,9 +32,8 @@ interface TitleContext {interface TabConfiguration {title: string | ((context: TitleContext) => string);icon: string;- // TODO: Mark as required after porting them all.- content?: (context: TabContext) => VNode;- show?: boolean | ((context: TitleContext) => boolean | null | undefined);+ content: (context: TabContext) => VNode | false;+ show: boolean | ((context: TitleContext) => boolean | null | undefined);toggleCommand?: CommandNames;activate?: boolean | ((context: TitleContext) => boolean);/**@@ -49,7 +48,7 @@ const TAB_CONFIGURATION = numberObjectsInPlace<TabConfiguration>([icon: "bx bx-text",show: ({ note }) => note?.type === "text" && options.get("textNoteEditorType") === "ckeditor-classic",toggleCommand: "toggleRibbonTabClassicEditor",- content: FormattingTab,+ content: FormattingToolbar,stayInDom: true},{