ritext 1.0.15 → 1.0.18

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.
Files changed (63) hide show
  1. package/README.md +7 -8
  2. package/dist/chunk-2YUUKIIT.mjs +149 -0
  3. package/dist/{chunk-ZLCVIW2P.mjs → chunk-7QOFJIQ3.mjs} +1 -1
  4. package/dist/chunk-D47XME55.mjs +49 -0
  5. package/dist/{chunk-TQTCTY3E.mjs → chunk-FWCSY2DS.mjs} +1 -16
  6. package/dist/{chunk-CU67RXD7.mjs → chunk-GSHINFPO.mjs} +3 -3
  7. package/dist/{chunk-E4PPKAVK.mjs → chunk-LMOTHRGQ.mjs} +1 -1
  8. package/dist/{chunk-LO4RJXQF.mjs → chunk-MBF77NHS.mjs} +1 -1
  9. package/dist/chunk-VYDH6BZE.mjs +17 -0
  10. package/dist/extension/bold.d.mts +1 -1
  11. package/dist/extension/bold.d.ts +1 -1
  12. package/dist/extension/bold.js +1 -1
  13. package/dist/extension/bold.mjs +4 -3
  14. package/dist/extension/clearformat.d.mts +8 -0
  15. package/dist/extension/clearformat.d.ts +8 -0
  16. package/dist/extension/clearformat.js +239 -0
  17. package/dist/extension/clearformat.mjs +69 -0
  18. package/dist/extension/font-family.d.mts +23 -0
  19. package/dist/extension/font-family.d.ts +23 -0
  20. package/dist/extension/font-family.js +388 -0
  21. package/dist/extension/font-family.mjs +113 -0
  22. package/dist/extension/font-size.d.mts +23 -0
  23. package/dist/extension/font-size.d.ts +23 -0
  24. package/dist/extension/font-size.js +386 -0
  25. package/dist/extension/font-size.mjs +111 -0
  26. package/dist/extension/heading.d.mts +23 -0
  27. package/dist/extension/heading.d.ts +23 -0
  28. package/dist/extension/heading.js +593 -0
  29. package/dist/extension/heading.mjs +312 -0
  30. package/dist/extension/history.d.mts +8 -0
  31. package/dist/extension/history.d.ts +8 -0
  32. package/dist/extension/history.js +296 -0
  33. package/dist/extension/history.mjs +126 -0
  34. package/dist/extension/italic.d.mts +1 -1
  35. package/dist/extension/italic.d.ts +1 -1
  36. package/dist/extension/italic.js +1 -1
  37. package/dist/extension/italic.mjs +4 -3
  38. package/dist/extension/strike.d.mts +1 -1
  39. package/dist/extension/strike.d.ts +1 -1
  40. package/dist/extension/strike.js +1 -1
  41. package/dist/extension/strike.mjs +4 -3
  42. package/dist/extension/subandsuperscript.d.mts +1 -1
  43. package/dist/extension/subandsuperscript.d.ts +1 -1
  44. package/dist/extension/subandsuperscript.js +30 -21
  45. package/dist/extension/subandsuperscript.mjs +37 -159
  46. package/dist/extension/subscript.d.mts +1 -1
  47. package/dist/extension/subscript.d.ts +1 -1
  48. package/dist/extension/subscript.js +1 -1
  49. package/dist/extension/subscript.mjs +5 -4
  50. package/dist/extension/superscript.d.mts +1 -1
  51. package/dist/extension/superscript.d.ts +1 -1
  52. package/dist/extension/superscript.js +1 -1
  53. package/dist/extension/superscript.mjs +5 -4
  54. package/dist/extension/underline.d.mts +1 -1
  55. package/dist/extension/underline.d.ts +1 -1
  56. package/dist/extension/underline.js +1 -1
  57. package/dist/extension/underline.mjs +4 -3
  58. package/dist/index.css +375 -8
  59. package/dist/index.js +1 -2
  60. package/dist/index.mjs +3 -3
  61. package/dist/{tiptap-ext.type-D61hoEX5.d.mts → tiptap-ext.type-DrneAC5G.d.mts} +8 -1
  62. package/dist/{tiptap-ext.type-D61hoEX5.d.ts → tiptap-ext.type-DrneAC5G.d.ts} +8 -1
  63. package/package.json +27 -24
@@ -0,0 +1,386 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __defProps = Object.defineProperties;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
6
+ var __getOwnPropNames = Object.getOwnPropertyNames;
7
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
8
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
9
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
10
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
11
+ var __spreadValues = (a, b) => {
12
+ for (var prop in b || (b = {}))
13
+ if (__hasOwnProp.call(b, prop))
14
+ __defNormalProp(a, prop, b[prop]);
15
+ if (__getOwnPropSymbols)
16
+ for (var prop of __getOwnPropSymbols(b)) {
17
+ if (__propIsEnum.call(b, prop))
18
+ __defNormalProp(a, prop, b[prop]);
19
+ }
20
+ return a;
21
+ };
22
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
23
+ var __objRest = (source, exclude) => {
24
+ var target = {};
25
+ for (var prop in source)
26
+ if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
27
+ target[prop] = source[prop];
28
+ if (source != null && __getOwnPropSymbols)
29
+ for (var prop of __getOwnPropSymbols(source)) {
30
+ if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
31
+ target[prop] = source[prop];
32
+ }
33
+ return target;
34
+ };
35
+ var __export = (target, all) => {
36
+ for (var name in all)
37
+ __defProp(target, name, { get: all[name], enumerable: true });
38
+ };
39
+ var __copyProps = (to, from, except, desc) => {
40
+ if (from && typeof from === "object" || typeof from === "function") {
41
+ for (let key of __getOwnPropNames(from))
42
+ if (!__hasOwnProp.call(to, key) && key !== except)
43
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
44
+ }
45
+ return to;
46
+ };
47
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
48
+
49
+ // src/extension/FontSize.tsx
50
+ var FontSize_exports = {};
51
+ __export(FontSize_exports, {
52
+ DEFAULT_FONT_SIZE_LIST: () => DEFAULT_FONT_SIZE_LIST,
53
+ FontSize: () => FontSize
54
+ });
55
+ module.exports = __toCommonJS(FontSize_exports);
56
+ var import_extension_text_style = require("@tiptap/extension-text-style");
57
+
58
+ // src/lib/components/DropdownComponent.tsx
59
+ var import_react4 = require("react");
60
+ var import_tailwind_merge2 = require("tailwind-merge");
61
+
62
+ // src/lib/components/_com/Tooltip.tsx
63
+ var import_react = require("react");
64
+ var import_react2 = require("@floating-ui/react");
65
+ var import_react3 = require("motion/react");
66
+ var import_tailwind_merge = require("tailwind-merge");
67
+ var import_jsx_runtime = require("react/jsx-runtime");
68
+ var Tooltip = ({ placement = "top", children, content, className }) => {
69
+ const [open, setOpen] = (0, import_react.useState)(false);
70
+ const { x, y, refs, strategy, context, placement: resolvedPlacement } = (0, import_react2.useFloating)({
71
+ open,
72
+ onOpenChange: setOpen,
73
+ placement,
74
+ middleware: [(0, import_react2.offset)(8), (0, import_react2.flip)(), (0, import_react2.shift)({ padding: 8 })],
75
+ whileElementsMounted: import_react2.autoUpdate
76
+ });
77
+ const hover = (0, import_react2.useHover)(context);
78
+ const dismiss = (0, import_react2.useDismiss)(context);
79
+ const { getReferenceProps, getFloatingProps } = (0, import_react2.useInteractions)([hover, dismiss]);
80
+ const id = (0, import_react.useId)();
81
+ function mergeRefs(...refsToMerge) {
82
+ return (node) => {
83
+ for (const r of refsToMerge) {
84
+ if (!r) continue;
85
+ if (typeof r === "function") r(node);
86
+ else r.current = node;
87
+ }
88
+ };
89
+ }
90
+ const side = resolvedPlacement.split("-")[0];
91
+ const enterOffset = 6;
92
+ const getInitial = () => {
93
+ switch (side) {
94
+ case "top":
95
+ return { opacity: 0, y: enterOffset };
96
+ case "bottom":
97
+ return { opacity: 0, y: -enterOffset };
98
+ case "left":
99
+ return { opacity: 0, x: enterOffset };
100
+ case "right":
101
+ return { opacity: 0, x: -enterOffset };
102
+ default:
103
+ return { opacity: 0 };
104
+ }
105
+ };
106
+ const getExit = () => __spreadProps(__spreadValues({}, getInitial()), { opacity: 0 });
107
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_react.Fragment, { children: [
108
+ (0, import_react.isValidElement)(children) ? (0, import_react.cloneElement)(children, __spreadProps(__spreadValues({}, getReferenceProps({
109
+ onFocus: () => setOpen(true),
110
+ onBlur: () => setOpen(false),
111
+ "aria-describedby": open ? id : void 0
112
+ /* eslint-disable @typescript-eslint/no-explicit-any */
113
+ })), {
114
+ /* eslint-disable @typescript-eslint/no-explicit-any */
115
+ ref: mergeRefs(children.props.ref, refs.setReference)
116
+ })) : children,
117
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react2.FloatingPortal, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react3.AnimatePresence, { children: open && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
118
+ import_react3.motion.div,
119
+ __spreadProps(__spreadValues({
120
+ ref: refs.setFloating
121
+ }, getFloatingProps({
122
+ role: "tooltip",
123
+ id,
124
+ style: {
125
+ position: strategy,
126
+ top: y != null ? y : 0,
127
+ left: x != null ? x : 0,
128
+ pointerEvents: "none"
129
+ }
130
+ })), {
131
+ initial: getInitial(),
132
+ animate: { opacity: 1, x: 0, y: 0, scale: 1 },
133
+ exit: getExit(),
134
+ transition: { type: "spring", stiffness: 420, damping: 30, mass: 0.6 },
135
+ className: (0, import_tailwind_merge.twMerge)("bg-white border border-solid border-gray-200/50 py-1 px-3 rounded-lg text-sm shadow-lg shadow-gray-50 text-center", className),
136
+ children: content
137
+ }),
138
+ "tooltip"
139
+ ) }) })
140
+ ] });
141
+ };
142
+ var Tooltip_default = Tooltip;
143
+
144
+ // src/lib/components/DropdownComponent.tsx
145
+ var import_react5 = require("@floating-ui/react");
146
+
147
+ // src/lib/icon/ArrowIcon.tsx
148
+ var import_jsx_runtime2 = require("react/jsx-runtime");
149
+ var ArrowIcon = (_a) => {
150
+ var _b = _a, { size = 17, className } = _b, props = __objRest(_b, ["size", "className"]);
151
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
152
+ "svg",
153
+ __spreadProps(__spreadValues({
154
+ xmlns: "http://www.w3.org/2000/svg",
155
+ viewBox: "0 0 48 48",
156
+ fill: "none",
157
+ stroke: "currentColor",
158
+ strokeWidth: 2,
159
+ strokeLinecap: "round",
160
+ strokeLinejoin: "round",
161
+ width: size,
162
+ height: size,
163
+ className
164
+ }, props), {
165
+ children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("path", { fill: "currentColor", stroke: "currentColor", strokeLinejoin: "round", strokeWidth: "4", d: "M36 19L24 31L12 19z" })
166
+ })
167
+ );
168
+ };
169
+ var ArrowIcon_default = ArrowIcon;
170
+
171
+ // src/lib/components/DropdownComponent.tsx
172
+ var import_react6 = require("motion/react");
173
+ var import_jsx_runtime3 = require("react/jsx-runtime");
174
+ var DropdownComponent = ({ children, className, showArrow = true, content, dropdownClassName, style, tooltip, tooltipClassName, tooltipPlacement, _tooltipContent, _internalContent, _dropdownClassName }) => {
175
+ const [open, setOpen] = (0, import_react4.useState)(false);
176
+ const { x, y, refs, strategy, context } = (0, import_react5.useFloating)({
177
+ open,
178
+ onOpenChange: setOpen,
179
+ placement: "bottom",
180
+ middleware: [(0, import_react5.offset)(4), (0, import_react5.flip)(), (0, import_react5.shift)({ padding: 8 })],
181
+ whileElementsMounted: import_react5.autoUpdate
182
+ });
183
+ const click = (0, import_react5.useClick)(context);
184
+ const dismiss = (0, import_react5.useDismiss)(context);
185
+ const { getReferenceProps, getFloatingProps } = (0, import_react5.useInteractions)([click, dismiss]);
186
+ const listId = (0, import_react4.useId)();
187
+ const tooltipContent = /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("p", { children: typeof tooltip === "string" ? tooltip : _tooltipContent });
188
+ const initialMotion = { opacity: 0, scale: 0.95 };
189
+ const animateMotion = { opacity: 1, scale: 1 };
190
+ const enhancedChildren = import_react4.Children.map(children, (child) => {
191
+ if (!(0, import_react4.isValidElement)(child)) return child;
192
+ if (!("onSelect" in child.props)) return child;
193
+ const prevOnSelect = child.props.onSelect;
194
+ const combinedOnSelect = () => {
195
+ prevOnSelect == null ? void 0 : prevOnSelect();
196
+ setOpen(false);
197
+ };
198
+ return (0, import_react4.cloneElement)(child, { onSelect: combinedOnSelect });
199
+ });
200
+ const btn = /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
201
+ "button",
202
+ __spreadProps(__spreadValues({}, getReferenceProps({
203
+ ref: refs.setReference,
204
+ type: "button",
205
+ "aria-controls": open ? listId : void 0
206
+ })), {
207
+ className: (0, import_tailwind_merge2.twMerge)(
208
+ "p-1.5 rounded-md hover:bg-gray-100 items-center flex gap-x-0.5",
209
+ className
210
+ ),
211
+ style,
212
+ children: [
213
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { children: content != null ? content : _internalContent }),
214
+ showArrow && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(ArrowIcon_default, { size: 14, className: "text-gray-500 block" })
215
+ ]
216
+ })
217
+ );
218
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_react4.Fragment, { children: [
219
+ tooltip === false ? btn : /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
220
+ Tooltip_default,
221
+ {
222
+ content: tooltipContent,
223
+ className: tooltipClassName,
224
+ placement: tooltipPlacement,
225
+ children: btn
226
+ }
227
+ ),
228
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react5.FloatingPortal, { children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react6.AnimatePresence, { children: open && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
229
+ import_react6.motion.div,
230
+ __spreadProps(__spreadValues({}, getFloatingProps({
231
+ ref: refs.setFloating,
232
+ style: {
233
+ position: strategy,
234
+ top: y != null ? y : 0,
235
+ left: x != null ? x : 0
236
+ },
237
+ role: "listbox",
238
+ id: listId
239
+ })), {
240
+ initial: initialMotion,
241
+ animate: animateMotion,
242
+ exit: initialMotion,
243
+ className: (0, import_tailwind_merge2.twMerge)("bg-white border border-solid border-gray-200 p-2 space-y-1 rounded-lg shadow-sm shadow-gray-200/40 max-h-125 overflow-auto", _dropdownClassName, dropdownClassName),
244
+ children: enhancedChildren
245
+ })
246
+ ) }) })
247
+ ] });
248
+ };
249
+ var DropdownComponent_default = DropdownComponent;
250
+
251
+ // src/lib/components/DropdownItemComponent.tsx
252
+ var import_tailwind_merge3 = require("tailwind-merge");
253
+
254
+ // src/lib/context/editor.context.tsx
255
+ var import_react7 = require("react");
256
+ var import_jsx_runtime4 = require("react/jsx-runtime");
257
+ var EditorContext = (0, import_react7.createContext)({ editor: null });
258
+ var useEditor = () => {
259
+ const ctx = (0, import_react7.useContext)(EditorContext);
260
+ if (!ctx) throw new Error("<Toolbar/> & <Content/> component must be used inside <Editor>...</Editor/>");
261
+ return ctx;
262
+ };
263
+
264
+ // src/lib/components/DropdownItemComponent.tsx
265
+ var import_react8 = require("@tiptap/react");
266
+ var import_jsx_runtime5 = require("react/jsx-runtime");
267
+ var DropdownItemComponent = ({ item, onSelect, activeClassName, itemClassName, _itemClassName, showKeyShortcutText = true, spClass }) => {
268
+ const { editor } = useEditor();
269
+ const editorState = (0, import_react8.useEditorState)({
270
+ editor,
271
+ selector: ({ editor: editor2 }) => ({ isActive: (editor2 == null ? void 0 : editor2.isActive(item.name, item.ext ? { level: item.ext } : void 0)) || false })
272
+ });
273
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: (0, import_tailwind_merge3.twMerge)(
274
+ "flex items-center gap-x-2.5 transition-all duration-100 cursor-pointer select-none px-2 py-1.5 rounded-md",
275
+ _itemClassName,
276
+ (editorState == null ? void 0 : editorState.isActive) ? "bg-gray-200/60" : "hover:bg-gray-100",
277
+ itemClassName,
278
+ (editorState == null ? void 0 : editorState.isActive) ? activeClassName : "hover:bg-gray-100"
279
+ ), onClick: onSelect, children: [
280
+ item.icon,
281
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: (0, import_tailwind_merge3.twMerge)("flex-1 text-base", spClass), style: item.style, children: item.text }),
282
+ showKeyShortcutText && item.keyBind && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "ml-6 text-gray-400", children: item.keyBind })
283
+ ] });
284
+ };
285
+ var DropdownItemComponent_default = DropdownItemComponent;
286
+
287
+ // src/extension/FontSize.tsx
288
+ var import_jsx_runtime6 = require("react/jsx-runtime");
289
+ var FontSize = import_extension_text_style.FontSize.extend({
290
+ addOptions() {
291
+ var _a, _b;
292
+ const parent = (_a = this.parent) == null ? void 0 : _a.call(this);
293
+ return __spreadProps(__spreadValues({}, parent), {
294
+ types: (_b = parent == null ? void 0 : parent.types) != null ? _b : ["textStyle"],
295
+ fontSizeList: DEFAULT_FONT_SIZE_LIST,
296
+ component: ({ options, editor, dropdownContainerClassName, dropdownItemClassName }) => {
297
+ var _a2;
298
+ const items = (_a2 = options.fontSizeList) != null ? _a2 : DEFAULT_FONT_SIZE_LIST;
299
+ const list = items.map((it) => {
300
+ const label = typeof it === "string" ? it : it.label;
301
+ const value = typeof it === "string" ? it : it.value === void 0 ? it.label : it.value;
302
+ const isDefault = value == null || label.toLowerCase() === "default";
303
+ return {
304
+ id: crypto.randomUUID(),
305
+ text: label,
306
+ name: "fontSize",
307
+ onClick: () => {
308
+ if (isDefault) {
309
+ editor.chain().focus().unsetFontSize().run();
310
+ } else {
311
+ editor.chain().focus().setFontSize(String(value)).run();
312
+ }
313
+ }
314
+ };
315
+ });
316
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
317
+ DropdownComponent_default,
318
+ {
319
+ className: options.className,
320
+ showArrow: options.showArrow,
321
+ content: options.content,
322
+ dropdownClassName: options.dropdownClassName,
323
+ style: options.style,
324
+ tooltip: options.tooltip,
325
+ tooltipClassName: options.tooltipClassName,
326
+ tooltipPlacement: options.tooltipPlacement,
327
+ _tooltipContent: "Font Size",
328
+ _internalContent: "Font Size",
329
+ _dropdownClassName: dropdownContainerClassName,
330
+ children: [
331
+ list.slice(0, 1).map((item) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
332
+ DropdownItemComponent_default,
333
+ {
334
+ onSelect: item.onClick,
335
+ item,
336
+ activeClassName: options.activeClassName || "",
337
+ itemClassName: options.itemClassName || "",
338
+ _itemClassName: dropdownItemClassName
339
+ },
340
+ item.id
341
+ )),
342
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("hr", { className: "border-gray-200" }),
343
+ list.slice(1).map((item) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
344
+ DropdownItemComponent_default,
345
+ {
346
+ onSelect: item.onClick,
347
+ item,
348
+ activeClassName: options.activeClassName || "",
349
+ itemClassName: options.itemClassName || "",
350
+ _itemClassName: dropdownItemClassName
351
+ },
352
+ item.id
353
+ ))
354
+ ]
355
+ }
356
+ );
357
+ }
358
+ });
359
+ },
360
+ // ✅ guarantees TextStyle exists even if user forgot to add it
361
+ addExtensions() {
362
+ return [import_extension_text_style.TextStyle];
363
+ }
364
+ });
365
+ var DEFAULT_FONT_SIZE_LIST = [
366
+ { label: "Default", value: null },
367
+ "10px",
368
+ "11px",
369
+ "12px",
370
+ "14px",
371
+ "16px",
372
+ "18px",
373
+ "20px",
374
+ "22px",
375
+ "24px",
376
+ "26px",
377
+ "28px",
378
+ "36px",
379
+ "48px",
380
+ "72px"
381
+ ];
382
+ // Annotate the CommonJS export names for ESM import in node:
383
+ 0 && (module.exports = {
384
+ DEFAULT_FONT_SIZE_LIST,
385
+ FontSize
386
+ });
@@ -0,0 +1,111 @@
1
+ import {
2
+ DropdownComponent_default,
3
+ DropdownItemComponent_default
4
+ } from "../chunk-2YUUKIIT.mjs";
5
+ import "../chunk-7QOFJIQ3.mjs";
6
+ import "../chunk-VYDH6BZE.mjs";
7
+ import {
8
+ __spreadProps,
9
+ __spreadValues
10
+ } from "../chunk-FWCSY2DS.mjs";
11
+
12
+ // src/extension/FontSize.tsx
13
+ import { FontSize as TiptapFontSize, TextStyle } from "@tiptap/extension-text-style";
14
+ import { jsx, jsxs } from "react/jsx-runtime";
15
+ var FontSize = TiptapFontSize.extend({
16
+ addOptions() {
17
+ var _a, _b;
18
+ const parent = (_a = this.parent) == null ? void 0 : _a.call(this);
19
+ return __spreadProps(__spreadValues({}, parent), {
20
+ types: (_b = parent == null ? void 0 : parent.types) != null ? _b : ["textStyle"],
21
+ fontSizeList: DEFAULT_FONT_SIZE_LIST,
22
+ component: ({ options, editor, dropdownContainerClassName, dropdownItemClassName }) => {
23
+ var _a2;
24
+ const items = (_a2 = options.fontSizeList) != null ? _a2 : DEFAULT_FONT_SIZE_LIST;
25
+ const list = items.map((it) => {
26
+ const label = typeof it === "string" ? it : it.label;
27
+ const value = typeof it === "string" ? it : it.value === void 0 ? it.label : it.value;
28
+ const isDefault = value == null || label.toLowerCase() === "default";
29
+ return {
30
+ id: crypto.randomUUID(),
31
+ text: label,
32
+ name: "fontSize",
33
+ onClick: () => {
34
+ if (isDefault) {
35
+ editor.chain().focus().unsetFontSize().run();
36
+ } else {
37
+ editor.chain().focus().setFontSize(String(value)).run();
38
+ }
39
+ }
40
+ };
41
+ });
42
+ return /* @__PURE__ */ jsxs(
43
+ DropdownComponent_default,
44
+ {
45
+ className: options.className,
46
+ showArrow: options.showArrow,
47
+ content: options.content,
48
+ dropdownClassName: options.dropdownClassName,
49
+ style: options.style,
50
+ tooltip: options.tooltip,
51
+ tooltipClassName: options.tooltipClassName,
52
+ tooltipPlacement: options.tooltipPlacement,
53
+ _tooltipContent: "Font Size",
54
+ _internalContent: "Font Size",
55
+ _dropdownClassName: dropdownContainerClassName,
56
+ children: [
57
+ list.slice(0, 1).map((item) => /* @__PURE__ */ jsx(
58
+ DropdownItemComponent_default,
59
+ {
60
+ onSelect: item.onClick,
61
+ item,
62
+ activeClassName: options.activeClassName || "",
63
+ itemClassName: options.itemClassName || "",
64
+ _itemClassName: dropdownItemClassName
65
+ },
66
+ item.id
67
+ )),
68
+ /* @__PURE__ */ jsx("hr", { className: "border-gray-200" }),
69
+ list.slice(1).map((item) => /* @__PURE__ */ jsx(
70
+ DropdownItemComponent_default,
71
+ {
72
+ onSelect: item.onClick,
73
+ item,
74
+ activeClassName: options.activeClassName || "",
75
+ itemClassName: options.itemClassName || "",
76
+ _itemClassName: dropdownItemClassName
77
+ },
78
+ item.id
79
+ ))
80
+ ]
81
+ }
82
+ );
83
+ }
84
+ });
85
+ },
86
+ // ✅ guarantees TextStyle exists even if user forgot to add it
87
+ addExtensions() {
88
+ return [TextStyle];
89
+ }
90
+ });
91
+ var DEFAULT_FONT_SIZE_LIST = [
92
+ { label: "Default", value: null },
93
+ "10px",
94
+ "11px",
95
+ "12px",
96
+ "14px",
97
+ "16px",
98
+ "18px",
99
+ "20px",
100
+ "22px",
101
+ "24px",
102
+ "26px",
103
+ "28px",
104
+ "36px",
105
+ "48px",
106
+ "72px"
107
+ ];
108
+ export {
109
+ DEFAULT_FONT_SIZE_LIST,
110
+ FontSize
111
+ };
@@ -0,0 +1,23 @@
1
+ import { ReactNode } from 'react';
2
+ import { Node, Editor } from '@tiptap/react';
3
+ import { a as ExtDropdownOptions } from '../tiptap-ext.type-DrneAC5G.mjs';
4
+ import '@floating-ui/react';
5
+
6
+ interface ExtHeadingOptions extends ExtDropdownOptions {
7
+ showKeyShortcutText?: boolean;
8
+ level?: {
9
+ enable: boolean;
10
+ icon?: ReactNode;
11
+ text?: string;
12
+ keyShortcuts?: string;
13
+ }[];
14
+ component: (args: {
15
+ options: ExtHeadingOptions;
16
+ editor: Editor;
17
+ dropdownContainerClassName: string;
18
+ dropdownItemClassName: string;
19
+ }) => ReactNode;
20
+ }
21
+ declare const Heading: Node<ExtHeadingOptions>;
22
+
23
+ export { Heading };
@@ -0,0 +1,23 @@
1
+ import { ReactNode } from 'react';
2
+ import { Node, Editor } from '@tiptap/react';
3
+ import { a as ExtDropdownOptions } from '../tiptap-ext.type-DrneAC5G.js';
4
+ import '@floating-ui/react';
5
+
6
+ interface ExtHeadingOptions extends ExtDropdownOptions {
7
+ showKeyShortcutText?: boolean;
8
+ level?: {
9
+ enable: boolean;
10
+ icon?: ReactNode;
11
+ text?: string;
12
+ keyShortcuts?: string;
13
+ }[];
14
+ component: (args: {
15
+ options: ExtHeadingOptions;
16
+ editor: Editor;
17
+ dropdownContainerClassName: string;
18
+ dropdownItemClassName: string;
19
+ }) => ReactNode;
20
+ }
21
+ declare const Heading: Node<ExtHeadingOptions>;
22
+
23
+ export { Heading };