slate-vue3 0.12.2 → 0.13.1
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/core.js +82 -82
- package/dist/{create-editor-CKqY-8iC.js → create-editor-DUZVKniJ.js} +81 -84
- package/dist/dom.js +53 -68
- package/dist/history.js +1 -1
- package/dist/{hotkeys-D6R9vfnD.js → hotkeys-D-Urs0nl.js} +86 -67
- package/dist/hyperscript.js +2 -2
- package/dist/{index-BzxeM0Pe.js → index-C2VZD0rk.js} +2 -2
- package/dist/index.js +20 -20
- package/dist/slate/interfaces/editor.d.ts +1 -3
- package/dist/slate-dom/chunking/children-helper.d.ts +3 -2
- package/dist/slate-dom/utils/weak-maps.d.ts +0 -6
- package/dist/slate-vue/components/children.d.ts +1 -4
- package/dist/slate-vue/components/chunk.d.ts +3 -5
- package/dist/slate-vue/render/version.d.ts +0 -3
- package/dist/slate-vue/utils/interface.d.ts +1 -0
- package/dist/{use-focused-rvrvwwCw.js → use-focused-DBkYw-GW.js} +41 -83
- package/dist/yjs.js +4 -4
- package/package.json +18 -18
package/dist/core.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { E as E2, a as a10, L as L2, N as N2, O as O2, P as P2, b as b2, R as R2,
|
|
1
|
+
import { P, a, R, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z, A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, Q, S, T, U, V, W, X, Y, Z, _, $, a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, aa, ab, ac, ad, ae, af, ag, ah, ai, aj, ak, al, am, an, ao, ap, aq } from "./create-editor-DUZVKniJ.js";
|
|
2
|
+
import { E as E2, a as a10, L as L2, N as N2, O as O2, P as P2, b as b2, R as R2, S as S2, c as c2, T as T2, d as d2, i as i2, e as e2 } from "./index-C2VZD0rk.js";
|
|
3
3
|
export {
|
|
4
4
|
E2 as Editor,
|
|
5
5
|
a10 as Element,
|
|
@@ -7,93 +7,93 @@ export {
|
|
|
7
7
|
N2 as Node,
|
|
8
8
|
O2 as Operation,
|
|
9
9
|
P2 as Path,
|
|
10
|
-
|
|
10
|
+
P as PathRef,
|
|
11
11
|
b2 as Point,
|
|
12
|
-
|
|
12
|
+
a as PointRef,
|
|
13
13
|
R2 as Range,
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
R as RangeRef,
|
|
15
|
+
S2 as Scrubber,
|
|
16
|
+
c2 as Span,
|
|
17
17
|
T2 as Text,
|
|
18
18
|
d2 as Transforms,
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
19
|
+
b as above,
|
|
20
|
+
c as addMark,
|
|
21
|
+
d as after,
|
|
22
|
+
e as apply,
|
|
23
|
+
f as before,
|
|
24
|
+
g as collapse,
|
|
25
|
+
h as createEditor,
|
|
26
26
|
i as deleteBackward,
|
|
27
27
|
j as deleteForward,
|
|
28
28
|
k as deleteFragment,
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
29
|
+
l as deleteText,
|
|
30
|
+
m as deselect,
|
|
31
|
+
n as edges,
|
|
32
|
+
o as elementReadOnly,
|
|
33
|
+
p as end,
|
|
34
|
+
q as first,
|
|
35
|
+
r as fragment,
|
|
36
|
+
s as getDirtyPaths,
|
|
37
|
+
t as getFragment,
|
|
38
|
+
u as getVoid,
|
|
39
|
+
v as hasBlocks,
|
|
40
|
+
w as hasInlines,
|
|
41
|
+
x as hasPath,
|
|
42
|
+
y as hasTexts,
|
|
43
|
+
z as insertBreak,
|
|
44
|
+
A as insertFragment,
|
|
45
|
+
B as insertNode,
|
|
46
|
+
C as insertNodes,
|
|
47
|
+
D as insertSoftBreak,
|
|
48
|
+
E as insertText,
|
|
49
|
+
F as isBlock,
|
|
50
|
+
G as isEdge,
|
|
51
51
|
i2 as isEditor,
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
52
|
+
H as isEmpty,
|
|
53
|
+
I as isEnd,
|
|
54
|
+
J as isNormalizing,
|
|
55
55
|
e2 as isObject,
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
56
|
+
K as isStart,
|
|
57
|
+
L as last,
|
|
58
|
+
M as leaf,
|
|
59
|
+
N as levels,
|
|
60
|
+
O as liftNodes,
|
|
61
|
+
Q as marks,
|
|
62
|
+
S as mergeNodes,
|
|
63
|
+
T as move,
|
|
64
|
+
U as moveNodes,
|
|
65
|
+
V as next,
|
|
66
|
+
W as node,
|
|
67
|
+
X as nodes,
|
|
68
|
+
Y as normalize,
|
|
69
|
+
Z as normalizeNode,
|
|
70
|
+
_ as parent,
|
|
71
|
+
$ as path,
|
|
72
|
+
a0 as pathRef,
|
|
73
|
+
a1 as pathRefs,
|
|
74
|
+
a2 as point,
|
|
75
|
+
a3 as pointRef,
|
|
76
|
+
a4 as pointRefs,
|
|
77
|
+
a5 as positions,
|
|
78
|
+
a6 as previous,
|
|
79
|
+
a7 as range,
|
|
80
|
+
a8 as rangeRef,
|
|
81
|
+
a9 as rangeRefs,
|
|
82
|
+
aa as removeMark,
|
|
83
|
+
ab as removeNodes,
|
|
84
|
+
ac as select,
|
|
85
|
+
ad as setNodes,
|
|
86
|
+
ae as setNormalizing,
|
|
87
|
+
af as setPoint,
|
|
88
|
+
ag as setSelection,
|
|
89
|
+
ah as shouldMergeNodesRemovePrevNode,
|
|
90
|
+
ai as shouldNormalize,
|
|
91
|
+
aj as splitNodes,
|
|
92
|
+
ak as start,
|
|
93
|
+
al as string,
|
|
94
|
+
am as unhangRange,
|
|
95
|
+
an as unsetNodes,
|
|
96
|
+
ao as unwrapNodes,
|
|
97
|
+
ap as withoutNormalizing,
|
|
98
|
+
aq as wrapNodes
|
|
99
99
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { P as Path, b as Point, R as Range, E as Editor, d as Transforms, N as Node, T as Text, L as Location, g as getDefaultInsertLocation,
|
|
1
|
+
import { P as Path, b as Point, R as Range, E as Editor, d as Transforms, N as Node, T as Text, L as Location, g as getDefaultInsertLocation, S as Scrubber } from "./index-C2VZD0rk.js";
|
|
2
2
|
import { shallowReactive, ref } from "vue";
|
|
3
3
|
const PathRef = {
|
|
4
4
|
transform(ref2, op) {
|
|
@@ -364,7 +364,6 @@ const apply = (editor, op) => {
|
|
|
364
364
|
if (op.type === "set_selection") {
|
|
365
365
|
editor.marks = null;
|
|
366
366
|
}
|
|
367
|
-
editor.onImmediateChange({ operation: op });
|
|
368
367
|
Promise.resolve().then(() => {
|
|
369
368
|
editor.onChange({ operation: op });
|
|
370
369
|
editor.operations = [];
|
|
@@ -977,7 +976,7 @@ const normalize = (editor, options = {}) => {
|
|
|
977
976
|
const entry = Editor.node(editor, dirtyPath);
|
|
978
977
|
const [node2, _] = entry;
|
|
979
978
|
if (Node.isElement(node2) && node2.children.length === 0) {
|
|
980
|
-
editor.normalizeNode(entry, { operation });
|
|
979
|
+
editor.normalizeNode(entry, { operation, force });
|
|
981
980
|
}
|
|
982
981
|
}
|
|
983
982
|
}
|
|
@@ -996,7 +995,7 @@ const normalize = (editor, options = {}) => {
|
|
|
996
995
|
const dirtyPath = popDirtyPath(editor);
|
|
997
996
|
if (Node.has(editor, dirtyPath)) {
|
|
998
997
|
const entry = Editor.node(editor, dirtyPath);
|
|
999
|
-
editor.normalizeNode(entry, { operation });
|
|
998
|
+
editor.normalizeNode(entry, { operation, force });
|
|
1000
999
|
}
|
|
1001
1000
|
iteration++;
|
|
1002
1001
|
dirtyPaths = getDirtyPaths2(editor);
|
|
@@ -3148,8 +3147,6 @@ const createEditor = () => {
|
|
|
3148
3147
|
markableVoid: () => false,
|
|
3149
3148
|
onChange: () => {
|
|
3150
3149
|
},
|
|
3151
|
-
onImmediateChange: () => {
|
|
3152
|
-
},
|
|
3153
3150
|
// Core
|
|
3154
3151
|
apply: (...args) => apply(editor, ...args),
|
|
3155
3152
|
// Editor
|
|
@@ -3243,85 +3240,85 @@ const createEditor = () => {
|
|
|
3243
3240
|
return editor;
|
|
3244
3241
|
};
|
|
3245
3242
|
export {
|
|
3246
|
-
|
|
3247
|
-
|
|
3248
|
-
|
|
3249
|
-
|
|
3250
|
-
|
|
3251
|
-
|
|
3252
|
-
|
|
3253
|
-
|
|
3254
|
-
|
|
3255
|
-
|
|
3256
|
-
|
|
3257
|
-
|
|
3258
|
-
|
|
3259
|
-
|
|
3260
|
-
|
|
3261
|
-
|
|
3262
|
-
|
|
3263
|
-
|
|
3264
|
-
|
|
3265
|
-
|
|
3266
|
-
|
|
3267
|
-
|
|
3268
|
-
|
|
3269
|
-
|
|
3270
|
-
|
|
3271
|
-
|
|
3272
|
-
|
|
3273
|
-
|
|
3274
|
-
|
|
3275
|
-
|
|
3276
|
-
|
|
3277
|
-
|
|
3278
|
-
|
|
3279
|
-
|
|
3280
|
-
|
|
3281
|
-
|
|
3282
|
-
|
|
3283
|
-
|
|
3284
|
-
|
|
3285
|
-
|
|
3286
|
-
|
|
3287
|
-
|
|
3288
|
-
|
|
3289
|
-
|
|
3290
|
-
|
|
3291
|
-
|
|
3292
|
-
|
|
3293
|
-
|
|
3294
|
-
|
|
3295
|
-
|
|
3296
|
-
|
|
3297
|
-
|
|
3298
|
-
|
|
3299
|
-
|
|
3300
|
-
|
|
3301
|
-
|
|
3302
|
-
|
|
3303
|
-
|
|
3304
|
-
|
|
3305
|
-
|
|
3306
|
-
|
|
3307
|
-
|
|
3308
|
-
|
|
3243
|
+
path as $,
|
|
3244
|
+
insertFragment as A,
|
|
3245
|
+
insertNode as B,
|
|
3246
|
+
insertNodes as C,
|
|
3247
|
+
insertSoftBreak as D,
|
|
3248
|
+
insertText as E,
|
|
3249
|
+
isBlock as F,
|
|
3250
|
+
isEdge as G,
|
|
3251
|
+
isEmpty as H,
|
|
3252
|
+
isEnd as I,
|
|
3253
|
+
isNormalizing as J,
|
|
3254
|
+
isStart as K,
|
|
3255
|
+
last as L,
|
|
3256
|
+
leaf as M,
|
|
3257
|
+
levels as N,
|
|
3258
|
+
liftNodes as O,
|
|
3259
|
+
PathRef as P,
|
|
3260
|
+
marks as Q,
|
|
3261
|
+
RangeRef as R,
|
|
3262
|
+
mergeNodes as S,
|
|
3263
|
+
move as T,
|
|
3264
|
+
moveNodes as U,
|
|
3265
|
+
next as V,
|
|
3266
|
+
node as W,
|
|
3267
|
+
nodes as X,
|
|
3268
|
+
normalize as Y,
|
|
3269
|
+
normalizeNode as Z,
|
|
3270
|
+
parent as _,
|
|
3271
|
+
PointRef as a,
|
|
3272
|
+
pathRef as a0,
|
|
3273
|
+
pathRefs as a1,
|
|
3274
|
+
point as a2,
|
|
3275
|
+
pointRef as a3,
|
|
3276
|
+
pointRefs as a4,
|
|
3277
|
+
positions as a5,
|
|
3278
|
+
previous as a6,
|
|
3279
|
+
range as a7,
|
|
3280
|
+
rangeRef as a8,
|
|
3281
|
+
rangeRefs as a9,
|
|
3282
|
+
removeMark as aa,
|
|
3283
|
+
removeNodes as ab,
|
|
3284
|
+
select as ac,
|
|
3285
|
+
setNodes as ad,
|
|
3286
|
+
setNormalizing as ae,
|
|
3287
|
+
setPoint as af,
|
|
3288
|
+
setSelection as ag,
|
|
3289
|
+
shouldMergeNodesRemovePrevNode as ah,
|
|
3290
|
+
shouldNormalize as ai,
|
|
3291
|
+
splitNodes as aj,
|
|
3292
|
+
start as ak,
|
|
3293
|
+
string as al,
|
|
3294
|
+
unhangRange as am,
|
|
3295
|
+
unsetNodes as an,
|
|
3296
|
+
unwrapNodes as ao,
|
|
3297
|
+
withoutNormalizing as ap,
|
|
3298
|
+
wrapNodes as aq,
|
|
3299
|
+
above as b,
|
|
3300
|
+
addMark as c,
|
|
3301
|
+
after as d,
|
|
3302
|
+
apply as e,
|
|
3303
|
+
before as f,
|
|
3304
|
+
collapse as g,
|
|
3305
|
+
createEditor as h,
|
|
3309
3306
|
deleteBackward as i,
|
|
3310
3307
|
deleteForward as j,
|
|
3311
3308
|
deleteFragment as k,
|
|
3312
|
-
|
|
3313
|
-
|
|
3314
|
-
|
|
3315
|
-
|
|
3316
|
-
|
|
3317
|
-
|
|
3318
|
-
|
|
3319
|
-
|
|
3320
|
-
|
|
3321
|
-
|
|
3322
|
-
|
|
3323
|
-
|
|
3324
|
-
|
|
3325
|
-
|
|
3326
|
-
|
|
3309
|
+
deleteText as l,
|
|
3310
|
+
deselect as m,
|
|
3311
|
+
edges as n,
|
|
3312
|
+
elementReadOnly as o,
|
|
3313
|
+
end as p,
|
|
3314
|
+
first as q,
|
|
3315
|
+
fragment as r,
|
|
3316
|
+
getDirtyPaths as s,
|
|
3317
|
+
getFragment as t,
|
|
3318
|
+
getVoid as u,
|
|
3319
|
+
hasBlocks as v,
|
|
3320
|
+
hasInlines as w,
|
|
3321
|
+
hasPath as x,
|
|
3322
|
+
hasTexts as y,
|
|
3323
|
+
insertBreak as z
|
|
3327
3324
|
};
|
package/dist/dom.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { D as DOMEditor, E as EDITOR_TO_KEY_TO_ELEMENT, a as EDITOR_TO_USER_MARKS, g as getChunkTreeForNode, b as EDITOR_TO_USER_SELECTION, N as NODE_TO_KEY, i as isDOMText, c as getPlainText, d as getSlateFragmentAttribute, e as EDITOR_TO_ON_CHANGE
|
|
2
|
-
import {
|
|
3
|
-
import { E as Editor, R as Range, N as Node, d as Transforms, P as Path } from "./index-
|
|
1
|
+
import { D as DOMEditor, E as EDITOR_TO_KEY_TO_ELEMENT, a as EDITOR_TO_USER_MARKS, g as getChunkTreeForNode, b as EDITOR_TO_USER_SELECTION, N as NODE_TO_KEY, i as isDOMText, c as getPlainText, d as getSlateFragmentAttribute, e as EDITOR_TO_ON_CHANGE } from "./hotkeys-D-Urs0nl.js";
|
|
2
|
+
import { C, f, h, j, H, k, I, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z, K, A, M, B, F, G, J, L, O, P, Q, R, S, T, U, V, W, X, Y, Z, _, $, a0, a1, a2, a3, a4 } from "./hotkeys-D-Urs0nl.js";
|
|
3
|
+
import { E as Editor, R as Range, N as Node, d as Transforms, P as Path } from "./index-C2VZD0rk.js";
|
|
4
4
|
import "vue";
|
|
5
5
|
const doRectsIntersect = (rect, compareRect) => {
|
|
6
6
|
const middle = (compareRect.top + compareRect.bottom) / 2;
|
|
@@ -47,14 +47,7 @@ const findCurrentLineRange = (editor, parentRange) => {
|
|
|
47
47
|
};
|
|
48
48
|
const withDOM = (editor, clipboardFormatKey = "x-slate-fragment") => {
|
|
49
49
|
const e = editor;
|
|
50
|
-
const {
|
|
51
|
-
apply,
|
|
52
|
-
onChange,
|
|
53
|
-
onImmediateChange,
|
|
54
|
-
deleteBackward,
|
|
55
|
-
addMark,
|
|
56
|
-
removeMark
|
|
57
|
-
} = e;
|
|
50
|
+
const { apply, onChange, deleteBackward, addMark, removeMark } = e;
|
|
58
51
|
EDITOR_TO_KEY_TO_ELEMENT.set(e, /* @__PURE__ */ new WeakMap());
|
|
59
52
|
e.addMark = (key, value) => {
|
|
60
53
|
EDITOR_TO_USER_MARKS.delete(e);
|
|
@@ -252,13 +245,6 @@ const withDOM = (editor, clipboardFormatKey = "x-slate-fragment") => {
|
|
|
252
245
|
}
|
|
253
246
|
onChange(options);
|
|
254
247
|
};
|
|
255
|
-
e.onImmediateChange = (options) => {
|
|
256
|
-
const onContextImmediateChange = EDITOR_TO_ON_IMMEDIATE_CHANGE.get(e);
|
|
257
|
-
if (onContextImmediateChange) {
|
|
258
|
-
onContextImmediateChange(options);
|
|
259
|
-
}
|
|
260
|
-
onImmediateChange(options);
|
|
261
|
-
};
|
|
262
248
|
return e;
|
|
263
249
|
};
|
|
264
250
|
const getMatches = (e, path) => {
|
|
@@ -352,68 +338,67 @@ const splitDecorationsByChild = (editor, node, decorations) => {
|
|
|
352
338
|
return decorationsByChild;
|
|
353
339
|
};
|
|
354
340
|
export {
|
|
355
|
-
|
|
341
|
+
C as CAN_USE_DOM,
|
|
356
342
|
DOMEditor,
|
|
357
|
-
|
|
343
|
+
f as EDITOR_TO_ELEMENT,
|
|
358
344
|
EDITOR_TO_KEY_TO_ELEMENT,
|
|
359
345
|
EDITOR_TO_ON_CHANGE,
|
|
360
|
-
EDITOR_TO_ON_IMMEDIATE_CHANGE,
|
|
361
346
|
EDITOR_TO_USER_MARKS,
|
|
362
347
|
EDITOR_TO_USER_SELECTION,
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
348
|
+
h as EDITOR_TO_WINDOW,
|
|
349
|
+
j as ELEMENT_TO_NODE,
|
|
350
|
+
H as HAS_BEFORE_INPUT_SUPPORT,
|
|
351
|
+
k as Hotkeys,
|
|
352
|
+
I as IS_ANDROID,
|
|
353
|
+
l as IS_ANDROID_CHROME_LEGACY,
|
|
354
|
+
m as IS_APPLE,
|
|
355
|
+
n as IS_CHROME,
|
|
356
|
+
o as IS_CHROME_LEGACY,
|
|
357
|
+
p as IS_COMPOSING,
|
|
358
|
+
q as IS_EDGE_LEGACY,
|
|
359
|
+
r as IS_FIREFOX,
|
|
360
|
+
s as IS_FIREFOX_LEGACY,
|
|
361
|
+
t as IS_FOCUSED,
|
|
362
|
+
u as IS_IOS,
|
|
363
|
+
v as IS_READ_ONLY,
|
|
364
|
+
w as IS_SAFARI_LEGACY,
|
|
365
|
+
x as IS_UC_MOBILE,
|
|
366
|
+
y as IS_WEBKIT,
|
|
367
|
+
z as IS_WECHATBROWSER,
|
|
368
|
+
K as KEY_TO_CHUNK_TREE,
|
|
369
|
+
A as Key,
|
|
370
|
+
M as MARK_PLACEHOLDER_SYMBOL,
|
|
371
|
+
B as NODE_TO_ELEMENT,
|
|
372
|
+
F as NODE_TO_INDEX,
|
|
388
373
|
NODE_TO_KEY,
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
374
|
+
G as NODE_TO_PARENT,
|
|
375
|
+
J as applyStringDiff,
|
|
376
|
+
L as closestShadowAware,
|
|
377
|
+
O as containsShadowAware,
|
|
378
|
+
P as getActiveElement,
|
|
394
379
|
getChunkTreeForNode,
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
380
|
+
Q as getClipboardData,
|
|
381
|
+
R as getDefaultView,
|
|
382
|
+
S as getEditableChild,
|
|
383
|
+
T as getEditableChildAndIndex,
|
|
399
384
|
getPlainText,
|
|
400
|
-
|
|
385
|
+
U as getSelection,
|
|
401
386
|
getSlateFragmentAttribute,
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
387
|
+
V as hasShadowRoot,
|
|
388
|
+
W as isAfter,
|
|
389
|
+
X as isBefore,
|
|
390
|
+
Y as isDOMComment,
|
|
391
|
+
Z as isDOMElement,
|
|
392
|
+
_ as isDOMNode,
|
|
393
|
+
$ as isDOMSelection,
|
|
409
394
|
isDOMText,
|
|
410
395
|
isElementDecorationsEqual,
|
|
411
|
-
|
|
396
|
+
a0 as isPlainTextOnlyPaste,
|
|
412
397
|
isTextDecorationsEqual,
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
398
|
+
a1 as isTrackedMutation,
|
|
399
|
+
a2 as normalizeDOMPoint,
|
|
400
|
+
a3 as normalizeStringDiff,
|
|
401
|
+
a4 as reconcileChildren,
|
|
417
402
|
shallowCompare,
|
|
418
403
|
splitDecorationsByChild,
|
|
419
404
|
withDOM
|
package/dist/history.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { e as isObject, O as Operation, E as Editor, d as Transforms, P as Path } from "./index-
|
|
1
|
+
import { e as isObject, O as Operation, E as Editor, d as Transforms, P as Path } from "./index-C2VZD0rk.js";
|
|
2
2
|
import { shallowReactive } from "vue";
|
|
3
3
|
const History = {
|
|
4
4
|
/**
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { toRaw } from "vue";
|
|
2
|
+
import { S as Scrubber, R as Range, E as Editor, N as Node, d as Transforms, P as Path } from "./index-C2VZD0rk.js";
|
|
3
3
|
import { t as toRawWeakMap } from "./index-Ban80MbP.js";
|
|
4
4
|
const getDefaultView = (value) => {
|
|
5
5
|
return value && value.ownerDocument && value.ownerDocument.defaultView || null;
|
|
@@ -262,7 +262,6 @@ const IS_FOCUSED = /* @__PURE__ */ new WeakMap();
|
|
|
262
262
|
const IS_COMPOSING = /* @__PURE__ */ new WeakMap();
|
|
263
263
|
const EDITOR_TO_USER_SELECTION = /* @__PURE__ */ new WeakMap();
|
|
264
264
|
const EDITOR_TO_ON_CHANGE = /* @__PURE__ */ new WeakMap();
|
|
265
|
-
const EDITOR_TO_ON_IMMEDIATE_CHANGE = /* @__PURE__ */ new WeakMap();
|
|
266
265
|
const EDITOR_TO_USER_MARKS = /* @__PURE__ */ new WeakMap();
|
|
267
266
|
const MARK_PLACEHOLDER_SYMBOL = /* @__PURE__ */ Symbol(
|
|
268
267
|
"mark-placeholder"
|
|
@@ -671,10 +670,16 @@ const DOMEditor = {
|
|
|
671
670
|
const node = parentNode.hasAttribute("data-slate-node") ? parentNode : parentNode.closest("[data-slate-node]");
|
|
672
671
|
if (node && DOMEditor.hasDOMNode(editor, node, { editable: true })) {
|
|
673
672
|
const slateNode2 = DOMEditor.toSlateNode(editor, node);
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
DOMEditor.findPath(editor, slateNode2)
|
|
677
|
-
)
|
|
673
|
+
let nodePath;
|
|
674
|
+
try {
|
|
675
|
+
nodePath = DOMEditor.findPath(editor, slateNode2);
|
|
676
|
+
} catch (e) {
|
|
677
|
+
if (suppressThrow) {
|
|
678
|
+
return null;
|
|
679
|
+
}
|
|
680
|
+
throw e;
|
|
681
|
+
}
|
|
682
|
+
const start = Editor.start(editor, nodePath);
|
|
678
683
|
const { path: path2 } = start;
|
|
679
684
|
let { offset: offset2 } = start;
|
|
680
685
|
if (!node.querySelector("[data-slate-leaf]")) {
|
|
@@ -692,7 +697,15 @@ const DOMEditor = {
|
|
|
692
697
|
);
|
|
693
698
|
}
|
|
694
699
|
const slateNode = DOMEditor.toSlateNode(editor, textNode);
|
|
695
|
-
|
|
700
|
+
let path;
|
|
701
|
+
try {
|
|
702
|
+
path = DOMEditor.findPath(editor, slateNode);
|
|
703
|
+
} catch (e) {
|
|
704
|
+
if (suppressThrow) {
|
|
705
|
+
return null;
|
|
706
|
+
}
|
|
707
|
+
throw e;
|
|
708
|
+
}
|
|
696
709
|
return { path, offset };
|
|
697
710
|
},
|
|
698
711
|
toSlateRange: (editor, domRange, options) => {
|
|
@@ -802,7 +815,7 @@ const getChunkTreeForNode = (editor, node) => {
|
|
|
802
815
|
chunkTree = {
|
|
803
816
|
type: "root",
|
|
804
817
|
movedNodeKeys: /* @__PURE__ */ new Set(),
|
|
805
|
-
children:
|
|
818
|
+
children: []
|
|
806
819
|
};
|
|
807
820
|
KEY_TO_CHUNK_TREE.set(key, chunkTree);
|
|
808
821
|
}
|
|
@@ -1147,8 +1160,10 @@ class ChunkTreeHelper {
|
|
|
1147
1160
|
parent,
|
|
1148
1161
|
children: []
|
|
1149
1162
|
};
|
|
1150
|
-
chunk.children =
|
|
1151
|
-
|
|
1163
|
+
chunk.children = groupIntoChunks(
|
|
1164
|
+
chunkNodes,
|
|
1165
|
+
chunk,
|
|
1166
|
+
perChunk / this.chunkSize
|
|
1152
1167
|
);
|
|
1153
1168
|
chunks2.push(chunk);
|
|
1154
1169
|
}
|
|
@@ -1208,6 +1223,7 @@ class ChunkTreeHelper {
|
|
|
1208
1223
|
class ChildrenHelper {
|
|
1209
1224
|
editor;
|
|
1210
1225
|
children;
|
|
1226
|
+
rawChildren;
|
|
1211
1227
|
/**
|
|
1212
1228
|
* Sparse array of Slate node keys, each index corresponding to an index in
|
|
1213
1229
|
* the children array
|
|
@@ -1221,7 +1237,8 @@ class ChildrenHelper {
|
|
|
1221
1237
|
pointerIndex;
|
|
1222
1238
|
constructor(editor, children) {
|
|
1223
1239
|
this.editor = editor;
|
|
1224
|
-
this.children = children;
|
|
1240
|
+
this.children = [...children];
|
|
1241
|
+
this.rawChildren = toRaw(children);
|
|
1225
1242
|
this.cachedKeys = new Array(children.length);
|
|
1226
1243
|
this.pointerIndex = 0;
|
|
1227
1244
|
}
|
|
@@ -1254,7 +1271,7 @@ class ChildrenHelper {
|
|
|
1254
1271
|
* Whether all children have been read
|
|
1255
1272
|
*/
|
|
1256
1273
|
get reachedEnd() {
|
|
1257
|
-
return this.pointerIndex >= this.
|
|
1274
|
+
return this.pointerIndex >= this.rawChildren.length;
|
|
1258
1275
|
}
|
|
1259
1276
|
/**
|
|
1260
1277
|
* Determine whether a node with a given key appears in the unread part of the
|
|
@@ -1270,10 +1287,13 @@ class ChildrenHelper {
|
|
|
1270
1287
|
* by one and compare it to the known key.
|
|
1271
1288
|
*/
|
|
1272
1289
|
lookAhead(node, key) {
|
|
1273
|
-
const elementResult = this.
|
|
1290
|
+
const elementResult = this.rawChildren.indexOf(
|
|
1291
|
+
toRaw(node),
|
|
1292
|
+
this.pointerIndex
|
|
1293
|
+
);
|
|
1274
1294
|
if (elementResult > -1) return elementResult - this.pointerIndex;
|
|
1275
|
-
for (let i = this.pointerIndex; i < this.
|
|
1276
|
-
const candidateNode = this.
|
|
1295
|
+
for (let i = this.pointerIndex; i < this.rawChildren.length; i++) {
|
|
1296
|
+
const candidateNode = this.rawChildren[i];
|
|
1277
1297
|
const candidateKey = this.findKey(candidateNode, i);
|
|
1278
1298
|
if (candidateKey === key) return i - this.pointerIndex;
|
|
1279
1299
|
}
|
|
@@ -1297,7 +1317,7 @@ class ChildrenHelper {
|
|
|
1297
1317
|
findKey(node, index) {
|
|
1298
1318
|
const cachedKey = this.cachedKeys[index];
|
|
1299
1319
|
if (cachedKey) return cachedKey;
|
|
1300
|
-
const key = DOMEditor.findKey(this.editor, node);
|
|
1320
|
+
const key = DOMEditor.findKey(this.editor, toRaw(node));
|
|
1301
1321
|
this.cachedKeys[index] = key;
|
|
1302
1322
|
return key;
|
|
1303
1323
|
}
|
|
@@ -1681,64 +1701,63 @@ const Hotkeys = {
|
|
|
1681
1701
|
isUndo: create("undo")
|
|
1682
1702
|
};
|
|
1683
1703
|
export {
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
|
|
1687
|
-
|
|
1704
|
+
isDOMSelection as $,
|
|
1705
|
+
Key as A,
|
|
1706
|
+
NODE_TO_ELEMENT as B,
|
|
1707
|
+
CAN_USE_DOM as C,
|
|
1688
1708
|
DOMEditor as D,
|
|
1689
1709
|
EDITOR_TO_KEY_TO_ELEMENT as E,
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
|
|
1696
|
-
|
|
1697
|
-
|
|
1710
|
+
NODE_TO_INDEX as F,
|
|
1711
|
+
NODE_TO_PARENT as G,
|
|
1712
|
+
HAS_BEFORE_INPUT_SUPPORT as H,
|
|
1713
|
+
IS_ANDROID as I,
|
|
1714
|
+
applyStringDiff as J,
|
|
1715
|
+
KEY_TO_CHUNK_TREE as K,
|
|
1716
|
+
closestShadowAware as L,
|
|
1717
|
+
MARK_PLACEHOLDER_SYMBOL as M,
|
|
1698
1718
|
NODE_TO_KEY as N,
|
|
1699
|
-
|
|
1700
|
-
|
|
1701
|
-
|
|
1702
|
-
|
|
1703
|
-
|
|
1704
|
-
|
|
1705
|
-
|
|
1706
|
-
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
|
|
1711
|
-
|
|
1719
|
+
containsShadowAware as O,
|
|
1720
|
+
getActiveElement as P,
|
|
1721
|
+
getClipboardData as Q,
|
|
1722
|
+
getDefaultView as R,
|
|
1723
|
+
getEditableChild as S,
|
|
1724
|
+
getEditableChildAndIndex as T,
|
|
1725
|
+
getSelection as U,
|
|
1726
|
+
hasShadowRoot as V,
|
|
1727
|
+
isAfter as W,
|
|
1728
|
+
isBefore as X,
|
|
1729
|
+
isDOMComment as Y,
|
|
1730
|
+
isDOMElement as Z,
|
|
1731
|
+
isDOMNode as _,
|
|
1712
1732
|
EDITOR_TO_USER_MARKS as a,
|
|
1713
|
-
|
|
1714
|
-
|
|
1715
|
-
|
|
1716
|
-
|
|
1717
|
-
|
|
1718
|
-
MARK_PLACEHOLDER_SYMBOL as a5,
|
|
1733
|
+
isPlainTextOnlyPaste as a0,
|
|
1734
|
+
isTrackedMutation as a1,
|
|
1735
|
+
normalizeDOMPoint as a2,
|
|
1736
|
+
normalizeStringDiff as a3,
|
|
1737
|
+
reconcileChildren as a4,
|
|
1719
1738
|
EDITOR_TO_USER_SELECTION as b,
|
|
1720
1739
|
getPlainText as c,
|
|
1721
1740
|
getSlateFragmentAttribute as d,
|
|
1722
1741
|
EDITOR_TO_ON_CHANGE as e,
|
|
1723
|
-
|
|
1742
|
+
EDITOR_TO_ELEMENT as f,
|
|
1724
1743
|
getChunkTreeForNode as g,
|
|
1725
|
-
|
|
1744
|
+
EDITOR_TO_WINDOW as h,
|
|
1726
1745
|
isDOMText as i,
|
|
1727
|
-
|
|
1728
|
-
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
|
|
1746
|
+
ELEMENT_TO_NODE as j,
|
|
1747
|
+
Hotkeys as k,
|
|
1748
|
+
IS_ANDROID_CHROME_LEGACY as l,
|
|
1749
|
+
IS_APPLE as m,
|
|
1750
|
+
IS_CHROME as n,
|
|
1751
|
+
IS_CHROME_LEGACY as o,
|
|
1752
|
+
IS_COMPOSING as p,
|
|
1753
|
+
IS_EDGE_LEGACY as q,
|
|
1754
|
+
IS_FIREFOX as r,
|
|
1755
|
+
IS_FIREFOX_LEGACY as s,
|
|
1756
|
+
IS_FOCUSED as t,
|
|
1757
|
+
IS_IOS as u,
|
|
1758
|
+
IS_READ_ONLY as v,
|
|
1759
|
+
IS_SAFARI_LEGACY as w,
|
|
1760
|
+
IS_UC_MOBILE as x,
|
|
1761
|
+
IS_WEBKIT as y,
|
|
1762
|
+
IS_WECHATBROWSER as z
|
|
1744
1763
|
};
|
package/dist/hyperscript.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { R as Range, N as Node, T as Text, a as Element, e as isObject } from "./index-
|
|
2
|
-
import {
|
|
1
|
+
import { R as Range, N as Node, T as Text, a as Element, e as isObject } from "./index-C2VZD0rk.js";
|
|
2
|
+
import { h as createEditor$1 } from "./create-editor-DUZVKniJ.js";
|
|
3
3
|
import "vue";
|
|
4
4
|
import { t as toRawWeakMap } from "./index-Ban80MbP.js";
|
|
5
5
|
const ANCHOR = new toRawWeakMap();
|
|
@@ -1550,11 +1550,11 @@ export {
|
|
|
1550
1550
|
Operation as O,
|
|
1551
1551
|
Path as P,
|
|
1552
1552
|
Range as R,
|
|
1553
|
-
|
|
1553
|
+
Scrubber as S,
|
|
1554
1554
|
Text as T,
|
|
1555
1555
|
Element as a,
|
|
1556
1556
|
Point as b,
|
|
1557
|
-
|
|
1557
|
+
Span as c,
|
|
1558
1558
|
Transforms as d,
|
|
1559
1559
|
isObject as e,
|
|
1560
1560
|
getDefaultInsertLocation as g,
|
package/dist/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { u as useElementIf, a as useEditor, S as SLATE_USE_SELECTION } from "./use-focused-
|
|
2
|
-
import {
|
|
3
|
-
import { E as Editor, R as Range } from "./index-
|
|
1
|
+
import { u as useElementIf, a as useEditor, S as SLATE_USE_SELECTION } from "./use-focused-DBkYw-GW.js";
|
|
2
|
+
import { D, b, c, d, e, f, g, E, h, i, j, k, l, m, n, o, p } from "./use-focused-DBkYw-GW.js";
|
|
3
|
+
import { E as Editor, R as Range } from "./index-C2VZD0rk.js";
|
|
4
4
|
import { computed, inject } from "vue";
|
|
5
|
-
import { D as DOMEditor } from "./hotkeys-
|
|
5
|
+
import { D as DOMEditor } from "./hotkeys-D-Urs0nl.js";
|
|
6
6
|
import { t } from "./index-Ban80MbP.js";
|
|
7
7
|
const useSelected = () => {
|
|
8
8
|
const element = useElementIf();
|
|
@@ -37,27 +37,27 @@ const useInheritRef = (attribute) => {
|
|
|
37
37
|
return attribute;
|
|
38
38
|
};
|
|
39
39
|
export {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
40
|
+
D as DEFAULT_CHUNK_RENDER,
|
|
41
|
+
b as DEFAULT_DECORATE_FN,
|
|
42
|
+
c as DEFAULT_ELEMENT_RENDER,
|
|
43
|
+
d as DEFAULT_LEAF_RENDER,
|
|
44
|
+
e as DEFAULT_PLACEHOLDER_RENDER,
|
|
45
|
+
f as DEFAULT_SCROLL_INTO_VIEW,
|
|
46
|
+
g as DEFAULT_TEXT_RENDER,
|
|
47
47
|
E as Editable,
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
48
|
+
h as Slate,
|
|
49
|
+
i as handleNativeHistoryEvents,
|
|
50
|
+
j as isDOMEventHandled,
|
|
51
|
+
k as isDOMEventTargetInput,
|
|
52
|
+
l as isEventHandled,
|
|
53
53
|
t as toRawWeakMap,
|
|
54
|
-
|
|
54
|
+
m as useComposing,
|
|
55
55
|
useEditor,
|
|
56
|
-
|
|
56
|
+
n as useElement,
|
|
57
57
|
useElementIf,
|
|
58
|
-
|
|
58
|
+
o as useFocused,
|
|
59
59
|
useInheritRef,
|
|
60
|
-
|
|
60
|
+
p as useReadOnly,
|
|
61
61
|
useSelected,
|
|
62
62
|
useSelection
|
|
63
63
|
};
|
|
@@ -21,9 +21,7 @@ export interface BaseEditor {
|
|
|
21
21
|
normalizeNode: (entry: NodeEntry, options?: {
|
|
22
22
|
operation?: Operation;
|
|
23
23
|
fallbackElement?: () => Element;
|
|
24
|
-
|
|
25
|
-
onImmediateChange: (options?: {
|
|
26
|
-
operation?: Operation;
|
|
24
|
+
force?: boolean;
|
|
27
25
|
}) => void;
|
|
28
26
|
onChange: (options?: {
|
|
29
27
|
operation?: Operation;
|
|
@@ -6,8 +6,9 @@ import { ChunkLeaf } from './types';
|
|
|
6
6
|
* children array with a chunk tree
|
|
7
7
|
*/
|
|
8
8
|
export declare class ChildrenHelper {
|
|
9
|
-
private editor;
|
|
10
|
-
private children;
|
|
9
|
+
private readonly editor;
|
|
10
|
+
private readonly children;
|
|
11
|
+
private readonly rawChildren;
|
|
11
12
|
/**
|
|
12
13
|
* Sparse array of Slate node keys, each index corresponding to an index in
|
|
13
14
|
* the children array
|
|
@@ -33,11 +33,5 @@ export declare const EDITOR_TO_USER_SELECTION: WeakMap<Editor, RangeRef | null>;
|
|
|
33
33
|
export declare const EDITOR_TO_ON_CHANGE: WeakMap<import('../../slate/index.ts').BaseEditor, (options?: {
|
|
34
34
|
operation?: Operation;
|
|
35
35
|
}) => void>;
|
|
36
|
-
/**
|
|
37
|
-
* Weak map for trigger chunk tree reconciliation on immediate changes.
|
|
38
|
-
*/
|
|
39
|
-
export declare const EDITOR_TO_ON_IMMEDIATE_CHANGE: WeakMap<import('../../slate/index.ts').BaseEditor, (options?: {
|
|
40
|
-
operation?: Operation;
|
|
41
|
-
}) => void>;
|
|
42
36
|
export declare const EDITOR_TO_USER_MARKS: WeakMap<Editor, Partial<Text> | null>;
|
|
43
37
|
export declare const MARK_PLACEHOLDER_SYMBOL: string;
|
|
@@ -1,12 +1,9 @@
|
|
|
1
1
|
import { Ancestor } from '../../slate/index.ts';
|
|
2
|
-
import { VNode } from 'vue';
|
|
3
2
|
/**
|
|
4
3
|
* Children.
|
|
5
4
|
*/
|
|
6
5
|
export declare const ChildrenComp: import('vue').DefineComponent<{
|
|
7
6
|
element: Ancestor;
|
|
8
|
-
}, (
|
|
9
|
-
[key: string]: any;
|
|
10
|
-
}>), {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<{
|
|
7
|
+
}, () => import('vue').VNodeChild[], {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<{
|
|
11
8
|
element: Ancestor;
|
|
12
9
|
}> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
|
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
import { ChunkAncestor } from '../../slate-dom/index.ts';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
ancestor: ChunkAncestor;
|
|
6
|
-
}> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
|
|
2
|
+
import { VNode } from 'vue';
|
|
3
|
+
import { RenderChunkProps } from '../utils/interface';
|
|
4
|
+
export declare const ChunkCompFc: (ancestor: ChunkAncestor, renderChunk: (props: RenderChunkProps) => VNode, highest?: boolean) => import('vue').VNodeChild[];
|
|
@@ -2,6 +2,3 @@ import { Ref } from 'vue';
|
|
|
2
2
|
export declare const SLATE_INNER_EDITOR_VERSION: unique symbol;
|
|
3
3
|
export declare const provideEditorVersion: (version: Ref<number>) => void;
|
|
4
4
|
export declare const useEditorVersion: () => Ref<number, number>;
|
|
5
|
-
export declare const SLATE_INNER_EDITOR_NODE_VERSION: unique symbol;
|
|
6
|
-
export declare const provideEditorNodeVersion: (version: Ref<number>) => void;
|
|
7
|
-
export declare const useEditorNodeVersion: () => Ref<number, number>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { h, inject, provide, computed, defineComponent, ref, onMounted, onUnmounted, renderSlot, renderList, watch, onUpdated, useAttrs, reactive, toRaw } from "vue";
|
|
2
|
-
import { R as Range, N as Node,
|
|
3
|
-
import {
|
|
2
|
+
import { R as Range, N as Node, S as Scrubber, T as Text, E as Editor, P as Path, d as Transforms, a as Element } from "./index-C2VZD0rk.js";
|
|
3
|
+
import { I as IS_ANDROID, _ as isDOMNode, D as DOMEditor, M as MARK_PLACEHOLDER_SYMBOL, e as EDITOR_TO_ON_CHANGE, y as IS_WEBKIT, E as EDITOR_TO_KEY_TO_ELEMENT, j as ELEMENT_TO_NODE, B as NODE_TO_ELEMENT, F as NODE_TO_INDEX, G as NODE_TO_PARENT, r as IS_FIREFOX, g as getChunkTreeForNode, a4 as reconcileChildren, J as applyStringDiff, $ as isDOMSelection, a3 as normalizeStringDiff, v as IS_READ_ONLY, R as getDefaultView, h as EDITOR_TO_WINDOW, f as EDITOR_TO_ELEMENT, U as getSelection, H as HAS_BEFORE_INPUT_SUPPORT, C as CAN_USE_DOM, O as containsShadowAware, P as getActiveElement, t as IS_FOCUSED, a0 as isPlainTextOnlyPaste, p as IS_COMPOSING, k as Hotkeys, n as IS_CHROME, s as IS_FIREFOX_LEGACY, u as IS_IOS, z as IS_WECHATBROWSER, x as IS_UC_MOBILE, a as EDITOR_TO_USER_MARKS, Z as isDOMElement, b as EDITOR_TO_USER_SELECTION } from "./hotkeys-D-Urs0nl.js";
|
|
4
4
|
const SLATE_USE_EDITOR = /* @__PURE__ */ Symbol("SLATE_USE_EDITOR");
|
|
5
5
|
const SLATE_USE_ELEMENT = /* @__PURE__ */ Symbol("SLATE_USE_ELEMENT");
|
|
6
6
|
const SLATE_USE_FOCUSED = /* @__PURE__ */ Symbol("SLATE_USE_FOCUSED");
|
|
@@ -267,21 +267,6 @@ const useEditorVersion = () => {
|
|
|
267
267
|
}
|
|
268
268
|
return EDITOR_VERSION;
|
|
269
269
|
};
|
|
270
|
-
const SLATE_INNER_EDITOR_NODE_VERSION = /* @__PURE__ */ Symbol(
|
|
271
|
-
"SLATE_INNER_EDITOR_NODE_VERSION"
|
|
272
|
-
);
|
|
273
|
-
const provideEditorNodeVersion = (version) => provide(SLATE_INNER_EDITOR_NODE_VERSION, version);
|
|
274
|
-
const useEditorNodeVersion = () => {
|
|
275
|
-
const EDITOR_NODE_VERSION = inject(
|
|
276
|
-
SLATE_INNER_EDITOR_NODE_VERSION
|
|
277
|
-
);
|
|
278
|
-
if (EDITOR_NODE_VERSION === void 0) {
|
|
279
|
-
throw new Error(
|
|
280
|
-
`The \`useEditorNodeVersion\` hook must be used inside the <Slate> component's context.`
|
|
281
|
-
);
|
|
282
|
-
}
|
|
283
|
-
return EDITOR_NODE_VERSION;
|
|
284
|
-
};
|
|
285
270
|
const SLATE_INNER_PLACEHOLDER = /* @__PURE__ */ Symbol("SLATE_INNER_PLACEHOLDER");
|
|
286
271
|
const providePlaceholder = (placeholder) => {
|
|
287
272
|
provide(SLATE_INNER_PLACEHOLDER, placeholder);
|
|
@@ -369,15 +354,6 @@ const SLATE_INNER_STATIC_CHUNK_ROOT = /* @__PURE__ */ Symbol(
|
|
|
369
354
|
const provideChunkRoot = (chunkRoot) => {
|
|
370
355
|
provide(SLATE_INNER_STATIC_CHUNK_ROOT, chunkRoot);
|
|
371
356
|
};
|
|
372
|
-
const useChunkRoot = () => {
|
|
373
|
-
const CHUNK_STATIC_ROOT = inject(SLATE_INNER_STATIC_CHUNK_ROOT);
|
|
374
|
-
if (CHUNK_STATIC_ROOT === void 0) {
|
|
375
|
-
throw new Error(
|
|
376
|
-
`The \`useStaticChunk\` hook must be used inside the <Slate> component's context.`
|
|
377
|
-
);
|
|
378
|
-
}
|
|
379
|
-
return CHUNK_STATIC_ROOT;
|
|
380
|
-
};
|
|
381
357
|
const SLATE_INNER_RENDER_CHUNK = /* @__PURE__ */ Symbol("SLATE_INNER_RENDER_CHUNK");
|
|
382
358
|
const provideRenderChunk = (fn) => provide(SLATE_INNER_RENDER_CHUNK, fn);
|
|
383
359
|
const useRenderChunk = () => {
|
|
@@ -456,9 +432,7 @@ const Slate = defineComponent({
|
|
|
456
432
|
provide(SLATE_USE_SELECTION, selection);
|
|
457
433
|
const focusCb = () => isFocus.value = DOMEditor.isFocused(editor);
|
|
458
434
|
const editorVersion = ref(0);
|
|
459
|
-
const editorNodeVersion = ref(0);
|
|
460
435
|
provideEditorVersion(editorVersion);
|
|
461
|
-
provideEditorNodeVersion(editorNodeVersion);
|
|
462
436
|
const markPlaceholder = computed(() => {
|
|
463
437
|
if (editor.selection && Range.isCollapsed(editor.selection) && editor.marks) {
|
|
464
438
|
const anchor = editor.selection.anchor;
|
|
@@ -493,16 +467,6 @@ const Slate = defineComponent({
|
|
|
493
467
|
emit("valuechange", options);
|
|
494
468
|
}
|
|
495
469
|
});
|
|
496
|
-
EDITOR_TO_ON_IMMEDIATE_CHANGE.set(
|
|
497
|
-
editor,
|
|
498
|
-
(options) => {
|
|
499
|
-
const type = options?.operation?.type;
|
|
500
|
-
if (!type || ["set_selection", "insert_text", "remove_text"].includes(type)) {
|
|
501
|
-
return;
|
|
502
|
-
}
|
|
503
|
-
editorNodeVersion.value++;
|
|
504
|
-
}
|
|
505
|
-
);
|
|
506
470
|
});
|
|
507
471
|
onUnmounted(() => {
|
|
508
472
|
document.removeEventListener("focusin", focusCb);
|
|
@@ -842,32 +806,20 @@ const ElementComp = defineComponent({
|
|
|
842
806
|
});
|
|
843
807
|
}
|
|
844
808
|
});
|
|
845
|
-
const
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
return () => renderList(ancestor.children, (chunkNode) => {
|
|
853
|
-
if (chunkNode.type === "chunk") {
|
|
854
|
-
return renderChunk({
|
|
855
|
-
highest: root === ancestor,
|
|
856
|
-
lowest: chunkNode.children.some((c) => c.type === "leaf"),
|
|
857
|
-
attributes: { "data-slate-chunk": true },
|
|
858
|
-
children: h(ChunkComp, {
|
|
859
|
-
ancestor: chunkNode,
|
|
860
|
-
key: chunkNode.key.id
|
|
861
|
-
})
|
|
862
|
-
});
|
|
863
|
-
}
|
|
864
|
-
return h(ElementComp, {
|
|
865
|
-
// @ts-expect-error Only blocks containing no inlines are chunked
|
|
866
|
-
element: chunkNode.node,
|
|
867
|
-
key: chunkNode.key.id
|
|
868
|
-
});
|
|
809
|
+
const ChunkCompFc = (ancestor, renderChunk, highest) => renderList(ancestor.children, (chunkNode) => {
|
|
810
|
+
if (chunkNode.type === "chunk") {
|
|
811
|
+
return renderChunk({
|
|
812
|
+
highest: highest === true,
|
|
813
|
+
lowest: chunkNode.children.some((c) => c.type === "leaf"),
|
|
814
|
+
attributes: { "data-slate-chunk": true, key: chunkNode.key.id },
|
|
815
|
+
children: ChunkCompFc(chunkNode, renderChunk, false)
|
|
869
816
|
});
|
|
870
817
|
}
|
|
818
|
+
return h(ElementComp, {
|
|
819
|
+
// @ts-expect-error Only blocks containing no inlines are chunked
|
|
820
|
+
element: chunkNode.node,
|
|
821
|
+
key: chunkNode.key.id
|
|
822
|
+
});
|
|
871
823
|
});
|
|
872
824
|
const ChildrenComp = defineComponent({
|
|
873
825
|
name: "slate-children",
|
|
@@ -895,10 +847,12 @@ const ChildrenComp = defineComponent({
|
|
|
895
847
|
});
|
|
896
848
|
}
|
|
897
849
|
const cacheTree = getChunkTreeForNode(editor, props.element);
|
|
898
|
-
const
|
|
850
|
+
const version = ref(0);
|
|
899
851
|
watch(
|
|
900
|
-
|
|
852
|
+
element.children,
|
|
901
853
|
() => {
|
|
854
|
+
version.value++;
|
|
855
|
+
console.time("Reconcile children chunks");
|
|
902
856
|
reconcileChildren(editor, element.children, {
|
|
903
857
|
chunkTree: cacheTree,
|
|
904
858
|
chunkSize,
|
|
@@ -914,15 +868,19 @@ const ChildrenComp = defineComponent({
|
|
|
914
868
|
NODE_TO_INDEX.set(n2, i);
|
|
915
869
|
}
|
|
916
870
|
});
|
|
871
|
+
console.timeEnd("Reconcile children chunks");
|
|
917
872
|
},
|
|
918
873
|
{
|
|
874
|
+
deep: false,
|
|
919
875
|
immediate: true
|
|
920
876
|
}
|
|
921
877
|
);
|
|
922
878
|
provideChunkRoot(cacheTree);
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
879
|
+
const renderChunk = useRenderChunk();
|
|
880
|
+
return () => {
|
|
881
|
+
version.value;
|
|
882
|
+
return ChunkCompFc(cacheTree, renderChunk, true);
|
|
883
|
+
};
|
|
926
884
|
}
|
|
927
885
|
});
|
|
928
886
|
const useComposing = () => {
|
|
@@ -2130,24 +2088,24 @@ const useFocused = () => {
|
|
|
2130
2088
|
return isFocus;
|
|
2131
2089
|
};
|
|
2132
2090
|
export {
|
|
2133
|
-
|
|
2091
|
+
DEFAULT_CHUNK_RENDER as D,
|
|
2134
2092
|
Editable as E,
|
|
2135
2093
|
SLATE_USE_SELECTION as S,
|
|
2136
2094
|
useEditor as a,
|
|
2137
|
-
|
|
2138
|
-
|
|
2139
|
-
|
|
2140
|
-
|
|
2141
|
-
|
|
2142
|
-
|
|
2143
|
-
|
|
2144
|
-
|
|
2145
|
-
|
|
2146
|
-
|
|
2147
|
-
|
|
2148
|
-
|
|
2149
|
-
|
|
2150
|
-
|
|
2151
|
-
|
|
2095
|
+
DEFAULT_DECORATE_FN as b,
|
|
2096
|
+
DEFAULT_ELEMENT_RENDER as c,
|
|
2097
|
+
DEFAULT_LEAF_RENDER as d,
|
|
2098
|
+
DEFAULT_PLACEHOLDER_RENDER as e,
|
|
2099
|
+
DEFAULT_SCROLL_INTO_VIEW as f,
|
|
2100
|
+
DEFAULT_TEXT_RENDER as g,
|
|
2101
|
+
Slate as h,
|
|
2102
|
+
handleNativeHistoryEvents as i,
|
|
2103
|
+
isDOMEventHandled as j,
|
|
2104
|
+
isDOMEventTargetInput as k,
|
|
2105
|
+
isEventHandled as l,
|
|
2106
|
+
useComposing as m,
|
|
2107
|
+
useElement as n,
|
|
2108
|
+
useFocused as o,
|
|
2109
|
+
useReadOnly as p,
|
|
2152
2110
|
useElementIf as u
|
|
2153
2111
|
};
|
package/dist/yjs.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { e as isObject, N as Node, P as Path, E as Editor, L as Location, d as Transforms, R as Range } from "./index-
|
|
1
|
+
import { e as isObject, N as Node, P as Path, E as Editor, L as Location, d as Transforms, R as Range } from "./index-C2VZD0rk.js";
|
|
2
2
|
import { ref, onMounted, onUnmounted, watch, onUpdated, computed } from "vue";
|
|
3
|
-
import { XmlText, YTextEvent,
|
|
4
|
-
import { a as useEditor,
|
|
5
|
-
import { D as DOMEditor } from "./hotkeys-
|
|
3
|
+
import { XmlText, YTextEvent, createAbsolutePositionFromRelativePosition, createRelativePositionFromTypeIndex, createRelativePositionFromJSON, decodeRelativePosition, encodeRelativePosition, UndoManager, compareRelativePositions } from "yjs";
|
|
4
|
+
import { a as useEditor, o as useFocused } from "./use-focused-DBkYw-GW.js";
|
|
5
|
+
import { D as DOMEditor } from "./hotkeys-D-Urs0nl.js";
|
|
6
6
|
function deepEquals(node, another) {
|
|
7
7
|
for (const key in node) {
|
|
8
8
|
const a = node[key];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "slate-vue3",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.13.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.js",
|
|
@@ -69,50 +69,50 @@
|
|
|
69
69
|
"dependencies": {
|
|
70
70
|
"direction": "^2.0.1",
|
|
71
71
|
"is-hotkey": "^0.2.0",
|
|
72
|
-
"lodash-es": "^4.17.
|
|
72
|
+
"lodash-es": "^4.17.23",
|
|
73
73
|
"scroll-into-view-if-needed": "^3.1.0"
|
|
74
74
|
},
|
|
75
75
|
"peerDependencies": {
|
|
76
76
|
"vue": "^3.0.0"
|
|
77
77
|
},
|
|
78
78
|
"devDependencies": {
|
|
79
|
-
"@actions/core": "^
|
|
80
|
-
"@eslint/js": "^
|
|
81
|
-
"@faker-js/faker": "^10.
|
|
82
|
-
"@liveblocks/client": "^3.13.
|
|
83
|
-
"@liveblocks/yjs": "^3.13.
|
|
84
|
-
"@playwright/test": "^1.
|
|
79
|
+
"@actions/core": "^3.0.0",
|
|
80
|
+
"@eslint/js": "^10.0.1",
|
|
81
|
+
"@faker-js/faker": "^10.3.0",
|
|
82
|
+
"@liveblocks/client": "^3.13.4",
|
|
83
|
+
"@liveblocks/yjs": "^3.13.4",
|
|
84
|
+
"@playwright/test": "^1.58.2",
|
|
85
85
|
"@testing-library/vue": "^8.1.0",
|
|
86
86
|
"@types/is-hotkey": "^0.1.10",
|
|
87
87
|
"@types/is-url": "^1.2.32",
|
|
88
88
|
"@types/lodash-es": "^4.17.12",
|
|
89
|
-
"@types/node": "^25.
|
|
90
|
-
"@types/prismjs": "^1.26.
|
|
91
|
-
"@vitejs/plugin-vue": "^6.0.
|
|
89
|
+
"@types/node": "^25.2.3",
|
|
90
|
+
"@types/prismjs": "^1.26.6",
|
|
91
|
+
"@vitejs/plugin-vue": "^6.0.4",
|
|
92
92
|
"@vue/eslint-config-prettier": "^10.2.0",
|
|
93
93
|
"babel-plugin-transform-regex": "^6.1.0",
|
|
94
|
-
"eslint": "^
|
|
94
|
+
"eslint": "^10.0.0",
|
|
95
95
|
"eslint-plugin-vue": "^10.7.0",
|
|
96
|
-
"globals": "^17.
|
|
96
|
+
"globals": "^17.3.0",
|
|
97
97
|
"husky": "^9.1.7",
|
|
98
98
|
"image-extensions": "^1.1.0",
|
|
99
99
|
"is-url": "^1.2.4",
|
|
100
100
|
"jiti": "^2.6.1",
|
|
101
|
-
"jsdom": "^
|
|
101
|
+
"jsdom": "^28.0.0",
|
|
102
102
|
"lint-staged": "^16.2.7",
|
|
103
103
|
"prismjs": "^1.30.0",
|
|
104
104
|
"remark-gfm": "^4.0.1",
|
|
105
105
|
"remark-parse": "^11.0.0",
|
|
106
106
|
"remark-slate-transformer": "^0.9.0",
|
|
107
107
|
"typescript": "~5.9.3",
|
|
108
|
-
"typescript-eslint": "^8.
|
|
108
|
+
"typescript-eslint": "^8.55.0",
|
|
109
109
|
"unified": "^11.0.5",
|
|
110
110
|
"vite": "^7.3.1",
|
|
111
|
-
"vite-plugin-babel": "^1.
|
|
111
|
+
"vite-plugin-babel": "^1.5.1",
|
|
112
112
|
"vite-plugin-dts": "^4.5.4",
|
|
113
113
|
"vite-plugin-eslint": "^1.8.1",
|
|
114
|
-
"vitest": "^4.0.
|
|
115
|
-
"vue-router": "^
|
|
114
|
+
"vitest": "^4.0.18",
|
|
115
|
+
"vue-router": "^5.0.2",
|
|
116
116
|
"yjs": "^13.6.29"
|
|
117
117
|
},
|
|
118
118
|
"publishConfig": {
|