@farmzone/fz-react-ui 1.1.9 → 1.1.10
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.cjs +253 -51
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +13 -0
- package/dist/index.d.ts +13 -0
- package/dist/index.js +254 -52
- package/dist/index.js.map +1 -1
- package/dist/styles.css +1 -1
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -279,6 +279,9 @@ var Z_INDEX = {
|
|
|
279
279
|
CALENDAR_PORTAL: 60,
|
|
280
280
|
TOOLTIP: 70,
|
|
281
281
|
SELECT_CONTENT: 100,
|
|
282
|
+
// body에 직접 mount되는 플로팅 메뉴(예: 에디터 멘션 제안 목록)가
|
|
283
|
+
// Modal(55) 안에서 열려도 가려지지 않도록 TOP(Toast) 바로 아래 배치
|
|
284
|
+
OVERLAY_POPUP: 9998,
|
|
282
285
|
TOP: 9999,
|
|
283
286
|
MODAL_Z_STEP: 10
|
|
284
287
|
};
|
|
@@ -1285,7 +1288,7 @@ function PopoverContent({
|
|
|
1285
1288
|
side: position,
|
|
1286
1289
|
sideOffset,
|
|
1287
1290
|
className: cn(
|
|
1288
|
-
"z-
|
|
1291
|
+
"z-100 w-72 rounded-md border border-neutral-200 bg-white p-4 text-neutral-950 shadow-md outline-none",
|
|
1289
1292
|
"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",
|
|
1290
1293
|
"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",
|
|
1291
1294
|
className
|
|
@@ -10070,7 +10073,7 @@ var LIGHT = {
|
|
|
10070
10073
|
toolbar: {
|
|
10071
10074
|
wrapper: "border-b border-gray-200 bg-white",
|
|
10072
10075
|
btnIdle: "text-gray-700 hover:bg-gray-100",
|
|
10073
|
-
btnActive: "bg-
|
|
10076
|
+
btnActive: "bg-[var(--rich-editor-accent-bg,#e0e7ff)] text-[var(--rich-editor-accent-text,#4f46e5)]",
|
|
10074
10077
|
btnDestructive: "text-red-400 hover:bg-red-50 hover:text-red-600",
|
|
10075
10078
|
divider: "bg-gray-200",
|
|
10076
10079
|
rText: "text-gray-700"
|
|
@@ -10091,16 +10094,16 @@ var LIGHT = {
|
|
|
10091
10094
|
container: "border-gray-200 bg-white",
|
|
10092
10095
|
emptyText: "text-gray-400",
|
|
10093
10096
|
btnIdle: "text-gray-700 hover:bg-gray-100 hover:text-gray-900",
|
|
10094
|
-
btnSelected: "bg-
|
|
10097
|
+
btnSelected: "bg-[var(--rich-editor-accent-bg,#dbeafe)] text-[var(--rich-editor-accent-text,#1e3a8a)]",
|
|
10095
10098
|
badgeIdle: "bg-gray-100 text-gray-500",
|
|
10096
|
-
badgeSelected: "bg-
|
|
10099
|
+
badgeSelected: "bg-[var(--rich-editor-accent-bg,#bfdbfe)] text-[var(--rich-editor-accent-text,#1e40af)]"
|
|
10097
10100
|
}
|
|
10098
10101
|
};
|
|
10099
10102
|
var DARK = {
|
|
10100
10103
|
toolbar: {
|
|
10101
10104
|
wrapper: "border-b border-gray-800 bg-gray-900",
|
|
10102
10105
|
btnIdle: "text-gray-400 hover:bg-gray-800 hover:text-gray-200",
|
|
10103
|
-
btnActive: "bg-
|
|
10106
|
+
btnActive: "bg-[var(--rich-editor-accent-bg,rgba(49,46,129,0.5))] text-[var(--rich-editor-accent-text,#818cf8)]",
|
|
10104
10107
|
btnDestructive: "text-red-400 hover:bg-red-900/30 hover:text-red-300",
|
|
10105
10108
|
divider: "bg-gray-800",
|
|
10106
10109
|
rText: "text-gray-400"
|
|
@@ -10121,9 +10124,9 @@ var DARK = {
|
|
|
10121
10124
|
container: "border-gray-700 bg-gray-900",
|
|
10122
10125
|
emptyText: "text-gray-500",
|
|
10123
10126
|
btnIdle: "text-gray-300 hover:bg-gray-800 hover:text-gray-100",
|
|
10124
|
-
btnSelected: "bg-
|
|
10127
|
+
btnSelected: "bg-[var(--rich-editor-accent-bg,rgba(30,58,138,0.5))] text-[var(--rich-editor-accent-text,#bfdbfe)]",
|
|
10125
10128
|
badgeIdle: "bg-gray-800 text-gray-400",
|
|
10126
|
-
badgeSelected: "bg-
|
|
10129
|
+
badgeSelected: "bg-[var(--rich-editor-accent-bg,#1e40af)] text-[var(--rich-editor-accent-text,#bfdbfe)]"
|
|
10127
10130
|
}
|
|
10128
10131
|
};
|
|
10129
10132
|
var RICH_EDITOR_THEMES = {
|
|
@@ -10136,8 +10139,12 @@ function useRichEditorTheme() {
|
|
|
10136
10139
|
return React6.useContext(RichEditorThemeContext);
|
|
10137
10140
|
}
|
|
10138
10141
|
var MentionList = React6.forwardRef((props, ref) => {
|
|
10139
|
-
const { items, command, loading, className } = props;
|
|
10142
|
+
const { items, command, loading, className, listClassName, accentColor, accentTextColor } = props;
|
|
10140
10143
|
const theme = useRichEditorTheme();
|
|
10144
|
+
const accentStyle = {
|
|
10145
|
+
...accentColor ? { "--rich-editor-accent-bg": accentColor } : {},
|
|
10146
|
+
...accentTextColor ? { "--rich-editor-accent-text": accentTextColor } : {}
|
|
10147
|
+
};
|
|
10141
10148
|
const [selectedIndex, setSelectedIndex] = React6.useState(0);
|
|
10142
10149
|
const selectedRef = React6.useRef(null);
|
|
10143
10150
|
const selectItem = (index) => {
|
|
@@ -10167,41 +10174,58 @@ var MentionList = React6.forwardRef((props, ref) => {
|
|
|
10167
10174
|
return false;
|
|
10168
10175
|
}
|
|
10169
10176
|
}));
|
|
10170
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
10171
|
-
|
|
10172
|
-
|
|
10173
|
-
"
|
|
10174
|
-
|
|
10175
|
-
|
|
10176
|
-
|
|
10177
|
-
|
|
10178
|
-
|
|
10179
|
-
|
|
10180
|
-
|
|
10181
|
-
|
|
10182
|
-
|
|
10183
|
-
|
|
10184
|
-
|
|
10185
|
-
|
|
10186
|
-
|
|
10187
|
-
|
|
10188
|
-
|
|
10177
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
10178
|
+
"div",
|
|
10179
|
+
{
|
|
10180
|
+
className: cn("rich-editor-mention-list z-50 overflow-hidden rounded-md border shadow-md", theme.mention.container, className),
|
|
10181
|
+
style: accentStyle,
|
|
10182
|
+
children: loading ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn("px-3 py-2 text-sm", theme.mention.emptyText), children: "\uAC80\uC0C9 \uC911..." }) : items.length === 0 ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn("px-3 py-2 text-sm", theme.mention.emptyText), children: "\uAC80\uC0C9 \uACB0\uACFC \uC5C6\uC74C" }) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn("max-h-68 overflow-y-auto p-1", listClassName), children: items.map((item, index) => {
|
|
10183
|
+
const isSelected = index === selectedIndex;
|
|
10184
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
10185
|
+
"button",
|
|
10186
|
+
{
|
|
10187
|
+
ref: isSelected ? selectedRef : null,
|
|
10188
|
+
type: "button",
|
|
10189
|
+
onClick: () => selectItem(index),
|
|
10190
|
+
className: cn(
|
|
10191
|
+
"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",
|
|
10192
|
+
isSelected ? theme.mention.btnSelected : theme.mention.btnIdle
|
|
10193
|
+
),
|
|
10194
|
+
children: [
|
|
10195
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
10196
|
+
"span",
|
|
10197
|
+
{
|
|
10198
|
+
className: cn(
|
|
10199
|
+
"flex h-5 w-5 shrink-0 items-center justify-center rounded-full text-[11px] font-semibold",
|
|
10200
|
+
isSelected ? theme.mention.badgeSelected : theme.mention.badgeIdle
|
|
10201
|
+
),
|
|
10202
|
+
children: item.label[0]?.toUpperCase()
|
|
10203
|
+
}
|
|
10189
10204
|
),
|
|
10190
|
-
children: item.label
|
|
10191
|
-
|
|
10192
|
-
|
|
10193
|
-
|
|
10194
|
-
|
|
10195
|
-
}
|
|
10196
|
-
|
|
10197
|
-
|
|
10198
|
-
}) }) });
|
|
10205
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "truncate", children: item.label })
|
|
10206
|
+
]
|
|
10207
|
+
},
|
|
10208
|
+
item.id
|
|
10209
|
+
);
|
|
10210
|
+
}) })
|
|
10211
|
+
}
|
|
10212
|
+
);
|
|
10199
10213
|
});
|
|
10200
10214
|
MentionList.displayName = "MentionList";
|
|
10201
10215
|
|
|
10202
10216
|
// src/components/RichEditor/config/extensions.ts
|
|
10203
10217
|
function buildExtensions(config) {
|
|
10204
|
-
const {
|
|
10218
|
+
const {
|
|
10219
|
+
toolbar,
|
|
10220
|
+
mentionUsers = [],
|
|
10221
|
+
onMentionSearch,
|
|
10222
|
+
mentionClassName,
|
|
10223
|
+
mentionListClassName,
|
|
10224
|
+
mentionTagClassName,
|
|
10225
|
+
accentColor,
|
|
10226
|
+
accentTextColor,
|
|
10227
|
+
zIndex
|
|
10228
|
+
} = config;
|
|
10205
10229
|
const exts = [extensionTextStyle.TextStyleKit, buildMarkResetOnEnter()];
|
|
10206
10230
|
const headingLevels = toolbar.heading === false ? [] : Array.isArray(toolbar.heading) ? [...toolbar.heading] : [1, 2, 3, 4];
|
|
10207
10231
|
exts.push(
|
|
@@ -10242,7 +10266,7 @@ function buildExtensions(config) {
|
|
|
10242
10266
|
const ALL_ITEM = { id: "__all__", label: "\uBAA8\uB450" };
|
|
10243
10267
|
exts.push(
|
|
10244
10268
|
Mention__default.default.configure({
|
|
10245
|
-
HTMLAttributes: { class: "rich-editor-mention" },
|
|
10269
|
+
HTMLAttributes: { class: cn("rich-editor-mention", mentionTagClassName) },
|
|
10246
10270
|
suggestion: {
|
|
10247
10271
|
items: async ({ query }) => {
|
|
10248
10272
|
let items;
|
|
@@ -10258,18 +10282,25 @@ function buildExtensions(config) {
|
|
|
10258
10282
|
render: () => {
|
|
10259
10283
|
let component;
|
|
10260
10284
|
let unmount;
|
|
10285
|
+
const extraProps = {
|
|
10286
|
+
className: mentionClassName,
|
|
10287
|
+
listClassName: mentionListClassName,
|
|
10288
|
+
accentColor,
|
|
10289
|
+
accentTextColor
|
|
10290
|
+
};
|
|
10261
10291
|
return {
|
|
10262
10292
|
onStart: (props) => {
|
|
10263
10293
|
component = new react.ReactRenderer(MentionList, {
|
|
10264
|
-
props:
|
|
10294
|
+
props: { ...props, ...extraProps },
|
|
10265
10295
|
editor: props.editor
|
|
10266
10296
|
});
|
|
10267
10297
|
unmount = props.mount(component.element);
|
|
10298
|
+
if (component.element instanceof HTMLElement) {
|
|
10299
|
+
component.element.style.zIndex = String(zIndex ?? Z_INDEX.OVERLAY_POPUP);
|
|
10300
|
+
}
|
|
10268
10301
|
},
|
|
10269
10302
|
onUpdate: (props) => {
|
|
10270
|
-
component.updateProps(
|
|
10271
|
-
mentionClassName ? { ...props, className: mentionClassName } : props
|
|
10272
|
-
);
|
|
10303
|
+
component.updateProps({ ...props, ...extraProps });
|
|
10273
10304
|
},
|
|
10274
10305
|
onKeyDown: ({ event }) => {
|
|
10275
10306
|
return component.ref?.onKeyDown({ event }) ?? false;
|
|
@@ -10460,6 +10491,11 @@ function useRichEditor(options = {}) {
|
|
|
10460
10491
|
mentionUsers = [],
|
|
10461
10492
|
onMentionSearch,
|
|
10462
10493
|
mentionClassName,
|
|
10494
|
+
mentionListClassName,
|
|
10495
|
+
mentionTagClassName,
|
|
10496
|
+
accentColor,
|
|
10497
|
+
accentTextColor,
|
|
10498
|
+
zIndex,
|
|
10463
10499
|
editable = true,
|
|
10464
10500
|
autofocus,
|
|
10465
10501
|
editorClassName,
|
|
@@ -10477,7 +10513,12 @@ function useRichEditor(options = {}) {
|
|
|
10477
10513
|
toolbar,
|
|
10478
10514
|
mentionUsers,
|
|
10479
10515
|
onMentionSearch,
|
|
10480
|
-
mentionClassName
|
|
10516
|
+
mentionClassName,
|
|
10517
|
+
mentionListClassName,
|
|
10518
|
+
mentionTagClassName,
|
|
10519
|
+
accentColor,
|
|
10520
|
+
accentTextColor,
|
|
10521
|
+
zIndex
|
|
10481
10522
|
}),
|
|
10482
10523
|
...additionalExtensions
|
|
10483
10524
|
];
|
|
@@ -10579,6 +10620,97 @@ function RowIcon() {
|
|
|
10579
10620
|
/* @__PURE__ */ jsxRuntime.jsx("rect", { x: "1", y: "8", width: "12", height: "5", rx: "1", fill: "currentColor", opacity: "0.15" })
|
|
10580
10621
|
] });
|
|
10581
10622
|
}
|
|
10623
|
+
var DEFAULT_COLOR_ROWS = [
|
|
10624
|
+
["#9CA3AF", "#60A5FA", "#2DD4BF", "#4ADE80", "#FACC15", "#FB923C", "#F472B6", "#C084FC"],
|
|
10625
|
+
["#4B5563", "#2563EB", "#0D9488", "#16A34A", "#CA8A04", "#EA580C", "#DC2626", "#9333EA"],
|
|
10626
|
+
["#1F2937", "#1E3A8A", "#134E4A", "#14532D", "#713F12", "#7C2D12", "#7F1D1D", "#581C87"]
|
|
10627
|
+
];
|
|
10628
|
+
function isLightColor(hex) {
|
|
10629
|
+
const normalized = hex.replace("#", "");
|
|
10630
|
+
if (normalized.length !== 6) return true;
|
|
10631
|
+
const r = parseInt(normalized.slice(0, 2), 16) / 255;
|
|
10632
|
+
const g = parseInt(normalized.slice(2, 4), 16) / 255;
|
|
10633
|
+
const b = parseInt(normalized.slice(4, 6), 16) / 255;
|
|
10634
|
+
const toLinear = (c) => c <= 0.03928 ? c / 12.92 : ((c + 0.055) / 1.055) ** 2.4;
|
|
10635
|
+
const luminance = 0.2126 * toLinear(r) + 0.7152 * toLinear(g) + 0.0722 * toLinear(b);
|
|
10636
|
+
return luminance > 0.55;
|
|
10637
|
+
}
|
|
10638
|
+
function TextColorPicker({ editor, colors, currentColor, onClose }) {
|
|
10639
|
+
const [customColor, setCustomColor] = React6.useState(currentColor ?? "#000000");
|
|
10640
|
+
const rows = colors ? Array.isArray(colors[0]) ? colors : [colors] : DEFAULT_COLOR_ROWS;
|
|
10641
|
+
const applyColor = (color) => {
|
|
10642
|
+
editor.chain().focus().setColor(color).run();
|
|
10643
|
+
onClose();
|
|
10644
|
+
};
|
|
10645
|
+
const clearColor = () => {
|
|
10646
|
+
editor.chain().focus().unsetColor().run();
|
|
10647
|
+
onClose();
|
|
10648
|
+
};
|
|
10649
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "w-64 p-3", children: [
|
|
10650
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "mb-2 text-xs font-medium text-gray-400", children: "\uD14D\uC2A4\uD2B8 \uC0C9\uC0C1" }),
|
|
10651
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "space-y-1", children: rows.map((row, rowIdx) => /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex gap-1", children: row.map((color) => {
|
|
10652
|
+
const isSelected = currentColor?.toLowerCase() === color.toLowerCase();
|
|
10653
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
10654
|
+
"button",
|
|
10655
|
+
{
|
|
10656
|
+
type: "button",
|
|
10657
|
+
"aria-label": `\uAE00\uC790 \uC0C9\uC0C1 ${color}`,
|
|
10658
|
+
onClick: () => applyColor(color),
|
|
10659
|
+
className: cn(
|
|
10660
|
+
"flex size-6 shrink-0 cursor-pointer items-center justify-center rounded-full border transition-transform hover:scale-110",
|
|
10661
|
+
color.toLowerCase() === "#ffffff" ? "border-gray-300" : "border-black/10"
|
|
10662
|
+
),
|
|
10663
|
+
style: { backgroundColor: color },
|
|
10664
|
+
children: isSelected && /* @__PURE__ */ jsxRuntime.jsx(
|
|
10665
|
+
lucideReact.Check,
|
|
10666
|
+
{
|
|
10667
|
+
size: 12,
|
|
10668
|
+
strokeWidth: 3,
|
|
10669
|
+
className: isLightColor(color) ? "text-gray-900" : "text-white"
|
|
10670
|
+
}
|
|
10671
|
+
)
|
|
10672
|
+
},
|
|
10673
|
+
color
|
|
10674
|
+
);
|
|
10675
|
+
}) }, rowIdx)) }),
|
|
10676
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mt-3 flex items-center gap-2 border-t border-gray-100 pt-3", children: [
|
|
10677
|
+
/* @__PURE__ */ jsxRuntime.jsx("label", { className: "relative size-7 shrink-0 cursor-pointer overflow-hidden rounded-full border border-gray-200", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
10678
|
+
"input",
|
|
10679
|
+
{
|
|
10680
|
+
type: "color",
|
|
10681
|
+
value: customColor,
|
|
10682
|
+
onChange: (e) => {
|
|
10683
|
+
setCustomColor(e.target.value);
|
|
10684
|
+
applyColor(e.target.value);
|
|
10685
|
+
},
|
|
10686
|
+
className: "absolute -left-1 -top-1 size-9 cursor-pointer"
|
|
10687
|
+
}
|
|
10688
|
+
) }),
|
|
10689
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
10690
|
+
"input",
|
|
10691
|
+
{
|
|
10692
|
+
type: "text",
|
|
10693
|
+
value: customColor,
|
|
10694
|
+
onChange: (e) => setCustomColor(e.target.value),
|
|
10695
|
+
onKeyDown: (e) => {
|
|
10696
|
+
if (e.key === "Enter") applyColor(customColor);
|
|
10697
|
+
},
|
|
10698
|
+
placeholder: "#RRGGBB",
|
|
10699
|
+
className: "h-7 flex-1 rounded border border-gray-200 px-2 text-xs text-gray-700 outline-none focus:border-indigo-400"
|
|
10700
|
+
}
|
|
10701
|
+
)
|
|
10702
|
+
] }),
|
|
10703
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
10704
|
+
"button",
|
|
10705
|
+
{
|
|
10706
|
+
type: "button",
|
|
10707
|
+
onClick: clearColor,
|
|
10708
|
+
className: "mt-2 w-full cursor-pointer rounded py-1 text-xs font-medium text-gray-500 hover:bg-gray-100",
|
|
10709
|
+
children: "\uC0C9\uC0C1 \uC9C0\uC6B0\uAE30"
|
|
10710
|
+
}
|
|
10711
|
+
)
|
|
10712
|
+
] });
|
|
10713
|
+
}
|
|
10582
10714
|
function ToolbarButton(props) {
|
|
10583
10715
|
const { onMouseDown, active, disabled, title, tooltip, variant = "default", children } = props;
|
|
10584
10716
|
const theme = useRichEditorTheme();
|
|
@@ -10611,9 +10743,11 @@ function cmd(fn) {
|
|
|
10611
10743
|
};
|
|
10612
10744
|
}
|
|
10613
10745
|
function RichEditorToolbar(props) {
|
|
10614
|
-
const { editor, toolbar = {}, className } = props;
|
|
10746
|
+
const { editor, toolbar = {}, className, zIndex } = props;
|
|
10747
|
+
const popoverStyle = zIndex !== void 0 ? { zIndex } : void 0;
|
|
10615
10748
|
const theme = useRichEditorTheme();
|
|
10616
10749
|
const [tablePickerOpen, setTablePickerOpen] = React6.useState(false);
|
|
10750
|
+
const [colorPickerOpen, setColorPickerOpen] = React6.useState(false);
|
|
10617
10751
|
const stateOrNull = react.useEditorState({
|
|
10618
10752
|
editor,
|
|
10619
10753
|
selector: ({ editor: e }) => ({
|
|
@@ -10632,7 +10766,8 @@ function RichEditorToolbar(props) {
|
|
|
10632
10766
|
isOrderedList: e?.isActive("orderedList") ?? false,
|
|
10633
10767
|
isBlockquote: e?.isActive("blockquote") ?? false,
|
|
10634
10768
|
isCodeBlock: e?.isActive("codeBlock") ?? false,
|
|
10635
|
-
isTable: e?.isActive("table") ?? false
|
|
10769
|
+
isTable: e?.isActive("table") ?? false,
|
|
10770
|
+
textColor: e?.getAttributes("textStyle").color ?? null
|
|
10636
10771
|
})
|
|
10637
10772
|
});
|
|
10638
10773
|
if (!editor) return null;
|
|
@@ -10652,7 +10787,8 @@ function RichEditorToolbar(props) {
|
|
|
10652
10787
|
isOrderedList: false,
|
|
10653
10788
|
isBlockquote: false,
|
|
10654
10789
|
isCodeBlock: false,
|
|
10655
|
-
isTable: false
|
|
10790
|
+
isTable: false,
|
|
10791
|
+
textColor: null
|
|
10656
10792
|
};
|
|
10657
10793
|
const showHeadingGroup = toolbar.heading !== false && (Array.isArray(toolbar.heading) ? toolbar.heading.length > 0 : true);
|
|
10658
10794
|
const showInlineGroup = toolbar.bold !== false || toolbar.italic !== false || toolbar.strike !== false || toolbar.code !== false;
|
|
@@ -10750,8 +10886,44 @@ function RichEditorToolbar(props) {
|
|
|
10750
10886
|
children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Code, { size: 16 })
|
|
10751
10887
|
}
|
|
10752
10888
|
),
|
|
10753
|
-
|
|
10889
|
+
toolbar.textColor && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
10754
10890
|
showInlineGroup && /* @__PURE__ */ jsxRuntime.jsx(Divider, {}),
|
|
10891
|
+
/* @__PURE__ */ jsxRuntime.jsxs(Popover, { open: colorPickerOpen, onOpenChange: setColorPickerOpen, children: [
|
|
10892
|
+
/* @__PURE__ */ jsxRuntime.jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
10893
|
+
"button",
|
|
10894
|
+
{
|
|
10895
|
+
type: "button",
|
|
10896
|
+
"aria-label": "\uAE00\uC790 \uC0C9\uC0C1",
|
|
10897
|
+
className: cn(
|
|
10898
|
+
"flex h-8 w-8 cursor-pointer flex-col items-center justify-center gap-0.5 rounded text-sm transition-colors",
|
|
10899
|
+
"disabled:cursor-not-allowed disabled:opacity-40",
|
|
10900
|
+
state.textColor ? theme.toolbar.btnActive : theme.toolbar.btnIdle
|
|
10901
|
+
),
|
|
10902
|
+
children: [
|
|
10903
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.Baseline, { size: 16 }),
|
|
10904
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
10905
|
+
"span",
|
|
10906
|
+
{
|
|
10907
|
+
className: "h-0.5 w-4 rounded-full",
|
|
10908
|
+
style: { backgroundColor: state.textColor ?? "currentColor" }
|
|
10909
|
+
}
|
|
10910
|
+
)
|
|
10911
|
+
]
|
|
10912
|
+
}
|
|
10913
|
+
) }),
|
|
10914
|
+
/* @__PURE__ */ jsxRuntime.jsx(PopoverContent, { className: "w-auto p-0", align: "start", position: "bottom", style: popoverStyle, children: editor && /* @__PURE__ */ jsxRuntime.jsx(
|
|
10915
|
+
TextColorPicker,
|
|
10916
|
+
{
|
|
10917
|
+
editor,
|
|
10918
|
+
currentColor: state.textColor,
|
|
10919
|
+
colors: Array.isArray(toolbar.textColor) ? toolbar.textColor : void 0,
|
|
10920
|
+
onClose: () => setColorPickerOpen(false)
|
|
10921
|
+
}
|
|
10922
|
+
) })
|
|
10923
|
+
] })
|
|
10924
|
+
] }),
|
|
10925
|
+
showAlignGroup && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
10926
|
+
(showInlineGroup || toolbar.textColor) && /* @__PURE__ */ jsxRuntime.jsx(Divider, {}),
|
|
10755
10927
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
10756
10928
|
ToolbarButton,
|
|
10757
10929
|
{
|
|
@@ -10849,7 +11021,7 @@ function RichEditorToolbar(props) {
|
|
|
10849
11021
|
children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Table, { size: 16 })
|
|
10850
11022
|
}
|
|
10851
11023
|
) }),
|
|
10852
|
-
/* @__PURE__ */ jsxRuntime.jsx(PopoverContent, { className: "w-auto p-0", align: "start", position: "bottom", children: editor && /* @__PURE__ */ jsxRuntime.jsx(TableGridPicker, { editor, onClose: () => setTablePickerOpen(false) }) })
|
|
11024
|
+
/* @__PURE__ */ jsxRuntime.jsx(PopoverContent, { className: "w-auto p-0", align: "start", position: "bottom", style: popoverStyle, children: editor && /* @__PURE__ */ jsxRuntime.jsx(TableGridPicker, { editor, onClose: () => setTablePickerOpen(false) }) })
|
|
10853
11025
|
] }),
|
|
10854
11026
|
state.isTable && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
10855
11027
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -10944,7 +11116,8 @@ var DEFAULT_TOOLBAR = {
|
|
|
10944
11116
|
bulletList: true,
|
|
10945
11117
|
orderedList: true,
|
|
10946
11118
|
blockquote: true,
|
|
10947
|
-
code: true
|
|
11119
|
+
code: true,
|
|
11120
|
+
textColor: true
|
|
10948
11121
|
};
|
|
10949
11122
|
function RichEditorContent(props) {
|
|
10950
11123
|
const { editor, className, editorClassName, minHeight, maxHeight } = props;
|
|
@@ -10954,7 +11127,20 @@ function RichEditorContent(props) {
|
|
|
10954
11127
|
style.maxHeight = typeof maxHeight === "number" ? `${maxHeight}px` : maxHeight;
|
|
10955
11128
|
style.overflowY = "auto";
|
|
10956
11129
|
}
|
|
10957
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
11130
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
11131
|
+
"div",
|
|
11132
|
+
{
|
|
11133
|
+
className: cn("rich-editor-content cursor-text", className),
|
|
11134
|
+
style,
|
|
11135
|
+
onMouseDown: (e) => {
|
|
11136
|
+
if (!editor) return;
|
|
11137
|
+
if (e.target.closest(".ProseMirror")) return;
|
|
11138
|
+
e.preventDefault();
|
|
11139
|
+
editor.commands.focus("end");
|
|
11140
|
+
},
|
|
11141
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(react.EditorContent, { editor, className: cn("h-full", editorClassName) })
|
|
11142
|
+
}
|
|
11143
|
+
);
|
|
10958
11144
|
}
|
|
10959
11145
|
var RichEditor = React6.forwardRef(function RichEditor2({
|
|
10960
11146
|
value,
|
|
@@ -10973,6 +11159,11 @@ var RichEditor = React6.forwardRef(function RichEditor2({
|
|
|
10973
11159
|
bodyClassName,
|
|
10974
11160
|
editorClassName,
|
|
10975
11161
|
mentionClassName,
|
|
11162
|
+
mentionListClassName,
|
|
11163
|
+
mentionTagClassName,
|
|
11164
|
+
accentColor,
|
|
11165
|
+
accentTextColor,
|
|
11166
|
+
zIndex,
|
|
10976
11167
|
themeTokens,
|
|
10977
11168
|
editable = true,
|
|
10978
11169
|
autofocus
|
|
@@ -10998,6 +11189,11 @@ var RichEditor = React6.forwardRef(function RichEditor2({
|
|
|
10998
11189
|
mentionUsers,
|
|
10999
11190
|
onMentionSearch,
|
|
11000
11191
|
mentionClassName,
|
|
11192
|
+
mentionListClassName,
|
|
11193
|
+
mentionTagClassName,
|
|
11194
|
+
accentColor,
|
|
11195
|
+
accentTextColor,
|
|
11196
|
+
zIndex,
|
|
11001
11197
|
additionalExtensions,
|
|
11002
11198
|
editable,
|
|
11003
11199
|
autofocus,
|
|
@@ -11043,17 +11239,23 @@ var RichEditor = React6.forwardRef(function RichEditor2({
|
|
|
11043
11239
|
...themeTokens.toolbar && { toolbar: { ...baseTheme.toolbar, ...themeTokens.toolbar } },
|
|
11044
11240
|
...themeTokens.mention && { mention: { ...baseTheme.mention, ...themeTokens.mention } }
|
|
11045
11241
|
} : baseTheme;
|
|
11242
|
+
const accentStyle = {
|
|
11243
|
+
...accentColor ? { "--rich-editor-accent-bg": accentColor } : {},
|
|
11244
|
+
...accentTextColor ? { "--rich-editor-accent-text": accentTextColor } : {}
|
|
11245
|
+
};
|
|
11046
11246
|
return /* @__PURE__ */ jsxRuntime.jsx(RichEditorThemeProvider, { value: resolvedTheme, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
11047
11247
|
"div",
|
|
11048
11248
|
{
|
|
11049
11249
|
className: cn("overflow-hidden rounded-lg border border-gray-200 shadow-sm flex flex-col relative", className),
|
|
11050
11250
|
"data-rich-editor-theme": theme,
|
|
11251
|
+
style: accentStyle,
|
|
11051
11252
|
children: [
|
|
11052
11253
|
isToolbarVisible && /* @__PURE__ */ jsxRuntime.jsx(
|
|
11053
11254
|
RichEditorToolbar,
|
|
11054
11255
|
{
|
|
11055
11256
|
editor,
|
|
11056
|
-
toolbar: activeToolbar
|
|
11257
|
+
toolbar: activeToolbar,
|
|
11258
|
+
zIndex
|
|
11057
11259
|
}
|
|
11058
11260
|
),
|
|
11059
11261
|
/* @__PURE__ */ jsxRuntime.jsx(
|