slate-vue3 0.0.35 → 0.0.37
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/dom.d.ts +0 -4
- package/dist/dom.js +30 -31
- package/dist/{hotkeys-DX661Z2s.js → hotkeys-CFtX6lwM.js} +31 -33
- package/dist/index.js +20 -25
- package/package.json +19 -7
package/dist/dom.d.ts
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import { RendererNode } from 'vue';
|
|
2
|
-
|
|
3
1
|
/**
|
|
4
2
|
* The `Ancestor` union type represents nodes that are ancestors in the tree.
|
|
5
3
|
* It is returned as a convenience in certain cases to narrow a value further
|
|
@@ -436,8 +434,6 @@ export declare const EDITOR_TO_ON_CHANGE: toRawWeakMap<BaseEditor, (options?: {
|
|
|
436
434
|
operation?: Operation;
|
|
437
435
|
}) => void>;
|
|
438
436
|
|
|
439
|
-
export declare const EDITOR_TO_PLACEHOLDER_ELEMENT: toRawWeakMap<Editor, RendererNode>;
|
|
440
|
-
|
|
441
437
|
export declare const EDITOR_TO_USER_MARKS: toRawWeakMap<Editor, Partial<Text_2> | null>;
|
|
442
438
|
|
|
443
439
|
export declare const EDITOR_TO_USER_SELECTION: toRawWeakMap<Editor, RangeRef | null>;
|
package/dist/dom.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { D as DOMEditor, b as EDITOR_TO_KEY_TO_ELEMENT,
|
|
2
|
-
import { C,
|
|
1
|
+
import { D as DOMEditor, b as EDITOR_TO_KEY_TO_ELEMENT, x as EDITOR_TO_USER_MARKS, r as EDITOR_TO_USER_SELECTION, F as NODE_TO_KEY, G as isDOMText, J as getPlainText, K as getSlateFragmentAttribute, E as EDITOR_TO_ON_CHANGE, P as PLACEHOLDER_SYMBOL } from "./hotkeys-CFtX6lwM.js";
|
|
2
|
+
import { C, m, l, c, H, z, I, A, s, y, u, q, a, j, w, f, v, T, M, N, d, e, g, o, k, p, L, O, Q, t, i, h, B, R, S, n } from "./hotkeys-CFtX6lwM.js";
|
|
3
3
|
import { E as Editor, R as Range, t as toRawWeakMap, l as Element, m as Transforms, P as Path, N as Node } from "./index-CjnPdoJN.js";
|
|
4
4
|
import "vue";
|
|
5
5
|
const doRectsIntersect = (rect, compareRect) => {
|
|
@@ -162,10 +162,10 @@ const withDOM = (editor, clipboardFormatKey = "x-slate-fragment") => {
|
|
|
162
162
|
});
|
|
163
163
|
if (endVoid) {
|
|
164
164
|
const [voidNode] = endVoid;
|
|
165
|
-
const
|
|
165
|
+
const r = domRange.cloneRange();
|
|
166
166
|
const domNode = DOMEditor.toDOMNode(e2, voidNode);
|
|
167
|
-
|
|
168
|
-
contents =
|
|
167
|
+
r.setEndAfter(domNode);
|
|
168
|
+
contents = r.cloneContents();
|
|
169
169
|
}
|
|
170
170
|
if (startVoid) {
|
|
171
171
|
attach = contents.querySelector("[data-slate-spacer]");
|
|
@@ -282,49 +282,48 @@ const isTextDecorationsEqual = (list, another) => {
|
|
|
282
282
|
export {
|
|
283
283
|
C as CAN_USE_DOM,
|
|
284
284
|
DOMEditor,
|
|
285
|
-
|
|
285
|
+
m as EDITOR_TO_ELEMENT,
|
|
286
286
|
EDITOR_TO_KEY_TO_ELEMENT,
|
|
287
287
|
EDITOR_TO_ON_CHANGE,
|
|
288
|
-
f as EDITOR_TO_PLACEHOLDER_ELEMENT,
|
|
289
288
|
EDITOR_TO_USER_MARKS,
|
|
290
289
|
EDITOR_TO_USER_SELECTION,
|
|
291
|
-
|
|
290
|
+
l as EDITOR_TO_WINDOW,
|
|
292
291
|
c as ELEMENT_TO_NODE,
|
|
293
292
|
H as HAS_BEFORE_INPUT_SUPPORT,
|
|
294
|
-
|
|
293
|
+
z as Hotkeys,
|
|
295
294
|
I as IS_ANDROID,
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
295
|
+
A as IS_CHROME,
|
|
296
|
+
s as IS_COMPOSING,
|
|
297
|
+
y as IS_FIREFOX,
|
|
298
|
+
u as IS_FIREFOX_LEGACY,
|
|
299
|
+
q as IS_FOCUSED,
|
|
301
300
|
a as IS_IOS,
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
301
|
+
j as IS_READ_ONLY,
|
|
302
|
+
w as IS_UC_MOBILE,
|
|
303
|
+
f as IS_WEBKIT,
|
|
304
|
+
v as IS_WECHATBROWSER,
|
|
305
|
+
T as Key,
|
|
307
306
|
M as MARK_PLACEHOLDER_SYMBOL,
|
|
308
307
|
N as NODE_TO_ELEMENT,
|
|
309
308
|
d as NODE_TO_INDEX,
|
|
310
309
|
NODE_TO_KEY,
|
|
311
310
|
e as NODE_TO_PARENT,
|
|
312
311
|
PLACEHOLDER_SYMBOL,
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
312
|
+
g as applyStringDiff,
|
|
313
|
+
o as getActiveElement,
|
|
314
|
+
k as getDefaultView,
|
|
315
|
+
p as getSelection,
|
|
316
|
+
L as hasShadowRoot,
|
|
317
|
+
O as isAfter,
|
|
318
|
+
Q as isBefore,
|
|
319
|
+
t as isDOMElement,
|
|
321
320
|
i as isDOMNode,
|
|
322
|
-
|
|
321
|
+
h as isDOMSelection,
|
|
323
322
|
isElementDecorationsEqual,
|
|
324
|
-
|
|
323
|
+
B as isPlainTextOnlyPaste,
|
|
325
324
|
isTextDecorationsEqual,
|
|
326
|
-
|
|
327
|
-
|
|
325
|
+
R as isTrackedMutation,
|
|
326
|
+
S as normalizeDOMPoint,
|
|
328
327
|
n as normalizeStringDiff,
|
|
329
328
|
withDOM
|
|
330
329
|
};
|
|
@@ -186,7 +186,6 @@ const NODE_TO_INDEX = new toRawWeakMap();
|
|
|
186
186
|
const NODE_TO_PARENT = new toRawWeakMap();
|
|
187
187
|
const EDITOR_TO_WINDOW = new toRawWeakMap();
|
|
188
188
|
const EDITOR_TO_ELEMENT = new toRawWeakMap();
|
|
189
|
-
const EDITOR_TO_PLACEHOLDER_ELEMENT = new toRawWeakMap();
|
|
190
189
|
const ELEMENT_TO_NODE = new toRawWeakMap();
|
|
191
190
|
const NODE_TO_ELEMENT = new toRawWeakMap();
|
|
192
191
|
const NODE_TO_KEY = new toRawWeakMap();
|
|
@@ -1033,51 +1032,50 @@ const Hotkeys = {
|
|
|
1033
1032
|
isUndo: create("undo")
|
|
1034
1033
|
};
|
|
1035
1034
|
export {
|
|
1036
|
-
|
|
1037
|
-
|
|
1035
|
+
IS_CHROME as A,
|
|
1036
|
+
isPlainTextOnlyPaste as B,
|
|
1038
1037
|
CAN_USE_DOM as C,
|
|
1039
1038
|
DOMEditor as D,
|
|
1040
1039
|
EDITOR_TO_ON_CHANGE as E,
|
|
1041
|
-
|
|
1042
|
-
|
|
1040
|
+
NODE_TO_KEY as F,
|
|
1041
|
+
isDOMText as G,
|
|
1043
1042
|
HAS_BEFORE_INPUT_SUPPORT as H,
|
|
1044
1043
|
IS_ANDROID as I,
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1044
|
+
getPlainText as J,
|
|
1045
|
+
getSlateFragmentAttribute as K,
|
|
1046
|
+
hasShadowRoot as L,
|
|
1048
1047
|
MARK_PLACEHOLDER_SYMBOL as M,
|
|
1049
1048
|
NODE_TO_ELEMENT as N,
|
|
1050
|
-
|
|
1049
|
+
isAfter as O,
|
|
1051
1050
|
PLACEHOLDER_SYMBOL as P,
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
Key as U,
|
|
1051
|
+
isBefore as Q,
|
|
1052
|
+
isTrackedMutation as R,
|
|
1053
|
+
normalizeDOMPoint as S,
|
|
1054
|
+
Key as T,
|
|
1057
1055
|
IS_IOS as a,
|
|
1058
1056
|
EDITOR_TO_KEY_TO_ELEMENT as b,
|
|
1059
1057
|
ELEMENT_TO_NODE as c,
|
|
1060
1058
|
NODE_TO_INDEX as d,
|
|
1061
1059
|
NODE_TO_PARENT as e,
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1060
|
+
IS_WEBKIT as f,
|
|
1061
|
+
applyStringDiff as g,
|
|
1062
|
+
isDOMSelection as h,
|
|
1065
1063
|
isDOMNode as i,
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1064
|
+
IS_READ_ONLY as j,
|
|
1065
|
+
getDefaultView as k,
|
|
1066
|
+
EDITOR_TO_WINDOW as l,
|
|
1067
|
+
EDITOR_TO_ELEMENT as m,
|
|
1070
1068
|
normalizeStringDiff as n,
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1069
|
+
getActiveElement as o,
|
|
1070
|
+
getSelection as p,
|
|
1071
|
+
IS_FOCUSED as q,
|
|
1072
|
+
EDITOR_TO_USER_SELECTION as r,
|
|
1073
|
+
IS_COMPOSING as s,
|
|
1074
|
+
isDOMElement as t,
|
|
1075
|
+
IS_FIREFOX_LEGACY as u,
|
|
1076
|
+
IS_WECHATBROWSER as v,
|
|
1077
|
+
IS_UC_MOBILE as w,
|
|
1078
|
+
EDITOR_TO_USER_MARKS as x,
|
|
1079
|
+
IS_FIREFOX as y,
|
|
1080
|
+
Hotkeys as z
|
|
1083
1081
|
};
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { defineComponent, provide, ref, computed, onMounted, onUnmounted, renderSlot, inject, h, watch, renderList, Fragment, useAttrs, reactive } from "vue";
|
|
2
2
|
import { i as isObjectLike, b as baseGetTag, S as Symbol$1, a as isArray, d as defineProperty, M as MapCache, c as isArguments, e as arrayPush, g as getPrototype, f as copyObject, h as getAllKeysIn, j as baseClone, N as Node, k as Scrubber, P as Path, E as Editor, R as Range, T as Text, l as Element, m as Transforms } from "./index-CjnPdoJN.js";
|
|
3
|
-
import { D as DOMEditor, E as EDITOR_TO_ON_CHANGE, M as MARK_PLACEHOLDER_SYMBOL, I as IS_ANDROID, a as IS_IOS, b as EDITOR_TO_KEY_TO_ELEMENT, c as ELEMENT_TO_NODE, N as NODE_TO_ELEMENT, d as NODE_TO_INDEX, e as NODE_TO_PARENT, i as isDOMNode, f as
|
|
3
|
+
import { D as DOMEditor, E as EDITOR_TO_ON_CHANGE, M as MARK_PLACEHOLDER_SYMBOL, I as IS_ANDROID, a as IS_IOS, b as EDITOR_TO_KEY_TO_ELEMENT, c as ELEMENT_TO_NODE, N as NODE_TO_ELEMENT, d as NODE_TO_INDEX, e as NODE_TO_PARENT, i as isDOMNode, f as IS_WEBKIT, g as applyStringDiff, h as isDOMSelection, n as normalizeStringDiff, j as IS_READ_ONLY, k as getDefaultView, l as EDITOR_TO_WINDOW, m as EDITOR_TO_ELEMENT, H as HAS_BEFORE_INPUT_SUPPORT, C as CAN_USE_DOM, o as getActiveElement, p as getSelection, q as IS_FOCUSED, r as EDITOR_TO_USER_SELECTION, s as IS_COMPOSING, t as isDOMElement, u as IS_FIREFOX_LEGACY, v as IS_WECHATBROWSER, w as IS_UC_MOBILE, x as EDITOR_TO_USER_MARKS, y as IS_FIREFOX, z as Hotkeys, A as IS_CHROME, B as isPlainTextOnlyPaste } from "./hotkeys-CFtX6lwM.js";
|
|
4
4
|
const SLATE_USE_EDITOR = Symbol("SLATE_USE_EDITOR");
|
|
5
5
|
const SLATE_USE_DECORATE = Symbol("SLATE_USE_DECORATE");
|
|
6
6
|
const SLATE_USE_SELECTED = Symbol("SLATE_USE_SELECTED");
|
|
@@ -556,6 +556,15 @@ const useReadOnly = () => {
|
|
|
556
556
|
}
|
|
557
557
|
return isReadOnly;
|
|
558
558
|
};
|
|
559
|
+
const VOID_CHILDREN_ATTRS = {
|
|
560
|
+
"data-slate-spacer": true,
|
|
561
|
+
style: {
|
|
562
|
+
height: "0",
|
|
563
|
+
color: "transparent",
|
|
564
|
+
outline: "none",
|
|
565
|
+
position: "absolute"
|
|
566
|
+
}
|
|
567
|
+
};
|
|
559
568
|
const ElementComp = defineComponent({
|
|
560
569
|
name: "slate-element",
|
|
561
570
|
props: ["element"],
|
|
@@ -607,8 +616,7 @@ const ElementComp = defineComponent({
|
|
|
607
616
|
};
|
|
608
617
|
if (isInline.value) {
|
|
609
618
|
attr["data-slate-inline"] = true;
|
|
610
|
-
}
|
|
611
|
-
if (!isInline.value && Editor.hasInlines(editor, element)) {
|
|
619
|
+
} else if (Editor.hasInlines(editor, element)) {
|
|
612
620
|
const text = Node.string(element);
|
|
613
621
|
const dir = direction(text);
|
|
614
622
|
if (dir === "rtl") {
|
|
@@ -618,31 +626,20 @@ const ElementComp = defineComponent({
|
|
|
618
626
|
if (Editor.isVoid(editor, element)) {
|
|
619
627
|
attr["data-slate-void"] = true;
|
|
620
628
|
if (!readOnly && isInline.value) {
|
|
621
|
-
attr.
|
|
629
|
+
attr.contenteditable = false;
|
|
622
630
|
}
|
|
623
631
|
}
|
|
624
632
|
return attr;
|
|
625
633
|
});
|
|
626
634
|
const children = computed(() => {
|
|
627
|
-
if (Editor.isVoid(editor, element)) {
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
style: {
|
|
636
|
-
height: "0",
|
|
637
|
-
color: "transparent",
|
|
638
|
-
outline: "none",
|
|
639
|
-
position: "absolute"
|
|
640
|
-
}
|
|
641
|
-
},
|
|
642
|
-
h(TextComp, { element, text })
|
|
643
|
-
);
|
|
644
|
-
}
|
|
645
|
-
return h(Fragment, ChildrenFC(element, editor));
|
|
635
|
+
if (!Editor.isVoid(editor, element)) {
|
|
636
|
+
return h(Fragment, ChildrenFC(element, editor));
|
|
637
|
+
}
|
|
638
|
+
const [[text]] = Node.texts(element);
|
|
639
|
+
NODE_TO_INDEX.set(text, 0);
|
|
640
|
+
NODE_TO_PARENT.set(text, element);
|
|
641
|
+
const tag = isInline.value ? "span" : "div";
|
|
642
|
+
return h(tag, VOID_CHILDREN_ATTRS, h(TextComp, { element, text }));
|
|
646
643
|
});
|
|
647
644
|
const decorate = useDecorate();
|
|
648
645
|
const parentDs = useParentDescoration();
|
|
@@ -831,7 +828,6 @@ const PlaceholderComp = defineComponent({
|
|
|
831
828
|
contenteditable: false,
|
|
832
829
|
onVnodeMounted(vNode) {
|
|
833
830
|
if (vNode.el) {
|
|
834
|
-
EDITOR_TO_PLACEHOLDER_ELEMENT.set(editor, vNode.el);
|
|
835
831
|
placeholderResizeObserver.value = new ResizeObserver(() => {
|
|
836
832
|
var _a, _b;
|
|
837
833
|
props.onPlaceholderResize(
|
|
@@ -843,7 +839,6 @@ const PlaceholderComp = defineComponent({
|
|
|
843
839
|
},
|
|
844
840
|
onVnodeUnmounted() {
|
|
845
841
|
var _a;
|
|
846
|
-
EDITOR_TO_PLACEHOLDER_ELEMENT.delete(editor);
|
|
847
842
|
(_a = placeholderResizeObserver.value) == null ? void 0 : _a.disconnect();
|
|
848
843
|
placeholderResizeObserver.value = void 0;
|
|
849
844
|
props.onPlaceholderResize();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "slate-vue3",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.37",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.js",
|
|
@@ -13,14 +13,26 @@
|
|
|
13
13
|
"exports": {
|
|
14
14
|
".": {
|
|
15
15
|
"import": {
|
|
16
|
-
"types": "./index.d.ts",
|
|
17
|
-
"default": "./index.js"
|
|
16
|
+
"types": "./dist/index.d.ts",
|
|
17
|
+
"default": "./dist/index.js"
|
|
18
18
|
}
|
|
19
19
|
},
|
|
20
|
-
"
|
|
20
|
+
"./core": {
|
|
21
21
|
"import": {
|
|
22
|
-
"types": "
|
|
23
|
-
"default": "
|
|
22
|
+
"types": "./dist/core.d.ts",
|
|
23
|
+
"default": "./dist/core.js"
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
"./dom": {
|
|
27
|
+
"import": {
|
|
28
|
+
"types": "./dist/dom.d.ts",
|
|
29
|
+
"default": "./dist/dom.js"
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
"./history": {
|
|
33
|
+
"import": {
|
|
34
|
+
"types": "./dist/history.d.ts",
|
|
35
|
+
"default": "./dist/history.js"
|
|
24
36
|
}
|
|
25
37
|
}
|
|
26
38
|
},
|
|
@@ -30,7 +42,7 @@
|
|
|
30
42
|
"preview": "vite preview",
|
|
31
43
|
"build-all": "vite build --mode=lib",
|
|
32
44
|
"e2e": "node --no-experimental-strip-types node_modules/@playwright/test/cli.js test",
|
|
33
|
-
"e2e-ui": "playwright test --ui",
|
|
45
|
+
"e2e-ui": "node --no-experimental-strip-types node_modules/@playwright/test/cli.js test --ui",
|
|
34
46
|
"test": "vitest"
|
|
35
47
|
},
|
|
36
48
|
"dependencies": {
|