ritext 1.0.23 → 1.0.25
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 +1 -30
- package/dist/chunk-EN4BPI7N.mjs +1213 -0
- package/dist/chunk-FJQ4FZRS.mjs +98 -0
- package/dist/chunk-M4ORWR74.mjs +31 -0
- package/dist/chunk-SJFT7WNM.mjs +38 -0
- package/dist/chunk-W367UGID.mjs +55 -0
- package/dist/{chunk-FWCSY2DS.mjs → chunk-WNQUEZJF.mjs} +22 -1
- package/dist/{chunk-D47XME55.mjs → chunk-WXCHG3NQ.mjs} +8 -2
- package/dist/chunk-WZKGD3DD.mjs +231 -0
- package/dist/extension/backgroundcolor.d.mts +16 -0
- package/dist/extension/backgroundcolor.d.ts +16 -0
- package/dist/extension/backgroundcolor.js +668 -0
- package/dist/extension/backgroundcolor.mjs +107 -0
- package/dist/extension/base.d.mts +6 -0
- package/dist/extension/base.d.ts +6 -0
- package/dist/extension/base.js +65 -0
- package/dist/extension/base.mjs +22 -0
- package/dist/extension/blockquote.d.mts +10 -0
- package/dist/extension/blockquote.d.ts +10 -0
- package/dist/extension/blockquote.js +239 -0
- package/dist/extension/blockquote.mjs +46 -0
- package/dist/extension/bold.d.mts +7 -2
- package/dist/extension/bold.d.ts +7 -2
- package/dist/extension/bold.js +22 -45
- package/dist/extension/bold.mjs +13 -35
- package/dist/extension/bulletlist.d.mts +10 -0
- package/dist/extension/bulletlist.d.ts +10 -0
- package/dist/extension/bulletlist.js +241 -0
- package/dist/extension/bulletlist.mjs +46 -0
- package/dist/extension/clearformat.d.mts +1 -1
- package/dist/extension/clearformat.d.ts +1 -1
- package/dist/extension/clearformat.js +11 -6
- package/dist/extension/clearformat.mjs +8 -35
- package/dist/extension/color.d.mts +17 -0
- package/dist/extension/color.d.ts +17 -0
- package/dist/extension/color.js +580 -0
- package/dist/extension/color.mjs +12 -0
- package/dist/extension/emoji.d.mts +15 -0
- package/dist/extension/emoji.d.ts +15 -0
- package/dist/extension/emoji.js +421 -0
- package/dist/extension/emoji.mjs +158 -0
- package/dist/extension/font-family.d.mts +8 -11
- package/dist/extension/font-family.d.ts +8 -11
- package/dist/extension/font-family.js +11 -12
- package/dist/extension/font-family.mjs +10 -11
- package/dist/extension/font-size.d.mts +8 -11
- package/dist/extension/font-size.d.ts +8 -11
- package/dist/extension/font-size.js +10 -12
- package/dist/extension/font-size.mjs +9 -11
- package/dist/extension/heading.d.mts +10 -10
- package/dist/extension/heading.d.ts +10 -10
- package/dist/extension/heading.js +68 -80
- package/dist/extension/heading.mjs +40 -206
- package/dist/extension/history.d.mts +4 -2
- package/dist/extension/history.d.ts +4 -2
- package/dist/extension/history.js +16 -9
- package/dist/extension/history.mjs +16 -64
- package/dist/extension/horizontalrule.d.mts +10 -0
- package/dist/extension/horizontalrule.d.ts +10 -0
- package/dist/extension/horizontalrule.js +242 -0
- package/dist/extension/horizontalrule.mjs +42 -0
- package/dist/extension/image.d.mts +26 -0
- package/dist/extension/image.d.ts +26 -0
- package/dist/extension/image.js +1611 -0
- package/dist/extension/image.mjs +1153 -0
- package/dist/extension/indentoutdent.d.mts +21 -0
- package/dist/extension/indentoutdent.d.ts +21 -0
- package/dist/extension/indentoutdent.js +380 -0
- package/dist/extension/indentoutdent.mjs +164 -0
- package/dist/extension/italic.d.mts +7 -2
- package/dist/extension/italic.d.ts +7 -2
- package/dist/extension/italic.js +22 -45
- package/dist/extension/italic.mjs +14 -40
- package/dist/extension/lineheight.d.mts +15 -0
- package/dist/extension/lineheight.d.ts +15 -0
- package/dist/extension/lineheight.js +342 -0
- package/dist/extension/lineheight.mjs +87 -0
- package/dist/extension/link.d.mts +15 -0
- package/dist/extension/link.d.ts +15 -0
- package/dist/extension/link.js +588 -0
- package/dist/extension/link.mjs +278 -0
- package/dist/extension/orderedlist.d.mts +10 -0
- package/dist/extension/orderedlist.d.ts +10 -0
- package/dist/extension/orderedlist.js +241 -0
- package/dist/extension/orderedlist.mjs +46 -0
- package/dist/extension/strike.d.mts +8 -3
- package/dist/extension/strike.d.ts +8 -3
- package/dist/extension/strike.js +22 -45
- package/dist/extension/strike.mjs +14 -40
- package/dist/extension/subandsuperscript.d.mts +7 -10
- package/dist/extension/subandsuperscript.d.ts +7 -10
- package/dist/extension/subandsuperscript.js +66 -77
- package/dist/extension/subandsuperscript.mjs +18 -48
- package/dist/extension/subscript.d.mts +4 -2
- package/dist/extension/subscript.d.ts +4 -2
- package/dist/extension/subscript.js +20 -45
- package/dist/extension/subscript.mjs +10 -10
- package/dist/extension/superscript.d.mts +4 -2
- package/dist/extension/superscript.d.ts +4 -2
- package/dist/extension/superscript.js +20 -45
- package/dist/extension/superscript.mjs +10 -10
- package/dist/extension/table.d.mts +12 -0
- package/dist/extension/table.d.ts +12 -0
- package/dist/extension/table.js +585 -0
- package/dist/extension/table.mjs +324 -0
- package/dist/extension/tasklist.d.mts +10 -0
- package/dist/extension/tasklist.d.ts +10 -0
- package/dist/extension/tasklist.js +246 -0
- package/dist/extension/tasklist.mjs +52 -0
- package/dist/extension/textalign.d.mts +15 -0
- package/dist/extension/textalign.d.ts +15 -0
- package/dist/extension/textalign.js +404 -0
- package/dist/extension/textalign.mjs +79 -0
- package/dist/extension/underline.d.mts +7 -2
- package/dist/extension/underline.d.ts +7 -2
- package/dist/extension/underline.js +22 -45
- package/dist/extension/underline.mjs +14 -39
- package/dist/index.css +683 -31
- package/dist/index.d.mts +3 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +306 -24
- package/dist/index.mjs +141 -13
- package/dist/tiptap-ext.type-B3TtT7-J.d.mts +43 -0
- package/dist/tiptap-ext.type-B3TtT7-J.d.ts +43 -0
- package/package.json +41 -28
- package/dist/chunk-2YUUKIIT.mjs +0 -149
- package/dist/chunk-7QOFJIQ3.mjs +0 -90
- package/dist/chunk-GSHINFPO.mjs +0 -53
- package/dist/chunk-LMOTHRGQ.mjs +0 -37
- package/dist/chunk-MBF77NHS.mjs +0 -37
- package/dist/tiptap-ext.type-DrneAC5G.d.mts +0 -39
- package/dist/tiptap-ext.type-DrneAC5G.d.ts +0 -39
|
@@ -52,11 +52,11 @@ __export(History_exports, {
|
|
|
52
52
|
History: () => History
|
|
53
53
|
});
|
|
54
54
|
module.exports = __toCommonJS(History_exports);
|
|
55
|
-
var
|
|
55
|
+
var import_react6 = require("react");
|
|
56
56
|
var import_extensions = require("@tiptap/extensions");
|
|
57
|
-
var
|
|
57
|
+
var import_react7 = require("@tiptap/react");
|
|
58
58
|
|
|
59
|
-
// src/lib/
|
|
59
|
+
// src/lib/icons/index.tsx
|
|
60
60
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
61
61
|
var Redo2 = (_a) => {
|
|
62
62
|
var _b = _a, { size = 17, className } = _b, props = __objRest(_b, ["size", "className"]);
|
|
@@ -106,6 +106,7 @@ var Undo2 = (_a) => {
|
|
|
106
106
|
};
|
|
107
107
|
|
|
108
108
|
// src/lib/components/ButtonWithoutActive.tsx
|
|
109
|
+
var import_react4 = require("react");
|
|
109
110
|
var import_tailwind_merge2 = require("tailwind-merge");
|
|
110
111
|
|
|
111
112
|
// src/lib/components/_com/Tooltip.tsx
|
|
@@ -191,15 +192,20 @@ var Tooltip = ({ placement = "top", children, content, className }) => {
|
|
|
191
192
|
var Tooltip_default = Tooltip;
|
|
192
193
|
|
|
193
194
|
// src/lib/components/ButtonWithoutActive.tsx
|
|
195
|
+
var import_react5 = require("@tiptap/react");
|
|
194
196
|
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
195
197
|
var ButtonWithoutActive = ({ className, icon, style, tooltip = true, tooltipClassName, tooltipPlacement, _internalIcon, _tooltipContent, _interShortcut, _onToggle, _buttonClassName, _disabled = false }) => {
|
|
198
|
+
const shortcutText = (0, import_react4.useMemo)(() => {
|
|
199
|
+
if (!_interShortcut) return "";
|
|
200
|
+
return (0, import_react5.isMacOS)() ? _interShortcut.mac : _interShortcut.win;
|
|
201
|
+
}, [_interShortcut]);
|
|
196
202
|
const tooltipContent = /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("p", { children: [
|
|
197
203
|
typeof tooltip === "string" ? tooltip : _tooltipContent,
|
|
198
204
|
_interShortcut && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_jsx_runtime3.Fragment, { children: [
|
|
199
205
|
" ",
|
|
200
206
|
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("br", {}),
|
|
201
207
|
" ",
|
|
202
|
-
|
|
208
|
+
shortcutText,
|
|
203
209
|
" "
|
|
204
210
|
] })
|
|
205
211
|
] });
|
|
@@ -238,14 +244,14 @@ function HistoryButtons({
|
|
|
238
244
|
options,
|
|
239
245
|
buttonClassName
|
|
240
246
|
}) {
|
|
241
|
-
const { canUndo, canRedo } = (0,
|
|
247
|
+
const { canUndo, canRedo } = (0, import_react7.useEditorState)({
|
|
242
248
|
editor,
|
|
243
249
|
selector: (ctx) => ({
|
|
244
250
|
canUndo: ctx.editor.can().chain().focus().undo().run(),
|
|
245
251
|
canRedo: ctx.editor.can().chain().focus().redo().run()
|
|
246
252
|
})
|
|
247
253
|
});
|
|
248
|
-
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
254
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_react6.Fragment, { children: [
|
|
249
255
|
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
250
256
|
ButtonWithoutActive_default,
|
|
251
257
|
{
|
|
@@ -257,7 +263,7 @@ function HistoryButtons({
|
|
|
257
263
|
tooltipPlacement: options.tooltipPlacement,
|
|
258
264
|
_internalIcon: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Undo2, {}),
|
|
259
265
|
_onToggle: () => editor.chain().focus().undo().run(),
|
|
260
|
-
_interShortcut: "\u2318 + Z",
|
|
266
|
+
_interShortcut: { win: "", mac: "\u2318 + Z" },
|
|
261
267
|
_tooltipContent: "Undo",
|
|
262
268
|
_disabled: !canUndo,
|
|
263
269
|
_buttonClassName: buttonClassName
|
|
@@ -274,7 +280,7 @@ function HistoryButtons({
|
|
|
274
280
|
tooltipPlacement: options.tooltipPlacement,
|
|
275
281
|
_internalIcon: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Redo2, {}),
|
|
276
282
|
_onToggle: () => editor.chain().focus().redo().run(),
|
|
277
|
-
_interShortcut: "
|
|
283
|
+
_interShortcut: { win: "Ctrl + Y", mac: "\u2318 + Y" },
|
|
278
284
|
_tooltipContent: "Redo",
|
|
279
285
|
_disabled: !canRedo,
|
|
280
286
|
_buttonClassName: buttonClassName
|
|
@@ -285,7 +291,8 @@ function HistoryButtons({
|
|
|
285
291
|
var History = import_extensions.UndoRedo.extend({
|
|
286
292
|
addOptions() {
|
|
287
293
|
var _a;
|
|
288
|
-
|
|
294
|
+
const parent = (_a = this.parent) == null ? void 0 : _a.call(this);
|
|
295
|
+
return __spreadProps(__spreadValues({}, parent != null ? parent : {}), {
|
|
289
296
|
component: ({ editor, options, buttonClassName }) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(HistoryButtons, { editor, options, buttonClassName })
|
|
290
297
|
});
|
|
291
298
|
}
|
|
@@ -1,69 +1,20 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ButtonWithoutActive_default
|
|
3
|
-
} from "../chunk-
|
|
4
|
-
import
|
|
3
|
+
} from "../chunk-WXCHG3NQ.mjs";
|
|
4
|
+
import {
|
|
5
|
+
Redo2,
|
|
6
|
+
Undo2
|
|
7
|
+
} from "../chunk-EN4BPI7N.mjs";
|
|
5
8
|
import {
|
|
6
|
-
__objRest,
|
|
7
9
|
__spreadProps,
|
|
8
10
|
__spreadValues
|
|
9
|
-
} from "../chunk-
|
|
11
|
+
} from "../chunk-WNQUEZJF.mjs";
|
|
10
12
|
|
|
11
13
|
// src/extension/History.tsx
|
|
12
14
|
import { Fragment } from "react";
|
|
13
15
|
import { UndoRedo } from "@tiptap/extensions";
|
|
14
16
|
import { useEditorState } from "@tiptap/react";
|
|
15
|
-
|
|
16
|
-
// src/lib/icon/HistoryIcon.tsx
|
|
17
17
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
18
|
-
var Redo2 = (_a) => {
|
|
19
|
-
var _b = _a, { size = 17, className } = _b, props = __objRest(_b, ["size", "className"]);
|
|
20
|
-
return /* @__PURE__ */ jsxs(
|
|
21
|
-
"svg",
|
|
22
|
-
__spreadProps(__spreadValues({
|
|
23
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
24
|
-
viewBox: "0 0 24 24",
|
|
25
|
-
fill: "none",
|
|
26
|
-
stroke: "currentColor",
|
|
27
|
-
strokeWidth: 2,
|
|
28
|
-
strokeLinecap: "round",
|
|
29
|
-
strokeLinejoin: "round",
|
|
30
|
-
width: size,
|
|
31
|
-
height: size,
|
|
32
|
-
className
|
|
33
|
-
}, props), {
|
|
34
|
-
children: [
|
|
35
|
-
/* @__PURE__ */ jsx("path", { d: "m15 14 5-5-5-5" }),
|
|
36
|
-
/* @__PURE__ */ jsx("path", { d: "M20 9H9.5A5.5 5.5 0 0 0 4 14.5A5.5 5.5 0 0 0 9.5 20H13" })
|
|
37
|
-
]
|
|
38
|
-
})
|
|
39
|
-
);
|
|
40
|
-
};
|
|
41
|
-
var Undo2 = (_a) => {
|
|
42
|
-
var _b = _a, { size = 17, className } = _b, props = __objRest(_b, ["size", "className"]);
|
|
43
|
-
return /* @__PURE__ */ jsxs(
|
|
44
|
-
"svg",
|
|
45
|
-
__spreadProps(__spreadValues({
|
|
46
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
47
|
-
viewBox: "0 0 24 24",
|
|
48
|
-
fill: "none",
|
|
49
|
-
stroke: "currentColor",
|
|
50
|
-
strokeWidth: "2",
|
|
51
|
-
strokeLinecap: "round",
|
|
52
|
-
strokeLinejoin: "round",
|
|
53
|
-
width: size,
|
|
54
|
-
height: size,
|
|
55
|
-
className
|
|
56
|
-
}, props), {
|
|
57
|
-
children: [
|
|
58
|
-
/* @__PURE__ */ jsx("path", { d: "M9 14 4 9l5-5" }),
|
|
59
|
-
/* @__PURE__ */ jsx("path", { d: "M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5a5.5 5.5 0 0 1-5.5 5.5H11" })
|
|
60
|
-
]
|
|
61
|
-
})
|
|
62
|
-
);
|
|
63
|
-
};
|
|
64
|
-
|
|
65
|
-
// src/extension/History.tsx
|
|
66
|
-
import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
67
18
|
function HistoryButtons({
|
|
68
19
|
editor,
|
|
69
20
|
options,
|
|
@@ -76,8 +27,8 @@ function HistoryButtons({
|
|
|
76
27
|
canRedo: ctx.editor.can().chain().focus().redo().run()
|
|
77
28
|
})
|
|
78
29
|
});
|
|
79
|
-
return /* @__PURE__ */
|
|
80
|
-
/* @__PURE__ */
|
|
30
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
31
|
+
/* @__PURE__ */ jsx(
|
|
81
32
|
ButtonWithoutActive_default,
|
|
82
33
|
{
|
|
83
34
|
className: options.className,
|
|
@@ -86,15 +37,15 @@ function HistoryButtons({
|
|
|
86
37
|
tooltip: options.tooltip,
|
|
87
38
|
tooltipClassName: options.tooltipClassName,
|
|
88
39
|
tooltipPlacement: options.tooltipPlacement,
|
|
89
|
-
_internalIcon: /* @__PURE__ */
|
|
40
|
+
_internalIcon: /* @__PURE__ */ jsx(Undo2, {}),
|
|
90
41
|
_onToggle: () => editor.chain().focus().undo().run(),
|
|
91
|
-
_interShortcut: "\u2318 + Z",
|
|
42
|
+
_interShortcut: { win: "", mac: "\u2318 + Z" },
|
|
92
43
|
_tooltipContent: "Undo",
|
|
93
44
|
_disabled: !canUndo,
|
|
94
45
|
_buttonClassName: buttonClassName
|
|
95
46
|
}
|
|
96
47
|
),
|
|
97
|
-
/* @__PURE__ */
|
|
48
|
+
/* @__PURE__ */ jsx(
|
|
98
49
|
ButtonWithoutActive_default,
|
|
99
50
|
{
|
|
100
51
|
className: options.className,
|
|
@@ -103,9 +54,9 @@ function HistoryButtons({
|
|
|
103
54
|
tooltip: options.tooltip,
|
|
104
55
|
tooltipClassName: options.tooltipClassName,
|
|
105
56
|
tooltipPlacement: options.tooltipPlacement,
|
|
106
|
-
_internalIcon: /* @__PURE__ */
|
|
57
|
+
_internalIcon: /* @__PURE__ */ jsx(Redo2, {}),
|
|
107
58
|
_onToggle: () => editor.chain().focus().redo().run(),
|
|
108
|
-
_interShortcut: "
|
|
59
|
+
_interShortcut: { win: "Ctrl + Y", mac: "\u2318 + Y" },
|
|
109
60
|
_tooltipContent: "Redo",
|
|
110
61
|
_disabled: !canRedo,
|
|
111
62
|
_buttonClassName: buttonClassName
|
|
@@ -116,8 +67,9 @@ function HistoryButtons({
|
|
|
116
67
|
var History = UndoRedo.extend({
|
|
117
68
|
addOptions() {
|
|
118
69
|
var _a;
|
|
119
|
-
|
|
120
|
-
|
|
70
|
+
const parent = (_a = this.parent) == null ? void 0 : _a.call(this);
|
|
71
|
+
return __spreadProps(__spreadValues({}, parent != null ? parent : {}), {
|
|
72
|
+
component: ({ editor, options, buttonClassName }) => /* @__PURE__ */ jsx(HistoryButtons, { editor, options, buttonClassName })
|
|
121
73
|
});
|
|
122
74
|
}
|
|
123
75
|
});
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { HorizontalRuleOptions } from '@tiptap/extension-horizontal-rule';
|
|
2
|
+
import { Node } from '@tiptap/react';
|
|
3
|
+
import { b as ExtWithoutActiveOptions } from '../tiptap-ext.type-B3TtT7-J.mjs';
|
|
4
|
+
import 'react';
|
|
5
|
+
import '@floating-ui/react';
|
|
6
|
+
|
|
7
|
+
type ExtHorizontalRules = ExtWithoutActiveOptions<HorizontalRuleOptions>;
|
|
8
|
+
declare const HorizontalRule: Node<ExtHorizontalRules>;
|
|
9
|
+
|
|
10
|
+
export { HorizontalRule };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { HorizontalRuleOptions } from '@tiptap/extension-horizontal-rule';
|
|
2
|
+
import { Node } from '@tiptap/react';
|
|
3
|
+
import { b as ExtWithoutActiveOptions } from '../tiptap-ext.type-B3TtT7-J.js';
|
|
4
|
+
import 'react';
|
|
5
|
+
import '@floating-ui/react';
|
|
6
|
+
|
|
7
|
+
type ExtHorizontalRules = ExtWithoutActiveOptions<HorizontalRuleOptions>;
|
|
8
|
+
declare const HorizontalRule: Node<ExtHorizontalRules>;
|
|
9
|
+
|
|
10
|
+
export { HorizontalRule };
|
|
@@ -0,0 +1,242 @@
|
|
|
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/HorizontalRule.tsx
|
|
50
|
+
var HorizontalRule_exports = {};
|
|
51
|
+
__export(HorizontalRule_exports, {
|
|
52
|
+
HorizontalRule: () => HorizontalRule
|
|
53
|
+
});
|
|
54
|
+
module.exports = __toCommonJS(HorizontalRule_exports);
|
|
55
|
+
var import_extension_horizontal_rule = require("@tiptap/extension-horizontal-rule");
|
|
56
|
+
|
|
57
|
+
// src/lib/icons/index.tsx
|
|
58
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
59
|
+
var MinusIcon = (_a) => {
|
|
60
|
+
var _b = _a, { size = 17, className } = _b, props = __objRest(_b, ["size", "className"]);
|
|
61
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
62
|
+
"svg",
|
|
63
|
+
__spreadProps(__spreadValues({
|
|
64
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
65
|
+
viewBox: "0 0 24 24",
|
|
66
|
+
fill: "none",
|
|
67
|
+
stroke: "currentColor",
|
|
68
|
+
strokeWidth: 2,
|
|
69
|
+
strokeLinecap: "round",
|
|
70
|
+
strokeLinejoin: "round",
|
|
71
|
+
width: size,
|
|
72
|
+
height: size,
|
|
73
|
+
className
|
|
74
|
+
}, props), {
|
|
75
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M5 12h14" })
|
|
76
|
+
})
|
|
77
|
+
);
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
// src/lib/components/ButtonWithoutActive.tsx
|
|
81
|
+
var import_react4 = require("react");
|
|
82
|
+
var import_tailwind_merge2 = require("tailwind-merge");
|
|
83
|
+
|
|
84
|
+
// src/lib/components/_com/Tooltip.tsx
|
|
85
|
+
var import_react = require("react");
|
|
86
|
+
var import_react2 = require("@floating-ui/react");
|
|
87
|
+
var import_react3 = require("motion/react");
|
|
88
|
+
var import_tailwind_merge = require("tailwind-merge");
|
|
89
|
+
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
90
|
+
var Tooltip = ({ placement = "top", children, content, className }) => {
|
|
91
|
+
const [open, setOpen] = (0, import_react.useState)(false);
|
|
92
|
+
const { x, y, refs, strategy, context, placement: resolvedPlacement } = (0, import_react2.useFloating)({
|
|
93
|
+
open,
|
|
94
|
+
onOpenChange: setOpen,
|
|
95
|
+
placement,
|
|
96
|
+
middleware: [(0, import_react2.offset)(8), (0, import_react2.flip)(), (0, import_react2.shift)({ padding: 8 })],
|
|
97
|
+
whileElementsMounted: import_react2.autoUpdate
|
|
98
|
+
});
|
|
99
|
+
const hover = (0, import_react2.useHover)(context);
|
|
100
|
+
const dismiss = (0, import_react2.useDismiss)(context);
|
|
101
|
+
const { getReferenceProps, getFloatingProps } = (0, import_react2.useInteractions)([hover, dismiss]);
|
|
102
|
+
const id = (0, import_react.useId)();
|
|
103
|
+
function mergeRefs(...refsToMerge) {
|
|
104
|
+
return (node) => {
|
|
105
|
+
for (const r of refsToMerge) {
|
|
106
|
+
if (!r) continue;
|
|
107
|
+
if (typeof r === "function") r(node);
|
|
108
|
+
else r.current = node;
|
|
109
|
+
}
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
const side = resolvedPlacement.split("-")[0];
|
|
113
|
+
const enterOffset = 6;
|
|
114
|
+
const getInitial = () => {
|
|
115
|
+
switch (side) {
|
|
116
|
+
case "top":
|
|
117
|
+
return { opacity: 0, y: enterOffset };
|
|
118
|
+
case "bottom":
|
|
119
|
+
return { opacity: 0, y: -enterOffset };
|
|
120
|
+
case "left":
|
|
121
|
+
return { opacity: 0, x: enterOffset };
|
|
122
|
+
case "right":
|
|
123
|
+
return { opacity: 0, x: -enterOffset };
|
|
124
|
+
default:
|
|
125
|
+
return { opacity: 0 };
|
|
126
|
+
}
|
|
127
|
+
};
|
|
128
|
+
const getExit = () => __spreadProps(__spreadValues({}, getInitial()), { opacity: 0 });
|
|
129
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_react.Fragment, { children: [
|
|
130
|
+
(0, import_react.isValidElement)(children) ? (0, import_react.cloneElement)(children, __spreadProps(__spreadValues({}, getReferenceProps({
|
|
131
|
+
onFocus: () => setOpen(true),
|
|
132
|
+
onBlur: () => setOpen(false),
|
|
133
|
+
"aria-describedby": open ? id : void 0
|
|
134
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
135
|
+
})), {
|
|
136
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
137
|
+
ref: mergeRefs(children.props.ref, refs.setReference)
|
|
138
|
+
})) : children,
|
|
139
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_react2.FloatingPortal, { children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_react3.AnimatePresence, { children: open && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
140
|
+
import_react3.motion.div,
|
|
141
|
+
__spreadProps(__spreadValues({
|
|
142
|
+
ref: refs.setFloating
|
|
143
|
+
}, getFloatingProps({
|
|
144
|
+
role: "tooltip",
|
|
145
|
+
id,
|
|
146
|
+
style: {
|
|
147
|
+
position: strategy,
|
|
148
|
+
top: y != null ? y : 0,
|
|
149
|
+
left: x != null ? x : 0,
|
|
150
|
+
pointerEvents: "none"
|
|
151
|
+
}
|
|
152
|
+
})), {
|
|
153
|
+
initial: getInitial(),
|
|
154
|
+
animate: { opacity: 1, x: 0, y: 0, scale: 1 },
|
|
155
|
+
exit: getExit(),
|
|
156
|
+
transition: { type: "spring", stiffness: 420, damping: 30, mass: 0.6 },
|
|
157
|
+
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),
|
|
158
|
+
children: content
|
|
159
|
+
}),
|
|
160
|
+
"tooltip"
|
|
161
|
+
) }) })
|
|
162
|
+
] });
|
|
163
|
+
};
|
|
164
|
+
var Tooltip_default = Tooltip;
|
|
165
|
+
|
|
166
|
+
// src/lib/components/ButtonWithoutActive.tsx
|
|
167
|
+
var import_react5 = require("@tiptap/react");
|
|
168
|
+
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
169
|
+
var ButtonWithoutActive = ({ className, icon, style, tooltip = true, tooltipClassName, tooltipPlacement, _internalIcon, _tooltipContent, _interShortcut, _onToggle, _buttonClassName, _disabled = false }) => {
|
|
170
|
+
const shortcutText = (0, import_react4.useMemo)(() => {
|
|
171
|
+
if (!_interShortcut) return "";
|
|
172
|
+
return (0, import_react5.isMacOS)() ? _interShortcut.mac : _interShortcut.win;
|
|
173
|
+
}, [_interShortcut]);
|
|
174
|
+
const tooltipContent = /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("p", { children: [
|
|
175
|
+
typeof tooltip === "string" ? tooltip : _tooltipContent,
|
|
176
|
+
_interShortcut && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_jsx_runtime3.Fragment, { children: [
|
|
177
|
+
" ",
|
|
178
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("br", {}),
|
|
179
|
+
" ",
|
|
180
|
+
shortcutText,
|
|
181
|
+
" "
|
|
182
|
+
] })
|
|
183
|
+
] });
|
|
184
|
+
const btn = /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
185
|
+
"button",
|
|
186
|
+
{
|
|
187
|
+
onClick: _onToggle,
|
|
188
|
+
disabled: _disabled,
|
|
189
|
+
className: (0, import_tailwind_merge2.twMerge)(
|
|
190
|
+
"py-1.5 px-2.5 rounded-md hover:bg-gray-100",
|
|
191
|
+
_disabled ? "opacity-20" : "",
|
|
192
|
+
_buttonClassName,
|
|
193
|
+
className
|
|
194
|
+
),
|
|
195
|
+
style,
|
|
196
|
+
children: icon != null ? icon : _internalIcon
|
|
197
|
+
}
|
|
198
|
+
);
|
|
199
|
+
if (tooltip === false) return btn;
|
|
200
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
201
|
+
Tooltip_default,
|
|
202
|
+
{
|
|
203
|
+
content: tooltipContent,
|
|
204
|
+
className: tooltipClassName,
|
|
205
|
+
placement: tooltipPlacement,
|
|
206
|
+
children: btn
|
|
207
|
+
}
|
|
208
|
+
);
|
|
209
|
+
};
|
|
210
|
+
var ButtonWithoutActive_default = ButtonWithoutActive;
|
|
211
|
+
|
|
212
|
+
// src/extension/HorizontalRule.tsx
|
|
213
|
+
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
214
|
+
var HorizontalRule = import_extension_horizontal_rule.HorizontalRule.extend({
|
|
215
|
+
addOptions() {
|
|
216
|
+
var _a;
|
|
217
|
+
const parent = (_a = this.parent) == null ? void 0 : _a.call(this);
|
|
218
|
+
return __spreadProps(__spreadValues({}, parent != null ? parent : {}), {
|
|
219
|
+
component: ({ editor, options, buttonClassName }) => {
|
|
220
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
221
|
+
ButtonWithoutActive_default,
|
|
222
|
+
{
|
|
223
|
+
className: options.className,
|
|
224
|
+
icon: options.icon,
|
|
225
|
+
style: options.style,
|
|
226
|
+
tooltip: options.tooltip,
|
|
227
|
+
tooltipClassName: options.tooltipClassName,
|
|
228
|
+
tooltipPlacement: options.tooltipPlacement,
|
|
229
|
+
_internalIcon: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(MinusIcon, {}),
|
|
230
|
+
_onToggle: () => editor.chain().focus().setHorizontalRule().run(),
|
|
231
|
+
_tooltipContent: "Horizontal Rules",
|
|
232
|
+
_buttonClassName: buttonClassName
|
|
233
|
+
}
|
|
234
|
+
);
|
|
235
|
+
}
|
|
236
|
+
});
|
|
237
|
+
}
|
|
238
|
+
});
|
|
239
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
240
|
+
0 && (module.exports = {
|
|
241
|
+
HorizontalRule
|
|
242
|
+
});
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import {
|
|
2
|
+
ButtonWithoutActive_default
|
|
3
|
+
} from "../chunk-WXCHG3NQ.mjs";
|
|
4
|
+
import {
|
|
5
|
+
MinusIcon
|
|
6
|
+
} from "../chunk-EN4BPI7N.mjs";
|
|
7
|
+
import {
|
|
8
|
+
__spreadProps,
|
|
9
|
+
__spreadValues
|
|
10
|
+
} from "../chunk-WNQUEZJF.mjs";
|
|
11
|
+
|
|
12
|
+
// src/extension/HorizontalRule.tsx
|
|
13
|
+
import { HorizontalRule as TiptapHorizontalRule } from "@tiptap/extension-horizontal-rule";
|
|
14
|
+
import { jsx } from "react/jsx-runtime";
|
|
15
|
+
var HorizontalRule = TiptapHorizontalRule.extend({
|
|
16
|
+
addOptions() {
|
|
17
|
+
var _a;
|
|
18
|
+
const parent = (_a = this.parent) == null ? void 0 : _a.call(this);
|
|
19
|
+
return __spreadProps(__spreadValues({}, parent != null ? parent : {}), {
|
|
20
|
+
component: ({ editor, options, buttonClassName }) => {
|
|
21
|
+
return /* @__PURE__ */ jsx(
|
|
22
|
+
ButtonWithoutActive_default,
|
|
23
|
+
{
|
|
24
|
+
className: options.className,
|
|
25
|
+
icon: options.icon,
|
|
26
|
+
style: options.style,
|
|
27
|
+
tooltip: options.tooltip,
|
|
28
|
+
tooltipClassName: options.tooltipClassName,
|
|
29
|
+
tooltipPlacement: options.tooltipPlacement,
|
|
30
|
+
_internalIcon: /* @__PURE__ */ jsx(MinusIcon, {}),
|
|
31
|
+
_onToggle: () => editor.chain().focus().setHorizontalRule().run(),
|
|
32
|
+
_tooltipContent: "Horizontal Rules",
|
|
33
|
+
_buttonClassName: buttonClassName
|
|
34
|
+
}
|
|
35
|
+
);
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
export {
|
|
41
|
+
HorizontalRule
|
|
42
|
+
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { SetImageOptions, ImageOptions } from '@tiptap/extension-image';
|
|
2
|
+
import { Node } from '@tiptap/react';
|
|
3
|
+
import { b as ExtWithoutActiveOptions } from '../tiptap-ext.type-B3TtT7-J.mjs';
|
|
4
|
+
import 'react';
|
|
5
|
+
import '@floating-ui/react';
|
|
6
|
+
|
|
7
|
+
type SetImageInlineOptions = SetImageOptions & {
|
|
8
|
+
inline?: boolean;
|
|
9
|
+
};
|
|
10
|
+
declare module "@tiptap/react" {
|
|
11
|
+
interface Commands<ReturnType> {
|
|
12
|
+
imageLine: {
|
|
13
|
+
setImageWithInline: (options: SetImageInlineOptions) => ReturnType;
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
type ExtImageOptions = ExtWithoutActiveOptions<ImageOptions & {
|
|
18
|
+
upload?: (file: File) => Promise<string>;
|
|
19
|
+
maxSize?: number;
|
|
20
|
+
defaultInline?: boolean;
|
|
21
|
+
enableAlt?: boolean;
|
|
22
|
+
aspect?: number;
|
|
23
|
+
}>;
|
|
24
|
+
declare const Image: Node<ExtImageOptions>;
|
|
25
|
+
|
|
26
|
+
export { Image };
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { SetImageOptions, ImageOptions } from '@tiptap/extension-image';
|
|
2
|
+
import { Node } from '@tiptap/react';
|
|
3
|
+
import { b as ExtWithoutActiveOptions } from '../tiptap-ext.type-B3TtT7-J.js';
|
|
4
|
+
import 'react';
|
|
5
|
+
import '@floating-ui/react';
|
|
6
|
+
|
|
7
|
+
type SetImageInlineOptions = SetImageOptions & {
|
|
8
|
+
inline?: boolean;
|
|
9
|
+
};
|
|
10
|
+
declare module "@tiptap/react" {
|
|
11
|
+
interface Commands<ReturnType> {
|
|
12
|
+
imageLine: {
|
|
13
|
+
setImageWithInline: (options: SetImageInlineOptions) => ReturnType;
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
type ExtImageOptions = ExtWithoutActiveOptions<ImageOptions & {
|
|
18
|
+
upload?: (file: File) => Promise<string>;
|
|
19
|
+
maxSize?: number;
|
|
20
|
+
defaultInline?: boolean;
|
|
21
|
+
enableAlt?: boolean;
|
|
22
|
+
aspect?: number;
|
|
23
|
+
}>;
|
|
24
|
+
declare const Image: Node<ExtImageOptions>;
|
|
25
|
+
|
|
26
|
+
export { Image };
|