ritext 1.0.14 → 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.
- package/README.md +27 -28
- package/dist/chunk-2YUUKIIT.mjs +149 -0
- package/dist/chunk-7QOFJIQ3.mjs +90 -0
- package/dist/chunk-D47XME55.mjs +49 -0
- package/dist/chunk-FWCSY2DS.mjs +37 -0
- package/dist/chunk-GSHINFPO.mjs +53 -0
- package/dist/chunk-LMOTHRGQ.mjs +37 -0
- package/dist/chunk-MBF77NHS.mjs +37 -0
- package/dist/chunk-VYDH6BZE.mjs +17 -0
- package/dist/extension/bold.d.mts +8 -0
- package/dist/extension/bold.d.ts +8 -0
- package/dist/extension/bold.js +260 -0
- package/dist/extension/bold.mjs +70 -0
- package/dist/extension/clearformat.d.mts +8 -0
- package/dist/extension/clearformat.d.ts +8 -0
- package/dist/extension/clearformat.js +239 -0
- package/dist/extension/clearformat.mjs +69 -0
- package/dist/extension/font-family.d.mts +23 -0
- package/dist/extension/font-family.d.ts +23 -0
- package/dist/extension/font-family.js +388 -0
- package/dist/extension/font-family.mjs +113 -0
- package/dist/extension/font-size.d.mts +23 -0
- package/dist/extension/font-size.d.ts +23 -0
- package/dist/extension/font-size.js +386 -0
- package/dist/extension/font-size.mjs +111 -0
- package/dist/extension/heading.d.mts +23 -0
- package/dist/extension/heading.d.ts +23 -0
- package/dist/extension/heading.js +593 -0
- package/dist/extension/heading.mjs +312 -0
- package/dist/extension/history.d.mts +8 -0
- package/dist/extension/history.d.ts +8 -0
- package/dist/extension/history.js +296 -0
- package/dist/extension/history.mjs +126 -0
- package/dist/extension/italic.d.mts +8 -0
- package/dist/extension/italic.d.ts +8 -0
- package/dist/extension/italic.js +264 -0
- package/dist/extension/italic.mjs +74 -0
- package/dist/extension/strike.d.mts +8 -0
- package/dist/extension/strike.d.ts +8 -0
- package/dist/extension/strike.js +264 -0
- package/dist/extension/strike.mjs +74 -0
- package/dist/extension/subandsuperscript.d.mts +21 -0
- package/dist/extension/subandsuperscript.d.ts +21 -0
- package/dist/extension/subandsuperscript.js +452 -0
- package/dist/extension/subandsuperscript.mjs +121 -0
- package/dist/extension/subscript.d.mts +8 -0
- package/dist/extension/subscript.d.ts +8 -0
- package/dist/extension/subscript.js +264 -0
- package/dist/extension/subscript.mjs +46 -0
- package/dist/extension/superscript.d.mts +8 -0
- package/dist/extension/superscript.d.ts +8 -0
- package/dist/extension/superscript.js +264 -0
- package/dist/extension/superscript.mjs +46 -0
- package/dist/extension/underline.d.mts +8 -0
- package/dist/extension/underline.d.ts +8 -0
- package/dist/extension/underline.js +263 -0
- package/dist/extension/underline.mjs +73 -0
- package/dist/index.css +471 -5
- package/dist/index.d.mts +6 -32
- package/dist/index.d.ts +6 -32
- package/dist/index.js +26 -538
- package/dist/index.mjs +31 -549
- package/dist/tiptap-ext.type-DrneAC5G.d.mts +39 -0
- package/dist/tiptap-ext.type-DrneAC5G.d.ts +39 -0
- package/package.json +52 -26
package/dist/index.mjs
CHANGED
|
@@ -1,34 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
7
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
8
|
-
var __spreadValues = (a, b) => {
|
|
9
|
-
for (var prop in b || (b = {}))
|
|
10
|
-
if (__hasOwnProp.call(b, prop))
|
|
11
|
-
__defNormalProp(a, prop, b[prop]);
|
|
12
|
-
if (__getOwnPropSymbols)
|
|
13
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
14
|
-
if (__propIsEnum.call(b, prop))
|
|
15
|
-
__defNormalProp(a, prop, b[prop]);
|
|
16
|
-
}
|
|
17
|
-
return a;
|
|
18
|
-
};
|
|
19
|
-
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
20
|
-
var __objRest = (source, exclude) => {
|
|
21
|
-
var target = {};
|
|
22
|
-
for (var prop in source)
|
|
23
|
-
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
24
|
-
target[prop] = source[prop];
|
|
25
|
-
if (source != null && __getOwnPropSymbols)
|
|
26
|
-
for (var prop of __getOwnPropSymbols(source)) {
|
|
27
|
-
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
28
|
-
target[prop] = source[prop];
|
|
29
|
-
}
|
|
30
|
-
return target;
|
|
31
|
-
};
|
|
1
|
+
import {
|
|
2
|
+
EditorProvider,
|
|
3
|
+
useEditor
|
|
4
|
+
} from "./chunk-VYDH6BZE.mjs";
|
|
5
|
+
import "./chunk-FWCSY2DS.mjs";
|
|
32
6
|
|
|
33
7
|
// src/lib/Editor.tsx
|
|
34
8
|
import { useMemo } from "react";
|
|
@@ -36,553 +10,61 @@ import { useEditor as useEditor2 } from "@tiptap/react";
|
|
|
36
10
|
import Document from "@tiptap/extension-document";
|
|
37
11
|
import Paragraph from "@tiptap/extension-paragraph";
|
|
38
12
|
import Text from "@tiptap/extension-text";
|
|
39
|
-
|
|
40
|
-
// src/lib/context/editor.context.tsx
|
|
41
|
-
import { createContext, useContext } from "react";
|
|
42
13
|
import { jsx } from "react/jsx-runtime";
|
|
43
|
-
var EditorContext = createContext({ editor: null });
|
|
44
|
-
var useEditor = () => {
|
|
45
|
-
const ctx = useContext(EditorContext);
|
|
46
|
-
if (!ctx) throw new Error("<Toolbar/> & <Content/> component must be used inside <Editor>...</Editor/>");
|
|
47
|
-
return ctx;
|
|
48
|
-
};
|
|
49
|
-
var EditorProvider = ({ children, value }) => {
|
|
50
|
-
return /* @__PURE__ */ jsx(EditorContext.Provider, { value, children });
|
|
51
|
-
};
|
|
52
|
-
|
|
53
|
-
// src/lib/Editor.tsx
|
|
54
|
-
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
55
14
|
var Editor = ({ children, extensions = [], className }) => {
|
|
56
15
|
const editor = useEditor2({
|
|
57
16
|
extensions: [Document, Paragraph, Text, ...extensions],
|
|
58
17
|
immediatelyRender: false
|
|
59
18
|
});
|
|
60
19
|
const value = useMemo(() => ({ editor }), [editor]);
|
|
61
|
-
return /* @__PURE__ */
|
|
20
|
+
return /* @__PURE__ */ jsx(EditorProvider, { value, children: /* @__PURE__ */ jsx("div", { className, children }) });
|
|
62
21
|
};
|
|
63
22
|
var Editor_default = Editor;
|
|
64
23
|
|
|
65
24
|
// src/lib/Toolbar.tsx
|
|
66
25
|
import * as React from "react";
|
|
67
26
|
import { twMerge } from "tailwind-merge";
|
|
68
|
-
import { jsx as
|
|
69
|
-
var Toolbar = ({ className, buttonClassName }) => {
|
|
27
|
+
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
28
|
+
var Toolbar = ({ className, buttonClassName, dropdownContainerClassName, dropdownItemClassName }) => {
|
|
70
29
|
const { editor } = useEditor();
|
|
71
30
|
if (!editor) return null;
|
|
72
31
|
const entries = editor.extensionManager.extensions.map((ext) => {
|
|
73
|
-
var _a
|
|
32
|
+
var _a;
|
|
74
33
|
const anyExt = ext;
|
|
75
|
-
const renderButton = (
|
|
76
|
-
|
|
34
|
+
const renderButton = (
|
|
35
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
36
|
+
(_a = anyExt.options) == null ? void 0 : _a.component
|
|
37
|
+
);
|
|
38
|
+
return renderButton ? {
|
|
39
|
+
name: anyExt.name,
|
|
40
|
+
renderButton,
|
|
41
|
+
options: anyExt.options,
|
|
42
|
+
buttonClassName: anyExt.buttonClassName,
|
|
43
|
+
dropdownContainerClassName: anyExt.dropdownContainerClassName,
|
|
44
|
+
dropdownItemClassName: anyExt.dropdownItemClassName
|
|
45
|
+
} : null;
|
|
77
46
|
}).filter(Boolean);
|
|
78
|
-
|
|
79
|
-
|
|
47
|
+
return /* @__PURE__ */ jsx2("div", { className: twMerge("flex gap-x-1", className), children: entries.map(({ name, renderButton, options }) => /* @__PURE__ */ jsx2(React.Fragment, { children: renderButton({
|
|
48
|
+
editor,
|
|
49
|
+
options,
|
|
50
|
+
buttonClassName: buttonClassName || "",
|
|
51
|
+
dropdownContainerClassName: dropdownContainerClassName || "",
|
|
52
|
+
dropdownItemClassName: dropdownItemClassName || ""
|
|
53
|
+
}) }, name)) });
|
|
80
54
|
};
|
|
81
55
|
var Toolbar_default = Toolbar;
|
|
82
56
|
|
|
83
57
|
// src/lib/Content.tsx
|
|
84
58
|
import { EditorContent } from "@tiptap/react";
|
|
85
59
|
import { twMerge as twMerge2 } from "tailwind-merge";
|
|
86
|
-
import { jsx as
|
|
60
|
+
import { jsx as jsx3 } from "react/jsx-runtime";
|
|
87
61
|
var Content = ({ className }) => {
|
|
88
62
|
const { editor } = useEditor();
|
|
89
|
-
return /* @__PURE__ */
|
|
63
|
+
return /* @__PURE__ */ jsx3(EditorContent, { editor, className: twMerge2("focus:outline-none [&_.tiptap]:focus:outline-none [&_.tiptap]:min-h-[200px] [&_.tiptap]:p-[10px_20px]", className) });
|
|
90
64
|
};
|
|
91
65
|
var Content_default = Content;
|
|
92
|
-
|
|
93
|
-
// src/lib/extensions/Bold.tsx
|
|
94
|
-
import TiptapBold from "@tiptap/extension-bold";
|
|
95
|
-
|
|
96
|
-
// src/lib/icon/BoldIcon.tsx
|
|
97
|
-
import { jsx as jsx5 } from "react/jsx-runtime";
|
|
98
|
-
var BoldIcon = (_a) => {
|
|
99
|
-
var _b = _a, { size = 17, className } = _b, props = __objRest(_b, ["size", "className"]);
|
|
100
|
-
return /* @__PURE__ */ jsx5(
|
|
101
|
-
"svg",
|
|
102
|
-
__spreadProps(__spreadValues({
|
|
103
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
104
|
-
viewBox: "0 0 24 24",
|
|
105
|
-
fill: "none",
|
|
106
|
-
stroke: "currentColor",
|
|
107
|
-
strokeWidth: 2,
|
|
108
|
-
strokeLinecap: "round",
|
|
109
|
-
strokeLinejoin: "round",
|
|
110
|
-
width: size,
|
|
111
|
-
height: size,
|
|
112
|
-
className
|
|
113
|
-
}, props), {
|
|
114
|
-
children: /* @__PURE__ */ jsx5("path", { d: "M6 12h9a4 4 0 0 1 0 8H7a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1h7a4 4 0 0 1 0 8" })
|
|
115
|
-
})
|
|
116
|
-
);
|
|
117
|
-
};
|
|
118
|
-
var BoldIcon_default = BoldIcon;
|
|
119
|
-
|
|
120
|
-
// src/lib/components/ButtonComponent.tsx
|
|
121
|
-
import { twMerge as twMerge4 } from "tailwind-merge";
|
|
122
|
-
|
|
123
|
-
// src/lib/components/_com/Tooltip.tsx
|
|
124
|
-
import { useState, Fragment as Fragment2, cloneElement, isValidElement, useId } from "react";
|
|
125
|
-
import { useFloating, offset, flip, shift, autoUpdate, useInteractions, useHover, useDismiss, FloatingPortal } from "@floating-ui/react";
|
|
126
|
-
import { AnimatePresence, motion } from "motion/react";
|
|
127
|
-
import { twMerge as twMerge3 } from "tailwind-merge";
|
|
128
|
-
import { jsx as jsx6, jsxs } from "react/jsx-runtime";
|
|
129
|
-
var Tooltip = ({ placement = "top", children, content, className }) => {
|
|
130
|
-
const [open, setOpen] = useState(false);
|
|
131
|
-
const { x, y, refs, strategy, context, placement: resolvedPlacement } = useFloating({
|
|
132
|
-
open,
|
|
133
|
-
onOpenChange: setOpen,
|
|
134
|
-
placement,
|
|
135
|
-
middleware: [offset(8), flip(), shift({ padding: 8 })],
|
|
136
|
-
whileElementsMounted: autoUpdate
|
|
137
|
-
});
|
|
138
|
-
const hover = useHover(context);
|
|
139
|
-
const dismiss = useDismiss(context);
|
|
140
|
-
const { getReferenceProps, getFloatingProps } = useInteractions([hover, dismiss]);
|
|
141
|
-
const id = useId();
|
|
142
|
-
function mergeRefs(...refsToMerge) {
|
|
143
|
-
return (node) => {
|
|
144
|
-
for (const r of refsToMerge) {
|
|
145
|
-
if (!r) continue;
|
|
146
|
-
if (typeof r === "function") r(node);
|
|
147
|
-
else r.current = node;
|
|
148
|
-
}
|
|
149
|
-
};
|
|
150
|
-
}
|
|
151
|
-
const side = resolvedPlacement.split("-")[0];
|
|
152
|
-
const enterOffset = 6;
|
|
153
|
-
const getInitial = () => {
|
|
154
|
-
switch (side) {
|
|
155
|
-
case "top":
|
|
156
|
-
return { opacity: 0, y: enterOffset };
|
|
157
|
-
case "bottom":
|
|
158
|
-
return { opacity: 0, y: -enterOffset };
|
|
159
|
-
case "left":
|
|
160
|
-
return { opacity: 0, x: enterOffset };
|
|
161
|
-
case "right":
|
|
162
|
-
return { opacity: 0, x: -enterOffset };
|
|
163
|
-
default:
|
|
164
|
-
return { opacity: 0 };
|
|
165
|
-
}
|
|
166
|
-
};
|
|
167
|
-
const getExit = () => __spreadProps(__spreadValues({}, getInitial()), { opacity: 0 });
|
|
168
|
-
return /* @__PURE__ */ jsxs(Fragment2, { children: [
|
|
169
|
-
isValidElement(children) ? cloneElement(children, __spreadProps(__spreadValues({}, getReferenceProps({
|
|
170
|
-
onFocus: () => setOpen(true),
|
|
171
|
-
onBlur: () => setOpen(false),
|
|
172
|
-
"aria-describedby": open ? id : void 0
|
|
173
|
-
})), {
|
|
174
|
-
ref: mergeRefs(children.ref, refs.setReference)
|
|
175
|
-
})) : children,
|
|
176
|
-
/* @__PURE__ */ jsx6(FloatingPortal, { children: /* @__PURE__ */ jsx6(AnimatePresence, { children: open && /* @__PURE__ */ jsx6(
|
|
177
|
-
motion.div,
|
|
178
|
-
__spreadProps(__spreadValues({
|
|
179
|
-
ref: refs.setFloating
|
|
180
|
-
}, getFloatingProps({
|
|
181
|
-
role: "tooltip",
|
|
182
|
-
id,
|
|
183
|
-
style: {
|
|
184
|
-
position: strategy,
|
|
185
|
-
top: y != null ? y : 0,
|
|
186
|
-
left: x != null ? x : 0,
|
|
187
|
-
pointerEvents: "none"
|
|
188
|
-
}
|
|
189
|
-
})), {
|
|
190
|
-
initial: getInitial(),
|
|
191
|
-
animate: { opacity: 1, x: 0, y: 0, scale: 1 },
|
|
192
|
-
exit: getExit(),
|
|
193
|
-
transition: { type: "spring", stiffness: 420, damping: 30, mass: 0.6 },
|
|
194
|
-
className: twMerge3("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),
|
|
195
|
-
children: content
|
|
196
|
-
}),
|
|
197
|
-
"tooltip"
|
|
198
|
-
) }) })
|
|
199
|
-
] });
|
|
200
|
-
};
|
|
201
|
-
var Tooltip_default = Tooltip;
|
|
202
|
-
|
|
203
|
-
// src/lib/components/ButtonComponent.tsx
|
|
204
|
-
import { useEditorState } from "@tiptap/react";
|
|
205
|
-
import { jsx as jsx7, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
206
|
-
var ButtonComponent = ({ className, activeClassName, icon, style, tooltip = true, tooltipClassName, tooltipPlacement, _extName, _internalIcon, _tooltipContent, _onToggle, _interShortcut, _buttonClassName }) => {
|
|
207
|
-
const { editor } = useEditor();
|
|
208
|
-
const editorState = useEditorState({
|
|
209
|
-
editor,
|
|
210
|
-
selector: ({ editor: editor2 }) => ({ isActive: (editor2 == null ? void 0 : editor2.isActive(_extName)) || false })
|
|
211
|
-
});
|
|
212
|
-
const tooltipContent = /* @__PURE__ */ jsxs2("p", { children: [
|
|
213
|
-
typeof tooltip === "string" ? tooltip : _tooltipContent,
|
|
214
|
-
/* @__PURE__ */ jsx7("br", {}),
|
|
215
|
-
_interShortcut
|
|
216
|
-
] });
|
|
217
|
-
const btn = /* @__PURE__ */ jsx7(
|
|
218
|
-
"button",
|
|
219
|
-
{
|
|
220
|
-
onClick: _onToggle,
|
|
221
|
-
className: twMerge4(
|
|
222
|
-
"p-1.5 rounded-md",
|
|
223
|
-
_buttonClassName,
|
|
224
|
-
(editorState == null ? void 0 : editorState.isActive) ? "bg-gray-200" : "hover:bg-gray-100",
|
|
225
|
-
className,
|
|
226
|
-
(editorState == null ? void 0 : editorState.isActive) ? activeClassName : "hover:bg-gray-100"
|
|
227
|
-
),
|
|
228
|
-
style,
|
|
229
|
-
children: icon != null ? icon : _internalIcon
|
|
230
|
-
}
|
|
231
|
-
);
|
|
232
|
-
if (tooltip === false) return btn;
|
|
233
|
-
return /* @__PURE__ */ jsx7(
|
|
234
|
-
Tooltip_default,
|
|
235
|
-
{
|
|
236
|
-
content: tooltipContent,
|
|
237
|
-
className: tooltipClassName,
|
|
238
|
-
placement: tooltipPlacement,
|
|
239
|
-
children: btn
|
|
240
|
-
}
|
|
241
|
-
);
|
|
242
|
-
};
|
|
243
|
-
var ButtonComponent_default = ButtonComponent;
|
|
244
|
-
|
|
245
|
-
// src/lib/extensions/Bold.tsx
|
|
246
|
-
import { jsx as jsx8 } from "react/jsx-runtime";
|
|
247
|
-
var Bold = TiptapBold.extend({
|
|
248
|
-
addOptions() {
|
|
249
|
-
var _a;
|
|
250
|
-
return __spreadProps(__spreadValues({}, (_a = this.parent) == null ? void 0 : _a.call(this)), {
|
|
251
|
-
button: ({ editor, options, buttonClassName }) => {
|
|
252
|
-
return /* @__PURE__ */ jsx8(
|
|
253
|
-
ButtonComponent_default,
|
|
254
|
-
{
|
|
255
|
-
className: options.className,
|
|
256
|
-
icon: options.icon,
|
|
257
|
-
style: options.style,
|
|
258
|
-
activeClassName: options.activeClassName,
|
|
259
|
-
tooltip: options.tooltip,
|
|
260
|
-
tooltipClassName: options.tooltipClassName,
|
|
261
|
-
tooltipPlacement: options.tooltipPlacement,
|
|
262
|
-
_internalIcon: /* @__PURE__ */ jsx8(BoldIcon_default, {}),
|
|
263
|
-
_extName: "bold",
|
|
264
|
-
_onToggle: () => editor.chain().focus().toggleBold().run(),
|
|
265
|
-
_interShortcut: "\u2318 + B",
|
|
266
|
-
_tooltipContent: "Bold",
|
|
267
|
-
_buttonClassName: buttonClassName
|
|
268
|
-
}
|
|
269
|
-
);
|
|
270
|
-
}
|
|
271
|
-
});
|
|
272
|
-
}
|
|
273
|
-
});
|
|
274
|
-
|
|
275
|
-
// src/lib/extensions/Italic.tsx
|
|
276
|
-
import TiptapItalic from "@tiptap/extension-italic";
|
|
277
|
-
|
|
278
|
-
// src/lib/icon/ItalicIcon.tsx
|
|
279
|
-
import { jsx as jsx9, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
280
|
-
var ItalicIcon = (_a) => {
|
|
281
|
-
var _b = _a, { size = 17, className } = _b, props = __objRest(_b, ["size", "className"]);
|
|
282
|
-
return /* @__PURE__ */ jsxs3(
|
|
283
|
-
"svg",
|
|
284
|
-
__spreadProps(__spreadValues({
|
|
285
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
286
|
-
viewBox: "0 0 24 24",
|
|
287
|
-
fill: "none",
|
|
288
|
-
stroke: "currentColor",
|
|
289
|
-
strokeWidth: 2,
|
|
290
|
-
strokeLinecap: "round",
|
|
291
|
-
strokeLinejoin: "round",
|
|
292
|
-
width: size,
|
|
293
|
-
height: size,
|
|
294
|
-
className
|
|
295
|
-
}, props), {
|
|
296
|
-
children: [
|
|
297
|
-
/* @__PURE__ */ jsx9("line", { x1: "19", x2: "10", y1: "4", y2: "4" }),
|
|
298
|
-
/* @__PURE__ */ jsx9("line", { x1: "14", x2: "5", y1: "20", y2: "20" }),
|
|
299
|
-
/* @__PURE__ */ jsx9("line", { x1: "15", x2: "9", y1: "4", y2: "20" })
|
|
300
|
-
]
|
|
301
|
-
})
|
|
302
|
-
);
|
|
303
|
-
};
|
|
304
|
-
var ItalicIcon_default = ItalicIcon;
|
|
305
|
-
|
|
306
|
-
// src/lib/extensions/Italic.tsx
|
|
307
|
-
import { jsx as jsx10 } from "react/jsx-runtime";
|
|
308
|
-
var Italic = TiptapItalic.extend({
|
|
309
|
-
addOptions() {
|
|
310
|
-
var _a;
|
|
311
|
-
return __spreadProps(__spreadValues({}, (_a = this.parent) == null ? void 0 : _a.call(this)), {
|
|
312
|
-
button: ({ options, editor, buttonClassName }) => {
|
|
313
|
-
return /* @__PURE__ */ jsx10(
|
|
314
|
-
ButtonComponent_default,
|
|
315
|
-
{
|
|
316
|
-
className: options.className,
|
|
317
|
-
icon: options.icon,
|
|
318
|
-
style: options.style,
|
|
319
|
-
activeClassName: options.activeClassName,
|
|
320
|
-
tooltip: options.tooltip,
|
|
321
|
-
tooltipClassName: options.tooltipClassName,
|
|
322
|
-
tooltipPlacement: options.tooltipPlacement,
|
|
323
|
-
_internalIcon: /* @__PURE__ */ jsx10(ItalicIcon_default, {}),
|
|
324
|
-
_extName: "italic",
|
|
325
|
-
_onToggle: () => editor.chain().focus().toggleItalic().run(),
|
|
326
|
-
_interShortcut: "\u2318 + I",
|
|
327
|
-
_tooltipContent: "Italic",
|
|
328
|
-
_buttonClassName: buttonClassName
|
|
329
|
-
}
|
|
330
|
-
);
|
|
331
|
-
}
|
|
332
|
-
});
|
|
333
|
-
}
|
|
334
|
-
});
|
|
335
|
-
|
|
336
|
-
// src/lib/extensions/Underline.tsx
|
|
337
|
-
import TiptapUnder from "@tiptap/extension-underline";
|
|
338
|
-
|
|
339
|
-
// src/lib/icon/UnderIcon.tsx
|
|
340
|
-
import { jsx as jsx11, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
341
|
-
var UnderIcon = (_a) => {
|
|
342
|
-
var _b = _a, { size = 17, className } = _b, props = __objRest(_b, ["size", "className"]);
|
|
343
|
-
return /* @__PURE__ */ jsxs4(
|
|
344
|
-
"svg",
|
|
345
|
-
__spreadProps(__spreadValues({
|
|
346
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
347
|
-
viewBox: "0 0 24 24",
|
|
348
|
-
fill: "none",
|
|
349
|
-
stroke: "currentColor",
|
|
350
|
-
strokeWidth: 2,
|
|
351
|
-
strokeLinecap: "round",
|
|
352
|
-
strokeLinejoin: "round",
|
|
353
|
-
width: size,
|
|
354
|
-
height: size,
|
|
355
|
-
className
|
|
356
|
-
}, props), {
|
|
357
|
-
children: [
|
|
358
|
-
/* @__PURE__ */ jsx11("path", { d: "M6 4v6a6 6 0 0 0 12 0V4" }),
|
|
359
|
-
/* @__PURE__ */ jsx11("line", { x1: "4", x2: "20", y1: "20", y2: "20" })
|
|
360
|
-
]
|
|
361
|
-
})
|
|
362
|
-
);
|
|
363
|
-
};
|
|
364
|
-
var UnderIcon_default = UnderIcon;
|
|
365
|
-
|
|
366
|
-
// src/lib/extensions/Underline.tsx
|
|
367
|
-
import { jsx as jsx12 } from "react/jsx-runtime";
|
|
368
|
-
var Underline = TiptapUnder.extend({
|
|
369
|
-
addOptions() {
|
|
370
|
-
var _a;
|
|
371
|
-
return __spreadProps(__spreadValues({}, (_a = this.parent) == null ? void 0 : _a.call(this)), {
|
|
372
|
-
button: ({ options, editor, buttonClassName }) => {
|
|
373
|
-
return /* @__PURE__ */ jsx12(
|
|
374
|
-
ButtonComponent_default,
|
|
375
|
-
{
|
|
376
|
-
className: options.className,
|
|
377
|
-
icon: options.icon,
|
|
378
|
-
style: options.style,
|
|
379
|
-
activeClassName: options.activeClassName,
|
|
380
|
-
tooltip: options.tooltip,
|
|
381
|
-
tooltipClassName: options.tooltipClassName,
|
|
382
|
-
tooltipPlacement: options.tooltipPlacement,
|
|
383
|
-
_internalIcon: /* @__PURE__ */ jsx12(UnderIcon_default, {}),
|
|
384
|
-
_extName: "underline",
|
|
385
|
-
_onToggle: () => editor.chain().focus().toggleUnderline().run(),
|
|
386
|
-
_interShortcut: "\u2318 + U",
|
|
387
|
-
_tooltipContent: "Underline",
|
|
388
|
-
_buttonClassName: buttonClassName
|
|
389
|
-
}
|
|
390
|
-
);
|
|
391
|
-
}
|
|
392
|
-
});
|
|
393
|
-
}
|
|
394
|
-
});
|
|
395
|
-
|
|
396
|
-
// src/lib/extensions/Strike.tsx
|
|
397
|
-
import TiptapStrike from "@tiptap/extension-strike";
|
|
398
|
-
|
|
399
|
-
// src/lib/icon/StrikeIcon.tsx
|
|
400
|
-
import { jsx as jsx13, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
401
|
-
var StrikeIcon = (_a) => {
|
|
402
|
-
var _b = _a, { size = 17, className } = _b, props = __objRest(_b, ["size", "className"]);
|
|
403
|
-
return /* @__PURE__ */ jsxs5(
|
|
404
|
-
"svg",
|
|
405
|
-
__spreadProps(__spreadValues({
|
|
406
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
407
|
-
viewBox: "0 0 24 24",
|
|
408
|
-
fill: "none",
|
|
409
|
-
stroke: "currentColor",
|
|
410
|
-
strokeWidth: 2,
|
|
411
|
-
strokeLinecap: "round",
|
|
412
|
-
strokeLinejoin: "round",
|
|
413
|
-
width: size,
|
|
414
|
-
height: size,
|
|
415
|
-
className
|
|
416
|
-
}, props), {
|
|
417
|
-
children: [
|
|
418
|
-
/* @__PURE__ */ jsx13("path", { d: "M16 4H9a3 3 0 0 0-2.83 4" }),
|
|
419
|
-
/* @__PURE__ */ jsx13("path", { d: "M14 12a4 4 0 0 1 0 8H6" }),
|
|
420
|
-
/* @__PURE__ */ jsx13("line", { x1: "4", x2: "20", y1: "12", y2: "12" })
|
|
421
|
-
]
|
|
422
|
-
})
|
|
423
|
-
);
|
|
424
|
-
};
|
|
425
|
-
var StrikeIcon_default = StrikeIcon;
|
|
426
|
-
|
|
427
|
-
// src/lib/extensions/Strike.tsx
|
|
428
|
-
import { jsx as jsx14 } from "react/jsx-runtime";
|
|
429
|
-
var Strike = TiptapStrike.extend({
|
|
430
|
-
addOptions() {
|
|
431
|
-
var _a;
|
|
432
|
-
return __spreadProps(__spreadValues({}, (_a = this.parent) == null ? void 0 : _a.call(this)), {
|
|
433
|
-
button: ({ options, editor, buttonClassName }) => {
|
|
434
|
-
return /* @__PURE__ */ jsx14(
|
|
435
|
-
ButtonComponent_default,
|
|
436
|
-
{
|
|
437
|
-
className: options.className,
|
|
438
|
-
icon: options.icon,
|
|
439
|
-
style: options.style,
|
|
440
|
-
activeClassName: options.activeClassName,
|
|
441
|
-
tooltip: options.tooltip,
|
|
442
|
-
tooltipClassName: options.tooltipClassName,
|
|
443
|
-
tooltipPlacement: options.tooltipPlacement,
|
|
444
|
-
_internalIcon: /* @__PURE__ */ jsx14(StrikeIcon_default, {}),
|
|
445
|
-
_extName: "strike",
|
|
446
|
-
_onToggle: () => editor.chain().focus().toggleStrike().run(),
|
|
447
|
-
_interShortcut: "\u2318 \u21E7 S",
|
|
448
|
-
_tooltipContent: "Strike",
|
|
449
|
-
_buttonClassName: buttonClassName
|
|
450
|
-
}
|
|
451
|
-
);
|
|
452
|
-
}
|
|
453
|
-
});
|
|
454
|
-
}
|
|
455
|
-
});
|
|
456
|
-
|
|
457
|
-
// src/lib/extensions/Subscript.tsx
|
|
458
|
-
import TiptapSubscript from "@tiptap/extension-subscript";
|
|
459
|
-
|
|
460
|
-
// src/lib/icon/SubIcon.tsx
|
|
461
|
-
import { jsx as jsx15, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
462
|
-
var SubIcon = (_a) => {
|
|
463
|
-
var _b = _a, { size = 17, className } = _b, props = __objRest(_b, ["size", "className"]);
|
|
464
|
-
return /* @__PURE__ */ jsxs6(
|
|
465
|
-
"svg",
|
|
466
|
-
__spreadProps(__spreadValues({
|
|
467
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
468
|
-
viewBox: "0 0 24 24",
|
|
469
|
-
fill: "none",
|
|
470
|
-
stroke: "currentColor",
|
|
471
|
-
strokeWidth: 2,
|
|
472
|
-
strokeLinecap: "round",
|
|
473
|
-
strokeLinejoin: "round",
|
|
474
|
-
width: size,
|
|
475
|
-
height: size,
|
|
476
|
-
className
|
|
477
|
-
}, props), {
|
|
478
|
-
children: [
|
|
479
|
-
/* @__PURE__ */ jsx15("path", { d: "m4 5 8 8" }),
|
|
480
|
-
/* @__PURE__ */ jsx15("path", { d: "m12 5-8 8" }),
|
|
481
|
-
/* @__PURE__ */ jsx15("path", { d: "M20 19h-4c0-1.5.44-2 1.5-2.5S20 15.33 20 14c0-.47-.17-.93-.48-1.29a2.11 2.11 0 0 0-2.62-.44c-.42.24-.74.62-.9 1.07" })
|
|
482
|
-
]
|
|
483
|
-
})
|
|
484
|
-
);
|
|
485
|
-
};
|
|
486
|
-
var SubIcon_default = SubIcon;
|
|
487
|
-
|
|
488
|
-
// src/lib/extensions/Subscript.tsx
|
|
489
|
-
import { jsx as jsx16 } from "react/jsx-runtime";
|
|
490
|
-
var Subscript = TiptapSubscript.extend({
|
|
491
|
-
addOptions() {
|
|
492
|
-
var _a;
|
|
493
|
-
return __spreadProps(__spreadValues({}, (_a = this.parent) == null ? void 0 : _a.call(this)), {
|
|
494
|
-
button: ({ options, editor, buttonClassName }) => {
|
|
495
|
-
return /* @__PURE__ */ jsx16(
|
|
496
|
-
ButtonComponent_default,
|
|
497
|
-
{
|
|
498
|
-
className: options.className,
|
|
499
|
-
icon: options.icon,
|
|
500
|
-
style: options.style,
|
|
501
|
-
activeClassName: options.activeClassName,
|
|
502
|
-
tooltip: options.tooltip,
|
|
503
|
-
tooltipClassName: options.tooltipClassName,
|
|
504
|
-
tooltipPlacement: options.tooltipPlacement,
|
|
505
|
-
_internalIcon: /* @__PURE__ */ jsx16(SubIcon_default, {}),
|
|
506
|
-
_extName: "subscript",
|
|
507
|
-
_onToggle: () => editor.chain().focus().toggleSubscript().run(),
|
|
508
|
-
_interShortcut: "\u2318 + ,",
|
|
509
|
-
_tooltipContent: "Subscript",
|
|
510
|
-
_buttonClassName: buttonClassName
|
|
511
|
-
}
|
|
512
|
-
);
|
|
513
|
-
}
|
|
514
|
-
});
|
|
515
|
-
}
|
|
516
|
-
});
|
|
517
|
-
|
|
518
|
-
// src/lib/extensions/Superscript.tsx
|
|
519
|
-
import TiptapSuperscript from "@tiptap/extension-superscript";
|
|
520
|
-
|
|
521
|
-
// src/lib/icon/SupIcon.tsx
|
|
522
|
-
import { jsx as jsx17, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
523
|
-
var SupIcon = (_a) => {
|
|
524
|
-
var _b = _a, { size = 17, className } = _b, props = __objRest(_b, ["size", "className"]);
|
|
525
|
-
return /* @__PURE__ */ jsxs7(
|
|
526
|
-
"svg",
|
|
527
|
-
__spreadProps(__spreadValues({
|
|
528
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
529
|
-
viewBox: "0 0 24 24",
|
|
530
|
-
fill: "none",
|
|
531
|
-
stroke: "currentColor",
|
|
532
|
-
strokeWidth: 2,
|
|
533
|
-
strokeLinecap: "round",
|
|
534
|
-
strokeLinejoin: "round",
|
|
535
|
-
width: size,
|
|
536
|
-
height: size,
|
|
537
|
-
className
|
|
538
|
-
}, props), {
|
|
539
|
-
children: [
|
|
540
|
-
/* @__PURE__ */ jsx17("path", { d: "m4 19 8-8" }),
|
|
541
|
-
/* @__PURE__ */ jsx17("path", { d: "m12 19-8-8" }),
|
|
542
|
-
/* @__PURE__ */ jsx17("path", { d: "M20 12h-4c0-1.5.442-2 1.5-2.5S20 8.334 20 7.002c0-.472-.17-.93-.484-1.29a2.105 2.105 0 0 0-2.617-.436c-.42.239-.738.614-.899 1.06" })
|
|
543
|
-
]
|
|
544
|
-
})
|
|
545
|
-
);
|
|
546
|
-
};
|
|
547
|
-
var SupIcon_default = SupIcon;
|
|
548
|
-
|
|
549
|
-
// src/lib/extensions/Superscript.tsx
|
|
550
|
-
import { jsx as jsx18 } from "react/jsx-runtime";
|
|
551
|
-
var Superscript = TiptapSuperscript.extend({
|
|
552
|
-
addOptions() {
|
|
553
|
-
var _a;
|
|
554
|
-
return __spreadProps(__spreadValues({}, (_a = this.parent) == null ? void 0 : _a.call(this)), {
|
|
555
|
-
button: ({ options, editor, buttonClassName }) => {
|
|
556
|
-
return /* @__PURE__ */ jsx18(
|
|
557
|
-
ButtonComponent_default,
|
|
558
|
-
{
|
|
559
|
-
className: options.className,
|
|
560
|
-
icon: options.icon,
|
|
561
|
-
style: options.style,
|
|
562
|
-
activeClassName: options.activeClassName,
|
|
563
|
-
tooltip: options.tooltip,
|
|
564
|
-
tooltipClassName: options.tooltipClassName,
|
|
565
|
-
tooltipPlacement: options.tooltipPlacement,
|
|
566
|
-
_internalIcon: /* @__PURE__ */ jsx18(SupIcon_default, {}),
|
|
567
|
-
_extName: "superscript",
|
|
568
|
-
_onToggle: () => editor.chain().focus().toggleSuperscript().run(),
|
|
569
|
-
_interShortcut: "\u2318 + ,",
|
|
570
|
-
_tooltipContent: "Superscript",
|
|
571
|
-
_buttonClassName: buttonClassName
|
|
572
|
-
}
|
|
573
|
-
);
|
|
574
|
-
}
|
|
575
|
-
});
|
|
576
|
-
}
|
|
577
|
-
});
|
|
578
66
|
export {
|
|
579
|
-
Bold,
|
|
580
67
|
Content_default as Content,
|
|
581
68
|
Editor_default as Editor,
|
|
582
|
-
|
|
583
|
-
Strike,
|
|
584
|
-
Subscript,
|
|
585
|
-
Superscript,
|
|
586
|
-
Toolbar_default as Toolbar,
|
|
587
|
-
Underline
|
|
69
|
+
Toolbar_default as Toolbar
|
|
588
70
|
};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { ReactNode, CSSProperties } from 'react';
|
|
2
|
+
import { Placement } from '@floating-ui/react';
|
|
3
|
+
import { Editor } from '@tiptap/react';
|
|
4
|
+
|
|
5
|
+
type ExtButtonOptions = {
|
|
6
|
+
className?: string;
|
|
7
|
+
activeClassName?: string;
|
|
8
|
+
icon?: ReactNode;
|
|
9
|
+
style?: CSSProperties;
|
|
10
|
+
tooltip?: boolean | string;
|
|
11
|
+
tooltipClassName?: string;
|
|
12
|
+
tooltipPlacement?: Placement;
|
|
13
|
+
component: (args: {
|
|
14
|
+
options: ExtButtonOptions;
|
|
15
|
+
editor: Editor;
|
|
16
|
+
buttonClassName: string;
|
|
17
|
+
}) => ReactNode;
|
|
18
|
+
};
|
|
19
|
+
type ExtWithoutActiveOptions = Omit<ExtButtonOptions, "activeClassName" | "component"> & {
|
|
20
|
+
component: (args: {
|
|
21
|
+
options: ExtWithoutActiveOptions;
|
|
22
|
+
editor: Editor;
|
|
23
|
+
buttonClassName: string;
|
|
24
|
+
}) => ReactNode;
|
|
25
|
+
};
|
|
26
|
+
type ExtDropdownOptions = {
|
|
27
|
+
className?: string;
|
|
28
|
+
showArrow?: boolean;
|
|
29
|
+
content?: ReactNode;
|
|
30
|
+
dropdownClassName?: string;
|
|
31
|
+
itemClassName?: string;
|
|
32
|
+
activeClassName?: string;
|
|
33
|
+
style?: CSSProperties;
|
|
34
|
+
tooltip?: boolean | string;
|
|
35
|
+
tooltipClassName?: string;
|
|
36
|
+
tooltipPlacement?: Placement;
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
export type { ExtButtonOptions as E, ExtDropdownOptions as a, ExtWithoutActiveOptions as b };
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { ReactNode, CSSProperties } from 'react';
|
|
2
|
+
import { Placement } from '@floating-ui/react';
|
|
3
|
+
import { Editor } from '@tiptap/react';
|
|
4
|
+
|
|
5
|
+
type ExtButtonOptions = {
|
|
6
|
+
className?: string;
|
|
7
|
+
activeClassName?: string;
|
|
8
|
+
icon?: ReactNode;
|
|
9
|
+
style?: CSSProperties;
|
|
10
|
+
tooltip?: boolean | string;
|
|
11
|
+
tooltipClassName?: string;
|
|
12
|
+
tooltipPlacement?: Placement;
|
|
13
|
+
component: (args: {
|
|
14
|
+
options: ExtButtonOptions;
|
|
15
|
+
editor: Editor;
|
|
16
|
+
buttonClassName: string;
|
|
17
|
+
}) => ReactNode;
|
|
18
|
+
};
|
|
19
|
+
type ExtWithoutActiveOptions = Omit<ExtButtonOptions, "activeClassName" | "component"> & {
|
|
20
|
+
component: (args: {
|
|
21
|
+
options: ExtWithoutActiveOptions;
|
|
22
|
+
editor: Editor;
|
|
23
|
+
buttonClassName: string;
|
|
24
|
+
}) => ReactNode;
|
|
25
|
+
};
|
|
26
|
+
type ExtDropdownOptions = {
|
|
27
|
+
className?: string;
|
|
28
|
+
showArrow?: boolean;
|
|
29
|
+
content?: ReactNode;
|
|
30
|
+
dropdownClassName?: string;
|
|
31
|
+
itemClassName?: string;
|
|
32
|
+
activeClassName?: string;
|
|
33
|
+
style?: CSSProperties;
|
|
34
|
+
tooltip?: boolean | string;
|
|
35
|
+
tooltipClassName?: string;
|
|
36
|
+
tooltipPlacement?: Placement;
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
export type { ExtButtonOptions as E, ExtDropdownOptions as a, ExtWithoutActiveOptions as b };
|