@pie-lib/editable-html-tip-tap 3.1.2-next.20261019093941 → 3.1.2-next.20261019151920
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/components/EditableHtml.js +116 -127
- package/dist/components/icons/RespArea.js +2 -2
- package/dist/components/icons/TextAlign.js +1 -3
- package/dist/components/media/MediaDialog.js +8 -24
- package/dist/components/respArea/DragInTheBlank/choice.js +1 -7
- package/dist/components/respArea/InlineDropdown.js +1 -1
- package/dist/extensions/css.js +17 -17
- package/dist/extensions/ensure-empty-root-div.js +2 -1
- package/dist/extensions/ensure-list-item-content-is-div.js +2 -1
- package/dist/extensions/image.js +2 -6
- package/dist/extensions/math.js +3 -2
- package/dist/extensions/responseArea.js +2 -2
- package/dist/extensions/table-semantics.js +1 -5
- package/dist/external-paste.js +5 -12
- package/dist/node_modules/.bun/clsx@2.1.1/node_modules/clsx/dist/clsx.js +6 -4
- package/package.json +8 -8
|
@@ -3,25 +3,25 @@ import { normalizeInitialMarkup as t } from "../utils/helper.js";
|
|
|
3
3
|
import { setPendingSaveFlush as n } from "../pending-save.js";
|
|
4
4
|
import r from "../extensions/extended-table.js";
|
|
5
5
|
import { ExtendedTableCell as i, ExtendedTableHeader as a } from "../extensions/extended-table-cell.js";
|
|
6
|
-
import { DivNode as
|
|
7
|
-
import { EnsureEmptyRootIsDiv as
|
|
8
|
-
import { EnsureListItemContentIsDiv as
|
|
9
|
-
import { DragInTheBlankNode as
|
|
10
|
-
import { MathNode as
|
|
11
|
-
import { ImageUploadNode as
|
|
12
|
-
import { Media as
|
|
13
|
-
import { CSSMark as
|
|
14
|
-
import { ExtendedListItem as
|
|
15
|
-
import { HeadingParagraph as
|
|
16
|
-
import { valueToSize as
|
|
17
|
-
import
|
|
18
|
-
import { PLUGINS_MAP as
|
|
19
|
-
import { useCallback as
|
|
20
|
-
import { debounce as
|
|
21
|
-
import { EditorContent as
|
|
22
|
-
import { styled as
|
|
23
|
-
import
|
|
24
|
-
import { TextStyleKit as
|
|
6
|
+
import { DivNode as o } from "../extensions/div-node.js";
|
|
7
|
+
import { EnsureEmptyRootIsDiv as ee } from "../extensions/ensure-empty-root-div.js";
|
|
8
|
+
import { EnsureListItemContentIsDiv as s } from "../extensions/ensure-list-item-content-is-div.js";
|
|
9
|
+
import { DragInTheBlankNode as c, ExplicitConstructedResponseNode as te, InlineDropdownNode as l, MathTemplatedNode as ne, ResponseAreaExtension as re } from "../extensions/responseArea.js";
|
|
10
|
+
import { MathNode as ie } from "../extensions/math.js";
|
|
11
|
+
import { ImageUploadNode as ae, uploadPastedImage as oe } from "../extensions/image.js";
|
|
12
|
+
import { Media as se } from "../extensions/media.js";
|
|
13
|
+
import { CSSMark as u } from "../extensions/css.js";
|
|
14
|
+
import { ExtendedListItem as ce } from "../extensions/extended-list-item.js";
|
|
15
|
+
import { HeadingParagraph as le } from "../extensions/heading-paragraph.js";
|
|
16
|
+
import { valueToSize as d } from "../utils/size.js";
|
|
17
|
+
import ue from "./TiptapContainer.js";
|
|
18
|
+
import { PLUGINS_MAP as de, buildExtensions as f } from "../extensions/index.js";
|
|
19
|
+
import { useCallback as p, useEffect as m, useMemo as h, useRef as g, useState as _ } from "react";
|
|
20
|
+
import { debounce as v } from "@pie-element/shared-lodash";
|
|
21
|
+
import { EditorContent as y, useEditor as fe, useEditorState as pe } from "@tiptap/react";
|
|
22
|
+
import { styled as b } from "@mui/material/styles";
|
|
23
|
+
import me from "@tiptap/starter-kit";
|
|
24
|
+
import { TextStyleKit as he } from "@tiptap/extension-text-style";
|
|
25
25
|
import { CharacterCount as ge } from "@tiptap/extension-character-count";
|
|
26
26
|
import _e from "@tiptap/extension-superscript";
|
|
27
27
|
import ve from "@tiptap/extension-subscript";
|
|
@@ -102,40 +102,34 @@ var C = {
|
|
|
102
102
|
autocapitalize: e ? "on" : "off",
|
|
103
103
|
...t && { "aria-label": t },
|
|
104
104
|
...n && { "aria-labelledby": n }
|
|
105
|
-
}), k = ["aria-label", "aria-labelledby"], A =
|
|
106
|
-
let { showParagraphs:
|
|
105
|
+
}), k = ["aria-label", "aria-labelledby"], A = (e) => e._insertingImage || e._toolbarOpened || e.isActive("inline_dropdown") || e.isActive("explicit_constructed_response"), j = (y) => {
|
|
106
|
+
let { showParagraphs: b, separateParagraphs: j } = y.pluginProps || {}, [Se, N] = _([]), [Ce, we] = _(!1), { toolbarOpts: Te } = y, P = p((e) => {
|
|
107
107
|
N((t) => {
|
|
108
108
|
let n = t.filter((t) => t.pos !== e);
|
|
109
|
-
return n.length === 0 &&
|
|
109
|
+
return n.length === 0 && we(!1), n;
|
|
110
110
|
});
|
|
111
111
|
}, [N]), F = {
|
|
112
112
|
...C,
|
|
113
|
-
...
|
|
114
|
-
}, I =
|
|
115
|
-
I.current = [...I.current.slice(
|
|
116
|
-
}, R =
|
|
113
|
+
...Te
|
|
114
|
+
}, I = g([]), L = (e) => {
|
|
115
|
+
I.current = [...I.current.slice(-4), e], y.onChange?.(e);
|
|
116
|
+
}, R = g(L);
|
|
117
117
|
R.current = L;
|
|
118
|
-
let z =
|
|
118
|
+
let z = p((e) => {
|
|
119
119
|
let t = e.getHTML();
|
|
120
|
-
|
|
120
|
+
y.markup !== t && R.current(t), F.doneOn === "blur" && y.onDone?.(t);
|
|
121
121
|
}, [
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
122
|
+
y.markup,
|
|
123
|
+
y.onChange,
|
|
124
|
+
y.onDone,
|
|
125
125
|
F.doneOn
|
|
126
|
-
]), B =
|
|
126
|
+
]), B = g(z);
|
|
127
127
|
B.current = z;
|
|
128
|
-
let { idleSaveDelay: V } =
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
W.current?.(e);
|
|
132
|
-
return;
|
|
133
|
-
}
|
|
134
|
-
B.current(e);
|
|
135
|
-
}
|
|
136
|
-
}, V) : null, [V]), W = m(U);
|
|
128
|
+
let { idleSaveDelay: V } = y, H = g(!1), U = h(() => V > 0 ? v((e) => {
|
|
129
|
+
e.isDestroyed || (!H.current && (e.view.composing || A(e)) ? W.current?.(e) : B.current(e));
|
|
130
|
+
}, V) : null, [V]), W = g(U);
|
|
137
131
|
W.current = U;
|
|
138
|
-
let G =
|
|
132
|
+
let G = p((e) => {
|
|
139
133
|
H.current = !0;
|
|
140
134
|
try {
|
|
141
135
|
e?.flush();
|
|
@@ -143,38 +137,38 @@ var C = {
|
|
|
143
137
|
H.current = !1;
|
|
144
138
|
}
|
|
145
139
|
}, []);
|
|
146
|
-
|
|
147
|
-
let
|
|
140
|
+
m(() => () => G(U), [U, G]);
|
|
141
|
+
let Ee = p(() => G(W.current), [G]), K = h(() => ({
|
|
148
142
|
...w,
|
|
149
|
-
...
|
|
143
|
+
...y.responseAreaProps,
|
|
150
144
|
onInlineDropdownToolbarClose: z
|
|
151
|
-
}), [
|
|
152
|
-
let { customPlugins: e, ...t } =
|
|
145
|
+
}), [y.responseAreaProps, z]), q = h(() => {
|
|
146
|
+
let { customPlugins: e, ...t } = y.pluginProps || {};
|
|
153
147
|
e ||= [];
|
|
154
|
-
let n = (
|
|
155
|
-
let n =
|
|
148
|
+
let n = (y.activePlugins || T)?.filter((e) => {
|
|
149
|
+
let n = de[e] || e, r = t[n] || {};
|
|
156
150
|
return !r || !r.disabled;
|
|
157
151
|
});
|
|
158
|
-
return
|
|
152
|
+
return f(n, e, {
|
|
159
153
|
math: {},
|
|
160
|
-
textAlign:
|
|
154
|
+
textAlign: y.textAlign,
|
|
161
155
|
html: {},
|
|
162
|
-
extraCSSRules:
|
|
163
|
-
image: { ...
|
|
156
|
+
extraCSSRules: y.extraCSSRules || {},
|
|
157
|
+
image: { ...y.imageSupport },
|
|
164
158
|
toolbar: {},
|
|
165
159
|
table: {},
|
|
166
160
|
responseArea: { type: K.type },
|
|
167
|
-
languageCharacters:
|
|
161
|
+
languageCharacters: y.languageCharactersProps,
|
|
168
162
|
keyPadCharacterRef: {},
|
|
169
163
|
setKeypadInteraction: {},
|
|
170
164
|
media: {}
|
|
171
165
|
});
|
|
172
|
-
}, [
|
|
166
|
+
}, [y, K.type]), J = g(null);
|
|
173
167
|
J.current = {
|
|
174
|
-
plainText:
|
|
168
|
+
plainText: y.pluginProps?.pasteFormatting?.disabled === !0,
|
|
175
169
|
formatting: q.map((e) => E[e]).filter(Boolean)
|
|
176
170
|
};
|
|
177
|
-
let
|
|
171
|
+
let De = [
|
|
178
172
|
ye.configure({
|
|
179
173
|
types: [
|
|
180
174
|
"heading",
|
|
@@ -197,13 +191,13 @@ var C = {
|
|
|
197
191
|
"justify"
|
|
198
192
|
]
|
|
199
193
|
}),
|
|
200
|
-
|
|
194
|
+
he,
|
|
201
195
|
e.configure({
|
|
202
196
|
settings: () => J.current,
|
|
203
|
-
uploadImage:
|
|
197
|
+
uploadImage: y.imageSupport && oe
|
|
204
198
|
}),
|
|
205
|
-
ge.configure({ limit:
|
|
206
|
-
|
|
199
|
+
ge.configure({ limit: y.charactersLimit || 1e6 }),
|
|
200
|
+
me.configure({
|
|
207
201
|
trailingNode: {
|
|
208
202
|
node: "paragraph",
|
|
209
203
|
notAfter: ["paragraph", "div"]
|
|
@@ -213,13 +207,13 @@ var C = {
|
|
|
213
207
|
linkOnPaste: !1
|
|
214
208
|
}
|
|
215
209
|
}),
|
|
216
|
-
|
|
210
|
+
ce,
|
|
211
|
+
o,
|
|
212
|
+
le,
|
|
217
213
|
ee,
|
|
218
|
-
|
|
219
|
-
te,
|
|
220
|
-
ne,
|
|
214
|
+
s,
|
|
221
215
|
xe.configure({
|
|
222
|
-
placeholder:
|
|
216
|
+
placeholder: y.placeholder,
|
|
223
217
|
showOnlyWhenEditable: !0,
|
|
224
218
|
showOnlyCurrent: !1,
|
|
225
219
|
includeChildren: !0
|
|
@@ -228,78 +222,73 @@ var C = {
|
|
|
228
222
|
x,
|
|
229
223
|
a,
|
|
230
224
|
i,
|
|
231
|
-
se.configure(K),
|
|
232
|
-
ie.configure(K),
|
|
233
225
|
re.configure(K),
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
226
|
+
te.configure(K),
|
|
227
|
+
c.configure(K),
|
|
228
|
+
l.configure(K),
|
|
229
|
+
ne.configure(K),
|
|
230
|
+
ie.configure({
|
|
237
231
|
toolbarOpts: F,
|
|
238
|
-
math:
|
|
232
|
+
math: y.pluginProps?.math || {}
|
|
239
233
|
}),
|
|
240
234
|
ve,
|
|
241
235
|
_e,
|
|
242
236
|
be,
|
|
243
|
-
|
|
237
|
+
ae.configure({
|
|
244
238
|
toolbarOpts: F,
|
|
245
239
|
imageHandling: {
|
|
246
|
-
disableImageAlignmentButtons:
|
|
247
|
-
onDone: (e) =>
|
|
248
|
-
onDelete:
|
|
240
|
+
disableImageAlignmentButtons: y.disableImageAlignmentButtons,
|
|
241
|
+
onDone: (e) => y.onDone?.(e.getHTML()),
|
|
242
|
+
onDelete: y.imageSupport && y.imageSupport.delete && ((e) => {
|
|
249
243
|
let { src: t } = e.attrs;
|
|
250
|
-
|
|
244
|
+
y.imageSupport.delete(t, (t) => {
|
|
251
245
|
P(e.pos);
|
|
252
246
|
});
|
|
253
247
|
}),
|
|
254
|
-
insertImageRequested:
|
|
248
|
+
insertImageRequested: y.imageSupport && ((e, t, n) => {
|
|
255
249
|
let [r, i] = t, a = (t) => {
|
|
256
250
|
let n;
|
|
257
|
-
|
|
251
|
+
Ce && t && (n = R.current), P(i), n?.(e.getHTML());
|
|
258
252
|
};
|
|
259
253
|
e._insertingImage = !0, N((e) => [...e, r]), (() => {
|
|
260
|
-
let t = n(a), r =
|
|
261
|
-
|
|
262
|
-
if (!e._insertingImage) {
|
|
263
|
-
t();
|
|
264
|
-
return;
|
|
265
|
-
}
|
|
266
|
-
P(i), e._insertingImage = !1, t();
|
|
254
|
+
let t = n(a), r = v(() => {
|
|
255
|
+
e._insertingImage &&= (P(i), !1), window.removeEventListener("focus", r);
|
|
267
256
|
}, 500);
|
|
268
|
-
window.addEventListener("focus", r),
|
|
257
|
+
window.addEventListener("focus", r), y.imageSupport.add(t);
|
|
269
258
|
})();
|
|
270
259
|
}),
|
|
271
|
-
maxImageWidth:
|
|
272
|
-
maxImageHeight:
|
|
260
|
+
maxImageWidth: y.maxImageWidth,
|
|
261
|
+
maxImageHeight: y.maxImageHeight
|
|
273
262
|
},
|
|
274
263
|
limit: 3
|
|
275
264
|
}),
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
], Y =
|
|
279
|
-
extensions:
|
|
265
|
+
se.configure({ uploadSoundSupport: y.uploadSoundSupport }),
|
|
266
|
+
u.configure({ extraCSSRules: y.extraCSSRules })
|
|
267
|
+
], Y = y.spellCheck !== !1, { ariaLabel: X, ariaLabelledBy: Z } = y, Q = fe({
|
|
268
|
+
extensions: De,
|
|
280
269
|
immediatelyRender: !1,
|
|
281
270
|
editorProps: {
|
|
282
271
|
attributes: O(Y, X, Z),
|
|
283
272
|
handleKeyDown(e, t) {
|
|
284
|
-
return
|
|
273
|
+
return y.onKeyDown ? y.onKeyDown(t) : !1;
|
|
285
274
|
}
|
|
286
275
|
},
|
|
287
|
-
editable: !
|
|
288
|
-
content: t(
|
|
276
|
+
editable: !y.disabled,
|
|
277
|
+
content: t(y.markup),
|
|
289
278
|
onUpdate: ({ editor: e, transaction: t }) => {
|
|
290
|
-
t.isDone && R.current(e.getHTML()), t.docChanged && W.current && (W.current(e), n(e.view.dom,
|
|
279
|
+
t.isDone && R.current(e.getHTML()), t.docChanged && W.current && (W.current(e), n(e.view.dom, Ee));
|
|
291
280
|
},
|
|
292
281
|
onBlur: ({ editor: e }) => {
|
|
293
|
-
|
|
282
|
+
!A(e) && e.schema && (W.current?.cancel(), z(e));
|
|
294
283
|
}
|
|
295
|
-
}, [
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
}, [
|
|
299
|
-
Q?.setEditable(!
|
|
300
|
-
}, [
|
|
284
|
+
}, [y.charactersLimit]);
|
|
285
|
+
m(() => {
|
|
286
|
+
y.editorRef && y.editorRef(Q);
|
|
287
|
+
}, [y.editorRef, Q]), m(() => {
|
|
288
|
+
Q?.setEditable(!y.disabled);
|
|
289
|
+
}, [y.disabled, Q]), m(() => {
|
|
301
290
|
Q?.on("destroy", () => G(W.current));
|
|
302
|
-
}, [Q, G]),
|
|
291
|
+
}, [Q, G]), m(() => {
|
|
303
292
|
if (!Q) return;
|
|
304
293
|
let e = Q.options?.editorProps, t = e?.attributes || {}, n = O(Y, X, Z);
|
|
305
294
|
if (["spellcheck", ...k].every((e) => t[e] === n[e])) return;
|
|
@@ -316,48 +305,48 @@ var C = {
|
|
|
316
305
|
X,
|
|
317
306
|
Z,
|
|
318
307
|
Q
|
|
319
|
-
]),
|
|
320
|
-
if (!Q || I.current.includes(
|
|
308
|
+
]), m(() => {
|
|
309
|
+
if (!Q || I.current.includes(y.markup)) return;
|
|
321
310
|
I.current = [];
|
|
322
|
-
let e = t(
|
|
311
|
+
let e = t(y.markup);
|
|
323
312
|
e !== Q.getHTML() && Q.commands.setContent(e, { emitUpdate: !1 });
|
|
324
|
-
}, [
|
|
313
|
+
}, [y.markup, Q]), m(() => {
|
|
325
314
|
Object.entries(D).forEach(([e, t]) => {
|
|
326
315
|
document.documentElement.style.setProperty(e, t);
|
|
327
316
|
});
|
|
328
317
|
}, []);
|
|
329
|
-
let
|
|
318
|
+
let Oe = pe({
|
|
330
319
|
editor: Q,
|
|
331
320
|
selector: (e) => ({ isFocused: e.editor?.isFocused })
|
|
332
|
-
}), $ =
|
|
333
|
-
let { minWidth: e, width: t, maxWidth: n, minHeight: r, height: i, maxHeight: a } =
|
|
321
|
+
}), $ = h(() => {
|
|
322
|
+
let { minWidth: e, width: t, maxWidth: n, minHeight: r, height: i, maxHeight: a } = y;
|
|
334
323
|
return {
|
|
335
|
-
width:
|
|
336
|
-
minWidth:
|
|
337
|
-
maxWidth:
|
|
338
|
-
height:
|
|
339
|
-
minHeight:
|
|
340
|
-
maxHeight:
|
|
324
|
+
width: d(t),
|
|
325
|
+
minWidth: d(e),
|
|
326
|
+
maxWidth: d(n),
|
|
327
|
+
height: d(i),
|
|
328
|
+
minHeight: d(r),
|
|
329
|
+
maxHeight: d(a)
|
|
341
330
|
};
|
|
342
|
-
}, [
|
|
343
|
-
return /* @__PURE__ */ S(
|
|
344
|
-
...
|
|
331
|
+
}, [y]);
|
|
332
|
+
return /* @__PURE__ */ S(ue, {
|
|
333
|
+
...y,
|
|
345
334
|
activePlugins: q,
|
|
346
335
|
toolbarOpts: F,
|
|
347
|
-
editorState:
|
|
336
|
+
editorState: Oe,
|
|
348
337
|
editor: Q,
|
|
349
|
-
children: Q && /* @__PURE__ */ S(
|
|
338
|
+
children: Q && /* @__PURE__ */ S(M, {
|
|
350
339
|
style: {
|
|
351
340
|
minHeight: $.minHeight,
|
|
352
341
|
height: $.height,
|
|
353
342
|
maxHeight: $.maxHeight
|
|
354
343
|
},
|
|
355
|
-
showParagraph:
|
|
356
|
-
separateParagraph:
|
|
344
|
+
showParagraph: b && !b.disabled,
|
|
345
|
+
separateParagraph: j && !j.disabled,
|
|
357
346
|
editor: Q
|
|
358
347
|
})
|
|
359
348
|
});
|
|
360
|
-
},
|
|
349
|
+
}, M = b(y, { shouldForwardProp: (e) => !["showParagraph", "separateParagraph"].includes(e) })(({ showParagraph: e, separateParagraph: t }) => ({
|
|
361
350
|
display: "flex",
|
|
362
351
|
outline: "none !important",
|
|
363
352
|
"& .ProseMirror": {
|
|
@@ -387,4 +376,4 @@ var C = {
|
|
|
387
376
|
}
|
|
388
377
|
}));
|
|
389
378
|
//#endregion
|
|
390
|
-
export {
|
|
379
|
+
export { j as EditableHtml, j as default };
|
|
@@ -13,9 +13,9 @@ var o = (e) => {
|
|
|
13
13
|
default: return 0;
|
|
14
14
|
}
|
|
15
15
|
}, s = (e) => {
|
|
16
|
-
let { direction: t, style: r } = e;
|
|
16
|
+
let { direction: t, style: r } = e, a = o(t);
|
|
17
17
|
return /* @__PURE__ */ n(i, { style: {
|
|
18
|
-
transform: `rotate(${
|
|
18
|
+
transform: `rotate(${a}deg)`,
|
|
19
19
|
...r
|
|
20
20
|
} });
|
|
21
21
|
};
|
|
@@ -64,9 +64,7 @@ var o = () => /* @__PURE__ */ t("svg", {
|
|
|
64
64
|
case u.isActive({ textAlign: "justify" }):
|
|
65
65
|
m = /* @__PURE__ */ t(l, {});
|
|
66
66
|
break;
|
|
67
|
-
default:
|
|
68
|
-
m = /* @__PURE__ */ t(o, {});
|
|
69
|
-
break;
|
|
67
|
+
default: m = /* @__PURE__ */ t(o, {});
|
|
70
68
|
}
|
|
71
69
|
let h = (e) => {
|
|
72
70
|
let t = e.currentTarget?.getAttribute("value");
|
|
@@ -154,14 +154,7 @@ var y = c("@pie-lib:editable-html:plugins:media:dialog"), b = (e) => {
|
|
|
154
154
|
};
|
|
155
155
|
urlChange = (e) => {
|
|
156
156
|
let { value: t } = e.target || {}, { type: n } = this.props;
|
|
157
|
-
|
|
158
|
-
this.checkAudio(t);
|
|
159
|
-
return;
|
|
160
|
-
} else if (n && n === "video") {
|
|
161
|
-
this.checkVideo(t);
|
|
162
|
-
return;
|
|
163
|
-
}
|
|
164
|
-
this.handleStateChange({
|
|
157
|
+
n && n === "audio" ? this.checkAudio(t) : n && n === "video" ? this.checkVideo(t) : this.handleStateChange({
|
|
165
158
|
urlToUse: null,
|
|
166
159
|
url: null,
|
|
167
160
|
invalid: !0
|
|
@@ -170,11 +163,8 @@ var y = c("@pie-lib:editable-html:plugins:media:dialog"), b = (e) => {
|
|
|
170
163
|
changeHandler = (e) => (t) => this.handleStateChange({ [e]: t.target.value });
|
|
171
164
|
handleDone = (e) => {
|
|
172
165
|
let { handleClose: t } = this.props, { tabValue: n, fileUpload: r } = this.state, i = n === E.insertUrl;
|
|
173
|
-
if (!e)
|
|
174
|
-
|
|
175
|
-
return;
|
|
176
|
-
}
|
|
177
|
-
if (i) {
|
|
166
|
+
if (!e) r.url && this.handleRemoveFile(), t(e);
|
|
167
|
+
else if (i) {
|
|
178
168
|
let { ends: n, height: r, url: i, urlToUse: a, formattedUrl: o, starts: s, width: c } = this.state;
|
|
179
169
|
t(e, {
|
|
180
170
|
tag: "iframe",
|
|
@@ -186,19 +176,13 @@ var y = c("@pie-lib:editable-html:plugins:media:dialog"), b = (e) => {
|
|
|
186
176
|
urlToUse: a,
|
|
187
177
|
src: o
|
|
188
178
|
});
|
|
189
|
-
|
|
190
|
-
}
|
|
191
|
-
if (!r.loading) {
|
|
192
|
-
t(e, {
|
|
193
|
-
tag: "audio",
|
|
194
|
-
src: r.url
|
|
195
|
-
});
|
|
196
|
-
return;
|
|
197
|
-
}
|
|
198
|
-
this.setState({ fileUpload: {
|
|
179
|
+
} else r.loading ? this.setState({ fileUpload: {
|
|
199
180
|
...r,
|
|
200
181
|
scheduled: !0
|
|
201
|
-
} })
|
|
182
|
+
} }) : t(e, {
|
|
183
|
+
tag: "audio",
|
|
184
|
+
src: r.url
|
|
185
|
+
});
|
|
202
186
|
};
|
|
203
187
|
handleUploadFile = async (e) => {
|
|
204
188
|
e.preventDefault(), this.setState({ fileUpload: {
|
|
@@ -109,13 +109,7 @@ function h({ value: t, disabled: n, instanceId: r, children: i, n: a, onChange:
|
|
|
109
109
|
n: a,
|
|
110
110
|
opts: { duplicates: l },
|
|
111
111
|
onDrop: (e, t) => {
|
|
112
|
-
|
|
113
|
-
if (e.type === "drag-in-the-blank-choice") {
|
|
114
|
-
o(e), !l && e.fromChoice && s(e);
|
|
115
|
-
return;
|
|
116
|
-
}
|
|
117
|
-
e.type === "drag-in-the-blank-placed-choice" && (s(t), o(e), setTimeout(() => s(e), 10));
|
|
118
|
-
}
|
|
112
|
+
t?.type === "drag-in-the-blank-drop-choice" && e.value.id !== t.value.id && (e.type === "drag-in-the-blank-choice" ? (o(e), !l && e.fromChoice && s(e)) : e.type === "drag-in-the-blank-placed-choice" && (s(t), o(e), setTimeout(() => s(e), 10)));
|
|
119
113
|
}
|
|
120
114
|
}
|
|
121
115
|
}), C = (e) => {
|
|
@@ -20,7 +20,7 @@ var h = (u) => {
|
|
|
20
20
|
let { tr: e } = h.state, t = e.doc.nodeAt(w);
|
|
21
21
|
if (!t) return;
|
|
22
22
|
let { selection: n } = e;
|
|
23
|
-
n.from
|
|
23
|
+
(n.from !== w || n.to !== w + t.nodeSize) && (e.setSelection(c.create(e.doc, w)), h.view.dispatch(e));
|
|
24
24
|
}, L = () => {
|
|
25
25
|
D.current || (v.onToolbarCloseRequest ? (D.current = !0, v.onToolbarCloseRequest([g, w], h, () => {
|
|
26
26
|
D.current = !1, delete h._holdInlineDropdownToolbarIndex, P();
|
package/dist/extensions/css.js
CHANGED
|
@@ -10,23 +10,23 @@ var s = () => {
|
|
|
10
10
|
}, c = ({ editor: e, callback: t, opts: c, selectedText: l, parentNode: u }) => {
|
|
11
11
|
let d = e.options.element, f = document.createElement("div"), { selection: p } = e.state;
|
|
12
12
|
s(), f.className = "insert-css-dialog";
|
|
13
|
-
let m = !1,
|
|
14
|
-
if (
|
|
15
|
-
let t = f.contains(e.target) ||
|
|
16
|
-
t || n ||
|
|
17
|
-
} else
|
|
18
|
-
},
|
|
19
|
-
t(void 0, !0), f.remove(), document.body.removeEventListener("click",
|
|
20
|
-
},
|
|
21
|
-
t(e, !0), f.remove(), document.body.removeEventListener("click",
|
|
22
|
-
},
|
|
13
|
+
let m, h = !1, g = (e) => {
|
|
14
|
+
if (h) {
|
|
15
|
+
let t = f.contains(e.target) || m, n = d.contains(e.target);
|
|
16
|
+
t || n || _();
|
|
17
|
+
} else h = !0;
|
|
18
|
+
}, _ = () => {
|
|
19
|
+
t(void 0, !0), f.remove(), document.body.removeEventListener("click", g);
|
|
20
|
+
}, v = (e) => {
|
|
21
|
+
t(e, !0), f.remove(), document.body.removeEventListener("click", g);
|
|
22
|
+
}, y = u?.attrs.class, b = (e) => {
|
|
23
23
|
let t = `<span class="${e}">${l}</span>`;
|
|
24
24
|
if (u) {
|
|
25
25
|
let e = "span";
|
|
26
|
-
u?.object === "inline" && (e = "span"), u?.object === "block" && (e = "div"), t = `<${e} class="${
|
|
26
|
+
u?.object === "inline" && (e = "span"), u?.object === "block" && (e = "div"), t = `<${e} class="${y}">${u.text.slice(0, p.$anchor.textOffset)}${t}${u.text.slice(p.$head.textOffset)}</${e}>`;
|
|
27
27
|
}
|
|
28
28
|
return t;
|
|
29
|
-
},
|
|
29
|
+
}, x = /* @__PURE__ */ i("div", {
|
|
30
30
|
style: {
|
|
31
31
|
background: "white",
|
|
32
32
|
height: 500,
|
|
@@ -37,22 +37,22 @@ var s = () => {
|
|
|
37
37
|
},
|
|
38
38
|
children: [
|
|
39
39
|
/* @__PURE__ */ r("h2", { children: "Please choose a css class" }),
|
|
40
|
-
|
|
40
|
+
y && /* @__PURE__ */ i("div", { children: ["The current parent has this class ", y] }),
|
|
41
41
|
/* @__PURE__ */ r(a, {
|
|
42
42
|
component: "nav",
|
|
43
43
|
style: { overflow: "scroll" },
|
|
44
44
|
children: c.names.map((e, t) => /* @__PURE__ */ i(o, {
|
|
45
45
|
button: !0,
|
|
46
|
-
onClick: () =>
|
|
46
|
+
onClick: () => v(e),
|
|
47
47
|
children: [/* @__PURE__ */ r("div", {
|
|
48
48
|
style: { marginRight: 20 },
|
|
49
49
|
children: e
|
|
50
|
-
}), /* @__PURE__ */ r("div", { dangerouslySetInnerHTML: { __html:
|
|
50
|
+
}), /* @__PURE__ */ r("div", { dangerouslySetInnerHTML: { __html: b(e) } })]
|
|
51
51
|
}, `rule-${t}`))
|
|
52
52
|
})
|
|
53
53
|
]
|
|
54
54
|
});
|
|
55
|
-
n.render(
|
|
55
|
+
n.render(x, f, () => {
|
|
56
56
|
let t = e.view.nodeDOM(e.state.selection.from)?.parentNode;
|
|
57
57
|
if (t) {
|
|
58
58
|
let e = d.parentElement.parentElement.parentElement.getBoundingClientRect(), n = t.getBoundingClientRect();
|
|
@@ -62,7 +62,7 @@ var s = () => {
|
|
|
62
62
|
let a = f.offsetWidth;
|
|
63
63
|
f.style.left = "unset", f.style.right = i;
|
|
64
64
|
let o = f.offsetWidth;
|
|
65
|
-
f.style.left = "unset", f.style.right = "unset", a >= o ? f.style.left = r : f.style.right = i, document.body.addEventListener("click",
|
|
65
|
+
f.style.left = "unset", f.style.right = "unset", a >= o ? f.style.left = r : f.style.right = i, document.body.addEventListener("click", g);
|
|
66
66
|
}
|
|
67
67
|
});
|
|
68
68
|
}, l = e.create({
|
|
@@ -4,8 +4,9 @@ import { Plugin as t, PluginKey as n } from "@tiptap/pm/state";
|
|
|
4
4
|
var r = e.create({
|
|
5
5
|
name: "ensureEmptyRootIsDiv",
|
|
6
6
|
addProseMirrorPlugins() {
|
|
7
|
+
let e = new n(this.name);
|
|
7
8
|
return [new t({
|
|
8
|
-
key:
|
|
9
|
+
key: e,
|
|
9
10
|
appendTransaction(e, t, n) {
|
|
10
11
|
if (!e.some((e) => e.docChanged)) return null;
|
|
11
12
|
let { doc: r } = n;
|
|
@@ -4,8 +4,9 @@ import { Plugin as t, PluginKey as n } from "@tiptap/pm/state";
|
|
|
4
4
|
var r = e.create({
|
|
5
5
|
name: "ensureListItemContentIsDiv",
|
|
6
6
|
addProseMirrorPlugins() {
|
|
7
|
+
let e = new n(this.name);
|
|
7
8
|
return [new t({
|
|
8
|
-
key:
|
|
9
|
+
key: e,
|
|
9
10
|
appendTransaction(e, t, n) {
|
|
10
11
|
if (!e.some((e) => e.docChanged)) return null;
|
|
11
12
|
let { doc: r, schema: i } = n, a = i.nodes.div;
|
package/dist/extensions/image.js
CHANGED
|
@@ -13,16 +13,12 @@ var l = (e) => {
|
|
|
13
13
|
};
|
|
14
14
|
function u(t, r, i, a, o = () => {}) {
|
|
15
15
|
let s = e(t, i);
|
|
16
|
-
|
|
17
|
-
o();
|
|
18
|
-
return;
|
|
19
|
-
}
|
|
20
|
-
r(t, s, (e) => {
|
|
16
|
+
s ? r(t, s, (e) => {
|
|
21
17
|
let r;
|
|
22
18
|
return r = new n(t, s, (t) => {
|
|
23
19
|
t || r?.updateNode({ loaded: !0 }), e(t), o();
|
|
24
20
|
}, !0), r.fileChosen(a), r;
|
|
25
|
-
});
|
|
21
|
+
}) : o();
|
|
26
22
|
}
|
|
27
23
|
function d(t, n) {
|
|
28
24
|
let r = t.extensionManager.extensions.find((e) => e.name === "imageUploadNode")?.options.imageHandling?.insertImageRequested, i = e(t, n)?.[0].attrs.src;
|
package/dist/extensions/math.js
CHANGED
|
@@ -40,7 +40,7 @@ var y = new u("ensureTextAfterMath"), b = (e = []) => e.map((e) => ({
|
|
|
40
40
|
let { state: n, dispatch: r } = e, { selection: i, doc: a } = n, { from: o, empty: s } = i;
|
|
41
41
|
if (s && t.key === "Backspace" && o > 0) {
|
|
42
42
|
let e = S(a, o);
|
|
43
|
-
return e
|
|
43
|
+
return e !== -1 && (r(n.tr.delete(e, o)), !0);
|
|
44
44
|
}
|
|
45
45
|
if (s && t.key === "ArrowLeft" && o > 0) {
|
|
46
46
|
let e = S(a, o);
|
|
@@ -49,7 +49,8 @@ var y = new u("ensureTextAfterMath"), b = (e = []) => e.map((e) => ({
|
|
|
49
49
|
if (t.nodeAfter || t.nodeBefore) {
|
|
50
50
|
let t = n.doc.resolve(e);
|
|
51
51
|
return r(n.tr.setSelection(c.create(n.doc, t.pos))), !0;
|
|
52
|
-
}
|
|
52
|
+
}
|
|
53
|
+
return r(n.tr.setSelection(d.create(n.doc, o - 2))), !0;
|
|
53
54
|
}
|
|
54
55
|
return !1;
|
|
55
56
|
} }
|
|
@@ -59,9 +59,9 @@ var f = (e) => String(e || "").replace(/-/g, "_"), p = (e) => e && e.attrs && e.
|
|
|
59
59
|
},
|
|
60
60
|
addProseMirrorPlugins() {
|
|
61
61
|
if (!this.options.type) return [];
|
|
62
|
-
let e = f(this.options.type);
|
|
62
|
+
let e = f(this.options.type), t = new l(`response-area-watcher:${e}`);
|
|
63
63
|
return [new c({
|
|
64
|
-
key:
|
|
64
|
+
key: t,
|
|
65
65
|
view: (t) => {
|
|
66
66
|
let { lastIndexMap: n } = this.storage;
|
|
67
67
|
return n[e] = Math.max(n[e] ?? 0, m(t.state.doc, e)), { update: (t, n) => {
|
|
@@ -19,11 +19,7 @@ function r(e, t) {
|
|
|
19
19
|
}
|
|
20
20
|
function i(t, n) {
|
|
21
21
|
let r = e(t);
|
|
22
|
-
|
|
23
|
-
r?.remove();
|
|
24
|
-
return;
|
|
25
|
-
}
|
|
26
|
-
r || (r = t.ownerDocument.createElement("caption"), r.setAttribute("contenteditable", "false"), t.insertBefore(r, t.firstChild)), r.textContent !== n && (r.textContent = n);
|
|
22
|
+
n ? (r || (r = t.ownerDocument.createElement("caption"), r.setAttribute("contenteditable", "false"), t.insertBefore(r, t.firstChild)), r.textContent !== n && (r.textContent = n)) : r?.remove();
|
|
27
23
|
}
|
|
28
24
|
var a = [
|
|
29
25
|
"row",
|
package/dist/external-paste.js
CHANGED
|
@@ -90,7 +90,7 @@ var C = (e, t = null) => (n, r) => {
|
|
|
90
90
|
})];
|
|
91
91
|
}, h = (e) => {
|
|
92
92
|
let t = [];
|
|
93
|
-
return e.descendants((e) => e.isTextblock
|
|
93
|
+
return e.descendants((e) => !e.isTextblock || (t.length && t.push(i.text(" ")), t.push(...p(e)), !1)), t;
|
|
94
94
|
}, v = (t) => {
|
|
95
95
|
let n = t.type.name === "orderedList";
|
|
96
96
|
if (e.has(t.type.name)) {
|
|
@@ -141,7 +141,7 @@ function w(e, t) {
|
|
|
141
141
|
t.push(i(e));
|
|
142
142
|
}), a.push(t.flatMap((e, t) => t ? [n.text(" ", r), ...e] : e)), !1;
|
|
143
143
|
}
|
|
144
|
-
return e.isTextblock
|
|
144
|
+
return !e.isTextblock || (a.push(i(e)), !1);
|
|
145
145
|
}), _(n, a.map((e) => n.nodes.paragraph.create(null, e)));
|
|
146
146
|
}
|
|
147
147
|
function T(e, t, n) {
|
|
@@ -157,9 +157,8 @@ function E(t, { text: n, html: r }, i, a) {
|
|
|
157
157
|
if ("$anchorCell" in o && !(u.has("table") && s(r, "table"))) {
|
|
158
158
|
let e = h(n).split("\n").map((e) => `<tr>${e.split(" ").map((e) => `<td>${m(e)}</td>`).join("")}</tr>`);
|
|
159
159
|
t.pasteHTML(`<table><tbody>${e.join("")}</tbody></table>`);
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
if (!i.plainText) {
|
|
160
|
+
} else if (i.plainText) c.nodes.math && l(r) ? T(t, r, w) : t.pasteText(o.$from.parent.type.spec.code ? h(n) : h(n).replace(/^$/gm, "\xA0"));
|
|
161
|
+
else {
|
|
163
162
|
let n = u.has("image") && c.nodes.imageUploadNode ? {
|
|
164
163
|
keys: [],
|
|
165
164
|
upload: !!a
|
|
@@ -167,13 +166,7 @@ function E(t, { text: n, html: r }, i, a) {
|
|
|
167
166
|
T(t, e(n ? p(r) : r), C(u, n));
|
|
168
167
|
let i = Promise.resolve();
|
|
169
168
|
for (let e of n?.keys ?? []) i = i.then(() => a?.(e));
|
|
170
|
-
return;
|
|
171
|
-
}
|
|
172
|
-
if (c.nodes.math && l(r)) {
|
|
173
|
-
T(t, r, w);
|
|
174
|
-
return;
|
|
175
169
|
}
|
|
176
|
-
t.pasteText(o.$from.parent.type.spec.code ? h(n) : h(n).replace(/^$/gm, "\xA0"));
|
|
177
170
|
}
|
|
178
171
|
var D = t.create({
|
|
179
172
|
name: "externalPaste",
|
|
@@ -197,7 +190,7 @@ var D = t.create({
|
|
|
197
190
|
},
|
|
198
191
|
handlePaste(t, n) {
|
|
199
192
|
let r = S(n.clipboardData);
|
|
200
|
-
return r
|
|
193
|
+
return r !== null && (E(t, r, e(), o), !0);
|
|
201
194
|
},
|
|
202
195
|
handleDrop(t, n) {
|
|
203
196
|
let r = t.dragging ? null : S(n.dataTransfer), a = r === null ? null : t.posAtCoords({
|
|
@@ -2,10 +2,12 @@
|
|
|
2
2
|
function e(t) {
|
|
3
3
|
var n, r, i = "";
|
|
4
4
|
if (typeof t == "string" || typeof t == "number") i += t;
|
|
5
|
-
else if (typeof t == "object")
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
else if (typeof t == "object") {
|
|
6
|
+
if (Array.isArray(t)) {
|
|
7
|
+
var a = t.length;
|
|
8
|
+
for (n = 0; n < a; n++) t[n] && (r = e(t[n])) && (i && (i += " "), i += r);
|
|
9
|
+
} else for (r in t) t[r] && (i && (i += " "), i += r);
|
|
10
|
+
}
|
|
9
11
|
return i;
|
|
10
12
|
}
|
|
11
13
|
function t() {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pie-lib/editable-html-tip-tap",
|
|
3
|
-
"version": "3.1.2-next.
|
|
3
|
+
"version": "3.1.2-next.20261019151920",
|
|
4
4
|
"description": "",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -13,11 +13,11 @@
|
|
|
13
13
|
"@dnd-kit/utilities": "3.2.2",
|
|
14
14
|
"@mui/icons-material": "^7.3.4",
|
|
15
15
|
"@mui/material": "^7.3.4",
|
|
16
|
-
"@pie-lib/drag": "5.0.7-next.
|
|
17
|
-
"@pie-lib/math-input": "9.0.7-next.
|
|
18
|
-
"@pie-lib/math-toolbar": "4.0.7-next.
|
|
19
|
-
"@pie-lib/render-ui": "8.0.7-next.
|
|
20
|
-
"@pie-lib/translator": "5.0.2-next.
|
|
16
|
+
"@pie-lib/drag": "5.0.7-next.20261019151920",
|
|
17
|
+
"@pie-lib/math-input": "9.0.7-next.20261019151920",
|
|
18
|
+
"@pie-lib/math-toolbar": "4.0.7-next.20261019151920",
|
|
19
|
+
"@pie-lib/render-ui": "8.0.7-next.20261019151920",
|
|
20
|
+
"@pie-lib/translator": "5.0.2-next.20261019151920",
|
|
21
21
|
"@tiptap/core": "3.31.4",
|
|
22
22
|
"@tiptap/extension-character-count": "3.31.4",
|
|
23
23
|
"@tiptap/extension-color": "3.31.4",
|
|
@@ -44,10 +44,10 @@
|
|
|
44
44
|
"react-portal": "^4.2.0",
|
|
45
45
|
"tippy.js": "latest",
|
|
46
46
|
"to-style": "^1.3.3",
|
|
47
|
-
"@pie-element/shared-lodash": "0.1.3-next.
|
|
47
|
+
"@pie-element/shared-lodash": "0.1.3-next.20261019151920",
|
|
48
48
|
"clsx": "^2.1.1",
|
|
49
49
|
"prosemirror-state": "^1.4.4",
|
|
50
|
-
"@pie-element/shared-math-rendering-mathjax": "0.1.8-next.
|
|
50
|
+
"@pie-element/shared-math-rendering-mathjax": "0.1.8-next.20261019151920",
|
|
51
51
|
"@tiptap/extensions": "3.31.4",
|
|
52
52
|
"@tiptap/extension-list": "3.31.4",
|
|
53
53
|
"@tiptap/extension-bubble-menu": "3.31.4",
|