tiptap-markdown-react 1.1.0 → 1.2.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/README.md +8 -5
- package/dist/ReportContentWithCharts-DHdD1BaH.js +1322 -0
- package/dist/ReportContentWithCharts-DHdD1BaH.js.map +1 -0
- package/dist/components/ContentOutline.d.ts +10 -0
- package/dist/components/ContentOutline.dom.test.d.ts +1 -0
- package/dist/components/MarkdownPreview.d.ts +7 -2
- package/dist/components/MarkdownPreview.toc.dom.test.d.ts +1 -0
- package/dist/components/MarkdownWysiwygEditor.d.ts +1 -1
- package/dist/components/ReaderReportContent.d.ts +16 -0
- package/dist/components/ReportContentInteractive.d.ts +6 -1
- package/dist/components/ReportContentWithCharts.d.ts +6 -1
- package/dist/index.js +216 -897
- package/dist/index.js.map +1 -1
- package/dist/reader.d.ts +1 -1
- package/dist/reader.js +5 -5
- package/dist/style-inline.css +129 -127
- package/dist/style.css +129 -127
- package/dist/toc/readTocItems.d.ts +4 -0
- package/package.json +1 -1
- package/dist/ReportContentWithCharts-CDwS4OH9.js +0 -496
- package/dist/ReportContentWithCharts-CDwS4OH9.js.map +0 -1
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { Markdown, MarkdownManager } from "@tiptap/markdown";
|
|
3
|
-
import {
|
|
4
|
-
import { C, a,
|
|
3
|
+
import { g as getLocaleBundle, d as renderOrUpdateChart, e as destroyChart, u as useIsMobile, E as EditorToc, h as sameTocItems$1 } from "./ReportContentWithCharts-DHdD1BaH.js";
|
|
4
|
+
import { C, a, b, c, f, m, r, s } from "./ReportContentWithCharts-DHdD1BaH.js";
|
|
5
5
|
import { jsx, jsxs, Fragment as Fragment$2 } from "react/jsx-runtime";
|
|
6
6
|
import CodeBlockLowlight from "@tiptap/extension-code-block-lowlight";
|
|
7
7
|
import FindAndReplace, { FindAndReplacePluginKey, createSearchRegex } from "@tiptap/extension-find-and-replace";
|
|
@@ -14,10 +14,10 @@ import { NodeViewWrapper, ReactNodeViewRenderer, useEditorState, ReactRenderer,
|
|
|
14
14
|
import { Extension, Node as Node$1, mergeAttributes } from "@tiptap/core";
|
|
15
15
|
import { createPortal } from "react-dom";
|
|
16
16
|
import { useState, useEffect, useCallback, useRef, useMemo, useSyncExternalStore, useLayoutEffect, forwardRef, useId, useImperativeHandle, Fragment as Fragment$1, useContext, createContext } from "react";
|
|
17
|
-
import { e as enrichMarkdownCitations, c as styles$
|
|
18
|
-
import { R
|
|
17
|
+
import { e as enrichMarkdownCitations, c as styles$d } from "./ReportContent-B7okwVW0.js";
|
|
18
|
+
import { R, a as a2, b as b2, s as s2 } from "./ReportContent-B7okwVW0.js";
|
|
19
19
|
import { C as CitationRef, i as mergeCommentIntervals, h as mapCommentAnchors, n as normalizeImageAlign, p as prepareChartMarkdown, j as reportChart, f as CommentMark, b as baseExtensions, l as lowlight, m as makeTocGetId, k as parseCodeTokenAsChartOrCodeBlock, o as imageMarkdownTokenizer, q as imageParseMarkdown, t as imageRenderMarkdown, u as imageNodeHtml, v as imageFigureParseRule, w as imageCaptionAttribute, x as imageAlignAttribute, y as normalizeImageCaption, a as pureCodeBlock, c as pureImage, z as renderMathInto, A as readCurrentNumberingFormat, B as subscribeMathClick, D as applyNumberingFormat, N as NUMBERING_FORMAT_IDS, E as NUMBERING_FORMAT_LABELS, F as NUMBERING_FORMAT_PREVIEWS, d as pureChart } from "./extractToc-B50WvHao.js";
|
|
20
|
-
import { P, g, e, s as
|
|
20
|
+
import { P, g, e, s as s3 } from "./extractToc-B50WvHao.js";
|
|
21
21
|
import { Slice, Fragment } from "@tiptap/pm/model";
|
|
22
22
|
import { PluginKey, Plugin, Selection, TextSelection, NodeSelection } from "@tiptap/pm/state";
|
|
23
23
|
import { DecorationSet, Decoration } from "@tiptap/pm/view";
|
|
@@ -270,7 +270,7 @@ function applyCommentAnchorsToEditor(editor, comments) {
|
|
|
270
270
|
const intervals = comments.length > 0 ? mergeCommentIntervals(
|
|
271
271
|
mapCommentAnchors(
|
|
272
272
|
editor.state.doc,
|
|
273
|
-
comments.map((
|
|
273
|
+
comments.map((c2) => ({ commentId: c2.commentId, segments: c2.segments }))
|
|
274
274
|
).map((r2) => ({ commentId: r2.commentId, ranges: r2.ranges }))
|
|
275
275
|
) : [];
|
|
276
276
|
const chain = editor.chain().clearCommentAnchors();
|
|
@@ -659,494 +659,7 @@ const KeyboardIcon = (p) => /* @__PURE__ */ jsxs(Svg, { ...p, children: [
|
|
|
659
659
|
/* @__PURE__ */ jsx("path", { d: "M18 12h.01" }),
|
|
660
660
|
/* @__PURE__ */ jsx("path", { d: "M7 16h10" })
|
|
661
661
|
] });
|
|
662
|
-
const
|
|
663
|
-
tabLabel: (chartType, index) => `${chartType} ${index + 1}`,
|
|
664
|
-
done: "Done",
|
|
665
|
-
cancel: "Cancel",
|
|
666
|
-
configLabel: "Chart config (JSON)",
|
|
667
|
-
tableLabel: "Data table (Markdown)",
|
|
668
|
-
editTitle: "Edit chart"
|
|
669
|
-
};
|
|
670
|
-
const defaultToolbarLabels = {
|
|
671
|
-
undo: "Undo",
|
|
672
|
-
redo: "Redo",
|
|
673
|
-
style: "Style",
|
|
674
|
-
normalText: "Normal text",
|
|
675
|
-
headingLabel: (level) => `Heading ${level}`,
|
|
676
|
-
fontSize: "Font size",
|
|
677
|
-
fontSizeDefault: "Default",
|
|
678
|
-
bold: "Bold",
|
|
679
|
-
italic: "Italic",
|
|
680
|
-
underline: "Underline",
|
|
681
|
-
strike: "Strikethrough",
|
|
682
|
-
code: "Inline code",
|
|
683
|
-
textColor: "Text color",
|
|
684
|
-
highlight: "Highlight",
|
|
685
|
-
colorNone: "None",
|
|
686
|
-
colorTheme: "THEME",
|
|
687
|
-
scriptMenu: "Superscript / Subscript",
|
|
688
|
-
scriptNormal: "Normal",
|
|
689
|
-
superscript: "Superscript",
|
|
690
|
-
subscript: "Subscript",
|
|
691
|
-
link: "Link",
|
|
692
|
-
align: "Alignment",
|
|
693
|
-
alignLeft: "Align left",
|
|
694
|
-
alignCenter: "Align center",
|
|
695
|
-
alignRight: "Align right",
|
|
696
|
-
alignJustify: "Justify",
|
|
697
|
-
indent: "Indent",
|
|
698
|
-
indentIncrease: "Increase indent",
|
|
699
|
-
indentDecrease: "Decrease indent",
|
|
700
|
-
lineHeight: "Line height",
|
|
701
|
-
lineHeightDefault: "Default",
|
|
702
|
-
linkPrompt: "Enter URL",
|
|
703
|
-
linkApply: "Apply link",
|
|
704
|
-
linkOpen: "Open in new window",
|
|
705
|
-
linkRemove: "Remove link",
|
|
706
|
-
linkInvalid: "The editor rejected this address",
|
|
707
|
-
image: "Image",
|
|
708
|
-
imageUploadFailed: "Image upload failed",
|
|
709
|
-
imageAlign: "Image alignment",
|
|
710
|
-
imageAlignLeft: "Align left",
|
|
711
|
-
imageAlignCenter: "Align center",
|
|
712
|
-
imageAlignRight: "Align right",
|
|
713
|
-
imageCaption: "Caption",
|
|
714
|
-
imageCaptionPlaceholder: "Add a caption…",
|
|
715
|
-
importMarkdownFailed: "Markdown import failed",
|
|
716
|
-
importDocument: "Import",
|
|
717
|
-
importDocumentHint: "Import a file",
|
|
718
|
-
importDocumentOther: "Document",
|
|
719
|
-
importDocumentBusy: "Importing…",
|
|
720
|
-
importDocumentUploading: (percent) => `Uploading ${percent}%`,
|
|
721
|
-
importDocumentConverting: "Converting…",
|
|
722
|
-
importDocumentFailed: "Import failed",
|
|
723
|
-
blockquote: "Blockquote",
|
|
724
|
-
details: "Toggle",
|
|
725
|
-
bulletList: "Bullet list",
|
|
726
|
-
orderedList: "Ordered list",
|
|
727
|
-
numberingFormat: "Numbering format",
|
|
728
|
-
taskList: "Task list",
|
|
729
|
-
more: "More",
|
|
730
|
-
search: "Find & replace",
|
|
731
|
-
codeBlock: "Code block",
|
|
732
|
-
hr: "Divider",
|
|
733
|
-
importMarkdown: "Markdown",
|
|
734
|
-
tableInsert: "Insert table",
|
|
735
|
-
tableRowMenu: "Row actions",
|
|
736
|
-
tableColumnMenu: "Column actions",
|
|
737
|
-
tableClearContent: "Clear content",
|
|
738
|
-
tableResetCellStyles: "Reset cell styles",
|
|
739
|
-
tableAppendRow: "Add row",
|
|
740
|
-
tableAppendColumn: "Add column",
|
|
741
|
-
tableSizeSelected: (cols, rows) => `${cols} × ${rows}`,
|
|
742
|
-
tableAddColumnBefore: "Add column before",
|
|
743
|
-
tableAddColumnAfter: "Add column after",
|
|
744
|
-
tableDeleteColumn: "Delete column",
|
|
745
|
-
tableAddRowBefore: "Add row before",
|
|
746
|
-
tableAddRowAfter: "Add row after",
|
|
747
|
-
tableDeleteRow: "Delete row",
|
|
748
|
-
tableAddColumnBeforeN: (n) => `Add ${n} columns before`,
|
|
749
|
-
tableAddColumnAfterN: (n) => `Add ${n} columns after`,
|
|
750
|
-
tableDeleteColumnN: (n) => `Delete ${n} columns`,
|
|
751
|
-
tableAddRowBeforeN: (n) => `Add ${n} rows before`,
|
|
752
|
-
tableAddRowAfterN: (n) => `Add ${n} rows after`,
|
|
753
|
-
tableDeleteRowN: (n) => `Delete ${n} rows`,
|
|
754
|
-
tableDeleteTable: "Delete table",
|
|
755
|
-
inlineMath: "Inline equation",
|
|
756
|
-
blockMath: "Block equation",
|
|
757
|
-
mathPlaceholder: "E = mc^2",
|
|
758
|
-
mathDone: "Done",
|
|
759
|
-
mathCancel: "Cancel",
|
|
760
|
-
mathNewInline: "New equation",
|
|
761
|
-
mathNewBlock: "Add a TeX equation"
|
|
762
|
-
};
|
|
763
|
-
const defaultBlockDragLabels = {
|
|
764
|
-
dragHandle: "Drag to move",
|
|
765
|
-
menuLabel: "Block actions",
|
|
766
|
-
turnInto: "Turn into",
|
|
767
|
-
paragraph: "Normal text",
|
|
768
|
-
headingLabel: (level) => `Heading ${level}`,
|
|
769
|
-
bulletList: "Bullet list",
|
|
770
|
-
orderedList: "Ordered list",
|
|
771
|
-
taskList: "Task list",
|
|
772
|
-
blockquote: "Blockquote",
|
|
773
|
-
codeBlock: "Code block",
|
|
774
|
-
copy: "Copy",
|
|
775
|
-
duplicate: "Duplicate",
|
|
776
|
-
resetFormatting: "Reset formatting",
|
|
777
|
-
downloadImage: "Download image",
|
|
778
|
-
delete: "Delete"
|
|
779
|
-
};
|
|
780
|
-
const defaultSlashMenuLabels = {
|
|
781
|
-
menuLabel: "Insert block",
|
|
782
|
-
groupText: "Text",
|
|
783
|
-
groupList: "Lists",
|
|
784
|
-
groupAdvanced: "Advanced",
|
|
785
|
-
normalText: "Normal text",
|
|
786
|
-
headingLabel: (level) => `Heading ${level}`,
|
|
787
|
-
bulletList: "Bullet list",
|
|
788
|
-
orderedList: "Ordered list",
|
|
789
|
-
taskList: "Task list",
|
|
790
|
-
blockquote: "Blockquote",
|
|
791
|
-
details: "Toggle",
|
|
792
|
-
codeBlock: "Code block",
|
|
793
|
-
divider: "Divider",
|
|
794
|
-
table: "Table",
|
|
795
|
-
inlineMath: "Inline equation",
|
|
796
|
-
blockMath: "Block equation"
|
|
797
|
-
};
|
|
798
|
-
const defaultShortcutLabels = {
|
|
799
|
-
panelTitle: "Shortcuts",
|
|
800
|
-
close: "Close",
|
|
801
|
-
colFormat: "Format",
|
|
802
|
-
colShortcut: "Shortcut",
|
|
803
|
-
colMarkdown: "Markdown",
|
|
804
|
-
formatGroup: "Formatting",
|
|
805
|
-
insertGroup: "Insert",
|
|
806
|
-
editGroup: "Editing",
|
|
807
|
-
bold: "Bold",
|
|
808
|
-
italic: "Italic",
|
|
809
|
-
strike: "Strikethrough",
|
|
810
|
-
underline: "Underline",
|
|
811
|
-
inlineCode: "Inline code",
|
|
812
|
-
highlight: "Highlight",
|
|
813
|
-
headingLabel: (level) => `Heading ${level}`,
|
|
814
|
-
paragraph: "Normal text",
|
|
815
|
-
blockquote: "Blockquote",
|
|
816
|
-
bulletList: "Bullet list",
|
|
817
|
-
orderedList: "Ordered list",
|
|
818
|
-
taskList: "Task list",
|
|
819
|
-
codeBlock: "Code block",
|
|
820
|
-
divider: "Divider",
|
|
821
|
-
undo: "Undo",
|
|
822
|
-
redo: "Redo",
|
|
823
|
-
hardBreak: "Hard break",
|
|
824
|
-
findReplace: "Find & replace",
|
|
825
|
-
alignLeft: "Align left",
|
|
826
|
-
alignCenter: "Align center",
|
|
827
|
-
alignRight: "Align right",
|
|
828
|
-
alignJustify: "Justify",
|
|
829
|
-
imageUpload: "Upload image",
|
|
830
|
-
smartQuote: "Smart quotes",
|
|
831
|
-
ellipsis: "Ellipsis",
|
|
832
|
-
emDash: "Em dash",
|
|
833
|
-
emoji: "Emoji"
|
|
834
|
-
};
|
|
835
|
-
const defaultCharacterCountLabels = {
|
|
836
|
-
label: "Document statistics",
|
|
837
|
-
characters: (count) => `${count} ${count === 1 ? "character" : "characters"}`,
|
|
838
|
-
words: (count) => `${count} ${count === 1 ? "word" : "words"}`
|
|
839
|
-
};
|
|
840
|
-
const defaultEmojiSuggestionLabels = {
|
|
841
|
-
menuLabel: "Emoji"
|
|
842
|
-
};
|
|
843
|
-
const defaultLinkPopoverLabels = {
|
|
844
|
-
field: "Enter URL",
|
|
845
|
-
apply: "Apply link",
|
|
846
|
-
open: "Open in new window",
|
|
847
|
-
remove: "Remove link",
|
|
848
|
-
invalid: "The editor rejected this address"
|
|
849
|
-
};
|
|
850
|
-
const defaultColorPaletteLabels = {
|
|
851
|
-
none: "None",
|
|
852
|
-
theme: "THEME"
|
|
853
|
-
};
|
|
854
|
-
const defaultTocLabels = {
|
|
855
|
-
title: "Contents",
|
|
856
|
-
expand: "Expand",
|
|
857
|
-
collapse: "Collapse"
|
|
858
|
-
};
|
|
859
|
-
const defaultCodeBlockLabels = {
|
|
860
|
-
autoDetect: "Auto-detect",
|
|
861
|
-
delete: "Delete code block",
|
|
862
|
-
copy: "Copy code",
|
|
863
|
-
expand: "Expand code",
|
|
864
|
-
collapse: "Collapse code",
|
|
865
|
-
language: "Code language"
|
|
866
|
-
};
|
|
867
|
-
const defaultFindLabels = {
|
|
868
|
-
find: "Find",
|
|
869
|
-
replace: "Replace with",
|
|
870
|
-
next: "Next match",
|
|
871
|
-
previous: "Previous match",
|
|
872
|
-
replaceOne: "Replace",
|
|
873
|
-
replaceAll: "Replace all",
|
|
874
|
-
close: "Close",
|
|
875
|
-
caseSensitive: "Match case",
|
|
876
|
-
wholeWord: "Whole word",
|
|
877
|
-
useRegex: "Use regular expression",
|
|
878
|
-
counter: (current, total) => `${current} / ${total}`,
|
|
879
|
-
invalidRegex: "Invalid pattern",
|
|
880
|
-
readOnly: "Read-only"
|
|
881
|
-
};
|
|
882
|
-
const defaultImageUploadLabels = {
|
|
883
|
-
dropzoneClick: "Click to upload",
|
|
884
|
-
dropzoneRest: " or drag and drop",
|
|
885
|
-
dropzoneLimits: (limit, maxSizeMb) => {
|
|
886
|
-
const count = `Maximum ${limit} file${limit === 1 ? "" : "s"}`;
|
|
887
|
-
return maxSizeMb == null ? `${count}.` : `${count}, ${maxSizeMb}MB each.`;
|
|
888
|
-
},
|
|
889
|
-
uploadingCount: (count) => `Uploading ${count} files`,
|
|
890
|
-
clearAll: "Clear all",
|
|
891
|
-
remove: "Remove",
|
|
892
|
-
failed: "Upload failed",
|
|
893
|
-
fallbackAlt: "image"
|
|
894
|
-
};
|
|
895
|
-
const zh = {
|
|
896
|
-
toolbar: {
|
|
897
|
-
undo: "撤销",
|
|
898
|
-
redo: "重做",
|
|
899
|
-
style: "样式",
|
|
900
|
-
normalText: "正文",
|
|
901
|
-
headingLabel: (level) => `标题 ${level}`,
|
|
902
|
-
fontSize: "字号",
|
|
903
|
-
fontSizeDefault: "默认",
|
|
904
|
-
bold: "加粗",
|
|
905
|
-
italic: "斜体",
|
|
906
|
-
underline: "下划线",
|
|
907
|
-
strike: "删除线",
|
|
908
|
-
code: "行内代码",
|
|
909
|
-
textColor: "文字颜色",
|
|
910
|
-
highlight: "高亮",
|
|
911
|
-
colorNone: "无",
|
|
912
|
-
colorTheme: "主题色",
|
|
913
|
-
scriptMenu: "上标 / 下标",
|
|
914
|
-
scriptNormal: "常规",
|
|
915
|
-
superscript: "上标",
|
|
916
|
-
subscript: "下标",
|
|
917
|
-
link: "链接",
|
|
918
|
-
align: "对齐",
|
|
919
|
-
alignLeft: "左对齐",
|
|
920
|
-
alignCenter: "居中",
|
|
921
|
-
alignRight: "右对齐",
|
|
922
|
-
alignJustify: "两端对齐",
|
|
923
|
-
indent: "缩进",
|
|
924
|
-
indentIncrease: "增加缩进",
|
|
925
|
-
indentDecrease: "减少缩进",
|
|
926
|
-
lineHeight: "行高",
|
|
927
|
-
lineHeightDefault: "默认",
|
|
928
|
-
linkPrompt: "输入链接地址",
|
|
929
|
-
linkApply: "应用链接",
|
|
930
|
-
linkOpen: "在新窗口打开",
|
|
931
|
-
linkRemove: "移除链接",
|
|
932
|
-
linkInvalid: "编辑器不接受这个地址",
|
|
933
|
-
image: "图片",
|
|
934
|
-
imageUploadFailed: "图片上传失败",
|
|
935
|
-
imageAlign: "图片对齐",
|
|
936
|
-
imageAlignLeft: "左对齐",
|
|
937
|
-
imageAlignCenter: "居中",
|
|
938
|
-
imageAlignRight: "右对齐",
|
|
939
|
-
imageCaption: "图片描述",
|
|
940
|
-
imageCaptionPlaceholder: "添加描述…",
|
|
941
|
-
importMarkdownFailed: "Markdown 导入失败",
|
|
942
|
-
importDocument: "导入",
|
|
943
|
-
importDocumentHint: "导入文件",
|
|
944
|
-
importDocumentOther: "文档",
|
|
945
|
-
importDocumentBusy: "正在导入…",
|
|
946
|
-
importDocumentUploading: (percent) => `上传中 ${percent}%`,
|
|
947
|
-
importDocumentConverting: "正在转换…",
|
|
948
|
-
importDocumentFailed: "导入失败",
|
|
949
|
-
blockquote: "引用",
|
|
950
|
-
details: "折叠块",
|
|
951
|
-
bulletList: "无序列表",
|
|
952
|
-
orderedList: "有序列表",
|
|
953
|
-
numberingFormat: "编号格式",
|
|
954
|
-
taskList: "任务列表",
|
|
955
|
-
more: "更多",
|
|
956
|
-
search: "查找替换",
|
|
957
|
-
codeBlock: "代码块",
|
|
958
|
-
hr: "分隔线",
|
|
959
|
-
importMarkdown: "Markdown",
|
|
960
|
-
tableInsert: "插入表格",
|
|
961
|
-
tableRowMenu: "行操作",
|
|
962
|
-
tableColumnMenu: "列操作",
|
|
963
|
-
tableClearContent: "清空内容",
|
|
964
|
-
tableResetCellStyles: "重置单元格样式",
|
|
965
|
-
tableAppendRow: "添加行",
|
|
966
|
-
tableAppendColumn: "添加列",
|
|
967
|
-
tableSizeSelected: (cols, rows) => `${cols} × ${rows}`,
|
|
968
|
-
tableAddColumnBefore: "在左侧插入列",
|
|
969
|
-
tableAddColumnAfter: "在右侧插入列",
|
|
970
|
-
tableDeleteColumn: "删除列",
|
|
971
|
-
tableAddRowBefore: "在上方插入行",
|
|
972
|
-
tableAddRowAfter: "在下方插入行",
|
|
973
|
-
tableDeleteRow: "删除行",
|
|
974
|
-
tableAddColumnBeforeN: (n) => `在左侧插入 ${n} 列`,
|
|
975
|
-
tableAddColumnAfterN: (n) => `在右侧插入 ${n} 列`,
|
|
976
|
-
tableDeleteColumnN: (n) => `删除 ${n} 列`,
|
|
977
|
-
tableAddRowBeforeN: (n) => `在上方插入 ${n} 行`,
|
|
978
|
-
tableAddRowAfterN: (n) => `在下方插入 ${n} 行`,
|
|
979
|
-
tableDeleteRowN: (n) => `删除 ${n} 行`,
|
|
980
|
-
tableDeleteTable: "删除表格",
|
|
981
|
-
inlineMath: "行内公式",
|
|
982
|
-
blockMath: "块级公式",
|
|
983
|
-
mathPlaceholder: "E = mc^2",
|
|
984
|
-
mathDone: "完成",
|
|
985
|
-
mathCancel: "取消",
|
|
986
|
-
mathNewInline: "新建公式",
|
|
987
|
-
mathNewBlock: "插入 TeX 公式"
|
|
988
|
-
},
|
|
989
|
-
slashMenu: {
|
|
990
|
-
menuLabel: "插入块",
|
|
991
|
-
groupText: "文本",
|
|
992
|
-
groupList: "列表",
|
|
993
|
-
groupAdvanced: "高级",
|
|
994
|
-
normalText: "正文",
|
|
995
|
-
headingLabel: (level) => `标题 ${level}`,
|
|
996
|
-
bulletList: "无序列表",
|
|
997
|
-
orderedList: "有序列表",
|
|
998
|
-
taskList: "任务列表",
|
|
999
|
-
blockquote: "引用",
|
|
1000
|
-
details: "折叠块",
|
|
1001
|
-
codeBlock: "代码块",
|
|
1002
|
-
divider: "分隔线",
|
|
1003
|
-
table: "表格",
|
|
1004
|
-
inlineMath: "行内公式",
|
|
1005
|
-
blockMath: "块级公式"
|
|
1006
|
-
},
|
|
1007
|
-
chart: {
|
|
1008
|
-
tabLabel: (chartType, index) => `${chartType} ${index + 1}`,
|
|
1009
|
-
done: "完成",
|
|
1010
|
-
cancel: "取消",
|
|
1011
|
-
configLabel: "图表配置(JSON)",
|
|
1012
|
-
tableLabel: "数据表(Markdown)",
|
|
1013
|
-
editTitle: "编辑图表"
|
|
1014
|
-
},
|
|
1015
|
-
blockDrag: {
|
|
1016
|
-
dragHandle: "拖动以移动",
|
|
1017
|
-
menuLabel: "块操作",
|
|
1018
|
-
turnInto: "转换成",
|
|
1019
|
-
paragraph: "正文",
|
|
1020
|
-
headingLabel: (level) => `标题 ${level}`,
|
|
1021
|
-
bulletList: "无序列表",
|
|
1022
|
-
orderedList: "有序列表",
|
|
1023
|
-
taskList: "任务列表",
|
|
1024
|
-
blockquote: "引用",
|
|
1025
|
-
codeBlock: "代码块",
|
|
1026
|
-
copy: "复制",
|
|
1027
|
-
duplicate: "再制一份",
|
|
1028
|
-
resetFormatting: "清除格式",
|
|
1029
|
-
downloadImage: "下载图片",
|
|
1030
|
-
delete: "删除"
|
|
1031
|
-
},
|
|
1032
|
-
shortcut: {
|
|
1033
|
-
panelTitle: "快捷键",
|
|
1034
|
-
close: "关闭",
|
|
1035
|
-
colFormat: "格式",
|
|
1036
|
-
colShortcut: "快捷键",
|
|
1037
|
-
colMarkdown: "Markdown",
|
|
1038
|
-
formatGroup: "格式",
|
|
1039
|
-
insertGroup: "插入",
|
|
1040
|
-
editGroup: "编辑",
|
|
1041
|
-
bold: "加粗",
|
|
1042
|
-
italic: "斜体",
|
|
1043
|
-
strike: "删除线",
|
|
1044
|
-
underline: "下划线",
|
|
1045
|
-
inlineCode: "行内代码",
|
|
1046
|
-
highlight: "高亮",
|
|
1047
|
-
headingLabel: (level) => `标题 ${level}`,
|
|
1048
|
-
paragraph: "正文",
|
|
1049
|
-
blockquote: "引用",
|
|
1050
|
-
bulletList: "无序列表",
|
|
1051
|
-
orderedList: "有序列表",
|
|
1052
|
-
taskList: "任务列表",
|
|
1053
|
-
codeBlock: "代码块",
|
|
1054
|
-
divider: "分隔线",
|
|
1055
|
-
undo: "撤销",
|
|
1056
|
-
redo: "重做",
|
|
1057
|
-
hardBreak: "硬换行",
|
|
1058
|
-
findReplace: "查找替换",
|
|
1059
|
-
alignLeft: "左对齐",
|
|
1060
|
-
alignCenter: "居中",
|
|
1061
|
-
alignRight: "右对齐",
|
|
1062
|
-
alignJustify: "两端对齐",
|
|
1063
|
-
imageUpload: "上传图片",
|
|
1064
|
-
smartQuote: "智能引号",
|
|
1065
|
-
ellipsis: "省略号",
|
|
1066
|
-
emDash: "破折号",
|
|
1067
|
-
emoji: "表情"
|
|
1068
|
-
},
|
|
1069
|
-
characterCount: {
|
|
1070
|
-
label: "字数统计",
|
|
1071
|
-
characters: (count) => `${count} 字符`,
|
|
1072
|
-
words: (count) => `${count} 词`
|
|
1073
|
-
},
|
|
1074
|
-
emoji: {
|
|
1075
|
-
menuLabel: "表情"
|
|
1076
|
-
},
|
|
1077
|
-
link: {
|
|
1078
|
-
field: "输入链接地址",
|
|
1079
|
-
apply: "应用链接",
|
|
1080
|
-
open: "在新窗口打开",
|
|
1081
|
-
remove: "移除链接",
|
|
1082
|
-
invalid: "编辑器不接受这个地址"
|
|
1083
|
-
},
|
|
1084
|
-
palette: {
|
|
1085
|
-
none: "无",
|
|
1086
|
-
theme: "主题色"
|
|
1087
|
-
},
|
|
1088
|
-
toc: {
|
|
1089
|
-
title: "目录",
|
|
1090
|
-
expand: "展开",
|
|
1091
|
-
collapse: "收起"
|
|
1092
|
-
},
|
|
1093
|
-
codeBlock: {
|
|
1094
|
-
autoDetect: "自动识别",
|
|
1095
|
-
delete: "删除代码块",
|
|
1096
|
-
copy: "复制代码",
|
|
1097
|
-
expand: "展开代码",
|
|
1098
|
-
collapse: "收起代码",
|
|
1099
|
-
language: "代码语言"
|
|
1100
|
-
},
|
|
1101
|
-
find: {
|
|
1102
|
-
find: "查找",
|
|
1103
|
-
replace: "替换为",
|
|
1104
|
-
next: "下一处",
|
|
1105
|
-
previous: "上一处",
|
|
1106
|
-
replaceOne: "替换",
|
|
1107
|
-
replaceAll: "全部替换",
|
|
1108
|
-
close: "关闭",
|
|
1109
|
-
caseSensitive: "区分大小写",
|
|
1110
|
-
wholeWord: "全词匹配",
|
|
1111
|
-
useRegex: "正则表达式",
|
|
1112
|
-
counter: (current, total) => `${current} / ${total}`,
|
|
1113
|
-
invalidRegex: "正则无效",
|
|
1114
|
-
readOnly: "只读"
|
|
1115
|
-
},
|
|
1116
|
-
imageUpload: {
|
|
1117
|
-
dropzoneClick: "点击上传",
|
|
1118
|
-
dropzoneRest: ",或拖拽到此处",
|
|
1119
|
-
dropzoneLimits: (limit, maxSizeMb) => {
|
|
1120
|
-
const count = `最多 ${limit} 个文件`;
|
|
1121
|
-
return maxSizeMb == null ? `${count}。` : `${count},每个 ${maxSizeMb}MB。`;
|
|
1122
|
-
},
|
|
1123
|
-
uploadingCount: (count) => `正在上传 ${count} 个文件`,
|
|
1124
|
-
clearAll: "全部清除",
|
|
1125
|
-
remove: "移除",
|
|
1126
|
-
failed: "上传失败",
|
|
1127
|
-
fallbackAlt: "图片"
|
|
1128
|
-
}
|
|
1129
|
-
};
|
|
1130
|
-
const en = {
|
|
1131
|
-
toolbar: defaultToolbarLabels,
|
|
1132
|
-
slashMenu: defaultSlashMenuLabels,
|
|
1133
|
-
chart: defaultChartLabels,
|
|
1134
|
-
blockDrag: defaultBlockDragLabels,
|
|
1135
|
-
shortcut: defaultShortcutLabels,
|
|
1136
|
-
characterCount: defaultCharacterCountLabels,
|
|
1137
|
-
emoji: defaultEmojiSuggestionLabels,
|
|
1138
|
-
link: defaultLinkPopoverLabels,
|
|
1139
|
-
palette: defaultColorPaletteLabels,
|
|
1140
|
-
toc: defaultTocLabels,
|
|
1141
|
-
codeBlock: defaultCodeBlockLabels,
|
|
1142
|
-
find: defaultFindLabels,
|
|
1143
|
-
imageUpload: defaultImageUploadLabels
|
|
1144
|
-
};
|
|
1145
|
-
const bundles = { en, zh };
|
|
1146
|
-
function getLocaleBundle(locale = "en") {
|
|
1147
|
-
return bundles[locale] ?? en;
|
|
1148
|
-
}
|
|
1149
|
-
const bar$2 = "_bar_1h61e_3";
|
|
662
|
+
const bar$1 = "_bar_1h61e_3";
|
|
1150
663
|
const row$1 = "_row_1h61e_25";
|
|
1151
664
|
const field$1 = "_field_1h61e_43";
|
|
1152
665
|
const fieldIcon = "_fieldIcon_1h61e_62";
|
|
@@ -1159,8 +672,8 @@ const toggleOn = "_toggleOn_1h61e_135";
|
|
|
1159
672
|
const iconGroup = "_iconGroup_1h61e_29";
|
|
1160
673
|
const spacer = "_spacer_1h61e_150";
|
|
1161
674
|
const readOnly = "_readOnly_1h61e_155";
|
|
1162
|
-
const styles$
|
|
1163
|
-
bar: bar$
|
|
675
|
+
const styles$c = {
|
|
676
|
+
bar: bar$1,
|
|
1164
677
|
row: row$1,
|
|
1165
678
|
field: field$1,
|
|
1166
679
|
fieldIcon,
|
|
@@ -1283,11 +796,11 @@ function FindReplaceBar({
|
|
|
1283
796
|
});
|
|
1284
797
|
};
|
|
1285
798
|
if (!hasExtension) return null;
|
|
1286
|
-
const toggleClass = (on) => `${styles$
|
|
799
|
+
const toggleClass = (on) => `${styles$c.btn} ${styles$c.toggle}${on ? ` ${styles$c.toggleOn}` : ""}`;
|
|
1287
800
|
return /* @__PURE__ */ jsxs(
|
|
1288
801
|
"div",
|
|
1289
802
|
{
|
|
1290
|
-
className: className ? `${styles$
|
|
803
|
+
className: className ? `${styles$c.bar} ${className}` : styles$c.bar,
|
|
1291
804
|
style,
|
|
1292
805
|
"data-find-bar": "",
|
|
1293
806
|
role: "dialog",
|
|
@@ -1300,14 +813,14 @@ function FindReplaceBar({
|
|
|
1300
813
|
onClose();
|
|
1301
814
|
},
|
|
1302
815
|
children: [
|
|
1303
|
-
/* @__PURE__ */ jsxs("div", { className: styles$
|
|
1304
|
-
/* @__PURE__ */ jsxs("span", { className: styles$
|
|
1305
|
-
/* @__PURE__ */ jsx(SearchIcon, { size: 14, className: styles$
|
|
816
|
+
/* @__PURE__ */ jsxs("div", { className: styles$c.row, children: [
|
|
817
|
+
/* @__PURE__ */ jsxs("span", { className: styles$c.field, children: [
|
|
818
|
+
/* @__PURE__ */ jsx(SearchIcon, { size: 14, className: styles$c.fieldIcon }),
|
|
1306
819
|
/* @__PURE__ */ jsx(
|
|
1307
820
|
"input",
|
|
1308
821
|
{
|
|
1309
822
|
ref: inputRef,
|
|
1310
|
-
className: styles$
|
|
823
|
+
className: styles$c.input,
|
|
1311
824
|
"data-find-field": "search",
|
|
1312
825
|
value: term,
|
|
1313
826
|
onChange: (e2) => setTerm(e2.target.value),
|
|
@@ -1321,7 +834,7 @@ function FindReplaceBar({
|
|
|
1321
834
|
/* @__PURE__ */ jsx(
|
|
1322
835
|
"span",
|
|
1323
836
|
{
|
|
1324
|
-
className: `${styles$
|
|
837
|
+
className: `${styles$c.counter}${invalidPattern ? ` ${styles$c.counterInvalid}` : ""}`,
|
|
1325
838
|
"data-find-counter": "",
|
|
1326
839
|
"aria-live": "polite",
|
|
1327
840
|
title: invalidPattern ? t.invalidRegex : void 0,
|
|
@@ -1357,13 +870,13 @@ function FindReplaceBar({
|
|
|
1357
870
|
children: "ab"
|
|
1358
871
|
}
|
|
1359
872
|
),
|
|
1360
|
-
/* @__PURE__ */ jsx("span", { className: styles$
|
|
1361
|
-
/* @__PURE__ */ jsxs("span", { className: styles$
|
|
873
|
+
/* @__PURE__ */ jsx("span", { className: styles$c.spacer }),
|
|
874
|
+
/* @__PURE__ */ jsxs("span", { className: styles$c.iconGroup, children: [
|
|
1362
875
|
/* @__PURE__ */ jsx(
|
|
1363
876
|
"button",
|
|
1364
877
|
{
|
|
1365
878
|
type: "button",
|
|
1366
|
-
className: styles$
|
|
879
|
+
className: styles$c.btn,
|
|
1367
880
|
"data-find-action": "previous",
|
|
1368
881
|
title: t.previous,
|
|
1369
882
|
"aria-label": t.previous,
|
|
@@ -1377,7 +890,7 @@ function FindReplaceBar({
|
|
|
1377
890
|
"button",
|
|
1378
891
|
{
|
|
1379
892
|
type: "button",
|
|
1380
|
-
className: styles$
|
|
893
|
+
className: styles$c.btn,
|
|
1381
894
|
"data-find-action": "next",
|
|
1382
895
|
title: t.next,
|
|
1383
896
|
"aria-label": t.next,
|
|
@@ -1391,7 +904,7 @@ function FindReplaceBar({
|
|
|
1391
904
|
"button",
|
|
1392
905
|
{
|
|
1393
906
|
type: "button",
|
|
1394
|
-
className: styles$
|
|
907
|
+
className: styles$c.btn,
|
|
1395
908
|
"data-find-action": "close",
|
|
1396
909
|
title: t.close,
|
|
1397
910
|
"aria-label": t.close,
|
|
@@ -1401,11 +914,11 @@ function FindReplaceBar({
|
|
|
1401
914
|
)
|
|
1402
915
|
] })
|
|
1403
916
|
] }),
|
|
1404
|
-
editor.isEditable ? /* @__PURE__ */ jsxs("div", { className: styles$
|
|
1405
|
-
/* @__PURE__ */ jsx("span", { className: styles$
|
|
917
|
+
editor.isEditable ? /* @__PURE__ */ jsxs("div", { className: styles$c.row, children: [
|
|
918
|
+
/* @__PURE__ */ jsx("span", { className: styles$c.field, children: /* @__PURE__ */ jsx(
|
|
1406
919
|
"input",
|
|
1407
920
|
{
|
|
1408
|
-
className: styles$
|
|
921
|
+
className: styles$c.input,
|
|
1409
922
|
"data-find-field": "replace",
|
|
1410
923
|
value: replaceTerm,
|
|
1411
924
|
onChange: (e2) => setReplaceTerm(e2.target.value),
|
|
@@ -1415,12 +928,12 @@ function FindReplaceBar({
|
|
|
1415
928
|
spellCheck: false
|
|
1416
929
|
}
|
|
1417
930
|
) }),
|
|
1418
|
-
/* @__PURE__ */ jsx("span", { className: styles$
|
|
931
|
+
/* @__PURE__ */ jsx("span", { className: styles$c.spacer }),
|
|
1419
932
|
/* @__PURE__ */ jsx(
|
|
1420
933
|
"button",
|
|
1421
934
|
{
|
|
1422
935
|
type: "button",
|
|
1423
|
-
className: styles$
|
|
936
|
+
className: styles$c.btn,
|
|
1424
937
|
"data-find-action": "replace",
|
|
1425
938
|
title: t.replaceOne,
|
|
1426
939
|
"aria-label": t.replaceOne,
|
|
@@ -1434,7 +947,7 @@ function FindReplaceBar({
|
|
|
1434
947
|
"button",
|
|
1435
948
|
{
|
|
1436
949
|
type: "button",
|
|
1437
|
-
className: styles$
|
|
950
|
+
className: styles$c.btn,
|
|
1438
951
|
"data-find-action": "replace-all",
|
|
1439
952
|
title: t.replaceAll,
|
|
1440
953
|
"aria-label": t.replaceAll,
|
|
@@ -1444,7 +957,7 @@ function FindReplaceBar({
|
|
|
1444
957
|
children: /* @__PURE__ */ jsx(ReplaceAllIcon, { size: 16 })
|
|
1445
958
|
}
|
|
1446
959
|
)
|
|
1447
|
-
] }) : /* @__PURE__ */ jsx("div", { className: styles$
|
|
960
|
+
] }) : /* @__PURE__ */ jsx("div", { className: styles$c.row, children: /* @__PURE__ */ jsx("span", { className: styles$c.readOnly, children: t.readOnly }) })
|
|
1448
961
|
]
|
|
1449
962
|
}
|
|
1450
963
|
);
|
|
@@ -1615,7 +1128,7 @@ const fileName = "_fileName_1k6n1_205";
|
|
|
1615
1128
|
const actions = "_actions_1k6n1_215";
|
|
1616
1129
|
const progressText = "_progressText_1k6n1_222";
|
|
1617
1130
|
const remove = "_remove_1k6n1_228";
|
|
1618
|
-
const styles$
|
|
1131
|
+
const styles$b = {
|
|
1619
1132
|
wrap,
|
|
1620
1133
|
dropzone,
|
|
1621
1134
|
dragActive,
|
|
@@ -1744,7 +1257,7 @@ function ImageUploadView(props) {
|
|
|
1744
1257
|
files.map(async (file) => ({ file, url: await uploadOne(file) }))
|
|
1745
1258
|
);
|
|
1746
1259
|
const uploaded = settled.filter(
|
|
1747
|
-
(
|
|
1260
|
+
(s4) => s4.url != null
|
|
1748
1261
|
);
|
|
1749
1262
|
if (uploaded.length === 0) return;
|
|
1750
1263
|
const pos = getPos();
|
|
@@ -1790,14 +1303,14 @@ function ImageUploadView(props) {
|
|
|
1790
1303
|
const hasFiles = items.length > 0;
|
|
1791
1304
|
const maxSizeMb = maxSize > 0 ? toMb(maxSize) : null;
|
|
1792
1305
|
const dropzoneClass = [
|
|
1793
|
-
styles$
|
|
1794
|
-
dragActive2 ? styles$
|
|
1795
|
-
dragOver2 ? styles$
|
|
1306
|
+
styles$b.dropzone,
|
|
1307
|
+
dragActive2 ? styles$b.dragActive : "",
|
|
1308
|
+
dragOver2 ? styles$b.dragOver : ""
|
|
1796
1309
|
].filter(Boolean).join(" ");
|
|
1797
1310
|
return /* @__PURE__ */ jsxs(
|
|
1798
1311
|
NodeViewWrapper,
|
|
1799
1312
|
{
|
|
1800
|
-
className: styles$
|
|
1313
|
+
className: styles$b.wrap,
|
|
1801
1314
|
"data-image-upload": "",
|
|
1802
1315
|
tabIndex: editable ? 0 : void 0,
|
|
1803
1316
|
onClick: openPicker,
|
|
@@ -1829,28 +1342,28 @@ function ImageUploadView(props) {
|
|
|
1829
1342
|
},
|
|
1830
1343
|
onDrop,
|
|
1831
1344
|
children: [
|
|
1832
|
-
/* @__PURE__ */ jsxs("span", { className: styles$
|
|
1345
|
+
/* @__PURE__ */ jsxs("span", { className: styles$b.fileShape, "aria-hidden": true, children: [
|
|
1833
1346
|
/* @__PURE__ */ jsx(FileDocIcon, {}),
|
|
1834
1347
|
/* @__PURE__ */ jsx(FileCornerIcon, {}),
|
|
1835
|
-
/* @__PURE__ */ jsx("span", { className: styles$
|
|
1348
|
+
/* @__PURE__ */ jsx("span", { className: styles$b.fileBadge, children: /* @__PURE__ */ jsx(CloudUploadIcon, {}) })
|
|
1836
1349
|
] }),
|
|
1837
|
-
/* @__PURE__ */ jsxs("span", { className: styles$
|
|
1838
|
-
/* @__PURE__ */ jsxs("span", { className: styles$
|
|
1839
|
-
/* @__PURE__ */ jsx("em", { className: styles$
|
|
1350
|
+
/* @__PURE__ */ jsxs("span", { className: styles$b.text, children: [
|
|
1351
|
+
/* @__PURE__ */ jsxs("span", { className: styles$b.textMain, children: [
|
|
1352
|
+
/* @__PURE__ */ jsx("em", { className: styles$b.textEm, children: labels.dropzoneClick }),
|
|
1840
1353
|
labels.dropzoneRest
|
|
1841
1354
|
] }),
|
|
1842
|
-
/* @__PURE__ */ jsx("span", { className: styles$
|
|
1355
|
+
/* @__PURE__ */ jsx("span", { className: styles$b.subtext, children: labels.dropzoneLimits(limit, maxSizeMb) })
|
|
1843
1356
|
] })
|
|
1844
1357
|
]
|
|
1845
1358
|
}
|
|
1846
|
-
) : /* @__PURE__ */ jsxs("div", { className: styles$
|
|
1847
|
-
items.length > 1 && /* @__PURE__ */ jsxs("div", { className: styles$
|
|
1359
|
+
) : /* @__PURE__ */ jsxs("div", { className: styles$b.previews, "data-image-upload-list": "", children: [
|
|
1360
|
+
items.length > 1 && /* @__PURE__ */ jsxs("div", { className: styles$b.header, children: [
|
|
1848
1361
|
/* @__PURE__ */ jsx("span", { children: labels.uploadingCount(items.length) }),
|
|
1849
1362
|
/* @__PURE__ */ jsx(
|
|
1850
1363
|
"button",
|
|
1851
1364
|
{
|
|
1852
1365
|
type: "button",
|
|
1853
|
-
className: styles$
|
|
1366
|
+
className: styles$b.clearAll,
|
|
1854
1367
|
onClick: (e2) => {
|
|
1855
1368
|
e2.stopPropagation();
|
|
1856
1369
|
clearAll2();
|
|
@@ -1862,27 +1375,27 @@ function ImageUploadView(props) {
|
|
|
1862
1375
|
items.map((it) => /* @__PURE__ */ jsxs(
|
|
1863
1376
|
"div",
|
|
1864
1377
|
{
|
|
1865
|
-
className: styles$
|
|
1378
|
+
className: styles$b.preview,
|
|
1866
1379
|
"data-image-upload-item": "",
|
|
1867
1380
|
children: [
|
|
1868
1381
|
it.status === "uploading" && /* @__PURE__ */ jsx(
|
|
1869
1382
|
"div",
|
|
1870
1383
|
{
|
|
1871
|
-
className: styles$
|
|
1384
|
+
className: styles$b.progress,
|
|
1872
1385
|
style: { width: `${it.progress}%` },
|
|
1873
1386
|
"aria-hidden": true
|
|
1874
1387
|
}
|
|
1875
1388
|
),
|
|
1876
|
-
/* @__PURE__ */ jsxs("div", { className: styles$
|
|
1877
|
-
/* @__PURE__ */ jsxs("span", { className: styles$
|
|
1878
|
-
/* @__PURE__ */ jsx("span", { className: styles$
|
|
1879
|
-
/* @__PURE__ */ jsxs("span", { className: styles$
|
|
1880
|
-
/* @__PURE__ */ jsx("span", { className: styles$
|
|
1881
|
-
/* @__PURE__ */ jsx("span", { className: styles$
|
|
1389
|
+
/* @__PURE__ */ jsxs("div", { className: styles$b.previewContent, children: [
|
|
1390
|
+
/* @__PURE__ */ jsxs("span", { className: styles$b.fileInfo, children: [
|
|
1391
|
+
/* @__PURE__ */ jsx("span", { className: styles$b.fileIcon, "aria-hidden": true, children: /* @__PURE__ */ jsx(CloudUploadIcon, {}) }),
|
|
1392
|
+
/* @__PURE__ */ jsxs("span", { className: styles$b.details, children: [
|
|
1393
|
+
/* @__PURE__ */ jsx("span", { className: styles$b.fileName, children: it.file.name }),
|
|
1394
|
+
/* @__PURE__ */ jsx("span", { className: styles$b.subtext, children: it.status === "error" ? labels.failed : formatFileSize(it.file.size) })
|
|
1882
1395
|
] })
|
|
1883
1396
|
] }),
|
|
1884
|
-
/* @__PURE__ */ jsxs("span", { className: styles$
|
|
1885
|
-
it.status === "uploading" && /* @__PURE__ */ jsxs("span", { className: styles$
|
|
1397
|
+
/* @__PURE__ */ jsxs("span", { className: styles$b.actions, children: [
|
|
1398
|
+
it.status === "uploading" && /* @__PURE__ */ jsxs("span", { className: styles$b.progressText, children: [
|
|
1886
1399
|
Math.round(it.progress),
|
|
1887
1400
|
"%"
|
|
1888
1401
|
] }),
|
|
@@ -1890,7 +1403,7 @@ function ImageUploadView(props) {
|
|
|
1890
1403
|
"button",
|
|
1891
1404
|
{
|
|
1892
1405
|
type: "button",
|
|
1893
|
-
className: styles$
|
|
1406
|
+
className: styles$b.remove,
|
|
1894
1407
|
"data-image-upload-remove": "",
|
|
1895
1408
|
title: labels.remove,
|
|
1896
1409
|
"aria-label": labels.remove,
|
|
@@ -1949,7 +1462,7 @@ function FileDocIcon() {
|
|
|
1949
1462
|
viewBox: "0 0 43 57",
|
|
1950
1463
|
fill: "none",
|
|
1951
1464
|
"aria-hidden": true,
|
|
1952
|
-
className: styles$
|
|
1465
|
+
className: styles$b.fileShapeDoc,
|
|
1953
1466
|
children: /* @__PURE__ */ jsx(
|
|
1954
1467
|
"path",
|
|
1955
1468
|
{
|
|
@@ -1972,7 +1485,7 @@ function FileCornerIcon() {
|
|
|
1972
1485
|
viewBox: "0 0 10 10",
|
|
1973
1486
|
fill: "currentColor",
|
|
1974
1487
|
"aria-hidden": true,
|
|
1975
|
-
className: styles$
|
|
1488
|
+
className: styles$b.fileShapeCorner,
|
|
1976
1489
|
children: /* @__PURE__ */ jsx("path", { d: "M0 0.75H0.343146C1.40401 0.75 2.42143 1.17143 3.17157 1.92157L8.82843 7.57843C9.57857 8.32857 10 9.34599 10 10.4069V10.75H4C1.79086 10.75 0 8.95914 0 6.75V0.75Z" })
|
|
1977
1490
|
}
|
|
1978
1491
|
);
|
|
@@ -2103,7 +1616,7 @@ const tab = "_tab_xhti8_32";
|
|
|
2103
1616
|
const tabActive = "_tabActive_xhti8_40";
|
|
2104
1617
|
const cell = "_cell_xhti8_71";
|
|
2105
1618
|
const cellActive = "_cellActive_xhti8_72";
|
|
2106
|
-
const styles$
|
|
1619
|
+
const styles$a = {
|
|
2107
1620
|
popupHost: popupHost$1,
|
|
2108
1621
|
panel: panel$1,
|
|
2109
1622
|
menu: menu$3,
|
|
@@ -2243,13 +1756,13 @@ const EmojiSuggestionPopup = forwardRef(function EmojiSuggestionPopup2({ items,
|
|
|
2243
1756
|
[visible, index, command]
|
|
2244
1757
|
);
|
|
2245
1758
|
if (!visible.length) return null;
|
|
2246
|
-
return /* @__PURE__ */ jsxs("div", { className: styles$
|
|
1759
|
+
return /* @__PURE__ */ jsxs("div", { className: styles$a.panel, children: [
|
|
2247
1760
|
/* @__PURE__ */ jsx(
|
|
2248
1761
|
"div",
|
|
2249
1762
|
{
|
|
2250
1763
|
id: gridId,
|
|
2251
1764
|
ref: menuRef,
|
|
2252
|
-
className: styles$
|
|
1765
|
+
className: styles$a.menu,
|
|
2253
1766
|
role: "listbox",
|
|
2254
1767
|
"aria-label": menuLabel,
|
|
2255
1768
|
children: visible.map((item2, i) => {
|
|
@@ -2265,7 +1778,7 @@ const EmojiSuggestionPopup = forwardRef(function EmojiSuggestionPopup2({ items,
|
|
|
2265
1778
|
"aria-label": shortcode,
|
|
2266
1779
|
"aria-selected": i === index,
|
|
2267
1780
|
title: shortcode,
|
|
2268
|
-
className: i === index ? styles$
|
|
1781
|
+
className: i === index ? styles$a.cellActive : styles$a.cell,
|
|
2269
1782
|
tabIndex: -1,
|
|
2270
1783
|
onMouseEnter: () => setIndex(i),
|
|
2271
1784
|
onMouseDown: (event) => {
|
|
@@ -2279,7 +1792,7 @@ const EmojiSuggestionPopup = forwardRef(function EmojiSuggestionPopup2({ items,
|
|
|
2279
1792
|
})
|
|
2280
1793
|
}
|
|
2281
1794
|
),
|
|
2282
|
-
browsing ? /* @__PURE__ */ jsx("div", { className: styles$
|
|
1795
|
+
browsing ? /* @__PURE__ */ jsx("div", { className: styles$a.tabs, role: "tablist", "aria-label": menuLabel, children: categories.map((category) => {
|
|
2283
1796
|
const selected = category.id === activeId;
|
|
2284
1797
|
return /* @__PURE__ */ jsx(
|
|
2285
1798
|
"button",
|
|
@@ -2290,7 +1803,7 @@ const EmojiSuggestionPopup = forwardRef(function EmojiSuggestionPopup2({ items,
|
|
|
2290
1803
|
"aria-controls": gridId,
|
|
2291
1804
|
"aria-label": category.label,
|
|
2292
1805
|
title: category.label,
|
|
2293
|
-
className: selected ? styles$
|
|
1806
|
+
className: selected ? styles$a.tabActive : styles$a.tab,
|
|
2294
1807
|
tabIndex: -1,
|
|
2295
1808
|
onMouseDown: (event) => {
|
|
2296
1809
|
event.preventDefault();
|
|
@@ -2337,7 +1850,7 @@ function configureEmojiSuggestion(extension, enabled) {
|
|
|
2337
1850
|
menuLabel: getEditorBundle(props.editor).emoji.menuLabel,
|
|
2338
1851
|
command: props.command
|
|
2339
1852
|
},
|
|
2340
|
-
className: styles$
|
|
1853
|
+
className: styles$a.popupHost
|
|
2341
1854
|
});
|
|
2342
1855
|
copyThemeVars(props.editor.view.dom, renderer.element);
|
|
2343
1856
|
unmountPopup = props.mount(renderer.element);
|
|
@@ -2379,16 +1892,16 @@ function countWords(text2) {
|
|
|
2379
1892
|
const popupHost = "_popupHost_1noza_11";
|
|
2380
1893
|
const menu$2 = "_menu_1noza_1";
|
|
2381
1894
|
const groupLabel$1 = "_groupLabel_1noza_43";
|
|
2382
|
-
const item$
|
|
2383
|
-
const itemActive$
|
|
1895
|
+
const item$1 = "_item_1noza_53";
|
|
1896
|
+
const itemActive$1 = "_itemActive_1noza_54";
|
|
2384
1897
|
const itemIcon$1 = "_itemIcon_1noza_79";
|
|
2385
1898
|
const itemTitle = "_itemTitle_1noza_102";
|
|
2386
|
-
const styles$
|
|
1899
|
+
const styles$9 = {
|
|
2387
1900
|
popupHost,
|
|
2388
1901
|
menu: menu$2,
|
|
2389
1902
|
groupLabel: groupLabel$1,
|
|
2390
|
-
item: item$
|
|
2391
|
-
itemActive: itemActive$
|
|
1903
|
+
item: item$1,
|
|
1904
|
+
itemActive: itemActive$1,
|
|
2392
1905
|
itemIcon: itemIcon$1,
|
|
2393
1906
|
itemTitle
|
|
2394
1907
|
};
|
|
@@ -2584,11 +2097,11 @@ const SlashMenuPopup = forwardRef(function SlashMenuPopup2({ items, query, menuL
|
|
|
2584
2097
|
);
|
|
2585
2098
|
if (!items.length) return null;
|
|
2586
2099
|
let optionIndex = -1;
|
|
2587
|
-
return /* @__PURE__ */ jsx("div", { className: styles$
|
|
2100
|
+
return /* @__PURE__ */ jsx("div", { className: styles$9.menu, role: "listbox", "aria-label": menuLabel, children: withGroupHeaders(items).map(([header2, item2]) => {
|
|
2588
2101
|
optionIndex += 1;
|
|
2589
2102
|
const i = optionIndex;
|
|
2590
2103
|
return /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
2591
|
-
header2 !== null ? /* @__PURE__ */ jsx("div", { className: styles$
|
|
2104
|
+
header2 !== null ? /* @__PURE__ */ jsx("div", { className: styles$9.groupLabel, "aria-hidden": "true", children: header2 }) : null,
|
|
2592
2105
|
/* @__PURE__ */ jsxs(
|
|
2593
2106
|
"button",
|
|
2594
2107
|
{
|
|
@@ -2596,7 +2109,7 @@ const SlashMenuPopup = forwardRef(function SlashMenuPopup2({ items, query, menuL
|
|
|
2596
2109
|
role: "option",
|
|
2597
2110
|
"aria-selected": i === index,
|
|
2598
2111
|
title: item2.title,
|
|
2599
|
-
className: i === index ? styles$
|
|
2112
|
+
className: i === index ? styles$9.itemActive : styles$9.item,
|
|
2600
2113
|
tabIndex: -1,
|
|
2601
2114
|
onMouseEnter: () => setIndex(i),
|
|
2602
2115
|
onMouseDown: (e2) => {
|
|
@@ -2604,8 +2117,8 @@ const SlashMenuPopup = forwardRef(function SlashMenuPopup2({ items, query, menuL
|
|
|
2604
2117
|
command(item2);
|
|
2605
2118
|
},
|
|
2606
2119
|
children: [
|
|
2607
|
-
item2.icon != null ? /* @__PURE__ */ jsx("span", { className: styles$
|
|
2608
|
-
/* @__PURE__ */ jsx("span", { className: styles$
|
|
2120
|
+
item2.icon != null ? /* @__PURE__ */ jsx("span", { className: styles$9.itemIcon, "aria-hidden": "true", children: item2.icon }) : /* @__PURE__ */ jsx("span", { className: styles$9.itemIcon, "aria-hidden": "true" }),
|
|
2121
|
+
/* @__PURE__ */ jsx("span", { className: styles$9.itemTitle, children: item2.title })
|
|
2609
2122
|
]
|
|
2610
2123
|
}
|
|
2611
2124
|
)
|
|
@@ -2657,7 +2170,7 @@ const SlashMenu = Extension.create({
|
|
|
2657
2170
|
menuLabel: getEditorBundle(props.editor).slashMenu.menuLabel,
|
|
2658
2171
|
command: props.command
|
|
2659
2172
|
},
|
|
2660
|
-
className: styles$
|
|
2173
|
+
className: styles$9.popupHost
|
|
2661
2174
|
}
|
|
2662
2175
|
);
|
|
2663
2176
|
const pmStyle = getComputedStyle(props.editor.view.dom);
|
|
@@ -2710,7 +2223,7 @@ const rowKeys = "_rowKeys_ljnq6_127";
|
|
|
2710
2223
|
const rowMd = "_rowMd_ljnq6_128";
|
|
2711
2224
|
const keycap = "_keycap_ljnq6_138";
|
|
2712
2225
|
const none = "_none_ljnq6_163";
|
|
2713
|
-
const styles$
|
|
2226
|
+
const styles$8 = {
|
|
2714
2227
|
drawer,
|
|
2715
2228
|
closeBtn,
|
|
2716
2229
|
head,
|
|
@@ -2814,7 +2327,7 @@ function ShortcutPanel({
|
|
|
2814
2327
|
return /* @__PURE__ */ jsxs(
|
|
2815
2328
|
"aside",
|
|
2816
2329
|
{
|
|
2817
|
-
className: styles$
|
|
2330
|
+
className: styles$8.drawer,
|
|
2818
2331
|
role: "dialog",
|
|
2819
2332
|
"aria-modal": "false",
|
|
2820
2333
|
"aria-label": t.panelTitle,
|
|
@@ -2823,27 +2336,27 @@ function ShortcutPanel({
|
|
|
2823
2336
|
"button",
|
|
2824
2337
|
{
|
|
2825
2338
|
type: "button",
|
|
2826
|
-
className: styles$
|
|
2339
|
+
className: styles$8.closeBtn,
|
|
2827
2340
|
title: t.close,
|
|
2828
2341
|
"aria-label": t.close,
|
|
2829
2342
|
onClick: onClose,
|
|
2830
2343
|
children: /* @__PURE__ */ jsx(XIcon, { size: 16 })
|
|
2831
2344
|
}
|
|
2832
2345
|
),
|
|
2833
|
-
/* @__PURE__ */ jsxs("div", { className: styles$
|
|
2834
|
-
/* @__PURE__ */ jsx("span", { className: styles$
|
|
2835
|
-
/* @__PURE__ */ jsx("span", { className: styles$
|
|
2836
|
-
/* @__PURE__ */ jsx("span", { className: styles$
|
|
2346
|
+
/* @__PURE__ */ jsxs("div", { className: styles$8.head, children: [
|
|
2347
|
+
/* @__PURE__ */ jsx("span", { className: styles$8.colFormat, children: t.colFormat }),
|
|
2348
|
+
/* @__PURE__ */ jsx("span", { className: styles$8.colShortcut, children: t.colShortcut }),
|
|
2349
|
+
/* @__PURE__ */ jsx("span", { className: styles$8.colMarkdown, children: t.colMarkdown })
|
|
2837
2350
|
] }),
|
|
2838
|
-
/* @__PURE__ */ jsx("div", { className: styles$
|
|
2839
|
-
/* @__PURE__ */ jsx("h3", { className: styles$
|
|
2840
|
-
group2.entries.map((entry) => /* @__PURE__ */ jsxs("div", { className: styles$
|
|
2841
|
-
/* @__PURE__ */ jsx("span", { className: styles$
|
|
2842
|
-
/* @__PURE__ */ jsx("span", { className: styles$
|
|
2843
|
-
/* @__PURE__ */ jsx("span", { className: styles$
|
|
2844
|
-
/* @__PURE__ */ jsx("kbd", { className: styles$
|
|
2845
|
-
entry.markdown.terminator ? /* @__PURE__ */ jsx("kbd", { className: styles$
|
|
2846
|
-
] }) : /* @__PURE__ */ jsx("span", { className: styles$
|
|
2351
|
+
/* @__PURE__ */ jsx("div", { className: styles$8.body, children: groups.map((group2) => /* @__PURE__ */ jsxs("section", { className: styles$8.group, children: [
|
|
2352
|
+
/* @__PURE__ */ jsx("h3", { className: styles$8.groupTitle, children: group2.title }),
|
|
2353
|
+
group2.entries.map((entry) => /* @__PURE__ */ jsxs("div", { className: styles$8.row, children: [
|
|
2354
|
+
/* @__PURE__ */ jsx("span", { className: styles$8.rowLabel, children: entry.label }),
|
|
2355
|
+
/* @__PURE__ */ jsx("span", { className: styles$8.rowKeys, children: entry.keys ? entry.keys.map((key, i) => /* @__PURE__ */ jsx("kbd", { className: styles$8.keycap, children: keycapText(key, mac) }, i)) : /* @__PURE__ */ jsx("span", { className: styles$8.none, children: "—" }) }),
|
|
2356
|
+
/* @__PURE__ */ jsx("span", { className: styles$8.rowMd, children: entry.markdown ? /* @__PURE__ */ jsxs(Fragment$2, { children: [
|
|
2357
|
+
/* @__PURE__ */ jsx("kbd", { className: styles$8.keycap, children: entry.markdown.marker }),
|
|
2358
|
+
entry.markdown.terminator ? /* @__PURE__ */ jsx("kbd", { className: styles$8.keycap, children: entry.markdown.terminator }) : null
|
|
2359
|
+
] }) : /* @__PURE__ */ jsx("span", { className: styles$8.none, children: "—" }) })
|
|
2847
2360
|
] }, entry.id))
|
|
2848
2361
|
] }, group2.id)) })
|
|
2849
2362
|
]
|
|
@@ -2931,8 +2444,8 @@ function buildDecorations(doc, anchors) {
|
|
|
2931
2444
|
bounds.push({ from: offset2, to: offset2 + child.nodeSize });
|
|
2932
2445
|
});
|
|
2933
2446
|
const decorations = [];
|
|
2934
|
-
for (const
|
|
2935
|
-
for (const range of
|
|
2447
|
+
for (const anchor of anchors) {
|
|
2448
|
+
for (const range of anchor.ranges) {
|
|
2936
2449
|
const from = Math.max(0, Math.min(range.from, range.to));
|
|
2937
2450
|
const to = Math.min(doc.content.size, Math.max(range.from, range.to));
|
|
2938
2451
|
if (from >= to) continue;
|
|
@@ -2940,7 +2453,7 @@ function buildDecorations(doc, anchors) {
|
|
|
2940
2453
|
if (bound.to <= from || bound.from >= to) continue;
|
|
2941
2454
|
const attrs = {
|
|
2942
2455
|
class: PENDING_ANCHOR_CLASS,
|
|
2943
|
-
"data-pending-id":
|
|
2456
|
+
"data-pending-id": anchor.id
|
|
2944
2457
|
};
|
|
2945
2458
|
if (from <= bound.from && to >= bound.to) {
|
|
2946
2459
|
decorations.push(Decoration.node(bound.from, bound.to, attrs));
|
|
@@ -3087,7 +2600,7 @@ function ChartView({
|
|
|
3087
2600
|
children: [
|
|
3088
2601
|
(config == null ? void 0 : config.title) ? /* @__PURE__ */ jsx("div", { className: "tmr-chart-title", children: config.title }) : null,
|
|
3089
2602
|
(config == null ? void 0 : config.dataTime) ? /* @__PURE__ */ jsx("div", { className: "tmr-chart-time", children: config.dataTime }) : null,
|
|
3090
|
-
configs.length > 1 ? /* @__PURE__ */ jsx("div", { className: "tmr-chart-tabs", role: "tablist", children: configs.map((
|
|
2603
|
+
configs.length > 1 ? /* @__PURE__ */ jsx("div", { className: "tmr-chart-tabs", role: "tablist", children: configs.map((c2, i) => /* @__PURE__ */ jsx(
|
|
3091
2604
|
"button",
|
|
3092
2605
|
{
|
|
3093
2606
|
type: "button",
|
|
@@ -3100,9 +2613,9 @@ function ChartView({
|
|
|
3100
2613
|
e2.stopPropagation();
|
|
3101
2614
|
setActive2(i);
|
|
3102
2615
|
},
|
|
3103
|
-
children: tabLabel(
|
|
2616
|
+
children: tabLabel(c2.chartType, c2.title, i, labels.tabLabel)
|
|
3104
2617
|
},
|
|
3105
|
-
`${
|
|
2618
|
+
`${c2.chartType}-${i}`
|
|
3106
2619
|
)) }) : null,
|
|
3107
2620
|
/* @__PURE__ */ jsx("div", { className: "tmr-chart-canvas-host", style: { height }, children: /* @__PURE__ */ jsx("canvas", { ref: canvasRef }) })
|
|
3108
2621
|
]
|
|
@@ -3143,7 +2656,7 @@ const gutterLine = "_gutterLine_k8th1_184";
|
|
|
3143
2656
|
const readonlyActions = "_readonlyActions_k8th1_188";
|
|
3144
2657
|
const actionBtn = "_actionBtn_k8th1_194";
|
|
3145
2658
|
const langBraces = "_langBraces_k8th1_213";
|
|
3146
|
-
const styles$
|
|
2659
|
+
const styles$7 = {
|
|
3147
2660
|
wrapper,
|
|
3148
2661
|
header,
|
|
3149
2662
|
langTrigger,
|
|
@@ -3238,29 +2751,29 @@ function CodeBlockView({
|
|
|
3238
2751
|
ta.remove();
|
|
3239
2752
|
};
|
|
3240
2753
|
const wrapperClass = [
|
|
3241
|
-
styles$
|
|
3242
|
-
readonly2 ? styles$
|
|
3243
|
-
folded2 ? styles$
|
|
2754
|
+
styles$7.wrapper,
|
|
2755
|
+
readonly2 ? styles$7.readonly : "",
|
|
2756
|
+
folded2 ? styles$7.folded : ""
|
|
3244
2757
|
].filter(Boolean).join(" ");
|
|
3245
2758
|
return /* @__PURE__ */ jsxs(NodeViewWrapper, { className: wrapperClass, children: [
|
|
3246
|
-
editable ? /* @__PURE__ */ jsxs("div", { className: styles$
|
|
2759
|
+
editable ? /* @__PURE__ */ jsxs("div", { className: styles$7.header, contentEditable: false, children: [
|
|
3247
2760
|
/* @__PURE__ */ jsxs(DropdownMenu.Root, { children: [
|
|
3248
2761
|
/* @__PURE__ */ jsx(DropdownMenu.Trigger, { asChild: true, children: /* @__PURE__ */ jsxs(
|
|
3249
2762
|
"button",
|
|
3250
2763
|
{
|
|
3251
2764
|
type: "button",
|
|
3252
|
-
className: styles$
|
|
2765
|
+
className: styles$7.langTrigger,
|
|
3253
2766
|
"aria-label": labels.language,
|
|
3254
2767
|
children: [
|
|
3255
2768
|
/* @__PURE__ */ jsx("span", { children: currentLabel }),
|
|
3256
|
-
/* @__PURE__ */ jsx(ChevronDownIcon, { size: 14, className: styles$
|
|
2769
|
+
/* @__PURE__ */ jsx(ChevronDownIcon, { size: 14, className: styles$7.langChevron })
|
|
3257
2770
|
]
|
|
3258
2771
|
}
|
|
3259
2772
|
) }),
|
|
3260
2773
|
/* @__PURE__ */ jsx(DropdownMenu.Portal, { children: /* @__PURE__ */ jsx(
|
|
3261
2774
|
DropdownMenu.Content,
|
|
3262
2775
|
{
|
|
3263
|
-
className: styles$
|
|
2776
|
+
className: styles$7.langMenu,
|
|
3264
2777
|
sideOffset: 4,
|
|
3265
2778
|
align: "end",
|
|
3266
2779
|
children: LANGUAGES.map((l) => {
|
|
@@ -3269,10 +2782,10 @@ function CodeBlockView({
|
|
|
3269
2782
|
return /* @__PURE__ */ jsxs(
|
|
3270
2783
|
DropdownMenu.Item,
|
|
3271
2784
|
{
|
|
3272
|
-
className: `${styles$
|
|
2785
|
+
className: `${styles$7.langItem}${selected ? ` ${styles$7.langItemSelected}` : ""}`,
|
|
3273
2786
|
onSelect: () => updateAttributes({ language: l.value }),
|
|
3274
2787
|
children: [
|
|
3275
|
-
/* @__PURE__ */ jsx("span", { className: styles$
|
|
2788
|
+
/* @__PURE__ */ jsx("span", { className: styles$7.langItemCheck, children: selected ? /* @__PURE__ */ jsx(CheckIcon, { size: 14 }) : null }),
|
|
3276
2789
|
optionLabel
|
|
3277
2790
|
]
|
|
3278
2791
|
},
|
|
@@ -3286,7 +2799,7 @@ function CodeBlockView({
|
|
|
3286
2799
|
"button",
|
|
3287
2800
|
{
|
|
3288
2801
|
type: "button",
|
|
3289
|
-
className: styles$
|
|
2802
|
+
className: styles$7.deleteBtn,
|
|
3290
2803
|
title: labels.delete,
|
|
3291
2804
|
"aria-label": labels.delete,
|
|
3292
2805
|
onClick: () => deleteNode(),
|
|
@@ -3295,17 +2808,17 @@ function CodeBlockView({
|
|
|
3295
2808
|
)
|
|
3296
2809
|
] }) : (
|
|
3297
2810
|
// 只读头部:左侧语言标签,右侧复制 + 展开收起(展开后按钮保留,供收回)
|
|
3298
|
-
/* @__PURE__ */ jsxs("div", { className: styles$
|
|
3299
|
-
/* @__PURE__ */ jsxs("span", { className: styles$
|
|
3300
|
-
/* @__PURE__ */ jsx("span", { className: styles$
|
|
2811
|
+
/* @__PURE__ */ jsxs("div", { className: styles$7.readonlyHeader, contentEditable: false, children: [
|
|
2812
|
+
/* @__PURE__ */ jsxs("span", { className: styles$7.langBadge, children: [
|
|
2813
|
+
/* @__PURE__ */ jsx("span", { className: styles$7.langBraces, children: "{}" }),
|
|
3301
2814
|
currentLabel
|
|
3302
2815
|
] }),
|
|
3303
|
-
/* @__PURE__ */ jsxs("span", { className: styles$
|
|
2816
|
+
/* @__PURE__ */ jsxs("span", { className: styles$7.readonlyActions, children: [
|
|
3304
2817
|
/* @__PURE__ */ jsx(
|
|
3305
2818
|
"button",
|
|
3306
2819
|
{
|
|
3307
2820
|
type: "button",
|
|
3308
|
-
className: styles$
|
|
2821
|
+
className: styles$7.actionBtn,
|
|
3309
2822
|
onClick: handleCopy,
|
|
3310
2823
|
"aria-label": labels.copy,
|
|
3311
2824
|
title: labels.copy,
|
|
@@ -3316,7 +2829,7 @@ function CodeBlockView({
|
|
|
3316
2829
|
"button",
|
|
3317
2830
|
{
|
|
3318
2831
|
type: "button",
|
|
3319
|
-
className: styles$
|
|
2832
|
+
className: styles$7.actionBtn,
|
|
3320
2833
|
onClick: () => setFolded((v) => !v),
|
|
3321
2834
|
"aria-label": folded2 ? labels.expand : labels.collapse,
|
|
3322
2835
|
title: folded2 ? labels.expand : labels.collapse,
|
|
@@ -3327,14 +2840,14 @@ function CodeBlockView({
|
|
|
3327
2840
|
] })
|
|
3328
2841
|
] })
|
|
3329
2842
|
),
|
|
3330
|
-
/* @__PURE__ */ jsxs("pre", { ref: preRef, className: styles$
|
|
2843
|
+
/* @__PURE__ */ jsxs("pre", { ref: preRef, className: styles$7.pre, children: [
|
|
3331
2844
|
readonly2 ? /* @__PURE__ */ jsx(
|
|
3332
2845
|
"span",
|
|
3333
2846
|
{
|
|
3334
|
-
className: styles$
|
|
2847
|
+
className: styles$7.gutter,
|
|
3335
2848
|
contentEditable: false,
|
|
3336
2849
|
"aria-hidden": "true",
|
|
3337
|
-
children: Array.from({ length: lineCount }, (_, i) => /* @__PURE__ */ jsx("span", { className: styles$
|
|
2850
|
+
children: Array.from({ length: lineCount }, (_, i) => /* @__PURE__ */ jsx("span", { className: styles$7.gutterLine, children: i + 1 }, i))
|
|
3338
2851
|
}
|
|
3339
2852
|
) : null,
|
|
3340
2853
|
/* @__PURE__ */ jsx(NodeViewContent, { as: "code" })
|
|
@@ -3532,8 +3045,8 @@ function deleteBlock(editor, pos) {
|
|
|
3532
3045
|
const parent = $pos.parent;
|
|
3533
3046
|
if ((node.type.name === "listItem" || node.type.name === "taskItem") && parent.childCount === 1) {
|
|
3534
3047
|
from = pos - $pos.parentOffset - 1;
|
|
3535
|
-
const
|
|
3536
|
-
if (
|
|
3048
|
+
const list = editor.state.doc.nodeAt(from);
|
|
3049
|
+
if (list) to = from + list.nodeSize;
|
|
3537
3050
|
}
|
|
3538
3051
|
if (from <= 0 && to >= editor.state.doc.content.size) {
|
|
3539
3052
|
return editor.chain().insertContentAt(
|
|
@@ -3698,9 +3211,9 @@ function placeBlockDropCursor(view, pos) {
|
|
|
3698
3211
|
const $pos = view.state.doc.resolve(pos);
|
|
3699
3212
|
const before = $pos.nodeBefore;
|
|
3700
3213
|
const anchorPos = before ? pos - before.nodeSize : pos;
|
|
3701
|
-
const
|
|
3702
|
-
if (!(
|
|
3703
|
-
const anchorRect =
|
|
3214
|
+
const anchor = view.nodeDOM(anchorPos);
|
|
3215
|
+
if (!(anchor instanceof HTMLElement)) return;
|
|
3216
|
+
const anchorRect = anchor.getBoundingClientRect();
|
|
3704
3217
|
let lineTop = before ? anchorRect.bottom : anchorRect.top;
|
|
3705
3218
|
if (before && $pos.nodeAfter) {
|
|
3706
3219
|
const next = view.nodeDOM(pos);
|
|
@@ -3767,11 +3280,11 @@ const grip = "_grip_5edcs_50";
|
|
|
3767
3280
|
const menu$1 = "_menu_5edcs_61";
|
|
3768
3281
|
const groupLabel = "_groupLabel_5edcs_84";
|
|
3769
3282
|
const divider$3 = "_divider_5edcs_94";
|
|
3770
|
-
const item
|
|
3771
|
-
const itemActive
|
|
3283
|
+
const item = "_item_5edcs_100";
|
|
3284
|
+
const itemActive = "_itemActive_5edcs_118";
|
|
3772
3285
|
const itemDanger = "_itemDanger_5edcs_123";
|
|
3773
3286
|
const itemIcon = "_itemIcon_5edcs_132";
|
|
3774
|
-
const styles$
|
|
3287
|
+
const styles$6 = {
|
|
3775
3288
|
cluster,
|
|
3776
3289
|
clusterOnTable,
|
|
3777
3290
|
button,
|
|
@@ -3779,8 +3292,8 @@ const styles$7 = {
|
|
|
3779
3292
|
menu: menu$1,
|
|
3780
3293
|
groupLabel,
|
|
3781
3294
|
divider: divider$3,
|
|
3782
|
-
item
|
|
3783
|
-
itemActive
|
|
3295
|
+
item,
|
|
3296
|
+
itemActive,
|
|
3784
3297
|
itemDanger,
|
|
3785
3298
|
itemIcon
|
|
3786
3299
|
};
|
|
@@ -3883,9 +3396,9 @@ function BlockDragHandle({ editor }) {
|
|
|
3883
3396
|
}
|
|
3884
3397
|
}, [menu2, editor]);
|
|
3885
3398
|
useEffect(() => () => lockDragHandle(editor, false), [editor, closeMenu]);
|
|
3886
|
-
const openMenu = (
|
|
3399
|
+
const openMenu = (anchor) => {
|
|
3887
3400
|
if (!target) return;
|
|
3888
|
-
const rect =
|
|
3401
|
+
const rect = anchor.getBoundingClientRect();
|
|
3889
3402
|
const estimated = 380;
|
|
3890
3403
|
const y = rect.top + estimated > window.innerHeight ? Math.max(8, window.innerHeight - estimated - 8) : rect.top;
|
|
3891
3404
|
const x = Math.min(rect.right + 6, window.innerWidth - 220);
|
|
@@ -3964,14 +3477,14 @@ function BlockDragHandle({ editor }) {
|
|
|
3964
3477
|
children: /* @__PURE__ */ jsx(
|
|
3965
3478
|
"div",
|
|
3966
3479
|
{
|
|
3967
|
-
className: `${styles$
|
|
3480
|
+
className: `${styles$6.cluster} ${(target == null ? void 0 : target.node.type.name) === "table" ? styles$6.clusterOnTable : ""}`,
|
|
3968
3481
|
"data-block-drag": "",
|
|
3969
3482
|
children: /* @__PURE__ */ jsx(
|
|
3970
3483
|
"div",
|
|
3971
3484
|
{
|
|
3972
3485
|
role: "button",
|
|
3973
3486
|
tabIndex: 0,
|
|
3974
|
-
className: `${styles$
|
|
3487
|
+
className: `${styles$6.button} ${styles$6.grip}`,
|
|
3975
3488
|
"data-block-drag-grip": "",
|
|
3976
3489
|
title: t.dragHandle,
|
|
3977
3490
|
"aria-label": t.dragHandle,
|
|
@@ -4003,7 +3516,7 @@ function BlockDragHandle({ editor }) {
|
|
|
4003
3516
|
"div",
|
|
4004
3517
|
{
|
|
4005
3518
|
ref: menuRef,
|
|
4006
|
-
className: styles$
|
|
3519
|
+
className: styles$6.menu,
|
|
4007
3520
|
"data-block-drag-menu": "",
|
|
4008
3521
|
role: "menu",
|
|
4009
3522
|
"aria-label": t.menuLabel,
|
|
@@ -4011,37 +3524,37 @@ function BlockDragHandle({ editor }) {
|
|
|
4011
3524
|
onMouseDown: (event) => event.stopPropagation(),
|
|
4012
3525
|
children: [
|
|
4013
3526
|
showTurn ? /* @__PURE__ */ jsxs(Fragment$2, { children: [
|
|
4014
|
-
/* @__PURE__ */ jsx("div", { className: styles$
|
|
3527
|
+
/* @__PURE__ */ jsx("div", { className: styles$6.groupLabel, children: t.turnInto }),
|
|
4015
3528
|
TURN_INTO_KINDS.map((kind) => /* @__PURE__ */ jsxs(
|
|
4016
3529
|
"button",
|
|
4017
3530
|
{
|
|
4018
3531
|
type: "button",
|
|
4019
3532
|
role: "menuitem",
|
|
4020
|
-
className: kind === activeKind ? `${styles$
|
|
3533
|
+
className: kind === activeKind ? `${styles$6.item} ${styles$6.itemActive}` : styles$6.item,
|
|
4021
3534
|
"data-block-drag-action": kind,
|
|
4022
3535
|
onClick: () => run(() => turnBlockInto(editor, menu2.pos, kind)),
|
|
4023
3536
|
children: [
|
|
4024
|
-
/* @__PURE__ */ jsx("span", { className: styles$
|
|
3537
|
+
/* @__PURE__ */ jsx("span", { className: styles$6.itemIcon, "aria-hidden": true, children: TURN_ICON[kind] }),
|
|
4025
3538
|
/* @__PURE__ */ jsx("span", { children: turnLabel(kind) })
|
|
4026
3539
|
]
|
|
4027
3540
|
},
|
|
4028
3541
|
kind
|
|
4029
3542
|
)),
|
|
4030
|
-
/* @__PURE__ */ jsx("div", { className: styles$
|
|
3543
|
+
/* @__PURE__ */ jsx("div", { className: styles$6.divider })
|
|
4031
3544
|
] }) : null,
|
|
4032
3545
|
/* @__PURE__ */ jsxs(
|
|
4033
3546
|
"button",
|
|
4034
3547
|
{
|
|
4035
3548
|
type: "button",
|
|
4036
3549
|
role: "menuitem",
|
|
4037
|
-
className: styles$
|
|
3550
|
+
className: styles$6.item,
|
|
4038
3551
|
"data-block-drag-action": "copy",
|
|
4039
3552
|
onClick: () => run(() => {
|
|
4040
3553
|
const markdown = blockMarkdown(editor, menu2.pos);
|
|
4041
3554
|
if (markdown != null) void copyMarkdown(markdown);
|
|
4042
3555
|
}),
|
|
4043
3556
|
children: [
|
|
4044
|
-
/* @__PURE__ */ jsx("span", { className: styles$
|
|
3557
|
+
/* @__PURE__ */ jsx("span", { className: styles$6.itemIcon, "aria-hidden": true, children: /* @__PURE__ */ jsx(CopyIcon, {}) }),
|
|
4045
3558
|
/* @__PURE__ */ jsx("span", { children: t.copy })
|
|
4046
3559
|
]
|
|
4047
3560
|
}
|
|
@@ -4051,11 +3564,11 @@ function BlockDragHandle({ editor }) {
|
|
|
4051
3564
|
{
|
|
4052
3565
|
type: "button",
|
|
4053
3566
|
role: "menuitem",
|
|
4054
|
-
className: styles$
|
|
3567
|
+
className: styles$6.item,
|
|
4055
3568
|
"data-block-drag-action": "duplicate",
|
|
4056
3569
|
onClick: () => run(() => duplicateBlock(editor, menu2.pos)),
|
|
4057
3570
|
children: [
|
|
4058
|
-
/* @__PURE__ */ jsx("span", { className: styles$
|
|
3571
|
+
/* @__PURE__ */ jsx("span", { className: styles$6.itemIcon, "aria-hidden": true, children: /* @__PURE__ */ jsx(CopyIcon, {}) }),
|
|
4059
3572
|
/* @__PURE__ */ jsx("span", { children: t.duplicate })
|
|
4060
3573
|
]
|
|
4061
3574
|
}
|
|
@@ -4065,11 +3578,11 @@ function BlockDragHandle({ editor }) {
|
|
|
4065
3578
|
{
|
|
4066
3579
|
type: "button",
|
|
4067
3580
|
role: "menuitem",
|
|
4068
|
-
className: styles$
|
|
3581
|
+
className: styles$6.item,
|
|
4069
3582
|
"data-block-drag-action": "reset",
|
|
4070
3583
|
onClick: () => run(() => resetBlockFormatting(editor, menu2.pos)),
|
|
4071
3584
|
children: [
|
|
4072
|
-
/* @__PURE__ */ jsx("span", { className: styles$
|
|
3585
|
+
/* @__PURE__ */ jsx("span", { className: styles$6.itemIcon, "aria-hidden": true, children: /* @__PURE__ */ jsx(EraserIcon, {}) }),
|
|
4073
3586
|
/* @__PURE__ */ jsx("span", { children: t.resetFormatting })
|
|
4074
3587
|
]
|
|
4075
3588
|
}
|
|
@@ -4079,26 +3592,26 @@ function BlockDragHandle({ editor }) {
|
|
|
4079
3592
|
{
|
|
4080
3593
|
type: "button",
|
|
4081
3594
|
role: "menuitem",
|
|
4082
|
-
className: styles$
|
|
3595
|
+
className: styles$6.item,
|
|
4083
3596
|
"data-block-drag-action": "download",
|
|
4084
3597
|
onClick: () => run(() => downloadImageBlock(menu2.node)),
|
|
4085
3598
|
children: [
|
|
4086
|
-
/* @__PURE__ */ jsx("span", { className: styles$
|
|
3599
|
+
/* @__PURE__ */ jsx("span", { className: styles$6.itemIcon, "aria-hidden": true, children: /* @__PURE__ */ jsx(DownloadIcon, {}) }),
|
|
4087
3600
|
/* @__PURE__ */ jsx("span", { children: t.downloadImage })
|
|
4088
3601
|
]
|
|
4089
3602
|
}
|
|
4090
3603
|
) : null,
|
|
4091
|
-
/* @__PURE__ */ jsx("div", { className: styles$
|
|
3604
|
+
/* @__PURE__ */ jsx("div", { className: styles$6.divider }),
|
|
4092
3605
|
/* @__PURE__ */ jsxs(
|
|
4093
3606
|
"button",
|
|
4094
3607
|
{
|
|
4095
3608
|
type: "button",
|
|
4096
3609
|
role: "menuitem",
|
|
4097
|
-
className: `${styles$
|
|
3610
|
+
className: `${styles$6.item} ${styles$6.itemDanger}`,
|
|
4098
3611
|
"data-block-drag-action": "delete",
|
|
4099
3612
|
onClick: () => run(() => deleteBlock(editor, menu2.pos)),
|
|
4100
3613
|
children: [
|
|
4101
|
-
/* @__PURE__ */ jsx("span", { className: styles$
|
|
3614
|
+
/* @__PURE__ */ jsx("span", { className: styles$6.itemIcon, "aria-hidden": true, children: /* @__PURE__ */ jsx(TrashIcon, {}) }),
|
|
4102
3615
|
/* @__PURE__ */ jsx("span", { children: t.delete })
|
|
4103
3616
|
]
|
|
4104
3617
|
}
|
|
@@ -4110,221 +3623,6 @@ function BlockDragHandle({ editor }) {
|
|
|
4110
3623
|
) : null
|
|
4111
3624
|
] });
|
|
4112
3625
|
}
|
|
4113
|
-
const anchor = "_anchor_1b977_4";
|
|
4114
|
-
const nav = "_nav_1b977_15";
|
|
4115
|
-
const navOpen = "_navOpen_1b977_16";
|
|
4116
|
-
const list = "_list_1b977_58";
|
|
4117
|
-
const barButton = "_barButton_1b977_64";
|
|
4118
|
-
const bar$1 = "_bar_1b977_64";
|
|
4119
|
-
const barActive = "_barActive_1b977_78";
|
|
4120
|
-
const item = "_item_1b977_89";
|
|
4121
|
-
const itemActive = "_itemActive_1b977_110";
|
|
4122
|
-
const itemText = "_itemText_1b977_117";
|
|
4123
|
-
const styles$6 = {
|
|
4124
|
-
anchor,
|
|
4125
|
-
nav,
|
|
4126
|
-
navOpen,
|
|
4127
|
-
list,
|
|
4128
|
-
barButton,
|
|
4129
|
-
bar: bar$1,
|
|
4130
|
-
barActive,
|
|
4131
|
-
item,
|
|
4132
|
-
itemActive,
|
|
4133
|
-
itemText
|
|
4134
|
-
};
|
|
4135
|
-
function barWidth(level) {
|
|
4136
|
-
if (level <= 1) return 16;
|
|
4137
|
-
if (level === 2) return 12;
|
|
4138
|
-
if (level === 3) return 8;
|
|
4139
|
-
return 6;
|
|
4140
|
-
}
|
|
4141
|
-
function findScrollParent(start) {
|
|
4142
|
-
let node = start.parentElement;
|
|
4143
|
-
while (node && node !== document.documentElement) {
|
|
4144
|
-
const style = getComputedStyle(node);
|
|
4145
|
-
const overflowY = style.overflowY;
|
|
4146
|
-
const canScroll = overflowY === "auto" || overflowY === "scroll" || overflowY === "overlay";
|
|
4147
|
-
if (canScroll && (node.scrollHeight > node.clientHeight + 1 || style.maxHeight !== "none")) {
|
|
4148
|
-
return node;
|
|
4149
|
-
}
|
|
4150
|
-
node = node.parentElement;
|
|
4151
|
-
}
|
|
4152
|
-
return document.scrollingElement ?? document.documentElement;
|
|
4153
|
-
}
|
|
4154
|
-
function isViewportScroller(node) {
|
|
4155
|
-
return node === document.documentElement || node === document.body || node === document.scrollingElement;
|
|
4156
|
-
}
|
|
4157
|
-
function EditorToc({ items, editorDom, locale = "en" }) {
|
|
4158
|
-
var _a;
|
|
4159
|
-
const t = getLocaleBundle(locale).toc;
|
|
4160
|
-
const [open, setOpen] = useState(false);
|
|
4161
|
-
const [activeId, setActiveId] = useState(((_a = items[0]) == null ? void 0 : _a.id) ?? "");
|
|
4162
|
-
const [roving, setRoving] = useState(0);
|
|
4163
|
-
const navRef = useRef(null);
|
|
4164
|
-
const itemRefs = useRef([]);
|
|
4165
|
-
const hideTimer = useRef(null);
|
|
4166
|
-
const clearHide = () => {
|
|
4167
|
-
if (hideTimer.current !== null) {
|
|
4168
|
-
window.clearTimeout(hideTimer.current);
|
|
4169
|
-
hideTimer.current = null;
|
|
4170
|
-
}
|
|
4171
|
-
};
|
|
4172
|
-
const show = () => {
|
|
4173
|
-
clearHide();
|
|
4174
|
-
setOpen(true);
|
|
4175
|
-
};
|
|
4176
|
-
const hideSoon = () => {
|
|
4177
|
-
clearHide();
|
|
4178
|
-
hideTimer.current = window.setTimeout(() => {
|
|
4179
|
-
var _a2;
|
|
4180
|
-
hideTimer.current = null;
|
|
4181
|
-
if ((_a2 = navRef.current) == null ? void 0 : _a2.contains(document.activeElement)) return;
|
|
4182
|
-
setOpen(false);
|
|
4183
|
-
}, 80);
|
|
4184
|
-
};
|
|
4185
|
-
useEffect(() => () => clearHide(), []);
|
|
4186
|
-
useEffect(() => {
|
|
4187
|
-
const headings = items.map(
|
|
4188
|
-
(item2) => editorDom.querySelector(
|
|
4189
|
-
`[data-toc-id="${CSS.escape(item2.id)}"]`
|
|
4190
|
-
)
|
|
4191
|
-
).filter((el) => el !== null);
|
|
4192
|
-
if (!headings.length) return;
|
|
4193
|
-
const scrollParent = findScrollParent(editorDom);
|
|
4194
|
-
const viewport = isViewportScroller(scrollParent);
|
|
4195
|
-
const visible = /* @__PURE__ */ new Set();
|
|
4196
|
-
const apply2 = () => {
|
|
4197
|
-
const rootTop = viewport ? 0 : scrollParent.getBoundingClientRect().top;
|
|
4198
|
-
let best = null;
|
|
4199
|
-
let bestTop = Infinity;
|
|
4200
|
-
for (const el of visible) {
|
|
4201
|
-
const top = el.getBoundingClientRect().top;
|
|
4202
|
-
if (top < bestTop) {
|
|
4203
|
-
bestTop = top;
|
|
4204
|
-
best = el;
|
|
4205
|
-
}
|
|
4206
|
-
}
|
|
4207
|
-
if (!best) {
|
|
4208
|
-
let last = null;
|
|
4209
|
-
for (const heading of headings) {
|
|
4210
|
-
if (heading.getBoundingClientRect().top <= rootTop + 12) last = heading;
|
|
4211
|
-
}
|
|
4212
|
-
best = last ?? headings[0];
|
|
4213
|
-
}
|
|
4214
|
-
const id = best.getAttribute("data-toc-id");
|
|
4215
|
-
if (id) setActiveId(id);
|
|
4216
|
-
};
|
|
4217
|
-
const observer = new IntersectionObserver(
|
|
4218
|
-
(entries) => {
|
|
4219
|
-
for (const entry of entries) {
|
|
4220
|
-
if (entry.isIntersecting) visible.add(entry.target);
|
|
4221
|
-
else visible.delete(entry.target);
|
|
4222
|
-
}
|
|
4223
|
-
apply2();
|
|
4224
|
-
},
|
|
4225
|
-
{
|
|
4226
|
-
root: viewport ? null : scrollParent,
|
|
4227
|
-
rootMargin: "0px 0px -60% 0px",
|
|
4228
|
-
threshold: [0, 1]
|
|
4229
|
-
}
|
|
4230
|
-
);
|
|
4231
|
-
for (const heading of headings) observer.observe(heading);
|
|
4232
|
-
const onScroll = () => apply2();
|
|
4233
|
-
const scrollTarget = viewport ? window : scrollParent;
|
|
4234
|
-
scrollTarget.addEventListener("scroll", onScroll, { passive: true });
|
|
4235
|
-
apply2();
|
|
4236
|
-
return () => {
|
|
4237
|
-
observer.disconnect();
|
|
4238
|
-
scrollTarget.removeEventListener("scroll", onScroll);
|
|
4239
|
-
};
|
|
4240
|
-
}, [items, editorDom]);
|
|
4241
|
-
useEffect(() => {
|
|
4242
|
-
var _a2;
|
|
4243
|
-
if ((_a2 = navRef.current) == null ? void 0 : _a2.contains(document.activeElement)) return;
|
|
4244
|
-
const index = items.findIndex((item2) => item2.id === activeId);
|
|
4245
|
-
if (index >= 0) setRoving(index);
|
|
4246
|
-
}, [activeId, items]);
|
|
4247
|
-
useEffect(() => {
|
|
4248
|
-
var _a2, _b;
|
|
4249
|
-
if (!open || !activeId) return;
|
|
4250
|
-
const reduce = window.matchMedia("(prefers-reduced-motion: reduce)").matches;
|
|
4251
|
-
(_b = (_a2 = navRef.current) == null ? void 0 : _a2.querySelector(`[data-toc-item="${CSS.escape(activeId)}"]`)) == null ? void 0 : _b.scrollIntoView({ block: "nearest", behavior: reduce ? "auto" : "smooth" });
|
|
4252
|
-
}, [activeId, open]);
|
|
4253
|
-
const jump = (item2) => {
|
|
4254
|
-
setActiveId(item2.id);
|
|
4255
|
-
scrollToTocHeading(item2.id, findScrollParent(editorDom));
|
|
4256
|
-
};
|
|
4257
|
-
const move = (delta) => {
|
|
4258
|
-
var _a2;
|
|
4259
|
-
const next = Math.min(items.length - 1, Math.max(0, roving + delta));
|
|
4260
|
-
setRoving(next);
|
|
4261
|
-
setOpen(true);
|
|
4262
|
-
(_a2 = itemRefs.current[next]) == null ? void 0 : _a2.focus();
|
|
4263
|
-
};
|
|
4264
|
-
return /* @__PURE__ */ jsx("div", { className: styles$6.anchor, children: /* @__PURE__ */ jsx(
|
|
4265
|
-
"nav",
|
|
4266
|
-
{
|
|
4267
|
-
ref: navRef,
|
|
4268
|
-
className: open ? styles$6.navOpen : styles$6.nav,
|
|
4269
|
-
"aria-label": t.title,
|
|
4270
|
-
"data-editor-toc": "",
|
|
4271
|
-
onMouseEnter: show,
|
|
4272
|
-
onMouseLeave: hideSoon,
|
|
4273
|
-
onFocus: show,
|
|
4274
|
-
onBlur: (event) => {
|
|
4275
|
-
if (!event.currentTarget.contains(event.relatedTarget)) hideSoon();
|
|
4276
|
-
},
|
|
4277
|
-
onKeyDown: (event) => {
|
|
4278
|
-
if (event.key === "ArrowDown") {
|
|
4279
|
-
event.preventDefault();
|
|
4280
|
-
move(1);
|
|
4281
|
-
} else if (event.key === "ArrowUp") {
|
|
4282
|
-
event.preventDefault();
|
|
4283
|
-
move(-1);
|
|
4284
|
-
} else if (event.key === "Escape") {
|
|
4285
|
-
setOpen(false);
|
|
4286
|
-
}
|
|
4287
|
-
},
|
|
4288
|
-
children: /* @__PURE__ */ jsx("ul", { className: styles$6.list, children: items.map((item2, index) => {
|
|
4289
|
-
const active = item2.id === activeId;
|
|
4290
|
-
return /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsx(
|
|
4291
|
-
"button",
|
|
4292
|
-
{
|
|
4293
|
-
type: "button",
|
|
4294
|
-
ref: (node) => {
|
|
4295
|
-
itemRefs.current[index] = node;
|
|
4296
|
-
},
|
|
4297
|
-
"data-toc-item": item2.id,
|
|
4298
|
-
tabIndex: index === roving ? 0 : -1,
|
|
4299
|
-
className: open ? `${styles$6.item} ${active ? styles$6.itemActive : ""}` : styles$6.barButton,
|
|
4300
|
-
style: open ? { paddingLeft: `${(item2.level - 1) * 12 + 10}px` } : void 0,
|
|
4301
|
-
"aria-current": active ? "true" : void 0,
|
|
4302
|
-
"aria-label": item2.text,
|
|
4303
|
-
onClick: () => jump(item2),
|
|
4304
|
-
children: open ? /* @__PURE__ */ jsx("span", { className: styles$6.itemText, children: item2.text }) : /* @__PURE__ */ jsx(
|
|
4305
|
-
"span",
|
|
4306
|
-
{
|
|
4307
|
-
className: active ? styles$6.barActive : styles$6.bar,
|
|
4308
|
-
style: { width: barWidth(item2.level) }
|
|
4309
|
-
}
|
|
4310
|
-
)
|
|
4311
|
-
}
|
|
4312
|
-
) }, item2.id);
|
|
4313
|
-
}) })
|
|
4314
|
-
}
|
|
4315
|
-
) });
|
|
4316
|
-
}
|
|
4317
|
-
function useIsMobile(breakpoint = 768) {
|
|
4318
|
-
const [isMobile, setIsMobile] = useState(false);
|
|
4319
|
-
useEffect(() => {
|
|
4320
|
-
const mq = window.matchMedia(`(max-width: ${breakpoint - 1}px)`);
|
|
4321
|
-
const update = () => setIsMobile(mq.matches);
|
|
4322
|
-
update();
|
|
4323
|
-
mq.addEventListener("change", update);
|
|
4324
|
-
return () => mq.removeEventListener("change", update);
|
|
4325
|
-
}, [breakpoint]);
|
|
4326
|
-
return isMobile;
|
|
4327
|
-
}
|
|
4328
3626
|
const CodeBlock = CodeBlockLowlight.extend({
|
|
4329
3627
|
// Built-in `code` tokens often win over chart's custom fence tokenizer;
|
|
4330
3628
|
// upgrade ```tmr-chart here so the mid-column card editor renders ChartView.
|
|
@@ -4500,14 +3798,14 @@ function CharacterCountStatus({
|
|
|
4500
3798
|
return /* @__PURE__ */ jsxs(
|
|
4501
3799
|
"div",
|
|
4502
3800
|
{
|
|
4503
|
-
className: styles$
|
|
3801
|
+
className: styles$d.charCount,
|
|
4504
3802
|
role: "group",
|
|
4505
3803
|
"aria-label": t.label,
|
|
4506
3804
|
"data-characters": counts.characters,
|
|
4507
3805
|
"data-words": counts.words,
|
|
4508
3806
|
children: [
|
|
4509
3807
|
/* @__PURE__ */ jsx("span", { children: t.characters(counts.characters) }),
|
|
4510
|
-
/* @__PURE__ */ jsx("span", { className: styles$
|
|
3808
|
+
/* @__PURE__ */ jsx("span", { className: styles$d.charCountSep, "aria-hidden": "true", children: "·" }),
|
|
4511
3809
|
/* @__PURE__ */ jsx("span", { children: t.words(counts.words) })
|
|
4512
3810
|
]
|
|
4513
3811
|
}
|
|
@@ -4535,7 +3833,7 @@ const MarkdownWysiwygEditor = forwardRef(function MarkdownWysiwygEditor2({
|
|
|
4535
3833
|
placeholder,
|
|
4536
3834
|
onEditorReady,
|
|
4537
3835
|
onTocChange,
|
|
4538
|
-
toc =
|
|
3836
|
+
toc = false,
|
|
4539
3837
|
markdownPaste = true,
|
|
4540
3838
|
markdownFileDrop = true,
|
|
4541
3839
|
extraExtensions,
|
|
@@ -4662,7 +3960,7 @@ const MarkdownWysiwygEditor = forwardRef(function MarkdownWysiwygEditor2({
|
|
|
4662
3960
|
immediatelyRender: false,
|
|
4663
3961
|
editorProps: {
|
|
4664
3962
|
attributes: {
|
|
4665
|
-
class: styles$
|
|
3963
|
+
class: styles$d.editorContent
|
|
4666
3964
|
}
|
|
4667
3965
|
}
|
|
4668
3966
|
});
|
|
@@ -4738,7 +4036,7 @@ const MarkdownWysiwygEditor = forwardRef(function MarkdownWysiwygEditor2({
|
|
|
4738
4036
|
const commentsSignatureRef = useRef("");
|
|
4739
4037
|
useEffect(() => {
|
|
4740
4038
|
if (!editor || !editable) return;
|
|
4741
|
-
const signature = (comments ?? []).map((
|
|
4039
|
+
const signature = (comments ?? []).map((c2) => `${c2.commentId}:${c2.segments.length}`).join("|");
|
|
4742
4040
|
if (signature === commentsSignatureRef.current) return;
|
|
4743
4041
|
commentsSignatureRef.current = signature;
|
|
4744
4042
|
applyCommentAnchorsToEditor(editor, comments ?? []);
|
|
@@ -4862,7 +4160,7 @@ const MarkdownWysiwygEditor = forwardRef(function MarkdownWysiwygEditor2({
|
|
|
4862
4160
|
locale,
|
|
4863
4161
|
onClose: closeFind,
|
|
4864
4162
|
inputRef: findInputRef,
|
|
4865
|
-
className: styles$
|
|
4163
|
+
className: styles$d.findBar,
|
|
4866
4164
|
style: findBarOffsetStyle(findBarOffset)
|
|
4867
4165
|
}
|
|
4868
4166
|
) : null;
|
|
@@ -4879,7 +4177,7 @@ const MarkdownWysiwygEditor = forwardRef(function MarkdownWysiwygEditor2({
|
|
|
4879
4177
|
"button",
|
|
4880
4178
|
{
|
|
4881
4179
|
type: "button",
|
|
4882
|
-
className: shortcutFabTarget ? `${styles$
|
|
4180
|
+
className: shortcutFabTarget ? `${styles$d.shortcutFab} ${styles$d.shortcutFabHosted}` : styles$d.shortcutFab,
|
|
4883
4181
|
title: shortcutT.panelTitle,
|
|
4884
4182
|
"aria-label": shortcutT.panelTitle,
|
|
4885
4183
|
"aria-expanded": shortcutsOpen,
|
|
@@ -4890,10 +4188,10 @@ const MarkdownWysiwygEditor = forwardRef(function MarkdownWysiwygEditor2({
|
|
|
4890
4188
|
return /* @__PURE__ */ jsxs(
|
|
4891
4189
|
"div",
|
|
4892
4190
|
{
|
|
4893
|
-
className: styles$
|
|
4191
|
+
className: styles$d.editorHost,
|
|
4894
4192
|
"data-block-drag-gutter": showBlockDrag ? "" : void 0,
|
|
4895
4193
|
children: [
|
|
4896
|
-
findBarNode && !findBarTarget ? /* @__PURE__ */ jsx("div", { className: styles$
|
|
4194
|
+
findBarNode && !findBarTarget ? /* @__PURE__ */ jsx("div", { className: styles$d.findBarAnchor, children: findBarNode }) : null,
|
|
4897
4195
|
findBarNode && findBarTarget ? createPortal(findBarNode, findBarTarget) : null,
|
|
4898
4196
|
editor && toc && !blockDragMobile && tocItems.length > 0 ? /* @__PURE__ */ jsx(
|
|
4899
4197
|
EditorToc,
|
|
@@ -4908,15 +4206,15 @@ const MarkdownWysiwygEditor = forwardRef(function MarkdownWysiwygEditor2({
|
|
|
4908
4206
|
{
|
|
4909
4207
|
editor,
|
|
4910
4208
|
className: [
|
|
4911
|
-
styles$
|
|
4912
|
-
showBlockDrag ? styles$
|
|
4913
|
-
toc && !blockDragMobile && tocItems.length > 0 ? styles$
|
|
4209
|
+
styles$d.editorScroll,
|
|
4210
|
+
showBlockDrag ? styles$d.withBlockDrag : "",
|
|
4211
|
+
toc && !blockDragMobile && tocItems.length > 0 ? styles$d.withToc : "",
|
|
4914
4212
|
className ?? ""
|
|
4915
4213
|
].filter(Boolean).join(" ")
|
|
4916
4214
|
}
|
|
4917
4215
|
),
|
|
4918
4216
|
editor && showBlockDrag ? /* @__PURE__ */ jsx(BlockDragHandle, { editor }) : null,
|
|
4919
|
-
editor && characterCount ? /* @__PURE__ */ jsxs("div", { className: styles$
|
|
4217
|
+
editor && characterCount ? /* @__PURE__ */ jsxs("div", { className: styles$d.editorStatus, children: [
|
|
4920
4218
|
/* @__PURE__ */ jsx(CharacterCountStatus, { editor, locale }),
|
|
4921
4219
|
shortcutFabNode && !shortcutFabTarget ? shortcutFabNode : null
|
|
4922
4220
|
] }) : shortcutFabNode && !shortcutFabTarget ? shortcutFabNode : null,
|
|
@@ -4938,8 +4236,12 @@ function MarkdownPreview({
|
|
|
4938
4236
|
sources,
|
|
4939
4237
|
renderCitation,
|
|
4940
4238
|
className,
|
|
4941
|
-
locale = "en"
|
|
4239
|
+
locale = "en",
|
|
4240
|
+
toc = false
|
|
4942
4241
|
}) {
|
|
4242
|
+
const mobile = useIsMobile(768);
|
|
4243
|
+
const [tocItems, setTocItems] = useState([]);
|
|
4244
|
+
const tocItemsRef = useRef([]);
|
|
4943
4245
|
const prepared = useMemo(
|
|
4944
4246
|
() => prepareChartMarkdown(
|
|
4945
4247
|
enrichMarkdownCitations(markdown, sources ?? [])
|
|
@@ -4961,9 +4263,22 @@ function MarkdownPreview({
|
|
|
4961
4263
|
pureImage,
|
|
4962
4264
|
createChart({ editable: false }),
|
|
4963
4265
|
createCitationRef({ renderCitation }),
|
|
4964
|
-
Markdown
|
|
4266
|
+
Markdown,
|
|
4267
|
+
TableOfContents.configure({
|
|
4268
|
+
getId: makeTocGetId(),
|
|
4269
|
+
onUpdate: (anchors) => {
|
|
4270
|
+
const next = anchors.filter((anchor) => anchor.originalLevel <= 6 && anchor.textContent.trim()).map((anchor) => ({
|
|
4271
|
+
id: anchor.id,
|
|
4272
|
+
level: anchor.originalLevel,
|
|
4273
|
+
text: anchor.textContent
|
|
4274
|
+
}));
|
|
4275
|
+
if (sameTocItems$1(tocItemsRef.current, next)) return;
|
|
4276
|
+
tocItemsRef.current = next;
|
|
4277
|
+
setTocItems(next);
|
|
4278
|
+
}
|
|
4279
|
+
})
|
|
4965
4280
|
],
|
|
4966
|
-
[renderCitation]
|
|
4281
|
+
[previewCodeBlock, renderCitation]
|
|
4967
4282
|
);
|
|
4968
4283
|
const editor = useEditor(
|
|
4969
4284
|
{
|
|
@@ -4973,7 +4288,7 @@ function MarkdownPreview({
|
|
|
4973
4288
|
editable: false,
|
|
4974
4289
|
immediatelyRender: false,
|
|
4975
4290
|
editorProps: {
|
|
4976
|
-
attributes: { class: styles$
|
|
4291
|
+
attributes: { class: styles$d.editorContent }
|
|
4977
4292
|
}
|
|
4978
4293
|
},
|
|
4979
4294
|
[extensions]
|
|
@@ -4983,13 +4298,17 @@ function MarkdownPreview({
|
|
|
4983
4298
|
if (!editor) return;
|
|
4984
4299
|
editor.commands.setContent(prepared, { contentType: "markdown" });
|
|
4985
4300
|
}, [editor, prepared]);
|
|
4986
|
-
|
|
4987
|
-
|
|
4988
|
-
{
|
|
4989
|
-
|
|
4990
|
-
|
|
4991
|
-
|
|
4992
|
-
|
|
4301
|
+
const showToc = Boolean(editor && toc && !mobile && tocItems.length > 0);
|
|
4302
|
+
return /* @__PURE__ */ jsxs("div", { className: styles$d.editorHost, children: [
|
|
4303
|
+
showToc && editor ? /* @__PURE__ */ jsx(EditorToc, { items: tocItems, editorDom: editor.view.dom, locale }) : null,
|
|
4304
|
+
/* @__PURE__ */ jsx(
|
|
4305
|
+
EditorContent,
|
|
4306
|
+
{
|
|
4307
|
+
editor,
|
|
4308
|
+
className: [className ?? styles$d.editorScroll, showToc ? styles$d.withToc : ""].filter(Boolean).join(" ")
|
|
4309
|
+
}
|
|
4310
|
+
)
|
|
4311
|
+
] });
|
|
4993
4312
|
}
|
|
4994
4313
|
const MD_FILE_RE = /\.(md|markdown)$/i;
|
|
4995
4314
|
const MD_ACCEPT = ".md,.markdown,text/markdown";
|
|
@@ -5209,32 +4528,32 @@ function ColorPalette({ value, onPick, locale = "en" }) {
|
|
|
5209
4528
|
]
|
|
5210
4529
|
}
|
|
5211
4530
|
),
|
|
5212
|
-
/* @__PURE__ */ jsx("div", { className: styles$4.grid, children: PALETTE.flat().map((
|
|
4531
|
+
/* @__PURE__ */ jsx("div", { className: styles$4.grid, children: PALETTE.flat().map((c2) => /* @__PURE__ */ jsx(
|
|
5213
4532
|
"button",
|
|
5214
4533
|
{
|
|
5215
4534
|
type: "button",
|
|
5216
|
-
className: `${styles$4.swatch} ${current ===
|
|
5217
|
-
style: { background:
|
|
5218
|
-
title:
|
|
5219
|
-
"aria-label":
|
|
4535
|
+
className: `${styles$4.swatch} ${current === c2.toLowerCase() ? styles$4.swatchActive : ""}`,
|
|
4536
|
+
style: { background: c2 },
|
|
4537
|
+
title: c2,
|
|
4538
|
+
"aria-label": c2,
|
|
5220
4539
|
onMouseDown: (e2) => e2.preventDefault(),
|
|
5221
|
-
onClick: () => onPick(
|
|
4540
|
+
onClick: () => onPick(c2)
|
|
5222
4541
|
},
|
|
5223
|
-
|
|
4542
|
+
c2
|
|
5224
4543
|
)) }),
|
|
5225
4544
|
/* @__PURE__ */ jsx("div", { className: styles$4.themeLabel, children: t.theme }),
|
|
5226
|
-
/* @__PURE__ */ jsx("div", { className: styles$4.themeRow, children: THEME_COLORS.map((
|
|
4545
|
+
/* @__PURE__ */ jsx("div", { className: styles$4.themeRow, children: THEME_COLORS.map((c2) => /* @__PURE__ */ jsx(
|
|
5227
4546
|
"button",
|
|
5228
4547
|
{
|
|
5229
4548
|
type: "button",
|
|
5230
|
-
className: `${styles$4.swatch} ${current ===
|
|
5231
|
-
style: { background:
|
|
5232
|
-
title:
|
|
5233
|
-
"aria-label":
|
|
4549
|
+
className: `${styles$4.swatch} ${current === c2.toLowerCase() ? styles$4.swatchActive : ""}`,
|
|
4550
|
+
style: { background: c2 },
|
|
4551
|
+
title: c2,
|
|
4552
|
+
"aria-label": c2,
|
|
5234
4553
|
onMouseDown: (e2) => e2.preventDefault(),
|
|
5235
|
-
onClick: () => onPick(
|
|
4554
|
+
onClick: () => onPick(c2)
|
|
5236
4555
|
},
|
|
5237
|
-
|
|
4556
|
+
c2
|
|
5238
4557
|
)) })
|
|
5239
4558
|
] });
|
|
5240
4559
|
}
|
|
@@ -6760,8 +6079,8 @@ function ColorPopover({
|
|
|
6760
6079
|
ColorPalette,
|
|
6761
6080
|
{
|
|
6762
6081
|
value,
|
|
6763
|
-
onPick: (
|
|
6764
|
-
onPick(
|
|
6082
|
+
onPick: (c2) => {
|
|
6083
|
+
onPick(c2);
|
|
6765
6084
|
setOpen(false);
|
|
6766
6085
|
},
|
|
6767
6086
|
locale
|
|
@@ -7646,10 +6965,10 @@ function CommentPopover({
|
|
|
7646
6965
|
] });
|
|
7647
6966
|
}
|
|
7648
6967
|
const PROBE_ID = "__anchor-range-probe__";
|
|
7649
|
-
function findRangeByAnchor(editor,
|
|
7650
|
-
if (!
|
|
6968
|
+
function findRangeByAnchor(editor, anchor) {
|
|
6969
|
+
if (!anchor || !anchor.exact) return null;
|
|
7651
6970
|
const [result] = mapCommentAnchors(editor.state.doc, [
|
|
7652
|
-
{ commentId: PROBE_ID, segments: [
|
|
6971
|
+
{ commentId: PROBE_ID, segments: [anchor] }
|
|
7653
6972
|
]);
|
|
7654
6973
|
const range = result == null ? void 0 : result.ranges[0];
|
|
7655
6974
|
if (!range) return null;
|
|
@@ -7833,9 +7152,9 @@ export {
|
|
|
7833
7152
|
RedoIcon,
|
|
7834
7153
|
ReplaceAllIcon,
|
|
7835
7154
|
ReplaceIcon,
|
|
7836
|
-
|
|
7837
|
-
|
|
7838
|
-
|
|
7155
|
+
R as ReportContent,
|
|
7156
|
+
b as ReportContentInteractive,
|
|
7157
|
+
c as ReportContentWithCharts,
|
|
7839
7158
|
RotateCcwIcon,
|
|
7840
7159
|
RowAfterIcon,
|
|
7841
7160
|
RowBeforeIcon,
|
|
@@ -7904,14 +7223,14 @@ export {
|
|
|
7904
7223
|
resetImageSize,
|
|
7905
7224
|
runFindCommand,
|
|
7906
7225
|
sanitizeLinkUrl,
|
|
7907
|
-
scrollToTocHeading,
|
|
7226
|
+
s as scrollToTocHeading,
|
|
7908
7227
|
selectionKind,
|
|
7909
|
-
|
|
7228
|
+
s2 as serializeChartPayload,
|
|
7910
7229
|
setImageAlign,
|
|
7911
7230
|
setImageAlignAt,
|
|
7912
7231
|
setImageCaption,
|
|
7913
7232
|
setImageCaptionAtPos,
|
|
7914
|
-
|
|
7233
|
+
s3 as stabilizeMarkdown,
|
|
7915
7234
|
stripCommentAnchorMarks,
|
|
7916
7235
|
useIsMobile
|
|
7917
7236
|
};
|