mirror of
https://github.com/zadam/trilium.git
synced 2025-10-09 07:05: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 NoteListWidget from "../widgets/note_list.js";
|
||||||
import CallToActionDialog from "../widgets/dialogs/call_to_action.jsx";
|
import CallToActionDialog from "../widgets/dialogs/call_to_action.jsx";
|
||||||
import NoteTitleWidget from "../widgets/note_title.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) {
|
export function applyModals(rootContainer: RootContainer) {
|
||||||
rootContainer
|
rootContainer
|
||||||
|
@ -63,7 +63,7 @@ export function applyModals(rootContainer: RootContainer) {
|
||||||
.cssBlock(".title-row > * { margin: 5px; }")
|
.cssBlock(".title-row > * { margin: 5px; }")
|
||||||
.child(<NoteIconWidget />)
|
.child(<NoteIconWidget />)
|
||||||
.child(<NoteTitleWidget />))
|
.child(<NoteTitleWidget />))
|
||||||
.child(<FormattingTab />)
|
.child(<FormattingToolbar />)
|
||||||
.child(new PromotedAttributesWidget())
|
.child(new PromotedAttributesWidget())
|
||||||
.child(new NoteDetailWidget())
|
.child(new NoteDetailWidget())
|
||||||
.child(new NoteListWidget(true)))
|
.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.
|
* 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 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 [ textNoteEditorType ] = useTriliumOption("textNoteEditorType");
|
||||||
|
|
||||||
const style: CSSProperties = {};
|
const style: CSSProperties = {};
|
|
@ -4,7 +4,7 @@ import { useNoteContext, useTriliumEvents } from "../react/hooks";
|
||||||
import "./style.css";
|
import "./style.css";
|
||||||
import { VNode } from "preact";
|
import { VNode } from "preact";
|
||||||
import BasicPropertiesTab from "./BasicPropertiesTab";
|
import BasicPropertiesTab from "./BasicPropertiesTab";
|
||||||
import FormattingTab from "./FormattingTab";
|
import FormattingToolbar from "./FormattingToolbar";
|
||||||
import { numberObjectsInPlace } from "../../services/utils";
|
import { numberObjectsInPlace } from "../../services/utils";
|
||||||
import { TabContext } from "./ribbon-interface";
|
import { TabContext } from "./ribbon-interface";
|
||||||
import options from "../../services/options";
|
import options from "../../services/options";
|
||||||
|
@ -32,9 +32,8 @@ interface TitleContext {
|
||||||
interface TabConfiguration {
|
interface TabConfiguration {
|
||||||
title: string | ((context: TitleContext) => string);
|
title: string | ((context: TitleContext) => string);
|
||||||
icon: string;
|
icon: string;
|
||||||
// TODO: Mark as required after porting them all.
|
content: (context: TabContext) => VNode | false;
|
||||||
content?: (context: TabContext) => VNode;
|
show: boolean | ((context: TitleContext) => boolean | null | undefined);
|
||||||
show?: boolean | ((context: TitleContext) => boolean | null | undefined);
|
|
||||||
toggleCommand?: CommandNames;
|
toggleCommand?: CommandNames;
|
||||||
activate?: boolean | ((context: TitleContext) => boolean);
|
activate?: boolean | ((context: TitleContext) => boolean);
|
||||||
/**
|
/**
|
||||||
|
@ -49,7 +48,7 @@ const TAB_CONFIGURATION = numberObjectsInPlace<TabConfiguration>([
|
||||||
icon: "bx bx-text",
|
icon: "bx bx-text",
|
||||||
show: ({ note }) => note?.type === "text" && options.get("textNoteEditorType") === "ckeditor-classic",
|
show: ({ note }) => note?.type === "text" && options.get("textNoteEditorType") === "ckeditor-classic",
|
||||||
toggleCommand: "toggleRibbonTabClassicEditor",
|
toggleCommand: "toggleRibbonTabClassicEditor",
|
||||||
content: FormattingTab,
|
content: FormattingToolbar,
|
||||||
stayInDom: true
|
stayInDom: true
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Reference in a new issue