2025-08-27 18:12:39 +03:00
|
|
|
import { useNoteContext, useTriliumOption } from "../react/hooks";
|
2025-08-22 16:24:02 +03:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Handles the editing toolbar when the CKEditor is in decoupled mode.
|
|
|
|
|
*
|
|
|
|
|
* 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.
|
2025-08-26 21:52:27 +03:00
|
|
|
*
|
|
|
|
|
* ! The toolbar is not only used in the ribbon, but also in the quick edit feature.
|
2025-08-22 16:24:02 +03:00
|
|
|
*/
|
2025-08-27 18:12:39 +03:00
|
|
|
export default function FormattingToolbar({ hidden }: { hidden?: boolean }) {
|
2025-08-26 21:45:22 +03:00
|
|
|
const [ textNoteEditorType ] = useTriliumOption("textNoteEditorType");
|
|
|
|
|
|
|
|
|
|
return (textNoteEditorType === "ckeditor-classic" &&
|
2025-08-27 18:12:39 +03:00
|
|
|
<div className={`classic-toolbar-widget ${hidden ? "hidden-ext" : ""}`} />
|
2025-08-22 16:24:02 +03:00
|
|
|
)
|
2025-08-27 18:12:39 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
export function PopupEditorFormattingToolbar() {
|
|
|
|
|
// TODO: Integrate this directly once we migrate away from class components.
|
|
|
|
|
const { note } = useNoteContext();
|
|
|
|
|
return <FormattingToolbar hidden={note?.type !== "text"} />;
|
|
|
|
|
}
|