diff --git a/apps/client/src/layouts/layout_commons.tsx b/apps/client/src/layouts/layout_commons.tsx index dee74927a..15e97ea2d 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() .child()) - .child() + .child() .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.tsx similarity index 80% rename from apps/client/src/widgets/ribbon/FormattingTab.tsx rename to apps/client/src/widgets/ribbon/FormattingToolbar.tsx index 555bd4529..57edaa106 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.tsx index a4debbca5..bf1b310aa 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([ icon: "bx bx-text", show: ({ note }) => note?.type === "text" && options.get("textNoteEditorType") === "ckeditor-classic", toggleCommand: "toggleRibbonTabClassicEditor", - content: FormattingTab, + content: FormattingToolbar, stayInDom: true }, {