mirror of
https://github.com/zadam/trilium.git
synced 2025-10-06 21:47:31 +08:00
refactor(react): rename formatting toolbar for clarity
This commit is contained in:
parent
8deaf22544
commit
2f9b2f0e8f
3 changed files with 9 additions and 8 deletions
|
@ -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)))
|
||||
|
|
|
@ -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 = {};
|
|
@ -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
|
||||
},
|
||||
{
|
||||
|
|
Loading…
Add table
Reference in a new issue