@kopexa/tiptap 17.0.17 → 17.2.0
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/chunk-2U5CQUZH.mjs +91 -0
- package/dist/chunk-2V6VOAPI.mjs +139 -0
- package/dist/chunk-32SUXCAQ.mjs +115 -0
- package/dist/chunk-3VRQUYYW.mjs +169 -0
- package/dist/chunk-4CDZ547I.mjs +185 -0
- package/dist/chunk-5GFFTVMZ.mjs +62 -0
- package/dist/{chunk-FJAGUXEO.mjs → chunk-7SRL3P4B.mjs} +32 -19
- package/dist/{chunk-WHJ4B43N.mjs → chunk-7VGROP26.mjs} +69 -25
- package/dist/chunk-7VW67NVL.mjs +80 -0
- package/dist/chunk-BXHPO3T7.mjs +152 -0
- package/dist/{chunk-QF3YHPWM.mjs → chunk-E5NW3MJZ.mjs} +4 -4
- package/dist/chunk-FRJX2F4T.mjs +55 -0
- package/dist/chunk-IFXRPGIJ.mjs +98 -0
- package/dist/chunk-JCV5SEKN.mjs +65 -0
- package/dist/chunk-LMCQMSW2.mjs +345 -0
- package/dist/chunk-N4CT5RNC.mjs +123 -0
- package/dist/{chunk-B2DHYFSH.mjs → chunk-NEHW62L7.mjs} +56 -3
- package/dist/chunk-NSYSECKW.mjs +53 -0
- package/dist/{chunk-3IKIIRV3.mjs → chunk-QAE2D4KV.mjs} +39 -16
- package/dist/chunk-TAM3VMJT.mjs +80 -0
- package/dist/chunk-UU6JK5HX.mjs +257 -0
- package/dist/chunk-UVHVCION.mjs +168 -0
- package/dist/chunk-VF3G2URZ.mjs +83 -0
- package/dist/chunk-VRQ6OSAZ.mjs +76 -0
- package/dist/chunk-WAAH3NLG.mjs +77 -0
- package/dist/chunk-XNDXYI2N.mjs +158 -0
- package/dist/context/editor-file-context.d.mts +70 -0
- package/dist/context/editor-file-context.d.ts +70 -0
- package/dist/context/editor-file-context.js +96 -0
- package/dist/context/editor-file-context.mjs +12 -0
- package/dist/extensions/callout/callout-settings.d.mts +13 -0
- package/dist/extensions/callout/callout-settings.d.ts +13 -0
- package/dist/extensions/callout/callout-settings.js +206 -0
- package/dist/extensions/callout/callout-settings.mjs +9 -0
- package/dist/extensions/callout/callout-view.d.mts +12 -0
- package/dist/extensions/callout/callout-view.d.ts +12 -0
- package/dist/extensions/callout/callout-view.js +273 -0
- package/dist/extensions/callout/callout-view.mjs +12 -0
- package/dist/extensions/callout/index.d.mts +44 -0
- package/dist/extensions/callout/index.d.ts +44 -0
- package/dist/extensions/callout/index.js +380 -0
- package/dist/extensions/callout/index.mjs +13 -0
- package/dist/extensions/callout/messages.d.mts +59 -0
- package/dist/extensions/callout/messages.d.ts +59 -0
- package/dist/extensions/callout/messages.js +88 -0
- package/dist/extensions/callout/messages.mjs +7 -0
- package/dist/extensions/image/image-view.d.mts +15 -0
- package/dist/extensions/image/image-view.d.ts +15 -0
- package/dist/extensions/image/image-view.js +423 -0
- package/dist/extensions/image/image-view.mjs +12 -0
- package/dist/extensions/image/index.d.mts +66 -0
- package/dist/extensions/image/index.d.ts +66 -0
- package/dist/extensions/image/index.js +495 -0
- package/dist/extensions/image/index.mjs +16 -0
- package/dist/extensions/image/messages.d.mts +56 -0
- package/dist/extensions/image/messages.d.ts +56 -0
- package/dist/extensions/image/messages.js +85 -0
- package/dist/extensions/image/messages.mjs +7 -0
- package/dist/extensions/math/index.d.mts +38 -0
- package/dist/extensions/math/index.d.ts +38 -0
- package/dist/extensions/math/index.js +544 -0
- package/dist/extensions/math/index.mjs +17 -0
- package/dist/extensions/math/inline-math-view.d.mts +12 -0
- package/dist/extensions/math/inline-math-view.d.ts +12 -0
- package/dist/extensions/math/inline-math-view.js +232 -0
- package/dist/extensions/math/inline-math-view.mjs +11 -0
- package/dist/extensions/math/inline-math.d.mts +32 -0
- package/dist/extensions/math/inline-math.d.ts +32 -0
- package/dist/extensions/math/inline-math.js +304 -0
- package/dist/extensions/math/inline-math.mjs +12 -0
- package/dist/extensions/math/math-block-view.d.mts +11 -0
- package/dist/extensions/math/math-block-view.d.ts +11 -0
- package/dist/extensions/math/math-block-view.js +248 -0
- package/dist/extensions/math/math-block-view.mjs +11 -0
- package/dist/extensions/math/messages.d.mts +49 -0
- package/dist/extensions/math/messages.d.ts +49 -0
- package/dist/extensions/math/messages.js +78 -0
- package/dist/extensions/math/messages.mjs +7 -0
- package/dist/extensions/toc/index.d.mts +53 -0
- package/dist/extensions/toc/index.d.ts +53 -0
- package/dist/extensions/toc/index.js +501 -0
- package/dist/extensions/toc/index.mjs +13 -0
- package/dist/extensions/toc/messages.d.mts +74 -0
- package/dist/extensions/toc/messages.d.ts +74 -0
- package/dist/extensions/toc/messages.js +103 -0
- package/dist/extensions/toc/messages.mjs +7 -0
- package/dist/extensions/toc/toc-settings.d.mts +13 -0
- package/dist/extensions/toc/toc-settings.d.ts +13 -0
- package/dist/extensions/toc/toc-settings.js +283 -0
- package/dist/extensions/toc/toc-settings.mjs +9 -0
- package/dist/extensions/toc/toc-view.d.mts +12 -0
- package/dist/extensions/toc/toc-view.d.ts +12 -0
- package/dist/extensions/toc/toc-view.js +411 -0
- package/dist/extensions/toc/toc-view.mjs +12 -0
- package/dist/hooks/use-create-editor.d.mts +20 -2
- package/dist/hooks/use-create-editor.d.ts +20 -2
- package/dist/hooks/use-create-editor.js +2020 -20
- package/dist/hooks/use-create-editor.mjs +20 -3
- package/dist/index.d.mts +11 -2
- package/dist/index.d.ts +11 -2
- package/dist/index.js +3948 -1563
- package/dist/index.mjs +64 -23
- package/dist/presets/basic/editor-header.d.mts +3 -2
- package/dist/presets/basic/editor-header.d.ts +3 -2
- package/dist/presets/basic/editor-header.js +91 -25
- package/dist/presets/basic/editor-header.mjs +14 -14
- package/dist/presets/basic/index.d.mts +3 -1
- package/dist/presets/basic/index.d.ts +3 -1
- package/dist/presets/basic/index.js +3833 -1517
- package/dist/presets/basic/index.mjs +41 -22
- package/dist/ui/bubble-menu/index.d.mts +13 -0
- package/dist/ui/bubble-menu/index.d.ts +13 -0
- package/dist/ui/bubble-menu/index.js +671 -0
- package/dist/ui/bubble-menu/index.mjs +16 -0
- package/dist/ui/color-highlight-popover/color-highlight-popover.mjs +2 -2
- package/dist/ui/color-highlight-popover/index.mjs +2 -2
- package/dist/ui/copy-anchor-link-button/use-scroll-to-hash.mjs +2 -2
- package/dist/ui/link-bubble/index.d.mts +13 -0
- package/dist/ui/link-bubble/index.d.ts +13 -0
- package/dist/ui/link-bubble/index.js +182 -0
- package/dist/ui/link-bubble/index.mjs +10 -0
- package/dist/ui/link-popover/index.js +66 -23
- package/dist/ui/link-popover/index.mjs +3 -3
- package/dist/ui/link-popover/link-popover.d.mts +7 -2
- package/dist/ui/link-popover/link-popover.d.ts +7 -2
- package/dist/ui/link-popover/link-popover.js +66 -23
- package/dist/ui/link-popover/link-popover.mjs +3 -3
- package/dist/ui/link-popover/use-link-popover.mjs +2 -2
- package/dist/ui/slash-dropdown-menu/index.js +53 -3
- package/dist/ui/slash-dropdown-menu/index.mjs +6 -6
- package/dist/ui/slash-dropdown-menu/slash-dropdown-menu.js +53 -3
- package/dist/ui/slash-dropdown-menu/slash-dropdown-menu.mjs +4 -4
- package/dist/ui/slash-dropdown-menu/use-slash-dropdown-menu.d.mts +28 -0
- package/dist/ui/slash-dropdown-menu/use-slash-dropdown-menu.d.ts +28 -0
- package/dist/ui/slash-dropdown-menu/use-slash-dropdown-menu.js +53 -3
- package/dist/ui/slash-dropdown-menu/use-slash-dropdown-menu.mjs +1 -1
- package/dist/ui/suggestion-menu/index.mjs +2 -2
- package/dist/ui/suggestion-menu/suggestion-menu.mjs +2 -2
- package/dist/utils/safe-parse.js +113 -4
- package/dist/utils/safe-parse.mjs +1 -1
- package/package.json +48 -39
- package/dist/chunk-7LHOYNVF.mjs +0 -60
- package/dist/chunk-LXOLVGLW.mjs +0 -131
- package/dist/{chunk-XL5FS7LN.mjs → chunk-C5RQWJKE.mjs} +3 -3
- package/dist/{chunk-JNL4KY45.mjs → chunk-DZLGLP7R.mjs} +3 -3
- package/dist/{chunk-LHXRE26G.mjs → chunk-VTKJPVNM.mjs} +3 -3
- package/dist/{chunk-XLSZK3WJ.mjs → chunk-ZYFCSR3E.mjs} +3 -3
|
@@ -0,0 +1,273 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
"use strict";
|
|
3
|
+
"use client";
|
|
4
|
+
var __defProp = Object.defineProperty;
|
|
5
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
21
|
+
|
|
22
|
+
// src/extensions/callout/callout-view.tsx
|
|
23
|
+
var callout_view_exports = {};
|
|
24
|
+
__export(callout_view_exports, {
|
|
25
|
+
CalloutNodeView: () => CalloutNodeView,
|
|
26
|
+
default: () => callout_view_default
|
|
27
|
+
});
|
|
28
|
+
module.exports = __toCommonJS(callout_view_exports);
|
|
29
|
+
var import_icons2 = require("@kopexa/icons");
|
|
30
|
+
var import_theme = require("@kopexa/theme");
|
|
31
|
+
var import_react2 = require("@tiptap/react");
|
|
32
|
+
var import_react3 = require("react");
|
|
33
|
+
|
|
34
|
+
// src/extensions/callout/callout-settings.tsx
|
|
35
|
+
var import_button = require("@kopexa/button");
|
|
36
|
+
var import_dialog = require("@kopexa/dialog");
|
|
37
|
+
var import_icons = require("@kopexa/icons");
|
|
38
|
+
var import_input = require("@kopexa/input");
|
|
39
|
+
var import_label = require("@kopexa/label");
|
|
40
|
+
var import_select = require("@kopexa/select");
|
|
41
|
+
var import_react = require("react");
|
|
42
|
+
var import_react_intl2 = require("react-intl");
|
|
43
|
+
|
|
44
|
+
// src/extensions/callout/messages.ts
|
|
45
|
+
var import_react_intl = require("react-intl");
|
|
46
|
+
var messages = (0, import_react_intl.defineMessages)({
|
|
47
|
+
settings: {
|
|
48
|
+
id: "editor.callout.settings",
|
|
49
|
+
defaultMessage: "Settings",
|
|
50
|
+
description: "Settings button label"
|
|
51
|
+
},
|
|
52
|
+
variant: {
|
|
53
|
+
id: "editor.callout.variant",
|
|
54
|
+
defaultMessage: "Variant",
|
|
55
|
+
description: "Variant setting label"
|
|
56
|
+
},
|
|
57
|
+
variant_default: {
|
|
58
|
+
id: "editor.callout.variant_default",
|
|
59
|
+
defaultMessage: "Default",
|
|
60
|
+
description: "Default variant option"
|
|
61
|
+
},
|
|
62
|
+
variant_info: {
|
|
63
|
+
id: "editor.callout.variant_info",
|
|
64
|
+
defaultMessage: "Info",
|
|
65
|
+
description: "Info variant option"
|
|
66
|
+
},
|
|
67
|
+
variant_success: {
|
|
68
|
+
id: "editor.callout.variant_success",
|
|
69
|
+
defaultMessage: "Success",
|
|
70
|
+
description: "Success variant option"
|
|
71
|
+
},
|
|
72
|
+
variant_warning: {
|
|
73
|
+
id: "editor.callout.variant_warning",
|
|
74
|
+
defaultMessage: "Warning",
|
|
75
|
+
description: "Warning variant option"
|
|
76
|
+
},
|
|
77
|
+
variant_destructive: {
|
|
78
|
+
id: "editor.callout.variant_destructive",
|
|
79
|
+
defaultMessage: "Error",
|
|
80
|
+
description: "Destructive/Error variant option"
|
|
81
|
+
},
|
|
82
|
+
title: {
|
|
83
|
+
id: "editor.callout.title",
|
|
84
|
+
defaultMessage: "Title",
|
|
85
|
+
description: "Title input label"
|
|
86
|
+
},
|
|
87
|
+
title_placeholder: {
|
|
88
|
+
id: "editor.callout.title_placeholder",
|
|
89
|
+
defaultMessage: "Optional title...",
|
|
90
|
+
description: "Title input placeholder"
|
|
91
|
+
},
|
|
92
|
+
save: {
|
|
93
|
+
id: "editor.callout.save",
|
|
94
|
+
defaultMessage: "Save",
|
|
95
|
+
description: "Save button label"
|
|
96
|
+
},
|
|
97
|
+
cancel: {
|
|
98
|
+
id: "editor.callout.cancel",
|
|
99
|
+
defaultMessage: "Cancel",
|
|
100
|
+
description: "Cancel button label"
|
|
101
|
+
}
|
|
102
|
+
});
|
|
103
|
+
|
|
104
|
+
// src/extensions/callout/callout-settings.tsx
|
|
105
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
106
|
+
var VARIANTS = [
|
|
107
|
+
{ value: "default", messageKey: "variant_default" },
|
|
108
|
+
{ value: "info", messageKey: "variant_info" },
|
|
109
|
+
{ value: "success", messageKey: "variant_success" },
|
|
110
|
+
{ value: "warning", messageKey: "variant_warning" },
|
|
111
|
+
{ value: "destructive", messageKey: "variant_destructive" }
|
|
112
|
+
];
|
|
113
|
+
function CalloutSettings({
|
|
114
|
+
editor,
|
|
115
|
+
attrs,
|
|
116
|
+
getPos
|
|
117
|
+
}) {
|
|
118
|
+
const intl = (0, import_react_intl2.useIntl)();
|
|
119
|
+
const [isOpen, setIsOpen] = (0, import_react.useState)(false);
|
|
120
|
+
const [localAttrs, setLocalAttrs] = (0, import_react.useState)(attrs);
|
|
121
|
+
(0, import_react.useEffect)(() => {
|
|
122
|
+
if (isOpen) {
|
|
123
|
+
setLocalAttrs(attrs);
|
|
124
|
+
}
|
|
125
|
+
}, [isOpen, attrs]);
|
|
126
|
+
const handleSave = (0, import_react.useCallback)(() => {
|
|
127
|
+
const pos = getPos();
|
|
128
|
+
if (pos === void 0) return;
|
|
129
|
+
editor.view.dispatch(
|
|
130
|
+
editor.state.tr.setNodeMarkup(pos, void 0, localAttrs)
|
|
131
|
+
);
|
|
132
|
+
setIsOpen(false);
|
|
133
|
+
}, [editor, localAttrs, getPos]);
|
|
134
|
+
const handleCancel = (0, import_react.useCallback)(() => {
|
|
135
|
+
setLocalAttrs(attrs);
|
|
136
|
+
setIsOpen(false);
|
|
137
|
+
}, [attrs]);
|
|
138
|
+
const handleVariantChange = (0, import_react.useCallback)((value) => {
|
|
139
|
+
setLocalAttrs((prev) => ({
|
|
140
|
+
...prev,
|
|
141
|
+
variant: String(value)
|
|
142
|
+
}));
|
|
143
|
+
}, []);
|
|
144
|
+
const handleTitleChange = (0, import_react.useCallback)(
|
|
145
|
+
(e) => {
|
|
146
|
+
const value = e.target.value;
|
|
147
|
+
setLocalAttrs((prev) => ({
|
|
148
|
+
...prev,
|
|
149
|
+
title: value || null
|
|
150
|
+
}));
|
|
151
|
+
},
|
|
152
|
+
[]
|
|
153
|
+
);
|
|
154
|
+
if (!editor.isEditable) {
|
|
155
|
+
return null;
|
|
156
|
+
}
|
|
157
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
158
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
159
|
+
import_button.IconButton,
|
|
160
|
+
{
|
|
161
|
+
size: "sm",
|
|
162
|
+
variant: "ghost",
|
|
163
|
+
"aria-label": intl.formatMessage(messages.settings),
|
|
164
|
+
onClick: (e) => {
|
|
165
|
+
e.stopPropagation();
|
|
166
|
+
e.preventDefault();
|
|
167
|
+
setIsOpen(true);
|
|
168
|
+
},
|
|
169
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icons.SettingsIcon, { className: "size-3.5" })
|
|
170
|
+
}
|
|
171
|
+
),
|
|
172
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dialog.Dialog.Root, { open: isOpen, onOpenChange: setIsOpen, size: "sm", children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_dialog.Dialog.Content, { children: [
|
|
173
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dialog.Dialog.Header, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dialog.Dialog.Title, { children: intl.formatMessage(messages.settings) }) }),
|
|
174
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dialog.Dialog.Body, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "space-y-4", children: [
|
|
175
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "space-y-1.5", children: [
|
|
176
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_label.Label, { className: "text-sm", children: intl.formatMessage(messages.variant) }),
|
|
177
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
178
|
+
import_select.Select,
|
|
179
|
+
{
|
|
180
|
+
size: "sm",
|
|
181
|
+
value: localAttrs.variant,
|
|
182
|
+
onValueChange: handleVariantChange,
|
|
183
|
+
children: [
|
|
184
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_select.Select.Trigger, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_select.Select.Value, {}) }),
|
|
185
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_select.Select.Content, { children: VARIANTS.map((v) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_select.Select.Item, { value: v.value, children: intl.formatMessage(messages[v.messageKey]) }, v.value)) })
|
|
186
|
+
]
|
|
187
|
+
}
|
|
188
|
+
)
|
|
189
|
+
] }),
|
|
190
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "space-y-1.5", children: [
|
|
191
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_label.Label, { className: "text-sm", children: intl.formatMessage(messages.title) }),
|
|
192
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
193
|
+
import_input.Input,
|
|
194
|
+
{
|
|
195
|
+
size: "sm",
|
|
196
|
+
value: localAttrs.title || "",
|
|
197
|
+
onChange: handleTitleChange,
|
|
198
|
+
placeholder: intl.formatMessage(messages.title_placeholder)
|
|
199
|
+
}
|
|
200
|
+
)
|
|
201
|
+
] })
|
|
202
|
+
] }) }),
|
|
203
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_dialog.Dialog.Footer, { children: [
|
|
204
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_button.Button, { variant: "ghost", onClick: handleCancel, children: intl.formatMessage(messages.cancel) }),
|
|
205
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_button.Button, { onClick: handleSave, children: intl.formatMessage(messages.save) })
|
|
206
|
+
] })
|
|
207
|
+
] }) })
|
|
208
|
+
] });
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
// src/extensions/callout/callout-view.tsx
|
|
212
|
+
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
213
|
+
function getVariantIcon(variant, iconClass) {
|
|
214
|
+
switch (variant) {
|
|
215
|
+
case "info":
|
|
216
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_icons2.InfoIcon, { className: iconClass });
|
|
217
|
+
case "success":
|
|
218
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_icons2.CheckCirleIcon, { className: iconClass });
|
|
219
|
+
case "warning":
|
|
220
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_icons2.AlertIcon, { className: iconClass });
|
|
221
|
+
case "destructive":
|
|
222
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_icons2.AlertCircleIcon, { className: iconClass });
|
|
223
|
+
default:
|
|
224
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_icons2.ShellIcon, { className: iconClass });
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
function CalloutNodeView({ editor, node, getPos }) {
|
|
228
|
+
const attrs = node.attrs;
|
|
229
|
+
const { variant = "info", title } = attrs;
|
|
230
|
+
const isEditable = (0, import_react2.useEditorState)({
|
|
231
|
+
editor,
|
|
232
|
+
selector: ({ editor: e }) => {
|
|
233
|
+
var _a;
|
|
234
|
+
return (_a = e == null ? void 0 : e.isEditable) != null ? _a : false;
|
|
235
|
+
}
|
|
236
|
+
});
|
|
237
|
+
const styles = (0, import_react3.useMemo)(
|
|
238
|
+
() => (0, import_theme.callout)({
|
|
239
|
+
variant,
|
|
240
|
+
radius: "md",
|
|
241
|
+
size: "md"
|
|
242
|
+
}),
|
|
243
|
+
[variant]
|
|
244
|
+
);
|
|
245
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
246
|
+
import_react2.NodeViewWrapper,
|
|
247
|
+
{
|
|
248
|
+
className: styles.root(),
|
|
249
|
+
"data-type": "callout",
|
|
250
|
+
"data-variant": variant,
|
|
251
|
+
children: [
|
|
252
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: styles.iconContainer(), children: getVariantIcon(variant, styles.icon()) }),
|
|
253
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: styles.content(), children: [
|
|
254
|
+
title && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: styles.title(), children: title }),
|
|
255
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_react2.NodeViewContent, { className: "callout-content" })
|
|
256
|
+
] }),
|
|
257
|
+
isEditable && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "absolute top-2 right-2", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
258
|
+
CalloutSettings,
|
|
259
|
+
{
|
|
260
|
+
editor,
|
|
261
|
+
attrs,
|
|
262
|
+
getPos
|
|
263
|
+
}
|
|
264
|
+
) })
|
|
265
|
+
]
|
|
266
|
+
}
|
|
267
|
+
);
|
|
268
|
+
}
|
|
269
|
+
var callout_view_default = CalloutNodeView;
|
|
270
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
271
|
+
0 && (module.exports = {
|
|
272
|
+
CalloutNodeView
|
|
273
|
+
});
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
"use client";
|
|
3
|
+
import {
|
|
4
|
+
CalloutNodeView,
|
|
5
|
+
callout_view_default
|
|
6
|
+
} from "../../chunk-VF3G2URZ.mjs";
|
|
7
|
+
import "../../chunk-N4CT5RNC.mjs";
|
|
8
|
+
import "../../chunk-JCV5SEKN.mjs";
|
|
9
|
+
export {
|
|
10
|
+
CalloutNodeView,
|
|
11
|
+
callout_view_default as default
|
|
12
|
+
};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { Node } from '@tiptap/core';
|
|
2
|
+
|
|
3
|
+
type CalloutVariant = "default" | "info" | "success" | "warning" | "destructive";
|
|
4
|
+
interface CalloutNodeAttrs {
|
|
5
|
+
/**
|
|
6
|
+
* Visual variant of the callout
|
|
7
|
+
* @default "info"
|
|
8
|
+
*/
|
|
9
|
+
variant: CalloutVariant;
|
|
10
|
+
/**
|
|
11
|
+
* Optional title for the callout
|
|
12
|
+
* @default null
|
|
13
|
+
*/
|
|
14
|
+
title: string | null;
|
|
15
|
+
}
|
|
16
|
+
interface CalloutOptions {
|
|
17
|
+
/**
|
|
18
|
+
* Custom HTML attributes for the Callout wrapper element.
|
|
19
|
+
*/
|
|
20
|
+
HTMLAttributes: Record<string, unknown>;
|
|
21
|
+
}
|
|
22
|
+
declare module "@tiptap/core" {
|
|
23
|
+
interface Commands<ReturnType> {
|
|
24
|
+
calloutNode: {
|
|
25
|
+
/**
|
|
26
|
+
* Insert a callout node
|
|
27
|
+
*/
|
|
28
|
+
insertCallout: (variant?: CalloutVariant) => ReturnType;
|
|
29
|
+
/**
|
|
30
|
+
* Update callout settings
|
|
31
|
+
*/
|
|
32
|
+
updateCalloutSettings: (attrs: Partial<CalloutNodeAttrs>) => ReturnType;
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Callout Node Extension
|
|
38
|
+
*
|
|
39
|
+
* Inserts a callout block with different variants (info, warning, success, error)
|
|
40
|
+
* Supports editable content inside the callout.
|
|
41
|
+
*/
|
|
42
|
+
declare const CalloutNode: Node<CalloutOptions, any>;
|
|
43
|
+
|
|
44
|
+
export { type CalloutNodeAttrs as CalloutAttrs, CalloutNode, type CalloutNodeAttrs, type CalloutOptions, type CalloutVariant, CalloutNode as default };
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { Node } from '@tiptap/core';
|
|
2
|
+
|
|
3
|
+
type CalloutVariant = "default" | "info" | "success" | "warning" | "destructive";
|
|
4
|
+
interface CalloutNodeAttrs {
|
|
5
|
+
/**
|
|
6
|
+
* Visual variant of the callout
|
|
7
|
+
* @default "info"
|
|
8
|
+
*/
|
|
9
|
+
variant: CalloutVariant;
|
|
10
|
+
/**
|
|
11
|
+
* Optional title for the callout
|
|
12
|
+
* @default null
|
|
13
|
+
*/
|
|
14
|
+
title: string | null;
|
|
15
|
+
}
|
|
16
|
+
interface CalloutOptions {
|
|
17
|
+
/**
|
|
18
|
+
* Custom HTML attributes for the Callout wrapper element.
|
|
19
|
+
*/
|
|
20
|
+
HTMLAttributes: Record<string, unknown>;
|
|
21
|
+
}
|
|
22
|
+
declare module "@tiptap/core" {
|
|
23
|
+
interface Commands<ReturnType> {
|
|
24
|
+
calloutNode: {
|
|
25
|
+
/**
|
|
26
|
+
* Insert a callout node
|
|
27
|
+
*/
|
|
28
|
+
insertCallout: (variant?: CalloutVariant) => ReturnType;
|
|
29
|
+
/**
|
|
30
|
+
* Update callout settings
|
|
31
|
+
*/
|
|
32
|
+
updateCalloutSettings: (attrs: Partial<CalloutNodeAttrs>) => ReturnType;
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Callout Node Extension
|
|
38
|
+
*
|
|
39
|
+
* Inserts a callout block with different variants (info, warning, success, error)
|
|
40
|
+
* Supports editable content inside the callout.
|
|
41
|
+
*/
|
|
42
|
+
declare const CalloutNode: Node<CalloutOptions, any>;
|
|
43
|
+
|
|
44
|
+
export { type CalloutNodeAttrs as CalloutAttrs, CalloutNode, type CalloutNodeAttrs, type CalloutOptions, type CalloutVariant, CalloutNode as default };
|