mirror of
https://github.com/zadam/trilium.git
synced 2025-10-09 15:08:14 +08:00
fix(react/dialogs): formatting toolbar shown in code notes in quick edit
This commit is contained in:
parent
dd4a01d9f8
commit
94fdc2beee
2 changed files with 12 additions and 6 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 FormattingToolbar from "../widgets/ribbon/FormattingToolbar.js";
|
import { PopupEditorFormattingToolbar } 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(<FormattingToolbar />)
|
.child(<PopupEditorFormattingToolbar />)
|
||||||
.child(new PromotedAttributesWidget())
|
.child(new PromotedAttributesWidget())
|
||||||
.child(new NoteDetailWidget())
|
.child(new NoteDetailWidget())
|
||||||
.child(new NoteListWidget(true)))
|
.child(new NoteListWidget(true)))
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { useTriliumOption } from "../react/hooks";
|
import { useNoteContext, useTriliumOption } from "../react/hooks";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handles the editing toolbar when the CKEditor is in decoupled mode.
|
* Handles the editing toolbar when the CKEditor is in decoupled mode.
|
||||||
|
@ -9,10 +9,16 @@ import { useTriliumOption } from "../react/hooks";
|
||||||
*
|
*
|
||||||
* ! The toolbar is not only used in the ribbon, but also in the quick edit feature.
|
* ! The toolbar is not only used in the ribbon, but also in the quick edit feature.
|
||||||
*/
|
*/
|
||||||
export default function FormattingToolbar() {
|
export default function FormattingToolbar({ hidden }: { hidden?: boolean }) {
|
||||||
const [ textNoteEditorType ] = useTriliumOption("textNoteEditorType");
|
const [ textNoteEditorType ] = useTriliumOption("textNoteEditorType");
|
||||||
|
|
||||||
return (textNoteEditorType === "ckeditor-classic" &&
|
return (textNoteEditorType === "ckeditor-classic" &&
|
||||||
<div className="classic-toolbar-widget" />
|
<div className={`classic-toolbar-widget ${hidden ? "hidden-ext" : ""}`} />
|
||||||
)
|
)
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export function PopupEditorFormattingToolbar() {
|
||||||
|
// TODO: Integrate this directly once we migrate away from class components.
|
||||||
|
const { note } = useNoteContext();
|
||||||
|
return <FormattingToolbar hidden={note?.type !== "text"} />;
|
||||||
|
}
|
Loading…
Add table
Reference in a new issue