laif-ds 0.2.85 → 0.2.87
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 +13 -0
- package/dist/_virtual/index6.js +2 -2
- package/dist/_virtual/index7.js +2 -2
- 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/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/index2.js +1 -1
- package/dist/node_modules/lexical/dist/Lexical.prod.js +6731 -0
- package/dist/node_modules/style-to-object/cjs/index.js +1 -1
- package/package.json +17 -15
- 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,567 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { $insertDataTransferForRichText as re, copyToClipboard as ne, setLexicalClipboardDataTransfer as ve, $getClipboardDataFromSelection as Ie, $writeDragSourceToDataTransfer as Ke, caretFromPoint as _e, $handleRichTextDrop as Pe } from "../../clipboard/dist/LexicalClipboard.prod.js";
|
|
3
|
+
import { signal as Fe } from "../../extension/dist/LexicalExtension.prod.js";
|
|
4
|
+
import { $isParentRTL as w, $shouldOverrideDefaultCharacterSelection as se, $moveCharacter as oe } from "../../selection/dist/LexicalSelection.prod.js";
|
|
5
|
+
import { eventFiles as $, objectKlassEquals as L, $getNearestBlockElementAncestorOrThrow as be, $handleIndentAndOutdent as ae } from "../../utils/dist/LexicalUtils.prod.js";
|
|
6
|
+
import { ElementNode as V, $getDocument as J, addClassNamesToElement as Ee, isHTMLElement as Z, $createParagraphNode as x, createState as we, $getState as $e, $setState as Le, $applyNodeReplacement as Te, setNodeIndentFromDOM as P, $setFormatFromDOM as F, $setDirectionFromDOM as b, mergeRegister as ke, MOVE_TO_START as Be, $getSelection as f, $isNodeSelection as C, $isRangeSelection as d, $findMatchingParent as E, $isElementNode as N, $isDecoratorNode as v, COMMAND_PRIORITY_EDITOR as c, MOVE_TO_END as ze, KEY_TAB_COMMAND as Ye, KEY_SPACE_COMMAND as Je, PASTE_COMMAND as qe, createCommand as We, isDOMNode as Xe, $isSelectionCapturedInDecoratorInput as He, PASTE_TAG as Ge, CUT_COMMAND as Ue, CUT_TAG as Ve, COPY_COMMAND as je, SELECT_ALL_COMMAND as Qe, $selectAll as Ze, $getSlotFrame as et, DRAGOVER_COMMAND as tt, DRAGSTART_COMMAND as rt, DROP_COMMAND as nt, $getNearestNodeFromDOMNode as ee, $createRangeSelection as st, $isTextNode as A, $normalizeSelection__EXPERIMENTAL as ot, $setSelection as Oe, KEY_ESCAPE_COMMAND as at, KEY_ENTER_COMMAND as it, IS_IOS as ie, IS_SAFARI as lt, IS_APPLE_WEBKIT as ut, CAN_USE_BEFORE_INPUT as le, INSERT_LINE_BREAK_COMMAND as ue, INSERT_PARAGRAPH_COMMAND as ce, KEY_DELETE_COMMAND as ct, DELETE_CHARACTER_COMMAND as H, KEY_BACKSPACE_COMMAND as ft, $isRootNode as Me, OUTDENT_CONTENT_COMMAND as fe, KEY_ARROW_RIGHT_COMMAND as dt, KEY_ARROW_LEFT_COMMAND as gt, KEY_ARROW_DOWN_COMMAND as mt, $getRoot as Ae, KEY_ARROW_UP_COMMAND as ht, INDENT_CONTENT_COMMAND as pt, INSERT_TAB_COMMAND as Ct, $createTabNode as Nt, $insertNodes as Dt, FORMAT_ELEMENT_COMMAND as _t, SET_TEXT_FORMAT_COMMAND as Et, $setTextFormat as Tt, FORMAT_TEXT_COMMAND as Ot, $formatText as Mt, REMOVE_TEXT_COMMAND as At, CONTROLLED_TEXT_INSERTION_COMMAND as St, DELETE_LINE_COMMAND as yt, DELETE_WORD_COMMAND as Rt, CLICK_COMMAND as xt, $getSiblingCaret as T, $comparePointCaretNext as vt, $setSelectionFromCaretRange as j, $getCollapsedCaretRange as Se, $caretFromPoint as Q, $isShadowRootNode as Y, $hasAncestor as ye, $getCaretRange as G, $isSiblingCaret as It, $extendCaretToRange as Kt, $needsBlockCursorBeside as Pt, $normalizeCaret as Ft, $getChildCaret as bt, $isRootOrShadowRoot as wt, $getEditor as Re, getDOMSelection as xe, $createNodeSelection as $t } from "../../../lexical/dist/Lexical.prod.js";
|
|
7
|
+
import { defineImportRule as I, sel as K, BlockSchema as Lt } from "../../html/dist/LexicalHtml.prod.js";
|
|
8
|
+
const kt = /* @__PURE__ */ I({ $import: (n, r) => {
|
|
9
|
+
const e = S(r.nodeName.toLowerCase());
|
|
10
|
+
return P(r, e), F(e, r), b(e, r), [e.splice(0, 0, n.$importChildren(r))];
|
|
11
|
+
}, match: K.tag("h1", "h2", "h3", "h4", "h5", "h6"), name: "@lexical/rich-text/heading" }), Bt = /* @__PURE__ */ I({ $import: (n, r) => {
|
|
12
|
+
const e = W();
|
|
13
|
+
return F(e, r), P(r, e), b(e, r), [e.splice(0, 0, n.$importChildren(r))];
|
|
14
|
+
}, match: K.tag("blockquote"), name: "@lexical/rich-text/blockquote" });
|
|
15
|
+
K.tag("blockquote");
|
|
16
|
+
K.tag("p"), K.tag("span");
|
|
17
|
+
const de = /* @__PURE__ */ We("DRAG_DROP_PASTE_FILE"), U = /* @__PURE__ */ we("shadowRoot", { parse: Boolean });
|
|
18
|
+
class q extends V {
|
|
19
|
+
static getType() {
|
|
20
|
+
return "quote";
|
|
21
|
+
}
|
|
22
|
+
static clone(r) {
|
|
23
|
+
return new q(r.__key);
|
|
24
|
+
}
|
|
25
|
+
$config() {
|
|
26
|
+
return this.config("quote", { extends: V, stateConfigs: [{ flat: !0, stateConfig: U }] });
|
|
27
|
+
}
|
|
28
|
+
isShadowRoot() {
|
|
29
|
+
return $e(this, U);
|
|
30
|
+
}
|
|
31
|
+
setIsShadowRoot(r) {
|
|
32
|
+
return Le(this, U, r);
|
|
33
|
+
}
|
|
34
|
+
createDOM(r) {
|
|
35
|
+
const e = J().createElement("blockquote");
|
|
36
|
+
return Ee(e, r.theme.quote), e;
|
|
37
|
+
}
|
|
38
|
+
updateDOM(r, e) {
|
|
39
|
+
return !1;
|
|
40
|
+
}
|
|
41
|
+
static importDOM() {
|
|
42
|
+
return { blockquote: (r) => ({ conversion: zt, priority: 0 }) };
|
|
43
|
+
}
|
|
44
|
+
exportDOM(r) {
|
|
45
|
+
const { element: e } = super.exportDOM(r);
|
|
46
|
+
if (Z(e)) {
|
|
47
|
+
this.isEmpty() && e.append(J().createElement("br"));
|
|
48
|
+
const t = this.getFormatType();
|
|
49
|
+
t && (e.style.textAlign = t);
|
|
50
|
+
const s = this.getDirection();
|
|
51
|
+
s && (e.dir = s);
|
|
52
|
+
}
|
|
53
|
+
return { element: e };
|
|
54
|
+
}
|
|
55
|
+
static importJSON(r) {
|
|
56
|
+
return W().updateFromJSON(r);
|
|
57
|
+
}
|
|
58
|
+
exportJSON() {
|
|
59
|
+
return super.exportJSON();
|
|
60
|
+
}
|
|
61
|
+
insertNewAfter(r, e) {
|
|
62
|
+
const t = x(), s = this.getDirection();
|
|
63
|
+
return t.setDirection(s), this.insertAfter(t, e), t;
|
|
64
|
+
}
|
|
65
|
+
collapseAtStart() {
|
|
66
|
+
if (this.isShadowRoot()) {
|
|
67
|
+
for (const e of this.getChildren()) this.insertBefore(e);
|
|
68
|
+
return this.remove(), !0;
|
|
69
|
+
}
|
|
70
|
+
const r = x();
|
|
71
|
+
return this.getChildren().forEach((e) => r.append(e)), this.replace(r), !0;
|
|
72
|
+
}
|
|
73
|
+
canMergeWhenEmpty() {
|
|
74
|
+
return !0;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
function W(n) {
|
|
78
|
+
const r = Te(new q());
|
|
79
|
+
return n && n.shadowRoot ? r.setIsShadowRoot(!0) : r;
|
|
80
|
+
}
|
|
81
|
+
function Ut(n) {
|
|
82
|
+
return n instanceof q;
|
|
83
|
+
}
|
|
84
|
+
class X extends V {
|
|
85
|
+
__tag;
|
|
86
|
+
static getType() {
|
|
87
|
+
return "heading";
|
|
88
|
+
}
|
|
89
|
+
static clone(r) {
|
|
90
|
+
return new X(r.__tag, r.__key);
|
|
91
|
+
}
|
|
92
|
+
afterCloneFrom(r) {
|
|
93
|
+
super.afterCloneFrom(r), this.__tag = r.__tag;
|
|
94
|
+
}
|
|
95
|
+
constructor(r = "h1", e) {
|
|
96
|
+
super(e), this.__tag = r;
|
|
97
|
+
}
|
|
98
|
+
getTag() {
|
|
99
|
+
return this.getLatest().__tag;
|
|
100
|
+
}
|
|
101
|
+
setTag(r) {
|
|
102
|
+
const e = this.getWritable();
|
|
103
|
+
return e.__tag = r, e;
|
|
104
|
+
}
|
|
105
|
+
createDOM(r) {
|
|
106
|
+
const e = this.__tag, t = J().createElement(e), s = r.theme.heading;
|
|
107
|
+
if (s !== void 0) {
|
|
108
|
+
const o = s[e];
|
|
109
|
+
Ee(t, o);
|
|
110
|
+
}
|
|
111
|
+
return t;
|
|
112
|
+
}
|
|
113
|
+
updateDOM(r, e, t) {
|
|
114
|
+
return r.__tag !== this.__tag;
|
|
115
|
+
}
|
|
116
|
+
static importDOM() {
|
|
117
|
+
return { h1: (r) => ({ conversion: O, priority: 0 }), h2: (r) => ({ conversion: O, priority: 0 }), h3: (r) => ({ conversion: O, priority: 0 }), h4: (r) => ({ conversion: O, priority: 0 }), h5: (r) => ({ conversion: O, priority: 0 }), h6: (r) => ({ conversion: O, priority: 0 }), p: (r) => {
|
|
118
|
+
const e = r.firstChild;
|
|
119
|
+
return e !== null && ge(e) ? { conversion: () => ({ node: null }), priority: 3 } : null;
|
|
120
|
+
}, span: (r) => ge(r) ? { conversion: (e) => ({ node: S("h1") }), priority: 3 } : null };
|
|
121
|
+
}
|
|
122
|
+
exportDOM(r) {
|
|
123
|
+
const { element: e } = super.exportDOM(r);
|
|
124
|
+
if (Z(e)) {
|
|
125
|
+
this.isEmpty() && e.append(J().createElement("br"));
|
|
126
|
+
const t = this.getFormatType();
|
|
127
|
+
t && (e.style.textAlign = t);
|
|
128
|
+
const s = this.getDirection();
|
|
129
|
+
s && (e.dir = s);
|
|
130
|
+
}
|
|
131
|
+
return { element: e };
|
|
132
|
+
}
|
|
133
|
+
static importJSON(r) {
|
|
134
|
+
return S(r.tag).updateFromJSON(r);
|
|
135
|
+
}
|
|
136
|
+
updateFromJSON(r) {
|
|
137
|
+
return super.updateFromJSON(r).setTag(r.tag);
|
|
138
|
+
}
|
|
139
|
+
exportJSON() {
|
|
140
|
+
return { ...super.exportJSON(), tag: this.getTag() };
|
|
141
|
+
}
|
|
142
|
+
insertNewAfter(r, e = !0) {
|
|
143
|
+
const t = r ? r.anchor.offset : 0, s = this.getLastDescendant(), o = !s || r && r.anchor.key === s.getKey() && t === s.getTextContentSize() || !r ? x() : S(this.getTag()), i = this.getDirection();
|
|
144
|
+
if (o.setDirection(i), this.insertAfter(o, e), t === 0 && !this.isEmpty() && r) {
|
|
145
|
+
const a = x();
|
|
146
|
+
a.select(), this.replace(a, !0);
|
|
147
|
+
}
|
|
148
|
+
return o;
|
|
149
|
+
}
|
|
150
|
+
collapseAtStart() {
|
|
151
|
+
if (this.isEmpty()) {
|
|
152
|
+
const r = x();
|
|
153
|
+
this.getChildren().forEach((e) => r.append(e)), this.replace(r);
|
|
154
|
+
}
|
|
155
|
+
return !0;
|
|
156
|
+
}
|
|
157
|
+
extractWithChild() {
|
|
158
|
+
return !0;
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
function ge(n) {
|
|
162
|
+
return n.nodeName.toLowerCase() === "span" && n.style.fontSize === "26pt";
|
|
163
|
+
}
|
|
164
|
+
function O(n) {
|
|
165
|
+
const r = n.nodeName.toLowerCase();
|
|
166
|
+
let e = null;
|
|
167
|
+
return r !== "h1" && r !== "h2" && r !== "h3" && r !== "h4" && r !== "h5" && r !== "h6" || (e = S(r), P(n, e), F(e, n), b(e, n)), { node: e };
|
|
168
|
+
}
|
|
169
|
+
function zt(n) {
|
|
170
|
+
const r = W();
|
|
171
|
+
return F(r, n), P(n, r), b(r, n), { node: r };
|
|
172
|
+
}
|
|
173
|
+
function S(n = "h1") {
|
|
174
|
+
return Te(new X(n));
|
|
175
|
+
}
|
|
176
|
+
function Vt(n) {
|
|
177
|
+
return n instanceof X;
|
|
178
|
+
}
|
|
179
|
+
function me(n) {
|
|
180
|
+
const r = ee(n);
|
|
181
|
+
return v(r);
|
|
182
|
+
}
|
|
183
|
+
function M(n, r, e, t) {
|
|
184
|
+
let s = !1, o = null;
|
|
185
|
+
if (n.isCollapsed() && n.anchor.type === "text") {
|
|
186
|
+
const a = n.anchor.getNode();
|
|
187
|
+
if (A(a)) {
|
|
188
|
+
o = a;
|
|
189
|
+
const u = n.anchor.offset, l = u === a.getTextContentSize() && a.getNextSibling() === null, m = u === 0 && a.getPreviousSibling() === null;
|
|
190
|
+
s = e === "end" && l || e === "start" && m || e === "both" && (l || m);
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
let i = !1;
|
|
194
|
+
for (const [a, u] of Object.entries(t)) {
|
|
195
|
+
if (u == null || !u[r]) continue;
|
|
196
|
+
const l = a;
|
|
197
|
+
if (u.onlyAtBoundary) {
|
|
198
|
+
if (!(s && o && A(o) && o.hasFormat(l))) continue;
|
|
199
|
+
i = !0;
|
|
200
|
+
}
|
|
201
|
+
n.hasFormat(l) && n.toggleFormat(l);
|
|
202
|
+
}
|
|
203
|
+
i && n.setStyle("");
|
|
204
|
+
}
|
|
205
|
+
const Yt = { capitalize: { enter: !0, space: !0, tab: !0 }, lowercase: { enter: !0, space: !0, tab: !0 }, uppercase: { enter: !0, space: !0, tab: !0 } };
|
|
206
|
+
function k(n, r) {
|
|
207
|
+
return (function(e, t) {
|
|
208
|
+
if (!e.isCollapsed()) return !1;
|
|
209
|
+
const s = Q(e.focus, t), o = E(s.origin, Y);
|
|
210
|
+
if (!o) return !1;
|
|
211
|
+
const i = e.focus.getNode();
|
|
212
|
+
if (!o.is(i) && !ye(i, o)) return !1;
|
|
213
|
+
const a = G(s, T(o, t));
|
|
214
|
+
if (a.getTextSlices().some((h) => h && h.getTextContentSize() > 0)) return !1;
|
|
215
|
+
const u = G(a.anchor.getSiblingCaret(), a.focus);
|
|
216
|
+
let l = u.anchor.origin;
|
|
217
|
+
for (const h of u) {
|
|
218
|
+
if (!It(h) || !h.origin.is(l.getParent())) return !1;
|
|
219
|
+
l = h.origin;
|
|
220
|
+
}
|
|
221
|
+
let m = o;
|
|
222
|
+
for (const h of Kt(T(o, t))) {
|
|
223
|
+
if (!h.origin.is(m.getParent())) {
|
|
224
|
+
if (Pt(h.origin)) {
|
|
225
|
+
const D = T(m, t);
|
|
226
|
+
return j(G(D, D)), !0;
|
|
227
|
+
}
|
|
228
|
+
break;
|
|
229
|
+
}
|
|
230
|
+
if (!Y(h.origin)) break;
|
|
231
|
+
m = h.origin;
|
|
232
|
+
}
|
|
233
|
+
return !1;
|
|
234
|
+
})(n, r) || (function(e, t) {
|
|
235
|
+
if (!e.isCollapsed() || e.anchor.type !== "element") return !1;
|
|
236
|
+
const s = Q(e.anchor, t).getNodeAtCaret();
|
|
237
|
+
return !(!Y(s) || s.isInline() || (j(Se(Ft(bt(s, t)))), 0));
|
|
238
|
+
})(n, r);
|
|
239
|
+
}
|
|
240
|
+
function he(n) {
|
|
241
|
+
return v(n) && !n.isInline() && !n.isIsolated() && n.isKeyboardSelectable();
|
|
242
|
+
}
|
|
243
|
+
function B(n) {
|
|
244
|
+
const r = $t();
|
|
245
|
+
r.add(n), Oe(r);
|
|
246
|
+
}
|
|
247
|
+
function pe(n, r) {
|
|
248
|
+
if (!n.isCollapsed()) return !1;
|
|
249
|
+
const e = n.focus, t = e.getNode(), s = r ? "previous" : "next", o = Q(e, s);
|
|
250
|
+
if (e.type === "element" && N(t) && (Me(t) || Y(t))) {
|
|
251
|
+
const p = o.getNodeAtCaret();
|
|
252
|
+
return !(p === null || !he(p)) && (B(p.__key), !0);
|
|
253
|
+
}
|
|
254
|
+
const i = E(N(t) ? t : t.getParentOrThrow(), (p) => N(p) && !p.isInline() && wt(p.getParent()));
|
|
255
|
+
if (i === null) return !1;
|
|
256
|
+
const a = T(i, s).getNodeAtCaret();
|
|
257
|
+
if (a === null || !he(a)) return !1;
|
|
258
|
+
if (i.getTextContentSize() === 0) return B(a.__key), !0;
|
|
259
|
+
const u = Re().getRootElement();
|
|
260
|
+
if (u === null) return !1;
|
|
261
|
+
const l = xe(u.ownerDocument.defaultView);
|
|
262
|
+
if (l === null || l.rangeCount === 0) return !1;
|
|
263
|
+
const m = l.anchorNode, h = l.anchorOffset, D = l.focusNode, _ = l.focusOffset;
|
|
264
|
+
l.modify("move", r ? "backward" : "forward", "line");
|
|
265
|
+
const y = l.anchorNode, R = l.anchorOffset;
|
|
266
|
+
if (y === null) return Ce(l, m, h, D, _), !1;
|
|
267
|
+
const g = ee(y);
|
|
268
|
+
return Ce(l, m, h, D, _), g === null ? !1 : (y === m && R === h || !g.is(i) && !ye(g, i)) && (B(a.__key), !0);
|
|
269
|
+
}
|
|
270
|
+
function Ce(n, r, e, t, s) {
|
|
271
|
+
r !== null && t !== null && n.setBaseAndExtent(r, e, t, s);
|
|
272
|
+
}
|
|
273
|
+
function Ne(n, r) {
|
|
274
|
+
if (!n.isCollapsed()) return !1;
|
|
275
|
+
const e = n.focus.getNode(), t = E(N(e) ? e : e.getParentOrThrow(), (g) => N(g) && !g.isInline());
|
|
276
|
+
if (t === null) return !1;
|
|
277
|
+
const s = Re(), o = s.getRootElement();
|
|
278
|
+
if (o === null) return !1;
|
|
279
|
+
const i = o.ownerDocument.defaultView;
|
|
280
|
+
if (i === null) return !1;
|
|
281
|
+
let a = !1;
|
|
282
|
+
for (const g of t.getChildren()) if (N(g) && g.isInline()) {
|
|
283
|
+
const p = s.getElementByKey(g.getKey());
|
|
284
|
+
if (p !== null) {
|
|
285
|
+
const te = i.getComputedStyle(p).display;
|
|
286
|
+
if (te === "inline-grid" || te === "inline-flex") {
|
|
287
|
+
a = !0;
|
|
288
|
+
break;
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
if (!a) return !1;
|
|
293
|
+
const u = T(t, r ? "previous" : "next").getNodeAtCaret();
|
|
294
|
+
if (u === null || !N(u)) {
|
|
295
|
+
if (r) {
|
|
296
|
+
const g = t.getFirstDescendant();
|
|
297
|
+
A(g) ? g.select(0, 0) : t.select(0, 0);
|
|
298
|
+
} else {
|
|
299
|
+
const g = t.getLastDescendant();
|
|
300
|
+
if (A(g)) {
|
|
301
|
+
const p = g.getTextContentSize();
|
|
302
|
+
g.select(p, p);
|
|
303
|
+
} else {
|
|
304
|
+
const p = t.getChildrenSize();
|
|
305
|
+
t.select(p, p);
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
return !0;
|
|
309
|
+
}
|
|
310
|
+
const l = s.getElementByKey(u.getKey());
|
|
311
|
+
if (l === null) return !1;
|
|
312
|
+
const m = xe(i);
|
|
313
|
+
if (m === null || m.rangeCount === 0) return !1;
|
|
314
|
+
const h = m.getRangeAt(0).cloneRange();
|
|
315
|
+
h.collapse(!0);
|
|
316
|
+
const D = h.getBoundingClientRect(), _ = l.getBoundingClientRect(), y = _.top + _.height / 2;
|
|
317
|
+
if (D.height > 0) {
|
|
318
|
+
const g = _e(D.left, y, o);
|
|
319
|
+
if (g !== null && l.contains(g.node)) {
|
|
320
|
+
const p = o.ownerDocument.createRange();
|
|
321
|
+
return p.setStart(g.node, g.offset), p.collapse(!0), n.applyDOMRange(p), n.dirty = !0, !0;
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
const R = r ? u.getLastDescendant() : u.getFirstDescendant();
|
|
325
|
+
if (A(R)) {
|
|
326
|
+
const g = r ? R.getTextContentSize() : 0;
|
|
327
|
+
R.select(g, g);
|
|
328
|
+
} else {
|
|
329
|
+
const g = u.getChildrenSize();
|
|
330
|
+
u.select(r ? g : 0, r ? g : 0);
|
|
331
|
+
}
|
|
332
|
+
return !0;
|
|
333
|
+
}
|
|
334
|
+
function z(n, r) {
|
|
335
|
+
const e = T(n, r), t = e.getAdjacentCaret();
|
|
336
|
+
t !== null && N(t.origin) && !t.origin.isInline() && t.origin.isShadowRoot() ? j(Se(e)) : r === "next" ? n.selectNext(0, 0) : n.selectPrevious();
|
|
337
|
+
}
|
|
338
|
+
function De(n, r, e) {
|
|
339
|
+
e.preventDefault(), e.stopPropagation();
|
|
340
|
+
const t = n.getNodes();
|
|
341
|
+
if (t.length === 0) return !0;
|
|
342
|
+
const s = t.map((u) => T(u, "next")).sort(vt), o = (r ? s[0] : s[s.length - 1]).origin, i = E(o, (u) => u !== o && N(u) && !u.isInline()) ?? Ae(), a = r ? 0 : i.getChildrenSize();
|
|
343
|
+
return i.select(a, a), !0;
|
|
344
|
+
}
|
|
345
|
+
function jt(n, r = Fe(Yt)) {
|
|
346
|
+
return ke(n.registerCommand(xt, () => {
|
|
347
|
+
const e = f();
|
|
348
|
+
return C(e) ? (e.clear(), !0) : (d(e) && M(e, "click", "both", r.peek()), !1);
|
|
349
|
+
}, c), n.registerCommand(H, (e) => {
|
|
350
|
+
const t = f();
|
|
351
|
+
return d(t) ? (t.deleteCharacter(e), !0) : !!C(t) && (t.deleteNodes(), !0);
|
|
352
|
+
}, c), n.registerCommand(Rt, (e) => {
|
|
353
|
+
const t = f();
|
|
354
|
+
return !!d(t) && (t.deleteWord(e), !0);
|
|
355
|
+
}, c), n.registerCommand(yt, (e) => {
|
|
356
|
+
const t = f();
|
|
357
|
+
return !!d(t) && (t.deleteLine(e), !0);
|
|
358
|
+
}, c), n.registerCommand(St, (e) => {
|
|
359
|
+
const t = f();
|
|
360
|
+
if (typeof e == "string") t !== null && t.insertText(e);
|
|
361
|
+
else {
|
|
362
|
+
if (t === null) return !1;
|
|
363
|
+
const s = e.dataTransfer;
|
|
364
|
+
if (s != null) re(s, t);
|
|
365
|
+
else if (d(t)) {
|
|
366
|
+
const o = e.data;
|
|
367
|
+
return o && t.insertText(o), !0;
|
|
368
|
+
}
|
|
369
|
+
}
|
|
370
|
+
return !0;
|
|
371
|
+
}, c), n.registerCommand(At, () => {
|
|
372
|
+
const e = f();
|
|
373
|
+
return !!d(e) && (e.removeText(), !0);
|
|
374
|
+
}, c), n.registerCommand(Ot, (e) => {
|
|
375
|
+
const t = f();
|
|
376
|
+
return !(!d(t) && !C(t)) && (Mt(t, e), !0);
|
|
377
|
+
}, c), n.registerCommand(Et, (e) => {
|
|
378
|
+
const t = f();
|
|
379
|
+
return !(!d(t) && !C(t)) && (Tt(t, e), !0);
|
|
380
|
+
}, c), n.registerCommand(_t, (e) => {
|
|
381
|
+
const t = f();
|
|
382
|
+
if (!d(t) && !C(t)) return !1;
|
|
383
|
+
const s = t.getNodes();
|
|
384
|
+
for (const o of s) {
|
|
385
|
+
const i = E(o, (a) => N(a) && !a.isInline());
|
|
386
|
+
i !== null && i.setFormat(e);
|
|
387
|
+
}
|
|
388
|
+
return !0;
|
|
389
|
+
}, c), n.registerCommand(ue, (e) => {
|
|
390
|
+
const t = f();
|
|
391
|
+
return !!d(t) && (t.insertLineBreak(e), !0);
|
|
392
|
+
}, c), n.registerCommand(ce, () => {
|
|
393
|
+
const e = f();
|
|
394
|
+
return !!d(e) && (e.insertParagraph(), !0);
|
|
395
|
+
}, c), n.registerCommand(Ct, () => {
|
|
396
|
+
const e = Nt(), t = f();
|
|
397
|
+
return d(t) && (e.setFormat(t.format), e.setStyle(t.style)), Dt([e]), !0;
|
|
398
|
+
}, c), n.registerCommand(pt, () => ae((e) => {
|
|
399
|
+
const t = e.getIndent();
|
|
400
|
+
e.setIndent(t + 1);
|
|
401
|
+
}), c), n.registerCommand(fe, () => ae((e) => {
|
|
402
|
+
const t = e.getIndent();
|
|
403
|
+
t > 0 && e.setIndent(Math.max(0, t - 1));
|
|
404
|
+
}), c), n.registerCommand(ht, (e) => {
|
|
405
|
+
const t = f();
|
|
406
|
+
if (C(t)) {
|
|
407
|
+
const s = t.getNodes();
|
|
408
|
+
if (s.length > 0) return e.preventDefault(), z(s[0], "previous"), !0;
|
|
409
|
+
} else if (d(t) && (!e.shiftKey && k(t, "previous") || !e.shiftKey && pe(t, !0) || !e.shiftKey && Ne(t, !0)))
|
|
410
|
+
return e.preventDefault(), !0;
|
|
411
|
+
return !1;
|
|
412
|
+
}, c), n.registerCommand(mt, (e) => {
|
|
413
|
+
const t = f();
|
|
414
|
+
if (C(t)) {
|
|
415
|
+
const s = t.getNodes();
|
|
416
|
+
if (s.length > 0) return e.preventDefault(), z(s[0], "next"), !0;
|
|
417
|
+
} else if (d(t) && ((function(s) {
|
|
418
|
+
const o = s.focus;
|
|
419
|
+
return o.key === "root" && o.offset === Ae().getChildrenSize();
|
|
420
|
+
})(t) || !e.shiftKey && k(t, "next") || !e.shiftKey && pe(t, !1) || !e.shiftKey && Ne(t, !1)))
|
|
421
|
+
return e.preventDefault(), !0;
|
|
422
|
+
return !1;
|
|
423
|
+
}, c), n.registerCommand(gt, (e) => {
|
|
424
|
+
const t = f();
|
|
425
|
+
if (C(t)) {
|
|
426
|
+
const s = t.getNodes();
|
|
427
|
+
if (s.length > 0) return e.preventDefault(), z(s[0], w(s[0]) ? "next" : "previous"), !0;
|
|
428
|
+
}
|
|
429
|
+
if (!d(t)) return !1;
|
|
430
|
+
if (!e.shiftKey && k(t, w(t.anchor.getNode()) ? "next" : "previous")) return e.preventDefault(), !0;
|
|
431
|
+
if (e.shiftKey || M(t, "arrow", "start", r.peek()), se(t, !0)) {
|
|
432
|
+
const s = e.shiftKey;
|
|
433
|
+
return e.preventDefault(), oe(t, s, !0), !0;
|
|
434
|
+
}
|
|
435
|
+
return !1;
|
|
436
|
+
}, c), n.registerCommand(dt, (e) => {
|
|
437
|
+
const t = f();
|
|
438
|
+
if (C(t)) {
|
|
439
|
+
const s = t.getNodes();
|
|
440
|
+
if (s.length > 0) return e.preventDefault(), z(s[0], w(s[0]) ? "previous" : "next"), !0;
|
|
441
|
+
}
|
|
442
|
+
if (!d(t)) return !1;
|
|
443
|
+
if (!e.shiftKey && k(t, w(t.anchor.getNode()) ? "previous" : "next")) return e.preventDefault(), !0;
|
|
444
|
+
if (e.shiftKey || M(t, "arrow", "end", r.peek()), se(t, !1)) {
|
|
445
|
+
const s = e.shiftKey;
|
|
446
|
+
return e.preventDefault(), oe(t, s, !1), !0;
|
|
447
|
+
}
|
|
448
|
+
return !1;
|
|
449
|
+
}, c), n.registerCommand(ft, (e) => {
|
|
450
|
+
const t = f();
|
|
451
|
+
if (!C(t) && me(e.target)) return !1;
|
|
452
|
+
if (d(t)) {
|
|
453
|
+
if ((function(s) {
|
|
454
|
+
if (!s.isCollapsed()) return !1;
|
|
455
|
+
const { anchor: o } = s;
|
|
456
|
+
if (o.offset !== 0) return !1;
|
|
457
|
+
const i = o.getNode();
|
|
458
|
+
if (Me(i)) return !1;
|
|
459
|
+
const a = be(i);
|
|
460
|
+
return a.getIndent() > 0 && (a.is(i) || i.is(a.getFirstDescendant()));
|
|
461
|
+
})(t)) return e.preventDefault(), n.dispatchCommand(fe, void 0);
|
|
462
|
+
if (ie && le) return !1;
|
|
463
|
+
} else if (!C(t)) return !1;
|
|
464
|
+
return e.preventDefault(), n.dispatchCommand(H, !0);
|
|
465
|
+
}, c), n.registerCommand(ct, (e) => {
|
|
466
|
+
const t = f();
|
|
467
|
+
return !(!C(t) && me(e.target)) && !(!d(t) && !C(t)) && (e.preventDefault(), n.dispatchCommand(H, !1));
|
|
468
|
+
}, c), n.registerCommand(it, (e) => {
|
|
469
|
+
let t = f();
|
|
470
|
+
if (C(t)) {
|
|
471
|
+
const s = t.getNodes();
|
|
472
|
+
s.length === 1 && v(s[0]) && !s[0].isInline() && (t = s[0].selectNext());
|
|
473
|
+
}
|
|
474
|
+
if (!d(t)) return !1;
|
|
475
|
+
if (M(t, "enter", "both", r.peek()), e !== null) {
|
|
476
|
+
if ((ie || lt || ut) && le) return !1;
|
|
477
|
+
if (e.preventDefault(), e.shiftKey) return n.dispatchCommand(ue, !1);
|
|
478
|
+
}
|
|
479
|
+
return n.dispatchCommand(ce, void 0);
|
|
480
|
+
}, c), n.registerCommand(at, () => {
|
|
481
|
+
const e = f();
|
|
482
|
+
return !!d(e) && (n.blur(), !0);
|
|
483
|
+
}, c), n.registerCommand(nt, (e) => {
|
|
484
|
+
const [, t] = $(e);
|
|
485
|
+
if (t.length > 0) {
|
|
486
|
+
const s = e.clientX, o = e.clientY, i = _e(s, o, n.getRootElement());
|
|
487
|
+
if (i !== null) {
|
|
488
|
+
const { offset: a, node: u } = i, l = ee(u);
|
|
489
|
+
if (l !== null) {
|
|
490
|
+
const m = st();
|
|
491
|
+
if (A(l)) m.anchor.set(l.getKey(), a, "text"), m.focus.set(l.getKey(), a, "text");
|
|
492
|
+
else {
|
|
493
|
+
const D = l.getParentOrThrow().getKey(), _ = l.getIndexWithinParent() + 1;
|
|
494
|
+
m.anchor.set(D, _, "element"), m.focus.set(D, _, "element");
|
|
495
|
+
}
|
|
496
|
+
const h = ot(m);
|
|
497
|
+
Oe(h);
|
|
498
|
+
}
|
|
499
|
+
n.dispatchCommand(de, t);
|
|
500
|
+
}
|
|
501
|
+
return e.preventDefault(), !0;
|
|
502
|
+
}
|
|
503
|
+
return Pe(e, n);
|
|
504
|
+
}, c), n.registerCommand(rt, (e) => {
|
|
505
|
+
const [t] = $(e), s = f();
|
|
506
|
+
return !(t && !d(s)) && (d(s) && !s.isCollapsed() && e.dataTransfer !== null && (ve(e.dataTransfer, Ie(s)), Ke(e.dataTransfer, n)), !0);
|
|
507
|
+
}, c), n.registerCommand(tt, (e) => {
|
|
508
|
+
const [t] = $(e), s = f();
|
|
509
|
+
return !(t && !d(s)) && (e.preventDefault(), !0);
|
|
510
|
+
}, c), n.registerCommand(Qe, () => {
|
|
511
|
+
const e = f();
|
|
512
|
+
return Ze(d(e) && et(e.anchor.getNode()) !== null ? e : null), !0;
|
|
513
|
+
}, c), n.registerCommand(je, (e) => (ne(n, L(e, ClipboardEvent) ? e : null), !0), c), n.registerCommand(Ue, (e) => ((async function(t, s) {
|
|
514
|
+
await ne(s, L(t, ClipboardEvent) ? t : null), s.update(() => {
|
|
515
|
+
const o = f();
|
|
516
|
+
d(o) ? o.removeText() : C(o) && o.getNodes().forEach((i) => i.remove());
|
|
517
|
+
}, { tag: Ve });
|
|
518
|
+
})(e, n), !0), c), n.registerCommand(qe, (e) => {
|
|
519
|
+
const [, t, s] = $(e);
|
|
520
|
+
return t.length > 0 && !s ? (n.dispatchCommand(de, t), !0) : Xe(e.target) && He(e.target) ? !1 : f() !== null && ((function(o, i) {
|
|
521
|
+
o.preventDefault(), i.update(() => {
|
|
522
|
+
const a = f(), u = L(o, InputEvent) || L(o, KeyboardEvent) ? null : o.clipboardData;
|
|
523
|
+
u != null && a !== null && re(u, a);
|
|
524
|
+
}, { tag: Ge });
|
|
525
|
+
})(e, n), !0);
|
|
526
|
+
}, c), n.registerCommand(Je, () => {
|
|
527
|
+
const e = f();
|
|
528
|
+
return d(e) && M(e, "space", "both", r.peek()), !1;
|
|
529
|
+
}, c), n.registerCommand(Ye, () => {
|
|
530
|
+
const e = f();
|
|
531
|
+
return d(e) && M(e, "tab", "both", r.peek()), !1;
|
|
532
|
+
}, c), n.registerCommand(ze, (e) => {
|
|
533
|
+
const t = f();
|
|
534
|
+
if (C(t)) return De(t, !1, e);
|
|
535
|
+
if (!d(t)) return !1;
|
|
536
|
+
const { anchor: s } = t;
|
|
537
|
+
if (s.type !== "element" || s.offset !== 0) return !1;
|
|
538
|
+
const o = s.getNode();
|
|
539
|
+
if (!N(o)) return !1;
|
|
540
|
+
const i = o.getFirstChild();
|
|
541
|
+
if (!v(i) || !i.isInline()) return !1;
|
|
542
|
+
const a = o.getKey(), u = o.selectEnd();
|
|
543
|
+
return e.shiftKey && u.anchor.set(a, 0, "element"), e.preventDefault(), e.stopPropagation(), !0;
|
|
544
|
+
}, c), n.registerCommand(Be, (e) => {
|
|
545
|
+
const t = f();
|
|
546
|
+
if (C(t)) return De(t, !0, e);
|
|
547
|
+
if (!d(t)) return !1;
|
|
548
|
+
const { anchor: s, focus: o } = t, i = E(o.getNode(), (l) => N(l) && !l.isInline());
|
|
549
|
+
if (i === null) return !1;
|
|
550
|
+
const a = i.getFirstChild();
|
|
551
|
+
if (!v(a) || !a.isInline() || E(s.getNode(), (l) => N(l) && !l.isInline()) !== i) return !1;
|
|
552
|
+
const u = i.getKey();
|
|
553
|
+
return (o.type !== "element" || o.key !== u || o.offset !== 0) && (t.focus.set(u, 0, "element"), e.shiftKey || t.anchor.set(u, 0, "element"), e.preventDefault(), e.stopPropagation(), !0);
|
|
554
|
+
}, c));
|
|
555
|
+
}
|
|
556
|
+
export {
|
|
557
|
+
S as $createHeadingNode,
|
|
558
|
+
W as $createQuoteNode,
|
|
559
|
+
Vt as $isHeadingNode,
|
|
560
|
+
Ut as $isQuoteNode,
|
|
561
|
+
de as DRAG_DROP_PASTE,
|
|
562
|
+
X as HeadingNode,
|
|
563
|
+
q as QuoteNode,
|
|
564
|
+
$ as eventFiles,
|
|
565
|
+
U as quoteShadowRootState,
|
|
566
|
+
jt as registerRichText
|
|
567
|
+
};
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { $findMatchingParent as y, INTERNAL_$isBlock as p, $isElementNode as u, $caretFromPoint as E, $isExtendableTextPointCaret as T, $isTextPointCaret as A, $isTabNode as P, $isTextNode as F, $extendCaretToRange as I, $isChildCaret as B, $isDecoratorNode as K, $isRootNode as O, $getEditor as R, $isTokenOrSegmented as b, $getCharacterOffsets as L, $cloneWithPropertiesEphemeral as D, flipDirection as M } from "../../../lexical/dist/Lexical.prod.js";
|
|
3
|
+
import { $cloneWithProperties as Q, $selectAll as Y } from "../../../lexical/dist/Lexical.prod.js";
|
|
4
|
+
function h(t) {
|
|
5
|
+
const e = R().getElementByKey(t.getKey());
|
|
6
|
+
if (e === null) return null;
|
|
7
|
+
const o = e.ownerDocument.defaultView;
|
|
8
|
+
return o === null ? null : o.getComputedStyle(e);
|
|
9
|
+
}
|
|
10
|
+
function S(t) {
|
|
11
|
+
return h(O(t) ? t : t.getParentOrThrow());
|
|
12
|
+
}
|
|
13
|
+
function z(t) {
|
|
14
|
+
const e = S(t);
|
|
15
|
+
return e !== null && e.direction === "rtl";
|
|
16
|
+
}
|
|
17
|
+
function J(t, e, o = "self") {
|
|
18
|
+
const n = t.getStartEndPoints();
|
|
19
|
+
if (e.isSelected(t) && !b(e) && n !== null) {
|
|
20
|
+
const [r, a] = n, l = t.isBackward(), s = r.getNode(), i = a.getNode(), d = e.is(s), C = e.is(i);
|
|
21
|
+
if (d || C) {
|
|
22
|
+
const [c, f] = L(t), N = s.is(i), g = e.is(l ? i : s), w = e.is(l ? s : i);
|
|
23
|
+
let $, m = 0;
|
|
24
|
+
N ? (m = c > f ? f : c, $ = c > f ? c : f) : g ? (m = l ? f : c, $ = void 0) : w && (m = 0, $ = l ? c : f);
|
|
25
|
+
const x = e.__text.slice(m, $);
|
|
26
|
+
x !== e.__text && (o === "clone" && (e = D(e)), e.__text = x);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
return e;
|
|
30
|
+
}
|
|
31
|
+
function W(t, e) {
|
|
32
|
+
const o = t.getFormatType(), n = t.getIndent();
|
|
33
|
+
o !== e.getFormatType() && e.setFormat(o), n !== e.getIndent() && e.setIndent(n);
|
|
34
|
+
}
|
|
35
|
+
function X(t, e, o) {
|
|
36
|
+
let n = E(t, o);
|
|
37
|
+
if (T(n)) return !1;
|
|
38
|
+
for (; n; n = n.getParentCaret()) {
|
|
39
|
+
const r = n.getParentAtCaret();
|
|
40
|
+
if (!r || n.getNodeAtCaret()) return !1;
|
|
41
|
+
if (e.is(r)) return !0;
|
|
42
|
+
}
|
|
43
|
+
return !1;
|
|
44
|
+
}
|
|
45
|
+
function V(t, e, o = W) {
|
|
46
|
+
if (!t) return;
|
|
47
|
+
const n = t.getStartEndPoints();
|
|
48
|
+
let r = !1, a = null;
|
|
49
|
+
const l = /* @__PURE__ */ new Map();
|
|
50
|
+
if (n) {
|
|
51
|
+
const [s, i] = n, d = y(s.getNode(), p);
|
|
52
|
+
a = y(i.getNode(), p);
|
|
53
|
+
const C = t.isBackward() ? "previous" : "next";
|
|
54
|
+
r = u(a) && !a.is(d) && (function(c, f, N) {
|
|
55
|
+
const g = c.getNode();
|
|
56
|
+
return (!u(g) || !g.isEmpty()) && X(c, f, N);
|
|
57
|
+
})(i, a, M(C)), u(d) && l.set(d.getKey(), d), u(a) && !r && l.set(a.getKey(), a);
|
|
58
|
+
}
|
|
59
|
+
for (const s of t.getNodes()) if (u(s) && p(s)) {
|
|
60
|
+
if (r && s.is(a)) continue;
|
|
61
|
+
l.set(s.getKey(), s);
|
|
62
|
+
} else if (!n) {
|
|
63
|
+
const i = y(s, p);
|
|
64
|
+
u(i) && l.set(i.getKey(), i);
|
|
65
|
+
}
|
|
66
|
+
for (const s of l.values()) {
|
|
67
|
+
const i = e();
|
|
68
|
+
o(s, i), s.replace(i, !0);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
function v(t) {
|
|
72
|
+
const e = _(t);
|
|
73
|
+
return e !== null && e.writingMode === "vertical-rl";
|
|
74
|
+
}
|
|
75
|
+
function _(t) {
|
|
76
|
+
const e = t.anchor.getNode();
|
|
77
|
+
return u(e) ? h(e) : S(e);
|
|
78
|
+
}
|
|
79
|
+
function Z(t, e) {
|
|
80
|
+
let o = v(t) ? !e : e;
|
|
81
|
+
k(t) && (o = !o);
|
|
82
|
+
const n = E(t.focus, o ? "previous" : "next");
|
|
83
|
+
if (T(n)) return !1;
|
|
84
|
+
if (A(n) && !P(n.origin) && n.origin.isUnmergeable()) {
|
|
85
|
+
const r = n.getNodeAtCaret();
|
|
86
|
+
if (F(r) && !P(r)) return !0;
|
|
87
|
+
}
|
|
88
|
+
for (const r of I(n)) {
|
|
89
|
+
if (B(r)) return !r.origin.isInline();
|
|
90
|
+
if (!u(r.origin)) {
|
|
91
|
+
if (K(r.origin)) return !0;
|
|
92
|
+
break;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
return !1;
|
|
96
|
+
}
|
|
97
|
+
function U(t, e, o, n) {
|
|
98
|
+
t.modify(e ? "extend" : "move", o, n);
|
|
99
|
+
}
|
|
100
|
+
function k(t) {
|
|
101
|
+
const e = _(t);
|
|
102
|
+
return e !== null && e.direction === "rtl";
|
|
103
|
+
}
|
|
104
|
+
function j(t, e, o) {
|
|
105
|
+
const n = k(t);
|
|
106
|
+
let r;
|
|
107
|
+
r = v(t) || n ? !o : o, U(t, e, r, "character");
|
|
108
|
+
}
|
|
109
|
+
export {
|
|
110
|
+
Q as $cloneWithProperties,
|
|
111
|
+
W as $copyBlockFormatIndent,
|
|
112
|
+
h as $getComputedStyleForElement,
|
|
113
|
+
S as $getComputedStyleForParent,
|
|
114
|
+
X as $isAtEdgeOfElement,
|
|
115
|
+
k as $isParentElementRTL,
|
|
116
|
+
z as $isParentRTL,
|
|
117
|
+
U as $moveCaretSelection,
|
|
118
|
+
j as $moveCharacter,
|
|
119
|
+
Y as $selectAll,
|
|
120
|
+
V as $setBlocksType,
|
|
121
|
+
Z as $shouldOverrideDefaultCharacterSelection,
|
|
122
|
+
J as $sliceSelectedTextNodeContent
|
|
123
|
+
};
|