fix(react/dialogs): formatting toolbar shown in code notes in quick edit

This commit is contained in:
Elian Doran
2025-08-27 18:12:39 +03:00
parent dd4a01d9f8
commit 94fdc2beee
2 changed files with 12 additions and 6 deletions

View File

@@ -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.
@@ -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.
*/
export default function FormattingToolbar() {
export default function FormattingToolbar({ hidden }: { hidden?: boolean }) {
const [ textNoteEditorType ] = useTriliumOption("textNoteEditorType");
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"} />;
}