lexical-medium-editor 1.2.4 → 1.2.5
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 +29 -0
- package/dist-lib/ImageNode-BhH71HMX.js +347 -0
- package/dist-lib/ImageNode-BhH71HMX.js.map +1 -0
- package/dist-lib/editorConfig.es.js +16 -12
- package/dist-lib/editorConfig.es.js.map +1 -1
- package/dist-lib/index.es.js +643 -1039
- package/dist-lib/index.es.js.map +1 -1
- package/package.json +1 -1
- package/dist-lib/ImageNode-CYwHoGzl.js +0 -25082
- package/dist-lib/ImageNode-CYwHoGzl.js.map +0 -1
package/README.md
CHANGED
|
@@ -30,3 +30,32 @@ To install the `lexical-medium-editor` package, run the following command:
|
|
|
30
30
|
```bash
|
|
31
31
|
npm install lexical-medium-editor
|
|
32
32
|
```
|
|
33
|
+
|
|
34
|
+
## Usage
|
|
35
|
+
|
|
36
|
+
Here is an example of how to use the editor in your project:
|
|
37
|
+
|
|
38
|
+
```jsx
|
|
39
|
+
import { useRef } from "react";
|
|
40
|
+
import Editor from "lexical-medium-editor";
|
|
41
|
+
import { initialConfig } from "lexical-medium-editor/config";
|
|
42
|
+
|
|
43
|
+
export default function App() {
|
|
44
|
+
const editorRef = useRef(null);
|
|
45
|
+
|
|
46
|
+
const handleOnChange = (editorState) => {
|
|
47
|
+
console.log(editorState);
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
return (
|
|
51
|
+
<Editor
|
|
52
|
+
initialConfig={initialConfig}
|
|
53
|
+
onChange={handleOnChange}
|
|
54
|
+
editorRef={editorRef}
|
|
55
|
+
blockToolbarGap={32}
|
|
56
|
+
isHeadingOneFirst={false}
|
|
57
|
+
spellCheck={false}
|
|
58
|
+
/>
|
|
59
|
+
);
|
|
60
|
+
}
|
|
61
|
+
```
|
|
@@ -0,0 +1,347 @@
|
|
|
1
|
+
import { jsx as o, jsxs as x, Fragment as _ } from "react/jsx-runtime";
|
|
2
|
+
import { DecoratorNode as p, $createNodeSelection as S, $setSelection as O, $applyNodeReplacement as l, TextNode as v, ElementNode as D, $getSelection as b, $isRangeSelection as w, $isLineBreakNode as N, $isTextNode as A, $isParagraphNode as C, $createParagraphNode as E, $createTextNode as J } from "lexical";
|
|
3
|
+
import { addClassNamesToElement as a, $findMatchingParent as T } from "@lexical/utils";
|
|
4
|
+
import { useRef as q, useEffect as k } from "react";
|
|
5
|
+
import { renderToString as z } from "react-dom/server";
|
|
6
|
+
const I = ({ children: n, inline: t }) => {
|
|
7
|
+
const e = q(null);
|
|
8
|
+
k(() => {
|
|
9
|
+
e.current && window.MathJax && window.MathJax.typesetPromise && window.MathJax.typesetPromise([e.current]).catch(
|
|
10
|
+
(i) => console.error("MathJax typesetting failed:", i)
|
|
11
|
+
);
|
|
12
|
+
}, [n, t]);
|
|
13
|
+
const r = `${n}`;
|
|
14
|
+
return /* @__PURE__ */ o("span", { ref: e, children: r });
|
|
15
|
+
};
|
|
16
|
+
class h extends p {
|
|
17
|
+
static getType() {
|
|
18
|
+
return "math";
|
|
19
|
+
}
|
|
20
|
+
static clone(t) {
|
|
21
|
+
return new h(t.__equation, t.__inline, t.__key);
|
|
22
|
+
}
|
|
23
|
+
constructor(t, e, r) {
|
|
24
|
+
super(r), this.__equation = t, this.__inline = e;
|
|
25
|
+
}
|
|
26
|
+
getEquation() {
|
|
27
|
+
return this.__equation;
|
|
28
|
+
}
|
|
29
|
+
getTextContent() {
|
|
30
|
+
return this.getEquation();
|
|
31
|
+
}
|
|
32
|
+
isInline() {
|
|
33
|
+
return this.__inline;
|
|
34
|
+
}
|
|
35
|
+
select() {
|
|
36
|
+
const t = S();
|
|
37
|
+
return t.add(this.getKey()), O(t), t;
|
|
38
|
+
}
|
|
39
|
+
createDOM(t) {
|
|
40
|
+
const e = document.createElement("span");
|
|
41
|
+
return this.__inline ? a(e, t.theme.math.renderedInline) : a(e, t.theme.math.renderedBlock), e;
|
|
42
|
+
}
|
|
43
|
+
updateDOM() {
|
|
44
|
+
return !1;
|
|
45
|
+
}
|
|
46
|
+
static importDOM() {
|
|
47
|
+
return {
|
|
48
|
+
span: (t) => ({
|
|
49
|
+
conversion: B,
|
|
50
|
+
priority: 1
|
|
51
|
+
})
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
exportDOM(t) {
|
|
55
|
+
const { element: e } = super.exportDOM(t);
|
|
56
|
+
return e.textContent = this.getEquation(), e.setAttribute("data-lexical-math", "true"), e.setAttribute("data-math-inline", this.__inline.toString()), { element: e };
|
|
57
|
+
}
|
|
58
|
+
static importJSON(t) {
|
|
59
|
+
const { equation: e, inline: r } = t;
|
|
60
|
+
return M(e, r).updateFromJSON(t);
|
|
61
|
+
}
|
|
62
|
+
exportJSON() {
|
|
63
|
+
return {
|
|
64
|
+
...super.exportJSON(),
|
|
65
|
+
equation: this.getEquation(),
|
|
66
|
+
inline: this.isInline()
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
decorate() {
|
|
70
|
+
return /* @__PURE__ */ o(I, { inline: this.__inline, children: this.__equation });
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
function B(n) {
|
|
74
|
+
let t = null;
|
|
75
|
+
if (n.getAttribute("data-lexical-math") === "true") {
|
|
76
|
+
const e = n.textContent, i = n.getAttribute("data-math-inline") === "true";
|
|
77
|
+
t = M(e, i);
|
|
78
|
+
}
|
|
79
|
+
return { node: t };
|
|
80
|
+
}
|
|
81
|
+
function M(n, t) {
|
|
82
|
+
return l(new h(n, t));
|
|
83
|
+
}
|
|
84
|
+
function G(n) {
|
|
85
|
+
return n instanceof h;
|
|
86
|
+
}
|
|
87
|
+
class d extends v {
|
|
88
|
+
static getType() {
|
|
89
|
+
return "math-highlight-inline";
|
|
90
|
+
}
|
|
91
|
+
static clone(t) {
|
|
92
|
+
return new d(t.__equation, t.__key);
|
|
93
|
+
}
|
|
94
|
+
createDOM(t) {
|
|
95
|
+
const e = super.createDOM(t);
|
|
96
|
+
return a(e, t.theme.math.highlightInline), e;
|
|
97
|
+
}
|
|
98
|
+
static importJSON(t) {
|
|
99
|
+
return null;
|
|
100
|
+
}
|
|
101
|
+
exportJSON() {
|
|
102
|
+
return {
|
|
103
|
+
type: "math",
|
|
104
|
+
version: 1,
|
|
105
|
+
equation: this.getTextContent(),
|
|
106
|
+
inline: !0
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
exportDOM(t) {
|
|
110
|
+
const e = document.createElement("span");
|
|
111
|
+
return a(e, t._config.theme.math.renderedInline), e.textContent = this.getTextContent(), e.setAttribute("data-lexical-math", "true"), e.setAttribute("data-math-inline", "true"), { element: e };
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
function V(n) {
|
|
115
|
+
const t = new d(n);
|
|
116
|
+
return l(t);
|
|
117
|
+
}
|
|
118
|
+
function Q(n) {
|
|
119
|
+
return n instanceof d;
|
|
120
|
+
}
|
|
121
|
+
class m extends D {
|
|
122
|
+
static getType() {
|
|
123
|
+
return "math-highlight-block";
|
|
124
|
+
}
|
|
125
|
+
static clone(t) {
|
|
126
|
+
return new m(t.__equation, t.__key);
|
|
127
|
+
}
|
|
128
|
+
constructor(t, e) {
|
|
129
|
+
super(e), this.__equation = t;
|
|
130
|
+
}
|
|
131
|
+
createDOM(t) {
|
|
132
|
+
const e = document.createElement("span");
|
|
133
|
+
return a(e, t.theme.math.highlightBlock), e;
|
|
134
|
+
}
|
|
135
|
+
updateDOM() {
|
|
136
|
+
return !1;
|
|
137
|
+
}
|
|
138
|
+
static importJSON(t) {
|
|
139
|
+
return null;
|
|
140
|
+
}
|
|
141
|
+
exportJSON() {
|
|
142
|
+
return {
|
|
143
|
+
type: "math",
|
|
144
|
+
version: 1,
|
|
145
|
+
equation: this.getTextContent(),
|
|
146
|
+
inline: !1
|
|
147
|
+
};
|
|
148
|
+
}
|
|
149
|
+
exportDOM(t) {
|
|
150
|
+
const e = document.createElement("span");
|
|
151
|
+
return a(e, t._config.theme.math.renderedBlock), e.textContent = this.getTextContent(), e.setAttribute("data-lexical-math", "true"), e.setAttribute("data-math-inline", "false"), { element: e };
|
|
152
|
+
}
|
|
153
|
+
collapseAtStart() {
|
|
154
|
+
return this.remove(), !0;
|
|
155
|
+
}
|
|
156
|
+
insertNewAfter() {
|
|
157
|
+
const t = b();
|
|
158
|
+
if (w(t) && t.isCollapsed()) {
|
|
159
|
+
const e = this.getLastChild(), r = t.anchor.getNode();
|
|
160
|
+
if (r.getKey() === this.getKey() && t.anchor.offset === 0 && this.getChildrenSize() === 0 || e && N(e) && r.getKey() === this.getKey() && t.anchor.offset === this.getChildrenSize() || e && A(e) && r.getKey() === e.getKey() && t.anchor.offset === e.getTextContent().length)
|
|
161
|
+
if (e && N(e)) {
|
|
162
|
+
e.remove();
|
|
163
|
+
const u = T(this, C), s = E();
|
|
164
|
+
return u ? u.insertAfter(s) : this.insertAfter(s), s.select(), s;
|
|
165
|
+
} else
|
|
166
|
+
return t.insertLineBreak(), null;
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
function U(n) {
|
|
171
|
+
const t = J(n);
|
|
172
|
+
let e = new m(n);
|
|
173
|
+
return l(e.append(t));
|
|
174
|
+
}
|
|
175
|
+
function W(n) {
|
|
176
|
+
return n instanceof m;
|
|
177
|
+
}
|
|
178
|
+
function c() {
|
|
179
|
+
return /* @__PURE__ */ o(
|
|
180
|
+
"svg",
|
|
181
|
+
{
|
|
182
|
+
width: 6,
|
|
183
|
+
height: 6,
|
|
184
|
+
viewBox: "0 0 6 6",
|
|
185
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
186
|
+
"aria-hidden": "true",
|
|
187
|
+
children: /* @__PURE__ */ o("circle", { cx: 3, cy: 3, r: 3 })
|
|
188
|
+
}
|
|
189
|
+
);
|
|
190
|
+
}
|
|
191
|
+
class f extends p {
|
|
192
|
+
static getType() {
|
|
193
|
+
return "horizontal-divider";
|
|
194
|
+
}
|
|
195
|
+
static clone(t) {
|
|
196
|
+
return new f(t.__key);
|
|
197
|
+
}
|
|
198
|
+
createDOM(t) {
|
|
199
|
+
const e = document.createElement("div");
|
|
200
|
+
return a(e, t.theme.divider), e;
|
|
201
|
+
}
|
|
202
|
+
getTextContent() {
|
|
203
|
+
return `
|
|
204
|
+
`;
|
|
205
|
+
}
|
|
206
|
+
isInline() {
|
|
207
|
+
return !1;
|
|
208
|
+
}
|
|
209
|
+
updateDOM() {
|
|
210
|
+
return !1;
|
|
211
|
+
}
|
|
212
|
+
static importDOM() {
|
|
213
|
+
return {
|
|
214
|
+
div: (t) => t.getAttribute("data-lexical-horizontal-divider") === "true" ? {
|
|
215
|
+
conversion: H,
|
|
216
|
+
priority: 2
|
|
217
|
+
} : null
|
|
218
|
+
};
|
|
219
|
+
}
|
|
220
|
+
exportDOM(t) {
|
|
221
|
+
const { element: e } = super.exportDOM(t);
|
|
222
|
+
return e.setAttribute("data-lexical-horizontal-divider", "true"), { after: (i) => {
|
|
223
|
+
const s = z(/* @__PURE__ */ x(_, { children: [
|
|
224
|
+
/* @__PURE__ */ o(c, {}),
|
|
225
|
+
/* @__PURE__ */ o(c, {}),
|
|
226
|
+
/* @__PURE__ */ o(c, {})
|
|
227
|
+
] }));
|
|
228
|
+
return i.innerHTML = s, i;
|
|
229
|
+
}, element: e };
|
|
230
|
+
}
|
|
231
|
+
static importJSON(t) {
|
|
232
|
+
return y().updateFromJSON(t);
|
|
233
|
+
}
|
|
234
|
+
exportJSON() {
|
|
235
|
+
return super.exportJSON();
|
|
236
|
+
}
|
|
237
|
+
decorate() {
|
|
238
|
+
return /* @__PURE__ */ x(_, { children: [
|
|
239
|
+
/* @__PURE__ */ o(c, {}),
|
|
240
|
+
/* @__PURE__ */ o(c, {}),
|
|
241
|
+
/* @__PURE__ */ o(c, {})
|
|
242
|
+
] });
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
function H(n) {
|
|
246
|
+
let t = null;
|
|
247
|
+
return n.getAttribute("data-lexical-horizontal-divider") === "true" && (t = y()), { node: t };
|
|
248
|
+
}
|
|
249
|
+
function y() {
|
|
250
|
+
return l(new f());
|
|
251
|
+
}
|
|
252
|
+
class g extends p {
|
|
253
|
+
static getType() {
|
|
254
|
+
return "image";
|
|
255
|
+
}
|
|
256
|
+
static clone(t) {
|
|
257
|
+
return new g(t.__src, t.__key);
|
|
258
|
+
}
|
|
259
|
+
constructor(t, e) {
|
|
260
|
+
super(e), this.__src = t, this.__attributes = {};
|
|
261
|
+
}
|
|
262
|
+
createDOM(t) {
|
|
263
|
+
const e = document.createElement("figure");
|
|
264
|
+
return a(e, t.theme.img), e;
|
|
265
|
+
}
|
|
266
|
+
updateDOM() {
|
|
267
|
+
return !1;
|
|
268
|
+
}
|
|
269
|
+
static importDOM() {
|
|
270
|
+
return {
|
|
271
|
+
figure: (t) => ({
|
|
272
|
+
conversion: K,
|
|
273
|
+
priority: 1
|
|
274
|
+
})
|
|
275
|
+
};
|
|
276
|
+
}
|
|
277
|
+
exportDOM(t) {
|
|
278
|
+
const { element: e } = super.exportDOM(t);
|
|
279
|
+
e.setAttribute("data-lexical-image-container", "true");
|
|
280
|
+
const r = document.createElement("img");
|
|
281
|
+
r.setAttribute("src", this.getSrc());
|
|
282
|
+
for (const [i, u] of Object.entries(this.__attributes))
|
|
283
|
+
r.setAttribute(i, u);
|
|
284
|
+
return e.appendChild(r), { element: e };
|
|
285
|
+
}
|
|
286
|
+
static importJSON(t) {
|
|
287
|
+
const { src: e } = t;
|
|
288
|
+
return $(e).updateFromJSON(t);
|
|
289
|
+
}
|
|
290
|
+
exportJSON() {
|
|
291
|
+
return {
|
|
292
|
+
...super.exportJSON(),
|
|
293
|
+
src: this.getSrc()
|
|
294
|
+
};
|
|
295
|
+
}
|
|
296
|
+
select() {
|
|
297
|
+
const t = S();
|
|
298
|
+
return t.add(this.getKey()), O(t), t;
|
|
299
|
+
}
|
|
300
|
+
getSrc() {
|
|
301
|
+
return this.__src;
|
|
302
|
+
}
|
|
303
|
+
getTextContent() {
|
|
304
|
+
return `
|
|
305
|
+
`;
|
|
306
|
+
}
|
|
307
|
+
isInline() {
|
|
308
|
+
return !1;
|
|
309
|
+
}
|
|
310
|
+
decorate() {
|
|
311
|
+
const t = { src: this.getSrc(), ...this.__attributes };
|
|
312
|
+
return /* @__PURE__ */ o("img", { ...t });
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
function K(n) {
|
|
316
|
+
let t = null;
|
|
317
|
+
if (n.getAttribute("data-lexical-image-container") === "true") {
|
|
318
|
+
const e = n.querySelector("img"), r = e.getAttribute("src");
|
|
319
|
+
t = $(r);
|
|
320
|
+
for (const i of e.attributes)
|
|
321
|
+
i.name !== "src" && (t.__attributes[i.name] = i.value);
|
|
322
|
+
}
|
|
323
|
+
return { node: t };
|
|
324
|
+
}
|
|
325
|
+
function $(n) {
|
|
326
|
+
return l(new g(n));
|
|
327
|
+
}
|
|
328
|
+
function X(n) {
|
|
329
|
+
return n instanceof g;
|
|
330
|
+
}
|
|
331
|
+
export {
|
|
332
|
+
G as $,
|
|
333
|
+
f as H,
|
|
334
|
+
g as I,
|
|
335
|
+
h as M,
|
|
336
|
+
Q as a,
|
|
337
|
+
W as b,
|
|
338
|
+
y as c,
|
|
339
|
+
$ as d,
|
|
340
|
+
X as e,
|
|
341
|
+
d as f,
|
|
342
|
+
V as g,
|
|
343
|
+
M as h,
|
|
344
|
+
m as i,
|
|
345
|
+
U as j
|
|
346
|
+
};
|
|
347
|
+
//# sourceMappingURL=ImageNode-BhH71HMX.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ImageNode-BhH71HMX.js","sources":["../src/components/MathJaxRenderer.jsx","../src/nodes/MathNode.jsx","../src/nodes/MathHighlightNode.jsx","../src/nodes/HorizontalDividerNode.jsx","../src/nodes/ImageNode.jsx"],"sourcesContent":["import React, { useEffect, useRef } from \"react\";\n\nconst MathJaxRenderer = ({ children, inline }) => {\n const containerRef = useRef(null);\n\n useEffect(() => {\n if (containerRef.current && window.MathJax && window.MathJax.typesetPromise) {\n window.MathJax.typesetPromise([containerRef.current]).catch((err) =>\n console.error(\"MathJax typesetting failed:\", err)\n );\n }\n }, [children, inline]);\n\n const content = `${children}`;\n\n return <span ref={containerRef}>{content}</span>;\n};\n\nexport default MathJaxRenderer;\n","import {\n DecoratorNode,\n $applyNodeReplacement,\n $createNodeSelection,\n $setSelection,\n} from \"lexical\";\nimport { addClassNamesToElement } from \"@lexical/utils\";\nimport MathJaxRenderer from \"../components/MathJaxRenderer\";\n\nexport class MathNode extends DecoratorNode {\n static getType() {\n return \"math\";\n }\n\n static clone(node) {\n return new MathNode(node.__equation, node.__inline, node.__key);\n }\n\n constructor(equation, inline, key) {\n super(key);\n this.__equation = equation;\n this.__inline = inline;\n }\n\n getEquation() {\n return this.__equation;\n }\n\n getTextContent() {\n return this.getEquation();\n }\n\n isInline() {\n return this.__inline;\n }\n\n select() {\n // only call during updates\n const nodeSelection = $createNodeSelection();\n nodeSelection.add(this.getKey());\n $setSelection(nodeSelection);\n return nodeSelection;\n }\n\n createDOM(config) {\n const element = document.createElement(\"span\");\n if (this.__inline) {\n addClassNamesToElement(element, config.theme.math.renderedInline);\n } else {\n addClassNamesToElement(element, config.theme.math.renderedBlock);\n }\n return element;\n }\n\n updateDOM() {\n return false;\n }\n\n static importDOM() {\n return {\n span: (node) => ({\n conversion: $convertMathElement,\n priority: 1,\n }),\n };\n }\n\n exportDOM(editor) {\n const { element } = super.exportDOM(editor); // calls the createDOM method\n element.textContent = this.getEquation();\n element.setAttribute(\"data-lexical-math\", \"true\");\n element.setAttribute(\"data-math-inline\", this.__inline.toString());\n return { element };\n }\n\n static importJSON(serializedNode) {\n const { equation, inline } = serializedNode;\n return $createMathNode(equation, inline).updateFromJSON(serializedNode);\n }\n\n exportJSON() {\n return {\n ...super.exportJSON(),\n equation: this.getEquation(),\n inline: this.isInline(),\n };\n }\n\n decorate() {\n return <MathJaxRenderer inline={this.__inline}>{this.__equation}</MathJaxRenderer>;\n }\n}\n\nfunction $convertMathElement(element) {\n let node = null;\n if (element.getAttribute(\"data-lexical-math\") === \"true\") {\n const equation = element.textContent;\n const inlineAttr = element.getAttribute(\"data-math-inline\");\n const inline = inlineAttr === \"true\";\n node = $createMathNode(equation, inline);\n }\n\n return { node };\n}\n\nexport function $createMathNode(equation, inline) {\n return $applyNodeReplacement(new MathNode(equation, inline));\n}\n\nexport function $isMathNode(node) {\n return node instanceof MathNode;\n}\n","import {\n TextNode,\n $applyNodeReplacement,\n ElementNode,\n $createParagraphNode,\n $createTextNode,\n $isParagraphNode,\n $getSelection,\n $isRangeSelection,\n $isTextNode,\n $isLineBreakNode,\n} from \"lexical\";\nimport { addClassNamesToElement, $findMatchingParent } from \"@lexical/utils\";\n\nexport class MathHighlightNodeInline extends TextNode {\n static getType() {\n return \"math-highlight-inline\";\n }\n\n static clone(node) {\n return new MathHighlightNodeInline(node.__equation, node.__key);\n }\n\n createDOM(config) {\n const element = super.createDOM(config);\n addClassNamesToElement(element, config.theme.math.highlightInline);\n return element;\n }\n\n static importJSON(serializedNode) {\n // This method will likely be never used\n return null;\n }\n\n exportJSON() {\n // Export as a MathNode\n return {\n type: \"math\",\n version: 1,\n equation: this.getTextContent(),\n inline: true,\n };\n }\n\n exportDOM(editor) {\n // Export as a MathNode\n const element = document.createElement(\"span\");\n addClassNamesToElement(element, editor._config.theme.math.renderedInline);\n element.textContent = this.getTextContent();\n element.setAttribute(\"data-lexical-math\", \"true\");\n element.setAttribute(\"data-math-inline\", \"true\");\n return { element };\n }\n}\n\nexport function $createMathHighlightNodeInline(equation) {\n const mathHighlightNode = new MathHighlightNodeInline(equation);\n return $applyNodeReplacement(mathHighlightNode);\n}\n\nexport function $isMathHighlightNodeInline(node) {\n return node instanceof MathHighlightNodeInline;\n}\n\nexport class MathHighlightNodeBlock extends ElementNode {\n static getType() {\n return \"math-highlight-block\";\n }\n\n static clone(node) {\n return new MathHighlightNodeBlock(node.__equation, node.__key);\n }\n\n constructor(equation, key) {\n super(key);\n this.__equation = equation;\n }\n\n createDOM(config) {\n const element = document.createElement(\"span\");\n addClassNamesToElement(element, config.theme.math.highlightBlock);\n return element;\n }\n\n updateDOM() {\n return false;\n }\n\n static importJSON(serializedNode) {\n return null;\n }\n\n exportJSON() {\n return {\n type: \"math\",\n version: 1,\n equation: this.getTextContent(),\n inline: false,\n };\n }\n\n exportDOM(editor) {\n const element = document.createElement(\"span\");\n addClassNamesToElement(element, editor._config.theme.math.renderedBlock);\n element.textContent = this.getTextContent();\n element.setAttribute(\"data-lexical-math\", \"true\");\n element.setAttribute(\"data-math-inline\", \"false\");\n return { element };\n }\n\n collapseAtStart() {\n this.remove();\n return true;\n }\n\n insertNewAfter() {\n const selection = $getSelection();\n if ($isRangeSelection(selection) && selection.isCollapsed()) {\n const lastChild = this.getLastChild();\n const anchorNode = selection.anchor.getNode();\n const isAtBlockEnd =\n (anchorNode.getKey() === this.getKey() &&\n selection.anchor.offset === 0 &&\n this.getChildrenSize() === 0) ||\n (lastChild &&\n $isLineBreakNode(lastChild) &&\n anchorNode.getKey() === this.getKey() &&\n selection.anchor.offset === this.getChildrenSize()) ||\n (lastChild &&\n $isTextNode(lastChild) &&\n anchorNode.getKey() === lastChild.getKey() &&\n selection.anchor.offset === lastChild.getTextContent().length);\n if (isAtBlockEnd) {\n // If the last child is a LineBreakNode, it means the user pressed Enter twice (once to create the break, once now).\n // In this case, we exit the block.\n if (lastChild && $isLineBreakNode(lastChild)) {\n lastChild.remove();\n const parentNode = $findMatchingParent(this, $isParagraphNode);\n const paragraphNode = $createParagraphNode();\n if (!parentNode) {\n this.insertAfter(paragraphNode);\n } else {\n parentNode.insertAfter(paragraphNode);\n }\n paragraphNode.select();\n return paragraphNode;\n } else {\n // Otherwise, we just insert a line break within the block.\n selection.insertLineBreak();\n return null;\n }\n }\n }\n }\n}\n\nexport function $createMathHighlightNodeBlock(equation) {\n const equationTextNode = $createTextNode(equation);\n let mathHighlightNode = new MathHighlightNodeBlock(equation);\n return $applyNodeReplacement(mathHighlightNode.append(equationTextNode));\n}\n\nexport function $isMathHighlightNodeBlock(node) {\n return node instanceof MathHighlightNodeBlock;\n}\n","import { DecoratorNode, $applyNodeReplacement } from \"lexical\";\nimport { addClassNamesToElement } from \"@lexical/utils\";\nimport { renderToString } from \"react-dom/server\";\n\nfunction SVGDot() {\n const dotSize = 6;\n const radius = dotSize / 2;\n const viewBox = `0 0 ${dotSize} ${dotSize}`;\n\n return (\n <svg\n width={dotSize}\n height={dotSize}\n viewBox={viewBox}\n xmlns=\"http://www.w3.org/2000/svg\"\n aria-hidden=\"true\"\n >\n <circle cx={radius} cy={radius} r={radius} />\n </svg>\n );\n}\n\nexport class HorizontalDividerNode extends DecoratorNode {\n static getType() {\n return \"horizontal-divider\";\n }\n\n static clone(node) {\n return new HorizontalDividerNode(node.__key);\n }\n\n createDOM(config) {\n const element = document.createElement(\"div\");\n addClassNamesToElement(element, config.theme.divider);\n return element;\n }\n\n getTextContent() {\n return \"\\n\";\n }\n\n isInline() {\n return false;\n }\n\n updateDOM() {\n return false;\n }\n\n static importDOM() {\n return {\n div: (node) => {\n if (node.getAttribute(\"data-lexical-horizontal-divider\") === \"true\") {\n return {\n conversion: $convertHorizontalDividerElement,\n priority: 2,\n };\n }\n return null;\n },\n };\n }\n\n exportDOM(editor) {\n const { element } = super.exportDOM(editor);\n element.setAttribute(\"data-lexical-horizontal-divider\", \"true\");\n\n // post-processing function\n const after = (element) => {\n const dotsComponent = (\n <>\n <SVGDot />\n <SVGDot />\n <SVGDot />\n </>\n );\n const dotsHTML = renderToString(dotsComponent);\n element.innerHTML = dotsHTML;\n\n return element;\n };\n\n return { after, element };\n }\n\n static importJSON(serializedNode) {\n return $createHorizontalDividerNode().updateFromJSON(serializedNode);\n }\n\n exportJSON() {\n return super.exportJSON();\n }\n\n decorate() {\n return (\n <>\n <SVGDot />\n <SVGDot />\n <SVGDot />\n </>\n );\n }\n}\n\nfunction $convertHorizontalDividerElement(element) {\n let node = null;\n if (element.getAttribute(\"data-lexical-horizontal-divider\") === \"true\") {\n node = $createHorizontalDividerNode();\n }\n return { node };\n}\n\nexport function $createHorizontalDividerNode() {\n return $applyNodeReplacement(new HorizontalDividerNode());\n}\n\nexport function $isHorizontalDividerNode(node) {\n return node instanceof HorizontalDividerNode;\n}\n","import {\n DecoratorNode,\n $applyNodeReplacement,\n $createNodeSelection,\n $setSelection,\n} from \"lexical\";\nimport { addClassNamesToElement } from \"@lexical/utils\";\n\nexport class ImageNode extends DecoratorNode {\n static getType() {\n return \"image\";\n }\n\n static clone(node) {\n return new ImageNode(node.__src, node.__key);\n }\n\n constructor(src, key) {\n super(key);\n this.__src = src;\n this.__attributes = {};\n }\n\n createDOM(config) {\n const element = document.createElement(\"figure\");\n addClassNamesToElement(element, config.theme.img);\n return element;\n }\n\n updateDOM() {\n return false;\n }\n\n static importDOM() {\n return {\n figure: (node) => ({\n conversion: $convertImageElement,\n priority: 1,\n }),\n };\n }\n\n exportDOM(editor) {\n const { element } = super.exportDOM(editor);\n element.setAttribute(\"data-lexical-image-container\", \"true\");\n\n const imgElement = document.createElement(\"img\");\n imgElement.setAttribute(\"src\", this.getSrc());\n\n // Apply stored attributes\n for (const [name, value] of Object.entries(this.__attributes)) {\n imgElement.setAttribute(name, value);\n }\n\n element.appendChild(imgElement);\n return { element };\n }\n\n static importJSON(serializedNode) {\n const { src } = serializedNode;\n return $createImageNode(src).updateFromJSON(serializedNode);\n }\n\n exportJSON() {\n return {\n ...super.exportJSON(),\n src: this.getSrc(),\n };\n }\n\n select() {\n const nodeSelection = $createNodeSelection();\n nodeSelection.add(this.getKey());\n $setSelection(nodeSelection);\n return nodeSelection;\n }\n\n getSrc() {\n return this.__src;\n }\n\n getTextContent() {\n return \"\\n\";\n }\n\n isInline() {\n return false;\n }\n\n decorate() {\n const props = { src: this.getSrc(), ...this.__attributes };\n return <img {...props} />;\n }\n}\n\nfunction $convertImageElement(element) {\n let node = null;\n if (element.getAttribute(\"data-lexical-image-container\") === \"true\") {\n const imgElement = element.querySelector(\"img\");\n const src = imgElement.getAttribute(\"src\");\n node = $createImageNode(src);\n\n // Store attributes\n for (const attr of imgElement.attributes) {\n if (attr.name !== \"src\") {\n node.__attributes[attr.name] = attr.value;\n }\n }\n }\n\n return { node };\n}\n\nexport function $createImageNode(src) {\n return $applyNodeReplacement(new ImageNode(src));\n}\n\nexport function $isImageNode(node) {\n return node instanceof ImageNode;\n}\n"],"names":["MathJaxRenderer","children","inline","containerRef","useRef","useEffect","err","content","jsx","MathNode","DecoratorNode","node","equation","key","nodeSelection","$createNodeSelection","$setSelection","config","element","addClassNamesToElement","$convertMathElement","editor","serializedNode","$createMathNode","$applyNodeReplacement","$isMathNode","MathHighlightNodeInline","TextNode","$createMathHighlightNodeInline","mathHighlightNode","$isMathHighlightNodeInline","MathHighlightNodeBlock","ElementNode","selection","$getSelection","$isRangeSelection","lastChild","anchorNode","$isLineBreakNode","$isTextNode","parentNode","$findMatchingParent","$isParagraphNode","paragraphNode","$createParagraphNode","$createMathHighlightNodeBlock","equationTextNode","$createTextNode","$isMathHighlightNodeBlock","SVGDot","HorizontalDividerNode","$convertHorizontalDividerElement","dotsHTML","renderToString","jsxs","Fragment","$createHorizontalDividerNode","ImageNode","src","$convertImageElement","imgElement","name","value","$createImageNode","props","attr","$isImageNode"],"mappings":";;;;;AAEA,MAAMA,IAAkB,CAAC,EAAE,UAAAC,GAAU,QAAAC,QAAa;AACxC,QAAAC,IAAeC,EAAO,IAAI;AAEhC,EAAAC,EAAU,MAAM;AACZ,IAAIF,EAAa,WAAW,OAAO,WAAW,OAAO,QAAQ,kBACzD,OAAO,QAAQ,eAAe,CAACA,EAAa,OAAO,CAAC,EAAE;AAAA,MAAM,CAACG,MACzD,QAAQ,MAAM,+BAA+BA,CAAG;AAAA,IACpD;AAAA,EACJ,GACD,CAACL,GAAUC,CAAM,CAAC;AAEf,QAAAK,IAAU,GAAGN,CAAQ;AAE3B,SAAQ,gBAAAO,EAAA,QAAA,EAAK,KAAKL,GAAe,UA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K,SAAS,UAChBtD,EAAK,aAAasD,EAAK,IAAI,IAAIA,EAAK;AAAA,EAExC;AAGF,SAAO,EAAE,MAAAtD,EAAK;AAChB;AAEO,SAASoD,EAAiBL,GAAK;AACpC,SAAOlC,EAAsB,IAAIiC,EAAUC,CAAG,CAAC;AACjD;AAEO,SAASQ,EAAavD,GAAM;AACjC,SAAOA,aAAgB8C;AACzB;"}
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import './lexical-medium-editor.css';
|
|
2
|
-
import {
|
|
3
|
-
|
|
2
|
+
import { HeadingNode as t, QuoteNode as o } from "@lexical/rich-text";
|
|
3
|
+
import { LinkNode as i } from "@lexical/link";
|
|
4
|
+
import { M as n, f as r, i as m, H as d, I as a } from "./ImageNode-BhH71HMX.js";
|
|
5
|
+
import { CodeNode as l, CodeHighlightNode as k } from "@lexical/code";
|
|
6
|
+
import { ListNode as h, ListItemNode as c } from "@lexical/list";
|
|
7
|
+
const u = {
|
|
4
8
|
paragraph: "medium-paragraph",
|
|
5
9
|
heading: {
|
|
6
10
|
h1: "medium-h1",
|
|
@@ -65,29 +69,29 @@ const s = {
|
|
|
65
69
|
variable: "tokenVariable"
|
|
66
70
|
}
|
|
67
71
|
};
|
|
68
|
-
function
|
|
72
|
+
function p(e) {
|
|
69
73
|
console.error(e);
|
|
70
74
|
}
|
|
71
|
-
const
|
|
75
|
+
const f = {
|
|
72
76
|
namespace: "MyEditor",
|
|
73
|
-
theme:
|
|
74
|
-
onError:
|
|
77
|
+
theme: u,
|
|
78
|
+
onError: p,
|
|
75
79
|
nodes: [
|
|
76
80
|
t,
|
|
77
81
|
o,
|
|
78
|
-
n,
|
|
79
82
|
i,
|
|
83
|
+
n,
|
|
80
84
|
r,
|
|
81
|
-
a,
|
|
82
85
|
m,
|
|
83
86
|
l,
|
|
84
|
-
d,
|
|
85
87
|
k,
|
|
86
|
-
|
|
87
|
-
|
|
88
|
+
d,
|
|
89
|
+
a,
|
|
90
|
+
h,
|
|
91
|
+
c
|
|
88
92
|
]
|
|
89
93
|
};
|
|
90
94
|
export {
|
|
91
|
-
|
|
95
|
+
f as initialConfig
|
|
92
96
|
};
|
|
93
97
|
//# sourceMappingURL=editorConfig.es.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"editorConfig.es.js","sources":["../src/editorConfig.js"],"sourcesContent":["import { HeadingNode, QuoteNode } from \"@lexical/rich-text\";\nimport { LinkNode } from \"@lexical/link\";\nimport { MathNode } from \"./nodes/MathNode\";\nimport {\n MathHighlightNodeInline,\n MathHighlightNodeBlock,\n} from \"./nodes/MathHighlightNode\";\nimport { CodeNode, CodeHighlightNode } from \"@lexical/code\";\nimport { HorizontalDividerNode } from \"./nodes/HorizontalDividerNode\";\nimport { ImageNode } from \"./nodes/ImageNode\";\nimport { ListItemNode, ListNode } from \"@lexical/list\";\n\nconst theme = {\n paragraph: \"medium-paragraph\",\n heading: {\n h1: \"medium-h1\",\n h2: \"medium-h2\",\n h3: \"medium-h3\",\n },\n text: {\n bold: \"medium-bold\",\n italic: \"medium-italic\",\n code: \"medium-code\",\n },\n quote: \"medium-quote\",\n link: \"medium-link\",\n divider: \"medium-divider\",\n math: {\n renderedInline: \"math-rendered-inline\",\n renderedBlock: \"math-rendered-block\",\n highlightInline: \"math-highlight-inline\",\n highlightBlock: \"math-highlight-block\",\n },\n img: \"medium-img\",\n list: {\n nested: {\n listitem: \"medium-nested-listitem\",\n },\n ol: \"medium-ol\",\n ul: \"medium-ul\",\n listitem: \"medium-listitem\",\n },\n // code block\n code: \"code-block\",\n codeHighlight: {\n atrule: \"tokenAttr\",\n attr: \"tokenAttr\",\n boolean: \"tokenProperty\",\n builtin: \"tokenSelector\",\n cdata: \"tokenComment\",\n char: \"tokenSelector\",\n class: \"tokenFunction\",\n \"class-name\": \"tokenFunction\",\n comment: \"tokenComment\",\n constant: \"tokenProperty\",\n deleted: \"tokenProperty\",\n doctype: \"tokenComment\",\n entity: \"tokenOperator\",\n function: \"tokenFunction\",\n important: \"tokenVariable\",\n inserted: \"tokenSelector\",\n keyword: \"tokenAttr\",\n namespace: \"tokenVariable\",\n number: \"tokenProperty\",\n operator: \"tokenOperator\",\n prolog: \"tokenComment\",\n property: \"tokenProperty\",\n punctuation: \"tokenPunctuation\",\n regex: \"tokenVariable\",\n selector: \"tokenSelector\",\n string: \"tokenSelector\",\n symbol: \"tokenProperty\",\n tag: \"tokenProperty\",\n url: \"tokenOperator\",\n variable: \"tokenVariable\",\n },\n};\n\nfunction onError(error) {\n console.error(error);\n}\n\nexport const initialConfig = {\n namespace: \"MyEditor\",\n theme,\n onError,\n nodes: [\n HeadingNode,\n QuoteNode,\n LinkNode,\n MathNode,\n MathHighlightNodeInline,\n MathHighlightNodeBlock,\n CodeNode,\n CodeHighlightNode,\n HorizontalDividerNode,\n ImageNode,\n ListNode,\n ListItemNode,\n ],\n};\n"],"names":["theme","onError","error","initialConfig","HeadingNode","QuoteNode","LinkNode","MathNode","MathHighlightNodeInline","MathHighlightNodeBlock","CodeNode","CodeHighlightNode","HorizontalDividerNode","ImageNode","ListNode","ListItemNode"],"mappings":"
|
|
1
|
+
{"version":3,"file":"editorConfig.es.js","sources":["../src/editorConfig.js"],"sourcesContent":["import { HeadingNode, QuoteNode } from \"@lexical/rich-text\";\nimport { LinkNode } from \"@lexical/link\";\nimport { MathNode } from \"./nodes/MathNode\";\nimport {\n MathHighlightNodeInline,\n MathHighlightNodeBlock,\n} from \"./nodes/MathHighlightNode\";\nimport { CodeNode, CodeHighlightNode } from \"@lexical/code\";\nimport { HorizontalDividerNode } from \"./nodes/HorizontalDividerNode\";\nimport { ImageNode } from \"./nodes/ImageNode\";\nimport { ListItemNode, ListNode } from \"@lexical/list\";\n\nconst theme = {\n paragraph: \"medium-paragraph\",\n heading: {\n h1: \"medium-h1\",\n h2: \"medium-h2\",\n h3: \"medium-h3\",\n },\n text: {\n bold: \"medium-bold\",\n italic: \"medium-italic\",\n code: \"medium-code\",\n },\n quote: \"medium-quote\",\n link: \"medium-link\",\n divider: \"medium-divider\",\n math: {\n renderedInline: \"math-rendered-inline\",\n renderedBlock: \"math-rendered-block\",\n highlightInline: \"math-highlight-inline\",\n highlightBlock: \"math-highlight-block\",\n },\n img: \"medium-img\",\n list: {\n nested: {\n listitem: \"medium-nested-listitem\",\n },\n ol: \"medium-ol\",\n ul: \"medium-ul\",\n listitem: \"medium-listitem\",\n },\n // code block\n code: \"code-block\",\n codeHighlight: {\n atrule: \"tokenAttr\",\n attr: \"tokenAttr\",\n boolean: \"tokenProperty\",\n builtin: \"tokenSelector\",\n cdata: \"tokenComment\",\n char: \"tokenSelector\",\n class: \"tokenFunction\",\n \"class-name\": \"tokenFunction\",\n comment: \"tokenComment\",\n constant: \"tokenProperty\",\n deleted: \"tokenProperty\",\n doctype: \"tokenComment\",\n entity: \"tokenOperator\",\n function: \"tokenFunction\",\n important: \"tokenVariable\",\n inserted: \"tokenSelector\",\n keyword: \"tokenAttr\",\n namespace: \"tokenVariable\",\n number: \"tokenProperty\",\n operator: \"tokenOperator\",\n prolog: \"tokenComment\",\n property: \"tokenProperty\",\n punctuation: \"tokenPunctuation\",\n regex: \"tokenVariable\",\n selector: \"tokenSelector\",\n string: \"tokenSelector\",\n symbol: \"tokenProperty\",\n tag: \"tokenProperty\",\n url: \"tokenOperator\",\n variable: \"tokenVariable\",\n },\n};\n\nfunction onError(error) {\n console.error(error);\n}\n\nexport const initialConfig = {\n namespace: \"MyEditor\",\n theme,\n onError,\n nodes: [\n HeadingNode,\n QuoteNode,\n LinkNode,\n MathNode,\n MathHighlightNodeInline,\n MathHighlightNodeBlock,\n CodeNode,\n CodeHighlightNode,\n HorizontalDividerNode,\n ImageNode,\n ListNode,\n ListItemNode,\n ],\n};\n"],"names":["theme","onError","error","initialConfig","HeadingNode","QuoteNode","LinkNode","MathNode","MathHighlightNodeInline","MathHighlightNodeBlock","CodeNode","CodeHighlightNode","HorizontalDividerNode","ImageNode","ListNode","ListItemNode"],"mappings":";;;;;AAYA,MAA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