@pie-lib/editable-html-tip-tap 3.0.5-next.20261013201335 → 3.1.0-next.20261015083721
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 +176 -147
- package/dist/index.d.ts +2 -1
- package/dist/index.js +6 -5
- package/dist/pending-save.d.ts +7 -0
- package/dist/pending-save.js +11 -0
- package/package.json +6 -6
|
@@ -1,46 +1,47 @@
|
|
|
1
1
|
import { ExternalPaste as e } from "../external-paste.js";
|
|
2
2
|
import { normalizeInitialMarkup as t } from "../utils/helper.js";
|
|
3
|
-
import n from "../
|
|
4
|
-
import
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import
|
|
17
|
-
import
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
22
|
-
import
|
|
23
|
-
import
|
|
24
|
-
import {
|
|
25
|
-
import
|
|
26
|
-
import
|
|
27
|
-
import
|
|
28
|
-
import
|
|
29
|
-
import
|
|
30
|
-
import
|
|
31
|
-
import {
|
|
3
|
+
import { setPendingSaveFlush as n } from "../pending-save.js";
|
|
4
|
+
import r from "../extensions/extended-table.js";
|
|
5
|
+
import { ExtendedTableCell as i, ExtendedTableHeader as a } from "../extensions/extended-table-cell.js";
|
|
6
|
+
import { DivNode as ee } from "../extensions/div-node.js";
|
|
7
|
+
import { EnsureEmptyRootIsDiv as te } from "../extensions/ensure-empty-root-div.js";
|
|
8
|
+
import { EnsureListItemContentIsDiv as ne } from "../extensions/ensure-list-item-content-is-div.js";
|
|
9
|
+
import { DragInTheBlankNode as re, ExplicitConstructedResponseNode as ie, InlineDropdownNode as ae, MathTemplatedNode as oe, ResponseAreaExtension as se } from "../extensions/responseArea.js";
|
|
10
|
+
import { MathNode as ce } from "../extensions/math.js";
|
|
11
|
+
import { ImageUploadNode as o, uploadPastedImage as s } from "../extensions/image.js";
|
|
12
|
+
import { Media as c } from "../extensions/media.js";
|
|
13
|
+
import { CSSMark as le } from "../extensions/css.js";
|
|
14
|
+
import { ExtendedListItem as ue } from "../extensions/extended-list-item.js";
|
|
15
|
+
import { HeadingParagraph as l } from "../extensions/heading-paragraph.js";
|
|
16
|
+
import { valueToSize as u } from "../utils/size.js";
|
|
17
|
+
import de from "./TiptapContainer.js";
|
|
18
|
+
import { PLUGINS_MAP as fe, buildExtensions as pe } from "../extensions/index.js";
|
|
19
|
+
import { useCallback as d, useEffect as f, useMemo as p, useRef as m, useState as h } from "react";
|
|
20
|
+
import { debounce as g } from "@pie-element/shared-lodash";
|
|
21
|
+
import { EditorContent as _, useEditor as me, useEditorState as he } from "@tiptap/react";
|
|
22
|
+
import { styled as v } from "@mui/material/styles";
|
|
23
|
+
import y from "@tiptap/starter-kit";
|
|
24
|
+
import { TextStyleKit as b } from "@tiptap/extension-text-style";
|
|
25
|
+
import { CharacterCount as ge } from "@tiptap/extension-character-count";
|
|
26
|
+
import _e from "@tiptap/extension-superscript";
|
|
27
|
+
import ve from "@tiptap/extension-subscript";
|
|
28
|
+
import ye from "@tiptap/extension-text-align";
|
|
29
|
+
import be from "@tiptap/extension-image";
|
|
30
|
+
import xe from "@tiptap/extension-placeholder";
|
|
31
|
+
import { TableRow as x } from "@tiptap/extension-table-row";
|
|
32
|
+
import { jsx as S } from "react/jsx-runtime";
|
|
32
33
|
//#region src/components/EditableHtml.tsx
|
|
33
|
-
var
|
|
34
|
+
var C = {
|
|
34
35
|
position: "bottom",
|
|
35
36
|
alignment: "left",
|
|
36
37
|
alwaysVisible: !1,
|
|
37
38
|
showDone: !0,
|
|
38
39
|
doneOn: "blur"
|
|
39
|
-
},
|
|
40
|
+
}, w = {
|
|
40
41
|
options: {},
|
|
41
42
|
respAreaToolbar: () => {},
|
|
42
43
|
onHandleAreaChange: () => {}
|
|
43
|
-
},
|
|
44
|
+
}, T = [
|
|
44
45
|
"bold",
|
|
45
46
|
"italic",
|
|
46
47
|
"underline",
|
|
@@ -62,7 +63,7 @@ var M = {
|
|
|
62
63
|
"h3",
|
|
63
64
|
"undo",
|
|
64
65
|
"redo"
|
|
65
|
-
],
|
|
66
|
+
], E = {
|
|
66
67
|
bold: "bold",
|
|
67
68
|
italic: "italic",
|
|
68
69
|
underline: "underline",
|
|
@@ -73,7 +74,7 @@ var M = {
|
|
|
73
74
|
"numbered-list": "orderedList",
|
|
74
75
|
table: "table",
|
|
75
76
|
image: "image"
|
|
76
|
-
},
|
|
77
|
+
}, D = {
|
|
77
78
|
"--white": "#fff",
|
|
78
79
|
"--black": "#2e2b29",
|
|
79
80
|
"--black-contrast": "#110f0e",
|
|
@@ -92,7 +93,7 @@ var M = {
|
|
|
92
93
|
"--red": "#ff5c33",
|
|
93
94
|
"--red-light": "#ffebe5",
|
|
94
95
|
"--shadow": "0px 12px 33px 0px rgba(0, 0, 0, .06),\n 0px 3.618px 9.949px 0px rgba(0, 0, 0, .04)"
|
|
95
|
-
},
|
|
96
|
+
}, O = (e, t, n) => ({
|
|
96
97
|
role: "textbox",
|
|
97
98
|
"data-pie-editor": "true",
|
|
98
99
|
class: "mathjax_ignore",
|
|
@@ -101,55 +102,80 @@ var M = {
|
|
|
101
102
|
autocapitalize: e ? "on" : "off",
|
|
102
103
|
...t && { "aria-label": t },
|
|
103
104
|
...n && { "aria-labelledby": n }
|
|
104
|
-
}),
|
|
105
|
-
let { showParagraphs:
|
|
106
|
-
|
|
105
|
+
}), k = ["aria-label", "aria-labelledby"], A = 5, j = (e) => e._insertingImage || e._toolbarOpened || e.isActive("inline_dropdown") || e.isActive("explicit_constructed_response"), M = (_) => {
|
|
106
|
+
let { showParagraphs: v, separateParagraphs: M } = _.pluginProps || {}, [Ce, N] = h([]), [we, Te] = h(!1), { toolbarOpts: Ee } = _, P = d((e) => {
|
|
107
|
+
N((t) => {
|
|
107
108
|
let n = t.filter((t) => t.pos !== e);
|
|
108
|
-
return n.length === 0 &&
|
|
109
|
+
return n.length === 0 && Te(!1), n;
|
|
109
110
|
});
|
|
110
|
-
}, [
|
|
111
|
-
...
|
|
112
|
-
...
|
|
113
|
-
},
|
|
111
|
+
}, [N]), F = {
|
|
112
|
+
...C,
|
|
113
|
+
...Ee
|
|
114
|
+
}, I = m([]), L = (e) => {
|
|
115
|
+
I.current = [...I.current.slice(1 - A), e], _.onChange?.(e);
|
|
116
|
+
}, R = m(L);
|
|
117
|
+
R.current = L;
|
|
118
|
+
let z = d((e) => {
|
|
114
119
|
let t = e.getHTML();
|
|
115
|
-
|
|
120
|
+
_.markup !== t && R.current(t), F.doneOn === "blur" && _.onDone?.(t);
|
|
116
121
|
}, [
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
]),
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
122
|
+
_.markup,
|
|
123
|
+
_.onChange,
|
|
124
|
+
_.onDone,
|
|
125
|
+
F.doneOn
|
|
126
|
+
]), B = m(z);
|
|
127
|
+
B.current = z;
|
|
128
|
+
let { idleSaveDelay: V } = _, H = m(!1), U = p(() => V > 0 ? g((e) => {
|
|
129
|
+
if (!e.isDestroyed) {
|
|
130
|
+
if (!H.current && (e.view.composing || j(e))) {
|
|
131
|
+
W.current?.(e);
|
|
132
|
+
return;
|
|
133
|
+
}
|
|
134
|
+
B.current(e);
|
|
135
|
+
}
|
|
136
|
+
}, V) : null, [V]), W = m(U);
|
|
137
|
+
W.current = U;
|
|
138
|
+
let G = d((e) => {
|
|
139
|
+
H.current = !0;
|
|
140
|
+
try {
|
|
141
|
+
e?.flush();
|
|
142
|
+
} finally {
|
|
143
|
+
H.current = !1;
|
|
144
|
+
}
|
|
145
|
+
}, []);
|
|
146
|
+
f(() => () => G(U), [U, G]);
|
|
147
|
+
let De = d(() => G(W.current), [G]), K = p(() => ({
|
|
148
|
+
...w,
|
|
149
|
+
..._.responseAreaProps,
|
|
150
|
+
onInlineDropdownToolbarClose: z
|
|
151
|
+
}), [_.responseAreaProps, z]), q = p(() => {
|
|
152
|
+
let { customPlugins: e, ...t } = _.pluginProps || {};
|
|
127
153
|
e ||= [];
|
|
128
|
-
let n = (
|
|
129
|
-
let n =
|
|
154
|
+
let n = (_.activePlugins || T)?.filter((e) => {
|
|
155
|
+
let n = fe[e] || e, r = t[n] || {};
|
|
130
156
|
return !r || !r.disabled;
|
|
131
157
|
});
|
|
132
|
-
return
|
|
158
|
+
return pe(n, e, {
|
|
133
159
|
math: {},
|
|
134
|
-
textAlign:
|
|
160
|
+
textAlign: _.textAlign,
|
|
135
161
|
html: {},
|
|
136
|
-
extraCSSRules:
|
|
137
|
-
image: { ...
|
|
162
|
+
extraCSSRules: _.extraCSSRules || {},
|
|
163
|
+
image: { ..._.imageSupport },
|
|
138
164
|
toolbar: {},
|
|
139
165
|
table: {},
|
|
140
166
|
responseArea: { type: K.type },
|
|
141
|
-
languageCharacters:
|
|
167
|
+
languageCharacters: _.languageCharactersProps,
|
|
142
168
|
keyPadCharacterRef: {},
|
|
143
169
|
setKeypadInteraction: {},
|
|
144
170
|
media: {}
|
|
145
171
|
});
|
|
146
|
-
}, [
|
|
172
|
+
}, [_, K.type]), J = m(null);
|
|
147
173
|
J.current = {
|
|
148
|
-
plainText:
|
|
149
|
-
formatting: q.map((e) =>
|
|
174
|
+
plainText: _.pluginProps?.pasteFormatting?.disabled === !0,
|
|
175
|
+
formatting: q.map((e) => E[e]).filter(Boolean)
|
|
150
176
|
};
|
|
151
|
-
let
|
|
152
|
-
|
|
177
|
+
let Oe = [
|
|
178
|
+
ye.configure({
|
|
153
179
|
types: [
|
|
154
180
|
"heading",
|
|
155
181
|
"paragraph",
|
|
@@ -171,13 +197,13 @@ var M = {
|
|
|
171
197
|
"justify"
|
|
172
198
|
]
|
|
173
199
|
}),
|
|
174
|
-
|
|
200
|
+
b,
|
|
175
201
|
e.configure({
|
|
176
202
|
settings: () => J.current,
|
|
177
|
-
uploadImage:
|
|
203
|
+
uploadImage: _.imageSupport && s
|
|
178
204
|
}),
|
|
179
|
-
|
|
180
|
-
|
|
205
|
+
ge.configure({ limit: _.charactersLimit || 1e6 }),
|
|
206
|
+
y.configure({
|
|
181
207
|
trailingNode: {
|
|
182
208
|
node: "paragraph",
|
|
183
209
|
notAfter: ["paragraph", "div"]
|
|
@@ -187,95 +213,97 @@ var M = {
|
|
|
187
213
|
linkOnPaste: !1
|
|
188
214
|
}
|
|
189
215
|
}),
|
|
190
|
-
|
|
191
|
-
a,
|
|
192
|
-
ce,
|
|
216
|
+
ue,
|
|
193
217
|
ee,
|
|
218
|
+
l,
|
|
194
219
|
te,
|
|
195
|
-
|
|
196
|
-
|
|
220
|
+
ne,
|
|
221
|
+
xe.configure({
|
|
222
|
+
placeholder: _.placeholder,
|
|
197
223
|
showOnlyWhenEditable: !0,
|
|
198
224
|
showOnlyCurrent: !1,
|
|
199
225
|
includeChildren: !0
|
|
200
226
|
}),
|
|
201
|
-
n,
|
|
202
|
-
A,
|
|
203
|
-
i,
|
|
204
227
|
r,
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
228
|
+
x,
|
|
229
|
+
a,
|
|
230
|
+
i,
|
|
231
|
+
se.configure(K),
|
|
232
|
+
ie.configure(K),
|
|
233
|
+
re.configure(K),
|
|
234
|
+
ae.configure(K),
|
|
235
|
+
oe.configure(K),
|
|
236
|
+
ce.configure({
|
|
237
|
+
toolbarOpts: F,
|
|
238
|
+
math: _.pluginProps?.math || {}
|
|
213
239
|
}),
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
toolbarOpts:
|
|
240
|
+
ve,
|
|
241
|
+
_e,
|
|
242
|
+
be,
|
|
243
|
+
o.configure({
|
|
244
|
+
toolbarOpts: F,
|
|
219
245
|
imageHandling: {
|
|
220
|
-
disableImageAlignmentButtons:
|
|
221
|
-
onDone: (e) =>
|
|
222
|
-
onDelete:
|
|
246
|
+
disableImageAlignmentButtons: _.disableImageAlignmentButtons,
|
|
247
|
+
onDone: (e) => _.onDone?.(e.getHTML()),
|
|
248
|
+
onDelete: _.imageSupport && _.imageSupport.delete && ((e) => {
|
|
223
249
|
let { src: t } = e.attrs;
|
|
224
|
-
|
|
225
|
-
|
|
250
|
+
_.imageSupport.delete(t, (t) => {
|
|
251
|
+
P(e.pos);
|
|
226
252
|
});
|
|
227
253
|
}),
|
|
228
|
-
insertImageRequested:
|
|
254
|
+
insertImageRequested: _.imageSupport && ((e, t, n) => {
|
|
229
255
|
let [r, i] = t, a = (t) => {
|
|
230
256
|
let n;
|
|
231
|
-
|
|
257
|
+
we && t && (n = R.current), P(i), n?.(e.getHTML());
|
|
232
258
|
};
|
|
233
|
-
e._insertingImage = !0,
|
|
234
|
-
let t = n(a), r =
|
|
259
|
+
e._insertingImage = !0, N((e) => [...e, r]), (() => {
|
|
260
|
+
let t = n(a), r = g(() => {
|
|
235
261
|
let t = () => window.removeEventListener("focus", r);
|
|
236
262
|
if (!e._insertingImage) {
|
|
237
263
|
t();
|
|
238
264
|
return;
|
|
239
265
|
}
|
|
240
|
-
|
|
266
|
+
P(i), e._insertingImage = !1, t();
|
|
241
267
|
}, 500);
|
|
242
|
-
window.addEventListener("focus", r),
|
|
268
|
+
window.addEventListener("focus", r), _.imageSupport.add(t);
|
|
243
269
|
})();
|
|
244
270
|
}),
|
|
245
|
-
maxImageWidth:
|
|
246
|
-
maxImageHeight:
|
|
271
|
+
maxImageWidth: _.maxImageWidth,
|
|
272
|
+
maxImageHeight: _.maxImageHeight
|
|
247
273
|
},
|
|
248
274
|
limit: 3
|
|
249
275
|
}),
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
], Y =
|
|
253
|
-
extensions:
|
|
276
|
+
c.configure({ uploadSoundSupport: _.uploadSoundSupport }),
|
|
277
|
+
le.configure({ extraCSSRules: _.extraCSSRules })
|
|
278
|
+
], Y = _.spellCheck !== !1, { ariaLabel: X, ariaLabelledBy: Z } = _, Q = me({
|
|
279
|
+
extensions: Oe,
|
|
254
280
|
immediatelyRender: !1,
|
|
255
281
|
editorProps: {
|
|
256
|
-
attributes:
|
|
282
|
+
attributes: O(Y, X, Z),
|
|
257
283
|
handleKeyDown(e, t) {
|
|
258
|
-
return
|
|
284
|
+
return _.onKeyDown ? _.onKeyDown(t) : !1;
|
|
259
285
|
}
|
|
260
286
|
},
|
|
261
|
-
editable: !
|
|
262
|
-
content: t(
|
|
287
|
+
editable: !_.disabled,
|
|
288
|
+
content: t(_.markup),
|
|
263
289
|
onUpdate: ({ editor: e, transaction: t }) => {
|
|
264
|
-
t.isDone &&
|
|
290
|
+
t.isDone && R.current(e.getHTML()), t.docChanged && W.current && (W.current(e), n(e.view.dom, De));
|
|
265
291
|
},
|
|
266
292
|
onBlur: ({ editor: e }) => {
|
|
267
|
-
e
|
|
293
|
+
j(e) || !e.schema || (W.current?.cancel(), z(e));
|
|
268
294
|
}
|
|
269
|
-
}, [
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
}, [
|
|
273
|
-
Q?.setEditable(!
|
|
274
|
-
}, [
|
|
295
|
+
}, [_.charactersLimit]);
|
|
296
|
+
f(() => {
|
|
297
|
+
_.editorRef && _.editorRef(Q);
|
|
298
|
+
}, [_.editorRef, Q]), f(() => {
|
|
299
|
+
Q?.setEditable(!_.disabled);
|
|
300
|
+
}, [_.disabled, Q]), f(() => {
|
|
301
|
+
Q?.on("destroy", () => G(W.current));
|
|
302
|
+
}, [Q, G]), f(() => {
|
|
275
303
|
if (!Q) return;
|
|
276
|
-
let e = Q.options?.editorProps, t = e?.attributes || {}, n =
|
|
277
|
-
if (["spellcheck", ...
|
|
278
|
-
let r = Object.fromEntries(Object.entries(t).filter(([e]) => !
|
|
304
|
+
let e = Q.options?.editorProps, t = e?.attributes || {}, n = O(Y, X, Z);
|
|
305
|
+
if (["spellcheck", ...k].every((e) => t[e] === n[e])) return;
|
|
306
|
+
let r = Object.fromEntries(Object.entries(t).filter(([e]) => !k.includes(e)));
|
|
279
307
|
Q.setOptions({ editorProps: {
|
|
280
308
|
...e,
|
|
281
309
|
attributes: {
|
|
@@ -288,47 +316,48 @@ var M = {
|
|
|
288
316
|
X,
|
|
289
317
|
Z,
|
|
290
318
|
Q
|
|
291
|
-
]),
|
|
292
|
-
if (!Q) return;
|
|
293
|
-
|
|
319
|
+
]), f(() => {
|
|
320
|
+
if (!Q || I.current.includes(_.markup)) return;
|
|
321
|
+
I.current = [];
|
|
322
|
+
let e = t(_.markup);
|
|
294
323
|
e !== Q.getHTML() && Q.commands.setContent(e, { emitUpdate: !1 });
|
|
295
|
-
}, [
|
|
296
|
-
Object.entries(
|
|
324
|
+
}, [_.markup, Q]), f(() => {
|
|
325
|
+
Object.entries(D).forEach(([e, t]) => {
|
|
297
326
|
document.documentElement.style.setProperty(e, t);
|
|
298
327
|
});
|
|
299
328
|
}, []);
|
|
300
|
-
let
|
|
329
|
+
let ke = he({
|
|
301
330
|
editor: Q,
|
|
302
331
|
selector: (e) => ({ isFocused: e.editor?.isFocused })
|
|
303
|
-
}), $ =
|
|
304
|
-
let { minWidth: e, width: t, maxWidth: n, minHeight: r, height: i, maxHeight: a } =
|
|
332
|
+
}), $ = p(() => {
|
|
333
|
+
let { minWidth: e, width: t, maxWidth: n, minHeight: r, height: i, maxHeight: a } = _;
|
|
305
334
|
return {
|
|
306
|
-
width:
|
|
307
|
-
minWidth:
|
|
308
|
-
maxWidth:
|
|
309
|
-
height:
|
|
310
|
-
minHeight:
|
|
311
|
-
maxHeight:
|
|
335
|
+
width: u(t),
|
|
336
|
+
minWidth: u(e),
|
|
337
|
+
maxWidth: u(n),
|
|
338
|
+
height: u(i),
|
|
339
|
+
minHeight: u(r),
|
|
340
|
+
maxHeight: u(a)
|
|
312
341
|
};
|
|
313
|
-
}, [
|
|
314
|
-
return /* @__PURE__ */
|
|
315
|
-
...
|
|
342
|
+
}, [_]);
|
|
343
|
+
return /* @__PURE__ */ S(de, {
|
|
344
|
+
..._,
|
|
316
345
|
activePlugins: q,
|
|
317
|
-
toolbarOpts:
|
|
318
|
-
editorState:
|
|
346
|
+
toolbarOpts: F,
|
|
347
|
+
editorState: ke,
|
|
319
348
|
editor: Q,
|
|
320
|
-
children: Q && /* @__PURE__ */
|
|
349
|
+
children: Q && /* @__PURE__ */ S(Se, {
|
|
321
350
|
style: {
|
|
322
351
|
minHeight: $.minHeight,
|
|
323
352
|
height: $.height,
|
|
324
353
|
maxHeight: $.maxHeight
|
|
325
354
|
},
|
|
326
|
-
showParagraph:
|
|
327
|
-
separateParagraph:
|
|
355
|
+
showParagraph: v && !v.disabled,
|
|
356
|
+
separateParagraph: M && !M.disabled,
|
|
328
357
|
editor: Q
|
|
329
358
|
})
|
|
330
359
|
});
|
|
331
|
-
},
|
|
360
|
+
}, Se = v(_, { shouldForwardProp: (e) => !["showParagraph", "separateParagraph"].includes(e) })(({ showParagraph: e, separateParagraph: t }) => ({
|
|
332
361
|
display: "flex",
|
|
333
362
|
outline: "none !important",
|
|
334
363
|
"& .ProseMirror": {
|
|
@@ -358,4 +387,4 @@ var M = {
|
|
|
358
387
|
}
|
|
359
388
|
}));
|
|
360
389
|
//#endregion
|
|
361
|
-
export {
|
|
390
|
+
export { M as EditableHtml, M as default };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import StyledEditor, { EditableHtml } from './components/EditableHtml.js';
|
|
2
2
|
import { ALL_PLUGINS, DEFAULT_PLUGINS } from './extensions/index.js';
|
|
3
3
|
import { deleteInlineDropdownByIndex } from './components/respArea/inlineDropdownUtils.js';
|
|
4
|
-
|
|
4
|
+
import { flushPendingEditorSaves } from './pending-save.js';
|
|
5
|
+
export { EditableHtml, ALL_PLUGINS, DEFAULT_PLUGINS, deleteInlineDropdownByIndex, flushPendingEditorSaves };
|
|
5
6
|
export default StyledEditor;
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { flushPendingEditorSaves as e } from "./pending-save.js";
|
|
2
|
+
import { ALL_PLUGINS as t, DEFAULT_PLUGINS as n } from "./extensions/index.js";
|
|
3
|
+
import { EditableHtml as r } from "./components/EditableHtml.js";
|
|
4
|
+
import { deleteInlineDropdownByIndex as i } from "./components/respArea/inlineDropdownUtils.js";
|
|
4
5
|
//#region src/index.tsx
|
|
5
|
-
var
|
|
6
|
+
var a = r;
|
|
6
7
|
//#endregion
|
|
7
|
-
export {
|
|
8
|
+
export { t as ALL_PLUGINS, n as DEFAULT_PLUGINS, r as EditableHtml, a as default, i as deleteInlineDropdownByIndex, e as flushPendingEditorSaves };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare const setPendingSaveFlush: (node: Element, flush: () => void) => void;
|
|
2
|
+
/**
|
|
3
|
+
* Sends every idle save still waiting in an editor under `root` now, as a blur would. An element
|
|
4
|
+
* calls this from `commitPendingSession()`, before its own notifiers flush, so a player committing
|
|
5
|
+
* the session gets what the student typed in the last idle-save delay.
|
|
6
|
+
*/
|
|
7
|
+
export declare function flushPendingEditorSaves(root: ParentNode): void;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
//#region src/pending-save.ts
|
|
2
|
+
var e = Symbol.for("@pie-lib/editable-html-tip-tap/pending-save"), t = (t, n) => {
|
|
3
|
+
t[e] = n;
|
|
4
|
+
};
|
|
5
|
+
function n(t) {
|
|
6
|
+
t.querySelectorAll("[data-pie-editor]").forEach((t) => {
|
|
7
|
+
t[e]?.();
|
|
8
|
+
});
|
|
9
|
+
}
|
|
10
|
+
//#endregion
|
|
11
|
+
export { n as flushPendingEditorSaves, t as setPendingSaveFlush };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pie-lib/editable-html-tip-tap",
|
|
3
|
-
"version": "3.0
|
|
3
|
+
"version": "3.1.0-next.20261015083721",
|
|
4
4
|
"description": "",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -13,10 +13,10 @@
|
|
|
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.5-next.
|
|
17
|
-
"@pie-lib/math-input": "9.0.5-next.
|
|
18
|
-
"@pie-lib/math-toolbar": "4.0.5-next.
|
|
19
|
-
"@pie-lib/render-ui": "8.0.5-next.
|
|
16
|
+
"@pie-lib/drag": "5.0.5-next.20261015083721",
|
|
17
|
+
"@pie-lib/math-input": "9.0.5-next.20261015083721",
|
|
18
|
+
"@pie-lib/math-toolbar": "4.0.5-next.20261015083721",
|
|
19
|
+
"@pie-lib/render-ui": "8.0.5-next.20261015083721",
|
|
20
20
|
"@pie-lib/translator": "5.0.2-next.20261006160832",
|
|
21
21
|
"@tiptap/core": "3.31.4",
|
|
22
22
|
"@tiptap/extension-character-count": "3.31.4",
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
"@pie-element/shared-lodash": "0.1.3-next.20261012213240",
|
|
48
48
|
"clsx": "^2.1.1",
|
|
49
49
|
"prosemirror-state": "^1.4.4",
|
|
50
|
-
"@pie-element/shared-math-rendering-mathjax": "0.1.6-next.
|
|
50
|
+
"@pie-element/shared-math-rendering-mathjax": "0.1.6-next.20261015083721",
|
|
51
51
|
"@tiptap/extensions": "3.31.4",
|
|
52
52
|
"@tiptap/extension-list": "3.31.4",
|
|
53
53
|
"@tiptap/extension-bubble-menu": "3.31.4",
|