@haklex/rich-editor 0.32.0 → 0.34.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{AlertQuoteEditNode-DzAlcunI.js → AlertQuoteEditNode-DQuC-CkB.js} +20 -11
- package/dist/{KaTeXRenderer-g9a2JrRn.js → KaTeXRenderer-DLtnsRSv.js} +7 -5
- package/dist/{MermaidPlugin-C9MynNJB.js → MermaidPlugin-DinmlrKK.js} +10 -6
- package/dist/{SubmitShortcutPlugin-B0j2mEwI.js → SubmitShortcutPlugin-CSGVA99C.js} +41 -32
- package/dist/commands-entry.mjs +2 -2
- package/dist/{config-BkFO9ZYH.js → config-DMoe8QNB.js} +4 -3
- package/dist/index.mjs +7 -7
- package/dist/{node-registry-7ejJVRJZ.js → node-registry-DPciIuyu.js} +8 -21
- package/dist/nodes/AlertQuoteEditNode.d.ts.map +1 -1
- package/dist/nodes/BannerEditNode.d.ts.map +1 -1
- package/dist/nodes/CodeBlockEditNode.d.ts +1 -0
- package/dist/nodes/CodeBlockEditNode.d.ts.map +1 -1
- package/dist/nodes/GridEditNode.d.ts.map +1 -1
- package/dist/nodes/shared.d.ts +2 -1
- package/dist/nodes/shared.d.ts.map +1 -1
- package/dist/nodes-entry.mjs +4 -4
- package/dist/plugins/ImageUploadPlugin.d.ts.map +1 -1
- package/dist/plugins-entry.mjs +2 -2
- package/dist/renderers-entry.mjs +1 -1
- package/dist/static-entry.mjs +3 -3
- package/dist/{theme-BVIoTCzV.js → theme-C7HnCTta.js} +11 -7
- package/dist/types/slash-menu.d.ts +1 -0
- package/dist/types/slash-menu.d.ts.map +1 -1
- package/dist/utils/image-insertion.d.ts +1 -0
- package/dist/utils/image-insertion.d.ts.map +1 -1
- package/package.json +28 -28
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { I as AlertQuoteNode, L as _defineProperty, M as FootnoteNode, N as $isAlertQuoteNode, _ as MentionNode, b as KaTeXInlineNode, c as SpoilerNode, d as RichQuoteNode, i as TagNode, t as editorTheme, z as AlertRenderer } from "./theme-
|
|
2
|
-
import { h as ALERT_NODE_KEY, l as RendererWrapper } from "./KaTeXRenderer-
|
|
1
|
+
import { I as AlertQuoteNode, L as _defineProperty, M as FootnoteNode, N as $isAlertQuoteNode, _ as MentionNode, b as KaTeXInlineNode, c as SpoilerNode, d as RichQuoteNode, i as TagNode, t as editorTheme, z as AlertRenderer } from "./theme-C7HnCTta.js";
|
|
2
|
+
import { h as ALERT_NODE_KEY, l as RendererWrapper } from "./KaTeXRenderer-DLtnsRSv.js";
|
|
3
3
|
import { LinkPlugin } from "@lexical/react/LexicalLinkPlugin";
|
|
4
4
|
import { ListPlugin } from "@lexical/react/LexicalListPlugin";
|
|
5
5
|
import { AutoLinkNode, LinkNode } from "@lexical/link";
|
|
6
6
|
import { useLexicalComposerContext } from "@lexical/react/LexicalComposerContext";
|
|
7
7
|
import { createContext, createElement, use, useCallback, useEffect, useMemo } from "react";
|
|
8
8
|
import { HeadingNode, QuoteNode } from "@lexical/rich-text";
|
|
9
|
-
import { $createParagraphNode, $getNodeByKey, $getRoot, $getSelection, $insertNodes, $isParagraphNode, $isRangeSelection, COMMAND_PRIORITY_CRITICAL, COMMAND_PRIORITY_HIGH, KEY_ARROW_DOWN_COMMAND, KEY_ENTER_COMMAND, createEditor } from "lexical";
|
|
9
|
+
import { $createParagraphNode, $getEditor, $getNodeByKey, $getRoot, $getSelection, $insertNodes, $isParagraphNode, $isRangeSelection, COMMAND_PRIORITY_CRITICAL, COMMAND_PRIORITY_HIGH, KEY_ARROW_DOWN_COMMAND, KEY_ENTER_COMMAND, createEditor } from "lexical";
|
|
10
10
|
import { HorizontalRuleNode } from "@lexical/extension";
|
|
11
11
|
import { CodeNode } from "@lexical/code-core";
|
|
12
12
|
import { ListItemNode, ListNode } from "@lexical/list";
|
|
@@ -180,18 +180,27 @@ var NESTED_EDITOR_NODES = [
|
|
|
180
180
|
KaTeXInlineNode,
|
|
181
181
|
TagNode
|
|
182
182
|
];
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
183
|
+
function $tryGetEditor() {
|
|
184
|
+
try {
|
|
185
|
+
return $getEditor();
|
|
186
|
+
} catch {
|
|
187
|
+
return null;
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
function createNestedEditor(fallbackNamespace) {
|
|
191
|
+
if ($tryGetEditor()) return createEditor();
|
|
186
192
|
return createEditor({
|
|
187
|
-
namespace:
|
|
193
|
+
namespace: fallbackNamespace,
|
|
188
194
|
nodes: NESTED_EDITOR_NODES,
|
|
189
195
|
theme: editorTheme,
|
|
190
|
-
onError: (error) => {
|
|
191
|
-
console.error("[AlertContent]", error);
|
|
192
|
-
}
|
|
196
|
+
onError: (error) => console.error(`[${fallbackNamespace}]`, error)
|
|
193
197
|
});
|
|
194
198
|
}
|
|
199
|
+
//#endregion
|
|
200
|
+
//#region src/nodes/AlertQuoteEditNode.ts
|
|
201
|
+
function createContentEditor() {
|
|
202
|
+
return createNestedEditor("AlertContent");
|
|
203
|
+
}
|
|
195
204
|
var AlertQuoteEditNode = class AlertQuoteEditNode extends AlertQuoteNode {
|
|
196
205
|
static clone(node) {
|
|
197
206
|
const cloned = new AlertQuoteEditNode(node.__alertType, node.__contentState, node.__key);
|
|
@@ -292,4 +301,4 @@ function $createAlertQuoteEditNode(alertType, contentState) {
|
|
|
292
301
|
return new AlertQuoteEditNode(alertType, contentState);
|
|
293
302
|
}
|
|
294
303
|
//#endregion
|
|
295
|
-
export {
|
|
304
|
+
export { NestedEditorCorePlugins as a, createNestedEditor as i, AlertQuoteEditNode as n, NestedEditorPluginsProvider as o, NESTED_EDITOR_NODES as r, useNestedEditorPlugins as s, $createAlertQuoteEditNode as t };
|
|
@@ -93,11 +93,12 @@ var FootnoteDefinitionsContext = createContext({
|
|
|
93
93
|
displayNumberMap: {}
|
|
94
94
|
});
|
|
95
95
|
function FootnoteDefinitionsProvider({ definitions, displayNumberMap, children }) {
|
|
96
|
+
const value = useMemo(() => ({
|
|
97
|
+
definitions,
|
|
98
|
+
displayNumberMap
|
|
99
|
+
}), [definitions, displayNumberMap]);
|
|
96
100
|
return /* @__PURE__ */ jsx(FootnoteDefinitionsContext, {
|
|
97
|
-
value
|
|
98
|
-
definitions,
|
|
99
|
-
displayNumberMap
|
|
100
|
-
}), [definitions, displayNumberMap]),
|
|
101
|
+
value,
|
|
101
102
|
children
|
|
102
103
|
});
|
|
103
104
|
}
|
|
@@ -175,7 +176,8 @@ async function computeImageMeta(file) {
|
|
|
175
176
|
}
|
|
176
177
|
function decodeThumbHash(hash) {
|
|
177
178
|
try {
|
|
178
|
-
|
|
179
|
+
const bytes = base64ToUint8(hash);
|
|
180
|
+
return thumbHashToDataURL(bytes);
|
|
179
181
|
} catch {
|
|
180
182
|
return;
|
|
181
183
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { f as $createMermaidNode, k as $withAdaptiveImageDisplayWidth, v as $createKaTeXInlineNode, w as $createImageNode, x as $createKaTeXBlockNode } from "./theme-
|
|
2
|
-
import { t as $createAlertQuoteEditNode } from "./AlertQuoteEditNode-
|
|
1
|
+
import { f as $createMermaidNode, k as $withAdaptiveImageDisplayWidth, v as $createKaTeXInlineNode, w as $createImageNode, x as $createKaTeXBlockNode } from "./theme-C7HnCTta.js";
|
|
2
|
+
import { t as $createAlertQuoteEditNode } from "./AlertQuoteEditNode-DQuC-CkB.js";
|
|
3
3
|
import { useLexicalComposerContext } from "@lexical/react/LexicalComposerContext";
|
|
4
4
|
import { useEffect } from "react";
|
|
5
5
|
import { $insertNodes, COMMAND_PRIORITY_EDITOR, createCommand } from "lexical";
|
|
@@ -22,7 +22,8 @@ function ImagePlugin() {
|
|
|
22
22
|
const [editor] = useLexicalComposerContext();
|
|
23
23
|
useEffect(() => {
|
|
24
24
|
return editor.registerCommand(INSERT_IMAGE_COMMAND, (payload) => {
|
|
25
|
-
$
|
|
25
|
+
const imageNode = $createImageNode($withAdaptiveImageDisplayWidth(payload));
|
|
26
|
+
$insertNodes([imageNode]);
|
|
26
27
|
return true;
|
|
27
28
|
}, COMMAND_PRIORITY_EDITOR);
|
|
28
29
|
}, [editor]);
|
|
@@ -36,11 +37,13 @@ function KaTeXPlugin() {
|
|
|
36
37
|
const [editor] = useLexicalComposerContext();
|
|
37
38
|
useEffect(() => {
|
|
38
39
|
const unregisterInline = editor.registerCommand(INSERT_KATEX_INLINE_COMMAND, (equation) => {
|
|
39
|
-
$
|
|
40
|
+
const node = $createKaTeXInlineNode(equation, { autoOpenOnMount: !equation.trim() });
|
|
41
|
+
$insertNodes([node]);
|
|
40
42
|
return true;
|
|
41
43
|
}, COMMAND_PRIORITY_EDITOR);
|
|
42
44
|
const unregisterBlock = editor.registerCommand(INSERT_KATEX_BLOCK_COMMAND, (equation) => {
|
|
43
|
-
$
|
|
45
|
+
const node = $createKaTeXBlockNode(equation, { autoOpenOnMount: !equation.trim() });
|
|
46
|
+
$insertNodes([node]);
|
|
44
47
|
return true;
|
|
45
48
|
}, COMMAND_PRIORITY_EDITOR);
|
|
46
49
|
return () => {
|
|
@@ -57,7 +60,8 @@ function MermaidPlugin() {
|
|
|
57
60
|
const [editor] = useLexicalComposerContext();
|
|
58
61
|
useEffect(() => {
|
|
59
62
|
return editor.registerCommand(INSERT_MERMAID_COMMAND, (diagram) => {
|
|
60
|
-
$
|
|
63
|
+
const node = $createMermaidNode(diagram);
|
|
64
|
+
$insertNodes([node]);
|
|
61
65
|
return true;
|
|
62
66
|
}, COMMAND_PRIORITY_EDITOR);
|
|
63
67
|
}, [editor]);
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { c as setCodeBlockCursorIntent, o as $createCodeBlockEditNode, s as $createBannerEditNode, t as getResolvedEditNodes } from "./node-registry-
|
|
2
|
-
import { A as OPEN_IMAGE_UPLOAD_DIALOG_COMMAND, C as KaTeXBlockNode, I as AlertQuoteNode, M as FootnoteNode, R as extractTextContent, _ as MentionNode, b as KaTeXInlineNode, c as SpoilerNode, h as $createMentionNode, j as $createFootnoteNode, k as $withAdaptiveImageDisplayWidth, o as $createSpoilerNode, v as $createKaTeXInlineNode, w as $createImageNode, x as $createKaTeXBlockNode } from "./theme-
|
|
3
|
-
import { a as FootnoteDefinitionsProvider, n as computeImageMeta } from "./KaTeXRenderer-
|
|
1
|
+
import { c as setCodeBlockCursorIntent, o as $createCodeBlockEditNode, s as $createBannerEditNode, t as getResolvedEditNodes } from "./node-registry-DPciIuyu.js";
|
|
2
|
+
import { A as OPEN_IMAGE_UPLOAD_DIALOG_COMMAND, C as KaTeXBlockNode, I as AlertQuoteNode, M as FootnoteNode, R as extractTextContent, _ as MentionNode, b as KaTeXInlineNode, c as SpoilerNode, h as $createMentionNode, j as $createFootnoteNode, k as $withAdaptiveImageDisplayWidth, o as $createSpoilerNode, v as $createKaTeXInlineNode, w as $createImageNode, x as $createKaTeXBlockNode } from "./theme-C7HnCTta.js";
|
|
3
|
+
import { a as FootnoteDefinitionsProvider, n as computeImageMeta } from "./KaTeXRenderer-DLtnsRSv.js";
|
|
4
4
|
import "./katex.css-0TJGE4On.js";
|
|
5
|
-
import { C as CommentNode, M as BannerNode, T as CodeBlockNode, _ as FootnoteSectionNode, b as $createCommentNode, c as RubyNode, g as $isFootnoteSectionNode, h as $createFootnoteSectionNode, i as $createVideoNode, o as $createRubyNode, p as $isGridContainerNode, v as $createDetailsNode, x as $createCommentPlaceholderNode, y as DetailsNode } from "./config-
|
|
6
|
-
import { t as $createAlertQuoteEditNode } from "./AlertQuoteEditNode-
|
|
5
|
+
import { C as CommentNode, M as BannerNode, T as CodeBlockNode, _ as FootnoteSectionNode, b as $createCommentNode, c as RubyNode, g as $isFootnoteSectionNode, h as $createFootnoteSectionNode, i as $createVideoNode, o as $createRubyNode, p as $isGridContainerNode, v as $createDetailsNode, x as $createCommentPlaceholderNode, y as DetailsNode } from "./config-DMoe8QNB.js";
|
|
6
|
+
import { t as $createAlertQuoteEditNode } from "./AlertQuoteEditNode-DQuC-CkB.js";
|
|
7
7
|
import { n as getHostname, r as probeFavicon, t as normalizeSerializedEditorState } from "./normalizeSerializedEditorState-VaI73T09.js";
|
|
8
8
|
import { CheckListPlugin } from "@lexical/react/LexicalCheckListPlugin";
|
|
9
9
|
import { LinkPlugin } from "@lexical/react/LexicalLinkPlugin";
|
|
@@ -443,8 +443,8 @@ var GIT_ALERT_TRANSFORMER$1 = {
|
|
|
443
443
|
dependencies: [AlertQuoteNode],
|
|
444
444
|
regExp: /^>\s*\[!(NOTE|TIP|IMPORTANT|WARNING|CAUTION)\]\s*$/,
|
|
445
445
|
replace: (parentNode, children, match) => {
|
|
446
|
-
const
|
|
447
|
-
const
|
|
446
|
+
const alertType = ALERT_TYPE_MAP[match[1]] || "note";
|
|
447
|
+
const content = { root: {
|
|
448
448
|
children: [{
|
|
449
449
|
type: "paragraph",
|
|
450
450
|
children: children.map((child) => child.exportJSON()),
|
|
@@ -460,7 +460,8 @@ var GIT_ALERT_TRANSFORMER$1 = {
|
|
|
460
460
|
indent: 0,
|
|
461
461
|
type: "root",
|
|
462
462
|
version: 1
|
|
463
|
-
} }
|
|
463
|
+
} };
|
|
464
|
+
const alertNode = $createAlertQuoteEditNode(alertType, content);
|
|
464
465
|
parentNode.replace(alertNode);
|
|
465
466
|
}
|
|
466
467
|
};
|
|
@@ -537,7 +538,7 @@ var CONTAINER_TRANSFORMER$1 = {
|
|
|
537
538
|
const params = match[2];
|
|
538
539
|
if (type in BANNER_TYPE_MAP) {
|
|
539
540
|
const bannerType = BANNER_TYPE_MAP[type];
|
|
540
|
-
const
|
|
541
|
+
const content = { root: {
|
|
541
542
|
children: [{
|
|
542
543
|
type: "paragraph",
|
|
543
544
|
children: children.map((child) => child.exportJSON()),
|
|
@@ -553,13 +554,15 @@ var CONTAINER_TRANSFORMER$1 = {
|
|
|
553
554
|
indent: 0,
|
|
554
555
|
type: "root",
|
|
555
556
|
version: 1
|
|
556
|
-
} }
|
|
557
|
+
} };
|
|
558
|
+
const banner = $createBannerEditNode(bannerType, content);
|
|
557
559
|
parentNode.replace(banner);
|
|
558
560
|
return;
|
|
559
561
|
}
|
|
560
562
|
if (type === "details") {
|
|
561
563
|
const summaryMatch = params?.match(/summary="([^"]*)"/);
|
|
562
|
-
const
|
|
564
|
+
const summary = summaryMatch ? summaryMatch[1] : "Details";
|
|
565
|
+
const details = $createDetailsNode(summary);
|
|
563
566
|
children.forEach((child) => {
|
|
564
567
|
details.append(child);
|
|
565
568
|
});
|
|
@@ -842,7 +845,8 @@ function convertAndInsert(markdown) {
|
|
|
842
845
|
}
|
|
843
846
|
const serializedChildren = tempEditor.getEditorState().toJSON().root.children;
|
|
844
847
|
if (!serializedChildren.length) return false;
|
|
845
|
-
|
|
848
|
+
const nodes = serializedChildren.map((s) => $parseSerializedNode(s));
|
|
849
|
+
$insertNodes(nodes);
|
|
846
850
|
return true;
|
|
847
851
|
}
|
|
848
852
|
function MarkdownPastePlugin() {
|
|
@@ -857,7 +861,8 @@ function MarkdownPastePlugin() {
|
|
|
857
861
|
if (vscodeData) {
|
|
858
862
|
const code = clipboardData.getData("text/plain");
|
|
859
863
|
if (code) {
|
|
860
|
-
|
|
864
|
+
const nodes = code.split(/\r?\n{3,}/).filter(Boolean).map((s) => $createCodeBlockEditNode(s.replace(/^\s*\n/, "").replace(/\n\s*$/, ""), vscodeData.language));
|
|
865
|
+
$insertNodes(nodes);
|
|
861
866
|
event.preventDefault();
|
|
862
867
|
return true;
|
|
863
868
|
}
|
|
@@ -1136,6 +1141,7 @@ function ImageUploadPlugin({ onUpload }) {
|
|
|
1136
1141
|
const [editor] = useLexicalComposerContext();
|
|
1137
1142
|
const uploadRef = useRef(onUpload);
|
|
1138
1143
|
uploadRef.current = onUpload;
|
|
1144
|
+
const targetEditorRef = useRef(editor);
|
|
1139
1145
|
const preprocessRef = useImagePreprocess()?.ref ?? null;
|
|
1140
1146
|
const getPreprocess = useCallback(() => preprocessRef?.current ?? null, [preprocessRef]);
|
|
1141
1147
|
const fileInputRef = useRef(null);
|
|
@@ -1167,21 +1173,22 @@ function ImageUploadPlugin({ onUpload }) {
|
|
|
1167
1173
|
if (toastTimerRef.current) window.clearTimeout(toastTimerRef.current);
|
|
1168
1174
|
toastTimerRef.current = window.setTimeout(setToast, 2200, null);
|
|
1169
1175
|
}, []);
|
|
1170
|
-
const insertByUpload = useCallback(async (file, options) => {
|
|
1176
|
+
const insertByUpload = useCallback(async (file, target, options) => {
|
|
1171
1177
|
if (!isImageFile(file)) return false;
|
|
1172
1178
|
const closeDialog = Boolean(options?.closeDialog);
|
|
1173
1179
|
setPendingUploads((value) => value + 1);
|
|
1174
1180
|
if (closeDialog) setDialogUploading(true);
|
|
1175
1181
|
try {
|
|
1176
1182
|
const [result, meta] = await Promise.all([uploadRef.current(file), computeImageMeta(file)]);
|
|
1177
|
-
|
|
1178
|
-
$
|
|
1183
|
+
target.update(() => {
|
|
1184
|
+
const node = $createImageNode($withAdaptiveImageDisplayWidth({
|
|
1179
1185
|
src: result.src,
|
|
1180
1186
|
altText: result.altText ?? file.name,
|
|
1181
1187
|
width: result.width ?? meta.width,
|
|
1182
1188
|
height: result.height ?? meta.height,
|
|
1183
1189
|
thumbhash: result.thumbhash ?? meta.thumbhash
|
|
1184
|
-
}))
|
|
1190
|
+
}));
|
|
1191
|
+
$insertNodes([node]);
|
|
1185
1192
|
});
|
|
1186
1193
|
if (closeDialog) {
|
|
1187
1194
|
setDialogOpen(false);
|
|
@@ -1200,26 +1207,27 @@ function ImageUploadPlugin({ onUpload }) {
|
|
|
1200
1207
|
setPendingUploads((value) => Math.max(value - 1, 0));
|
|
1201
1208
|
setDialogUploading(false);
|
|
1202
1209
|
}
|
|
1203
|
-
}, [
|
|
1204
|
-
const handleFiles = useCallback((files, source) => {
|
|
1210
|
+
}, [pushToast]);
|
|
1211
|
+
const handleFiles = useCallback((files, source, target) => {
|
|
1205
1212
|
const images = files.filter(isImageFile);
|
|
1206
1213
|
if (images.length === 0) return false;
|
|
1207
1214
|
(async () => {
|
|
1208
1215
|
const targets = await resolvePreprocessTargets(images, source, getPreprocess());
|
|
1209
|
-
for (const file of targets) insertByUpload(file);
|
|
1216
|
+
for (const file of targets) insertByUpload(file, target);
|
|
1210
1217
|
})();
|
|
1211
1218
|
return true;
|
|
1212
1219
|
}, [insertByUpload, getPreprocess]);
|
|
1213
1220
|
useEffect(() => {
|
|
1214
|
-
const unregisterDragDrop = editor.registerCommand(DRAG_DROP_PASTE, (files) => handleFiles(files, "drop"), COMMAND_PRIORITY_HIGH);
|
|
1215
|
-
const unregisterPaste = editor.registerCommand(PASTE_COMMAND, (event) => {
|
|
1221
|
+
const unregisterDragDrop = editor.registerCommand(DRAG_DROP_PASTE, (files, fromEditor) => handleFiles(files, "drop", fromEditor), COMMAND_PRIORITY_HIGH);
|
|
1222
|
+
const unregisterPaste = editor.registerCommand(PASTE_COMMAND, (event, fromEditor) => {
|
|
1216
1223
|
const clipboardData = "clipboardData" in event ? event.clipboardData : null;
|
|
1217
1224
|
if (!clipboardData) return false;
|
|
1218
1225
|
const files = [...clipboardData.files];
|
|
1219
|
-
if (files.some(isImageFile)) return handleFiles(files, "paste");
|
|
1226
|
+
if (files.some(isImageFile)) return handleFiles(files, "paste", fromEditor);
|
|
1220
1227
|
return false;
|
|
1221
1228
|
}, COMMAND_PRIORITY_HIGH);
|
|
1222
|
-
const unregisterOpenDialog = editor.registerCommand(OPEN_IMAGE_UPLOAD_DIALOG_COMMAND, () => {
|
|
1229
|
+
const unregisterOpenDialog = editor.registerCommand(OPEN_IMAGE_UPLOAD_DIALOG_COMMAND, (_payload, fromEditor) => {
|
|
1230
|
+
targetEditorRef.current = fromEditor;
|
|
1223
1231
|
setDialogOpen(true);
|
|
1224
1232
|
return true;
|
|
1225
1233
|
}, COMMAND_PRIORITY_EDITOR);
|
|
@@ -1277,10 +1285,10 @@ function ImageUploadPlugin({ onUpload }) {
|
|
|
1277
1285
|
}, []);
|
|
1278
1286
|
const handleDialogFile = useCallback(async (file) => {
|
|
1279
1287
|
if (!file) return;
|
|
1280
|
-
let
|
|
1281
|
-
if (isImageFile(file)) [
|
|
1282
|
-
if (!
|
|
1283
|
-
await insertByUpload(
|
|
1288
|
+
let uploadFile = file;
|
|
1289
|
+
if (isImageFile(file)) [uploadFile] = await resolvePreprocessTargets([file], "dialog", getPreprocess());
|
|
1290
|
+
if (!uploadFile) return;
|
|
1291
|
+
await insertByUpload(uploadFile, targetEditorRef.current, { closeDialog: true });
|
|
1284
1292
|
}, [insertByUpload, getPreprocess]);
|
|
1285
1293
|
const handleUrlPreview = useCallback(async () => {
|
|
1286
1294
|
const nextUrl = urlInput.trim();
|
|
@@ -1305,19 +1313,19 @@ function ImageUploadPlugin({ onUpload }) {
|
|
|
1305
1313
|
}, [urlInput]);
|
|
1306
1314
|
const handleInsertByUrl = useCallback(() => {
|
|
1307
1315
|
if (!urlPreview$1 || !isSafeImageUrl(urlPreview$1)) return;
|
|
1308
|
-
|
|
1309
|
-
$
|
|
1316
|
+
targetEditorRef.current.update(() => {
|
|
1317
|
+
const node = $createImageNode($withAdaptiveImageDisplayWidth({
|
|
1310
1318
|
src: urlPreview$1,
|
|
1311
1319
|
altText: "",
|
|
1312
1320
|
width: urlMeta?.width,
|
|
1313
1321
|
height: urlMeta?.height
|
|
1314
|
-
}))
|
|
1322
|
+
}));
|
|
1323
|
+
$insertNodes([node]);
|
|
1315
1324
|
});
|
|
1316
1325
|
pushToast("success", "Image inserted");
|
|
1317
1326
|
setDialogOpen(false);
|
|
1318
1327
|
resetUrlState();
|
|
1319
1328
|
}, [
|
|
1320
|
-
editor,
|
|
1321
1329
|
pushToast,
|
|
1322
1330
|
resetUrlState,
|
|
1323
1331
|
urlMeta,
|
|
@@ -1342,6 +1350,7 @@ function ImageUploadPlugin({ onUpload }) {
|
|
|
1342
1350
|
resetUrlState();
|
|
1343
1351
|
setDialogUploading(false);
|
|
1344
1352
|
setDialogDragActive(false);
|
|
1353
|
+
targetEditorRef.current = editor;
|
|
1345
1354
|
}
|
|
1346
1355
|
},
|
|
1347
1356
|
children: /* @__PURE__ */ jsxs(DialogPopup, {
|
package/dist/commands-entry.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { A as OPEN_IMAGE_UPLOAD_DIALOG_COMMAND, R as extractTextContent, o as $createSpoilerNode, s as $isSpoilerNode } from "./theme-
|
|
2
|
-
import { i as INSERT_KATEX_INLINE_COMMAND, l as INSERT_ALERT_COMMAND, o as INSERT_IMAGE_COMMAND, r as INSERT_KATEX_BLOCK_COMMAND, t as INSERT_MERMAID_COMMAND } from "./MermaidPlugin-
|
|
1
|
+
import { A as OPEN_IMAGE_UPLOAD_DIALOG_COMMAND, R as extractTextContent, o as $createSpoilerNode, s as $isSpoilerNode } from "./theme-C7HnCTta.js";
|
|
2
|
+
import { i as INSERT_KATEX_INLINE_COMMAND, l as INSERT_ALERT_COMMAND, o as INSERT_IMAGE_COMMAND, r as INSERT_KATEX_BLOCK_COMMAND, t as INSERT_MERMAID_COMMAND } from "./MermaidPlugin-DinmlrKK.js";
|
|
3
3
|
import { $createTextNode, $getSelection, $isRangeSelection } from "lexical";
|
|
4
4
|
//#region src/utils/collect-command-items.ts
|
|
5
5
|
function collectCommandItems(editor) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { C as KaTeXBlockNode, E as ImageNode, I as AlertQuoteNode, L as _defineProperty, M as FootnoteNode, R as extractTextContent, V as useNestedContentRenderer, _ as MentionNode, b as KaTeXInlineNode, c as SpoilerNode, d as RichQuoteNode, i as TagNode, m as MermaidNode } from "./theme-
|
|
2
|
-
import { D as VIDEO_NODE_KEY, S as LINK_CARD_NODE_KEY, _ as CODE_BLOCK_NODE_KEY, g as BANNER_NODE_KEY, l as RendererWrapper, m as useVariant, s as useFootnoteDefinitions, u as createRendererDecoration, y as FOOTNOTE_SECTION_NODE_KEY } from "./KaTeXRenderer-
|
|
1
|
+
import { C as KaTeXBlockNode, E as ImageNode, I as AlertQuoteNode, L as _defineProperty, M as FootnoteNode, R as extractTextContent, V as useNestedContentRenderer, _ as MentionNode, b as KaTeXInlineNode, c as SpoilerNode, d as RichQuoteNode, i as TagNode, m as MermaidNode } from "./theme-C7HnCTta.js";
|
|
2
|
+
import { D as VIDEO_NODE_KEY, S as LINK_CARD_NODE_KEY, _ as CODE_BLOCK_NODE_KEY, g as BANNER_NODE_KEY, l as RendererWrapper, m as useVariant, s as useFootnoteDefinitions, u as createRendererDecoration, y as FOOTNOTE_SECTION_NODE_KEY } from "./KaTeXRenderer-DLtnsRSv.js";
|
|
3
3
|
import { l as semanticClassNames, r as clsx, u as sharedStyles } from "./katex.css-0TJGE4On.js";
|
|
4
4
|
import { i as detailsStyles, n as gridStyles, r as detailsClassNames, t as gridClassNames } from "./grid.css-ClPR9Sd5.js";
|
|
5
5
|
import { t as LinkCardRenderer } from "./LinkCardRenderer-DPV1JP0X.js";
|
|
@@ -585,9 +585,10 @@ function FootnoteSectionRenderer({ definitions }) {
|
|
|
585
585
|
children: [/* @__PURE__ */ jsx("hr", { className: clsx(semanticClassNames.footnoteSectionDivider, sharedStyles.footnoteSectionDivider) }), /* @__PURE__ */ jsx("ol", {
|
|
586
586
|
className: clsx(semanticClassNames.footnoteSectionList, sharedStyles.footnoteSectionList),
|
|
587
587
|
children: sortedEntries.map(([identifier, content]) => {
|
|
588
|
+
const displayNum = displayNumberMap[identifier] ?? identifier;
|
|
588
589
|
return /* @__PURE__ */ jsx(FootnoteSectionItem, {
|
|
589
590
|
content,
|
|
590
|
-
displayNum
|
|
591
|
+
displayNum,
|
|
591
592
|
identifier
|
|
592
593
|
}, identifier);
|
|
593
594
|
})
|
package/dist/index.mjs
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { A as blockIdState, C as createTextSelectionStore, D as ImageUploadPlugin, E as LinkFaviconPlugin, F as ImagePreprocessProvider, L as CorePlugins, N as ImageUploadProvider, O as defaultImageUpload, S as TextSelectionStoreProvider, T as useTextSelectionStore, _ as $getRootBlock, a as AutoFocusPlugin, b as buildBlockAnchor, c as $captureTextSelection, d as createDOMRangeFromTextSelection, f as findDOMPointByTextOffset, g as TEXT_SELECTION_HIGHLIGHT_NAME, h as getTextOffsetFromDOMPoint, i as EditorRefPlugin, j as VideoUploadProvider, k as BlockIdPlugin, l as $captureTextSelectionFromRangeSelection, m as getDOMRectFromTextSelection, n as OnChangePlugin, o as VideoUploadPlugin, p as getBlockElementById, r as FootnotePlugin, s as TextSelectionPlugin, t as SubmitShortcutPlugin, u as $restoreTextSelection, v as $getTextOffsetInBlock, w as useTextSelectionSnapshot, x as buildRangeAnchor, y as $resolveSelectionPoint } from "./SubmitShortcutPlugin-
|
|
2
|
-
import { n as setResolvedEditNodes, r as allEditNodes } from "./node-registry-
|
|
3
|
-
import { B as NestedContentRendererProvider, H as useOptionalNestedContentRenderer, V as useNestedContentRenderer, t as editorTheme } from "./theme-
|
|
4
|
-
import { C as MENTION_NODE_KEY, D as VIDEO_NODE_KEY, E as TAG_NODE_KEY, S as LINK_CARD_NODE_KEY, T as RUBY_NODE_KEY, _ as CODE_BLOCK_NODE_KEY, a as FootnoteDefinitionsProvider, b as IMAGE_NODE_KEY, c as useFootnoteDisplayNumber, d as RendererConfigProvider, f as useRendererConfig, g as BANNER_NODE_KEY, h as ALERT_NODE_KEY, m as useVariant, o as useFootnoteContent, p as useRendererMode, s as useFootnoteDefinitions, v as FOOTNOTE_NODE_KEY, w as MERMAID_NODE_KEY, x as KATEX_NODE_KEY, y as FOOTNOTE_SECTION_NODE_KEY } from "./KaTeXRenderer-
|
|
1
|
+
import { A as blockIdState, C as createTextSelectionStore, D as ImageUploadPlugin, E as LinkFaviconPlugin, F as ImagePreprocessProvider, L as CorePlugins, N as ImageUploadProvider, O as defaultImageUpload, S as TextSelectionStoreProvider, T as useTextSelectionStore, _ as $getRootBlock, a as AutoFocusPlugin, b as buildBlockAnchor, c as $captureTextSelection, d as createDOMRangeFromTextSelection, f as findDOMPointByTextOffset, g as TEXT_SELECTION_HIGHLIGHT_NAME, h as getTextOffsetFromDOMPoint, i as EditorRefPlugin, j as VideoUploadProvider, k as BlockIdPlugin, l as $captureTextSelectionFromRangeSelection, m as getDOMRectFromTextSelection, n as OnChangePlugin, o as VideoUploadPlugin, p as getBlockElementById, r as FootnotePlugin, s as TextSelectionPlugin, t as SubmitShortcutPlugin, u as $restoreTextSelection, v as $getTextOffsetInBlock, w as useTextSelectionSnapshot, x as buildRangeAnchor, y as $resolveSelectionPoint } from "./SubmitShortcutPlugin-CSGVA99C.js";
|
|
2
|
+
import { n as setResolvedEditNodes, r as allEditNodes } from "./node-registry-DPciIuyu.js";
|
|
3
|
+
import { B as NestedContentRendererProvider, H as useOptionalNestedContentRenderer, V as useNestedContentRenderer, t as editorTheme } from "./theme-C7HnCTta.js";
|
|
4
|
+
import { C as MENTION_NODE_KEY, D as VIDEO_NODE_KEY, E as TAG_NODE_KEY, S as LINK_CARD_NODE_KEY, T as RUBY_NODE_KEY, _ as CODE_BLOCK_NODE_KEY, a as FootnoteDefinitionsProvider, b as IMAGE_NODE_KEY, c as useFootnoteDisplayNumber, d as RendererConfigProvider, f as useRendererConfig, g as BANNER_NODE_KEY, h as ALERT_NODE_KEY, m as useVariant, o as useFootnoteContent, p as useRendererMode, s as useFootnoteDefinitions, v as FOOTNOTE_NODE_KEY, w as MERMAID_NODE_KEY, x as KATEX_NODE_KEY, y as FOOTNOTE_SECTION_NODE_KEY } from "./KaTeXRenderer-DLtnsRSv.js";
|
|
5
5
|
import { a as noteVariant, c as richContent, i as getVariantClass, l as semanticClassNames, n as katexStyles, o as commentVariant, r as clsx, s as articleVariant, t as katexClassNames, u as sharedStyles } from "./katex.css-0TJGE4On.js";
|
|
6
|
-
import { D as ColorSchemeProvider, O as useColorScheme } from "./config-
|
|
6
|
+
import { D as ColorSchemeProvider, O as useColorScheme } from "./config-DMoe8QNB.js";
|
|
7
7
|
import { i as detailsStyles, n as gridStyles, r as detailsClassNames, t as gridClassNames } from "./grid.css-ClPR9Sd5.js";
|
|
8
|
-
import {
|
|
8
|
+
import { o as NestedEditorPluginsProvider, s as useNestedEditorPlugins } from "./AlertQuoteEditNode-DQuC-CkB.js";
|
|
9
9
|
import { t as normalizeSerializedEditorState } from "./normalizeSerializedEditorState-VaI73T09.js";
|
|
10
10
|
import { n as useExtraNodes, r as LinkFavicon, t as ExtraNodesProvider } from "./ExtraNodesContext-Cjb_L5rP.js";
|
|
11
|
-
import { a as KaTeXPlugin, c as AlertPlugin, n as MermaidPlugin, s as ImagePlugin } from "./MermaidPlugin-
|
|
11
|
+
import { a as KaTeXPlugin, c as AlertPlugin, n as MermaidPlugin, s as ImagePlugin } from "./MermaidPlugin-DinmlrKK.js";
|
|
12
12
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
13
13
|
import { ContentEditable } from "@lexical/react/LexicalContentEditable";
|
|
14
14
|
import { LexicalErrorBoundary } from "@lexical/react/LexicalErrorBoundary";
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { C as KaTeXBlockNode, E as ImageNode, L as _defineProperty, M as FootnoteNode, _ as MentionNode, b as KaTeXInlineNode, c as SpoilerNode, i as TagNode, m as MermaidNode
|
|
2
|
-
import { _ as CODE_BLOCK_NODE_KEY, g as BANNER_NODE_KEY, l as RendererWrapper, s as useFootnoteDefinitions } from "./KaTeXRenderer-
|
|
1
|
+
import { C as KaTeXBlockNode, E as ImageNode, L as _defineProperty, M as FootnoteNode, _ as MentionNode, b as KaTeXInlineNode, c as SpoilerNode, i as TagNode, m as MermaidNode } from "./theme-C7HnCTta.js";
|
|
2
|
+
import { _ as CODE_BLOCK_NODE_KEY, g as BANNER_NODE_KEY, l as RendererWrapper, s as useFootnoteDefinitions } from "./KaTeXRenderer-DLtnsRSv.js";
|
|
3
3
|
import { l as semanticClassNames, r as clsx, u as sharedStyles } from "./katex.css-0TJGE4On.js";
|
|
4
|
-
import { C as CommentNode, E as CodeBlockRenderer, M as BannerNode, N as normalizeBannerType, P as BannerRenderer, T as CodeBlockNode, _ as FootnoteSectionNode, a as VideoNode, c as RubyNode, d as LinkCardNode, k as $isBannerNode, m as GridContainerNode, n as builtinNodes, p as $isGridContainerNode, w as $isCodeBlockNode, y as DetailsNode } from "./config-
|
|
4
|
+
import { C as CommentNode, E as CodeBlockRenderer, M as BannerNode, N as normalizeBannerType, P as BannerRenderer, T as CodeBlockNode, _ as FootnoteSectionNode, a as VideoNode, c as RubyNode, d as LinkCardNode, k as $isBannerNode, m as GridContainerNode, n as builtinNodes, p as $isGridContainerNode, w as $isCodeBlockNode, y as DetailsNode } from "./config-DMoe8QNB.js";
|
|
5
5
|
import { n as gridStyles, t as gridClassNames } from "./grid.css-ClPR9Sd5.js";
|
|
6
|
-
import {
|
|
6
|
+
import { a as NestedEditorCorePlugins, i as createNestedEditor, n as AlertQuoteEditNode } from "./AlertQuoteEditNode-DQuC-CkB.js";
|
|
7
7
|
import { useLexicalComposerContext } from "@lexical/react/LexicalComposerContext";
|
|
8
8
|
import { createElement, useCallback, useEffect, useState } from "react";
|
|
9
|
-
import { $createNodeSelection, $createParagraphNode, $getNodeByKey, $getRoot, $getSelection, $insertNodes, $isDecoratorNode, $isElementNode, $isNodeSelection, $nodesOfType, $setSelection
|
|
9
|
+
import { $createNodeSelection, $createParagraphNode, $getNodeByKey, $getRoot, $getSelection, $insertNodes, $isDecoratorNode, $isElementNode, $isNodeSelection, $nodesOfType, $setSelection } from "lexical";
|
|
10
10
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
11
11
|
import { Flag, LayoutGrid, Minus, Plus } from "lucide-react";
|
|
12
12
|
import { ContentEditable } from "@lexical/react/LexicalContentEditable";
|
|
@@ -66,14 +66,7 @@ function BannerEditDecorator({ nodeKey, bannerType, contentEditor }) {
|
|
|
66
66
|
//#endregion
|
|
67
67
|
//#region src/nodes/BannerEditNode.ts
|
|
68
68
|
function createContentEditor() {
|
|
69
|
-
return
|
|
70
|
-
namespace: "BannerContent",
|
|
71
|
-
nodes: NESTED_EDITOR_NODES,
|
|
72
|
-
theme: editorTheme,
|
|
73
|
-
onError: (error) => {
|
|
74
|
-
console.error("[BannerContent]", error);
|
|
75
|
-
}
|
|
76
|
-
});
|
|
69
|
+
return createNestedEditor("BannerContent");
|
|
77
70
|
}
|
|
78
71
|
var BannerEditNode = class BannerEditNode extends BannerNode {
|
|
79
72
|
static clone(node) {
|
|
@@ -528,14 +521,7 @@ function GridEditDecorator({ nodeKey, autoFocusOnMount, cols: initialCols, gap,
|
|
|
528
521
|
//#endregion
|
|
529
522
|
//#region src/nodes/GridEditNode.ts
|
|
530
523
|
function createCellEditor() {
|
|
531
|
-
return
|
|
532
|
-
namespace: "GridCell",
|
|
533
|
-
nodes: NESTED_EDITOR_NODES,
|
|
534
|
-
theme: editorTheme,
|
|
535
|
-
onError: (error) => {
|
|
536
|
-
console.error("[GridCell]", error);
|
|
537
|
-
}
|
|
538
|
-
});
|
|
524
|
+
return createNestedEditor("GridCell");
|
|
539
525
|
}
|
|
540
526
|
var GridEditNode = class GridEditNode extends GridContainerNode {
|
|
541
527
|
static clone(node) {
|
|
@@ -680,6 +666,7 @@ _defineProperty(GridEditNode, "slashMenuItems", [{
|
|
|
680
666
|
"columns",
|
|
681
667
|
"layout"
|
|
682
668
|
],
|
|
669
|
+
nested: false,
|
|
683
670
|
section: "LAYOUT",
|
|
684
671
|
onSelect: (editor) => {
|
|
685
672
|
editor.update(() => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AlertQuoteEditNode.d.ts","sourceRoot":"","sources":["../../src/nodes/AlertQuoteEditNode.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,YAAY,EACZ,aAAa,EACb,qBAAqB,EACrB,qBAAqB,EACtB,MAAM,SAAS,CAAC;AAGjB,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"AlertQuoteEditNode.d.ts","sourceRoot":"","sources":["../../src/nodes/AlertQuoteEditNode.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,YAAY,EACZ,aAAa,EACb,qBAAqB,EACrB,qBAAqB,EACtB,MAAM,SAAS,CAAC;AAGjB,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAI1C,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAC7D,OAAO,EAAE,cAAc,EAAE,KAAK,SAAS,EAAE,KAAK,wBAAwB,EAAE,MAAM,kBAAkB,CAAC;AAOjG,qBAAa,kBAAmB,SAAQ,cAAc;IACpD,eAAe,EAAE,aAAa,CAAC;IAE/B,MAAM,CAAC,YAAY,EAAE,iBAAiB,EAAE,CA2CtC;IAEF,MAAM,CAAC,KAAK,CAAC,IAAI,EAAE,kBAAkB,GAAG,kBAAkB;gBAM9C,SAAS,EAAE,SAAS,EAAE,YAAY,CAAC,EAAE,qBAAqB,EAAE,GAAG,CAAC,EAAE,MAAM;IASpF,gBAAgB,IAAI,aAAa;IAIjC,MAAM,CAAC,UAAU,CACf,eAAe,EAAE,qBAAqB,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC/D,kBAAkB;IAMrB,UAAU,IAAI,wBAAwB;IAUtC,QAAQ,CAAC,OAAO,EAAE,aAAa,EAAE,OAAO,EAAE,YAAY,GAAG,YAAY;CAOtE;AAED,wBAAgB,yBAAyB,CACvC,SAAS,EAAE,SAAS,EACpB,YAAY,CAAC,EAAE,qBAAqB,GACnC,kBAAkB,CAEpB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BannerEditNode.d.ts","sourceRoot":"","sources":["../../src/nodes/BannerEditNode.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,YAAY,EACZ,aAAa,EACb,qBAAqB,EACrB,qBAAqB,EACtB,MAAM,SAAS,CAAC;AAGjB,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"BannerEditNode.d.ts","sourceRoot":"","sources":["../../src/nodes/BannerEditNode.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,YAAY,EACZ,aAAa,EACb,qBAAqB,EACrB,qBAAqB,EACtB,MAAM,SAAS,CAAC;AAGjB,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAI1C,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAC7D,OAAO,EACL,UAAU,EACV,KAAK,UAAU,EAEf,KAAK,oBAAoB,EAC1B,MAAM,cAAc,CAAC;AAWtB,qBAAa,cAAe,SAAQ,UAAU;IAC5C,eAAe,EAAE,aAAa,CAAC;IAE/B,MAAM,CAAC,YAAY,EAAE,iBAAiB,EAAE,CAetC;IAEF,MAAM,CAAC,KAAK,CAAC,IAAI,EAAE,cAAc,GAAG,cAAc;gBAMtC,UAAU,EAAE,UAAU,EAAE,YAAY,CAAC,EAAE,qBAAqB,EAAE,GAAG,CAAC,EAAE,MAAM;IAStF,gBAAgB,IAAI,aAAa;IAIjC,MAAM,CAAC,UAAU,CACf,eAAe,EAAE,qBAAqB,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC/D,cAAc;IA0BjB,UAAU,IAAI,oBAAoB;IAUlC,QAAQ,CAAC,OAAO,EAAE,aAAa,EAAE,OAAO,EAAE,YAAY,GAAG,YAAY;CAOtE;AAED,wBAAgB,qBAAqB,CACnC,UAAU,EAAE,UAAU,EACtB,YAAY,CAAC,EAAE,qBAAqB,GACnC,cAAc,CAEhB"}
|
|
@@ -10,6 +10,7 @@ export declare class CodeBlockEditNode extends CodeBlockNode {
|
|
|
10
10
|
isActive?: (editor: LexicalEditor) => boolean;
|
|
11
11
|
isDisabled?: (editor: LexicalEditor) => boolean;
|
|
12
12
|
keywords?: string[];
|
|
13
|
+
nested?: boolean;
|
|
13
14
|
placement?: import('../commands-entry').CommandPlacement[];
|
|
14
15
|
section?: string;
|
|
15
16
|
shortcut?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CodeBlockEditNode.d.ts","sourceRoot":"","sources":["../../src/nodes/CodeBlockEditNode.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,aAAa,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAC;AAElF,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAI1C,OAAO,EAAE,aAAa,EAAgC,MAAM,iBAAiB,CAAC;AAE9E,qBAAa,iBAAkB,SAAQ,aAAa;IAClD,MAAM,CAAC,YAAY;2BAEE,aAAa
|
|
1
|
+
{"version":3,"file":"CodeBlockEditNode.d.ts","sourceRoot":"","sources":["../../src/nodes/CodeBlockEditNode.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,aAAa,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAC;AAElF,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAI1C,OAAO,EAAE,aAAa,EAAgC,MAAM,iBAAiB,CAAC;AAE9E,qBAAa,iBAAkB,SAAQ,aAAa;IAClD,MAAM,CAAC,YAAY;2BAEE,aAAa;;;;;;;;;;;;QAK9B;IAEJ,MAAM,CAAC,KAAK,CAAC,IAAI,EAAE,iBAAiB,GAAG,iBAAiB;IAIxD,MAAM,CAAC,UAAU,CACf,eAAe,EAAE,qBAAqB,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC/D,iBAAiB;IAKpB,QAAQ,CAAC,OAAO,EAAE,aAAa,EAAE,OAAO,EAAE,YAAY,GAAG,YAAY;CAOtE;AAED,wBAAgB,wBAAwB,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,iBAAiB,CAE1F"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GridEditNode.d.ts","sourceRoot":"","sources":["../../src/nodes/GridEditNode.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,YAAY,EACZ,aAAa,EACb,WAAW,EACX,qBAAqB,EACrB,qBAAqB,EACtB,MAAM,SAAS,CAAC;AAGjB,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"GridEditNode.d.ts","sourceRoot":"","sources":["../../src/nodes/GridEditNode.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,YAAY,EACZ,aAAa,EACb,WAAW,EACX,qBAAqB,EACrB,qBAAqB,EACtB,MAAM,SAAS,CAAC;AAGjB,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAI1C,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAC/D,OAAO,EAAE,iBAAiB,EAAE,KAAK,2BAA2B,EAAE,MAAM,qBAAqB,CAAC;AAY1F,UAAU,mBAAmB;IAC3B,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC5B;AAMD,qBAAa,YAAa,SAAQ,iBAAiB;IACjD,aAAa,EAAE,aAAa,EAAE,CAAC;IAC/B,kBAAkB,EAAE,OAAO,CAAC;IAE5B,MAAM,CAAC,cAAc,EAAE,mBAAmB,EAAE,CAc1C;IAEF,MAAM,CAAC,KAAK,CAAC,IAAI,EAAE,YAAY,GAAG,YAAY;gBAS5C,IAAI,SAAI,EACR,GAAG,CAAC,EAAE,MAAM,EACZ,UAAU,CAAC,EAAE,qBAAqB,EAAE,EACpC,GAAG,CAAC,EAAE,MAAM,EACZ,OAAO,CAAC,EAAE,mBAAmB;IAY/B,cAAc,IAAI,aAAa,EAAE;IAIjC,yBAAyB,IAAI,OAAO;IAIpC,yBAAyB,CAAC,gBAAgB,EAAE,OAAO,GAAG,IAAI;IAK1D,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI;IAkC3B,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IA8B7B,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAiBhC,MAAM,CAAC,UAAU,CACf,eAAe,EAAE,qBAAqB,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC/D,YAAY;IA8Bf,UAAU,IAAI,2BAA2B;IAWzC,QAAQ,CAAC,OAAO,EAAE,aAAa,EAAE,OAAO,EAAE,YAAY,GAAG,YAAY;CAStE;AAED,wBAAgB,mBAAmB,CACjC,IAAI,SAAI,EACR,GAAG,CAAC,EAAE,MAAM,EACZ,OAAO,CAAC,EAAE,mBAAmB,GAC5B,YAAY,CAEd;AAED,wBAAgB,eAAe,CAAC,IAAI,EAAE,WAAW,GAAG,IAAI,GAAG,SAAS,GAAG,IAAI,IAAI,YAAY,CAE1F"}
|
package/dist/nodes/shared.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
import { Klass, LexicalNode, LexicalNodeReplacement } from 'lexical';
|
|
1
|
+
import { Klass, LexicalEditor, LexicalNode, LexicalNodeReplacement } from 'lexical';
|
|
2
2
|
export declare const NESTED_EDITOR_NODES: Array<Klass<LexicalNode> | LexicalNodeReplacement>;
|
|
3
|
+
export declare function createNestedEditor(fallbackNamespace: string): LexicalEditor;
|
|
3
4
|
//# sourceMappingURL=shared.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shared.d.ts","sourceRoot":"","sources":["../../src/nodes/shared.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,KAAK,EAAE,WAAW,EAAE,sBAAsB,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"shared.d.ts","sourceRoot":"","sources":["../../src/nodes/shared.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,KAAK,EAAE,aAAa,EAAE,WAAW,EAAE,sBAAsB,EAAE,MAAM,SAAS,CAAC;AAWzF,eAAO,MAAM,mBAAmB,EAAE,KAAK,CAAC,KAAK,CAAC,WAAW,CAAC,GAAG,sBAAsB,CAmBlF,CAAC;AAUF,wBAAgB,kBAAkB,CAAC,iBAAiB,EAAE,MAAM,GAAG,aAAa,CAS3E"}
|
package/dist/nodes-entry.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { a as FootnoteSectionEditNode, i as customEditNodes, n as setResolvedEditNodes, r as allEditNodes, t as getResolvedEditNodes } from "./node-registry-
|
|
2
|
-
import { C as KaTeXBlockNode, D as sanitizeImageDisplayWidth, E as ImageNode, F as ALERT_TYPES, O as sanitizeImageLayout, P as ALERT_LABELS, S as $isKaTeXBlockNode, T as $isImageNode, _ as MentionNode, b as KaTeXInlineNode, d as RichQuoteNode, f as $createMermaidNode, g as $isMentionNode, h as $createMentionNode, i as TagNode, l as $createRichQuoteNode, m as MermaidNode, n as $createTagNode, p as $isMermaidNode, r as $isTagNode, u as $isRichQuoteNode, w as $createImageNode, y as $isKaTeXInlineNode } from "./theme-
|
|
3
|
-
import { A as BANNER_LABELS, C as CommentNode, S as $isCommentNode, _ as FootnoteSectionNode, b as $createCommentNode, c as RubyNode, d as LinkCardNode, f as $createGridContainerNode, g as $isFootnoteSectionNode, h as $createFootnoteSectionNode, j as BANNER_TYPES, l as $createLinkCardNode, m as GridContainerNode, n as builtinNodes, o as $createRubyNode, p as $isGridContainerNode, r as customNodes, s as $isRubyNode, t as allNodes, u as $isLinkCardNode } from "./config-
|
|
4
|
-
import { r as NESTED_EDITOR_NODES } from "./AlertQuoteEditNode-
|
|
1
|
+
import { a as FootnoteSectionEditNode, i as customEditNodes, n as setResolvedEditNodes, r as allEditNodes, t as getResolvedEditNodes } from "./node-registry-DPciIuyu.js";
|
|
2
|
+
import { C as KaTeXBlockNode, D as sanitizeImageDisplayWidth, E as ImageNode, F as ALERT_TYPES, O as sanitizeImageLayout, P as ALERT_LABELS, S as $isKaTeXBlockNode, T as $isImageNode, _ as MentionNode, b as KaTeXInlineNode, d as RichQuoteNode, f as $createMermaidNode, g as $isMentionNode, h as $createMentionNode, i as TagNode, l as $createRichQuoteNode, m as MermaidNode, n as $createTagNode, p as $isMermaidNode, r as $isTagNode, u as $isRichQuoteNode, w as $createImageNode, y as $isKaTeXInlineNode } from "./theme-C7HnCTta.js";
|
|
3
|
+
import { A as BANNER_LABELS, C as CommentNode, S as $isCommentNode, _ as FootnoteSectionNode, b as $createCommentNode, c as RubyNode, d as LinkCardNode, f as $createGridContainerNode, g as $isFootnoteSectionNode, h as $createFootnoteSectionNode, j as BANNER_TYPES, l as $createLinkCardNode, m as GridContainerNode, n as builtinNodes, o as $createRubyNode, p as $isGridContainerNode, r as customNodes, s as $isRubyNode, t as allNodes, u as $isLinkCardNode } from "./config-DMoe8QNB.js";
|
|
4
|
+
import { r as NESTED_EDITOR_NODES } from "./AlertQuoteEditNode-DQuC-CkB.js";
|
|
5
5
|
export { $createCommentNode, $createFootnoteSectionNode, $createGridContainerNode, $createImageNode, $createLinkCardNode, $createMentionNode, $createMermaidNode, $createRichQuoteNode, $createRubyNode, $createTagNode, $isCommentNode, $isFootnoteSectionNode, $isGridContainerNode, $isImageNode, $isKaTeXBlockNode, $isKaTeXInlineNode, $isLinkCardNode, $isMentionNode, $isMermaidNode, $isRichQuoteNode, $isRubyNode, $isTagNode, ALERT_LABELS, ALERT_TYPES, BANNER_LABELS, BANNER_TYPES, CommentNode, FootnoteSectionEditNode, FootnoteSectionNode, GridContainerNode, ImageNode, KaTeXBlockNode, KaTeXInlineNode, LinkCardNode, MentionNode, MermaidNode, NESTED_EDITOR_NODES, RichQuoteNode, RubyNode, TagNode, allEditNodes, allNodes, builtinNodes, customEditNodes, customNodes, getResolvedEditNodes, sanitizeImageDisplayWidth, sanitizeImageLayout, setResolvedEditNodes };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ImageUploadPlugin.d.ts","sourceRoot":"","sources":["../../src/plugins/ImageUploadPlugin.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ImageUploadPlugin.d.ts","sourceRoot":"","sources":["../../src/plugins/ImageUploadPlugin.tsx"],"names":[],"mappings":"AA4BA,MAAM,WAAW,iBAAiB;IAChC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,GAAG,EAAE,MAAM,CAAC;IACZ,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,MAAM,aAAa,GAAG,CAAC,IAAI,EAAE,IAAI,KAAK,OAAO,CAAC,iBAAiB,CAAC,CAAC;AA0CvE,wBAAsB,kBAAkB,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAK/E;AAED,UAAU,sBAAsB;IAC9B,QAAQ,EAAE,aAAa,CAAC;CACzB;AAED,wBAAgB,iBAAiB,CAAC,EAAE,QAAQ,EAAE,EAAE,sBAAsB,+BAucrE"}
|
package/dist/plugins-entry.mjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { A as blockIdState, B as ALL_TRANSFORMERS, D as ImageUploadPlugin, E as LinkFaviconPlugin, F as ImagePreprocessProvider, G as AutoLinkPlugin, H as ClickBelowPlugin, I as useImagePreprocess, L as CorePlugins, M as useVideoUpload, N as ImageUploadProvider, O as defaultImageUpload, P as useImageUpload, R as MarkdownShortcutsPlugin, U as registerClickBelowCommand, V as HorizontalRulePlugin, W as BlockExitPlugin, a as AutoFocusPlugin, i as EditorRefPlugin, j as VideoUploadProvider, k as BlockIdPlugin, n as OnChangePlugin, o as VideoUploadPlugin, r as FootnotePlugin, s as TextSelectionPlugin, t as SubmitShortcutPlugin, z as MarkdownPastePlugin } from "./SubmitShortcutPlugin-
|
|
2
|
-
import { a as KaTeXPlugin, c as AlertPlugin, n as MermaidPlugin, s as ImagePlugin } from "./MermaidPlugin-
|
|
1
|
+
import { A as blockIdState, B as ALL_TRANSFORMERS, D as ImageUploadPlugin, E as LinkFaviconPlugin, F as ImagePreprocessProvider, G as AutoLinkPlugin, H as ClickBelowPlugin, I as useImagePreprocess, L as CorePlugins, M as useVideoUpload, N as ImageUploadProvider, O as defaultImageUpload, P as useImageUpload, R as MarkdownShortcutsPlugin, U as registerClickBelowCommand, V as HorizontalRulePlugin, W as BlockExitPlugin, a as AutoFocusPlugin, i as EditorRefPlugin, j as VideoUploadProvider, k as BlockIdPlugin, n as OnChangePlugin, o as VideoUploadPlugin, r as FootnotePlugin, s as TextSelectionPlugin, t as SubmitShortcutPlugin, z as MarkdownPastePlugin } from "./SubmitShortcutPlugin-CSGVA99C.js";
|
|
2
|
+
import { a as KaTeXPlugin, c as AlertPlugin, n as MermaidPlugin, s as ImagePlugin } from "./MermaidPlugin-DinmlrKK.js";
|
|
3
3
|
export { ALL_TRANSFORMERS, AlertPlugin, AutoFocusPlugin, AutoLinkPlugin, BlockExitPlugin, BlockIdPlugin, ClickBelowPlugin, CorePlugins, EditorRefPlugin, FootnotePlugin, HorizontalRulePlugin, ImagePlugin, ImagePreprocessProvider, ImageUploadPlugin, ImageUploadProvider, KaTeXPlugin, LinkFaviconPlugin, MarkdownPastePlugin, MarkdownShortcutsPlugin, MermaidPlugin, OnChangePlugin, SubmitShortcutPlugin, TextSelectionPlugin, VideoUploadPlugin, VideoUploadProvider, blockIdState, defaultImageUpload, registerClickBelowCommand, useImagePreprocess, useImageUpload, useVideoUpload };
|
package/dist/renderers-entry.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { C as MENTION_NODE_KEY, D as VIDEO_NODE_KEY, E as TAG_NODE_KEY, S as LINK_CARD_NODE_KEY, T as RUBY_NODE_KEY, _ as CODE_BLOCK_NODE_KEY, b as IMAGE_NODE_KEY, c as useFootnoteDisplayNumber, g as BANNER_NODE_KEY, h as ALERT_NODE_KEY, i as FootnoteStaticRenderer, l as RendererWrapper, n as computeImageMeta, o as useFootnoteContent, r as decodeThumbHash, t as KaTeXRenderer, u as createRendererDecoration, v as FOOTNOTE_NODE_KEY, w as MERMAID_NODE_KEY, x as KATEX_NODE_KEY, y as FOOTNOTE_SECTION_NODE_KEY } from "./KaTeXRenderer-
|
|
1
|
+
import { C as MENTION_NODE_KEY, D as VIDEO_NODE_KEY, E as TAG_NODE_KEY, S as LINK_CARD_NODE_KEY, T as RUBY_NODE_KEY, _ as CODE_BLOCK_NODE_KEY, b as IMAGE_NODE_KEY, c as useFootnoteDisplayNumber, g as BANNER_NODE_KEY, h as ALERT_NODE_KEY, i as FootnoteStaticRenderer, l as RendererWrapper, n as computeImageMeta, o as useFootnoteContent, r as decodeThumbHash, t as KaTeXRenderer, u as createRendererDecoration, v as FOOTNOTE_NODE_KEY, w as MERMAID_NODE_KEY, x as KATEX_NODE_KEY, y as FOOTNOTE_SECTION_NODE_KEY } from "./KaTeXRenderer-DLtnsRSv.js";
|
|
2
2
|
import { l as semanticClassNames, r as clsx, u as sharedStyles } from "./katex.css-0TJGE4On.js";
|
|
3
3
|
import { t as LinkCardRenderer } from "./LinkCardRenderer-DPV1JP0X.js";
|
|
4
4
|
import { t as RubyRenderer } from "./RubyRenderer-B76PPUga.js";
|
package/dist/static-entry.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { B as NestedContentRendererProvider, H as useOptionalNestedContentRenderer, R as extractTextContent, V as useNestedContentRenderer, a as getTagBgColor, t as editorTheme } from "./theme-
|
|
2
|
-
import { C as MENTION_NODE_KEY, D as VIDEO_NODE_KEY, E as TAG_NODE_KEY, S as LINK_CARD_NODE_KEY, T as RUBY_NODE_KEY, _ as CODE_BLOCK_NODE_KEY, a as FootnoteDefinitionsProvider, b as IMAGE_NODE_KEY, c as useFootnoteDisplayNumber, d as RendererConfigProvider, f as useRendererConfig, g as BANNER_NODE_KEY, h as ALERT_NODE_KEY, l as RendererWrapper, m as useVariant, o as useFootnoteContent, p as useRendererMode, s as useFootnoteDefinitions, u as createRendererDecoration, v as FOOTNOTE_NODE_KEY, w as MERMAID_NODE_KEY, x as KATEX_NODE_KEY, y as FOOTNOTE_SECTION_NODE_KEY } from "./KaTeXRenderer-
|
|
1
|
+
import { B as NestedContentRendererProvider, H as useOptionalNestedContentRenderer, R as extractTextContent, V as useNestedContentRenderer, a as getTagBgColor, t as editorTheme } from "./theme-C7HnCTta.js";
|
|
2
|
+
import { C as MENTION_NODE_KEY, D as VIDEO_NODE_KEY, E as TAG_NODE_KEY, S as LINK_CARD_NODE_KEY, T as RUBY_NODE_KEY, _ as CODE_BLOCK_NODE_KEY, a as FootnoteDefinitionsProvider, b as IMAGE_NODE_KEY, c as useFootnoteDisplayNumber, d as RendererConfigProvider, f as useRendererConfig, g as BANNER_NODE_KEY, h as ALERT_NODE_KEY, l as RendererWrapper, m as useVariant, o as useFootnoteContent, p as useRendererMode, s as useFootnoteDefinitions, u as createRendererDecoration, v as FOOTNOTE_NODE_KEY, w as MERMAID_NODE_KEY, x as KATEX_NODE_KEY, y as FOOTNOTE_SECTION_NODE_KEY } from "./KaTeXRenderer-DLtnsRSv.js";
|
|
3
3
|
import { a as noteVariant, c as richContent, i as getVariantClass, l as semanticClassNames, n as katexStyles, o as commentVariant, r as clsx, s as articleVariant, t as katexClassNames, u as sharedStyles } from "./katex.css-0TJGE4On.js";
|
|
4
|
-
import { D as ColorSchemeProvider, O as useColorScheme, n as builtinNodes, r as customNodes, t as allNodes } from "./config-
|
|
4
|
+
import { D as ColorSchemeProvider, O as useColorScheme, n as builtinNodes, r as customNodes, t as allNodes } from "./config-DMoe8QNB.js";
|
|
5
5
|
import { i as detailsStyles, n as gridStyles, r as detailsClassNames, t as gridClassNames } from "./grid.css-ClPR9Sd5.js";
|
|
6
6
|
import { t as normalizeSerializedEditorState } from "./normalizeSerializedEditorState-VaI73T09.js";
|
|
7
7
|
import { n as useExtraNodes, r as LinkFavicon, t as ExtraNodesProvider } from "./ExtraNodesContext-Cjb_L5rP.js";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { C as MENTION_NODE_KEY, b as IMAGE_NODE_KEY, h as ALERT_NODE_KEY, i as FootnoteStaticRenderer, l as RendererWrapper, r as decodeThumbHash, t as KaTeXRenderer, u as createRendererDecoration, v as FOOTNOTE_NODE_KEY, w as MERMAID_NODE_KEY, x as KATEX_NODE_KEY } from "./KaTeXRenderer-
|
|
1
|
+
import { C as MENTION_NODE_KEY, b as IMAGE_NODE_KEY, h as ALERT_NODE_KEY, i as FootnoteStaticRenderer, l as RendererWrapper, r as decodeThumbHash, t as KaTeXRenderer, u as createRendererDecoration, v as FOOTNOTE_NODE_KEY, w as MERMAID_NODE_KEY, x as KATEX_NODE_KEY } from "./KaTeXRenderer-DLtnsRSv.js";
|
|
2
2
|
import { l as semanticClassNames, u as sharedStyles } from "./katex.css-0TJGE4On.js";
|
|
3
3
|
import { createContext, createElement, use, useCallback, useEffect, useMemo, useState } from "react";
|
|
4
4
|
import { QuoteNode } from "@lexical/rich-text";
|
|
@@ -69,7 +69,7 @@ function extractTextContent(state) {
|
|
|
69
69
|
return walk(state);
|
|
70
70
|
}
|
|
71
71
|
//#endregion
|
|
72
|
-
//#region \0@oxc-project+runtime@0.
|
|
72
|
+
//#region \0@oxc-project+runtime@0.142.0/helpers/esm/typeof.js
|
|
73
73
|
function _typeof(o) {
|
|
74
74
|
"@babel/helpers - typeof";
|
|
75
75
|
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
|
|
@@ -79,7 +79,7 @@ function _typeof(o) {
|
|
|
79
79
|
}, _typeof(o);
|
|
80
80
|
}
|
|
81
81
|
//#endregion
|
|
82
|
-
//#region \0@oxc-project+runtime@0.
|
|
82
|
+
//#region \0@oxc-project+runtime@0.142.0/helpers/esm/toPrimitive.js
|
|
83
83
|
function toPrimitive(t, r) {
|
|
84
84
|
if ("object" != _typeof(t) || !t) return t;
|
|
85
85
|
var e = t[Symbol.toPrimitive];
|
|
@@ -91,13 +91,13 @@ function toPrimitive(t, r) {
|
|
|
91
91
|
return ("string" === r ? String : Number)(t);
|
|
92
92
|
}
|
|
93
93
|
//#endregion
|
|
94
|
-
//#region \0@oxc-project+runtime@0.
|
|
94
|
+
//#region \0@oxc-project+runtime@0.142.0/helpers/esm/toPropertyKey.js
|
|
95
95
|
function toPropertyKey(t) {
|
|
96
96
|
var i = toPrimitive(t, "string");
|
|
97
97
|
return "symbol" == _typeof(i) ? i : i + "";
|
|
98
98
|
}
|
|
99
99
|
//#endregion
|
|
100
|
-
//#region \0@oxc-project+runtime@0.
|
|
100
|
+
//#region \0@oxc-project+runtime@0.142.0/helpers/esm/defineProperty.js
|
|
101
101
|
function _defineProperty(e, r, t) {
|
|
102
102
|
return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
|
|
103
103
|
value: t,
|
|
@@ -293,10 +293,11 @@ function ImageRenderer({ src, altText, width, height, caption, thumbhash, accent
|
|
|
293
293
|
maxWidth: "100%",
|
|
294
294
|
width: displayWidth !== void 0 ? "100%" : width && height ? width : void 0
|
|
295
295
|
};
|
|
296
|
+
const figureStyle = displayWidth ? { "--rich-image-display-width": `${displayWidth}%` } : void 0;
|
|
296
297
|
return /* @__PURE__ */ jsxs("figure", {
|
|
297
298
|
className: "rich-image",
|
|
298
299
|
"data-layout": layout,
|
|
299
|
-
style:
|
|
300
|
+
style: figureStyle,
|
|
300
301
|
children: [
|
|
301
302
|
/* @__PURE__ */ jsx("div", {
|
|
302
303
|
"aria-label": loaded ? `Zoom image: ${altText}` : void 0,
|
|
@@ -358,8 +359,11 @@ function $isSelectionInTableCell() {
|
|
|
358
359
|
const anchorNode = $getSelectionAnchorNode();
|
|
359
360
|
return anchorNode ? $getTableCellNodeFromLexicalNode(anchorNode) !== null : false;
|
|
360
361
|
}
|
|
362
|
+
function $isInNestedEditor() {
|
|
363
|
+
return $getEditor()._parentEditor !== null;
|
|
364
|
+
}
|
|
361
365
|
function $withAdaptiveImageDisplayWidth(payload) {
|
|
362
|
-
if (payload.displayWidth !== void 0 || !$isSelectionInTableCell()) return payload;
|
|
366
|
+
if (payload.displayWidth !== void 0 || !$isSelectionInTableCell() && !$isInNestedEditor()) return payload;
|
|
363
367
|
return {
|
|
364
368
|
...payload,
|
|
365
369
|
displayWidth: 100
|
|
@@ -9,6 +9,7 @@ export interface CommandItemConfig {
|
|
|
9
9
|
isActive?: (editor: LexicalEditor) => boolean;
|
|
10
10
|
isDisabled?: (editor: LexicalEditor) => boolean;
|
|
11
11
|
keywords?: string[];
|
|
12
|
+
nested?: boolean;
|
|
12
13
|
onSelect: (editor: LexicalEditor, queryString: string) => void;
|
|
13
14
|
placement?: CommandPlacement[];
|
|
14
15
|
section?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"slash-menu.d.ts","sourceRoot":"","sources":["../../src/types/slash-menu.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAC7C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC,MAAM,MAAM,gBAAgB,GAAG,OAAO,GAAG,SAAS,GAAG,aAAa,CAAC;AAEnE,MAAM,MAAM,YAAY,GAAG,SAAS,GAAG,SAAS,GAAG,QAAQ,GAAG,OAAO,GAAG,MAAM,GAAG,OAAO,GAAG,QAAQ,CAAC;AAEpG,MAAM,WAAW,iBAAiB;IAChC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,KAAK,CAAC,EAAE,YAAY,CAAC;IACrB,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,QAAQ,CAAC,EAAE,CAAC,MAAM,EAAE,aAAa,KAAK,OAAO,CAAC;IAC9C,UAAU,CAAC,EAAE,CAAC,MAAM,EAAE,aAAa,KAAK,OAAO,CAAC;IAChD,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"slash-menu.d.ts","sourceRoot":"","sources":["../../src/types/slash-menu.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAC7C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC,MAAM,MAAM,gBAAgB,GAAG,OAAO,GAAG,SAAS,GAAG,aAAa,CAAC;AAEnE,MAAM,MAAM,YAAY,GAAG,SAAS,GAAG,SAAS,GAAG,QAAQ,GAAG,OAAO,GAAG,MAAM,GAAG,OAAO,GAAG,QAAQ,CAAC;AAEpG,MAAM,WAAW,iBAAiB;IAChC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,KAAK,CAAC,EAAE,YAAY,CAAC;IACrB,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,QAAQ,CAAC,EAAE,CAAC,MAAM,EAAE,aAAa,KAAK,OAAO,CAAC;IAC9C,UAAU,CAAC,EAAE,CAAC,MAAM,EAAE,aAAa,KAAK,OAAO,CAAC;IAChD,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACpB,MAAM,CAAC,EAAE,OAAO,CAAC;IAEjB,QAAQ,EAAE,CAAC,MAAM,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,KAAK,IAAI,CAAC;IAC/D,SAAS,CAAC,EAAE,gBAAgB,EAAE,CAAC;IAC/B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC;CACf;AAED,wCAAwC;AACxC,MAAM,MAAM,mBAAmB,GAAG,iBAAiB,CAAC"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { ImageNodePayload } from '../nodes/ImageNode';
|
|
2
2
|
export declare function $isSelectionInTableCell(): boolean;
|
|
3
|
+
export declare function $isInNestedEditor(): boolean;
|
|
3
4
|
export declare function $withAdaptiveImageDisplayWidth(payload: ImageNodePayload): ImageNodePayload;
|
|
4
5
|
//# sourceMappingURL=image-insertion.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"image-insertion.d.ts","sourceRoot":"","sources":["../../src/utils/image-insertion.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"image-insertion.d.ts","sourceRoot":"","sources":["../../src/utils/image-insertion.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAgB3D,wBAAgB,uBAAuB,IAAI,OAAO,CAGjD;AAED,wBAAgB,iBAAiB,IAAI,OAAO,CAE3C;AAED,wBAAgB,8BAA8B,CAAC,OAAO,EAAE,gBAAgB,GAAG,gBAAgB,CAS1F"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@haklex/rich-editor",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.34.0",
|
|
4
4
|
"description": "Core rich text editor based on Lexical",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -45,46 +45,46 @@
|
|
|
45
45
|
"dist"
|
|
46
46
|
],
|
|
47
47
|
"dependencies": {
|
|
48
|
-
"@lexical/code-core": "^0.
|
|
48
|
+
"@lexical/code-core": "^0.49.0",
|
|
49
49
|
"nanoid": "^6.0.0",
|
|
50
50
|
"thumbhash": "^0.1.1",
|
|
51
|
-
"@haklex/rich-editor-ui": "0.
|
|
52
|
-
"@haklex/rich-headless": "0.
|
|
53
|
-
"@haklex/rich-style-token": "0.
|
|
51
|
+
"@haklex/rich-editor-ui": "0.34.0",
|
|
52
|
+
"@haklex/rich-headless": "0.34.0",
|
|
53
|
+
"@haklex/rich-style-token": "0.34.0"
|
|
54
54
|
},
|
|
55
55
|
"devDependencies": {
|
|
56
|
-
"@lexical/extension": "^0.
|
|
57
|
-
"@lexical/link": "^0.
|
|
58
|
-
"@lexical/list": "^0.
|
|
59
|
-
"@lexical/markdown": "^0.
|
|
60
|
-
"@lexical/react": "^0.
|
|
61
|
-
"@lexical/rich-text": "^0.
|
|
62
|
-
"@lexical/table": "^0.
|
|
63
|
-
"@types/react": "^19.2.
|
|
64
|
-
"@types/react-dom": "^19.2.
|
|
65
|
-
"@vanilla-extract/css": "^1.21.
|
|
66
|
-
"@vanilla-extract/vite-plugin": "^5.2.
|
|
56
|
+
"@lexical/extension": "^0.49.0",
|
|
57
|
+
"@lexical/link": "^0.49.0",
|
|
58
|
+
"@lexical/list": "^0.49.0",
|
|
59
|
+
"@lexical/markdown": "^0.49.0",
|
|
60
|
+
"@lexical/react": "^0.49.0",
|
|
61
|
+
"@lexical/rich-text": "^0.49.0",
|
|
62
|
+
"@lexical/table": "^0.49.0",
|
|
63
|
+
"@types/react": "^19.2.18",
|
|
64
|
+
"@types/react-dom": "^19.2.4",
|
|
65
|
+
"@vanilla-extract/css": "^1.21.2",
|
|
66
|
+
"@vanilla-extract/vite-plugin": "^5.2.6",
|
|
67
67
|
"katex": "^0.18.1",
|
|
68
|
-
"lexical": "^0.
|
|
69
|
-
"lucide-react": "^1.
|
|
68
|
+
"lexical": "^0.49.0",
|
|
69
|
+
"lucide-react": "^1.28.0",
|
|
70
70
|
"react": "^19.2.8",
|
|
71
71
|
"react-dom": "^19.2.8",
|
|
72
|
-
"shiki": "^4.
|
|
72
|
+
"shiki": "^4.4.1",
|
|
73
73
|
"typescript": "^7.0.2",
|
|
74
74
|
"unplugin-dts": "^1.0.3",
|
|
75
|
-
"vite": "^8.
|
|
75
|
+
"vite": "^8.2.0"
|
|
76
76
|
},
|
|
77
77
|
"peerDependencies": {
|
|
78
78
|
"@base-ui/react": ">=1.5.0",
|
|
79
|
-
"@lexical/extension": "^0.
|
|
80
|
-
"@lexical/link": "^0.
|
|
81
|
-
"@lexical/list": "^0.
|
|
82
|
-
"@lexical/markdown": "^0.
|
|
83
|
-
"@lexical/react": "^0.
|
|
84
|
-
"@lexical/rich-text": "^0.
|
|
85
|
-
"@lexical/table": "^0.
|
|
79
|
+
"@lexical/extension": "^0.49.0",
|
|
80
|
+
"@lexical/link": "^0.49.0",
|
|
81
|
+
"@lexical/list": "^0.49.0",
|
|
82
|
+
"@lexical/markdown": "^0.49.0",
|
|
83
|
+
"@lexical/react": "^0.49.0",
|
|
84
|
+
"@lexical/rich-text": "^0.49.0",
|
|
85
|
+
"@lexical/table": "^0.49.0",
|
|
86
86
|
"katex": ">=0.16.0",
|
|
87
|
-
"lexical": "^0.
|
|
87
|
+
"lexical": "^0.49.0",
|
|
88
88
|
"lucide-react": "^1.0.0",
|
|
89
89
|
"react": ">=19",
|
|
90
90
|
"react-dom": ">=19",
|