diff --git a/apps/client/src/widgets/react/Admonition.tsx b/apps/client/src/widgets/react/Admonition.tsx index d5de3a5c8..5fb86daf2 100644 --- a/apps/client/src/widgets/react/Admonition.tsx +++ b/apps/client/src/widgets/react/Admonition.tsx @@ -3,12 +3,13 @@ import { ComponentChildren } from "preact"; interface AdmonitionProps { type: "warning" | "note" | "caution"; children: ComponentChildren; + className?: string; } -export default function Admonition({ type, children }: AdmonitionProps) { +export default function Admonition({ type, children, className }: AdmonitionProps) { return ( -
+
{children}
) -} \ No newline at end of file +} diff --git a/apps/client/src/widgets/type_widgets/helpers/SplitEditor.tsx b/apps/client/src/widgets/type_widgets/helpers/SplitEditor.tsx index f2554d9e1..33a0d4768 100644 --- a/apps/client/src/widgets/type_widgets/helpers/SplitEditor.tsx +++ b/apps/client/src/widgets/type_widgets/helpers/SplitEditor.tsx @@ -1,8 +1,13 @@ import { isMobile } from "../../../services/utils"; -import { useNoteLabel, useNoteLabelBoolean, useTriliumOption } from "../../react/hooks"; +import Admonition from "../../react/Admonition"; +import { useNoteLabelBoolean, useTriliumOption } from "../../react/hooks"; import { TypeWidgetProps } from "../type_widget"; import "./SplitEditor.css"; +interface SplitEditorProps extends TypeWidgetProps { + error?: string | null; +} + /** * Abstract `TypeWidget` which contains a preview and editor pane, each displayed on half of the available screen. * @@ -12,19 +17,21 @@ import "./SplitEditor.css"; * - Can display errors to the user via {@link setError}. * - Horizontal or vertical orientation for the editor/preview split, adjustable via the switch split orientation button floating button. */ -export default function SplitEditor({ note }: TypeWidgetProps) { +export default function SplitEditor({ note, error }: SplitEditorProps) { const splitEditorOrientation = useSplitOrientation(); const [ readOnly ] = useNoteLabelBoolean(note, "readOnly"); const editor = (!readOnly &&
Detail goes here.
-
Errors go here.
+ {error && + {error} + }
); const preview = ( -
+
Preview goes here
Buttons go here
diff --git a/apps/client/src/widgets/type_widgets/helpers/SvgSplitEditor.tsx b/apps/client/src/widgets/type_widgets/helpers/SvgSplitEditor.tsx index 60a1c2e2f..88fb36704 100644 --- a/apps/client/src/widgets/type_widgets/helpers/SvgSplitEditor.tsx +++ b/apps/client/src/widgets/type_widgets/helpers/SvgSplitEditor.tsx @@ -3,6 +3,9 @@ import SplitEditor from "./SplitEditor"; export default function SvgSplitEditor(props: TypeWidgetProps) { return ( - + ) } diff --git a/apps/client/src/widgets/type_widgets_old/abstract_split_type_widget.ts b/apps/client/src/widgets/type_widgets_old/abstract_split_type_widget.ts index 5234f0037..3085d2d19 100644 --- a/apps/client/src/widgets/type_widgets_old/abstract_split_type_widget.ts +++ b/apps/client/src/widgets/type_widgets_old/abstract_split_type_widget.ts @@ -143,12 +143,6 @@ export default abstract class AbstractSplitTypeWidget extends TypeWidget { return []; } - setError(message: string | null | undefined) { - this.$errorContainer.toggleClass("hidden-ext", !message); - this.$preview.toggleClass("on-error", !!message); - this.$errorContainer.text(message ?? ""); - } - getData() { return this.editorTypeWidget.getData(); }