slate-vue3 0.15.0 → 1.0.0
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.js +2 -2
- package/dist/index.js +2 -2
- package/dist/slate-dom/custom-types.d.ts +2 -0
- package/dist/slate-dom/plugin/dom-editor.d.ts +3 -1
- package/dist/slate-dom/utils/weak-maps.d.ts +1 -0
- package/dist/{slate-dom-Bhp4HdEp.js → slate-dom-CbCA1XcK.js} +54 -17
- package/dist/slate-vue/components/children.d.ts +7 -2
- package/dist/slate-vue/components/chunk.d.ts +12 -3
- package/dist/slate-vue/components/element.d.ts +3 -1
- package/dist/slate-vue/components/placeholder.d.ts +8 -3
- package/dist/slate-vue/components/text.d.ts +2 -2
- package/dist/slate-vue/hooks/use-decorations.d.ts +5 -0
- package/dist/slate-vue/render/chunk.d.ts +0 -4
- package/dist/slate-vue/render/decorate.d.ts +1 -4
- package/dist/slate-vue/render/placeholder.d.ts +1 -19
- package/dist/slate-vue/utils/interface.d.ts +1 -1
- package/dist/{slate-vue-BAUZN2zq.js → slate-vue-C5Tp0KRv.js} +220 -217
- package/dist/yjs.js +2 -2
- package/package.json +1 -1
package/dist/dom.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { $ as
|
|
2
|
-
export { CAN_USE_DOM, DOMEditor, EDITOR_TO_ELEMENT, EDITOR_TO_KEY_TO_ELEMENT, EDITOR_TO_ON_CHANGE, EDITOR_TO_USER_MARKS, EDITOR_TO_USER_SELECTION, EDITOR_TO_WINDOW, ELEMENT_TO_NODE, HAS_BEFORE_INPUT_SUPPORT, Hotkeys, IS_ANDROID, IS_ANDROID_CHROME_LEGACY, IS_APPLE, IS_CHROME, IS_CHROME_LEGACY, IS_COMPOSING, IS_EDGE_LEGACY, IS_FIREFOX, IS_FIREFOX_LEGACY, IS_FOCUSED, IS_IOS, IS_READ_ONLY, IS_SAFARI_LEGACY, IS_UC_MOBILE, IS_WEBKIT, IS_WECHATBROWSER, Key, MARK_PLACEHOLDER_SYMBOL, NODE_TO_ELEMENT, NODE_TO_INDEX, NODE_TO_KEY, NODE_TO_PARENT, applyStringDiff, closestShadowAware, containsShadowAware, getActiveElement, getClipboardData, getDefaultView, getEditableChild, getEditableChildAndIndex, getPlainText, getSelection, getSlateFragmentAttribute, hasShadowRoot, isAfter, isBefore, isDOMComment, isDOMElement, isDOMNode, isDOMSelection, isDOMText, isElementDecorationsEqual, isPlainTextOnlyPaste, isTextDecorationsEqual, isTrackedMutation, normalizeDOMPoint, normalizeStringDiff, shallowCompare, splitDecorationsByChild, withDOM };
|
|
1
|
+
import { $ as getSelection, A as CAN_USE_DOM, B as IS_IOS, C as MARK_PLACEHOLDER_SYMBOL, D as NODE_TO_PARENT, E as NODE_TO_KEY, F as IS_CHROME, G as closestShadowAware, H as IS_UC_MOBILE, I as IS_CHROME_LEGACY, J as getClipboardData, K as containsShadowAware, L as IS_EDGE_LEGACY, M as IS_ANDROID, N as IS_ANDROID_CHROME_LEGACY, O as PLACEHOLDER_SYMBOL, P as IS_APPLE, Q as getPlainText, R as IS_FIREFOX, S as IS_READ_ONLY, T as NODE_TO_INDEX, U as IS_WEBKIT, V as IS_SAFARI_LEGACY, W as IS_WECHATBROWSER, X as getEditableChild, Y as getDefaultView, Z as getEditableChildAndIndex, _ as EDITOR_TO_USER_SELECTION, a as Hotkeys, at as isDOMElement, b as IS_COMPOSING, c as withDOM, ct as isDOMText, dt as normalizeDOMPoint, et as getSlateFragmentAttribute, f as DOMEditor, g as EDITOR_TO_USER_MARKS, h as EDITOR_TO_ON_CHANGE, i as splitDecorationsByChild, it as isDOMComment, j as HAS_BEFORE_INPUT_SUPPORT, k as Key, lt as isPlainTextOnlyPaste, m as EDITOR_TO_KEY_TO_ELEMENT, n as isTextDecorationsEqual, nt as isAfter, o as applyStringDiff, ot as isDOMNode, p as EDITOR_TO_ELEMENT, q as getActiveElement, r as shallowCompare, rt as isBefore, s as normalizeStringDiff, st as isDOMSelection, t as isElementDecorationsEqual, tt as hasShadowRoot, ut as isTrackedMutation, v as EDITOR_TO_WINDOW, w as NODE_TO_ELEMENT, x as IS_FOCUSED, y as ELEMENT_TO_NODE, z as IS_FIREFOX_LEGACY } from "./slate-dom-CbCA1XcK.js";
|
|
2
|
+
export { CAN_USE_DOM, DOMEditor, EDITOR_TO_ELEMENT, EDITOR_TO_KEY_TO_ELEMENT, EDITOR_TO_ON_CHANGE, EDITOR_TO_USER_MARKS, EDITOR_TO_USER_SELECTION, EDITOR_TO_WINDOW, ELEMENT_TO_NODE, HAS_BEFORE_INPUT_SUPPORT, Hotkeys, IS_ANDROID, IS_ANDROID_CHROME_LEGACY, IS_APPLE, IS_CHROME, IS_CHROME_LEGACY, IS_COMPOSING, IS_EDGE_LEGACY, IS_FIREFOX, IS_FIREFOX_LEGACY, IS_FOCUSED, IS_IOS, IS_READ_ONLY, IS_SAFARI_LEGACY, IS_UC_MOBILE, IS_WEBKIT, IS_WECHATBROWSER, Key, MARK_PLACEHOLDER_SYMBOL, NODE_TO_ELEMENT, NODE_TO_INDEX, NODE_TO_KEY, NODE_TO_PARENT, PLACEHOLDER_SYMBOL, applyStringDiff, closestShadowAware, containsShadowAware, getActiveElement, getClipboardData, getDefaultView, getEditableChild, getEditableChildAndIndex, getPlainText, getSelection, getSlateFragmentAttribute, hasShadowRoot, isAfter, isBefore, isDOMComment, isDOMElement, isDOMNode, isDOMSelection, isDOMText, isElementDecorationsEqual, isPlainTextOnlyPaste, isTextDecorationsEqual, isTrackedMutation, normalizeDOMPoint, normalizeStringDiff, shallowCompare, splitDecorationsByChild, withDOM };
|
package/dist/index.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { d as reconcileChildren, l as KEY_TO_CHUNK_TREE, u as getChunkTreeForNode } from "./slate-dom-
|
|
2
|
-
import { C as isEventHandled, D as SLATE_USE_FOCUSED, E as SLATE_USE_ELEMENT, O as SLATE_USE_READ_ONLY, S as isDOMEventTargetInput, T as SLATE_USE_EDITOR, _ as DEFAULT_PLACEHOLDER_RENDER, a as useFocused, b as handleNativeHistoryEvents, c as useReadOnly, d as useEditor, f as Slate, g as DEFAULT_LEAF_RENDER, h as DEFAULT_ELEMENT_RENDER, i as useSelected, k as SLATE_USE_SELECTION, l as useElement, m as DEFAULT_DECORATE_FN, n as useInheritRef, o as Editable, p as DEFAULT_CHUNK_RENDER, r as useSelection, s as useComposing, t as createReactiveEditor, u as useElementIf, v as DEFAULT_SCROLL_INTO_VIEW, w as SLATE_USE_COMPOSING, x as isDOMEventHandled, y as DEFAULT_TEXT_RENDER } from "./slate-vue-
|
|
1
|
+
import { d as reconcileChildren, l as KEY_TO_CHUNK_TREE, u as getChunkTreeForNode } from "./slate-dom-CbCA1XcK.js";
|
|
2
|
+
import { C as isEventHandled, D as SLATE_USE_FOCUSED, E as SLATE_USE_ELEMENT, O as SLATE_USE_READ_ONLY, S as isDOMEventTargetInput, T as SLATE_USE_EDITOR, _ as DEFAULT_PLACEHOLDER_RENDER, a as useFocused, b as handleNativeHistoryEvents, c as useReadOnly, d as useEditor, f as Slate, g as DEFAULT_LEAF_RENDER, h as DEFAULT_ELEMENT_RENDER, i as useSelected, k as SLATE_USE_SELECTION, l as useElement, m as DEFAULT_DECORATE_FN, n as useInheritRef, o as Editable, p as DEFAULT_CHUNK_RENDER, r as useSelection, s as useComposing, t as createReactiveEditor, u as useElementIf, v as DEFAULT_SCROLL_INTO_VIEW, w as SLATE_USE_COMPOSING, x as isDOMEventHandled, y as DEFAULT_TEXT_RENDER } from "./slate-vue-C5Tp0KRv.js";
|
|
3
3
|
export { DEFAULT_CHUNK_RENDER, DEFAULT_DECORATE_FN, DEFAULT_ELEMENT_RENDER, DEFAULT_LEAF_RENDER, DEFAULT_PLACEHOLDER_RENDER, DEFAULT_SCROLL_INTO_VIEW, DEFAULT_TEXT_RENDER, Editable, KEY_TO_CHUNK_TREE, SLATE_USE_COMPOSING, SLATE_USE_EDITOR, SLATE_USE_ELEMENT, SLATE_USE_FOCUSED, SLATE_USE_READ_ONLY, SLATE_USE_SELECTION, Slate, createReactiveEditor, getChunkTreeForNode, handleNativeHistoryEvents, isDOMEventHandled, isDOMEventTargetInput, isEventHandled, reconcileChildren, useComposing, useEditor, useElement, useElementIf, useFocused, useInheritRef, useReadOnly, useSelected, useSelection };
|
|
@@ -34,4 +34,5 @@ export declare const EDITOR_TO_ON_CHANGE: WeakMap<import('slate').BaseEditor, (o
|
|
|
34
34
|
operation?: Operation;
|
|
35
35
|
}) => void>;
|
|
36
36
|
export declare const EDITOR_TO_USER_MARKS: WeakMap<Editor, Partial<Text> | null>;
|
|
37
|
+
export declare const PLACEHOLDER_SYMBOL: string;
|
|
37
38
|
export declare const MARK_PLACEHOLDER_SYMBOL: string;
|
|
@@ -4408,11 +4408,6 @@ var getEditableChildAndIndex = (parent, index, direction) => {
|
|
|
4408
4408
|
index = i;
|
|
4409
4409
|
i += direction === "forward" ? 1 : -1;
|
|
4410
4410
|
}
|
|
4411
|
-
while (child.nodeType === 3 && child.textContent === "") {
|
|
4412
|
-
index += direction === "forward" ? 1 : -1;
|
|
4413
|
-
child = childNodes[index];
|
|
4414
|
-
}
|
|
4415
|
-
if (!child) throw new Error(`Compact on vue3 empty childNode: Failed to find adjacent nodes: ${Scrubber.stringify(child)}`);
|
|
4416
4411
|
return [child, index];
|
|
4417
4412
|
};
|
|
4418
4413
|
/**
|
|
@@ -4598,6 +4593,7 @@ var EDITOR_TO_USER_SELECTION = /* @__PURE__ */ new WeakMap();
|
|
|
4598
4593
|
*/
|
|
4599
4594
|
var EDITOR_TO_ON_CHANGE = /* @__PURE__ */ new WeakMap();
|
|
4600
4595
|
var EDITOR_TO_USER_MARKS = /* @__PURE__ */ new WeakMap();
|
|
4596
|
+
var PLACEHOLDER_SYMBOL = Symbol("placeholder");
|
|
4601
4597
|
var MARK_PLACEHOLDER_SYMBOL = Symbol("mark-placeholder");
|
|
4602
4598
|
//#endregion
|
|
4603
4599
|
//#region packages/slate-dom/plugin/dom-editor.ts
|
|
@@ -4684,9 +4680,16 @@ var DOMEditor = {
|
|
|
4684
4680
|
}
|
|
4685
4681
|
throw new Error(`Unable to find the path for Slate node: ${Scrubber.stringify(node)}`);
|
|
4686
4682
|
},
|
|
4687
|
-
focus: (editor) => {
|
|
4683
|
+
focus: (editor, options = { retries: 5 }) => {
|
|
4688
4684
|
if (IS_FOCUSED.get(editor)) return;
|
|
4689
4685
|
if (!EDITOR_TO_ELEMENT.get(editor)) return;
|
|
4686
|
+
if (options.retries <= 0) throw new Error("Could not set focus, editor seems stuck with pending operations");
|
|
4687
|
+
if (editor.operations.length > 0) {
|
|
4688
|
+
setTimeout(() => {
|
|
4689
|
+
DOMEditor.focus(editor, { retries: options.retries - 1 });
|
|
4690
|
+
}, 10);
|
|
4691
|
+
return;
|
|
4692
|
+
}
|
|
4690
4693
|
const el = DOMEditor.toDOMNode(editor, editor);
|
|
4691
4694
|
const root = DOMEditor.findDocumentOrShadowRoot(editor);
|
|
4692
4695
|
if (root.activeElement !== el) {
|
|
@@ -4812,7 +4815,7 @@ var DOMEditor = {
|
|
|
4812
4815
|
const potentialVoidNode = parentNode.closest("[data-slate-void=\"true\"]");
|
|
4813
4816
|
const voidNode = potentialVoidNode && containsShadowAware(editorEl, potentialVoidNode) ? potentialVoidNode : null;
|
|
4814
4817
|
const potentialNonEditableNode = parentNode.closest("[contenteditable=\"false\"]");
|
|
4815
|
-
const nonEditableNode = potentialNonEditableNode && editorEl
|
|
4818
|
+
const nonEditableNode = potentialNonEditableNode && containsShadowAware(editorEl, potentialNonEditableNode) ? potentialNonEditableNode : null;
|
|
4816
4819
|
let leafNode = parentNode.closest("[data-slate-leaf]");
|
|
4817
4820
|
let domNode = null;
|
|
4818
4821
|
if (leafNode) {
|
|
@@ -4929,14 +4932,48 @@ var DOMEditor = {
|
|
|
4929
4932
|
let isCollapsed;
|
|
4930
4933
|
if (el) {
|
|
4931
4934
|
if (isDOMSelection(domRange)) {
|
|
4932
|
-
|
|
4933
|
-
|
|
4934
|
-
|
|
4935
|
-
|
|
4935
|
+
if (IS_FIREFOX && domRange.rangeCount > 1) {
|
|
4936
|
+
focusNode = domRange.focusNode;
|
|
4937
|
+
const firstRange = domRange.getRangeAt(0);
|
|
4938
|
+
const lastRange = domRange.getRangeAt(domRange.rangeCount - 1);
|
|
4939
|
+
if (focusNode instanceof HTMLTableRowElement && firstRange.startContainer instanceof HTMLTableRowElement && lastRange.startContainer instanceof HTMLTableRowElement) {
|
|
4940
|
+
function getLastChildren(element) {
|
|
4941
|
+
if (element.childElementCount > 0) return getLastChildren(element.children[0]);
|
|
4942
|
+
else return element;
|
|
4943
|
+
}
|
|
4944
|
+
const firstNodeRow = firstRange.startContainer;
|
|
4945
|
+
const lastNodeRow = lastRange.startContainer;
|
|
4946
|
+
const firstNode = getLastChildren(firstNodeRow.children[firstRange.startOffset]);
|
|
4947
|
+
const lastNode = getLastChildren(lastNodeRow.children[lastRange.startOffset]);
|
|
4948
|
+
focusOffset = 0;
|
|
4949
|
+
if (lastNode.childNodes.length > 0) anchorNode = lastNode.childNodes[0];
|
|
4950
|
+
else anchorNode = lastNode;
|
|
4951
|
+
if (firstNode.childNodes.length > 0) focusNode = firstNode.childNodes[0];
|
|
4952
|
+
else focusNode = firstNode;
|
|
4953
|
+
if (lastNode instanceof HTMLElement) anchorOffset = lastNode.innerHTML.length;
|
|
4954
|
+
else anchorOffset = 0;
|
|
4955
|
+
} else if (firstRange.startContainer === focusNode) {
|
|
4956
|
+
anchorNode = lastRange.endContainer;
|
|
4957
|
+
anchorOffset = lastRange.endOffset;
|
|
4958
|
+
focusOffset = firstRange.startOffset;
|
|
4959
|
+
} else {
|
|
4960
|
+
anchorNode = firstRange.startContainer;
|
|
4961
|
+
anchorOffset = firstRange.endOffset;
|
|
4962
|
+
focusOffset = lastRange.startOffset;
|
|
4963
|
+
}
|
|
4964
|
+
} else {
|
|
4965
|
+
anchorNode = domRange.anchorNode;
|
|
4966
|
+
anchorOffset = domRange.anchorOffset;
|
|
4967
|
+
focusNode = domRange.focusNode;
|
|
4968
|
+
focusOffset = domRange.focusOffset;
|
|
4969
|
+
}
|
|
4936
4970
|
if (IS_FIREFOX) {
|
|
4937
|
-
if (
|
|
4938
|
-
|
|
4939
|
-
|
|
4971
|
+
if (anchorNode instanceof HTMLElement && anchorNode?.attributes?.getNamedItem("data-slate-editor")) {
|
|
4972
|
+
if (focusNode instanceof HTMLElement) {
|
|
4973
|
+
const nodeList = Array.from(anchorNode.querySelectorAll("[data-slate-string=\"true\"]")).filter((node) => !node.querySelector("[data-slate-string=\"true\"]"));
|
|
4974
|
+
anchorNode = nodeList[0];
|
|
4975
|
+
focusNode = nodeList[nodeList.length - 1];
|
|
4976
|
+
}
|
|
4940
4977
|
anchorNode = anchorNode?.firstChild;
|
|
4941
4978
|
anchorOffset = 0;
|
|
4942
4979
|
focusNode = focusNode?.lastChild;
|
|
@@ -4954,7 +4991,6 @@ var DOMEditor = {
|
|
|
4954
4991
|
}
|
|
4955
4992
|
}
|
|
4956
4993
|
}
|
|
4957
|
-
if (!anchorNode || !focusNode) return null;
|
|
4958
4994
|
if (IS_CHROME && hasShadowRoot(anchorNode) || IS_FIREFOX) isCollapsed = domRange.anchorNode === domRange.focusNode && domRange.anchorOffset === domRange.focusOffset;
|
|
4959
4995
|
else isCollapsed = domRange.isCollapsed;
|
|
4960
4996
|
} else {
|
|
@@ -6061,7 +6097,7 @@ var shallowCompare = (obj1, obj2) => Object.keys(obj1).length === Object.keys(ob
|
|
|
6061
6097
|
var isDecorationFlagsEqual = (range, other) => {
|
|
6062
6098
|
const { anchor: rangeAnchor, focus: rangeFocus, ...rangeOwnProps } = range;
|
|
6063
6099
|
const { anchor: otherAnchor, focus: otherFocus, ...otherOwnProps } = other;
|
|
6064
|
-
return shallowCompare(rangeOwnProps, otherOwnProps);
|
|
6100
|
+
return range[PLACEHOLDER_SYMBOL] === other[PLACEHOLDER_SYMBOL] && shallowCompare(rangeOwnProps, otherOwnProps);
|
|
6065
6101
|
};
|
|
6066
6102
|
/**
|
|
6067
6103
|
* Check if a list of decorator ranges are equal to another.
|
|
@@ -6073,6 +6109,7 @@ var isDecorationFlagsEqual = (range, other) => {
|
|
|
6073
6109
|
var isElementDecorationsEqual = (list, another) => {
|
|
6074
6110
|
if (list === another) return true;
|
|
6075
6111
|
if (!list || !another) return false;
|
|
6112
|
+
if (list.length !== another.length) return false;
|
|
6076
6113
|
for (let i = 0; i < list.length; i++) {
|
|
6077
6114
|
const range = list[i];
|
|
6078
6115
|
const other = another[i];
|
|
@@ -6140,4 +6177,4 @@ var splitDecorationsByChild = (editor, node, decorations) => {
|
|
|
6140
6177
|
return decorationsByChild;
|
|
6141
6178
|
};
|
|
6142
6179
|
//#endregion
|
|
6143
|
-
export {
|
|
6180
|
+
export { getSelection as $, isEmpty as $t, CAN_USE_DOM as A, removeNodes as An, deleteFragment as At, IS_IOS as B, string as Bn, getVoid as Bt, MARK_PLACEHOLDER_SYMBOL as C, pointRefs as Cn, after as Ct, NODE_TO_PARENT as D, rangeRef as Dn, createEditor as Dt, NODE_TO_KEY as E, range as En, collapse as Et, IS_CHROME as F, setSelection as Fn, end as Ft, closestShadowAware as G, wrapNodes as Gn, insertBreak as Gt, IS_UC_MOBILE as H, unsetNodes as Hn, hasInlines as Ht, IS_CHROME_LEGACY as I, shouldMergeNodesRemovePrevNode as In, first as It, getClipboardData as J, insertNodes as Jt, containsShadowAware as K, insertFragment as Kt, IS_EDGE_LEGACY as L, shouldNormalize as Ln, fragment as Lt, IS_ANDROID as M, setNodes as Mn, deselect as Mt, IS_ANDROID_CHROME_LEGACY as N, setNormalizing as Nn, edges as Nt, PLACEHOLDER_SYMBOL as O, rangeRefs as On, deleteBackward as Ot, IS_APPLE as P, setPoint as Pn, elementReadOnly as Pt, getPlainText as Q, isEdge as Qt, IS_FIREFOX as R, splitNodes as Rn, getDirtyPaths as Rt, IS_READ_ONLY as S, pointRef as Sn, addMark as St, NODE_TO_INDEX as T, previous as Tn, before as Tt, IS_WEBKIT as U, unwrapNodes as Un, hasPath as Ut, IS_SAFARI_LEGACY as V, unhangRange as Vn, hasBlocks as Vt, IS_WECHATBROWSER as W, withoutNormalizing as Wn, hasTexts as Wt, getEditableChild as X, insertText as Xt, getDefaultView as Y, insertSoftBreak as Yt, getEditableChildAndIndex as Z, isBlock as Zt, EDITOR_TO_USER_SELECTION as _, parent as _n, Range as _t, Hotkeys as a, leaf as an, isDOMElement as at, IS_COMPOSING as b, pathRefs as bn, Transforms as bt, withDOM as c, marks as cn, isDOMText as ct, reconcileChildren as d, moveNodes as dn, normalizeDOMPoint as dt, isEnd as en, getSlateFragmentAttribute as et, DOMEditor as f, next as fn, Editor as ft, EDITOR_TO_USER_MARKS as g, normalizeNode as gn, Path as gt, EDITOR_TO_ON_CHANGE as h, normalize as hn, Node as ht, splitDecorationsByChild as i, last as in, isDOMComment as it, HAS_BEFORE_INPUT_SUPPORT as j, select as jn, deleteText as jt, Key as k, removeMark as kn, deleteForward as kt, KEY_TO_CHUNK_TREE as l, mergeNodes as ln, isPlainTextOnlyPaste as lt, EDITOR_TO_KEY_TO_ELEMENT as m, nodes as mn, Location as mt, isTextDecorationsEqual as n, isObject as nn, isAfter as nt, applyStringDiff as o, levels as on, isDOMNode as ot, EDITOR_TO_ELEMENT as p, node as pn, Element as pt, getActiveElement as q, insertNode as qt, shallowCompare as r, isStart as rn, isBefore as rt, normalizeStringDiff as s, liftNodes as sn, isDOMSelection as st, isElementDecorationsEqual as t, isNormalizing as tn, hasShadowRoot as tt, getChunkTreeForNode as u, move as un, isTrackedMutation as ut, EDITOR_TO_WINDOW as v, path as vn, Scrubber as vt, NODE_TO_ELEMENT as w, positions as wn, apply as wt, IS_FOCUSED as x, point as xn, above as xt, ELEMENT_TO_NODE as y, pathRef as yn, Text as yt, IS_FIREFOX_LEGACY as z, start as zn, getFragment as zt };
|
|
@@ -1,9 +1,14 @@
|
|
|
1
|
-
import { Ancestor } from 'slate';
|
|
1
|
+
import { Ancestor, DecoratedRange } from 'slate';
|
|
2
|
+
import { VNode } from 'vue';
|
|
2
3
|
/**
|
|
3
4
|
* Children.
|
|
4
5
|
*/
|
|
5
6
|
export declare const ChildrenComp: import('vue').DefineComponent<{
|
|
6
7
|
element: Ancestor;
|
|
7
|
-
|
|
8
|
+
decorations: DecoratedRange[];
|
|
9
|
+
}, () => VNode<import('vue').RendererNode, import('vue').RendererElement, {
|
|
10
|
+
[key: string]: any;
|
|
11
|
+
}> | import('vue').VNodeChild[], {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<{
|
|
8
12
|
element: Ancestor;
|
|
13
|
+
decorations: DecoratedRange[];
|
|
9
14
|
}> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
|
|
@@ -1,4 +1,13 @@
|
|
|
1
1
|
import { VNode } from 'vue';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
2
|
+
import { ChunkAncestor, ChunkTree } from '../chunking';
|
|
3
|
+
import { Key } from '../../slate-dom/index.ts';
|
|
4
|
+
import { Element } from 'slate';
|
|
5
|
+
export declare const ChunkComp: import('vue').DefineComponent<{
|
|
6
|
+
root: ChunkTree;
|
|
7
|
+
ancestor: ChunkAncestor;
|
|
8
|
+
renderElement: (node: Element, index: number, key: Key) => VNode;
|
|
9
|
+
}, () => import('vue').VNodeChild[], {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<{
|
|
10
|
+
root: ChunkTree;
|
|
11
|
+
ancestor: ChunkAncestor;
|
|
12
|
+
renderElement: (node: Element, index: number, key: Key) => VNode;
|
|
13
|
+
}> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
import { Element } from 'slate';
|
|
1
|
+
import { DecoratedRange, Element } from 'slate';
|
|
2
2
|
export declare const ElementComp: import('vue').DefineComponent<{
|
|
3
3
|
element: Element;
|
|
4
|
+
decorations: DecoratedRange[];
|
|
4
5
|
}, () => import('vue').VNode<import('vue').RendererNode, import('vue').RendererElement, {
|
|
5
6
|
[key: string]: any;
|
|
6
7
|
}>, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<{
|
|
7
8
|
element: Element;
|
|
9
|
+
decorations: DecoratedRange[];
|
|
8
10
|
}> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
|
|
@@ -1,4 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
export declare const PlaceholderComp: import('vue').DefineComponent<{
|
|
2
|
+
placeholder?: string | undefined;
|
|
3
|
+
onPlaceholderResize?: ((height?: number) => void) | undefined;
|
|
4
|
+
}, () => import('vue').VNode<import('vue').RendererNode, import('vue').RendererElement, {
|
|
3
5
|
[key: string]: any;
|
|
4
|
-
}>, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<{
|
|
6
|
+
}>, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<{
|
|
7
|
+
placeholder?: string | undefined;
|
|
8
|
+
onPlaceholderResize?: ((height?: number) => void) | undefined;
|
|
9
|
+
}> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
|
|
@@ -2,11 +2,11 @@ import { Text, DecoratedRange } from 'slate';
|
|
|
2
2
|
export declare const TextComp: import('vue').DefineComponent<{
|
|
3
3
|
text: Text;
|
|
4
4
|
isLast: boolean;
|
|
5
|
-
|
|
5
|
+
decorations: DecoratedRange[];
|
|
6
6
|
}, () => import('vue').VNode<import('vue').RendererNode, import('vue').RendererElement, {
|
|
7
7
|
[key: string]: any;
|
|
8
8
|
}>, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<{
|
|
9
9
|
text: Text;
|
|
10
10
|
isLast: boolean;
|
|
11
|
-
|
|
11
|
+
decorations: DecoratedRange[];
|
|
12
12
|
}> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
|
|
@@ -1,9 +1,5 @@
|
|
|
1
1
|
import { VNode } from 'vue';
|
|
2
2
|
import { RenderChunkProps } from '../utils/interface';
|
|
3
|
-
import { ChunkTree } from '../chunking';
|
|
4
|
-
export declare const SLATE_INNER_STATIC_CHUNK_ROOT: unique symbol;
|
|
5
|
-
export declare const provideChunkRoot: (chunkRoot: ChunkTree) => void;
|
|
6
|
-
export declare const useChunkRoot: () => ChunkTree;
|
|
7
3
|
export declare const SLATE_INNER_RENDER_CHUNK: unique symbol;
|
|
8
4
|
export declare const provideRenderChunk: (fn: (props: RenderChunkProps) => VNode) => void;
|
|
9
5
|
export declare const useRenderChunk: () => (props: RenderChunkProps) => VNode;
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
import { DecoratedRange,
|
|
2
|
-
import { DOMEditor } from '../../slate-dom/index.ts';
|
|
1
|
+
import { DecoratedRange, NodeEntry } from 'slate';
|
|
3
2
|
export declare const SLATE_INNER_RENDER_DECORATE_FN: unique symbol;
|
|
4
3
|
export declare const provideDecorateFn: (fn: (entry: NodeEntry) => DecoratedRange[]) => void;
|
|
5
4
|
export declare const injectDecorateFn: () => ((entry: NodeEntry) => DecoratedRange[]);
|
|
6
|
-
export declare const SLATE_INNER_RENDER_DECORATE_RANGE: unique symbol;
|
|
7
|
-
export declare const getElementDR: (element: Element, editor: DOMEditor, decorate: (entry: NodeEntry) => DecoratedRange[]) => DecoratedRange[];
|
|
@@ -1,23 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { ComputedRef, VNode } from 'vue';
|
|
1
|
+
import { VNode } from 'vue';
|
|
3
2
|
import { RenderPlaceholderProps } from '../utils/interface';
|
|
4
|
-
export declare const SLATE_INNER_PLACEHOLDER: unique symbol;
|
|
5
|
-
export declare const providePlaceholder: (placeholder: ComputedRef<string>) => void;
|
|
6
|
-
export declare const usePlaceholder: () => ComputedRef<string>;
|
|
7
|
-
type MarkPlaceholder = ComputedRef<{
|
|
8
|
-
anchor: BasePoint;
|
|
9
|
-
focus: BasePoint;
|
|
10
|
-
} | null>;
|
|
11
|
-
export declare const SLATE_INNER_MARK_PLACEHOLDER: unique symbol;
|
|
12
|
-
export declare const provideMarkPlaceholder: (markPlaceholder: MarkPlaceholder) => void;
|
|
13
|
-
export declare const useMarkPlaceholder: () => MarkPlaceholder;
|
|
14
|
-
export declare const SLATE_INNER_PLACEHOLDER_SHOW: unique symbol;
|
|
15
|
-
export declare const providePlaceholderShow: (show: ComputedRef<boolean>) => void;
|
|
16
|
-
export declare const usePlaceholderShow: () => () => boolean;
|
|
17
|
-
export declare const SLATE_INNER_PLACEHOLDER_RESIZE: unique symbol;
|
|
18
|
-
export declare const providePlaceholderResize: (fn: (height?: number) => void) => void;
|
|
19
|
-
export declare const usePlaceholderResize: () => (height?: number) => void;
|
|
20
3
|
export declare const SLATE_INNER_RENDER_PLACEHOLDER: unique symbol;
|
|
21
4
|
export declare const provideRenderPlaceholder: (fn: (props: RenderPlaceholderProps) => VNode) => void;
|
|
22
5
|
export declare const useRenderPlaceholder: () => (props: RenderPlaceholderProps) => VNode;
|
|
23
|
-
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { $t as
|
|
2
|
-
import { computed, defineComponent, h, inject, onMounted, onUnmounted, onUpdated, provide,
|
|
1
|
+
import { $ as getSelection, $t as isEmpty, A as CAN_USE_DOM, An as removeNodes, At as deleteFragment, B as IS_IOS, Bn as string, Bt as getVoid, C as MARK_PLACEHOLDER_SYMBOL, Cn as pointRefs, Ct as after, D as NODE_TO_PARENT, Dn as rangeRef, Dt as createEditor, En as range, Et as collapse, F as IS_CHROME, Fn as setSelection, Ft as end, Gn as wrapNodes, Gt as insertBreak, H as IS_UC_MOBILE, Hn as unsetNodes, Ht as hasInlines, In as shouldMergeNodesRemovePrevNode, It as first, Jt as insertNodes, K as containsShadowAware, Kt as insertFragment, Ln as shouldNormalize, Lt as fragment, M as IS_ANDROID, Mn as setNodes, Mt as deselect, Nn as setNormalizing, Nt as edges, O as PLACEHOLDER_SYMBOL, On as rangeRefs, Ot as deleteBackward, Pn as setPoint, Pt as elementReadOnly, Qt as isEdge, R as IS_FIREFOX, Rn as splitNodes, Rt as getDirtyPaths, S as IS_READ_ONLY, Sn as pointRef, St as addMark, T as NODE_TO_INDEX, Tn as previous, Tt as before, U as IS_WEBKIT, Un as unwrapNodes, Ut as hasPath, Vn as unhangRange, Vt as hasBlocks, W as IS_WECHATBROWSER, Wn as withoutNormalizing, Wt as hasTexts, Xt as insertText, Y as getDefaultView, Yt as insertSoftBreak, Zt as isBlock, _ as EDITOR_TO_USER_SELECTION, _n as parent, _t as Range, a as Hotkeys, an as leaf, at as isDOMElement, b as IS_COMPOSING, bn as pathRefs, bt as Transforms, c as withDOM, cn as marks, dn as moveNodes, en as isEnd, f as DOMEditor, fn as next, ft as Editor, g as EDITOR_TO_USER_MARKS, gn as normalizeNode, gt as Path, h as EDITOR_TO_ON_CHANGE, hn as normalize, ht as Node, i as splitDecorationsByChild, in as last, j as HAS_BEFORE_INPUT_SUPPORT, jn as select, jt as deleteText, kn as removeMark, kt as deleteForward, ln as mergeNodes, lt as isPlainTextOnlyPaste, m as EDITOR_TO_KEY_TO_ELEMENT, mn as nodes, n as isTextDecorationsEqual, o as applyStringDiff, on as levels, ot as isDOMNode, p as EDITOR_TO_ELEMENT, pn as node, pt as Element, q as getActiveElement, qt as insertNode, rn as isStart, s as normalizeStringDiff, sn as liftNodes, st as isDOMSelection, t as isElementDecorationsEqual, tn as isNormalizing, u as getChunkTreeForNode, un as move, v as EDITOR_TO_WINDOW, vn as path, vt as Scrubber, w as NODE_TO_ELEMENT, wn as positions, wt as apply, x as IS_FOCUSED, xn as point, xt as above, y as ELEMENT_TO_NODE, yn as pathRef, yt as Text, z as IS_FIREFOX_LEGACY, zn as start, zt as getFragment } from "./slate-dom-CbCA1XcK.js";
|
|
2
|
+
import { computed, defineComponent, h, inject, onMounted, onScopeDispose, onUnmounted, onUpdated, provide, ref, renderList, renderSlot, shallowReactive, shallowRef, toRaw, useAttrs, watch, watchEffect } from "vue";
|
|
3
3
|
//#region packages/slate-vue/utils/constants.ts
|
|
4
4
|
var SLATE_USE_EDITOR = Symbol("SLATE_USE_EDITOR");
|
|
5
5
|
var SLATE_USE_ELEMENT = Symbol("SLATE_USE_ELEMENT");
|
|
@@ -188,10 +188,6 @@ var injectDecorateFn = () => {
|
|
|
188
188
|
if (decorate === void 0) throw new Error(`The \`injectDecorateFn\` hook must be used inside the <Slate> component's context.`);
|
|
189
189
|
return decorate;
|
|
190
190
|
};
|
|
191
|
-
var getElementDR = (element, editor, decorate) => {
|
|
192
|
-
if (!(decorate !== DEFAULT_DECORATE_FN)) return [];
|
|
193
|
-
return decorate([element, DOMEditor.findPath(editor, element)]);
|
|
194
|
-
};
|
|
195
191
|
//#endregion
|
|
196
192
|
//#region packages/slate-vue/render/fn.ts
|
|
197
193
|
var SLATE_INNER_RENDER_ELEMENT = Symbol("SLATE_INNER_RENDER_ELEMENT");
|
|
@@ -226,42 +222,6 @@ var useEditorVersion = () => {
|
|
|
226
222
|
};
|
|
227
223
|
//#endregion
|
|
228
224
|
//#region packages/slate-vue/render/placeholder.ts
|
|
229
|
-
var SLATE_INNER_PLACEHOLDER = Symbol("SLATE_INNER_PLACEHOLDER");
|
|
230
|
-
var providePlaceholder = (placeholder) => {
|
|
231
|
-
provide(SLATE_INNER_PLACEHOLDER, placeholder);
|
|
232
|
-
};
|
|
233
|
-
var usePlaceholder = () => {
|
|
234
|
-
const PLACEHOLDER_INJECT = inject(SLATE_INNER_PLACEHOLDER);
|
|
235
|
-
if (PLACEHOLDER_INJECT === void 0) throw new Error(`The \`usePlaceholder\` hook must be used inside the <Slate> component's context.`);
|
|
236
|
-
return PLACEHOLDER_INJECT;
|
|
237
|
-
};
|
|
238
|
-
var SLATE_INNER_MARK_PLACEHOLDER = Symbol("SLATE_INNER_MARK_PLACEHOLDER");
|
|
239
|
-
var provideMarkPlaceholder = (markPlaceholder) => {
|
|
240
|
-
provide(SLATE_INNER_MARK_PLACEHOLDER, markPlaceholder);
|
|
241
|
-
};
|
|
242
|
-
var useMarkPlaceholder = () => {
|
|
243
|
-
const MARK_PLACEHOLDER_INJECT = inject(SLATE_INNER_MARK_PLACEHOLDER);
|
|
244
|
-
if (MARK_PLACEHOLDER_INJECT === void 0) throw new Error(`The \`useMarkPlaceholder\` hook must be used inside the <Slate> component's context.`);
|
|
245
|
-
return MARK_PLACEHOLDER_INJECT;
|
|
246
|
-
};
|
|
247
|
-
var SLATE_INNER_PLACEHOLDER_SHOW = Symbol("SLATE_INNER_PLACEHOLDER_SHOW");
|
|
248
|
-
var providePlaceholderShow = (show) => {
|
|
249
|
-
provide(SLATE_INNER_PLACEHOLDER_SHOW, () => show.value);
|
|
250
|
-
};
|
|
251
|
-
var usePlaceholderShow = () => {
|
|
252
|
-
const PLACEHOLDER_SHOW_INJECT = inject(SLATE_INNER_PLACEHOLDER_SHOW);
|
|
253
|
-
if (PLACEHOLDER_SHOW_INJECT === void 0) throw new Error(`The \`usePlaceholderShow\` hook must be used inside the <Slate> component's context.`);
|
|
254
|
-
return PLACEHOLDER_SHOW_INJECT;
|
|
255
|
-
};
|
|
256
|
-
var SLATE_INNER_PLACEHOLDER_RESIZE = Symbol("SLATE_INNER_PLACEHOLDER_RESIZE");
|
|
257
|
-
var providePlaceholderResize = (fn) => {
|
|
258
|
-
provide(SLATE_INNER_PLACEHOLDER_RESIZE, fn);
|
|
259
|
-
};
|
|
260
|
-
var usePlaceholderResize = () => {
|
|
261
|
-
const PLACEHOLDER_RESIZE_INJECT = inject(SLATE_INNER_PLACEHOLDER_RESIZE);
|
|
262
|
-
if (PLACEHOLDER_RESIZE_INJECT === void 0) throw new Error(`The \`usePlaceholderResize\` hook must be used inside the <Slate> component's context.`);
|
|
263
|
-
return PLACEHOLDER_RESIZE_INJECT;
|
|
264
|
-
};
|
|
265
225
|
var SLATE_INNER_RENDER_PLACEHOLDER = Symbol("SLATE_INNER_RENDER_PLACEHOLDER");
|
|
266
226
|
var provideRenderPlaceholder = (fn) => provide(SLATE_INNER_RENDER_PLACEHOLDER, fn);
|
|
267
227
|
var useRenderPlaceholder = () => {
|
|
@@ -271,10 +231,6 @@ var useRenderPlaceholder = () => {
|
|
|
271
231
|
};
|
|
272
232
|
//#endregion
|
|
273
233
|
//#region packages/slate-vue/render/chunk.ts
|
|
274
|
-
var SLATE_INNER_STATIC_CHUNK_ROOT = Symbol("SLATE_INNER_STATIC_CHUNK_ROOT");
|
|
275
|
-
var provideChunkRoot = (chunkRoot) => {
|
|
276
|
-
provide(SLATE_INNER_STATIC_CHUNK_ROOT, chunkRoot);
|
|
277
|
-
};
|
|
278
234
|
var SLATE_INNER_RENDER_CHUNK = Symbol("SLATE_INNER_RENDER_CHUNK");
|
|
279
235
|
var provideRenderChunk = (fn) => provide(SLATE_INNER_RENDER_CHUNK, fn);
|
|
280
236
|
var useRenderChunk = () => {
|
|
@@ -340,24 +296,6 @@ var Slate = defineComponent({
|
|
|
340
296
|
const focusCb = () => isFocus.value = DOMEditor.isFocused(editor);
|
|
341
297
|
const editorVersion = ref(0);
|
|
342
298
|
provideEditorVersion(editorVersion);
|
|
343
|
-
provideMarkPlaceholder(computed(() => {
|
|
344
|
-
if (editor.selection && Range.isCollapsed(editor.selection) && editor.marks) {
|
|
345
|
-
const anchor = editor.selection.anchor;
|
|
346
|
-
const leaf = Node.leaf(editor, anchor.path);
|
|
347
|
-
const { text, ...rest } = leaf;
|
|
348
|
-
if (!Text.equals(leaf, editor.marks, { loose: true })) {
|
|
349
|
-
const unset = Object.fromEntries(Object.keys(rest).map((mark) => [mark, null]));
|
|
350
|
-
return {
|
|
351
|
-
[MARK_PLACEHOLDER_SYMBOL]: true,
|
|
352
|
-
...unset,
|
|
353
|
-
...editor.marks,
|
|
354
|
-
anchor,
|
|
355
|
-
focus: anchor
|
|
356
|
-
};
|
|
357
|
-
}
|
|
358
|
-
}
|
|
359
|
-
return null;
|
|
360
|
-
}));
|
|
361
299
|
onMounted(() => {
|
|
362
300
|
document.addEventListener("focusin", focusCb);
|
|
363
301
|
document.addEventListener("focusout", focusCb);
|
|
@@ -403,6 +341,31 @@ var useEditor = () => {
|
|
|
403
341
|
return editor;
|
|
404
342
|
};
|
|
405
343
|
//#endregion
|
|
344
|
+
//#region packages/slate-vue/hooks/use-decorations.ts
|
|
345
|
+
var useDecorations = (getNode) => {
|
|
346
|
+
const editor = useEditor();
|
|
347
|
+
const decorate = injectDecorateFn();
|
|
348
|
+
const decorations = shallowRef([]);
|
|
349
|
+
const update = () => {
|
|
350
|
+
const node = getNode();
|
|
351
|
+
try {
|
|
352
|
+
const equalityFn = Node.isText(node) ? isTextDecorationsEqual : isElementDecorationsEqual;
|
|
353
|
+
const path = DOMEditor.findPath(editor, node);
|
|
354
|
+
const newDecorations = decorate([node, path]);
|
|
355
|
+
if (equalityFn(decorations.value, newDecorations)) return;
|
|
356
|
+
decorations.value = newDecorations;
|
|
357
|
+
} catch (err) {
|
|
358
|
+
console.log(err);
|
|
359
|
+
}
|
|
360
|
+
};
|
|
361
|
+
const stop = watchEffect(update);
|
|
362
|
+
onScopeDispose(stop);
|
|
363
|
+
return {
|
|
364
|
+
decorations,
|
|
365
|
+
update
|
|
366
|
+
};
|
|
367
|
+
};
|
|
368
|
+
//#endregion
|
|
406
369
|
//#region packages/slate-vue/hooks/use-element.ts
|
|
407
370
|
/**
|
|
408
371
|
* Get the current element.
|
|
@@ -484,31 +447,30 @@ var style = {
|
|
|
484
447
|
};
|
|
485
448
|
var PlaceholderComp = defineComponent({
|
|
486
449
|
name: "slate-placeholder",
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
const onPlaceholderResize = usePlaceholderResize();
|
|
450
|
+
props: ["placeholder", "onPlaceholderResize"],
|
|
451
|
+
setup(props) {
|
|
490
452
|
const placeholderResizeObserver = ref();
|
|
453
|
+
const placeholderRef = ref();
|
|
454
|
+
onMounted(() => {
|
|
455
|
+
placeholderResizeObserver.value = new ResizeObserver(() => {
|
|
456
|
+
props.onPlaceholderResize?.(placeholderRef.value?.getBoundingClientRect()?.height);
|
|
457
|
+
});
|
|
458
|
+
placeholderResizeObserver.value.observe(placeholderRef.value);
|
|
459
|
+
});
|
|
460
|
+
onUnmounted(() => {
|
|
461
|
+
placeholderResizeObserver.value?.disconnect();
|
|
462
|
+
placeholderResizeObserver.value = void 0;
|
|
463
|
+
props.onPlaceholderResize?.();
|
|
464
|
+
});
|
|
491
465
|
const attributes = computed(() => ({
|
|
492
466
|
"data-slate-placeholder": true,
|
|
493
467
|
style,
|
|
494
468
|
contenteditable: false,
|
|
495
|
-
|
|
496
|
-
if (vNode.el) {
|
|
497
|
-
placeholderResizeObserver.value = new ResizeObserver(() => {
|
|
498
|
-
onPlaceholderResize(vNode.el?.getBoundingClientRect()?.height);
|
|
499
|
-
});
|
|
500
|
-
placeholderResizeObserver.value.observe(vNode.el);
|
|
501
|
-
}
|
|
502
|
-
},
|
|
503
|
-
onVnodeUnmounted() {
|
|
504
|
-
placeholderResizeObserver.value?.disconnect();
|
|
505
|
-
placeholderResizeObserver.value = void 0;
|
|
506
|
-
onPlaceholderResize();
|
|
507
|
-
}
|
|
469
|
+
ref: placeholderRef
|
|
508
470
|
}));
|
|
509
471
|
const renderPlaceholder = useRenderPlaceholder();
|
|
510
472
|
return () => renderPlaceholder({
|
|
511
|
-
children: placeholder
|
|
473
|
+
children: props.placeholder,
|
|
512
474
|
attributes: attributes.value
|
|
513
475
|
});
|
|
514
476
|
}
|
|
@@ -525,17 +487,20 @@ var LeafComp = defineComponent({
|
|
|
525
487
|
],
|
|
526
488
|
setup(props) {
|
|
527
489
|
const renderLeaf = useRenderLeaf();
|
|
528
|
-
const showPlaceholder =
|
|
490
|
+
const showPlaceholder = computed(() => props.leaf[PLACEHOLDER_SYMBOL]);
|
|
529
491
|
return () => renderLeaf({
|
|
530
492
|
text: props.text,
|
|
531
493
|
leaf: props.leaf,
|
|
532
494
|
leafPosition: props.leafPosition,
|
|
533
495
|
attributes: { "data-slate-leaf": true },
|
|
534
|
-
children: showPlaceholder
|
|
496
|
+
children: showPlaceholder.value ? [h(StringComp, {
|
|
535
497
|
text: props.text,
|
|
536
498
|
leaf: props.leaf,
|
|
537
499
|
isLast: true
|
|
538
|
-
}), h(PlaceholderComp
|
|
500
|
+
}), h(PlaceholderComp, {
|
|
501
|
+
placeholder: props.leaf.placeholder,
|
|
502
|
+
onPlaceholderResize: props.leaf.onPlaceholderResize
|
|
503
|
+
})] : h(StringComp, {
|
|
539
504
|
text: props.text,
|
|
540
505
|
leaf: props.leaf,
|
|
541
506
|
isLast: props.isLast
|
|
@@ -550,66 +515,40 @@ var TextComp = defineComponent({
|
|
|
550
515
|
props: [
|
|
551
516
|
"text",
|
|
552
517
|
"isLast",
|
|
553
|
-
"
|
|
518
|
+
"decorations"
|
|
554
519
|
],
|
|
555
520
|
setup(props) {
|
|
556
521
|
const editor = useEditor();
|
|
557
522
|
const textRef = ref();
|
|
558
|
-
const decorate = injectDecorateFn();
|
|
559
|
-
const needDecorate = decorate !== DEFAULT_DECORATE_FN;
|
|
560
|
-
onUnmounted(() => {
|
|
561
|
-
NODE_TO_ELEMENT.delete(props.text);
|
|
562
|
-
if (textRef.value) ELEMENT_TO_NODE.delete(textRef.value);
|
|
563
|
-
});
|
|
564
523
|
const renderText = useRenderText();
|
|
565
524
|
const renderTextAttributes = {
|
|
566
525
|
"data-slate-node": "text",
|
|
567
526
|
ref: textRef
|
|
568
527
|
};
|
|
569
|
-
if (!needDecorate) return () => {
|
|
570
|
-
const KEY_TO_ELEMENT = EDITOR_TO_KEY_TO_ELEMENT.get(editor);
|
|
571
|
-
if (textRef.value) {
|
|
572
|
-
KEY_TO_ELEMENT?.set(DOMEditor.findKey(editor, props.text), textRef.value);
|
|
573
|
-
ELEMENT_TO_NODE.set(textRef.value, props.text);
|
|
574
|
-
NODE_TO_ELEMENT.set(props.text, textRef.value);
|
|
575
|
-
}
|
|
576
|
-
return renderText({
|
|
577
|
-
text: props.text,
|
|
578
|
-
attributes: renderTextAttributes,
|
|
579
|
-
children: [h(LeafComp, {
|
|
580
|
-
text: props.text,
|
|
581
|
-
leaf: props.text,
|
|
582
|
-
isLast: props.isLast
|
|
583
|
-
})]
|
|
584
|
-
});
|
|
585
|
-
};
|
|
586
|
-
const markPlaceholder = useMarkPlaceholder();
|
|
587
528
|
const editorVersion = useEditorVersion();
|
|
588
|
-
|
|
589
|
-
|
|
529
|
+
const KEY_TO_ELEMENT = EDITOR_TO_KEY_TO_ELEMENT.get(editor);
|
|
530
|
+
const { decorations, update } = useDecorations(() => props.text);
|
|
531
|
+
onUpdated(() => {
|
|
532
|
+
editorVersion.value++;
|
|
533
|
+
update();
|
|
534
|
+
});
|
|
535
|
+
const decoratedLeaves = computed(() => Text.decorations(props.text, [...props.decorations, ...decorations.value]));
|
|
590
536
|
return () => {
|
|
591
|
-
const
|
|
592
|
-
if (textRef.value) {
|
|
593
|
-
KEY_TO_ELEMENT
|
|
537
|
+
const key = DOMEditor.findKey(editor, props.text);
|
|
538
|
+
if (textRef.value && KEY_TO_ELEMENT) {
|
|
539
|
+
KEY_TO_ELEMENT.set(key, textRef.value);
|
|
594
540
|
ELEMENT_TO_NODE.set(textRef.value, props.text);
|
|
595
541
|
NODE_TO_ELEMENT.set(props.text, textRef.value);
|
|
596
542
|
}
|
|
597
|
-
const textPath = DOMEditor.findPath(editor, props.text);
|
|
598
|
-
const textDs = decorate([props.text, textPath]);
|
|
599
|
-
const range = Editor.range(editor, textPath);
|
|
600
|
-
for (const dr of props.elementDR) textDs.push(Range.intersection(dr, range));
|
|
601
|
-
if (markPlaceholder.value) textDs.unshift(markPlaceholder.value);
|
|
602
|
-
const filterDs = textDs.filter(Boolean);
|
|
603
|
-
const leaves = Text.decorations(props.text, filterDs.length ? filterDs : []);
|
|
604
543
|
return renderText({
|
|
605
544
|
text: props.text,
|
|
606
545
|
attributes: renderTextAttributes,
|
|
607
|
-
children: renderList(
|
|
546
|
+
children: renderList(decoratedLeaves.value, (leaf, i) => h(LeafComp, {
|
|
608
547
|
text: props.text,
|
|
609
548
|
leaf: leaf.leaf,
|
|
610
|
-
isLast: props.isLast && i ===
|
|
549
|
+
isLast: props.isLast && i === decoratedLeaves.value.length - 1,
|
|
611
550
|
leafPosition: leaf.position,
|
|
612
|
-
key:
|
|
551
|
+
key: `${props.text.text}-${leaf.position?.end}-${leaf.position?.start}`
|
|
613
552
|
}))
|
|
614
553
|
});
|
|
615
554
|
};
|
|
@@ -638,7 +577,7 @@ var VOID_CHILDREN_ATTRS = {
|
|
|
638
577
|
};
|
|
639
578
|
var ElementComp = defineComponent({
|
|
640
579
|
name: "slate-element",
|
|
641
|
-
props: ["element"],
|
|
580
|
+
props: ["element", "decorations"],
|
|
642
581
|
setup(props) {
|
|
643
582
|
const editor = useEditor();
|
|
644
583
|
provide(SLATE_USE_ELEMENT, props.element);
|
|
@@ -652,6 +591,9 @@ var ElementComp = defineComponent({
|
|
|
652
591
|
if (nodes[lastIndex].nodeType === 3 && nodes[lastIndex].textContent !== "") nodes[lastIndex].textContent = "";
|
|
653
592
|
});
|
|
654
593
|
const renderElement = useRenderElement();
|
|
594
|
+
const { decorations, update } = useDecorations(() => props.element);
|
|
595
|
+
onUpdated(update);
|
|
596
|
+
const decorationsProps = computed(() => [...props.decorations, ...decorations.value]);
|
|
655
597
|
return () => {
|
|
656
598
|
const isInline = editor.isInline(props.element);
|
|
657
599
|
const [[text]] = Node.texts(props.element);
|
|
@@ -685,14 +627,17 @@ var ElementComp = defineComponent({
|
|
|
685
627
|
children: h(tag, VOID_CHILDREN_ATTRS, h(TextComp, {
|
|
686
628
|
text,
|
|
687
629
|
isLast: false,
|
|
688
|
-
|
|
630
|
+
decorations: decorationsProps.value
|
|
689
631
|
})),
|
|
690
632
|
element: props.element
|
|
691
633
|
});
|
|
692
634
|
}
|
|
693
635
|
return renderElement({
|
|
694
636
|
attributes,
|
|
695
|
-
children: h(ChildrenComp, {
|
|
637
|
+
children: h(ChildrenComp, {
|
|
638
|
+
element: props.element,
|
|
639
|
+
decorations: decorationsProps.value
|
|
640
|
+
}),
|
|
696
641
|
element: props.element
|
|
697
642
|
});
|
|
698
643
|
};
|
|
@@ -700,65 +645,83 @@ var ElementComp = defineComponent({
|
|
|
700
645
|
});
|
|
701
646
|
//#endregion
|
|
702
647
|
//#region packages/slate-vue/components/chunk.ts
|
|
703
|
-
var
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
648
|
+
var ChunkComp = defineComponent({
|
|
649
|
+
props: [
|
|
650
|
+
"root",
|
|
651
|
+
"ancestor",
|
|
652
|
+
"renderElement"
|
|
653
|
+
],
|
|
654
|
+
setup(props) {
|
|
655
|
+
const renderChunk = useRenderChunk();
|
|
656
|
+
return () => renderList(props.ancestor.children, (chunkNode) => {
|
|
657
|
+
if (chunkNode.type === "chunk") return renderChunk({
|
|
658
|
+
highest: props.ancestor === props.root,
|
|
659
|
+
lowest: chunkNode.children.some((c) => c.type === "leaf"),
|
|
660
|
+
attributes: {
|
|
661
|
+
"data-slate-chunk": true,
|
|
662
|
+
key: chunkNode.key.id
|
|
663
|
+
},
|
|
664
|
+
children: h(ChunkComp, {
|
|
665
|
+
root: props.root,
|
|
666
|
+
ancestor: chunkNode,
|
|
667
|
+
renderElement: props.renderElement
|
|
668
|
+
})
|
|
669
|
+
});
|
|
670
|
+
return props.renderElement(chunkNode.node, chunkNode.index, chunkNode.key);
|
|
714
671
|
});
|
|
715
672
|
}
|
|
716
|
-
return h(ElementComp, {
|
|
717
|
-
element: chunkNode.node,
|
|
718
|
-
key: chunkNode.key.id
|
|
719
|
-
});
|
|
720
673
|
});
|
|
721
674
|
//#endregion
|
|
722
675
|
//#region packages/slate-vue/components/children.ts
|
|
676
|
+
var useDecorationsByChild = (editor, node, decorations) => {
|
|
677
|
+
const decorationsByChild = splitDecorationsByChild(editor, node, decorations);
|
|
678
|
+
const mutableDecorationsByChild = decorationsByChild;
|
|
679
|
+
const childrenToRedecorate = [];
|
|
680
|
+
mutableDecorationsByChild.length = decorationsByChild.length;
|
|
681
|
+
for (let i = 0; i < decorationsByChild.length; i++) {
|
|
682
|
+
const decorations = decorationsByChild[i];
|
|
683
|
+
const previousDecorations = mutableDecorationsByChild[i] ?? null;
|
|
684
|
+
if (!isElementDecorationsEqual(previousDecorations, decorations)) {
|
|
685
|
+
mutableDecorationsByChild[i] = decorations;
|
|
686
|
+
childrenToRedecorate.push(i);
|
|
687
|
+
}
|
|
688
|
+
}
|
|
689
|
+
return {
|
|
690
|
+
decorationsByChild: mutableDecorationsByChild,
|
|
691
|
+
childrenToRedecorate
|
|
692
|
+
};
|
|
693
|
+
};
|
|
723
694
|
/**
|
|
724
695
|
* Children.
|
|
725
696
|
*/
|
|
726
697
|
var ChildrenComp = defineComponent({
|
|
727
698
|
name: "slate-children",
|
|
728
|
-
props: ["element"],
|
|
699
|
+
props: ["element", "decorations"],
|
|
729
700
|
setup(props) {
|
|
730
701
|
const editor = useEditor();
|
|
731
702
|
const isBlock = Node.isElement(props.element) && !editor.isInline(props.element);
|
|
732
703
|
const chunkSize = Editor.hasInlines(editor, props.element) ? null : editor.getChunkSize(props.element);
|
|
733
|
-
if (isBlock || chunkSize === null)
|
|
734
|
-
provideIsLastEmptyBlock(props.element);
|
|
735
|
-
const decorate = injectDecorateFn();
|
|
736
|
-
return () => {
|
|
737
|
-
const elementDR = getElementDR(props.element, editor, decorate);
|
|
738
|
-
return renderList(props.element.children, (n, i) => {
|
|
739
|
-
NODE_TO_INDEX.set(n, i);
|
|
740
|
-
NODE_TO_PARENT.set(n, props.element);
|
|
741
|
-
const key = DOMEditor.findKey(editor, n);
|
|
742
|
-
return Node.isText(n) ? h(TextComp, {
|
|
743
|
-
text: n,
|
|
744
|
-
key: key.id,
|
|
745
|
-
elementDR,
|
|
746
|
-
isLast: i === props.element.children.length - 1
|
|
747
|
-
}) : h(ElementComp, {
|
|
748
|
-
element: n,
|
|
749
|
-
key: key.id
|
|
750
|
-
});
|
|
751
|
-
});
|
|
752
|
-
};
|
|
753
|
-
}
|
|
754
|
-
const cacheTree = getChunkTreeForNode(editor, props.element);
|
|
755
|
-
provideChunkRoot(cacheTree);
|
|
756
|
-
const renderChunk = useRenderChunk();
|
|
704
|
+
if (isBlock || chunkSize === null) provideIsLastEmptyBlock(props.element);
|
|
757
705
|
return () => {
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
706
|
+
const { decorationsByChild, childrenToRedecorate } = useDecorationsByChild(editor, props.element, props.decorations);
|
|
707
|
+
if (isBlock || chunkSize === null) return renderList(props.element.children, (n, i) => {
|
|
708
|
+
NODE_TO_INDEX.set(n, i);
|
|
709
|
+
NODE_TO_PARENT.set(n, props.element);
|
|
710
|
+
const key = DOMEditor.findKey(editor, n);
|
|
711
|
+
return Node.isText(n) ? h(TextComp, {
|
|
712
|
+
text: n,
|
|
713
|
+
key: key.id,
|
|
714
|
+
decorations: decorationsByChild[i],
|
|
715
|
+
isLast: i === props.element.children.length - 1
|
|
716
|
+
}) : h(ElementComp, {
|
|
717
|
+
element: n,
|
|
718
|
+
key: key.id,
|
|
719
|
+
decorations: decorationsByChild[i]
|
|
720
|
+
});
|
|
721
|
+
});
|
|
722
|
+
const chunkTree = getChunkTreeForNode(editor, props.element, { reconcile: {
|
|
761
723
|
chunkSize,
|
|
724
|
+
rerenderChildren: childrenToRedecorate,
|
|
762
725
|
onInsert: (n, i) => {
|
|
763
726
|
NODE_TO_INDEX.set(n, i);
|
|
764
727
|
NODE_TO_PARENT.set(n, props.element);
|
|
@@ -770,8 +733,21 @@ var ChildrenComp = defineComponent({
|
|
|
770
733
|
onIndexChange: (n, i) => {
|
|
771
734
|
NODE_TO_INDEX.set(n, i);
|
|
772
735
|
}
|
|
736
|
+
} });
|
|
737
|
+
const renderElementComponent = (n, i, cachedKey) => {
|
|
738
|
+
const key = cachedKey ?? DOMEditor.findKey(editor, n);
|
|
739
|
+
return h(ElementComp, {
|
|
740
|
+
decorations: decorationsByChild[i],
|
|
741
|
+
element: n,
|
|
742
|
+
i,
|
|
743
|
+
key: key.id
|
|
744
|
+
});
|
|
745
|
+
};
|
|
746
|
+
return h(ChunkComp, {
|
|
747
|
+
root: chunkTree,
|
|
748
|
+
ancestor: chunkTree,
|
|
749
|
+
renderElement: renderElementComponent
|
|
773
750
|
});
|
|
774
|
-
return ChunkCompFc(cacheTree, renderChunk, true);
|
|
775
751
|
};
|
|
776
752
|
}
|
|
777
753
|
});
|
|
@@ -1027,10 +1003,11 @@ var Editable = defineComponent({
|
|
|
1027
1003
|
IS_READ_ONLY.set(editor, current);
|
|
1028
1004
|
isReadOnly.value = current;
|
|
1029
1005
|
});
|
|
1030
|
-
const state =
|
|
1006
|
+
const state = {
|
|
1031
1007
|
isDraggingInternally: false,
|
|
1032
|
-
latestElement: null
|
|
1033
|
-
|
|
1008
|
+
latestElement: null,
|
|
1009
|
+
hasMarkPlaceholder: false
|
|
1010
|
+
};
|
|
1034
1011
|
const placeholderHeight = ref();
|
|
1035
1012
|
const onPlaceholderResize = (h) => placeholderHeight.value = h;
|
|
1036
1013
|
const processing = ref(false);
|
|
@@ -1084,14 +1061,6 @@ var Editable = defineComponent({
|
|
|
1084
1061
|
EDITOR_TO_ELEMENT.delete(editor);
|
|
1085
1062
|
NODE_TO_ELEMENT.delete(editor);
|
|
1086
1063
|
});
|
|
1087
|
-
const hasMarkPlaceholder = computed(() => {
|
|
1088
|
-
if (editor.selection && Range.isCollapsed(editor.selection) && editor.marks) {
|
|
1089
|
-
const anchor = editor.selection.anchor;
|
|
1090
|
-
const leaf = Node.leaf(editor, anchor.path);
|
|
1091
|
-
if (!Text.equals(leaf, editor.marks, { loose: true })) return true;
|
|
1092
|
-
}
|
|
1093
|
-
return false;
|
|
1094
|
-
});
|
|
1095
1064
|
const setDomSelection = () => {
|
|
1096
1065
|
const root = DOMEditor.findDocumentOrShadowRoot(editor);
|
|
1097
1066
|
const domSelection = getSelection(root);
|
|
@@ -1115,7 +1084,7 @@ var Editable = defineComponent({
|
|
|
1115
1084
|
suppressThrow: true
|
|
1116
1085
|
});
|
|
1117
1086
|
if (slateRange && Range.equals(slateRange, editor.selection)) {
|
|
1118
|
-
if (!hasMarkPlaceholder
|
|
1087
|
+
if (!state.hasMarkPlaceholder) return;
|
|
1119
1088
|
if (anchorNode?.parentElement?.hasAttribute("data-slate-mark-placeholder")) return;
|
|
1120
1089
|
}
|
|
1121
1090
|
}
|
|
@@ -1140,7 +1109,6 @@ var Editable = defineComponent({
|
|
|
1140
1109
|
};
|
|
1141
1110
|
const editorVersion = useEditorVersion();
|
|
1142
1111
|
watch(() => editorVersion.value, () => {
|
|
1143
|
-
console.log(JSON.stringify(editor.selection));
|
|
1144
1112
|
const root = DOMEditor.findDocumentOrShadowRoot(editor);
|
|
1145
1113
|
const domSelection = getSelection(root);
|
|
1146
1114
|
if (!domSelection || !DOMEditor.isFocused(editor)) return;
|
|
@@ -1621,39 +1589,74 @@ var Editable = defineComponent({
|
|
|
1621
1589
|
const autocorrect = computed(() => HAS_BEFORE_INPUT_SUPPORT || !CAN_USE_DOM ? attributes.autocorrect : void 0);
|
|
1622
1590
|
const autocapitalize = computed(() => HAS_BEFORE_INPUT_SUPPORT || !CAN_USE_DOM ? attributes.autocapitalize : void 0);
|
|
1623
1591
|
const showPlaceholder = computed(() => Boolean(placeholder) && editor.children?.length === 1 && Array.from(Node.texts(editor)).length === 1 && Node.string(editor) === "" && !isComposing.value);
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
}
|
|
1592
|
+
const decorate = injectDecorateFn();
|
|
1593
|
+
const decorations = computed(() => {
|
|
1594
|
+
const _decorations = decorate([editor, []]);
|
|
1595
|
+
if (showPlaceholder.value) {
|
|
1596
|
+
const start = Editor.start(editor, []);
|
|
1597
|
+
_decorations.push({
|
|
1598
|
+
[PLACEHOLDER_SYMBOL]: true,
|
|
1599
|
+
placeholder,
|
|
1600
|
+
onPlaceholderResize,
|
|
1601
|
+
anchor: start,
|
|
1602
|
+
focus: start
|
|
1603
|
+
});
|
|
1604
|
+
}
|
|
1605
|
+
const { marks } = editor;
|
|
1606
|
+
state.hasMarkPlaceholder = false;
|
|
1607
|
+
if (editor.selection && Range.isCollapsed(editor.selection) && marks) {
|
|
1608
|
+
const { anchor } = editor.selection;
|
|
1609
|
+
const leaf = Node.leaf(editor, anchor.path);
|
|
1610
|
+
const { text, ...rest } = leaf;
|
|
1611
|
+
if (!Text.equals(leaf, marks, { loose: true })) {
|
|
1612
|
+
state.hasMarkPlaceholder = true;
|
|
1613
|
+
const unset = Object.fromEntries(Object.keys(rest).map((mark) => [mark, null]));
|
|
1614
|
+
_decorations.push({
|
|
1615
|
+
[MARK_PLACEHOLDER_SYMBOL]: true,
|
|
1616
|
+
...unset,
|
|
1617
|
+
...marks,
|
|
1618
|
+
anchor,
|
|
1619
|
+
focus: anchor
|
|
1620
|
+
});
|
|
1621
|
+
}
|
|
1622
|
+
}
|
|
1623
|
+
return _decorations;
|
|
1624
|
+
});
|
|
1625
|
+
return () => {
|
|
1626
|
+
return h(attributes.is || "div", {
|
|
1627
|
+
role: readOnly ? void 0 : "textbox",
|
|
1628
|
+
"aria-multiline": readOnly ? void 0 : true,
|
|
1629
|
+
translate: "no",
|
|
1630
|
+
"data-slate-editor": true,
|
|
1631
|
+
"data-slate-node": "value",
|
|
1632
|
+
zindex: -1,
|
|
1633
|
+
spellcheck: spellcheck.value,
|
|
1634
|
+
autocorrect: autocorrect.value,
|
|
1635
|
+
autocapitalize: autocapitalize.value,
|
|
1636
|
+
contenteditable: !readOnly,
|
|
1637
|
+
ref: editableRef,
|
|
1638
|
+
style: editableStyle.value,
|
|
1639
|
+
onBeforeinput,
|
|
1640
|
+
onInput,
|
|
1641
|
+
onBlur,
|
|
1642
|
+
onClick,
|
|
1643
|
+
onCompositionend,
|
|
1644
|
+
onCompositionupdate,
|
|
1645
|
+
onCompositionstart,
|
|
1646
|
+
onCopy,
|
|
1647
|
+
onCut,
|
|
1648
|
+
onDragover,
|
|
1649
|
+
onDragstart,
|
|
1650
|
+
onDrop,
|
|
1651
|
+
onDragend,
|
|
1652
|
+
onFocus,
|
|
1653
|
+
onKeydown,
|
|
1654
|
+
onPaste
|
|
1655
|
+
}, h(ChildrenComp, {
|
|
1656
|
+
element: editor,
|
|
1657
|
+
decorations: decorations.value
|
|
1658
|
+
}));
|
|
1659
|
+
};
|
|
1657
1660
|
}
|
|
1658
1661
|
});
|
|
1659
1662
|
//#endregion
|
package/dist/yjs.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { a as useFocused, d as useEditor } from "./slate-vue-
|
|
1
|
+
import { _t as Range, bt as Transforms, f as DOMEditor, ft as Editor, gt as Path, ht as Node, mt as Location, nn as isObject } from "./slate-dom-CbCA1XcK.js";
|
|
2
|
+
import { a as useFocused, d as useEditor } from "./slate-vue-C5Tp0KRv.js";
|
|
3
3
|
import { computed, onMounted, onUnmounted, onUpdated, ref, watch } from "vue";
|
|
4
4
|
import { UndoManager, XmlText, YTextEvent, compareRelativePositions, createAbsolutePositionFromRelativePosition, createRelativePositionFromJSON, createRelativePositionFromTypeIndex, decodeRelativePosition, encodeRelativePosition } from "yjs";
|
|
5
5
|
//#region packages/slate-yjs/utils/object.ts
|