@kopexa/tiptap 17.2.0 → 17.2.2
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-E5NW3MJZ.mjs → chunk-3ZPLSXTZ.mjs} +3 -3
- package/dist/{chunk-7SRL3P4B.mjs → chunk-5QFCLKHL.mjs} +7 -7
- package/dist/{chunk-NEHW62L7.mjs → chunk-6552DQWB.mjs} +2 -2
- package/dist/{chunk-5GFFTVMZ.mjs → chunk-DSBJFMHK.mjs} +4 -28
- package/dist/chunk-EAAQE5ZV.mjs +283 -0
- package/dist/chunk-HTJ2RXOG.mjs +32 -0
- package/dist/{chunk-LMCQMSW2.mjs → chunk-KYLBKQ2E.mjs} +12 -154
- package/dist/chunk-N3JE67CS.mjs +81 -0
- package/dist/{chunk-UU6JK5HX.mjs → chunk-SSJMKQ5G.mjs} +33 -20
- package/dist/chunk-Z365KVQY.mjs +34 -0
- package/dist/extensions/image/image-view.d.mts +3 -3
- package/dist/extensions/image/image-view.d.ts +3 -3
- package/dist/extensions/image/image-view.js +13 -181
- package/dist/extensions/image/image-view.mjs +2 -2
- package/dist/extensions/image/index.d.mts +12 -49
- package/dist/extensions/image/index.d.ts +12 -49
- package/dist/extensions/image/index.js +18 -231
- package/dist/extensions/image/index.mjs +3 -3
- package/dist/extensions/image/messages.d.mts +2 -30
- package/dist/extensions/image/messages.d.ts +2 -30
- package/dist/extensions/image/messages.js +4 -32
- package/dist/extensions/image/messages.mjs +1 -1
- package/dist/extensions/image-upload/image-upload-view.d.mts +12 -0
- package/dist/extensions/image-upload/image-upload-view.d.ts +12 -0
- package/dist/extensions/image-upload/image-upload-view.js +338 -0
- package/dist/extensions/image-upload/image-upload-view.mjs +12 -0
- package/dist/extensions/image-upload/index.d.mts +46 -0
- package/dist/extensions/image-upload/index.d.ts +46 -0
- package/dist/extensions/image-upload/index.js +414 -0
- package/dist/extensions/image-upload/index.mjs +16 -0
- package/dist/extensions/image-upload/messages.d.mts +32 -0
- package/dist/extensions/image-upload/messages.d.ts +32 -0
- package/dist/extensions/image-upload/messages.js +61 -0
- package/dist/extensions/image-upload/messages.mjs +7 -0
- package/dist/extensions/math/index.mjs +1 -1
- package/dist/hooks/use-create-editor.js +562 -393
- package/dist/hooks/use-create-editor.mjs +13 -10
- package/dist/index.d.mts +4 -1
- package/dist/index.d.ts +4 -1
- package/dist/index.js +956 -785
- package/dist/index.mjs +39 -33
- package/dist/presets/basic/editor-header.mjs +14 -14
- package/dist/presets/basic/index.js +953 -784
- package/dist/presets/basic/index.mjs +32 -29
- package/dist/ui/slash-dropdown-menu/index.js +2 -2
- package/dist/ui/slash-dropdown-menu/index.mjs +4 -4
- package/dist/ui/slash-dropdown-menu/slash-dropdown-menu.js +2 -2
- package/dist/ui/slash-dropdown-menu/slash-dropdown-menu.mjs +2 -2
- package/dist/ui/slash-dropdown-menu/use-slash-dropdown-menu.js +2 -2
- package/dist/ui/slash-dropdown-menu/use-slash-dropdown-menu.mjs +1 -1
- package/package.json +25 -24
- package/dist/chunk-WAAH3NLG.mjs +0 -77
- package/dist/{chunk-QAE2D4KV.mjs → chunk-FDPXD6VC.mjs} +11 -11
|
@@ -26,7 +26,7 @@ __export(image_exports, {
|
|
|
26
26
|
imageMessages: () => messages
|
|
27
27
|
});
|
|
28
28
|
module.exports = __toCommonJS(image_exports);
|
|
29
|
-
var
|
|
29
|
+
var import_extension_image = require("@tiptap/extension-image");
|
|
30
30
|
var import_react4 = require("@tiptap/react");
|
|
31
31
|
|
|
32
32
|
// src/extensions/image/image-view.tsx
|
|
@@ -54,6 +54,10 @@ var messages = (0, import_react_intl.defineMessages)({
|
|
|
54
54
|
id: "editor.image.loading",
|
|
55
55
|
defaultMessage: "Loading image..."
|
|
56
56
|
},
|
|
57
|
+
uploading: {
|
|
58
|
+
id: "editor.image.uploading",
|
|
59
|
+
defaultMessage: "Uploading..."
|
|
60
|
+
},
|
|
57
61
|
error: {
|
|
58
62
|
id: "editor.image.error",
|
|
59
63
|
defaultMessage: "Failed to load image"
|
|
@@ -62,38 +66,6 @@ var messages = (0, import_react_intl.defineMessages)({
|
|
|
62
66
|
id: "editor.image.upload_error",
|
|
63
67
|
defaultMessage: "Failed to upload image"
|
|
64
68
|
},
|
|
65
|
-
uploading: {
|
|
66
|
-
id: "editor.image.uploading",
|
|
67
|
-
defaultMessage: "Uploading..."
|
|
68
|
-
},
|
|
69
|
-
upload_placeholder: {
|
|
70
|
-
id: "editor.image.upload_placeholder",
|
|
71
|
-
defaultMessage: "Click to upload or drag & drop"
|
|
72
|
-
},
|
|
73
|
-
upload_hint: {
|
|
74
|
-
id: "editor.image.upload_hint",
|
|
75
|
-
defaultMessage: "PNG, JPG, GIF, WebP, SVG"
|
|
76
|
-
},
|
|
77
|
-
alt_text: {
|
|
78
|
-
id: "editor.image.alt_text",
|
|
79
|
-
defaultMessage: "Alt text"
|
|
80
|
-
},
|
|
81
|
-
alt_placeholder: {
|
|
82
|
-
id: "editor.image.alt_placeholder",
|
|
83
|
-
defaultMessage: "Describe the image..."
|
|
84
|
-
},
|
|
85
|
-
files_not_supported: {
|
|
86
|
-
id: "editor.image.files_not_supported",
|
|
87
|
-
defaultMessage: "File upload is not configured"
|
|
88
|
-
},
|
|
89
|
-
file_too_large: {
|
|
90
|
-
id: "editor.image.file_too_large",
|
|
91
|
-
defaultMessage: "File is too large (max {maxSize})"
|
|
92
|
-
},
|
|
93
|
-
invalid_type: {
|
|
94
|
-
id: "editor.image.invalid_type",
|
|
95
|
-
defaultMessage: "Invalid file type"
|
|
96
|
-
},
|
|
97
69
|
retry: {
|
|
98
70
|
id: "editor.image.retry",
|
|
99
71
|
defaultMessage: "Retry"
|
|
@@ -110,7 +82,7 @@ function ImageNodeView({ editor, node, getPos }) {
|
|
|
110
82
|
var _a;
|
|
111
83
|
const intl = (0, import_react_intl2.useIntl)();
|
|
112
84
|
const fileHandler = useEditorFile();
|
|
113
|
-
const
|
|
85
|
+
const { src, alt, title, uploadState, uploadProgress } = node.attrs;
|
|
114
86
|
const isEditable = (0, import_react2.useEditorState)({
|
|
115
87
|
editor,
|
|
116
88
|
selector: ({ editor: e }) => {
|
|
@@ -118,7 +90,6 @@ function ImageNodeView({ editor, node, getPos }) {
|
|
|
118
90
|
return (_a2 = e == null ? void 0 : e.isEditable) != null ? _a2 : false;
|
|
119
91
|
}
|
|
120
92
|
});
|
|
121
|
-
const { src, alt, title, uploadState, uploadProgress } = attrs;
|
|
122
93
|
const [resolvedUrl, setResolvedUrl] = (0, import_react3.useState)(null);
|
|
123
94
|
const [resolveState, setResolveState] = (0, import_react3.useState)("idle");
|
|
124
95
|
const needsResolve = (_a = fileHandler == null ? void 0 : fileHandler.isReference(src)) != null ? _a : false;
|
|
@@ -130,7 +101,8 @@ function ImageNodeView({ editor, node, getPos }) {
|
|
|
130
101
|
return;
|
|
131
102
|
}
|
|
132
103
|
if (!fileHandler) {
|
|
133
|
-
|
|
104
|
+
setResolvedUrl(src);
|
|
105
|
+
setResolveState("resolved");
|
|
134
106
|
return;
|
|
135
107
|
}
|
|
136
108
|
setResolveState("loading");
|
|
@@ -156,156 +128,16 @@ function ImageNodeView({ editor, node, getPos }) {
|
|
|
156
128
|
to: pos + node.nodeSize
|
|
157
129
|
});
|
|
158
130
|
}, [editor, getPos, node.nodeSize]);
|
|
159
|
-
const fileInputRef = (0, import_react3.useRef)(null);
|
|
160
|
-
const handleFileSelect = (0, import_react3.useCallback)(
|
|
161
|
-
async (file) => {
|
|
162
|
-
if (!fileHandler) return;
|
|
163
|
-
const pos = getPos();
|
|
164
|
-
if (pos === void 0) return;
|
|
165
|
-
editor.view.dispatch(
|
|
166
|
-
editor.state.tr.setNodeMarkup(pos, void 0, {
|
|
167
|
-
...attrs,
|
|
168
|
-
uploadState: "uploading",
|
|
169
|
-
uploadProgress: 0
|
|
170
|
-
})
|
|
171
|
-
);
|
|
172
|
-
try {
|
|
173
|
-
const ref = await fileHandler.upload(file, (percent) => {
|
|
174
|
-
const currentPos = getPos();
|
|
175
|
-
if (currentPos === void 0) return;
|
|
176
|
-
editor.view.dispatch(
|
|
177
|
-
editor.state.tr.setNodeMarkup(currentPos, void 0, {
|
|
178
|
-
...attrs,
|
|
179
|
-
uploadState: "uploading",
|
|
180
|
-
uploadProgress: percent
|
|
181
|
-
})
|
|
182
|
-
);
|
|
183
|
-
});
|
|
184
|
-
const finalPos = getPos();
|
|
185
|
-
if (finalPos === void 0) return;
|
|
186
|
-
editor.view.dispatch(
|
|
187
|
-
editor.state.tr.setNodeMarkup(finalPos, void 0, {
|
|
188
|
-
src: ref,
|
|
189
|
-
uploadState: null,
|
|
190
|
-
uploadProgress: null
|
|
191
|
-
})
|
|
192
|
-
);
|
|
193
|
-
} catch {
|
|
194
|
-
const errorPos = getPos();
|
|
195
|
-
if (errorPos === void 0) return;
|
|
196
|
-
editor.view.dispatch(
|
|
197
|
-
editor.state.tr.setNodeMarkup(errorPos, void 0, {
|
|
198
|
-
...attrs,
|
|
199
|
-
uploadState: "error",
|
|
200
|
-
uploadProgress: null
|
|
201
|
-
})
|
|
202
|
-
);
|
|
203
|
-
}
|
|
204
|
-
},
|
|
205
|
-
[fileHandler, editor, getPos, attrs]
|
|
206
|
-
);
|
|
207
|
-
const handleInputChange = (0, import_react3.useCallback)(
|
|
208
|
-
(e) => {
|
|
209
|
-
var _a2;
|
|
210
|
-
const file = (_a2 = e.target.files) == null ? void 0 : _a2[0];
|
|
211
|
-
if (file) {
|
|
212
|
-
handleFileSelect(file);
|
|
213
|
-
}
|
|
214
|
-
},
|
|
215
|
-
[handleFileSelect]
|
|
216
|
-
);
|
|
217
|
-
const handleDrop = (0, import_react3.useCallback)(
|
|
218
|
-
(e) => {
|
|
219
|
-
e.preventDefault();
|
|
220
|
-
e.stopPropagation();
|
|
221
|
-
const file = e.dataTransfer.files[0];
|
|
222
|
-
if (file == null ? void 0 : file.type.startsWith("image/")) {
|
|
223
|
-
handleFileSelect(file);
|
|
224
|
-
}
|
|
225
|
-
},
|
|
226
|
-
[handleFileSelect]
|
|
227
|
-
);
|
|
228
|
-
const handleDragOver = (0, import_react3.useCallback)((e) => {
|
|
229
|
-
e.preventDefault();
|
|
230
|
-
e.stopPropagation();
|
|
231
|
-
}, []);
|
|
232
|
-
const styles = (0, import_react3.useMemo)(() => (0, import_theme.imagePlaceholder)({ size: "md" }), []);
|
|
233
131
|
const errorStyles = (0, import_react3.useMemo)(
|
|
234
132
|
() => (0, import_theme.imagePlaceholder)({ size: "md", variant: "error" }),
|
|
235
133
|
[]
|
|
236
134
|
);
|
|
237
|
-
const
|
|
135
|
+
const loadingStyles = (0, import_react3.useMemo)(
|
|
238
136
|
() => (0, import_theme.imagePlaceholder)({ size: "md", variant: "uploading" }),
|
|
239
137
|
[]
|
|
240
138
|
);
|
|
241
|
-
const disabledStyles = (0, import_react3.useMemo)(
|
|
242
|
-
() => (0, import_theme.imagePlaceholder)({ size: "md", variant: "disabled" }),
|
|
243
|
-
[]
|
|
244
|
-
);
|
|
245
|
-
const isEmpty = !src;
|
|
246
|
-
if (isEmpty && !uploadState) {
|
|
247
|
-
if (!fileHandler) {
|
|
248
|
-
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_react2.NodeViewWrapper, { className: "my-4", "data-type": "image", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: disabledStyles.root(), children: /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: disabledStyles.content(), children: [
|
|
249
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_icons.ImageIcon, { className: disabledStyles.icon() }),
|
|
250
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: disabledStyles.text(), children: intl.formatMessage(messages.files_not_supported) }),
|
|
251
|
-
isEditable && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
252
|
-
import_button.IconButton,
|
|
253
|
-
{
|
|
254
|
-
size: "sm",
|
|
255
|
-
variant: "ghost",
|
|
256
|
-
onClick: handleRemove,
|
|
257
|
-
"aria-label": intl.formatMessage(messages.remove),
|
|
258
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_icons.TrashIcon, { className: "size-4" })
|
|
259
|
-
}
|
|
260
|
-
)
|
|
261
|
-
] }) }) });
|
|
262
|
-
}
|
|
263
|
-
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_react2.NodeViewWrapper, { className: "my-4", "data-type": "image", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
264
|
-
"div",
|
|
265
|
-
{
|
|
266
|
-
className: styles.root(),
|
|
267
|
-
onClick: () => {
|
|
268
|
-
var _a2;
|
|
269
|
-
return (_a2 = fileInputRef.current) == null ? void 0 : _a2.click();
|
|
270
|
-
},
|
|
271
|
-
onDrop: handleDrop,
|
|
272
|
-
onDragOver: handleDragOver,
|
|
273
|
-
children: [
|
|
274
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: styles.content(), children: [
|
|
275
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_icons.UploadIcon, { className: styles.icon() }),
|
|
276
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: styles.text(), children: intl.formatMessage(messages.upload_placeholder) }),
|
|
277
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: styles.hint(), children: intl.formatMessage(messages.upload_hint) })
|
|
278
|
-
] }),
|
|
279
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
280
|
-
"input",
|
|
281
|
-
{
|
|
282
|
-
ref: fileInputRef,
|
|
283
|
-
type: "file",
|
|
284
|
-
accept: "image/*",
|
|
285
|
-
className: "hidden",
|
|
286
|
-
onChange: handleInputChange
|
|
287
|
-
}
|
|
288
|
-
),
|
|
289
|
-
isEditable && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
290
|
-
import_button.IconButton,
|
|
291
|
-
{
|
|
292
|
-
size: "sm",
|
|
293
|
-
variant: "ghost",
|
|
294
|
-
className: styles.removeButton(),
|
|
295
|
-
onClick: (e) => {
|
|
296
|
-
e.stopPropagation();
|
|
297
|
-
handleRemove();
|
|
298
|
-
},
|
|
299
|
-
"aria-label": intl.formatMessage(messages.remove),
|
|
300
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_icons.TrashIcon, { className: "size-3.5" })
|
|
301
|
-
}
|
|
302
|
-
)
|
|
303
|
-
]
|
|
304
|
-
}
|
|
305
|
-
) });
|
|
306
|
-
}
|
|
307
139
|
if (uploadState === "uploading") {
|
|
308
|
-
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_react2.NodeViewWrapper, { className: "my-4", "data-type": "image", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className:
|
|
140
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_react2.NodeViewWrapper, { className: "my-4", "data-type": "image", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: loadingStyles.root(), children: /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: loadingStyles.content(), children: [
|
|
309
141
|
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "relative size-12", children: [
|
|
310
142
|
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
311
143
|
"svg",
|
|
@@ -347,14 +179,14 @@ function ImageNodeView({ editor, node, getPos }) {
|
|
|
347
179
|
"%"
|
|
348
180
|
] })
|
|
349
181
|
] }),
|
|
350
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className:
|
|
182
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: loadingStyles.text(), children: intl.formatMessage(messages.uploading) })
|
|
351
183
|
] }) }) });
|
|
352
184
|
}
|
|
353
185
|
if (uploadState === "error") {
|
|
354
186
|
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_react2.NodeViewWrapper, { className: "my-4", "data-type": "image", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: errorStyles.root(), children: /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: errorStyles.content(), children: [
|
|
355
187
|
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_icons.AlertCircleIcon, { className: errorStyles.icon() }),
|
|
356
188
|
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: errorStyles.text(), children: intl.formatMessage(messages.upload_error) }),
|
|
357
|
-
isEditable && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
189
|
+
isEditable && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
358
190
|
import_button.IconButton,
|
|
359
191
|
{
|
|
360
192
|
size: "sm",
|
|
@@ -363,11 +195,11 @@ function ImageNodeView({ editor, node, getPos }) {
|
|
|
363
195
|
"aria-label": intl.formatMessage(messages.remove),
|
|
364
196
|
children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_icons.TrashIcon, { className: "size-4" })
|
|
365
197
|
}
|
|
366
|
-
)
|
|
198
|
+
)
|
|
367
199
|
] }) }) });
|
|
368
200
|
}
|
|
369
201
|
if (resolveState === "loading") {
|
|
370
|
-
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_react2.NodeViewWrapper, { className: "my-4", "data-type": "image", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: `${
|
|
202
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_react2.NodeViewWrapper, { className: "my-4", "data-type": "image", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: `${loadingStyles.root()} animate-pulse`, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: loadingStyles.text(), children: intl.formatMessage(messages.loading) }) }) });
|
|
371
203
|
}
|
|
372
204
|
if (resolveState === "error") {
|
|
373
205
|
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_react2.NodeViewWrapper, { className: "my-4", "data-type": "image", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: errorStyles.root(), children: /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: errorStyles.content(), children: [
|
|
@@ -422,34 +254,12 @@ function ImageNodeView({ editor, node, getPos }) {
|
|
|
422
254
|
}
|
|
423
255
|
|
|
424
256
|
// src/extensions/image/index.ts
|
|
425
|
-
var ImageNode =
|
|
426
|
-
name: "image",
|
|
427
|
-
group: "block",
|
|
428
|
-
atom: true,
|
|
429
|
-
draggable: true,
|
|
430
|
-
addOptions() {
|
|
431
|
-
return {
|
|
432
|
-
allowBase64: true,
|
|
433
|
-
HTMLAttributes: {}
|
|
434
|
-
};
|
|
435
|
-
},
|
|
257
|
+
var ImageNode = import_extension_image.Image.extend({
|
|
436
258
|
addAttributes() {
|
|
259
|
+
var _a;
|
|
437
260
|
return {
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
},
|
|
441
|
-
alt: {
|
|
442
|
-
default: null
|
|
443
|
-
},
|
|
444
|
-
title: {
|
|
445
|
-
default: null
|
|
446
|
-
},
|
|
447
|
-
width: {
|
|
448
|
-
default: null
|
|
449
|
-
},
|
|
450
|
-
height: {
|
|
451
|
-
default: null
|
|
452
|
-
},
|
|
261
|
+
...(_a = this.parent) == null ? void 0 : _a.call(this),
|
|
262
|
+
// Upload state for drag & drop / paste uploads
|
|
453
263
|
uploadState: {
|
|
454
264
|
default: null,
|
|
455
265
|
rendered: false
|
|
@@ -460,31 +270,8 @@ var ImageNode = import_core.Node.create({
|
|
|
460
270
|
}
|
|
461
271
|
};
|
|
462
272
|
},
|
|
463
|
-
parseHTML() {
|
|
464
|
-
return [
|
|
465
|
-
{
|
|
466
|
-
tag: "img[src]"
|
|
467
|
-
}
|
|
468
|
-
];
|
|
469
|
-
},
|
|
470
|
-
renderHTML({ HTMLAttributes }) {
|
|
471
|
-
return [
|
|
472
|
-
"img",
|
|
473
|
-
(0, import_core.mergeAttributes)(this.options.HTMLAttributes, HTMLAttributes)
|
|
474
|
-
];
|
|
475
|
-
},
|
|
476
273
|
addNodeView() {
|
|
477
274
|
return (0, import_react4.ReactNodeViewRenderer)(ImageNodeView);
|
|
478
|
-
},
|
|
479
|
-
addCommands() {
|
|
480
|
-
return {
|
|
481
|
-
setImage: (options) => ({ commands }) => {
|
|
482
|
-
return commands.insertContent({
|
|
483
|
-
type: this.name,
|
|
484
|
-
attrs: options
|
|
485
|
-
});
|
|
486
|
-
}
|
|
487
|
-
};
|
|
488
275
|
}
|
|
489
276
|
});
|
|
490
277
|
// Annotate the CommonJS export names for ESM import in node:
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import {
|
|
3
3
|
ImageNode
|
|
4
|
-
} from "../../chunk-
|
|
4
|
+
} from "../../chunk-HTJ2RXOG.mjs";
|
|
5
5
|
import {
|
|
6
6
|
ImageNodeView
|
|
7
|
-
} from "../../chunk-
|
|
7
|
+
} from "../../chunk-KYLBKQ2E.mjs";
|
|
8
8
|
import {
|
|
9
9
|
messages
|
|
10
|
-
} from "../../chunk-
|
|
10
|
+
} from "../../chunk-Z365KVQY.mjs";
|
|
11
11
|
import "../../chunk-VRQ6OSAZ.mjs";
|
|
12
12
|
export {
|
|
13
13
|
ImageNode,
|
|
@@ -3,43 +3,15 @@ declare const messages: {
|
|
|
3
3
|
id: string;
|
|
4
4
|
defaultMessage: string;
|
|
5
5
|
};
|
|
6
|
-
error: {
|
|
7
|
-
id: string;
|
|
8
|
-
defaultMessage: string;
|
|
9
|
-
};
|
|
10
|
-
upload_error: {
|
|
11
|
-
id: string;
|
|
12
|
-
defaultMessage: string;
|
|
13
|
-
};
|
|
14
6
|
uploading: {
|
|
15
7
|
id: string;
|
|
16
8
|
defaultMessage: string;
|
|
17
9
|
};
|
|
18
|
-
|
|
19
|
-
id: string;
|
|
20
|
-
defaultMessage: string;
|
|
21
|
-
};
|
|
22
|
-
upload_hint: {
|
|
23
|
-
id: string;
|
|
24
|
-
defaultMessage: string;
|
|
25
|
-
};
|
|
26
|
-
alt_text: {
|
|
27
|
-
id: string;
|
|
28
|
-
defaultMessage: string;
|
|
29
|
-
};
|
|
30
|
-
alt_placeholder: {
|
|
31
|
-
id: string;
|
|
32
|
-
defaultMessage: string;
|
|
33
|
-
};
|
|
34
|
-
files_not_supported: {
|
|
35
|
-
id: string;
|
|
36
|
-
defaultMessage: string;
|
|
37
|
-
};
|
|
38
|
-
file_too_large: {
|
|
10
|
+
error: {
|
|
39
11
|
id: string;
|
|
40
12
|
defaultMessage: string;
|
|
41
13
|
};
|
|
42
|
-
|
|
14
|
+
upload_error: {
|
|
43
15
|
id: string;
|
|
44
16
|
defaultMessage: string;
|
|
45
17
|
};
|
|
@@ -3,43 +3,15 @@ declare const messages: {
|
|
|
3
3
|
id: string;
|
|
4
4
|
defaultMessage: string;
|
|
5
5
|
};
|
|
6
|
-
error: {
|
|
7
|
-
id: string;
|
|
8
|
-
defaultMessage: string;
|
|
9
|
-
};
|
|
10
|
-
upload_error: {
|
|
11
|
-
id: string;
|
|
12
|
-
defaultMessage: string;
|
|
13
|
-
};
|
|
14
6
|
uploading: {
|
|
15
7
|
id: string;
|
|
16
8
|
defaultMessage: string;
|
|
17
9
|
};
|
|
18
|
-
|
|
19
|
-
id: string;
|
|
20
|
-
defaultMessage: string;
|
|
21
|
-
};
|
|
22
|
-
upload_hint: {
|
|
23
|
-
id: string;
|
|
24
|
-
defaultMessage: string;
|
|
25
|
-
};
|
|
26
|
-
alt_text: {
|
|
27
|
-
id: string;
|
|
28
|
-
defaultMessage: string;
|
|
29
|
-
};
|
|
30
|
-
alt_placeholder: {
|
|
31
|
-
id: string;
|
|
32
|
-
defaultMessage: string;
|
|
33
|
-
};
|
|
34
|
-
files_not_supported: {
|
|
35
|
-
id: string;
|
|
36
|
-
defaultMessage: string;
|
|
37
|
-
};
|
|
38
|
-
file_too_large: {
|
|
10
|
+
error: {
|
|
39
11
|
id: string;
|
|
40
12
|
defaultMessage: string;
|
|
41
13
|
};
|
|
42
|
-
|
|
14
|
+
upload_error: {
|
|
43
15
|
id: string;
|
|
44
16
|
defaultMessage: string;
|
|
45
17
|
};
|
|
@@ -30,6 +30,10 @@ var messages = (0, import_react_intl.defineMessages)({
|
|
|
30
30
|
id: "editor.image.loading",
|
|
31
31
|
defaultMessage: "Loading image..."
|
|
32
32
|
},
|
|
33
|
+
uploading: {
|
|
34
|
+
id: "editor.image.uploading",
|
|
35
|
+
defaultMessage: "Uploading..."
|
|
36
|
+
},
|
|
33
37
|
error: {
|
|
34
38
|
id: "editor.image.error",
|
|
35
39
|
defaultMessage: "Failed to load image"
|
|
@@ -38,38 +42,6 @@ var messages = (0, import_react_intl.defineMessages)({
|
|
|
38
42
|
id: "editor.image.upload_error",
|
|
39
43
|
defaultMessage: "Failed to upload image"
|
|
40
44
|
},
|
|
41
|
-
uploading: {
|
|
42
|
-
id: "editor.image.uploading",
|
|
43
|
-
defaultMessage: "Uploading..."
|
|
44
|
-
},
|
|
45
|
-
upload_placeholder: {
|
|
46
|
-
id: "editor.image.upload_placeholder",
|
|
47
|
-
defaultMessage: "Click to upload or drag & drop"
|
|
48
|
-
},
|
|
49
|
-
upload_hint: {
|
|
50
|
-
id: "editor.image.upload_hint",
|
|
51
|
-
defaultMessage: "PNG, JPG, GIF, WebP, SVG"
|
|
52
|
-
},
|
|
53
|
-
alt_text: {
|
|
54
|
-
id: "editor.image.alt_text",
|
|
55
|
-
defaultMessage: "Alt text"
|
|
56
|
-
},
|
|
57
|
-
alt_placeholder: {
|
|
58
|
-
id: "editor.image.alt_placeholder",
|
|
59
|
-
defaultMessage: "Describe the image..."
|
|
60
|
-
},
|
|
61
|
-
files_not_supported: {
|
|
62
|
-
id: "editor.image.files_not_supported",
|
|
63
|
-
defaultMessage: "File upload is not configured"
|
|
64
|
-
},
|
|
65
|
-
file_too_large: {
|
|
66
|
-
id: "editor.image.file_too_large",
|
|
67
|
-
defaultMessage: "File is too large (max {maxSize})"
|
|
68
|
-
},
|
|
69
|
-
invalid_type: {
|
|
70
|
-
id: "editor.image.invalid_type",
|
|
71
|
-
defaultMessage: "Invalid file type"
|
|
72
|
-
},
|
|
73
45
|
retry: {
|
|
74
46
|
id: "editor.image.retry",
|
|
75
47
|
defaultMessage: "Retry"
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { NodeViewProps } from '@tiptap/react';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* ImageUploadNodeView - Upload placeholder component
|
|
6
|
+
*
|
|
7
|
+
* Shows a dropzone/file picker UI. After successful upload,
|
|
8
|
+
* replaces itself with a standard `image` node.
|
|
9
|
+
*/
|
|
10
|
+
declare function ImageUploadNodeView({ editor, node, getPos }: NodeViewProps): react_jsx_runtime.JSX.Element;
|
|
11
|
+
|
|
12
|
+
export { ImageUploadNodeView, ImageUploadNodeView as default };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { NodeViewProps } from '@tiptap/react';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* ImageUploadNodeView - Upload placeholder component
|
|
6
|
+
*
|
|
7
|
+
* Shows a dropzone/file picker UI. After successful upload,
|
|
8
|
+
* replaces itself with a standard `image` node.
|
|
9
|
+
*/
|
|
10
|
+
declare function ImageUploadNodeView({ editor, node, getPos }: NodeViewProps): react_jsx_runtime.JSX.Element;
|
|
11
|
+
|
|
12
|
+
export { ImageUploadNodeView, ImageUploadNodeView as default };
|