laif-ds 0.2.85 → 0.2.86
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/README.md +11 -81
- package/dist/CHANGELOG.md +7 -0
- package/dist/_virtual/index3.js +5 -5
- package/dist/_virtual/index4.js +5 -5
- package/dist/_virtual/index5.js +4 -4
- package/dist/_virtual/index7.js +5 -2
- package/dist/_virtual/index8.js +2 -5
- package/dist/agent-docs/adoption-report.json +2 -2
- package/dist/agent-docs/manifest.json +3 -3
- package/dist/components/editor/editor-hooks/use-update-toolbar.js +6 -6
- package/dist/components/editor/editor-ui/content-editable.js +1 -1
- package/dist/components/editor/nodes/mention-node.js +2 -2
- package/dist/components/editor/plugins/actions/clear-editor-plugin.js +2 -2
- package/dist/components/editor/plugins/actions/counter-character-plugin.js +2 -2
- package/dist/components/editor/plugins/mention-plugin.js +21 -21
- package/dist/components/editor/plugins/toolbar/block-format/format-bulleted-list.js +10 -10
- package/dist/components/editor/plugins/toolbar/block-format/format-check-list.js +5 -5
- package/dist/components/editor/plugins/toolbar/block-format/format-heading.js +5 -5
- package/dist/components/editor/plugins/toolbar/block-format/format-numbered-list.js +5 -5
- package/dist/components/editor/plugins/toolbar/block-format/format-paragraph.js +9 -9
- package/dist/components/editor/plugins/toolbar/block-format/format-quote.js +3 -3
- package/dist/components/editor/plugins/toolbar/block-format-toolbar-plugin.js +13 -13
- package/dist/components/editor/plugins/toolbar/font-format-toolbar-plugin.js +2 -2
- package/dist/components/editor/plugins/toolbar/history-toolbar-plugin.js +18 -19
- package/dist/components/editor/plugins/toolbar/mention-insert-toolbar-plugin.js +1 -1
- package/dist/components/editor/plugins/toolbar/toolbar-plugin.js +3 -3
- package/dist/components/ui/app-editor.js +51 -51
- package/dist/components/ui/gantt/components/Chart/Chart.js +1 -1
- package/dist/components/ui/markdown-renderer.js +33 -32
- package/dist/lib/utils.js +35 -34
- package/dist/node_modules/@floating-ui/core/dist/floating-ui.core.js +1 -1
- package/dist/node_modules/@floating-ui/{utils → core/node_modules/@floating-ui/utils}/dist/floating-ui.utils.js +33 -39
- package/dist/node_modules/@floating-ui/dom/dist/floating-ui.dom.js +20 -19
- package/dist/node_modules/@floating-ui/dom/node_modules/@floating-ui/utils/dist/floating-ui.utils.js +12 -0
- package/dist/node_modules/@lexical/clipboard/dist/LexicalClipboard.prod.js +354 -0
- package/dist/node_modules/@lexical/code-core/dist/LexicalCodeCore.prod.js +298 -0
- package/dist/node_modules/@lexical/dragon/dist/LexicalDragon.prod.js +89 -0
- package/dist/node_modules/@lexical/extension/dist/LexicalExtension.prod.js +611 -0
- package/dist/node_modules/@lexical/history/dist/LexicalHistory.prod.js +96 -0
- package/dist/node_modules/@lexical/html/dist/LexicalHtml.prod.js +604 -0
- package/dist/node_modules/@lexical/link/dist/LexicalLink.prod.js +201 -0
- package/dist/node_modules/@lexical/list/dist/LexicalList.prod.js +843 -0
- package/dist/node_modules/@lexical/markdown/dist/LexicalMarkdown.prod.js +555 -0
- package/dist/node_modules/@lexical/react/dist/LexicalCheckListPlugin.prod.js +11 -0
- package/dist/node_modules/@lexical/react/dist/LexicalClearEditorPlugin.prod.js +13 -0
- package/dist/node_modules/@lexical/react/dist/LexicalComposer.prod.js +45 -0
- package/dist/node_modules/@lexical/react/{LexicalComposerContext.prod.js → dist/LexicalComposerContext.prod.js} +1 -1
- package/dist/node_modules/@lexical/react/dist/LexicalContentEditable.prod.js +53 -0
- package/dist/node_modules/@lexical/react/dist/LexicalErrorBoundary.prod.js +21 -0
- package/dist/node_modules/@lexical/react/{LexicalHistoryPlugin.prod.js → dist/LexicalHistoryPlugin.prod.js} +3 -3
- package/dist/node_modules/@lexical/react/dist/LexicalListPlugin.prod.js +17 -0
- package/dist/node_modules/@lexical/react/dist/LexicalOnChangePlugin.prod.js +16 -0
- package/dist/node_modules/@lexical/react/dist/LexicalReactProviderExtension.prod.js +6 -0
- package/dist/node_modules/@lexical/react/dist/LexicalRichTextPlugin.prod.js +77 -0
- package/dist/node_modules/@lexical/react/dist/LexicalTypeaheadMenuPlugin.prod.js +245 -0
- package/dist/node_modules/@lexical/react/dist/useLexicalEditable.prod.js +22 -0
- package/dist/node_modules/@lexical/rich-text/dist/LexicalRichText.prod.js +567 -0
- package/dist/node_modules/@lexical/selection/dist/LexicalSelection.prod.js +123 -0
- package/dist/node_modules/@lexical/table/dist/LexicalTable.prod.js +929 -0
- package/dist/node_modules/@lexical/text/{LexicalText.prod.js → dist/LexicalText.prod.js} +6 -6
- package/dist/node_modules/@lexical/utils/dist/LexicalUtils.prod.js +111 -0
- package/dist/node_modules/eventemitter3/index.js +1 -1
- package/dist/node_modules/eventemitter3/index2.js +1 -1
- package/dist/node_modules/hast-util-to-jsx-runtime/lib/index.js +1 -1
- package/dist/node_modules/lexical/dist/Lexical.prod.js +6731 -0
- package/dist/node_modules/recharts/es6/util/Events.js +1 -1
- package/dist/node_modules/unified/lib/index.js +1 -1
- package/package.json +14 -14
- package/dist/_virtual/prism-cpp.js +0 -3
- package/dist/_virtual/prism-cpp2.js +0 -5
- package/dist/_virtual/prism-java.js +0 -3
- package/dist/_virtual/prism-java2.js +0 -5
- package/dist/_virtual/prism-python.js +0 -3
- package/dist/_virtual/prism-python2.js +0 -5
- package/dist/_virtual/prism-rust.js +0 -3
- package/dist/_virtual/prism-rust2.js +0 -5
- package/dist/_virtual/prism-typescript.js +0 -3
- package/dist/_virtual/prism-typescript2.js +0 -5
- package/dist/_virtual/prism.js +0 -3
- package/dist/_virtual/prism2.js +0 -5
- package/dist/node_modules/@lexical/clipboard/LexicalClipboard.prod.js +0 -159
- package/dist/node_modules/@lexical/code/LexicalCode.prod.js +0 -236
- package/dist/node_modules/@lexical/dragon/LexicalDragon.prod.js +0 -46
- package/dist/node_modules/@lexical/history/LexicalHistory.prod.js +0 -89
- package/dist/node_modules/@lexical/html/LexicalHtml.prod.js +0 -108
- package/dist/node_modules/@lexical/link/LexicalLink.prod.js +0 -187
- package/dist/node_modules/@lexical/list/LexicalList.prod.js +0 -729
- package/dist/node_modules/@lexical/markdown/LexicalMarkdown.prod.js +0 -367
- package/dist/node_modules/@lexical/react/LexicalCheckListPlugin.prod.js +0 -11
- package/dist/node_modules/@lexical/react/LexicalClearEditorPlugin.prod.js +0 -17
- package/dist/node_modules/@lexical/react/LexicalComposer.prod.js +0 -45
- package/dist/node_modules/@lexical/react/LexicalContentEditable.prod.js +0 -55
- package/dist/node_modules/@lexical/react/LexicalErrorBoundary.prod.js +0 -49
- package/dist/node_modules/@lexical/react/LexicalListPlugin.prod.js +0 -17
- package/dist/node_modules/@lexical/react/LexicalOnChangePlugin.prod.js +0 -16
- package/dist/node_modules/@lexical/react/LexicalRichTextPlugin.prod.js +0 -56
- package/dist/node_modules/@lexical/react/LexicalTypeaheadMenuPlugin.prod.js +0 -220
- package/dist/node_modules/@lexical/react/useLexicalEditable.prod.js +0 -21
- package/dist/node_modules/@lexical/rich-text/LexicalRichText.prod.js +0 -376
- package/dist/node_modules/@lexical/selection/LexicalSelection.prod.js +0 -107
- package/dist/node_modules/@lexical/table/LexicalTable.prod.js +0 -661
- package/dist/node_modules/@lexical/utils/LexicalUtils.prod.js +0 -102
- package/dist/node_modules/lexical/Lexical.prod.js +0 -4912
- package/dist/node_modules/prismjs/components/prism-c.js +0 -77
- package/dist/node_modules/prismjs/components/prism-clike.js +0 -32
- package/dist/node_modules/prismjs/components/prism-cpp.js +0 -93
- package/dist/node_modules/prismjs/components/prism-css.js +0 -56
- package/dist/node_modules/prismjs/components/prism-java.js +0 -122
- package/dist/node_modules/prismjs/components/prism-javascript.js +0 -138
- package/dist/node_modules/prismjs/components/prism-markdown.js +0 -301
- package/dist/node_modules/prismjs/components/prism-markup.js +0 -174
- package/dist/node_modules/prismjs/components/prism-objectivec.js +0 -11
- package/dist/node_modules/prismjs/components/prism-powershell.js +0 -56
- package/dist/node_modules/prismjs/components/prism-python.js +0 -69
- package/dist/node_modules/prismjs/components/prism-rust.js +0 -124
- package/dist/node_modules/prismjs/components/prism-sql.js +0 -34
- package/dist/node_modules/prismjs/components/prism-swift.js +0 -114
- package/dist/node_modules/prismjs/components/prism-typescript.js +0 -53
- package/dist/node_modules/prismjs/prism.js +0 -1165
- /package/dist/node_modules/@floating-ui/{utils → dom/node_modules/@floating-ui/utils}/dist/floating-ui.utils.dom.js +0 -0
|
@@ -0,0 +1,611 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { CLEAR_EDITOR_COMMAND as nt, COMMAND_PRIORITY_EDITOR as st, $getRoot as J, $getSelection as ot, $createParagraphNode as V, $isRangeSelection as rt, createEditor as at, mergeRegister as T, shallowMergeConfig as ct, $getEditor as dt, defineExtension as ht, RootNode as ft, TextNode as ut, LineBreakNode as lt, TabNode as gt, ParagraphNode as pt, safeCast as mt, $isEditorState as vt, HISTORY_MERGE_TAG as Et, $create as xt, DecoratorNode as yt, $getDocument as U, addClassNamesToElement as St } from "../../../lexical/dist/Lexical.prod.js";
|
|
3
|
+
const bt = Symbol.for("preact-signals");
|
|
4
|
+
function $() {
|
|
5
|
+
if (m > 1) return void m--;
|
|
6
|
+
let i, t = !1;
|
|
7
|
+
for (!(function() {
|
|
8
|
+
let e = C;
|
|
9
|
+
for (C = void 0; e !== void 0; ) e.S.v === e.v && (e.S.i = e.i), e = e.o;
|
|
10
|
+
})(); S !== void 0; ) {
|
|
11
|
+
let e = S;
|
|
12
|
+
for (S = void 0, D++; e !== void 0; ) {
|
|
13
|
+
const n = e.u;
|
|
14
|
+
if (e.u = void 0, e.f &= -3, !(8 & e.f) && Z(e)) try {
|
|
15
|
+
e.c();
|
|
16
|
+
} catch (o) {
|
|
17
|
+
t || (i = o, t = !0);
|
|
18
|
+
}
|
|
19
|
+
e = n;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
if (D = 0, m--, t) throw i;
|
|
23
|
+
}
|
|
24
|
+
let a, S;
|
|
25
|
+
function z(i) {
|
|
26
|
+
const t = a;
|
|
27
|
+
a = void 0;
|
|
28
|
+
try {
|
|
29
|
+
return i();
|
|
30
|
+
} finally {
|
|
31
|
+
a = t;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
let C, m = 0, D = 0, L = 0, O = 0;
|
|
35
|
+
function G(i) {
|
|
36
|
+
if (a === void 0) return;
|
|
37
|
+
let t = i.n;
|
|
38
|
+
return t === void 0 || t.t !== a ? (t = { i: 0, S: i, p: a.s, n: void 0, t: a, e: void 0, x: void 0, r: t }, a.s !== void 0 && (a.s.n = t), a.s = t, i.n = t, 32 & a.f && i.S(t), t) : t.i === -1 ? (t.i = 0, t.n !== void 0 && (t.n.p = t.p, t.p !== void 0 && (t.p.n = t.n), t.p = a.s, t.n = void 0, a.s.n = t, a.s = t), t) : void 0;
|
|
39
|
+
}
|
|
40
|
+
function f(i, t) {
|
|
41
|
+
this.v = i, this.i = 0, this.n = void 0, this.t = void 0, this.l = 0, this.W = t?.watched, this.Z = t?.unwatched, this.name = t?.name;
|
|
42
|
+
}
|
|
43
|
+
function wt(i, t) {
|
|
44
|
+
return new f(i, t);
|
|
45
|
+
}
|
|
46
|
+
function Z(i) {
|
|
47
|
+
for (let t = i.s; t !== void 0; t = t.n) if (t.S.i !== t.i || !t.S.h() || t.S.i !== t.i) return !0;
|
|
48
|
+
return !1;
|
|
49
|
+
}
|
|
50
|
+
function K(i) {
|
|
51
|
+
for (let t = i.s; t !== void 0; t = t.n) {
|
|
52
|
+
const e = t.S.n;
|
|
53
|
+
if (e !== void 0 && (t.r = e), t.S.n = t, t.i = -1, t.n === void 0) {
|
|
54
|
+
i.s = t;
|
|
55
|
+
break;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
function Q(i) {
|
|
60
|
+
let t, e = i.s;
|
|
61
|
+
for (; e !== void 0; ) {
|
|
62
|
+
const n = e.p;
|
|
63
|
+
e.i === -1 ? (e.S.U(e), n !== void 0 && (n.n = e.n), e.n !== void 0 && (e.n.p = n)) : t = e, e.S.n = e.r, e.r !== void 0 && (e.r = void 0), e = n;
|
|
64
|
+
}
|
|
65
|
+
i.s = t;
|
|
66
|
+
}
|
|
67
|
+
function v(i, t) {
|
|
68
|
+
f.call(this, void 0), this.x = i, this.s = void 0, this.g = O - 1, this.f = 4, this.W = t?.watched, this.Z = t?.unwatched, this.name = t?.name;
|
|
69
|
+
}
|
|
70
|
+
function X(i) {
|
|
71
|
+
const t = i.m;
|
|
72
|
+
if (i.m = void 0, typeof t == "function") {
|
|
73
|
+
m++;
|
|
74
|
+
const e = a;
|
|
75
|
+
a = void 0;
|
|
76
|
+
try {
|
|
77
|
+
t();
|
|
78
|
+
} catch (n) {
|
|
79
|
+
throw i.f &= -2, i.f |= 8, A(i), n;
|
|
80
|
+
} finally {
|
|
81
|
+
a = e, $();
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
function A(i) {
|
|
86
|
+
for (let t = i.s; t !== void 0; t = t.n) t.S.U(t);
|
|
87
|
+
i.x = void 0, i.s = void 0, X(i);
|
|
88
|
+
}
|
|
89
|
+
function Nt(i) {
|
|
90
|
+
if (a !== this) throw new Error("Out-of-order effect");
|
|
91
|
+
Q(this), a = i, this.f &= -2, 8 & this.f && A(this), $();
|
|
92
|
+
}
|
|
93
|
+
function x(i, t) {
|
|
94
|
+
this.x = i, this.m = void 0, this.s = void 0, this.u = void 0, this.f = 32, this.name = t?.name;
|
|
95
|
+
}
|
|
96
|
+
function Rt(i, t) {
|
|
97
|
+
const e = new x(i, t);
|
|
98
|
+
try {
|
|
99
|
+
e.c();
|
|
100
|
+
} catch (o) {
|
|
101
|
+
throw e.d(), o;
|
|
102
|
+
}
|
|
103
|
+
const n = e.d.bind(e);
|
|
104
|
+
return n[Symbol.dispose] = n, n;
|
|
105
|
+
}
|
|
106
|
+
f.prototype.brand = bt, f.prototype.h = function() {
|
|
107
|
+
return !0;
|
|
108
|
+
}, f.prototype.S = function(i) {
|
|
109
|
+
const t = this.t;
|
|
110
|
+
t !== i && i.e === void 0 && (i.x = t, this.t = i, t !== void 0 ? t.e = i : z(() => {
|
|
111
|
+
var e;
|
|
112
|
+
(e = this.W) == null || e.call(this);
|
|
113
|
+
}));
|
|
114
|
+
}, f.prototype.U = function(i) {
|
|
115
|
+
if (this.t !== void 0) {
|
|
116
|
+
const t = i.e, e = i.x;
|
|
117
|
+
t !== void 0 && (t.x = e, i.e = void 0), e !== void 0 && (e.e = t, i.x = void 0), i === this.t && (this.t = e, e === void 0 && z(() => {
|
|
118
|
+
var n;
|
|
119
|
+
(n = this.Z) == null || n.call(this);
|
|
120
|
+
}));
|
|
121
|
+
}
|
|
122
|
+
}, f.prototype.subscribe = function(i) {
|
|
123
|
+
return Rt(() => {
|
|
124
|
+
const t = this.value, e = a;
|
|
125
|
+
a = void 0;
|
|
126
|
+
try {
|
|
127
|
+
i(t);
|
|
128
|
+
} finally {
|
|
129
|
+
a = e;
|
|
130
|
+
}
|
|
131
|
+
}, { name: "sub" });
|
|
132
|
+
}, f.prototype.valueOf = function() {
|
|
133
|
+
return this.value;
|
|
134
|
+
}, f.prototype.toString = function() {
|
|
135
|
+
return this.value + "";
|
|
136
|
+
}, f.prototype.toJSON = function() {
|
|
137
|
+
return this.value;
|
|
138
|
+
}, f.prototype.peek = function() {
|
|
139
|
+
const i = a;
|
|
140
|
+
a = void 0;
|
|
141
|
+
try {
|
|
142
|
+
return this.value;
|
|
143
|
+
} finally {
|
|
144
|
+
a = i;
|
|
145
|
+
}
|
|
146
|
+
}, Object.defineProperty(f.prototype, "value", { get() {
|
|
147
|
+
const i = G(this);
|
|
148
|
+
return i !== void 0 && (i.i = this.i), this.v;
|
|
149
|
+
}, set(i) {
|
|
150
|
+
if (i !== this.v) {
|
|
151
|
+
if (D > 100) throw new Error("Cycle detected");
|
|
152
|
+
(function(t) {
|
|
153
|
+
m !== 0 && D === 0 && t.l !== L && (t.l = L, C = { S: t, v: t.v, i: t.i, o: C });
|
|
154
|
+
})(this), this.v = i, this.i++, O++, m++;
|
|
155
|
+
try {
|
|
156
|
+
for (let t = this.t; t !== void 0; t = t.x) t.t.N();
|
|
157
|
+
} finally {
|
|
158
|
+
$();
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
} }), v.prototype = new f(), v.prototype.h = function() {
|
|
162
|
+
if (this.f &= -3, 1 & this.f) return !1;
|
|
163
|
+
if ((36 & this.f) == 32 || (this.f &= -5, this.g === O)) return !0;
|
|
164
|
+
if (this.g = O, this.f |= 1, this.i > 0 && !Z(this)) return this.f &= -2, !0;
|
|
165
|
+
const i = a;
|
|
166
|
+
try {
|
|
167
|
+
K(this), a = this;
|
|
168
|
+
const t = this.x();
|
|
169
|
+
(16 & this.f || this.v !== t || this.i === 0) && (this.v = t, this.f &= -17, this.i++);
|
|
170
|
+
} catch (t) {
|
|
171
|
+
this.v = t, this.f |= 16, this.i++;
|
|
172
|
+
}
|
|
173
|
+
return a = i, Q(this), this.f &= -2, !0;
|
|
174
|
+
}, v.prototype.S = function(i) {
|
|
175
|
+
if (this.t === void 0) {
|
|
176
|
+
this.f |= 36;
|
|
177
|
+
for (let t = this.s; t !== void 0; t = t.n) t.S.S(t);
|
|
178
|
+
}
|
|
179
|
+
f.prototype.S.call(this, i);
|
|
180
|
+
}, v.prototype.U = function(i) {
|
|
181
|
+
if (this.t !== void 0 && (f.prototype.U.call(this, i), this.t === void 0)) {
|
|
182
|
+
this.f &= -33;
|
|
183
|
+
for (let t = this.s; t !== void 0; t = t.n) t.S.U(t);
|
|
184
|
+
}
|
|
185
|
+
}, v.prototype.N = function() {
|
|
186
|
+
if (!(2 & this.f)) {
|
|
187
|
+
this.f |= 6;
|
|
188
|
+
for (let i = this.t; i !== void 0; i = i.x) i.t.N();
|
|
189
|
+
}
|
|
190
|
+
}, Object.defineProperty(v.prototype, "value", { get() {
|
|
191
|
+
if (1 & this.f) throw new Error("Cycle detected");
|
|
192
|
+
const i = G(this);
|
|
193
|
+
if (this.h(), i !== void 0 && (i.i = this.i), 16 & this.f) throw this.v;
|
|
194
|
+
return this.v;
|
|
195
|
+
} }), x.prototype.c = function() {
|
|
196
|
+
const i = this.S();
|
|
197
|
+
try {
|
|
198
|
+
if (8 & this.f || this.x === void 0) return;
|
|
199
|
+
const t = this.x();
|
|
200
|
+
typeof t == "function" && (this.m = t);
|
|
201
|
+
} finally {
|
|
202
|
+
i();
|
|
203
|
+
}
|
|
204
|
+
}, x.prototype.S = function() {
|
|
205
|
+
if (1 & this.f) throw new Error("Cycle detected");
|
|
206
|
+
this.f |= 1, this.f &= -9, X(this), K(this), m++;
|
|
207
|
+
const i = a;
|
|
208
|
+
return a = this, Nt.bind(this, i);
|
|
209
|
+
}, x.prototype.N = function() {
|
|
210
|
+
2 & this.f || (this.f |= 2, this.u = S, S = this);
|
|
211
|
+
}, x.prototype.d = function() {
|
|
212
|
+
this.f |= 8, 1 & this.f || A(this);
|
|
213
|
+
}, x.prototype.dispose = function() {
|
|
214
|
+
this.d();
|
|
215
|
+
};
|
|
216
|
+
function Ot() {
|
|
217
|
+
const i = J(), t = ot(), e = V();
|
|
218
|
+
i.clear(), i.append(e), t !== null && e.select(), rt(t) && (t.format = 0);
|
|
219
|
+
}
|
|
220
|
+
function Ut(i, t = Ot) {
|
|
221
|
+
return i.registerCommand(nt, (e) => (i.update(t), !0), st);
|
|
222
|
+
}
|
|
223
|
+
function Ct(i) {
|
|
224
|
+
return (typeof i.nodes == "function" ? i.nodes() : i.nodes) || [];
|
|
225
|
+
}
|
|
226
|
+
function zt(i, t) {
|
|
227
|
+
let e;
|
|
228
|
+
return wt(i(), { unwatched() {
|
|
229
|
+
e && (e(), e = void 0);
|
|
230
|
+
}, watched() {
|
|
231
|
+
this.value = i(), e = t(this);
|
|
232
|
+
} });
|
|
233
|
+
}
|
|
234
|
+
function d(i, ...t) {
|
|
235
|
+
const e = new URL("https://lexical.dev/docs/error"), n = new URLSearchParams();
|
|
236
|
+
n.append("code", i);
|
|
237
|
+
for (const o of t) n.append("v", o);
|
|
238
|
+
throw e.search = n.toString(), Error(`Minified Lexical error #${i}; visit ${e.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`);
|
|
239
|
+
}
|
|
240
|
+
let Y;
|
|
241
|
+
try {
|
|
242
|
+
Y = "0.47.0+prod.esm";
|
|
243
|
+
} catch {
|
|
244
|
+
}
|
|
245
|
+
const Dt = Y ?? '"<unknown>+source"', Mt = /* @__PURE__ */ new Set(["__proto__", "constructor", "prototype"]);
|
|
246
|
+
function q(i, t) {
|
|
247
|
+
if (i && t && !Array.isArray(t) && typeof i == "object" && typeof t == "object") {
|
|
248
|
+
const e = i, n = t;
|
|
249
|
+
for (const o in n) !Mt.has(o) && Object.prototype.hasOwnProperty.call(n, o) && (e[o] = q(e[o], n[o]));
|
|
250
|
+
return i;
|
|
251
|
+
}
|
|
252
|
+
return t;
|
|
253
|
+
}
|
|
254
|
+
const k = 0, j = 1, tt = 2, M = 3, N = 4, E = 5, _ = 6, y = 7;
|
|
255
|
+
function I(i) {
|
|
256
|
+
return i.id === k;
|
|
257
|
+
}
|
|
258
|
+
function et(i) {
|
|
259
|
+
return i.id === tt;
|
|
260
|
+
}
|
|
261
|
+
function _t(i) {
|
|
262
|
+
return (function(t) {
|
|
263
|
+
return t.id === j;
|
|
264
|
+
})(i) || d(305, String(i.id), String(j)), Object.assign(i, { id: tt });
|
|
265
|
+
}
|
|
266
|
+
const It = /* @__PURE__ */ new Set();
|
|
267
|
+
class Pt {
|
|
268
|
+
builder;
|
|
269
|
+
configs;
|
|
270
|
+
_dependency;
|
|
271
|
+
_peerNameSet;
|
|
272
|
+
extension;
|
|
273
|
+
state;
|
|
274
|
+
_signal;
|
|
275
|
+
constructor(t, e) {
|
|
276
|
+
this.builder = t, this.extension = e, this.configs = /* @__PURE__ */ new Set(), this.state = { id: k };
|
|
277
|
+
}
|
|
278
|
+
mergeConfigs() {
|
|
279
|
+
let t = this.extension.config || {};
|
|
280
|
+
const e = this.extension.mergeConfig ? this.extension.mergeConfig.bind(this.extension) : ct;
|
|
281
|
+
for (const n of this.configs) t = e(t, n);
|
|
282
|
+
return t;
|
|
283
|
+
}
|
|
284
|
+
init(t) {
|
|
285
|
+
const e = this.state;
|
|
286
|
+
et(e) || d(306, String(e.id));
|
|
287
|
+
const n = { getDependency: this.getInitDependency.bind(this), getDirectDependentNames: this.getDirectDependentNames.bind(this), getPeer: this.getInitPeer.bind(this), getPeerNameSet: this.getPeerNameSet.bind(this) }, o = { ...n, getDependency: this.getDependency.bind(this), getInitResult: this.getInitResult.bind(this), getPeer: this.getPeer.bind(this) }, s = (function(c, u, l) {
|
|
288
|
+
return Object.assign(c, { config: u, id: M, registerState: l });
|
|
289
|
+
})(e, this.mergeConfigs(), n);
|
|
290
|
+
let r;
|
|
291
|
+
this.state = s, this.extension.init && (r = this.extension.init(t, s.config, n)), this.state = (function(c, u, l) {
|
|
292
|
+
return Object.assign(c, { id: N, initResult: u, registerState: l });
|
|
293
|
+
})(s, r, o);
|
|
294
|
+
}
|
|
295
|
+
build(t) {
|
|
296
|
+
const e = this.state;
|
|
297
|
+
let n;
|
|
298
|
+
e.id !== N && d(307, String(e.id), String(E)), this.extension.build && (n = this.extension.build(t, e.config, e.registerState));
|
|
299
|
+
const o = { ...e.registerState, getOutput: () => n, getSignal: this.getSignal.bind(this) };
|
|
300
|
+
this.state = (function(s, r, c) {
|
|
301
|
+
return Object.assign(s, { id: E, output: r, registerState: c });
|
|
302
|
+
})(e, n, o);
|
|
303
|
+
}
|
|
304
|
+
register(t, e) {
|
|
305
|
+
this._signal = e;
|
|
306
|
+
const n = this.state;
|
|
307
|
+
n.id !== E && d(308, String(n.id), String(E));
|
|
308
|
+
const o = this.extension.register && this.extension.register(t, n.config, n.registerState);
|
|
309
|
+
return this.state = (function(s) {
|
|
310
|
+
return Object.assign(s, { id: _ });
|
|
311
|
+
})(n), () => {
|
|
312
|
+
const s = this.state;
|
|
313
|
+
s.id !== y && d(309, String(n.id), String(y)), this.state = (function(r) {
|
|
314
|
+
return Object.assign(r, { id: E });
|
|
315
|
+
})(s), o && o();
|
|
316
|
+
};
|
|
317
|
+
}
|
|
318
|
+
afterRegistration(t) {
|
|
319
|
+
const e = this.state;
|
|
320
|
+
let n;
|
|
321
|
+
return e.id !== _ && d(310, String(e.id), String(_)), this.extension.afterRegistration && (n = this.extension.afterRegistration(t, e.config, e.registerState)), this.state = (function(o) {
|
|
322
|
+
return Object.assign(o, { id: y });
|
|
323
|
+
})(e), n;
|
|
324
|
+
}
|
|
325
|
+
getSignal() {
|
|
326
|
+
return this._signal === void 0 && d(311), this._signal;
|
|
327
|
+
}
|
|
328
|
+
getInitResult() {
|
|
329
|
+
this.extension.init === void 0 && d(312, this.extension.name);
|
|
330
|
+
const t = this.state;
|
|
331
|
+
return (function(e) {
|
|
332
|
+
return e.id >= N;
|
|
333
|
+
})(t) || d(313, String(t.id), String(N)), t.initResult;
|
|
334
|
+
}
|
|
335
|
+
getInitPeer(t) {
|
|
336
|
+
const e = this.builder.extensionNameMap.get(t);
|
|
337
|
+
return e ? e.getExtensionInitDependency() : void 0;
|
|
338
|
+
}
|
|
339
|
+
getExtensionInitDependency() {
|
|
340
|
+
const t = this.state;
|
|
341
|
+
return (function(e) {
|
|
342
|
+
return e.id >= M;
|
|
343
|
+
})(t) || d(314, String(t.id), String(M)), { config: t.config };
|
|
344
|
+
}
|
|
345
|
+
getPeer(t) {
|
|
346
|
+
const e = this.builder.extensionNameMap.get(t);
|
|
347
|
+
return e ? e.getExtensionDependency() : void 0;
|
|
348
|
+
}
|
|
349
|
+
getInitDependency(t) {
|
|
350
|
+
const e = this.builder.getExtensionRep(t);
|
|
351
|
+
return e === void 0 && d(315, this.extension.name, t.name), e.getExtensionInitDependency();
|
|
352
|
+
}
|
|
353
|
+
getDependency(t) {
|
|
354
|
+
const e = this.builder.getExtensionRep(t);
|
|
355
|
+
return e === void 0 && d(315, this.extension.name, t.name), e.getExtensionDependency();
|
|
356
|
+
}
|
|
357
|
+
getState() {
|
|
358
|
+
const t = this.state;
|
|
359
|
+
return (function(e) {
|
|
360
|
+
return e.id >= y;
|
|
361
|
+
})(t) || d(316, String(t.id), String(y)), t;
|
|
362
|
+
}
|
|
363
|
+
getDirectDependentNames() {
|
|
364
|
+
return this.builder.incomingEdges.get(this.extension.name) || It;
|
|
365
|
+
}
|
|
366
|
+
getPeerNameSet() {
|
|
367
|
+
let t = this._peerNameSet;
|
|
368
|
+
return t || (t = new Set((this.extension.peerDependencies || []).map(([e]) => e)), this._peerNameSet = t), t;
|
|
369
|
+
}
|
|
370
|
+
getExtensionDependency() {
|
|
371
|
+
if (!this._dependency) {
|
|
372
|
+
const t = this.state;
|
|
373
|
+
(function(e) {
|
|
374
|
+
return e.id >= E;
|
|
375
|
+
})(t) || d(317, this.extension.name), this._dependency = { config: t.config, init: t.initResult, output: t.output };
|
|
376
|
+
}
|
|
377
|
+
return this._dependency;
|
|
378
|
+
}
|
|
379
|
+
}
|
|
380
|
+
const B = { tag: Et };
|
|
381
|
+
function jt() {
|
|
382
|
+
const i = J();
|
|
383
|
+
i.isEmpty() && i.append(V());
|
|
384
|
+
}
|
|
385
|
+
const $t = /* @__PURE__ */ ht({ config: /* @__PURE__ */ mt({ setOptions: B, updateOptions: B }), init: ({ $initialEditorState: i = jt }) => ({ $initialEditorState: i, initialized: !1 }), afterRegistration(i, { updateOptions: t, setOptions: e }, n) {
|
|
386
|
+
const o = n.getInitResult();
|
|
387
|
+
if (!o.initialized) {
|
|
388
|
+
o.initialized = !0;
|
|
389
|
+
const { $initialEditorState: s } = o;
|
|
390
|
+
if (vt(s)) i.setEditorState(s, e);
|
|
391
|
+
else if (typeof s == "function") i.update(() => {
|
|
392
|
+
s(i);
|
|
393
|
+
}, t);
|
|
394
|
+
else if (s && (typeof s == "string" || typeof s == "object")) {
|
|
395
|
+
const r = i.parseEditorState(s);
|
|
396
|
+
i.setEditorState(r, e);
|
|
397
|
+
}
|
|
398
|
+
}
|
|
399
|
+
return () => {
|
|
400
|
+
};
|
|
401
|
+
}, name: "@lexical/extension/InitialState", nodes: [ft, ut, lt, gt, pt] }), F = Symbol.for("@lexical/extension/LexicalBuilder");
|
|
402
|
+
function H() {
|
|
403
|
+
}
|
|
404
|
+
function At(i) {
|
|
405
|
+
throw i;
|
|
406
|
+
}
|
|
407
|
+
function R(i) {
|
|
408
|
+
return Array.isArray(i) ? i : [i];
|
|
409
|
+
}
|
|
410
|
+
const P = Dt;
|
|
411
|
+
class b {
|
|
412
|
+
roots;
|
|
413
|
+
extensionNameMap;
|
|
414
|
+
outgoingConfigEdges;
|
|
415
|
+
incomingEdges;
|
|
416
|
+
conflicts;
|
|
417
|
+
_sortedExtensionReps;
|
|
418
|
+
PACKAGE_VERSION;
|
|
419
|
+
constructor(t) {
|
|
420
|
+
this.outgoingConfigEdges = /* @__PURE__ */ new Map(), this.incomingEdges = /* @__PURE__ */ new Map(), this.extensionNameMap = /* @__PURE__ */ new Map(), this.conflicts = /* @__PURE__ */ new Map(), this.PACKAGE_VERSION = P, this.roots = t;
|
|
421
|
+
for (const e of t) this.addExtension(e);
|
|
422
|
+
}
|
|
423
|
+
static fromExtensions(t) {
|
|
424
|
+
const e = [R($t)];
|
|
425
|
+
for (const n of t) e.push(R(n));
|
|
426
|
+
return new b(e);
|
|
427
|
+
}
|
|
428
|
+
static maybeFromEditor(t) {
|
|
429
|
+
const e = t[F];
|
|
430
|
+
return e && (e.PACKAGE_VERSION !== P && d(292, e.PACKAGE_VERSION, P), e instanceof b || d(293)), e;
|
|
431
|
+
}
|
|
432
|
+
static fromEditor(t) {
|
|
433
|
+
const e = b.maybeFromEditor(t);
|
|
434
|
+
return e === void 0 && d(294), e;
|
|
435
|
+
}
|
|
436
|
+
constructEditor() {
|
|
437
|
+
const { $initialEditorState: t, onError: e, onWarn: n, ...o } = this.buildCreateEditorArgs(), s = Object.assign(at({ ...o, ...e ? { onError: (r) => {
|
|
438
|
+
e(r, s);
|
|
439
|
+
} } : {}, ...n ? { onWarn: (r) => {
|
|
440
|
+
n(r, s);
|
|
441
|
+
} } : {} }), { [F]: this });
|
|
442
|
+
for (const r of this.sortedExtensionReps()) r.build(s);
|
|
443
|
+
return s;
|
|
444
|
+
}
|
|
445
|
+
buildEditor() {
|
|
446
|
+
let t = H;
|
|
447
|
+
function e() {
|
|
448
|
+
try {
|
|
449
|
+
t();
|
|
450
|
+
} finally {
|
|
451
|
+
t = H;
|
|
452
|
+
}
|
|
453
|
+
}
|
|
454
|
+
const n = Object.assign(this.constructEditor(), { dispose: e, [Symbol.dispose]: e });
|
|
455
|
+
return t = T(this.registerEditor(n), () => n.setRootElement(null)), n;
|
|
456
|
+
}
|
|
457
|
+
hasExtensionByName(t) {
|
|
458
|
+
return this.extensionNameMap.has(t);
|
|
459
|
+
}
|
|
460
|
+
getExtensionRep(t) {
|
|
461
|
+
const e = this.extensionNameMap.get(t.name);
|
|
462
|
+
if (e) return e.extension !== t && d(295, t.name), e;
|
|
463
|
+
}
|
|
464
|
+
addEdge(t, e, n) {
|
|
465
|
+
const o = this.outgoingConfigEdges.get(t);
|
|
466
|
+
o ? o.set(e, n) : this.outgoingConfigEdges.set(t, /* @__PURE__ */ new Map([[e, n]]));
|
|
467
|
+
const s = this.incomingEdges.get(e);
|
|
468
|
+
s ? s.add(t) : this.incomingEdges.set(e, /* @__PURE__ */ new Set([t]));
|
|
469
|
+
}
|
|
470
|
+
addExtension(t) {
|
|
471
|
+
this._sortedExtensionReps !== void 0 && d(296);
|
|
472
|
+
const e = R(t), [n] = e;
|
|
473
|
+
typeof n.name != "string" && d(297, typeof n.name);
|
|
474
|
+
let o = this.extensionNameMap.get(n.name);
|
|
475
|
+
if (o !== void 0 && o.extension !== n && d(298, n.name), !o) {
|
|
476
|
+
o = new Pt(this, n), this.extensionNameMap.set(n.name, o);
|
|
477
|
+
const s = this.conflicts.get(n.name);
|
|
478
|
+
typeof s == "string" && d(299, n.name, s);
|
|
479
|
+
for (const r of n.conflictsWith || []) this.extensionNameMap.has(r) && d(299, n.name, r), this.conflicts.set(r, n.name);
|
|
480
|
+
for (const r of n.dependencies || []) {
|
|
481
|
+
const c = R(r);
|
|
482
|
+
this.addEdge(n.name, c[0].name, c.slice(1)), this.addExtension(c);
|
|
483
|
+
}
|
|
484
|
+
for (const [r, c] of n.peerDependencies || []) this.addEdge(n.name, r, c ? [c] : []);
|
|
485
|
+
}
|
|
486
|
+
}
|
|
487
|
+
sortedExtensionReps() {
|
|
488
|
+
if (this._sortedExtensionReps) return this._sortedExtensionReps;
|
|
489
|
+
const t = [], e = (n, o) => {
|
|
490
|
+
let s = n.state;
|
|
491
|
+
if (et(s)) return;
|
|
492
|
+
const r = n.extension.name;
|
|
493
|
+
var c;
|
|
494
|
+
I(s) || d(300, r, o || "[unknown]"), I(c = s) || d(304, String(c.id), String(k)), s = Object.assign(c, { id: j }), n.state = s;
|
|
495
|
+
const u = this.outgoingConfigEdges.get(r);
|
|
496
|
+
if (u) for (const l of u.keys()) {
|
|
497
|
+
const g = this.extensionNameMap.get(l);
|
|
498
|
+
g && e(g, r);
|
|
499
|
+
}
|
|
500
|
+
s = _t(s), n.state = s, t.push(n);
|
|
501
|
+
};
|
|
502
|
+
for (const n of this.extensionNameMap.values()) I(n.state) && e(n);
|
|
503
|
+
for (const n of t) for (const [o, s] of this.outgoingConfigEdges.get(n.extension.name) || []) if (s.length > 0) {
|
|
504
|
+
const r = this.extensionNameMap.get(o);
|
|
505
|
+
if (r) for (const c of s) r.configs.add(c);
|
|
506
|
+
}
|
|
507
|
+
for (const [n, ...o] of this.roots) if (o.length > 0) {
|
|
508
|
+
const s = this.extensionNameMap.get(n.name);
|
|
509
|
+
s === void 0 && d(301, n.name);
|
|
510
|
+
for (const r of o) s.configs.add(r);
|
|
511
|
+
}
|
|
512
|
+
return this._sortedExtensionReps = t, this._sortedExtensionReps;
|
|
513
|
+
}
|
|
514
|
+
registerEditor(t) {
|
|
515
|
+
const e = this.sortedExtensionReps(), n = new AbortController(), o = [() => n.abort()], s = n.signal;
|
|
516
|
+
for (const r of e) {
|
|
517
|
+
const c = r.register(t, s);
|
|
518
|
+
c && o.push(c);
|
|
519
|
+
}
|
|
520
|
+
for (const r of e) {
|
|
521
|
+
const c = r.afterRegistration(t);
|
|
522
|
+
c && o.push(c);
|
|
523
|
+
}
|
|
524
|
+
return T(...o);
|
|
525
|
+
}
|
|
526
|
+
buildCreateEditorArgs() {
|
|
527
|
+
const t = {}, e = /* @__PURE__ */ new Set(), n = /* @__PURE__ */ new Map(), o = /* @__PURE__ */ new Map(), s = {}, r = {}, c = this.sortedExtensionReps();
|
|
528
|
+
for (const g of c) {
|
|
529
|
+
const { extension: h } = g;
|
|
530
|
+
if (h.onError !== void 0 && (t.onError = h.onError), h.onWarn !== void 0 && (t.onWarn = h.onWarn), h.disableEvents !== void 0 && (t.disableEvents = h.disableEvents), h.parentEditor !== void 0 && (t.parentEditor = h.parentEditor), h.editable !== void 0 && (t.editable = h.editable), h.namespace !== void 0 && (t.namespace = h.namespace), h.$initialEditorState !== void 0 && (t.$initialEditorState = h.$initialEditorState), h.nodes) for (const p of Ct(h)) {
|
|
531
|
+
if (typeof p != "function") {
|
|
532
|
+
const w = n.get(p.replace);
|
|
533
|
+
w && d(302, h.name, p.replace.name, w.extension.name), n.set(p.replace, g);
|
|
534
|
+
}
|
|
535
|
+
e.add(p);
|
|
536
|
+
}
|
|
537
|
+
if (h.html) {
|
|
538
|
+
if (h.html.export) for (const [p, w] of h.html.export.entries()) o.set(p, w);
|
|
539
|
+
h.html.import && Object.assign(s, h.html.import);
|
|
540
|
+
}
|
|
541
|
+
h.theme && q(r, h.theme);
|
|
542
|
+
}
|
|
543
|
+
Object.keys(r).length > 0 && (t.theme = r), e.size && (t.nodes = [...e]);
|
|
544
|
+
const u = Object.keys(s).length > 0, l = o.size > 0;
|
|
545
|
+
(u || l) && (t.html = {}, u && (t.html.import = s), l && (t.html.export = o));
|
|
546
|
+
for (const g of c) g.init(t);
|
|
547
|
+
return t.onError || (t.onError = At), t;
|
|
548
|
+
}
|
|
549
|
+
}
|
|
550
|
+
function kt(i, t) {
|
|
551
|
+
const e = b.maybeFromEditor(i);
|
|
552
|
+
if (!e) return;
|
|
553
|
+
const n = e.extensionNameMap.get(t);
|
|
554
|
+
return n ? n.getExtensionDependency() : void 0;
|
|
555
|
+
}
|
|
556
|
+
function Lt(i) {
|
|
557
|
+
return kt(dt(), i);
|
|
558
|
+
}
|
|
559
|
+
class W extends yt {
|
|
560
|
+
static getType() {
|
|
561
|
+
return "horizontalrule";
|
|
562
|
+
}
|
|
563
|
+
static clone(t) {
|
|
564
|
+
return new W(t.__key);
|
|
565
|
+
}
|
|
566
|
+
static importJSON(t) {
|
|
567
|
+
return it().updateFromJSON(t);
|
|
568
|
+
}
|
|
569
|
+
static importDOM() {
|
|
570
|
+
return { hr: () => ({ conversion: Wt, priority: 0 }) };
|
|
571
|
+
}
|
|
572
|
+
exportDOM() {
|
|
573
|
+
return { element: U().createElement("hr") };
|
|
574
|
+
}
|
|
575
|
+
createDOM(t) {
|
|
576
|
+
const e = U().createElement("hr");
|
|
577
|
+
return St(e, t.theme.hr), e;
|
|
578
|
+
}
|
|
579
|
+
getTextContent() {
|
|
580
|
+
return `
|
|
581
|
+
`;
|
|
582
|
+
}
|
|
583
|
+
isInline() {
|
|
584
|
+
return !1;
|
|
585
|
+
}
|
|
586
|
+
updateDOM() {
|
|
587
|
+
return !1;
|
|
588
|
+
}
|
|
589
|
+
}
|
|
590
|
+
function Wt() {
|
|
591
|
+
return { node: it() };
|
|
592
|
+
}
|
|
593
|
+
function it() {
|
|
594
|
+
return xt(W);
|
|
595
|
+
}
|
|
596
|
+
export {
|
|
597
|
+
it as $createHorizontalRuleNode,
|
|
598
|
+
Lt as $getPeerDependency,
|
|
599
|
+
W as HorizontalRuleNode,
|
|
600
|
+
$t as InitialStateExtension,
|
|
601
|
+
b as LexicalBuilder,
|
|
602
|
+
ht as defineExtension,
|
|
603
|
+
Rt as effect,
|
|
604
|
+
kt as getPeerDependencyFromEditor,
|
|
605
|
+
Ut as registerClearEditor,
|
|
606
|
+
mt as safeCast,
|
|
607
|
+
ct as shallowMergeConfig,
|
|
608
|
+
wt as signal,
|
|
609
|
+
z as untracked,
|
|
610
|
+
zt as watchedSignal
|
|
611
|
+
};
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { mergeRegister as P, CAN_REDO_COMMAND as k, CAN_UNDO_COMMAND as E, CLEAR_HISTORY_COMMAND as U, COMMAND_PRIORITY_EDITOR as R, CLEAR_EDITOR_COMMAND as v, REDO_COMMAND as w, HISTORIC_TAG as z, UNDO_COMMAND as J, COMPOSITION_START_TAG as L, COMPOSITION_END_TAG as Y, PASTE_TAG as b, CUT_TAG as $, HISTORY_PUSH_TAG as Q, HISTORY_MERGE_TAG as X, $isRangeSelection as D, $isTextNode as N, $isRootNode as Z } from "../../../lexical/dist/Lexical.prod.js";
|
|
3
|
+
function j(t, o, C, l, p) {
|
|
4
|
+
if (t === null || C.size === 0 && l.size === 0 && !p) return 0;
|
|
5
|
+
const i = o._selection, h = t._selection;
|
|
6
|
+
if (p) return 1;
|
|
7
|
+
if (!(D(i) && D(h) && h.isCollapsed() && i.isCollapsed())) return 0;
|
|
8
|
+
const s = (function(_, m, A) {
|
|
9
|
+
const T = _._nodeMap, y = [];
|
|
10
|
+
for (const O of m) {
|
|
11
|
+
const S = T.get(O);
|
|
12
|
+
S !== void 0 && y.push(S);
|
|
13
|
+
}
|
|
14
|
+
for (const [O, S] of A) {
|
|
15
|
+
if (!S) continue;
|
|
16
|
+
const M = T.get(O);
|
|
17
|
+
M === void 0 || Z(M) || y.push(M);
|
|
18
|
+
}
|
|
19
|
+
return y;
|
|
20
|
+
})(o, C, l);
|
|
21
|
+
if (s.length === 0) return 0;
|
|
22
|
+
if (s.length > 1) {
|
|
23
|
+
const _ = o._nodeMap, m = _.get(i.anchor.key), A = _.get(h.anchor.key);
|
|
24
|
+
return m && A && !t._nodeMap.has(m.__key) && N(m) && m.__text.length === 1 && i.anchor.offset === 1 ? 2 : 0;
|
|
25
|
+
}
|
|
26
|
+
const e = s[0], d = t._nodeMap.get(e.__key);
|
|
27
|
+
if (!N(d) || !N(e) || d.__mode !== e.__mode) return 0;
|
|
28
|
+
const u = d.__text, a = e.__text;
|
|
29
|
+
if (u === a) return 0;
|
|
30
|
+
const r = i.anchor, n = h.anchor;
|
|
31
|
+
if (r.key !== n.key || r.type !== "text") return 0;
|
|
32
|
+
const c = r.offset, f = n.offset, g = a.length - u.length;
|
|
33
|
+
return g === 1 && f === c - 1 ? 2 : g === -1 && f === c + 1 ? 3 : g === -1 && f === c ? 4 : 0;
|
|
34
|
+
}
|
|
35
|
+
function q(t, o, C) {
|
|
36
|
+
let l = C(), p = 0, i = l, h = 0, s = null;
|
|
37
|
+
return (e, d, u, a, r, n) => {
|
|
38
|
+
const c = C();
|
|
39
|
+
if (n.has(L) && (i = l, h = p, s = e), n.has(z)) return p = 0, l = c, 2;
|
|
40
|
+
n.has(Y) && s && (l = i, p = h, e = s);
|
|
41
|
+
const f = n.has(b) || n.has($) ? 0 : j(e, d, a, r, t.isComposing()), g = (() => {
|
|
42
|
+
const _ = u === null || u.editor === t, m = n.has(Q);
|
|
43
|
+
if (!m && _ && n.has(X)) return 0;
|
|
44
|
+
if (f === 1) return 2;
|
|
45
|
+
if (e === null) return 1;
|
|
46
|
+
const A = d._selection;
|
|
47
|
+
if (!(a.size > 0 || r.size > 0)) return A !== null ? 0 : 2;
|
|
48
|
+
const T = typeof o == "number" ? o : o.peek();
|
|
49
|
+
return m === !1 && f !== 0 && f === p && c < l + T && _ || a.size === 1 && (function(y, O, S) {
|
|
50
|
+
const M = O._nodeMap.get(y), I = S._nodeMap.get(y), x = O._selection, G = S._selection;
|
|
51
|
+
return !(D(x) && D(G) && x.anchor.type === "element" && x.focus.type === "element" && G.anchor.type === "text" && G.focus.type === "text" || !N(M) || !N(I) || M.__parent !== I.__parent) && JSON.stringify(O.read(() => M.exportJSON())) === JSON.stringify(S.read(() => I.exportJSON()));
|
|
52
|
+
})(Array.from(a)[0], e, d) ? 0 : 1;
|
|
53
|
+
})();
|
|
54
|
+
return l = c, p = f, g;
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
function H(t, o) {
|
|
58
|
+
t.undoStack = [], t.redoStack = [], t.current = null;
|
|
59
|
+
}
|
|
60
|
+
function F(t, o, C, l = Date.now, p, i = null) {
|
|
61
|
+
const h = q(t, C, l);
|
|
62
|
+
return P(t.registerCommand(J, () => ((function(s, e, d) {
|
|
63
|
+
const u = e.redoStack, a = e.undoStack;
|
|
64
|
+
if (a.length !== 0) {
|
|
65
|
+
const r = e.current, n = a.pop();
|
|
66
|
+
r !== null && (u.push(r), s.dispatchCommand(k, !0)), a.length === 0 && s.dispatchCommand(E, !1), e.current = n || null, n && n.editor.setEditorState(n.editorState, { tag: z });
|
|
67
|
+
}
|
|
68
|
+
})(t, o), !0), R), t.registerCommand(w, () => ((function(s, e, d) {
|
|
69
|
+
const u = e.redoStack, a = e.undoStack;
|
|
70
|
+
if (u.length !== 0) {
|
|
71
|
+
const r = e.current;
|
|
72
|
+
r !== null && (a.push(r), s.dispatchCommand(E, !0));
|
|
73
|
+
const n = u.pop();
|
|
74
|
+
u.length === 0 && s.dispatchCommand(k, !1), e.current = n || null, n && n.editor.setEditorState(n.editorState, { tag: z });
|
|
75
|
+
}
|
|
76
|
+
})(t, o), !0), R), t.registerCommand(v, () => (H(o), !1), R), t.registerCommand(U, () => (H(o), t.dispatchCommand(k, !1), t.dispatchCommand(E, !1), !0), R), t.registerUpdateListener(({ editorState: s, prevEditorState: e, dirtyLeaves: d, dirtyElements: u, tags: a }) => {
|
|
77
|
+
const r = o.current, n = o.redoStack, c = o.undoStack, f = r === null ? null : r.editorState;
|
|
78
|
+
if (r !== null && s === f) return;
|
|
79
|
+
const g = h(e, s, r, d, u, a);
|
|
80
|
+
if (g === 1) {
|
|
81
|
+
if (n.length !== 0 && (o.redoStack = [], t.dispatchCommand(k, !1)), r !== null) {
|
|
82
|
+
c.push({ ...r });
|
|
83
|
+
const _ = typeof i == "number" || i === null ? i : i.peek();
|
|
84
|
+
_ !== null && c.length > _ && c.splice(0, c.length - _), t.dispatchCommand(E, !0);
|
|
85
|
+
}
|
|
86
|
+
} else if (g === 2) return;
|
|
87
|
+
o.current = { editor: t, editorState: s };
|
|
88
|
+
}));
|
|
89
|
+
}
|
|
90
|
+
function K() {
|
|
91
|
+
return { current: null, redoStack: [], undoStack: [] };
|
|
92
|
+
}
|
|
93
|
+
export {
|
|
94
|
+
K as createEmptyHistoryState,
|
|
95
|
+
F as registerHistory
|
|
96
|
+
};
|