@farmzone/fz-react-ui 1.1.9 → 1.1.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.cts CHANGED
@@ -1311,6 +1311,7 @@ interface RichEditorToolbarConfig {
1311
1311
  mention?: boolean;
1312
1312
  mentionAll?: boolean;
1313
1313
  table?: boolean;
1314
+ textColor?: boolean | string[];
1314
1315
  placeholder?: string;
1315
1316
  }
1316
1317
  interface RichEditorHandle {
@@ -1339,6 +1340,11 @@ interface RichEditorProps {
1339
1340
  bodyClassName?: string;
1340
1341
  editorClassName?: string;
1341
1342
  mentionClassName?: string;
1343
+ mentionListClassName?: string;
1344
+ mentionTagClassName?: string;
1345
+ accentColor?: string;
1346
+ accentTextColor?: string;
1347
+ zIndex?: number;
1342
1348
  editable?: boolean;
1343
1349
  autofocus?: boolean | "start" | "end" | "all" | null;
1344
1350
  onSubmit?: () => void;
@@ -1349,6 +1355,11 @@ interface UseRichEditorOptions {
1349
1355
  mentionUsers?: MentionItem[];
1350
1356
  onMentionSearch?: (query: string) => MentionItem[] | Promise<MentionItem[]>;
1351
1357
  mentionClassName?: string;
1358
+ mentionListClassName?: string;
1359
+ mentionTagClassName?: string;
1360
+ accentColor?: string;
1361
+ accentTextColor?: string;
1362
+ zIndex?: number;
1352
1363
  editable?: boolean;
1353
1364
  autofocus?: boolean | "start" | "end" | "all" | null;
1354
1365
  editorClassName?: string;
@@ -1367,6 +1378,7 @@ interface RichEditorToolbarProps {
1367
1378
  editor: _tiptap_core.Editor | null;
1368
1379
  toolbar?: RichEditorToolbarConfig;
1369
1380
  className?: string;
1381
+ zIndex?: number;
1370
1382
  }
1371
1383
 
1372
1384
  interface UseRichEditorReturn {
@@ -1630,6 +1642,7 @@ declare const Z_INDEX: {
1630
1642
  readonly CALENDAR_PORTAL: 60;
1631
1643
  readonly TOOLTIP: 70;
1632
1644
  readonly SELECT_CONTENT: 100;
1645
+ readonly OVERLAY_POPUP: 9998;
1633
1646
  readonly TOP: 9999;
1634
1647
  readonly MODAL_Z_STEP: 10;
1635
1648
  };
package/dist/index.d.ts CHANGED
@@ -1311,6 +1311,7 @@ interface RichEditorToolbarConfig {
1311
1311
  mention?: boolean;
1312
1312
  mentionAll?: boolean;
1313
1313
  table?: boolean;
1314
+ textColor?: boolean | string[];
1314
1315
  placeholder?: string;
1315
1316
  }
1316
1317
  interface RichEditorHandle {
@@ -1339,6 +1340,11 @@ interface RichEditorProps {
1339
1340
  bodyClassName?: string;
1340
1341
  editorClassName?: string;
1341
1342
  mentionClassName?: string;
1343
+ mentionListClassName?: string;
1344
+ mentionTagClassName?: string;
1345
+ accentColor?: string;
1346
+ accentTextColor?: string;
1347
+ zIndex?: number;
1342
1348
  editable?: boolean;
1343
1349
  autofocus?: boolean | "start" | "end" | "all" | null;
1344
1350
  onSubmit?: () => void;
@@ -1349,6 +1355,11 @@ interface UseRichEditorOptions {
1349
1355
  mentionUsers?: MentionItem[];
1350
1356
  onMentionSearch?: (query: string) => MentionItem[] | Promise<MentionItem[]>;
1351
1357
  mentionClassName?: string;
1358
+ mentionListClassName?: string;
1359
+ mentionTagClassName?: string;
1360
+ accentColor?: string;
1361
+ accentTextColor?: string;
1362
+ zIndex?: number;
1352
1363
  editable?: boolean;
1353
1364
  autofocus?: boolean | "start" | "end" | "all" | null;
1354
1365
  editorClassName?: string;
@@ -1367,6 +1378,7 @@ interface RichEditorToolbarProps {
1367
1378
  editor: _tiptap_core.Editor | null;
1368
1379
  toolbar?: RichEditorToolbarConfig;
1369
1380
  className?: string;
1381
+ zIndex?: number;
1370
1382
  }
1371
1383
 
1372
1384
  interface UseRichEditorReturn {
@@ -1630,6 +1642,7 @@ declare const Z_INDEX: {
1630
1642
  readonly CALENDAR_PORTAL: 60;
1631
1643
  readonly TOOLTIP: 70;
1632
1644
  readonly SELECT_CONTENT: 100;
1645
+ readonly OVERLAY_POPUP: 9998;
1633
1646
  readonly TOP: 9999;
1634
1647
  readonly MODAL_Z_STEP: 10;
1635
1648
  };
package/dist/index.js CHANGED
@@ -6,7 +6,7 @@ import * as React6 from 'react';
6
6
  import React6__default, { forwardRef, useState, useRef, useEffect, useImperativeHandle, useCallback, memo, createContext, useContext, useMemo, useId, useLayoutEffect, useDeferredValue, Fragment as Fragment$1 } from 'react';
7
7
  import { Slot } from '@radix-ui/react-slot';
8
8
  import * as TooltipPrimitive from '@radix-ui/react-tooltip';
9
- import { ChevronLeft, ChevronRight, FileText, ZoomIn, ZoomOut, RotateCcw, RotateCw, Download, X, Heading1, Heading2, Heading3, Heading4, Bold, Italic, Strikethrough, Code, AlignLeft, AlignCenter, AlignRight, List, ListOrdered, Quote, FileCode, Table as Table$1, Plus, Minus, Trash2, CircleX, EyeOff, Eye, Check, ChevronDown, Calendar, CircleIcon, ChevronUp, Search, TriangleAlert, Info, Pencil, BadgePlus, FileSearch2, Upload, FileUp, PanelRightClose, PanelLeftClose, ChevronFirst, ChevronLast, MoreHorizontal } from 'lucide-react';
9
+ import { ChevronLeft, ChevronRight, FileText, ZoomIn, ZoomOut, RotateCcw, RotateCw, Download, X, Heading1, Heading2, Heading3, Heading4, Bold, Italic, Strikethrough, Code, Baseline, AlignLeft, AlignCenter, AlignRight, List, ListOrdered, Quote, FileCode, Table as Table$1, Plus, Minus, Trash2, Check, CircleX, EyeOff, Eye, ChevronDown, Calendar, CircleIcon, ChevronUp, Search, TriangleAlert, Info, Pencil, BadgePlus, FileSearch2, Upload, FileUp, PanelRightClose, PanelLeftClose, ChevronFirst, ChevronLast, MoreHorizontal } from 'lucide-react';
10
10
  import * as SwitchPrimitive from '@radix-ui/react-switch';
11
11
  import * as RadixSlider from '@radix-ui/react-slider';
12
12
  import * as SelectPrimitive from '@radix-ui/react-select';
@@ -242,6 +242,9 @@ var Z_INDEX = {
242
242
  CALENDAR_PORTAL: 60,
243
243
  TOOLTIP: 70,
244
244
  SELECT_CONTENT: 100,
245
+ // body에 직접 mount되는 플로팅 메뉴(예: 에디터 멘션 제안 목록)가
246
+ // Modal(55) 안에서 열려도 가려지지 않도록 TOP(Toast) 바로 아래 배치
247
+ OVERLAY_POPUP: 9998,
245
248
  TOP: 9999,
246
249
  MODAL_Z_STEP: 10
247
250
  };
@@ -1248,7 +1251,7 @@ function PopoverContent({
1248
1251
  side: position,
1249
1252
  sideOffset,
1250
1253
  className: cn(
1251
- "z-50 w-72 rounded-md border border-neutral-200 bg-white p-4 text-neutral-950 shadow-md outline-none",
1254
+ "z-100 w-72 rounded-md border border-neutral-200 bg-white p-4 text-neutral-950 shadow-md outline-none",
1252
1255
  "data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95",
1253
1256
  "data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",
1254
1257
  className
@@ -10033,7 +10036,7 @@ var LIGHT = {
10033
10036
  toolbar: {
10034
10037
  wrapper: "border-b border-gray-200 bg-white",
10035
10038
  btnIdle: "text-gray-700 hover:bg-gray-100",
10036
- btnActive: "bg-indigo-100 text-indigo-600",
10039
+ btnActive: "bg-[var(--rich-editor-accent-bg,#e0e7ff)] text-[var(--rich-editor-accent-text,#4f46e5)]",
10037
10040
  btnDestructive: "text-red-400 hover:bg-red-50 hover:text-red-600",
10038
10041
  divider: "bg-gray-200",
10039
10042
  rText: "text-gray-700"
@@ -10054,16 +10057,16 @@ var LIGHT = {
10054
10057
  container: "border-gray-200 bg-white",
10055
10058
  emptyText: "text-gray-400",
10056
10059
  btnIdle: "text-gray-700 hover:bg-gray-100 hover:text-gray-900",
10057
- btnSelected: "bg-blue-100 text-blue-900",
10060
+ btnSelected: "bg-[var(--rich-editor-accent-bg,#dbeafe)] text-[var(--rich-editor-accent-text,#1e3a8a)]",
10058
10061
  badgeIdle: "bg-gray-100 text-gray-500",
10059
- badgeSelected: "bg-blue-200 text-blue-800"
10062
+ badgeSelected: "bg-[var(--rich-editor-accent-bg,#bfdbfe)] text-[var(--rich-editor-accent-text,#1e40af)]"
10060
10063
  }
10061
10064
  };
10062
10065
  var DARK = {
10063
10066
  toolbar: {
10064
10067
  wrapper: "border-b border-gray-800 bg-gray-900",
10065
10068
  btnIdle: "text-gray-400 hover:bg-gray-800 hover:text-gray-200",
10066
- btnActive: "bg-indigo-900/50 text-indigo-400",
10069
+ btnActive: "bg-[var(--rich-editor-accent-bg,rgba(49,46,129,0.5))] text-[var(--rich-editor-accent-text,#818cf8)]",
10067
10070
  btnDestructive: "text-red-400 hover:bg-red-900/30 hover:text-red-300",
10068
10071
  divider: "bg-gray-800",
10069
10072
  rText: "text-gray-400"
@@ -10084,9 +10087,9 @@ var DARK = {
10084
10087
  container: "border-gray-700 bg-gray-900",
10085
10088
  emptyText: "text-gray-500",
10086
10089
  btnIdle: "text-gray-300 hover:bg-gray-800 hover:text-gray-100",
10087
- btnSelected: "bg-blue-900/50 text-blue-200",
10090
+ btnSelected: "bg-[var(--rich-editor-accent-bg,rgba(30,58,138,0.5))] text-[var(--rich-editor-accent-text,#bfdbfe)]",
10088
10091
  badgeIdle: "bg-gray-800 text-gray-400",
10089
- badgeSelected: "bg-blue-800 text-blue-200"
10092
+ badgeSelected: "bg-[var(--rich-editor-accent-bg,#1e40af)] text-[var(--rich-editor-accent-text,#bfdbfe)]"
10090
10093
  }
10091
10094
  };
10092
10095
  var RICH_EDITOR_THEMES = {
@@ -10099,8 +10102,12 @@ function useRichEditorTheme() {
10099
10102
  return useContext(RichEditorThemeContext);
10100
10103
  }
10101
10104
  var MentionList = forwardRef((props, ref) => {
10102
- const { items, command, loading, className } = props;
10105
+ const { items, command, loading, className, listClassName, accentColor, accentTextColor } = props;
10103
10106
  const theme = useRichEditorTheme();
10107
+ const accentStyle = {
10108
+ ...accentColor ? { "--rich-editor-accent-bg": accentColor } : {},
10109
+ ...accentTextColor ? { "--rich-editor-accent-text": accentTextColor } : {}
10110
+ };
10104
10111
  const [selectedIndex, setSelectedIndex] = useState(0);
10105
10112
  const selectedRef = useRef(null);
10106
10113
  const selectItem = (index) => {
@@ -10130,41 +10137,58 @@ var MentionList = forwardRef((props, ref) => {
10130
10137
  return false;
10131
10138
  }
10132
10139
  }));
10133
- return /* @__PURE__ */ jsx("div", { className: cn("rich-editor-mention-list z-50 overflow-hidden rounded-md border shadow-md", theme.mention.container, className), children: loading ? /* @__PURE__ */ jsx("div", { className: cn("px-3 py-2 text-sm", theme.mention.emptyText), children: "\uAC80\uC0C9 \uC911..." }) : items.length === 0 ? /* @__PURE__ */ jsx("div", { className: cn("px-3 py-2 text-sm", theme.mention.emptyText), children: "\uAC80\uC0C9 \uACB0\uACFC \uC5C6\uC74C" }) : /* @__PURE__ */ jsx("div", { className: "max-h-48 overflow-y-auto p-1", children: items.map((item, index) => {
10134
- const isSelected = index === selectedIndex;
10135
- return /* @__PURE__ */ jsxs(
10136
- "button",
10137
- {
10138
- ref: isSelected ? selectedRef : null,
10139
- type: "button",
10140
- onClick: () => selectItem(index),
10141
- className: cn(
10142
- "flex w-full cursor-default items-center gap-2 rounded-sm py-1.5 pl-2 pr-4 text-sm text-left select-none transition-colors",
10143
- isSelected ? theme.mention.btnSelected : theme.mention.btnIdle
10144
- ),
10145
- children: [
10146
- /* @__PURE__ */ jsx(
10147
- "span",
10148
- {
10149
- className: cn(
10150
- "flex h-5 w-5 shrink-0 items-center justify-center rounded-full text-[11px] font-semibold",
10151
- isSelected ? theme.mention.badgeSelected : theme.mention.badgeIdle
10140
+ return /* @__PURE__ */ jsx(
10141
+ "div",
10142
+ {
10143
+ className: cn("rich-editor-mention-list z-50 overflow-hidden rounded-md border shadow-md", theme.mention.container, className),
10144
+ style: accentStyle,
10145
+ children: loading ? /* @__PURE__ */ jsx("div", { className: cn("px-3 py-2 text-sm", theme.mention.emptyText), children: "\uAC80\uC0C9 \uC911..." }) : items.length === 0 ? /* @__PURE__ */ jsx("div", { className: cn("px-3 py-2 text-sm", theme.mention.emptyText), children: "\uAC80\uC0C9 \uACB0\uACFC \uC5C6\uC74C" }) : /* @__PURE__ */ jsx("div", { className: cn("max-h-68 overflow-y-auto p-1", listClassName), children: items.map((item, index) => {
10146
+ const isSelected = index === selectedIndex;
10147
+ return /* @__PURE__ */ jsxs(
10148
+ "button",
10149
+ {
10150
+ ref: isSelected ? selectedRef : null,
10151
+ type: "button",
10152
+ onClick: () => selectItem(index),
10153
+ className: cn(
10154
+ "flex w-full cursor-default items-center gap-2 rounded-sm py-1.5 pl-2 pr-4 text-sm text-left select-none transition-colors",
10155
+ isSelected ? theme.mention.btnSelected : theme.mention.btnIdle
10156
+ ),
10157
+ children: [
10158
+ /* @__PURE__ */ jsx(
10159
+ "span",
10160
+ {
10161
+ className: cn(
10162
+ "flex h-5 w-5 shrink-0 items-center justify-center rounded-full text-[11px] font-semibold",
10163
+ isSelected ? theme.mention.badgeSelected : theme.mention.badgeIdle
10164
+ ),
10165
+ children: item.label[0]?.toUpperCase()
10166
+ }
10152
10167
  ),
10153
- children: item.label[0]?.toUpperCase()
10154
- }
10155
- ),
10156
- /* @__PURE__ */ jsx("span", { className: "truncate", children: item.label })
10157
- ]
10158
- },
10159
- item.id
10160
- );
10161
- }) }) });
10168
+ /* @__PURE__ */ jsx("span", { className: "truncate", children: item.label })
10169
+ ]
10170
+ },
10171
+ item.id
10172
+ );
10173
+ }) })
10174
+ }
10175
+ );
10162
10176
  });
10163
10177
  MentionList.displayName = "MentionList";
10164
10178
 
10165
10179
  // src/components/RichEditor/config/extensions.ts
10166
10180
  function buildExtensions(config) {
10167
- const { toolbar, mentionUsers = [], onMentionSearch, mentionClassName } = config;
10181
+ const {
10182
+ toolbar,
10183
+ mentionUsers = [],
10184
+ onMentionSearch,
10185
+ mentionClassName,
10186
+ mentionListClassName,
10187
+ mentionTagClassName,
10188
+ accentColor,
10189
+ accentTextColor,
10190
+ zIndex
10191
+ } = config;
10168
10192
  const exts = [TextStyleKit, buildMarkResetOnEnter()];
10169
10193
  const headingLevels = toolbar.heading === false ? [] : Array.isArray(toolbar.heading) ? [...toolbar.heading] : [1, 2, 3, 4];
10170
10194
  exts.push(
@@ -10205,7 +10229,7 @@ function buildExtensions(config) {
10205
10229
  const ALL_ITEM = { id: "__all__", label: "\uBAA8\uB450" };
10206
10230
  exts.push(
10207
10231
  Mention.configure({
10208
- HTMLAttributes: { class: "rich-editor-mention" },
10232
+ HTMLAttributes: { class: cn("rich-editor-mention", mentionTagClassName) },
10209
10233
  suggestion: {
10210
10234
  items: async ({ query }) => {
10211
10235
  let items;
@@ -10221,18 +10245,25 @@ function buildExtensions(config) {
10221
10245
  render: () => {
10222
10246
  let component;
10223
10247
  let unmount;
10248
+ const extraProps = {
10249
+ className: mentionClassName,
10250
+ listClassName: mentionListClassName,
10251
+ accentColor,
10252
+ accentTextColor
10253
+ };
10224
10254
  return {
10225
10255
  onStart: (props) => {
10226
10256
  component = new ReactRenderer(MentionList, {
10227
- props: mentionClassName ? { ...props, className: mentionClassName } : props,
10257
+ props: { ...props, ...extraProps },
10228
10258
  editor: props.editor
10229
10259
  });
10230
10260
  unmount = props.mount(component.element);
10261
+ if (component.element instanceof HTMLElement) {
10262
+ component.element.style.zIndex = String(zIndex ?? Z_INDEX.OVERLAY_POPUP);
10263
+ }
10231
10264
  },
10232
10265
  onUpdate: (props) => {
10233
- component.updateProps(
10234
- mentionClassName ? { ...props, className: mentionClassName } : props
10235
- );
10266
+ component.updateProps({ ...props, ...extraProps });
10236
10267
  },
10237
10268
  onKeyDown: ({ event }) => {
10238
10269
  return component.ref?.onKeyDown({ event }) ?? false;
@@ -10423,6 +10454,11 @@ function useRichEditor(options = {}) {
10423
10454
  mentionUsers = [],
10424
10455
  onMentionSearch,
10425
10456
  mentionClassName,
10457
+ mentionListClassName,
10458
+ mentionTagClassName,
10459
+ accentColor,
10460
+ accentTextColor,
10461
+ zIndex,
10426
10462
  editable = true,
10427
10463
  autofocus,
10428
10464
  editorClassName,
@@ -10440,7 +10476,12 @@ function useRichEditor(options = {}) {
10440
10476
  toolbar,
10441
10477
  mentionUsers,
10442
10478
  onMentionSearch,
10443
- mentionClassName
10479
+ mentionClassName,
10480
+ mentionListClassName,
10481
+ mentionTagClassName,
10482
+ accentColor,
10483
+ accentTextColor,
10484
+ zIndex
10444
10485
  }),
10445
10486
  ...additionalExtensions
10446
10487
  ];
@@ -10542,6 +10583,97 @@ function RowIcon() {
10542
10583
  /* @__PURE__ */ jsx("rect", { x: "1", y: "8", width: "12", height: "5", rx: "1", fill: "currentColor", opacity: "0.15" })
10543
10584
  ] });
10544
10585
  }
10586
+ var DEFAULT_COLOR_ROWS = [
10587
+ ["#9CA3AF", "#60A5FA", "#2DD4BF", "#4ADE80", "#FACC15", "#FB923C", "#F472B6", "#C084FC"],
10588
+ ["#4B5563", "#2563EB", "#0D9488", "#16A34A", "#CA8A04", "#EA580C", "#DC2626", "#9333EA"],
10589
+ ["#1F2937", "#1E3A8A", "#134E4A", "#14532D", "#713F12", "#7C2D12", "#7F1D1D", "#581C87"]
10590
+ ];
10591
+ function isLightColor(hex) {
10592
+ const normalized = hex.replace("#", "");
10593
+ if (normalized.length !== 6) return true;
10594
+ const r = parseInt(normalized.slice(0, 2), 16) / 255;
10595
+ const g = parseInt(normalized.slice(2, 4), 16) / 255;
10596
+ const b = parseInt(normalized.slice(4, 6), 16) / 255;
10597
+ const toLinear = (c) => c <= 0.03928 ? c / 12.92 : ((c + 0.055) / 1.055) ** 2.4;
10598
+ const luminance = 0.2126 * toLinear(r) + 0.7152 * toLinear(g) + 0.0722 * toLinear(b);
10599
+ return luminance > 0.55;
10600
+ }
10601
+ function TextColorPicker({ editor, colors, currentColor, onClose }) {
10602
+ const [customColor, setCustomColor] = useState(currentColor ?? "#000000");
10603
+ const rows = colors ? Array.isArray(colors[0]) ? colors : [colors] : DEFAULT_COLOR_ROWS;
10604
+ const applyColor = (color) => {
10605
+ editor.chain().focus().setColor(color).run();
10606
+ onClose();
10607
+ };
10608
+ const clearColor = () => {
10609
+ editor.chain().focus().unsetColor().run();
10610
+ onClose();
10611
+ };
10612
+ return /* @__PURE__ */ jsxs("div", { className: "w-64 p-3", children: [
10613
+ /* @__PURE__ */ jsx("p", { className: "mb-2 text-xs font-medium text-gray-400", children: "\uD14D\uC2A4\uD2B8 \uC0C9\uC0C1" }),
10614
+ /* @__PURE__ */ jsx("div", { className: "space-y-1", children: rows.map((row, rowIdx) => /* @__PURE__ */ jsx("div", { className: "flex gap-1", children: row.map((color) => {
10615
+ const isSelected = currentColor?.toLowerCase() === color.toLowerCase();
10616
+ return /* @__PURE__ */ jsx(
10617
+ "button",
10618
+ {
10619
+ type: "button",
10620
+ "aria-label": `\uAE00\uC790 \uC0C9\uC0C1 ${color}`,
10621
+ onClick: () => applyColor(color),
10622
+ className: cn(
10623
+ "flex size-6 shrink-0 cursor-pointer items-center justify-center rounded-full border transition-transform hover:scale-110",
10624
+ color.toLowerCase() === "#ffffff" ? "border-gray-300" : "border-black/10"
10625
+ ),
10626
+ style: { backgroundColor: color },
10627
+ children: isSelected && /* @__PURE__ */ jsx(
10628
+ Check,
10629
+ {
10630
+ size: 12,
10631
+ strokeWidth: 3,
10632
+ className: isLightColor(color) ? "text-gray-900" : "text-white"
10633
+ }
10634
+ )
10635
+ },
10636
+ color
10637
+ );
10638
+ }) }, rowIdx)) }),
10639
+ /* @__PURE__ */ jsxs("div", { className: "mt-3 flex items-center gap-2 border-t border-gray-100 pt-3", children: [
10640
+ /* @__PURE__ */ jsx("label", { className: "relative size-7 shrink-0 cursor-pointer overflow-hidden rounded-full border border-gray-200", children: /* @__PURE__ */ jsx(
10641
+ "input",
10642
+ {
10643
+ type: "color",
10644
+ value: customColor,
10645
+ onChange: (e) => {
10646
+ setCustomColor(e.target.value);
10647
+ applyColor(e.target.value);
10648
+ },
10649
+ className: "absolute -left-1 -top-1 size-9 cursor-pointer"
10650
+ }
10651
+ ) }),
10652
+ /* @__PURE__ */ jsx(
10653
+ "input",
10654
+ {
10655
+ type: "text",
10656
+ value: customColor,
10657
+ onChange: (e) => setCustomColor(e.target.value),
10658
+ onKeyDown: (e) => {
10659
+ if (e.key === "Enter") applyColor(customColor);
10660
+ },
10661
+ placeholder: "#RRGGBB",
10662
+ className: "h-7 flex-1 rounded border border-gray-200 px-2 text-xs text-gray-700 outline-none focus:border-indigo-400"
10663
+ }
10664
+ )
10665
+ ] }),
10666
+ /* @__PURE__ */ jsx(
10667
+ "button",
10668
+ {
10669
+ type: "button",
10670
+ onClick: clearColor,
10671
+ className: "mt-2 w-full cursor-pointer rounded py-1 text-xs font-medium text-gray-500 hover:bg-gray-100",
10672
+ children: "\uC0C9\uC0C1 \uC9C0\uC6B0\uAE30"
10673
+ }
10674
+ )
10675
+ ] });
10676
+ }
10545
10677
  function ToolbarButton(props) {
10546
10678
  const { onMouseDown, active, disabled, title, tooltip, variant = "default", children } = props;
10547
10679
  const theme = useRichEditorTheme();
@@ -10570,13 +10702,16 @@ function Divider() {
10570
10702
  function cmd(fn) {
10571
10703
  return (e) => {
10572
10704
  e.preventDefault();
10705
+ e.stopPropagation();
10573
10706
  fn();
10574
10707
  };
10575
10708
  }
10576
10709
  function RichEditorToolbar(props) {
10577
- const { editor, toolbar = {}, className } = props;
10710
+ const { editor, toolbar = {}, className, zIndex } = props;
10711
+ const popoverStyle = zIndex !== void 0 ? { zIndex } : void 0;
10578
10712
  const theme = useRichEditorTheme();
10579
10713
  const [tablePickerOpen, setTablePickerOpen] = useState(false);
10714
+ const [colorPickerOpen, setColorPickerOpen] = useState(false);
10580
10715
  const stateOrNull = useEditorState({
10581
10716
  editor,
10582
10717
  selector: ({ editor: e }) => ({
@@ -10595,7 +10730,8 @@ function RichEditorToolbar(props) {
10595
10730
  isOrderedList: e?.isActive("orderedList") ?? false,
10596
10731
  isBlockquote: e?.isActive("blockquote") ?? false,
10597
10732
  isCodeBlock: e?.isActive("codeBlock") ?? false,
10598
- isTable: e?.isActive("table") ?? false
10733
+ isTable: e?.isActive("table") ?? false,
10734
+ textColor: e?.getAttributes("textStyle").color ?? null
10599
10735
  })
10600
10736
  });
10601
10737
  if (!editor) return null;
@@ -10615,7 +10751,8 @@ function RichEditorToolbar(props) {
10615
10751
  isOrderedList: false,
10616
10752
  isBlockquote: false,
10617
10753
  isCodeBlock: false,
10618
- isTable: false
10754
+ isTable: false,
10755
+ textColor: null
10619
10756
  };
10620
10757
  const showHeadingGroup = toolbar.heading !== false && (Array.isArray(toolbar.heading) ? toolbar.heading.length > 0 : true);
10621
10758
  const showInlineGroup = toolbar.bold !== false || toolbar.italic !== false || toolbar.strike !== false || toolbar.code !== false;
@@ -10713,8 +10850,56 @@ function RichEditorToolbar(props) {
10713
10850
  children: /* @__PURE__ */ jsx(Code, { size: 16 })
10714
10851
  }
10715
10852
  ),
10716
- showAlignGroup && /* @__PURE__ */ jsxs(Fragment, { children: [
10853
+ toolbar.textColor && /* @__PURE__ */ jsxs(Fragment, { children: [
10717
10854
  showInlineGroup && /* @__PURE__ */ jsx(Divider, {}),
10855
+ /* @__PURE__ */ jsxs(Popover, { open: colorPickerOpen, onOpenChange: setColorPickerOpen, children: [
10856
+ /* @__PURE__ */ jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxs(
10857
+ "button",
10858
+ {
10859
+ type: "button",
10860
+ "aria-label": "\uAE00\uC790 \uC0C9\uC0C1",
10861
+ className: cn(
10862
+ "flex h-8 w-8 cursor-pointer flex-col items-center justify-center gap-0.5 rounded text-sm transition-colors",
10863
+ "disabled:cursor-not-allowed disabled:opacity-40",
10864
+ state.textColor ? theme.toolbar.btnActive : theme.toolbar.btnIdle
10865
+ ),
10866
+ children: [
10867
+ /* @__PURE__ */ jsx(Baseline, { size: 16 }),
10868
+ /* @__PURE__ */ jsx(
10869
+ "span",
10870
+ {
10871
+ className: "h-0.5 w-4 rounded-full",
10872
+ style: { backgroundColor: state.textColor ?? "currentColor" }
10873
+ }
10874
+ )
10875
+ ]
10876
+ }
10877
+ ) }),
10878
+ /* @__PURE__ */ jsx(
10879
+ PopoverContent,
10880
+ {
10881
+ className: "w-auto p-0",
10882
+ align: "start",
10883
+ position: "bottom",
10884
+ style: popoverStyle,
10885
+ onMouseDown: (e) => e.stopPropagation(),
10886
+ onOpenAutoFocus: (e) => e.preventDefault(),
10887
+ onFocusOutside: (e) => e.preventDefault(),
10888
+ children: editor && /* @__PURE__ */ jsx(
10889
+ TextColorPicker,
10890
+ {
10891
+ editor,
10892
+ currentColor: state.textColor,
10893
+ colors: Array.isArray(toolbar.textColor) ? toolbar.textColor : void 0,
10894
+ onClose: () => setColorPickerOpen(false)
10895
+ }
10896
+ )
10897
+ }
10898
+ )
10899
+ ] })
10900
+ ] }),
10901
+ showAlignGroup && /* @__PURE__ */ jsxs(Fragment, { children: [
10902
+ (showInlineGroup || toolbar.textColor) && /* @__PURE__ */ jsx(Divider, {}),
10718
10903
  /* @__PURE__ */ jsx(
10719
10904
  ToolbarButton,
10720
10905
  {
@@ -10812,7 +10997,19 @@ function RichEditorToolbar(props) {
10812
10997
  children: /* @__PURE__ */ jsx(Table$1, { size: 16 })
10813
10998
  }
10814
10999
  ) }),
10815
- /* @__PURE__ */ jsx(PopoverContent, { className: "w-auto p-0", align: "start", position: "bottom", children: editor && /* @__PURE__ */ jsx(TableGridPicker, { editor, onClose: () => setTablePickerOpen(false) }) })
11000
+ /* @__PURE__ */ jsx(
11001
+ PopoverContent,
11002
+ {
11003
+ className: "w-auto p-0",
11004
+ align: "start",
11005
+ position: "bottom",
11006
+ style: popoverStyle,
11007
+ onMouseDown: (e) => e.stopPropagation(),
11008
+ onOpenAutoFocus: (e) => e.preventDefault(),
11009
+ onFocusOutside: (e) => e.preventDefault(),
11010
+ children: editor && /* @__PURE__ */ jsx(TableGridPicker, { editor, onClose: () => setTablePickerOpen(false) })
11011
+ }
11012
+ )
10816
11013
  ] }),
10817
11014
  state.isTable && /* @__PURE__ */ jsxs(Fragment, { children: [
10818
11015
  /* @__PURE__ */ jsx(
@@ -10907,7 +11104,8 @@ var DEFAULT_TOOLBAR = {
10907
11104
  bulletList: true,
10908
11105
  orderedList: true,
10909
11106
  blockquote: true,
10910
- code: true
11107
+ code: true,
11108
+ textColor: true
10911
11109
  };
10912
11110
  function RichEditorContent(props) {
10913
11111
  const { editor, className, editorClassName, minHeight, maxHeight } = props;
@@ -10917,7 +11115,20 @@ function RichEditorContent(props) {
10917
11115
  style.maxHeight = typeof maxHeight === "number" ? `${maxHeight}px` : maxHeight;
10918
11116
  style.overflowY = "auto";
10919
11117
  }
10920
- return /* @__PURE__ */ jsx("div", { className: cn("rich-editor-content", className), style, children: /* @__PURE__ */ jsx(EditorContent, { editor, className: cn("h-full", editorClassName) }) });
11118
+ return /* @__PURE__ */ jsx(
11119
+ "div",
11120
+ {
11121
+ className: cn("rich-editor-content cursor-text", className),
11122
+ style,
11123
+ onMouseDown: (e) => {
11124
+ if (!editor) return;
11125
+ if (e.target.closest(".ProseMirror")) return;
11126
+ e.preventDefault();
11127
+ editor.commands.focus("end");
11128
+ },
11129
+ children: /* @__PURE__ */ jsx(EditorContent, { editor, className: cn("h-full", editorClassName) })
11130
+ }
11131
+ );
10921
11132
  }
10922
11133
  var RichEditor = forwardRef(function RichEditor2({
10923
11134
  value,
@@ -10936,6 +11147,11 @@ var RichEditor = forwardRef(function RichEditor2({
10936
11147
  bodyClassName,
10937
11148
  editorClassName,
10938
11149
  mentionClassName,
11150
+ mentionListClassName,
11151
+ mentionTagClassName,
11152
+ accentColor,
11153
+ accentTextColor,
11154
+ zIndex,
10939
11155
  themeTokens,
10940
11156
  editable = true,
10941
11157
  autofocus
@@ -10961,6 +11177,11 @@ var RichEditor = forwardRef(function RichEditor2({
10961
11177
  mentionUsers,
10962
11178
  onMentionSearch,
10963
11179
  mentionClassName,
11180
+ mentionListClassName,
11181
+ mentionTagClassName,
11182
+ accentColor,
11183
+ accentTextColor,
11184
+ zIndex,
10964
11185
  additionalExtensions,
10965
11186
  editable,
10966
11187
  autofocus,
@@ -11006,17 +11227,23 @@ var RichEditor = forwardRef(function RichEditor2({
11006
11227
  ...themeTokens.toolbar && { toolbar: { ...baseTheme.toolbar, ...themeTokens.toolbar } },
11007
11228
  ...themeTokens.mention && { mention: { ...baseTheme.mention, ...themeTokens.mention } }
11008
11229
  } : baseTheme;
11230
+ const accentStyle = {
11231
+ ...accentColor ? { "--rich-editor-accent-bg": accentColor } : {},
11232
+ ...accentTextColor ? { "--rich-editor-accent-text": accentTextColor } : {}
11233
+ };
11009
11234
  return /* @__PURE__ */ jsx(RichEditorThemeProvider, { value: resolvedTheme, children: /* @__PURE__ */ jsxs(
11010
11235
  "div",
11011
11236
  {
11012
11237
  className: cn("overflow-hidden rounded-lg border border-gray-200 shadow-sm flex flex-col relative", className),
11013
11238
  "data-rich-editor-theme": theme,
11239
+ style: accentStyle,
11014
11240
  children: [
11015
11241
  isToolbarVisible && /* @__PURE__ */ jsx(
11016
11242
  RichEditorToolbar,
11017
11243
  {
11018
11244
  editor,
11019
- toolbar: activeToolbar
11245
+ toolbar: activeToolbar,
11246
+ zIndex
11020
11247
  }
11021
11248
  ),
11022
11249
  /* @__PURE__ */ jsx(