laif-ds 0.1.76 → 0.1.80
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/_virtual/index.js +5 -3
- package/dist/_virtual/index2.js +5 -2
- package/dist/_virtual/index3.js +5 -5
- package/dist/_virtual/index4.js +2 -5
- package/dist/_virtual/index5.js +2 -5
- package/dist/_virtual/index7.js +3 -2
- package/dist/_virtual/prism-cpp.js +3 -0
- package/dist/_virtual/prism-cpp2.js +5 -0
- package/dist/_virtual/prism-java.js +3 -0
- package/dist/_virtual/prism-java2.js +5 -0
- package/dist/_virtual/prism-python.js +3 -0
- package/dist/_virtual/prism-python2.js +5 -0
- package/dist/_virtual/prism-rust.js +3 -0
- package/dist/_virtual/prism-rust2.js +5 -0
- package/dist/_virtual/prism-typescript.js +3 -0
- package/dist/_virtual/prism-typescript2.js +5 -0
- package/dist/_virtual/prism.js +3 -0
- package/dist/_virtual/prism2.js +5 -0
- package/dist/components/editor/context/toolbar-context.js +42 -0
- package/dist/components/editor/editor-hooks/use-modal.js +30 -0
- package/dist/components/editor/editor-hooks/use-update-toolbar.js +24 -0
- package/dist/components/editor/editor-ui/content-editable.js +26 -0
- package/dist/components/editor/plugins/actions/actions-plugin.js +7 -0
- package/dist/components/editor/plugins/actions/clear-editor-plugin.js +39 -0
- package/dist/components/editor/plugins/actions/counter-character-plugin.js +53 -0
- package/dist/components/editor/plugins/toolbar/block-format/block-format-data.js +52 -0
- package/dist/components/editor/plugins/toolbar/block-format/format-bulleted-list.js +26 -0
- package/dist/components/editor/plugins/toolbar/block-format/format-check-list.js +26 -0
- package/dist/components/editor/plugins/toolbar/block-format/format-heading.js +31 -0
- package/dist/components/editor/plugins/toolbar/block-format/format-numbered-list.js +26 -0
- package/dist/components/editor/plugins/toolbar/block-format/format-paragraph.js +23 -0
- package/dist/components/editor/plugins/toolbar/block-format/format-quote.js +24 -0
- package/dist/components/editor/plugins/toolbar/block-format-toolbar-plugin.js +56 -0
- package/dist/components/editor/plugins/toolbar/font-format-toolbar-plugin.js +50 -0
- package/dist/components/editor/plugins/toolbar/history-toolbar-plugin.js +69 -0
- package/dist/components/editor/plugins/toolbar/toolbar-plugin.js +34 -0
- package/dist/components/editor/themes/editor-theme.js +112 -0
- package/dist/components/ui/app-editor.js +150 -0
- package/dist/components/ui/app-multiple-select-dropdown.js +2 -2
- package/dist/components/ui/button.js +25 -24
- package/dist/components/ui/calendar.js +9 -9
- package/dist/components/ui/dialog.js +43 -37
- package/dist/components/ui/sidebar.js +20 -19
- package/dist/index.d.ts +23 -1
- package/dist/index.js +48 -44
- package/dist/laif-ds.css +1 -0
- package/dist/node_modules/@lexical/clipboard/LexicalClipboard.prod.js +159 -0
- package/dist/node_modules/@lexical/code/LexicalCode.prod.js +236 -0
- package/dist/node_modules/@lexical/dragon/LexicalDragon.prod.js +46 -0
- package/dist/node_modules/@lexical/history/LexicalHistory.prod.js +89 -0
- package/dist/node_modules/@lexical/html/LexicalHtml.prod.js +108 -0
- package/dist/node_modules/@lexical/link/LexicalLink.prod.js +187 -0
- package/dist/node_modules/@lexical/list/LexicalList.prod.js +729 -0
- package/dist/node_modules/@lexical/markdown/LexicalMarkdown.prod.js +367 -0
- package/dist/node_modules/@lexical/react/LexicalCheckListPlugin.prod.js +11 -0
- package/dist/node_modules/@lexical/react/LexicalClearEditorPlugin.prod.js +17 -0
- package/dist/node_modules/@lexical/react/LexicalComposer.prod.js +45 -0
- package/dist/node_modules/@lexical/react/LexicalComposerContext.prod.js +22 -0
- package/dist/node_modules/@lexical/react/LexicalContentEditable.prod.js +55 -0
- package/dist/node_modules/@lexical/react/LexicalErrorBoundary.prod.js +49 -0
- package/dist/node_modules/@lexical/react/LexicalHistoryPlugin.prod.js +15 -0
- package/dist/node_modules/@lexical/react/LexicalListPlugin.prod.js +17 -0
- package/dist/node_modules/@lexical/react/LexicalOnChangePlugin.prod.js +16 -0
- package/dist/node_modules/@lexical/react/LexicalRichTextPlugin.prod.js +56 -0
- package/dist/node_modules/@lexical/react/useLexicalEditable.prod.js +21 -0
- package/dist/node_modules/@lexical/rich-text/LexicalRichText.prod.js +376 -0
- package/dist/node_modules/@lexical/selection/LexicalSelection.prod.js +107 -0
- package/dist/node_modules/@lexical/table/LexicalTable.prod.js +661 -0
- package/dist/node_modules/@lexical/text/LexicalText.prod.js +37 -0
- package/dist/node_modules/@lexical/utils/LexicalUtils.prod.js +102 -0
- package/dist/node_modules/@radix-ui/react-use-is-hydrated/dist/index.js +1 -1
- 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/Lexical.prod.js +4901 -0
- package/dist/node_modules/prismjs/components/prism-c.js +77 -0
- package/dist/node_modules/prismjs/components/prism-clike.js +32 -0
- package/dist/node_modules/prismjs/components/prism-cpp.js +93 -0
- package/dist/node_modules/prismjs/components/prism-css.js +56 -0
- package/dist/node_modules/prismjs/components/prism-java.js +122 -0
- package/dist/node_modules/prismjs/components/prism-javascript.js +138 -0
- package/dist/node_modules/prismjs/components/prism-markdown.js +301 -0
- package/dist/node_modules/prismjs/components/prism-markup.js +174 -0
- package/dist/node_modules/prismjs/components/prism-objectivec.js +11 -0
- package/dist/node_modules/prismjs/components/prism-powershell.js +56 -0
- package/dist/node_modules/prismjs/components/prism-python.js +69 -0
- package/dist/node_modules/prismjs/components/prism-rust.js +124 -0
- package/dist/node_modules/prismjs/components/prism-sql.js +34 -0
- package/dist/node_modules/prismjs/components/prism-swift.js +114 -0
- package/dist/node_modules/prismjs/components/prism-typescript.js +53 -0
- package/dist/node_modules/prismjs/prism.js +1165 -0
- package/dist/node_modules/recharts/es6/util/Events.js +1 -1
- package/dist/node_modules/unified/lib/index.js +1 -1
- package/dist/node_modules/use-sync-external-store/shim/index.js +1 -1
- package/dist/styles.v3.css +1 -1
- package/package.json +12 -1
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useLexicalComposerContext as E } from "./LexicalComposerContext.prod.js";
|
|
3
|
+
import { useLexicalEditable as b } from "./useLexicalEditable.prod.js";
|
|
4
|
+
import { $canShowPlaceholderCurry as j } from "../text/LexicalText.prod.js";
|
|
5
|
+
import { mergeRegister as y } from "../utils/LexicalUtils.prod.js";
|
|
6
|
+
import { useState as w, useMemo as C, useLayoutEffect as D, useEffect as x, Suspense as P } from "react";
|
|
7
|
+
import { flushSync as R, createPortal as $ } from "react-dom";
|
|
8
|
+
import { jsx as m, jsxs as k, Fragment as v } from "react/jsx-runtime";
|
|
9
|
+
import { registerDragonSupport as B } from "../dragon/LexicalDragon.prod.js";
|
|
10
|
+
import { registerRichText as M } from "../rich-text/LexicalRichText.prod.js";
|
|
11
|
+
const d = typeof window < "u" && window.document !== void 0 && window.document.createElement !== void 0 ? D : x;
|
|
12
|
+
function h(r) {
|
|
13
|
+
return r.getEditorState().read(j(r.isComposing()));
|
|
14
|
+
}
|
|
15
|
+
function H({ contentEditable: r, placeholder: u = null, ErrorBoundary: a }) {
|
|
16
|
+
const [n] = E(), o = function(e, i) {
|
|
17
|
+
const [t, s] = w(() => e.getDecorators());
|
|
18
|
+
return d(() => e.registerDecoratorListener((c) => {
|
|
19
|
+
R(() => {
|
|
20
|
+
s(c);
|
|
21
|
+
});
|
|
22
|
+
}), [e]), x(() => {
|
|
23
|
+
s(e.getDecorators());
|
|
24
|
+
}, [e]), C(() => {
|
|
25
|
+
const c = [], p = Object.keys(t);
|
|
26
|
+
for (let l = 0; l < p.length; l++) {
|
|
27
|
+
const f = p[l], L = m(i, { onError: (S) => e._onError(S), children: m(P, { fallback: null, children: t[f] }) }), g = e.getElementByKey(f);
|
|
28
|
+
g !== null && c.push($(L, g, f));
|
|
29
|
+
}
|
|
30
|
+
return c;
|
|
31
|
+
}, [i, t, e]);
|
|
32
|
+
}(n, a);
|
|
33
|
+
return function(e) {
|
|
34
|
+
d(() => y(M(e), B(e)), [e]);
|
|
35
|
+
}(n), k(v, { children: [r, m(T, { content: u }), o] });
|
|
36
|
+
}
|
|
37
|
+
function T({ content: r }) {
|
|
38
|
+
const [u] = E(), a = function(o) {
|
|
39
|
+
const [e, i] = w(() => h(o));
|
|
40
|
+
return d(() => {
|
|
41
|
+
function t() {
|
|
42
|
+
const s = h(o);
|
|
43
|
+
i(s);
|
|
44
|
+
}
|
|
45
|
+
return t(), y(o.registerUpdateListener(() => {
|
|
46
|
+
t();
|
|
47
|
+
}), o.registerEditableListener(() => {
|
|
48
|
+
t();
|
|
49
|
+
}));
|
|
50
|
+
}, [o]), e;
|
|
51
|
+
}(u), n = b();
|
|
52
|
+
return a ? typeof r == "function" ? r(n) : r : null;
|
|
53
|
+
}
|
|
54
|
+
export {
|
|
55
|
+
H as RichTextPlugin
|
|
56
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useLexicalComposerContext as l } from "./LexicalComposerContext.prod.js";
|
|
3
|
+
import { useMemo as d, useState as f, useRef as m, useLayoutEffect as b, useEffect as w } from "react";
|
|
4
|
+
const E = typeof window < "u" && window.document !== void 0 && window.document.createElement !== void 0 ? b : w;
|
|
5
|
+
function p(e) {
|
|
6
|
+
return { initialValueFn: () => e.isEditable(), subscribe: (t) => e.registerEditableListener(t) };
|
|
7
|
+
}
|
|
8
|
+
function F() {
|
|
9
|
+
return function(e) {
|
|
10
|
+
const [t] = l(), n = d(() => e(t), [t, e]), [r, o] = f(() => n.initialValueFn()), i = m(r);
|
|
11
|
+
return E(() => {
|
|
12
|
+
const { initialValueFn: c, subscribe: a } = n, u = c();
|
|
13
|
+
return i.current !== u && (i.current = u, o(u)), a((s) => {
|
|
14
|
+
i.current = s, o(s);
|
|
15
|
+
});
|
|
16
|
+
}, [n, e]), r;
|
|
17
|
+
}(p);
|
|
18
|
+
}
|
|
19
|
+
export {
|
|
20
|
+
F as useLexicalEditable
|
|
21
|
+
};
|
|
@@ -0,0 +1,376 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { $insertDataTransferForRichText as R, copyToClipboard as S } from "../clipboard/LexicalClipboard.prod.js";
|
|
3
|
+
import { $shouldOverrideDefaultCharacterSelection as I, $moveCharacter as P } from "../selection/LexicalSelection.prod.js";
|
|
4
|
+
import { addClassNamesToElement as k, mergeRegister as U, objectKlassEquals as g, $getNearestBlockElementAncestorOrThrow as j, $findMatchingParent as B } from "../utils/LexicalUtils.prod.js";
|
|
5
|
+
import { ElementNode as z, isHTMLElement as G, $createParagraphNode as h, $applyNodeReplacement as H, setNodeIndentFromDOM as X, KEY_TAB_COMMAND as V, $getSelection as i, $isRangeSelection as u, COMMAND_PRIORITY_EDITOR as a, KEY_SPACE_COMMAND as Z, PASTE_COMMAND as ee, createCommand as te, isDOMNode as ne, isSelectionCapturedInDecoratorInput as re, PASTE_TAG as se, CUT_COMMAND as ae, $isNodeSelection as d, COPY_COMMAND as oe, SELECT_ALL_COMMAND as ie, $selectAll as ue, DRAGOVER_COMMAND as ce, $getNearestNodeFromDOMNode as T, $isDecoratorNode as E, DRAGSTART_COMMAND as le, DROP_COMMAND as de, $createRangeSelection as fe, $isTextNode as me, $normalizeSelection__EXPERIMENTAL as ge, $setSelection as pe, KEY_ESCAPE_COMMAND as Ce, KEY_ENTER_COMMAND as he, INSERT_LINE_BREAK_COMMAND as x, INSERT_PARAGRAPH_COMMAND as $, KEY_DELETE_COMMAND as Ne, DELETE_CHARACTER_COMMAND as A, KEY_BACKSPACE_COMMAND as De, $isRootNode as Ee, OUTDENT_CONTENT_COMMAND as w, KEY_ARROW_RIGHT_COMMAND as Me, KEY_ARROW_LEFT_COMMAND as _e, KEY_ARROW_DOWN_COMMAND as Ae, $getRoot as Oe, $getAdjacentNode as F, KEY_ARROW_UP_COMMAND as Te, INDENT_CONTENT_COMMAND as ve, INSERT_TAB_COMMAND as ye, $insertNodes as Re, $createTabNode as Se, FORMAT_ELEMENT_COMMAND as Ie, FORMAT_TEXT_COMMAND as Pe, REMOVE_TEXT_COMMAND as xe, CONTROLLED_TEXT_INSERTION_COMMAND as $e, DELETE_LINE_COMMAND as we, DELETE_WORD_COMMAND as Fe, CLICK_COMMAND as Ke, $isElementNode as q } from "../../lexical/Lexical.prod.js";
|
|
6
|
+
function K(n, e) {
|
|
7
|
+
if (document.caretRangeFromPoint !== void 0) {
|
|
8
|
+
const t = document.caretRangeFromPoint(n, e);
|
|
9
|
+
return t === null ? null : { node: t.startContainer, offset: t.startOffset };
|
|
10
|
+
}
|
|
11
|
+
if (document.caretPositionFromPoint !== "undefined") {
|
|
12
|
+
const t = document.caretPositionFromPoint(n, e);
|
|
13
|
+
return t === null ? null : { node: t.offsetNode, offset: t.offset };
|
|
14
|
+
}
|
|
15
|
+
return null;
|
|
16
|
+
}
|
|
17
|
+
const p = typeof window < "u" && window.document !== void 0 && window.document.createElement !== void 0, Le = p && "documentMode" in document ? document.documentMode : null, be = !(!p || !("InputEvent" in window) || Le) && "getTargetRanges" in new window.InputEvent("input"), Ye = p && /Version\/[\d.]+.*Safari/.test(navigator.userAgent), L = p && /iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream, We = p && /^(?=.*Chrome).*/i.test(navigator.userAgent), Je = p && /AppleWebKit\/[\d.]+/.test(navigator.userAgent) && !We, b = te("DRAG_DROP_PASTE_FILE");
|
|
18
|
+
class M extends z {
|
|
19
|
+
static getType() {
|
|
20
|
+
return "quote";
|
|
21
|
+
}
|
|
22
|
+
static clone(e) {
|
|
23
|
+
return new M(e.__key);
|
|
24
|
+
}
|
|
25
|
+
createDOM(e) {
|
|
26
|
+
const t = document.createElement("blockquote");
|
|
27
|
+
return k(t, e.theme.quote), t;
|
|
28
|
+
}
|
|
29
|
+
updateDOM(e, t) {
|
|
30
|
+
return !1;
|
|
31
|
+
}
|
|
32
|
+
static importDOM() {
|
|
33
|
+
return { blockquote: (e) => ({ conversion: ke, priority: 0 }) };
|
|
34
|
+
}
|
|
35
|
+
exportDOM(e) {
|
|
36
|
+
const { element: t } = super.exportDOM(e);
|
|
37
|
+
if (G(t)) {
|
|
38
|
+
this.isEmpty() && t.append(document.createElement("br"));
|
|
39
|
+
const r = this.getFormatType();
|
|
40
|
+
r && (t.style.textAlign = r);
|
|
41
|
+
const s = this.getDirection();
|
|
42
|
+
s && (t.dir = s);
|
|
43
|
+
}
|
|
44
|
+
return { element: t };
|
|
45
|
+
}
|
|
46
|
+
static importJSON(e) {
|
|
47
|
+
return Q().updateFromJSON(e);
|
|
48
|
+
}
|
|
49
|
+
insertNewAfter(e, t) {
|
|
50
|
+
const r = h(), s = this.getDirection();
|
|
51
|
+
return r.setDirection(s), this.insertAfter(r, t), r;
|
|
52
|
+
}
|
|
53
|
+
collapseAtStart() {
|
|
54
|
+
const e = h();
|
|
55
|
+
return this.getChildren().forEach((t) => e.append(t)), this.replace(e), !0;
|
|
56
|
+
}
|
|
57
|
+
canMergeWhenEmpty() {
|
|
58
|
+
return !0;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
function Q() {
|
|
62
|
+
return H(new M());
|
|
63
|
+
}
|
|
64
|
+
function Xe(n) {
|
|
65
|
+
return n instanceof M;
|
|
66
|
+
}
|
|
67
|
+
class _ extends z {
|
|
68
|
+
static getType() {
|
|
69
|
+
return "heading";
|
|
70
|
+
}
|
|
71
|
+
static clone(e) {
|
|
72
|
+
return new _(e.__tag, e.__key);
|
|
73
|
+
}
|
|
74
|
+
constructor(e, t) {
|
|
75
|
+
super(t), this.__tag = e;
|
|
76
|
+
}
|
|
77
|
+
getTag() {
|
|
78
|
+
return this.__tag;
|
|
79
|
+
}
|
|
80
|
+
setTag(e) {
|
|
81
|
+
const t = this.getWritable();
|
|
82
|
+
return this.__tag = e, t;
|
|
83
|
+
}
|
|
84
|
+
createDOM(e) {
|
|
85
|
+
const t = this.__tag, r = document.createElement(t), s = e.theme.heading;
|
|
86
|
+
if (s !== void 0) {
|
|
87
|
+
const o = s[t];
|
|
88
|
+
k(r, o);
|
|
89
|
+
}
|
|
90
|
+
return r;
|
|
91
|
+
}
|
|
92
|
+
updateDOM(e, t, r) {
|
|
93
|
+
return e.__tag !== this.__tag;
|
|
94
|
+
}
|
|
95
|
+
static importDOM() {
|
|
96
|
+
return { h1: (e) => ({ conversion: m, priority: 0 }), h2: (e) => ({ conversion: m, priority: 0 }), h3: (e) => ({ conversion: m, priority: 0 }), h4: (e) => ({ conversion: m, priority: 0 }), h5: (e) => ({ conversion: m, priority: 0 }), h6: (e) => ({ conversion: m, priority: 0 }), p: (e) => {
|
|
97
|
+
const t = e.firstChild;
|
|
98
|
+
return t !== null && Y(t) ? { conversion: () => ({ node: null }), priority: 3 } : null;
|
|
99
|
+
}, span: (e) => Y(e) ? { conversion: (t) => ({ node: C("h1") }), priority: 3 } : null };
|
|
100
|
+
}
|
|
101
|
+
exportDOM(e) {
|
|
102
|
+
const { element: t } = super.exportDOM(e);
|
|
103
|
+
if (G(t)) {
|
|
104
|
+
this.isEmpty() && t.append(document.createElement("br"));
|
|
105
|
+
const r = this.getFormatType();
|
|
106
|
+
r && (t.style.textAlign = r);
|
|
107
|
+
const s = this.getDirection();
|
|
108
|
+
s && (t.dir = s);
|
|
109
|
+
}
|
|
110
|
+
return { element: t };
|
|
111
|
+
}
|
|
112
|
+
static importJSON(e) {
|
|
113
|
+
return C(e.tag).updateFromJSON(e);
|
|
114
|
+
}
|
|
115
|
+
updateFromJSON(e) {
|
|
116
|
+
return super.updateFromJSON(e).setTag(e.tag);
|
|
117
|
+
}
|
|
118
|
+
exportJSON() {
|
|
119
|
+
return { ...super.exportJSON(), tag: this.getTag() };
|
|
120
|
+
}
|
|
121
|
+
insertNewAfter(e, t = !0) {
|
|
122
|
+
const r = e ? e.anchor.offset : 0, s = this.getLastDescendant(), o = !s || e && e.anchor.key === s.getKey() && r === s.getTextContentSize() || !e ? h() : C(this.getTag()), l = this.getDirection();
|
|
123
|
+
if (o.setDirection(l), this.insertAfter(o, t), r === 0 && !this.isEmpty() && e) {
|
|
124
|
+
const c = h();
|
|
125
|
+
c.select(), this.replace(c, !0);
|
|
126
|
+
}
|
|
127
|
+
return o;
|
|
128
|
+
}
|
|
129
|
+
collapseAtStart() {
|
|
130
|
+
const e = this.isEmpty() ? h() : C(this.getTag());
|
|
131
|
+
return this.getChildren().forEach((t) => e.append(t)), this.replace(e), !0;
|
|
132
|
+
}
|
|
133
|
+
extractWithChild() {
|
|
134
|
+
return !0;
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
function Y(n) {
|
|
138
|
+
return n.nodeName.toLowerCase() === "span" && n.style.fontSize === "26pt";
|
|
139
|
+
}
|
|
140
|
+
function m(n) {
|
|
141
|
+
const e = n.nodeName.toLowerCase();
|
|
142
|
+
let t = null;
|
|
143
|
+
return e !== "h1" && e !== "h2" && e !== "h3" && e !== "h4" && e !== "h5" && e !== "h6" || (t = C(e), n.style !== null && (X(n, t), t.setFormat(n.style.textAlign))), { node: t };
|
|
144
|
+
}
|
|
145
|
+
function ke(n) {
|
|
146
|
+
const e = Q();
|
|
147
|
+
return n.style !== null && (e.setFormat(n.style.textAlign), X(n, e)), { node: e };
|
|
148
|
+
}
|
|
149
|
+
function C(n = "h1") {
|
|
150
|
+
return H(new _(n));
|
|
151
|
+
}
|
|
152
|
+
function qe(n) {
|
|
153
|
+
return n instanceof _;
|
|
154
|
+
}
|
|
155
|
+
function D(n) {
|
|
156
|
+
let e = null;
|
|
157
|
+
if (g(n, DragEvent) ? e = n.dataTransfer : g(n, ClipboardEvent) && (e = n.clipboardData), e === null) return [!1, [], !1];
|
|
158
|
+
const t = e.types, r = t.includes("Files"), s = t.includes("text/html") || t.includes("text/plain");
|
|
159
|
+
return [r, Array.from(e.files), s];
|
|
160
|
+
}
|
|
161
|
+
function W(n) {
|
|
162
|
+
const e = i();
|
|
163
|
+
if (!u(e)) return !1;
|
|
164
|
+
const t = /* @__PURE__ */ new Set(), r = e.getNodes();
|
|
165
|
+
for (let s = 0; s < r.length; s++) {
|
|
166
|
+
const o = r[s], l = o.getKey();
|
|
167
|
+
if (t.has(l)) continue;
|
|
168
|
+
const c = B(o, (N) => q(N) && !N.isInline());
|
|
169
|
+
if (c === null) continue;
|
|
170
|
+
const f = c.getKey();
|
|
171
|
+
c.canIndent() && !t.has(f) && (t.add(f), n(c));
|
|
172
|
+
}
|
|
173
|
+
return t.size > 0;
|
|
174
|
+
}
|
|
175
|
+
function J(n) {
|
|
176
|
+
const e = T(n);
|
|
177
|
+
return E(e);
|
|
178
|
+
}
|
|
179
|
+
function O(n) {
|
|
180
|
+
for (const e of ["lowercase", "uppercase", "capitalize"]) n.hasFormat(e) && n.toggleFormat(e);
|
|
181
|
+
}
|
|
182
|
+
function Qe(n) {
|
|
183
|
+
return U(n.registerCommand(Ke, (e) => {
|
|
184
|
+
const t = i();
|
|
185
|
+
return !!d(t) && (t.clear(), !0);
|
|
186
|
+
}, a), n.registerCommand(A, (e) => {
|
|
187
|
+
const t = i();
|
|
188
|
+
return u(t) ? (t.deleteCharacter(e), !0) : !!d(t) && (t.deleteNodes(), !0);
|
|
189
|
+
}, a), n.registerCommand(Fe, (e) => {
|
|
190
|
+
const t = i();
|
|
191
|
+
return !!u(t) && (t.deleteWord(e), !0);
|
|
192
|
+
}, a), n.registerCommand(we, (e) => {
|
|
193
|
+
const t = i();
|
|
194
|
+
return !!u(t) && (t.deleteLine(e), !0);
|
|
195
|
+
}, a), n.registerCommand($e, (e) => {
|
|
196
|
+
const t = i();
|
|
197
|
+
if (typeof e == "string") t !== null && t.insertText(e);
|
|
198
|
+
else {
|
|
199
|
+
if (t === null) return !1;
|
|
200
|
+
const r = e.dataTransfer;
|
|
201
|
+
if (r != null) R(r, t, n);
|
|
202
|
+
else if (u(t)) {
|
|
203
|
+
const s = e.data;
|
|
204
|
+
return s && t.insertText(s), !0;
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
return !0;
|
|
208
|
+
}, a), n.registerCommand(xe, () => {
|
|
209
|
+
const e = i();
|
|
210
|
+
return !!u(e) && (e.removeText(), !0);
|
|
211
|
+
}, a), n.registerCommand(Pe, (e) => {
|
|
212
|
+
const t = i();
|
|
213
|
+
return !!u(t) && (t.formatText(e), !0);
|
|
214
|
+
}, a), n.registerCommand(Ie, (e) => {
|
|
215
|
+
const t = i();
|
|
216
|
+
if (!u(t) && !d(t)) return !1;
|
|
217
|
+
const r = t.getNodes();
|
|
218
|
+
for (const s of r) {
|
|
219
|
+
const o = B(s, (l) => q(l) && !l.isInline());
|
|
220
|
+
o !== null && o.setFormat(e);
|
|
221
|
+
}
|
|
222
|
+
return !0;
|
|
223
|
+
}, a), n.registerCommand(x, (e) => {
|
|
224
|
+
const t = i();
|
|
225
|
+
return !!u(t) && (t.insertLineBreak(e), !0);
|
|
226
|
+
}, a), n.registerCommand($, () => {
|
|
227
|
+
const e = i();
|
|
228
|
+
return !!u(e) && (e.insertParagraph(), !0);
|
|
229
|
+
}, a), n.registerCommand(ye, () => (Re([Se()]), !0), a), n.registerCommand(ve, () => W((e) => {
|
|
230
|
+
const t = e.getIndent();
|
|
231
|
+
e.setIndent(t + 1);
|
|
232
|
+
}), a), n.registerCommand(w, () => W((e) => {
|
|
233
|
+
const t = e.getIndent();
|
|
234
|
+
t > 0 && e.setIndent(Math.max(0, t - 1));
|
|
235
|
+
}), a), n.registerCommand(Te, (e) => {
|
|
236
|
+
const t = i();
|
|
237
|
+
if (d(t)) {
|
|
238
|
+
const r = t.getNodes();
|
|
239
|
+
if (r.length > 0) return r[0].selectPrevious(), !0;
|
|
240
|
+
} else if (u(t)) {
|
|
241
|
+
const r = F(t.focus, !0);
|
|
242
|
+
if (!e.shiftKey && E(r) && !r.isIsolated() && !r.isInline()) return r.selectPrevious(), e.preventDefault(), !0;
|
|
243
|
+
}
|
|
244
|
+
return !1;
|
|
245
|
+
}, a), n.registerCommand(Ae, (e) => {
|
|
246
|
+
const t = i();
|
|
247
|
+
if (d(t)) {
|
|
248
|
+
const r = t.getNodes();
|
|
249
|
+
if (r.length > 0) return r[0].selectNext(0, 0), !0;
|
|
250
|
+
} else if (u(t)) {
|
|
251
|
+
if (function(s) {
|
|
252
|
+
const o = s.focus;
|
|
253
|
+
return o.key === "root" && o.offset === Oe().getChildrenSize();
|
|
254
|
+
}(t)) return e.preventDefault(), !0;
|
|
255
|
+
const r = F(t.focus, !1);
|
|
256
|
+
if (!e.shiftKey && E(r) && !r.isIsolated() && !r.isInline()) return r.selectNext(), e.preventDefault(), !0;
|
|
257
|
+
}
|
|
258
|
+
return !1;
|
|
259
|
+
}, a), n.registerCommand(_e, (e) => {
|
|
260
|
+
const t = i();
|
|
261
|
+
if (d(t)) {
|
|
262
|
+
const r = t.getNodes();
|
|
263
|
+
if (r.length > 0) return e.preventDefault(), r[0].selectPrevious(), !0;
|
|
264
|
+
}
|
|
265
|
+
if (!u(t)) return !1;
|
|
266
|
+
if (I(t, !0)) {
|
|
267
|
+
const r = e.shiftKey;
|
|
268
|
+
return e.preventDefault(), P(t, r, !0), !0;
|
|
269
|
+
}
|
|
270
|
+
return !1;
|
|
271
|
+
}, a), n.registerCommand(Me, (e) => {
|
|
272
|
+
const t = i();
|
|
273
|
+
if (d(t)) {
|
|
274
|
+
const s = t.getNodes();
|
|
275
|
+
if (s.length > 0) return e.preventDefault(), s[0].selectNext(0, 0), !0;
|
|
276
|
+
}
|
|
277
|
+
if (!u(t)) return !1;
|
|
278
|
+
const r = e.shiftKey;
|
|
279
|
+
return !!I(t, !1) && (e.preventDefault(), P(t, r, !1), !0);
|
|
280
|
+
}, a), n.registerCommand(De, (e) => {
|
|
281
|
+
if (J(e.target)) return !1;
|
|
282
|
+
const t = i();
|
|
283
|
+
if (u(t)) {
|
|
284
|
+
if (function(r) {
|
|
285
|
+
if (!r.isCollapsed()) return !1;
|
|
286
|
+
const { anchor: s } = r;
|
|
287
|
+
if (s.offset !== 0) return !1;
|
|
288
|
+
const o = s.getNode();
|
|
289
|
+
if (Ee(o)) return !1;
|
|
290
|
+
const l = j(o);
|
|
291
|
+
return l.getIndent() > 0 && (l.is(o) || o.is(l.getFirstDescendant()));
|
|
292
|
+
}(t)) return e.preventDefault(), n.dispatchCommand(w, void 0);
|
|
293
|
+
if (L && navigator.language === "ko-KR") return !1;
|
|
294
|
+
} else if (!d(t)) return !1;
|
|
295
|
+
return e.preventDefault(), n.dispatchCommand(A, !0);
|
|
296
|
+
}, a), n.registerCommand(Ne, (e) => {
|
|
297
|
+
if (J(e.target)) return !1;
|
|
298
|
+
const t = i();
|
|
299
|
+
return !(!u(t) && !d(t)) && (e.preventDefault(), n.dispatchCommand(A, !1));
|
|
300
|
+
}, a), n.registerCommand(he, (e) => {
|
|
301
|
+
const t = i();
|
|
302
|
+
if (!u(t)) return !1;
|
|
303
|
+
if (O(t), e !== null) {
|
|
304
|
+
if ((L || Ye || Je) && be) return !1;
|
|
305
|
+
if (e.preventDefault(), e.shiftKey) return n.dispatchCommand(x, !1);
|
|
306
|
+
}
|
|
307
|
+
return n.dispatchCommand($, void 0);
|
|
308
|
+
}, a), n.registerCommand(Ce, () => {
|
|
309
|
+
const e = i();
|
|
310
|
+
return !!u(e) && (n.blur(), !0);
|
|
311
|
+
}, a), n.registerCommand(de, (e) => {
|
|
312
|
+
const [, t] = D(e);
|
|
313
|
+
if (t.length > 0) {
|
|
314
|
+
const s = K(e.clientX, e.clientY);
|
|
315
|
+
if (s !== null) {
|
|
316
|
+
const { offset: o, node: l } = s, c = T(l);
|
|
317
|
+
if (c !== null) {
|
|
318
|
+
const f = fe();
|
|
319
|
+
if (me(c)) f.anchor.set(c.getKey(), o, "text"), f.focus.set(c.getKey(), o, "text");
|
|
320
|
+
else {
|
|
321
|
+
const v = c.getParentOrThrow().getKey(), y = c.getIndexWithinParent() + 1;
|
|
322
|
+
f.anchor.set(v, y, "element"), f.focus.set(v, y, "element");
|
|
323
|
+
}
|
|
324
|
+
const N = ge(f);
|
|
325
|
+
pe(N);
|
|
326
|
+
}
|
|
327
|
+
n.dispatchCommand(b, t);
|
|
328
|
+
}
|
|
329
|
+
return e.preventDefault(), !0;
|
|
330
|
+
}
|
|
331
|
+
const r = i();
|
|
332
|
+
return !!u(r);
|
|
333
|
+
}, a), n.registerCommand(le, (e) => {
|
|
334
|
+
const [t] = D(e), r = i();
|
|
335
|
+
return !(t && !u(r));
|
|
336
|
+
}, a), n.registerCommand(ce, (e) => {
|
|
337
|
+
const [t] = D(e), r = i();
|
|
338
|
+
if (t && !u(r)) return !1;
|
|
339
|
+
const s = K(e.clientX, e.clientY);
|
|
340
|
+
if (s !== null) {
|
|
341
|
+
const o = T(s.node);
|
|
342
|
+
E(o) && e.preventDefault();
|
|
343
|
+
}
|
|
344
|
+
return !0;
|
|
345
|
+
}, a), n.registerCommand(ie, () => (ue(), !0), a), n.registerCommand(oe, (e) => (S(n, g(e, ClipboardEvent) ? e : null), !0), a), n.registerCommand(ae, (e) => (async function(t, r) {
|
|
346
|
+
await S(r, g(t, ClipboardEvent) ? t : null), r.update(() => {
|
|
347
|
+
const s = i();
|
|
348
|
+
u(s) ? s.removeText() : d(s) && s.getNodes().forEach((o) => o.remove());
|
|
349
|
+
});
|
|
350
|
+
}(e, n), !0), a), n.registerCommand(ee, (e) => {
|
|
351
|
+
const [, t, r] = D(e);
|
|
352
|
+
return t.length > 0 && !r ? (n.dispatchCommand(b, t), !0) : ne(e.target) && re(e.target) ? !1 : i() !== null && (function(s, o) {
|
|
353
|
+
s.preventDefault(), o.update(() => {
|
|
354
|
+
const l = i(), c = g(s, InputEvent) || g(s, KeyboardEvent) ? null : s.clipboardData;
|
|
355
|
+
c != null && l !== null && R(c, l, o);
|
|
356
|
+
}, { tag: se });
|
|
357
|
+
}(e, n), !0);
|
|
358
|
+
}, a), n.registerCommand(Z, (e) => {
|
|
359
|
+
const t = i();
|
|
360
|
+
return u(t) && O(t), !1;
|
|
361
|
+
}, a), n.registerCommand(V, (e) => {
|
|
362
|
+
const t = i();
|
|
363
|
+
return u(t) && O(t), !1;
|
|
364
|
+
}, a));
|
|
365
|
+
}
|
|
366
|
+
export {
|
|
367
|
+
C as $createHeadingNode,
|
|
368
|
+
Q as $createQuoteNode,
|
|
369
|
+
qe as $isHeadingNode,
|
|
370
|
+
Xe as $isQuoteNode,
|
|
371
|
+
b as DRAG_DROP_PASTE,
|
|
372
|
+
_ as HeadingNode,
|
|
373
|
+
M as QuoteNode,
|
|
374
|
+
D as eventFiles,
|
|
375
|
+
Qe as registerRichText
|
|
376
|
+
};
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { $createRangeSelection as k, $isElementNode as g, INTERNAL_$isBlock as $, $getSelection as P, $setSelection as v, $caretFromPoint as w, $isExtendableTextPointCaret as K, $extendCaretToRange as E, $isChildCaret as I, $isDecoratorNode as O, $isRootNode as h, $getEditor as _, $isTokenOrSegmented as B, $getCharacterOffsets as F } from "../../lexical/Lexical.prod.js";
|
|
3
|
+
import { $cloneWithProperties as J, $selectAll as Q } from "../../lexical/Lexical.prod.js";
|
|
4
|
+
const p = /* @__PURE__ */ new Map();
|
|
5
|
+
function S(t) {
|
|
6
|
+
const e = {};
|
|
7
|
+
if (!t) return e;
|
|
8
|
+
const n = t.split(";");
|
|
9
|
+
for (const o of n) if (o !== "") {
|
|
10
|
+
const [r, s] = o.split(/:([^]+)/);
|
|
11
|
+
r && s && (e[r.trim()] = s.trim());
|
|
12
|
+
}
|
|
13
|
+
return e;
|
|
14
|
+
}
|
|
15
|
+
function A(t) {
|
|
16
|
+
let e = p.get(t);
|
|
17
|
+
return e === void 0 && (e = S(t), p.set(t, e)), e;
|
|
18
|
+
}
|
|
19
|
+
function L(t, e) {
|
|
20
|
+
const n = t.getStartEndPoints();
|
|
21
|
+
if (e.isSelected(t) && !B(e) && n !== null) {
|
|
22
|
+
const [o, r] = n, s = t.isBackward(), i = o.getNode(), c = r.getNode(), l = e.is(i), u = e.is(c);
|
|
23
|
+
if (l || u) {
|
|
24
|
+
const [a, f] = F(t), C = i.is(c), T = e.is(s ? c : i), x = e.is(s ? i : c);
|
|
25
|
+
let d, y = 0;
|
|
26
|
+
C ? (y = a > f ? f : a, d = a > f ? a : f) : T ? (y = s ? f : a, d = void 0) : x && (y = 0, d = s ? a : f), e.__text = e.__text.slice(y, d);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
return e;
|
|
30
|
+
}
|
|
31
|
+
function W(t) {
|
|
32
|
+
const e = t.getStyle(), n = S(e);
|
|
33
|
+
p.set(e, n);
|
|
34
|
+
}
|
|
35
|
+
function D(t, e) {
|
|
36
|
+
const n = t.getFormatType(), o = t.getIndent();
|
|
37
|
+
n !== e.getFormatType() && e.setFormat(n), o !== e.getIndent() && e.setIndent(o);
|
|
38
|
+
}
|
|
39
|
+
function Z(t, e, n = D) {
|
|
40
|
+
if (t === null) return;
|
|
41
|
+
const o = t.getStartEndPoints(), r = /* @__PURE__ */ new Map();
|
|
42
|
+
let s = null;
|
|
43
|
+
if (o) {
|
|
44
|
+
const [i, c] = o;
|
|
45
|
+
s = k(), s.anchor.set(i.key, i.offset, i.type), s.focus.set(c.key, c.offset, c.type);
|
|
46
|
+
const l = m(i.getNode(), $), u = m(c.getNode(), $);
|
|
47
|
+
g(l) && r.set(l.getKey(), l), g(u) && r.set(u.getKey(), u);
|
|
48
|
+
}
|
|
49
|
+
for (const i of t.getNodes()) if (g(i) && $(i)) r.set(i.getKey(), i);
|
|
50
|
+
else if (o === null) {
|
|
51
|
+
const c = m(i, $);
|
|
52
|
+
g(c) && r.set(c.getKey(), c);
|
|
53
|
+
}
|
|
54
|
+
for (const [i, c] of r) {
|
|
55
|
+
const l = e();
|
|
56
|
+
n(c, l), c.replace(l, !0), s && (i === s.anchor.key && s.anchor.set(l.getKey(), s.anchor.offset, s.anchor.type), i === s.focus.key && s.focus.set(l.getKey(), s.focus.offset, s.focus.type));
|
|
57
|
+
}
|
|
58
|
+
s && t.is(P()) && v(s);
|
|
59
|
+
}
|
|
60
|
+
function N(t) {
|
|
61
|
+
const e = t.anchor.getNode(), n = h(e) ? e : e.getParentOrThrow(), o = _().getElementByKey(n.getKey());
|
|
62
|
+
if (o === null) return !1;
|
|
63
|
+
const r = o.ownerDocument.defaultView;
|
|
64
|
+
return r === null ? !1 : r.getComputedStyle(o).writingMode === "vertical-rl";
|
|
65
|
+
}
|
|
66
|
+
function j(t, e) {
|
|
67
|
+
const n = N(t) ? !e : e, o = w(t.focus, n ? "previous" : "next");
|
|
68
|
+
if (K(o)) return !1;
|
|
69
|
+
for (const r of E(o)) {
|
|
70
|
+
if (I(r)) return !r.origin.isInline();
|
|
71
|
+
if (!g(r.origin)) {
|
|
72
|
+
if (O(r.origin)) return !0;
|
|
73
|
+
break;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
return !1;
|
|
77
|
+
}
|
|
78
|
+
function R(t, e, n, o) {
|
|
79
|
+
t.modify(e ? "extend" : "move", n, o);
|
|
80
|
+
}
|
|
81
|
+
function b(t) {
|
|
82
|
+
const e = t.anchor.getNode();
|
|
83
|
+
return (h(e) ? e : e.getParentOrThrow()).getDirection() === "rtl";
|
|
84
|
+
}
|
|
85
|
+
function q(t, e, n) {
|
|
86
|
+
const o = b(t);
|
|
87
|
+
let r;
|
|
88
|
+
r = N(t) || o ? !n : n, R(t, e, r, "character");
|
|
89
|
+
}
|
|
90
|
+
function m(t, e) {
|
|
91
|
+
let n = t;
|
|
92
|
+
for (; n !== null && n.getParent() !== null && !e(n); ) n = n.getParentOrThrow();
|
|
93
|
+
return e(n) ? n : null;
|
|
94
|
+
}
|
|
95
|
+
export {
|
|
96
|
+
W as $addNodeStyle,
|
|
97
|
+
J as $cloneWithProperties,
|
|
98
|
+
D as $copyBlockFormatIndent,
|
|
99
|
+
b as $isParentElementRTL,
|
|
100
|
+
R as $moveCaretSelection,
|
|
101
|
+
q as $moveCharacter,
|
|
102
|
+
Q as $selectAll,
|
|
103
|
+
Z as $setBlocksType,
|
|
104
|
+
j as $shouldOverrideDefaultCharacterSelection,
|
|
105
|
+
L as $sliceSelectedTextNodeContent,
|
|
106
|
+
A as getStyleObjectFromCSS
|
|
107
|
+
};
|