From 9f2be7217316d451dd68526da8ac20b5e37b89ef Mon Sep 17 00:00:00 2001 From: Philipinho <16838612+Philipinho@users.noreply.github.com> Date: Tue, 24 Feb 2026 13:21:49 +0000 Subject: [PATCH] notes callout --- .../public/locales/en-US/translation.json | 1 + .../components/callout/callout-menu.tsx | 29 +++++++++++++++++-- .../components/callout/callout-view.tsx | 7 ++++- packages/editor-ext/src/lib/callout/utils.ts | 19 ++++++++++-- 4 files changed, 49 insertions(+), 7 deletions(-) diff --git a/apps/client/public/locales/en-US/translation.json b/apps/client/public/locales/en-US/translation.json index 1588d301..25848e5d 100644 --- a/apps/client/public/locales/en-US/translation.json +++ b/apps/client/public/locales/en-US/translation.json @@ -274,6 +274,7 @@ "Add row below": "Add row below", "Delete table": "Delete table", "Info": "Info", + "Note": "Note", "Success": "Success", "Warning": "Warning", "Danger": "Danger", diff --git a/apps/client/src/features/editor/components/callout/callout-menu.tsx b/apps/client/src/features/editor/components/callout/callout-menu.tsx index 25ca546e..7560a428 100644 --- a/apps/client/src/features/editor/components/callout/callout-menu.tsx +++ b/apps/client/src/features/editor/components/callout/callout-menu.tsx @@ -14,6 +14,7 @@ import { IconCircleXFilled, IconInfoCircleFilled, IconMoodSmile, + IconNotes, } from "@tabler/icons-react"; import { CalloutType } from "@docmost/editor-ext"; import { useTranslation } from "react-i18next"; @@ -44,6 +45,7 @@ export function CalloutMenu({ editor }: EditorMenuProps) { return { isCallout: ctx.editor.isActive("callout"), isInfo: ctx.editor.isActive("callout", { type: "info" }), + isNote: ctx.editor.isActive("callout", { type: "note" }), isSuccess: ctx.editor.isActive("callout", { type: "success" }), isWarning: ctx.editor.isActive("callout", { type: "warning" }), isDanger: ctx.editor.isActive("callout", { type: "danger" }), @@ -137,7 +139,22 @@ export function CalloutMenu({ editor }: EditorMenuProps) { variant="subtle" className={clsx({ [classes.active]: editorState?.isInfo })} > - + + + + + + setCalloutType("note")} + size="lg" + aria-label={t("Note")} + variant="subtle" + className={clsx({ [classes.active]: editorState?.isNote })} + > + @@ -149,7 +166,10 @@ export function CalloutMenu({ editor }: EditorMenuProps) { variant="subtle" className={clsx({ [classes.active]: editorState?.isSuccess })} > - + @@ -161,7 +181,10 @@ export function CalloutMenu({ editor }: EditorMenuProps) { variant="subtle" className={clsx({ [classes.active]: editorState?.isWarning })} > - + diff --git a/apps/client/src/features/editor/components/callout/callout-view.tsx b/apps/client/src/features/editor/components/callout/callout-view.tsx index 5583bd87..561947bb 100644 --- a/apps/client/src/features/editor/components/callout/callout-view.tsx +++ b/apps/client/src/features/editor/components/callout/callout-view.tsx @@ -4,6 +4,7 @@ import { IconCircleCheckFilled, IconCircleXFilled, IconInfoCircleFilled, + IconNotes, } from "@tabler/icons-react"; import { Alert } from "@mantine/core"; import classes from "./callout.module.css"; @@ -34,12 +35,14 @@ export default function CalloutView(props: NodeViewProps) { function getCalloutIcon(type: CalloutType, customIcon?: string) { if (customIcon && customIcon.trim() !== "") { - return {customIcon}; + return {customIcon}; } switch (type) { case "info": return ; + case "note": + return ; case "success": return ; case "warning": @@ -55,6 +58,8 @@ function getCalloutColor(type: CalloutType) { switch (type) { case "info": return "blue"; + case "note": + return "grape"; case "success": return "green"; case "warning": diff --git a/packages/editor-ext/src/lib/callout/utils.ts b/packages/editor-ext/src/lib/callout/utils.ts index 6484aa3b..26ff3856 100644 --- a/packages/editor-ext/src/lib/callout/utils.ts +++ b/packages/editor-ext/src/lib/callout/utils.ts @@ -1,8 +1,21 @@ -export type CalloutType = "default" | "info" | "success" | "warning" | "danger"; -const validCalloutTypes = ["default", "info", "success", "warning", "danger"]; +export type CalloutType = + | 'default' + | 'info' + | 'note' + | 'success' + | 'warning' + | 'danger'; +const validCalloutTypes = [ + 'default', + 'info', + 'note', + 'success', + 'warning', + 'danger', +]; export function getValidCalloutType(value: string): string { if (value) { - return validCalloutTypes.includes(value) ? value : "info"; + return validCalloutTypes.includes(value) ? value : 'info'; } }