@jvs-milkdown/crepe 1.2.0 → 1.2.2
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/lib/cjs/builder.js +55 -2
- package/lib/cjs/builder.js.map +1 -1
- package/lib/cjs/feature/block-edit/index.js +73 -5
- package/lib/cjs/feature/block-edit/index.js.map +1 -1
- package/lib/cjs/feature/code-mirror/index.js +65 -3
- package/lib/cjs/feature/code-mirror/index.js.map +1 -1
- package/lib/cjs/feature/cursor/index.js +55 -2
- package/lib/cjs/feature/cursor/index.js.map +1 -1
- package/lib/cjs/feature/image-block/index.js +76 -8
- package/lib/cjs/feature/image-block/index.js.map +1 -1
- package/lib/cjs/feature/latex/index.js +55 -2
- package/lib/cjs/feature/latex/index.js.map +1 -1
- package/lib/cjs/feature/link-tooltip/index.js +55 -2
- package/lib/cjs/feature/link-tooltip/index.js.map +1 -1
- package/lib/cjs/feature/list-item/index.js +55 -2
- package/lib/cjs/feature/list-item/index.js.map +1 -1
- package/lib/cjs/feature/placeholder/index.js +55 -2
- package/lib/cjs/feature/placeholder/index.js.map +1 -1
- package/lib/cjs/feature/table/index.js +55 -2
- package/lib/cjs/feature/table/index.js.map +1 -1
- package/lib/cjs/feature/toolbar/index.js +73 -5
- package/lib/cjs/feature/toolbar/index.js.map +1 -1
- package/lib/cjs/index.js +457 -31
- package/lib/cjs/index.js.map +1 -1
- package/lib/esm/builder.js +55 -2
- package/lib/esm/builder.js.map +1 -1
- package/lib/esm/feature/block-edit/index.js +73 -5
- package/lib/esm/feature/block-edit/index.js.map +1 -1
- package/lib/esm/feature/code-mirror/index.js +65 -3
- package/lib/esm/feature/code-mirror/index.js.map +1 -1
- package/lib/esm/feature/cursor/index.js +55 -2
- package/lib/esm/feature/cursor/index.js.map +1 -1
- package/lib/esm/feature/image-block/index.js +76 -8
- package/lib/esm/feature/image-block/index.js.map +1 -1
- package/lib/esm/feature/latex/index.js +55 -2
- package/lib/esm/feature/latex/index.js.map +1 -1
- package/lib/esm/feature/link-tooltip/index.js +55 -2
- package/lib/esm/feature/link-tooltip/index.js.map +1 -1
- package/lib/esm/feature/list-item/index.js +55 -2
- package/lib/esm/feature/list-item/index.js.map +1 -1
- package/lib/esm/feature/placeholder/index.js +55 -2
- package/lib/esm/feature/placeholder/index.js.map +1 -1
- package/lib/esm/feature/table/index.js +55 -2
- package/lib/esm/feature/table/index.js.map +1 -1
- package/lib/esm/feature/toolbar/index.js +73 -5
- package/lib/esm/feature/toolbar/index.js.map +1 -1
- package/lib/esm/index.js +458 -32
- package/lib/esm/index.js.map +1 -1
- package/lib/theme/common/code-mirror.css +13 -0
- package/lib/theme/common/image-block.css +324 -22
- package/lib/theme/common/reset.css +3 -0
- package/lib/theme/common/toolbar.css +27 -2
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/package.json +4 -4
- package/src/core/locale.ts +55 -0
- package/src/feature/block-edit/menu/config.ts +19 -3
- package/src/feature/code-mirror/index.ts +3 -0
- package/src/feature/fixed-toolbar/component.tsx +31 -2
- package/src/feature/fixed-toolbar/config.ts +18 -3
- package/src/feature/fixed-toolbar/document-header.tsx +8 -4
- package/src/feature/fixed-toolbar/index.ts +18 -1
- package/src/feature/fixed-toolbar/menu-bar.tsx +91 -3
- package/src/feature/fixed-toolbar/shortcut-help-modal.tsx +244 -0
- package/src/feature/fixed-toolbar/view-menu-state.ts +9 -0
- package/src/feature/image-block/index.ts +11 -1
- package/src/icons/border.ts +5 -0
- package/src/icons/close.ts +3 -0
- package/src/icons/crop.ts +6 -0
- package/src/icons/index.ts +5 -0
- package/src/icons/keyboard.ts +3 -0
- package/src/icons/word-wrap.ts +6 -0
- package/src/theme/common/code-mirror.css +13 -0
- package/src/theme/common/image-block.css +368 -23
- package/src/theme/common/reset.css +3 -0
- package/src/theme/common/toolbar.css +30 -2
package/lib/cjs/index.js
CHANGED
|
@@ -18,6 +18,7 @@ var utils = require('@jvs-milkdown/kit/utils');
|
|
|
18
18
|
var unistUtilVisit = require('unist-util-visit');
|
|
19
19
|
var imageBlock$1 = require('@jvs-milkdown/kit/component/image-block');
|
|
20
20
|
var commands = require('@jvs-milkdown/kit/prose/commands');
|
|
21
|
+
var schemaList = require('@jvs-milkdown/kit/prose/schema-list');
|
|
21
22
|
var katex = require('katex');
|
|
22
23
|
var commands$1 = require('@codemirror/commands');
|
|
23
24
|
var view = require('@codemirror/view');
|
|
@@ -216,6 +217,10 @@ const clearIcon = `
|
|
|
216
217
|
</svg>
|
|
217
218
|
`;
|
|
218
219
|
|
|
220
|
+
const closeIcon = `
|
|
221
|
+
<svg viewBox="0 0 1024 1024" width="20" height="20"><path d="M619.52 544.448l324.672-324.928a53.632 53.632 0 0 0 0-75.776 53.376 53.376 0 0 0-75.712 0L543.872 468.672l-324.48-324.928a53.376 53.376 0 0 0-75.712 0 53.632 53.632 0 0 0 0 75.776l324.48 324.8-324.48 324.928a53.632 53.632 0 0 0 75.776 75.776l324.416-324.8 324.48 324.8a53.184 53.184 0 0 0 37.952 15.744 53.696 53.696 0 0 0 37.76-91.52l-324.48-324.8z" fill="#6F7588"></path></svg>
|
|
222
|
+
`;
|
|
223
|
+
|
|
219
224
|
const codeIcon = `
|
|
220
225
|
<svg viewBox="0 0 1024 1024" width="24" height="24">
|
|
221
226
|
<path d="M64 830.848V193.152q0-53.504 37.76-91.328Q139.712 64 193.216 64h637.696q53.504 0 91.328 37.76 37.824 37.888 37.824 91.392v637.696q0 53.504-37.76 91.328-37.888 37.824-91.392 37.824H193.152q-53.504 0-91.328-37.76Q64 884.288 64 830.784z m94.72 0q0 34.432 34.432 34.432h637.696q34.432 0 34.432-34.432V193.152q0-34.432-34.432-34.432H193.152q-34.432 0-34.432 34.432v637.696zM278.144 432q-6.592-6.592-10.24-15.296-3.584-8.704-3.584-18.176 0-4.608 0.896-9.216t2.688-8.832q1.792-4.288 4.416-8.192 2.56-3.904 5.824-7.232 3.392-3.2 7.232-5.888 3.84-2.56 8.192-4.352 4.224-1.792 8.896-2.688 4.544-0.96 9.216-0.96 9.408 0 18.112 3.584 8.704 3.648 15.36 10.304L491.968 512q6.72 6.656 10.24 15.36 3.648 8.64 3.648 18.112 0 9.408-3.584 18.112-3.584 8.704-10.24 15.36L345.216 725.76q-6.72 6.72-15.36 10.304-8.768 3.584-18.24 3.584-4.608 0-9.216-0.896-4.48-0.896-8.832-2.688-4.288-1.728-8.192-4.416-3.84-2.56-7.168-5.888-3.328-3.264-5.888-7.104-2.624-3.904-4.416-8.192-1.792-4.288-2.688-8.96-0.96-4.48-0.96-9.216 0-9.408 3.648-18.112 3.584-8.64 10.24-15.36L391.68 545.408 278.144 432z m440.832 299.2H585.472q-4.672 0-9.28-0.896-4.544-0.832-8.832-2.688-4.352-1.792-8.256-4.352-3.84-2.56-7.104-5.952-3.264-3.2-5.952-7.04-2.56-3.968-4.352-8.256-1.728-4.352-2.688-8.896-0.896-4.544-0.896-9.28 0-4.608 0.896-9.216 0.96-4.544 2.688-8.832 1.792-4.352 4.352-8.32 2.688-3.84 5.952-7.04 3.2-3.328 7.168-5.952 3.904-2.56 8.192-4.352 4.288-1.792 8.832-2.688 4.608-0.96 9.28-0.96h133.504q4.736 0 9.28 0.96 4.608 0.896 8.96 2.688 4.224 1.792 8.128 4.352 3.84 2.624 7.104 5.888 3.392 3.328 5.952 7.232 2.624 3.904 4.416 8.192 1.792 4.288 2.624 8.832 0.896 4.608 0.896 9.216 0 4.736-0.896 9.28-0.832 4.608-2.624 8.96-1.792 4.224-4.48 8.128-2.56 3.84-5.888 7.104-3.2 3.392-7.04 5.952-3.968 2.56-8.256 4.352-4.352 1.856-8.896 2.688-4.544 0.896-9.28 0.896z" fill="#363B4C" p-id="16577"></path></svg>
|
|
@@ -612,6 +617,30 @@ const splitCellIcon = `
|
|
|
612
617
|
</svg>
|
|
613
618
|
`;
|
|
614
619
|
|
|
620
|
+
const keyboardIcon = `
|
|
621
|
+
<svg t="1778036070440" class="icon" viewBox="0 0 1024 1024" width="20" height="20"><path d="M934.4 190.08c0-23.68-18.048-42.88-40.192-42.88H129.856c-22.208 0-40.256 19.2-40.256 42.88v643.84c0 23.68 17.984 42.88 40.32 42.88h764.288c22.144 0 40.128-19.2 40.192-42.88V190.08z m-764.352 43.008h683.968v558.016H170.048V233.088z m603.456 343.296c11.072 0 20.16 9.728 20.16 21.44v42.944c0 11.84-9.088 21.44-20.16 21.44H250.56a20.8 20.8 0 0 1-20.16-21.44v-42.88c0-11.904 9.088-21.504 20.16-21.504h522.88z m-422.4-193.088a20.8 20.8 0 0 0-20.096-21.44H250.56a20.8 20.8 0 0 0-20.16 21.44v42.88c0 11.904 9.088 21.504 20.16 21.504h80.448c11.072 0 20.096-9.728 20.096-21.44v-42.944zM512 361.856c11.136 0 20.096 9.6 20.096 21.44v42.88c0 11.84-8.96 21.504-20.096 21.504H431.616a20.8 20.8 0 0 1-20.16-21.44v-42.944c0-11.84 9.024-21.44 20.16-21.44H512z m281.6 21.44a20.8 20.8 0 0 0-20.096-21.44H612.608a20.8 20.8 0 0 0-20.16 21.44v42.88c0 11.904 9.088 21.504 20.16 21.504h160.896a20.928 20.928 0 0 0 20.16-21.44v-42.944z" fill="#363B4C" p-id="13200"></path></svg>
|
|
622
|
+
`;
|
|
623
|
+
|
|
624
|
+
const wordWrapIcon = `
|
|
625
|
+
<svg viewBox="0 0 1024 1024" height="24px"
|
|
626
|
+
width="24px">
|
|
627
|
+
<path d="M128 850.88V173.12q0-4.48 0.896-8.832 0.832-4.352 2.56-8.448 1.664-4.096 4.16-7.808 2.432-3.648 5.568-6.848 3.2-3.136 6.848-5.568 3.712-2.496 7.808-4.16 4.096-1.728 8.448-2.56Q168.704 128 173.12 128q4.48 0 8.832 0.896 4.352 0.832 8.448 2.56 4.096 1.664 7.808 4.16 3.648 2.432 6.848 5.568 3.136 3.2 5.568 6.848 2.496 3.712 4.16 7.808 1.728 4.096 2.56 8.448 0.896 4.416 0.896 8.832v677.76q0 4.48-0.896 8.768-0.832 4.416-2.56 8.512-1.664 4.096-4.16 7.808-2.432 3.648-5.568 6.848-3.2 3.136-6.848 5.568-3.712 2.496-7.808 4.16-4.096 1.728-8.448 2.56-4.416 0.896-8.832 0.896-4.48 0-8.832-0.896-4.352-0.832-8.448-2.56-4.096-1.664-7.808-4.16-3.648-2.432-6.848-5.632-3.136-3.136-5.568-6.784-2.496-3.712-4.16-7.808-1.728-4.096-2.56-8.512Q128 855.296 128 850.88z m677.76 0a45.12 45.12 0 0 0 90.24 0V173.12a45.12 45.12 0 0 0-90.24 0v677.76zM471.232 684.8a46.208 46.208 0 0 1-4.288 0.192h-48l48 48.448c8.832 8.896 13.056 20.288 13.056 32a44.8 44.8 0 0 1-12.992 32 45.184 45.184 0 0 1-64 0L282.24 676.224A44.992 44.992 0 0 1 269.184 640a44.992 44.992 0 0 1 13.056-36.288l120.704-120.704a45.184 45.184 0 1 1 64 64l-47.744 47.744h47.744c2.176 0 4.352 0.128 6.464 0.448h70.656q47.68 0 81.472-33.728 33.728-33.792 33.728-81.472 0-47.744-33.728-81.472Q591.744 364.8 544 364.8H384a44.8 44.8 0 1 1 0-89.6h160q84.8 0 144.832 59.968 59.968 59.968 59.968 144.832 0 84.8-59.968 144.832-60.032 59.968-144.832 59.968H471.232z" fill="#363B4C"></path>
|
|
628
|
+
</svg>
|
|
629
|
+
`;
|
|
630
|
+
|
|
631
|
+
const cropIcon = `
|
|
632
|
+
<svg viewBox="0 0 1024 1024" height="24px" width="24px">
|
|
633
|
+
<path d="M192 128v128H128v64h192V128h-128z m0 0h64v128h-64V128z m512 0v128h192v64H640V128h64z m-512 640H128v-64h192v192h-128v-128z m0 128h64v-128h-64v128z m512 0v-128h192v64h-128v128h-64z m0 0h64v-128h-64v128z" fill="currentColor"/>
|
|
634
|
+
<path d="M256 256h512v512H256z" fill="none" stroke="currentColor" stroke-width="64"/>
|
|
635
|
+
</svg>
|
|
636
|
+
`;
|
|
637
|
+
|
|
638
|
+
const borderIcon = `
|
|
639
|
+
<svg viewBox="0 0 1024 1024" height="24px" width="24px">
|
|
640
|
+
<path d="M160 160h704v704H160z" fill="none" stroke="currentColor" stroke-width="64" stroke-dasharray="64 32"/>
|
|
641
|
+
</svg>
|
|
642
|
+
`;
|
|
643
|
+
|
|
615
644
|
const defaultConfig = {
|
|
616
645
|
[CrepeFeature.CodeMirror]: {
|
|
617
646
|
theme: themeOneDark.oneDark,
|
|
@@ -647,12 +676,17 @@ const zhCN = {
|
|
|
647
676
|
"view.docBackground": "\u6587\u6863\u80CC\u666F\u8272",
|
|
648
677
|
"view.title": "\u663E\u793A\u6807\u9898",
|
|
649
678
|
"view.cover": "\u663E\u793A\u5C01\u9762",
|
|
679
|
+
"view.editorWidth": "\u5185\u5BB9\u5BBD\u5EA6",
|
|
680
|
+
"view.widthDefault": "\u9ED8\u8BA4",
|
|
681
|
+
"view.widthWide": "\u8F83\u5BBD",
|
|
682
|
+
"view.widthFull": "\u5168\u5BBD",
|
|
650
683
|
// code-mirror
|
|
651
684
|
"codeMirror.searchPlaceholder": "\u641C\u7D22\u8BED\u8A00",
|
|
652
685
|
"codeMirror.noResultText": "\u65E0\u7ED3\u679C",
|
|
653
686
|
"codeMirror.previewToggleOptionEdit": "\u7F16\u8F91",
|
|
654
687
|
"codeMirror.previewToggleOptionHide": "\u9690\u85CF",
|
|
655
688
|
"codeMirror.previewLabel": "\u9884\u89C8",
|
|
689
|
+
"codeMirror.wrapText": "\u81EA\u52A8\u6362\u884C",
|
|
656
690
|
// link-tooltip
|
|
657
691
|
"linkTooltip.pasteLink": "\u7C98\u8D34\u94FE\u63A5...",
|
|
658
692
|
// image-block
|
|
@@ -750,7 +784,29 @@ const zhCN = {
|
|
|
750
784
|
"latex.escToExit": "\u6309 ESC \u5B8C\u6210\u8F93\u5165",
|
|
751
785
|
"latex.helpDoc": "\u67E5\u770B\u5E2E\u52A9\u6587\u6863",
|
|
752
786
|
"latex.emptyPlaceholder": "\u6DFB\u52A0 LaTeX \u516C\u5F0F",
|
|
753
|
-
"latex.inputPlaceholder": "\u8BF7\u8F93\u5165\u516C\u5F0F"
|
|
787
|
+
"latex.inputPlaceholder": "\u8BF7\u8F93\u5165\u516C\u5F0F",
|
|
788
|
+
// shortcuts
|
|
789
|
+
"shortcuts.title": "\u952E\u76D8\u5FEB\u6377\u952E",
|
|
790
|
+
"shortcuts.formatting": "\u6587\u672C\u683C\u5F0F",
|
|
791
|
+
"shortcuts.bold": "\u52A0\u7C97",
|
|
792
|
+
"shortcuts.italic": "\u659C\u4F53",
|
|
793
|
+
"shortcuts.underline": "\u4E0B\u5212\u7EBF",
|
|
794
|
+
"shortcuts.strikethrough": "\u5220\u9664\u7EBF",
|
|
795
|
+
"shortcuts.inlineCode": "\u884C\u5185\u4EE3\u7801",
|
|
796
|
+
"shortcuts.highlight": "\u9AD8\u4EAE",
|
|
797
|
+
"shortcuts.paragraph": "\u6BB5\u843D",
|
|
798
|
+
"shortcuts.heading": "\u6807\u9898",
|
|
799
|
+
"shortcuts.block": "\u5757\u7EA7\u5143\u7D20",
|
|
800
|
+
"shortcuts.codeBlock": "\u4EE3\u7801\u5757",
|
|
801
|
+
"shortcuts.blockquote": "\u5F15\u7528",
|
|
802
|
+
"shortcuts.orderedList": "\u6709\u5E8F\u5217\u8868",
|
|
803
|
+
"shortcuts.bulletList": "\u65E0\u5E8F\u5217\u8868",
|
|
804
|
+
"shortcuts.indent": "\u589E\u52A0\u7F29\u8FDB",
|
|
805
|
+
"shortcuts.outdent": "\u51CF\u5C11\u7F29\u8FDB",
|
|
806
|
+
"shortcuts.hardBreak": "\u6362\u884C",
|
|
807
|
+
"shortcuts.history": "\u5386\u53F2\u8BB0\u5F55",
|
|
808
|
+
"shortcuts.undo": "\u64A4\u9500",
|
|
809
|
+
"shortcuts.redo": "\u91CD\u505A"
|
|
754
810
|
};
|
|
755
811
|
const enUS = {
|
|
756
812
|
"handle.add": "Add content",
|
|
@@ -771,11 +827,16 @@ const enUS = {
|
|
|
771
827
|
"view.docBackground": "Document Background",
|
|
772
828
|
"view.title": "Show Title",
|
|
773
829
|
"view.cover": "Show Cover",
|
|
830
|
+
"view.editorWidth": "Content Width",
|
|
831
|
+
"view.widthDefault": "Default",
|
|
832
|
+
"view.widthWide": "Wide",
|
|
833
|
+
"view.widthFull": "Full Width",
|
|
774
834
|
"codeMirror.searchPlaceholder": "Search language",
|
|
775
835
|
"codeMirror.noResultText": "No result",
|
|
776
836
|
"codeMirror.previewToggleOptionEdit": "Edit",
|
|
777
837
|
"codeMirror.previewToggleOptionHide": "Hide",
|
|
778
838
|
"codeMirror.previewLabel": "Preview",
|
|
839
|
+
"codeMirror.wrapText": "Wrap",
|
|
779
840
|
"linkTooltip.pasteLink": "Paste link...",
|
|
780
841
|
"imageBlock.inlineUploadButton": "Upload",
|
|
781
842
|
"imageBlock.inlineUploadPlaceholder": "or paste link",
|
|
@@ -865,7 +926,28 @@ const enUS = {
|
|
|
865
926
|
"latex.escToExit": "Press ESC to finish",
|
|
866
927
|
"latex.helpDoc": "Help Doc",
|
|
867
928
|
"latex.emptyPlaceholder": "Add LaTeX",
|
|
868
|
-
"latex.inputPlaceholder": "Please enter formula"
|
|
929
|
+
"latex.inputPlaceholder": "Please enter formula",
|
|
930
|
+
"shortcuts.title": "Keyboard Shortcuts",
|
|
931
|
+
"shortcuts.formatting": "Text Formatting",
|
|
932
|
+
"shortcuts.bold": "Bold",
|
|
933
|
+
"shortcuts.italic": "Italic",
|
|
934
|
+
"shortcuts.underline": "Underline",
|
|
935
|
+
"shortcuts.strikethrough": "Strikethrough",
|
|
936
|
+
"shortcuts.inlineCode": "Inline Code",
|
|
937
|
+
"shortcuts.highlight": "Highlight",
|
|
938
|
+
"shortcuts.paragraph": "Paragraph",
|
|
939
|
+
"shortcuts.heading": "Heading",
|
|
940
|
+
"shortcuts.block": "Block Elements",
|
|
941
|
+
"shortcuts.codeBlock": "Code Block",
|
|
942
|
+
"shortcuts.blockquote": "Blockquote",
|
|
943
|
+
"shortcuts.orderedList": "Ordered List",
|
|
944
|
+
"shortcuts.bulletList": "Bullet List",
|
|
945
|
+
"shortcuts.indent": "Indent",
|
|
946
|
+
"shortcuts.outdent": "Outdent",
|
|
947
|
+
"shortcuts.hardBreak": "Hard Break",
|
|
948
|
+
"shortcuts.history": "History",
|
|
949
|
+
"shortcuts.undo": "Undo",
|
|
950
|
+
"shortcuts.redo": "Redo"
|
|
869
951
|
};
|
|
870
952
|
const translationsCtx = ctx.createSlice(
|
|
871
953
|
{
|
|
@@ -1912,10 +1994,24 @@ function getGroups$1(filter, config, ctx) {
|
|
|
1912
1994
|
return;
|
|
1913
1995
|
}
|
|
1914
1996
|
convertHeadingToParagraphIfNeeded$1(ctx2);
|
|
1915
|
-
|
|
1916
|
-
|
|
1917
|
-
|
|
1997
|
+
const result = schemaList.wrapInList(bulletList)(view.state, (tr) => {
|
|
1998
|
+
tr.doc.nodesBetween(
|
|
1999
|
+
tr.mapping.map(from),
|
|
2000
|
+
tr.mapping.map(to),
|
|
2001
|
+
(node, pos) => {
|
|
2002
|
+
if (node.type === listItem) {
|
|
2003
|
+
tr.setNodeMarkup(pos, void 0, {
|
|
2004
|
+
...node.attrs,
|
|
2005
|
+
checked: false,
|
|
2006
|
+
listType: "bullet",
|
|
2007
|
+
label: "\u2022"
|
|
2008
|
+
});
|
|
2009
|
+
}
|
|
2010
|
+
}
|
|
2011
|
+
);
|
|
2012
|
+
view.dispatch(tr);
|
|
1918
2013
|
});
|
|
2014
|
+
if (result) return;
|
|
1919
2015
|
}
|
|
1920
2016
|
});
|
|
1921
2017
|
}
|
|
@@ -3171,7 +3267,7 @@ var __accessCheck$5 = (obj, member, msg) => member.has(obj) || __typeError$5("Ca
|
|
|
3171
3267
|
var __privateGet$5 = (obj, member, getter) => (__accessCheck$5(obj, member, "read from private field"), member.get(obj));
|
|
3172
3268
|
var __privateAdd$5 = (obj, member, value) => member.has(obj) ? __typeError$5("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
|
3173
3269
|
var __privateSet$5 = (obj, member, value, setter) => (__accessCheck$5(obj, member, "write to private field"), member.set(obj, value), value);
|
|
3174
|
-
var _content$4, _app$4, _filter, _slashProvider, _activeKey, _view, _programmaticallyPos, _mode, _hideTimeout, _isMenuHovered, _keepOpenUntilClickOutside;
|
|
3270
|
+
var _content$4, _app$4, _filter, _slashProvider, _activeKey, _view$1, _programmaticallyPos, _mode, _hideTimeout, _isMenuHovered, _keepOpenUntilClickOutside;
|
|
3175
3271
|
const menu = slash.slashFactory("CREPE_MENU");
|
|
3176
3272
|
function configureMenu(ctx, config) {
|
|
3177
3273
|
ctx.set(menu.key, {
|
|
@@ -3185,7 +3281,7 @@ class MenuView {
|
|
|
3185
3281
|
__privateAdd$5(this, _filter);
|
|
3186
3282
|
__privateAdd$5(this, _slashProvider);
|
|
3187
3283
|
__privateAdd$5(this, _activeKey);
|
|
3188
|
-
__privateAdd$5(this, _view);
|
|
3284
|
+
__privateAdd$5(this, _view$1);
|
|
3189
3285
|
__privateAdd$5(this, _programmaticallyPos, null);
|
|
3190
3286
|
__privateAdd$5(this, _mode, null);
|
|
3191
3287
|
__privateAdd$5(this, _hideTimeout);
|
|
@@ -3214,7 +3310,7 @@ class MenuView {
|
|
|
3214
3310
|
__privateSet$5(this, _programmaticallyPos, pos);
|
|
3215
3311
|
__privateSet$5(this, _mode, mode);
|
|
3216
3312
|
__privateGet$5(this, _filter).value = "";
|
|
3217
|
-
const node = __privateGet$5(this, _view).state.doc.nodeAt(pos);
|
|
3313
|
+
const node = __privateGet$5(this, _view$1).state.doc.nodeAt(pos);
|
|
3218
3314
|
if (node) {
|
|
3219
3315
|
__privateGet$5(this, _activeKey).value = getBlockKey(node);
|
|
3220
3316
|
} else {
|
|
@@ -3262,7 +3358,7 @@ class MenuView {
|
|
|
3262
3358
|
__privateGet$5(this, _app$4).unmount();
|
|
3263
3359
|
__privateGet$5(this, _content$4).remove();
|
|
3264
3360
|
};
|
|
3265
|
-
__privateSet$5(this, _view, view);
|
|
3361
|
+
__privateSet$5(this, _view$1, view);
|
|
3266
3362
|
const content = document.createElement("div");
|
|
3267
3363
|
content.classList.add("milkdown-slash-menu");
|
|
3268
3364
|
const show = vue.ref(false);
|
|
@@ -3349,7 +3445,7 @@ _app$4 = new WeakMap();
|
|
|
3349
3445
|
_filter = new WeakMap();
|
|
3350
3446
|
_slashProvider = new WeakMap();
|
|
3351
3447
|
_activeKey = new WeakMap();
|
|
3352
|
-
_view = new WeakMap();
|
|
3448
|
+
_view$1 = new WeakMap();
|
|
3353
3449
|
_programmaticallyPos = new WeakMap();
|
|
3354
3450
|
_mode = new WeakMap();
|
|
3355
3451
|
_hideTimeout = new WeakMap();
|
|
@@ -3801,7 +3897,9 @@ const codeMirror = (editor, config = {}) => {
|
|
|
3801
3897
|
},
|
|
3802
3898
|
previewLabel: config.previewLabel || i18n(ctx, "codeMirror.previewLabel"),
|
|
3803
3899
|
previewLoading: config.previewLoading || defaultConfig.previewLoading,
|
|
3804
|
-
previewOnlyByDefault: (_a = config.previewOnlyByDefault) != null ? _a : defaultConfig.previewOnlyByDefault
|
|
3900
|
+
previewOnlyByDefault: (_a = config.previewOnlyByDefault) != null ? _a : defaultConfig.previewOnlyByDefault,
|
|
3901
|
+
wrapText: config.wrapText || i18n(ctx, "codeMirror.wrapText"),
|
|
3902
|
+
wrapIcon: config.wrapIcon || wordWrapIcon
|
|
3805
3903
|
};
|
|
3806
3904
|
});
|
|
3807
3905
|
}).use(codeBlock.codeBlockComponent);
|
|
@@ -6858,6 +6956,11 @@ function randomCover(custom) {
|
|
|
6858
6956
|
return (_a = images[Math.floor(Math.random() * images.length)]) != null ? _a : "";
|
|
6859
6957
|
}
|
|
6860
6958
|
|
|
6959
|
+
const editorWidthMap = {
|
|
6960
|
+
default: "820px",
|
|
6961
|
+
wide: "1020px",
|
|
6962
|
+
full: "none"
|
|
6963
|
+
};
|
|
6861
6964
|
const createViewMenuState = () => vue.reactive({
|
|
6862
6965
|
outlineVisible: false,
|
|
6863
6966
|
outlinePosition: "left",
|
|
@@ -6865,7 +6968,8 @@ const createViewMenuState = () => vue.reactive({
|
|
|
6865
6968
|
documentBackground: null,
|
|
6866
6969
|
showTitle: false,
|
|
6867
6970
|
showCover: false,
|
|
6868
|
-
coverUrl: ""
|
|
6971
|
+
coverUrl: "",
|
|
6972
|
+
editorWidth: "default"
|
|
6869
6973
|
});
|
|
6870
6974
|
const viewMenuStateCtx = utils.$ctx(createViewMenuState(), "viewMenuStateCtx");
|
|
6871
6975
|
|
|
@@ -6949,7 +7053,7 @@ const MenuBar = vue.defineComponent({
|
|
|
6949
7053
|
activeSubmenu.value = menuKey;
|
|
6950
7054
|
};
|
|
6951
7055
|
const closeMenu = (e) => {
|
|
6952
|
-
if (showMenu.value && containerRef.value && !containerRef.value.contains(e.target)) {
|
|
7056
|
+
if (showMenu.value && containerRef.value && !containerRef.value.contains(e.target) && mainRef.value && !mainRef.value.contains(e.target)) {
|
|
6953
7057
|
showMenu.value = false;
|
|
6954
7058
|
activeSubmenu.value = null;
|
|
6955
7059
|
if (rafId) cancelAnimationFrame(rafId);
|
|
@@ -6986,7 +7090,7 @@ const MenuBar = vue.defineComponent({
|
|
|
6986
7090
|
style: {
|
|
6987
7091
|
display: "flex",
|
|
6988
7092
|
alignItems: "center",
|
|
6989
|
-
padding: "0
|
|
7093
|
+
padding: "0 6px 0 0",
|
|
6990
7094
|
position: "relative"
|
|
6991
7095
|
}
|
|
6992
7096
|
},
|
|
@@ -7069,6 +7173,11 @@ const MenuBar = vue.defineComponent({
|
|
|
7069
7173
|
{
|
|
7070
7174
|
key: menuKey,
|
|
7071
7175
|
onMouseenter: () => onMouseEnterItem(menuKey),
|
|
7176
|
+
onMouseleave: () => {
|
|
7177
|
+
if (hasSubmenu(menuKey)) {
|
|
7178
|
+
activeSubmenu.value = null;
|
|
7179
|
+
}
|
|
7180
|
+
},
|
|
7072
7181
|
style: {
|
|
7073
7182
|
position: "relative",
|
|
7074
7183
|
padding: "8px 16px",
|
|
@@ -7316,6 +7425,82 @@ const MenuBar = vue.defineComponent({
|
|
|
7316
7425
|
)
|
|
7317
7426
|
) : null
|
|
7318
7427
|
))
|
|
7428
|
+
),
|
|
7429
|
+
/* @__PURE__ */ vue.h(
|
|
7430
|
+
"div",
|
|
7431
|
+
{
|
|
7432
|
+
style: {
|
|
7433
|
+
height: "1px",
|
|
7434
|
+
background: "var(--crepe-color-outline-variant, #eee)",
|
|
7435
|
+
margin: "4px 0"
|
|
7436
|
+
}
|
|
7437
|
+
}
|
|
7438
|
+
),
|
|
7439
|
+
/* @__PURE__ */ vue.h(
|
|
7440
|
+
"div",
|
|
7441
|
+
{
|
|
7442
|
+
style: {
|
|
7443
|
+
padding: "8px 16px",
|
|
7444
|
+
display: "flex",
|
|
7445
|
+
justifyContent: "space-between",
|
|
7446
|
+
alignItems: "center"
|
|
7447
|
+
}
|
|
7448
|
+
},
|
|
7449
|
+
/* @__PURE__ */ vue.h(
|
|
7450
|
+
"span",
|
|
7451
|
+
{
|
|
7452
|
+
style: {
|
|
7453
|
+
fontSize: "14px",
|
|
7454
|
+
color: "var(--crepe-color-on-surface, #333)"
|
|
7455
|
+
}
|
|
7456
|
+
},
|
|
7457
|
+
i18n(props.ctx, "view.editorWidth") || "\u5185\u5BB9\u5BBD\u5EA6"
|
|
7458
|
+
)
|
|
7459
|
+
),
|
|
7460
|
+
/* @__PURE__ */ vue.h(
|
|
7461
|
+
"div",
|
|
7462
|
+
{
|
|
7463
|
+
style: {
|
|
7464
|
+
padding: "4px 16px 8px",
|
|
7465
|
+
display: "flex",
|
|
7466
|
+
gap: "6px"
|
|
7467
|
+
}
|
|
7468
|
+
},
|
|
7469
|
+
[
|
|
7470
|
+
{
|
|
7471
|
+
key: "default",
|
|
7472
|
+
labelKey: "view.widthDefault"
|
|
7473
|
+
},
|
|
7474
|
+
{
|
|
7475
|
+
key: "wide",
|
|
7476
|
+
labelKey: "view.widthWide"
|
|
7477
|
+
},
|
|
7478
|
+
{
|
|
7479
|
+
key: "full",
|
|
7480
|
+
labelKey: "view.widthFull"
|
|
7481
|
+
}
|
|
7482
|
+
].map(({ key, labelKey }) => /* @__PURE__ */ vue.h(
|
|
7483
|
+
"button",
|
|
7484
|
+
{
|
|
7485
|
+
key,
|
|
7486
|
+
type: "button",
|
|
7487
|
+
onClick: (e) => {
|
|
7488
|
+
e.stopPropagation();
|
|
7489
|
+
state.editorWidth = key;
|
|
7490
|
+
},
|
|
7491
|
+
style: {
|
|
7492
|
+
flex: 1,
|
|
7493
|
+
padding: "4px 0",
|
|
7494
|
+
fontSize: "12px",
|
|
7495
|
+
cursor: "pointer",
|
|
7496
|
+
borderRadius: "4px",
|
|
7497
|
+
border: state.editorWidth === key ? "1px solid var(--crepe-color-primary, #1890ff)" : "1px solid var(--crepe-color-outline-variant, #e8e8e8)",
|
|
7498
|
+
background: state.editorWidth === key ? "var(--crepe-color-primary, #1890ff)" : "transparent",
|
|
7499
|
+
color: state.editorWidth === key ? "#fff" : "var(--crepe-color-on-surface, #333)"
|
|
7500
|
+
}
|
|
7501
|
+
},
|
|
7502
|
+
i18n(props.ctx, labelKey) || key
|
|
7503
|
+
))
|
|
7319
7504
|
)
|
|
7320
7505
|
) : null
|
|
7321
7506
|
);
|
|
@@ -7326,6 +7511,191 @@ const MenuBar = vue.defineComponent({
|
|
|
7326
7511
|
}
|
|
7327
7512
|
});
|
|
7328
7513
|
|
|
7514
|
+
const isMac = typeof navigator !== "undefined" && /Mac|iPod|iPhone|iPad/.test(navigator.platform || navigator.userAgent);
|
|
7515
|
+
function fmt(shortcut) {
|
|
7516
|
+
return shortcut.replace(/Mod/g, isMac ? "\u2318" : "Ctrl").replace(/\+/g, isMac ? "" : "+").replace(/Shift/g, isMac ? "\u21E7" : "Shift").replace(/Alt/g, isMac ? "\u2325" : "Alt");
|
|
7517
|
+
}
|
|
7518
|
+
const leftGroups = [
|
|
7519
|
+
{
|
|
7520
|
+
titleKey: "shortcuts.formatting",
|
|
7521
|
+
items: [
|
|
7522
|
+
{ labelKey: "shortcuts.bold", keys: ["Mod+b"] },
|
|
7523
|
+
{ labelKey: "shortcuts.italic", keys: ["Mod+i"] },
|
|
7524
|
+
{ labelKey: "shortcuts.underline", keys: ["Mod+u"] },
|
|
7525
|
+
{ labelKey: "shortcuts.strikethrough", keys: ["Mod+Alt+x"] },
|
|
7526
|
+
{ labelKey: "shortcuts.inlineCode", keys: ["Mod+e"] },
|
|
7527
|
+
{ labelKey: "shortcuts.highlight", keys: ["Mod+Shift+h"] }
|
|
7528
|
+
]
|
|
7529
|
+
},
|
|
7530
|
+
{
|
|
7531
|
+
titleKey: "shortcuts.paragraph",
|
|
7532
|
+
items: [
|
|
7533
|
+
{ labelKey: "shortcuts.paragraph", keys: ["Mod+Alt+0"] },
|
|
7534
|
+
{ labelKey: "shortcuts.heading", keys: ["Mod+Alt+1~6"] }
|
|
7535
|
+
]
|
|
7536
|
+
}
|
|
7537
|
+
];
|
|
7538
|
+
const rightGroups = [
|
|
7539
|
+
{
|
|
7540
|
+
titleKey: "shortcuts.block",
|
|
7541
|
+
items: [
|
|
7542
|
+
{ labelKey: "shortcuts.codeBlock", keys: ["Mod+Alt+c"] },
|
|
7543
|
+
{ labelKey: "shortcuts.blockquote", keys: ["Mod+Shift+b"] },
|
|
7544
|
+
{ labelKey: "shortcuts.orderedList", keys: ["Mod+Alt+7"] },
|
|
7545
|
+
{ labelKey: "shortcuts.bulletList", keys: ["Mod+Alt+8"] },
|
|
7546
|
+
{ labelKey: "shortcuts.indent", keys: ["Tab", "Mod+]"] },
|
|
7547
|
+
{ labelKey: "shortcuts.outdent", keys: ["Shift+Tab", "Mod+["] },
|
|
7548
|
+
{ labelKey: "shortcuts.hardBreak", keys: ["Shift+Enter"] }
|
|
7549
|
+
]
|
|
7550
|
+
},
|
|
7551
|
+
{
|
|
7552
|
+
titleKey: "shortcuts.history",
|
|
7553
|
+
items: [
|
|
7554
|
+
{ labelKey: "shortcuts.undo", keys: ["Mod+z"] },
|
|
7555
|
+
{ labelKey: "shortcuts.redo", keys: ["Mod+y", "Shift+Mod+z"] }
|
|
7556
|
+
]
|
|
7557
|
+
}
|
|
7558
|
+
];
|
|
7559
|
+
const badgeStyle = {
|
|
7560
|
+
display: "inline-flex",
|
|
7561
|
+
alignItems: "center",
|
|
7562
|
+
justifyContent: "center",
|
|
7563
|
+
minWidth: "22px",
|
|
7564
|
+
height: "22px",
|
|
7565
|
+
padding: "0 6px",
|
|
7566
|
+
borderRadius: "4px",
|
|
7567
|
+
fontSize: "11px",
|
|
7568
|
+
fontFamily: "var(--crepe-font-code, monospace)",
|
|
7569
|
+
backgroundColor: "var(--crepe-color-surface-low, color-mix(in srgb, var(--crepe-color-surface), transparent 60%))",
|
|
7570
|
+
border: "1px solid var(--crepe-color-outline-variant, color-mix(in srgb, var(--crepe-color-outline), transparent 80%))",
|
|
7571
|
+
whiteSpace: "nowrap"
|
|
7572
|
+
};
|
|
7573
|
+
const columnStyle = {
|
|
7574
|
+
flex: 1,
|
|
7575
|
+
minWidth: 0
|
|
7576
|
+
};
|
|
7577
|
+
const groupTitleStyle = {
|
|
7578
|
+
fontSize: "11px",
|
|
7579
|
+
fontWeight: 600,
|
|
7580
|
+
color: "var(--crepe-color-on-surface-variant, #888)",
|
|
7581
|
+
marginBottom: "8px",
|
|
7582
|
+
textTransform: "uppercase",
|
|
7583
|
+
letterSpacing: "0.5px"
|
|
7584
|
+
};
|
|
7585
|
+
const rowStyle = {
|
|
7586
|
+
display: "flex",
|
|
7587
|
+
alignItems: "center",
|
|
7588
|
+
justifyContent: "space-between",
|
|
7589
|
+
padding: "5px 0"
|
|
7590
|
+
};
|
|
7591
|
+
const labelStyle = {
|
|
7592
|
+
fontSize: "13px",
|
|
7593
|
+
color: "var(--crepe-color-on-surface, #333)"
|
|
7594
|
+
};
|
|
7595
|
+
function renderGroup(ctx, group) {
|
|
7596
|
+
return /* @__PURE__ */ vue.h("div", { style: { marginBottom: "16px" }, key: group.titleKey }, /* @__PURE__ */ vue.h("div", { style: groupTitleStyle }, i18n(ctx, group.titleKey)), /* @__PURE__ */ vue.h("div", { style: { display: "flex", flexDirection: "column" } }, group.items.map((item) => /* @__PURE__ */ vue.h("div", { key: item.labelKey, style: rowStyle }, /* @__PURE__ */ vue.h("span", { style: labelStyle }, i18n(ctx, item.labelKey)), /* @__PURE__ */ vue.h("div", { style: { display: "flex", gap: "4px", alignItems: "center" } }, item.keys.map((key, i) => /* @__PURE__ */ vue.h("span", { key: i, style: badgeStyle }, fmt(key))))))));
|
|
7597
|
+
}
|
|
7598
|
+
const ShortcutHelpModal = vue.defineComponent({
|
|
7599
|
+
props: {
|
|
7600
|
+
ctx: { type: Object, required: true },
|
|
7601
|
+
visible: { type: Object, required: true }
|
|
7602
|
+
},
|
|
7603
|
+
setup(props) {
|
|
7604
|
+
const close = () => {
|
|
7605
|
+
props.visible.value = false;
|
|
7606
|
+
};
|
|
7607
|
+
const onKeydown = (e) => {
|
|
7608
|
+
if (e.key === "Escape") close();
|
|
7609
|
+
};
|
|
7610
|
+
vue.onMounted(() => document.addEventListener("keydown", onKeydown));
|
|
7611
|
+
vue.onBeforeUnmount(() => document.removeEventListener("keydown", onKeydown));
|
|
7612
|
+
return () => /* @__PURE__ */ vue.h(
|
|
7613
|
+
"div",
|
|
7614
|
+
{
|
|
7615
|
+
style: {
|
|
7616
|
+
position: "fixed",
|
|
7617
|
+
inset: 0,
|
|
7618
|
+
zIndex: 1e4,
|
|
7619
|
+
background: "rgba(0, 0, 0, 0.4)",
|
|
7620
|
+
display: "flex",
|
|
7621
|
+
alignItems: "center",
|
|
7622
|
+
justifyContent: "center"
|
|
7623
|
+
},
|
|
7624
|
+
onClick: close
|
|
7625
|
+
},
|
|
7626
|
+
/* @__PURE__ */ vue.h(
|
|
7627
|
+
"div",
|
|
7628
|
+
{
|
|
7629
|
+
style: {
|
|
7630
|
+
position: "relative",
|
|
7631
|
+
width: "560px",
|
|
7632
|
+
maxWidth: "calc(100vw - 32px)",
|
|
7633
|
+
background: "var(--crepe-color-surface, #fff)",
|
|
7634
|
+
borderRadius: "12px",
|
|
7635
|
+
boxShadow: "0 8px 32px rgba(0, 0, 0, 0.15)",
|
|
7636
|
+
padding: "20px 24px"
|
|
7637
|
+
},
|
|
7638
|
+
onClick: (e) => e.stopPropagation()
|
|
7639
|
+
},
|
|
7640
|
+
/* @__PURE__ */ vue.h(
|
|
7641
|
+
"div",
|
|
7642
|
+
{
|
|
7643
|
+
style: {
|
|
7644
|
+
display: "flex",
|
|
7645
|
+
alignItems: "center",
|
|
7646
|
+
justifyContent: "space-between",
|
|
7647
|
+
marginBottom: "16px",
|
|
7648
|
+
paddingBottom: "12px",
|
|
7649
|
+
borderBottom: "1px solid var(--crepe-color-outline-variant, color-mix(in srgb, var(--crepe-color-outline), transparent 80%))"
|
|
7650
|
+
}
|
|
7651
|
+
},
|
|
7652
|
+
/* @__PURE__ */ vue.h(
|
|
7653
|
+
"span",
|
|
7654
|
+
{
|
|
7655
|
+
style: {
|
|
7656
|
+
fontSize: "15px",
|
|
7657
|
+
fontWeight: 600,
|
|
7658
|
+
color: "var(--crepe-color-on-surface, #1a1a1a)"
|
|
7659
|
+
}
|
|
7660
|
+
},
|
|
7661
|
+
i18n(props.ctx, "shortcuts.title")
|
|
7662
|
+
),
|
|
7663
|
+
/* @__PURE__ */ vue.h(
|
|
7664
|
+
"button",
|
|
7665
|
+
{
|
|
7666
|
+
type: "button",
|
|
7667
|
+
onClick: close,
|
|
7668
|
+
style: {
|
|
7669
|
+
display: "inline-flex",
|
|
7670
|
+
alignItems: "center",
|
|
7671
|
+
justifyContent: "center",
|
|
7672
|
+
width: "28px",
|
|
7673
|
+
height: "28px",
|
|
7674
|
+
border: "none",
|
|
7675
|
+
background: "transparent",
|
|
7676
|
+
cursor: "pointer",
|
|
7677
|
+
borderRadius: "4px",
|
|
7678
|
+
color: "var(--crepe-color-on-surface-variant, #666)"
|
|
7679
|
+
}
|
|
7680
|
+
},
|
|
7681
|
+
/* @__PURE__ */ vue.h(component.Icon, { icon: closeIcon })
|
|
7682
|
+
)
|
|
7683
|
+
),
|
|
7684
|
+
/* @__PURE__ */ vue.h("div", { style: { display: "flex", gap: "24px" } }, /* @__PURE__ */ vue.h("div", { style: columnStyle }, leftGroups.map((g) => renderGroup(props.ctx, g))), /* @__PURE__ */ vue.h(
|
|
7685
|
+
"div",
|
|
7686
|
+
{
|
|
7687
|
+
style: {
|
|
7688
|
+
width: "1px",
|
|
7689
|
+
flexShrink: 0,
|
|
7690
|
+
backgroundColor: "var(--crepe-color-outline-variant, color-mix(in srgb, var(--crepe-color-outline), transparent 80%))"
|
|
7691
|
+
}
|
|
7692
|
+
}
|
|
7693
|
+
), /* @__PURE__ */ vue.h("div", { style: columnStyle }, rightGroups.map((g) => renderGroup(props.ctx, g))))
|
|
7694
|
+
)
|
|
7695
|
+
);
|
|
7696
|
+
}
|
|
7697
|
+
});
|
|
7698
|
+
|
|
7329
7699
|
const FixedToolbarComponent = vue.defineComponent({
|
|
7330
7700
|
props: {
|
|
7331
7701
|
ctx: { type: Object, required: true },
|
|
@@ -7335,6 +7705,7 @@ const FixedToolbarComponent = vue.defineComponent({
|
|
|
7335
7705
|
config: { type: Object, required: false }
|
|
7336
7706
|
},
|
|
7337
7707
|
setup(props) {
|
|
7708
|
+
const showShortcuts = vue.ref(false);
|
|
7338
7709
|
return () => /* @__PURE__ */ vue.h(
|
|
7339
7710
|
"div",
|
|
7340
7711
|
{
|
|
@@ -7343,7 +7714,7 @@ const FixedToolbarComponent = vue.defineComponent({
|
|
|
7343
7714
|
alignItems: "center",
|
|
7344
7715
|
justifyContent: "center",
|
|
7345
7716
|
width: "100%",
|
|
7346
|
-
gap: "
|
|
7717
|
+
gap: "0px"
|
|
7347
7718
|
}
|
|
7348
7719
|
},
|
|
7349
7720
|
/* @__PURE__ */ vue.h(MenuBar, { ctx: props.ctx, config: props.config }),
|
|
@@ -7368,7 +7739,32 @@ const FixedToolbarComponent = vue.defineComponent({
|
|
|
7368
7739
|
config: props.config,
|
|
7369
7740
|
isFixed: true
|
|
7370
7741
|
}
|
|
7371
|
-
)
|
|
7742
|
+
),
|
|
7743
|
+
/* @__PURE__ */ vue.h(
|
|
7744
|
+
"div",
|
|
7745
|
+
{
|
|
7746
|
+
style: {
|
|
7747
|
+
width: "1px",
|
|
7748
|
+
minWidth: "1px",
|
|
7749
|
+
height: "20px",
|
|
7750
|
+
flexShrink: 0,
|
|
7751
|
+
backgroundColor: "var(--crepe-color-outline-variant, color-mix(in srgb, var(--crepe-color-outline), transparent 80%))"
|
|
7752
|
+
}
|
|
7753
|
+
}
|
|
7754
|
+
),
|
|
7755
|
+
/* @__PURE__ */ vue.h(
|
|
7756
|
+
"button",
|
|
7757
|
+
{
|
|
7758
|
+
type: "button",
|
|
7759
|
+
class: "toolbar-shortcut-btn",
|
|
7760
|
+
title: i18n(props.ctx, "shortcuts.title"),
|
|
7761
|
+
onClick: () => {
|
|
7762
|
+
showShortcuts.value = true;
|
|
7763
|
+
}
|
|
7764
|
+
},
|
|
7765
|
+
/* @__PURE__ */ vue.h(component.Icon, { icon: keyboardIcon })
|
|
7766
|
+
),
|
|
7767
|
+
showShortcuts.value && /* @__PURE__ */ vue.h(ShortcutHelpModal, { ctx: props.ctx, visible: showShortcuts })
|
|
7372
7768
|
);
|
|
7373
7769
|
}
|
|
7374
7770
|
});
|
|
@@ -7738,10 +8134,24 @@ function buildDefaultFixedToolbar(builder, _config, ctx) {
|
|
|
7738
8134
|
return;
|
|
7739
8135
|
}
|
|
7740
8136
|
convertHeadingToParagraphIfNeeded(ctx2);
|
|
7741
|
-
|
|
7742
|
-
|
|
7743
|
-
|
|
8137
|
+
const result = schemaList.wrapInList(bulletList)(view.state, (tr) => {
|
|
8138
|
+
tr.doc.nodesBetween(
|
|
8139
|
+
tr.mapping.map(from),
|
|
8140
|
+
tr.mapping.map(to),
|
|
8141
|
+
(node, pos) => {
|
|
8142
|
+
if (node.type === listItem) {
|
|
8143
|
+
tr.setNodeMarkup(pos, void 0, {
|
|
8144
|
+
...node.attrs,
|
|
8145
|
+
checked: false,
|
|
8146
|
+
listType: "bullet",
|
|
8147
|
+
label: "\u2022"
|
|
8148
|
+
});
|
|
8149
|
+
}
|
|
8150
|
+
}
|
|
8151
|
+
);
|
|
8152
|
+
view.dispatch(tr);
|
|
7744
8153
|
});
|
|
8154
|
+
if (result) return;
|
|
7745
8155
|
}
|
|
7746
8156
|
});
|
|
7747
8157
|
}
|
|
@@ -7968,10 +8378,9 @@ const DocumentHeader = vue.defineComponent({
|
|
|
7968
8378
|
class: "milkdown-document-title-wrapper",
|
|
7969
8379
|
style: {
|
|
7970
8380
|
width: "100%",
|
|
7971
|
-
|
|
7972
|
-
|
|
7973
|
-
padding:
|
|
7974
|
-
// Match ProseMirror padding
|
|
8381
|
+
maxWidth: editorWidthMap[state.editorWidth] === "none" ? void 0 : editorWidthMap[state.editorWidth],
|
|
8382
|
+
margin: editorWidthMap[state.editorWidth] === "none" ? "0" : "0 auto",
|
|
8383
|
+
padding: `40px ${editorWidthMap[state.editorWidth] === "none" ? "80px" : "0"} 0`
|
|
7975
8384
|
}
|
|
7976
8385
|
},
|
|
7977
8386
|
/* @__PURE__ */ vue.h("style", null, `.milkdown-document-title::placeholder { color: #BFBFBF; }`),
|
|
@@ -8396,7 +8805,7 @@ var __accessCheck$3 = (obj, member, msg) => member.has(obj) || __typeError$3("Ca
|
|
|
8396
8805
|
var __privateGet$3 = (obj, member, getter) => (__accessCheck$3(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
|
|
8397
8806
|
var __privateAdd$3 = (obj, member, value) => member.has(obj) ? __typeError$3("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
|
8398
8807
|
var __privateSet$3 = (obj, member, value, setter) => (__accessCheck$3(obj, member, "write to private field"), member.set(obj, value), value);
|
|
8399
|
-
var _content$2, _app$2, _headerContent, _headerApp, _outlineContent, _outlineApp, _watcher, _selection$1, _show$1, _resizeObserver, _updateOutlineGeometry, _scrollContainers;
|
|
8808
|
+
var _content$2, _app$2, _headerContent, _headerApp, _outlineContent, _outlineApp, _watcher, _selection$1, _show$1, _resizeObserver, _updateOutlineGeometry, _scrollContainers, _view;
|
|
8400
8809
|
const fixedToolbarConfig = utils.$ctx(
|
|
8401
8810
|
{},
|
|
8402
8811
|
"fixedToolbarConfigCtx"
|
|
@@ -8416,6 +8825,7 @@ class FixedToolbarView {
|
|
|
8416
8825
|
__privateAdd$3(this, _resizeObserver);
|
|
8417
8826
|
__privateAdd$3(this, _updateOutlineGeometry);
|
|
8418
8827
|
__privateAdd$3(this, _scrollContainers, []);
|
|
8828
|
+
__privateAdd$3(this, _view);
|
|
8419
8829
|
this.update = (view) => {
|
|
8420
8830
|
__privateGet$3(this, _selection$1).value = view.state.selection;
|
|
8421
8831
|
};
|
|
@@ -8437,6 +8847,7 @@ class FixedToolbarView {
|
|
|
8437
8847
|
if (__privateGet$3(this, _outlineApp)) __privateGet$3(this, _outlineApp).unmount();
|
|
8438
8848
|
if (__privateGet$3(this, _outlineContent)) __privateGet$3(this, _outlineContent).remove();
|
|
8439
8849
|
};
|
|
8850
|
+
__privateSet$3(this, _view, view);
|
|
8440
8851
|
const config = ctx.get(fixedToolbarConfig.key);
|
|
8441
8852
|
const content = document.createElement("div");
|
|
8442
8853
|
content.className = "milkdown-fixed-toolbar";
|
|
@@ -8532,7 +8943,8 @@ class FixedToolbarView {
|
|
|
8532
8943
|
viewState.outlinePosition,
|
|
8533
8944
|
viewState.outlineWidth,
|
|
8534
8945
|
viewState.documentBackground,
|
|
8535
|
-
viewState.showCover
|
|
8946
|
+
viewState.showCover,
|
|
8947
|
+
viewState.editorWidth
|
|
8536
8948
|
],
|
|
8537
8949
|
() => {
|
|
8538
8950
|
if (viewState.documentBackground) {
|
|
@@ -8561,6 +8973,17 @@ class FixedToolbarView {
|
|
|
8561
8973
|
__privateGet$3(this, _content$2).style.marginLeft = "0";
|
|
8562
8974
|
__privateGet$3(this, _content$2).style.marginRight = "0";
|
|
8563
8975
|
}
|
|
8976
|
+
const maxWidth = editorWidthMap[viewState.editorWidth];
|
|
8977
|
+
const isFull = maxWidth === "none";
|
|
8978
|
+
const px = isFull ? "80px" : "0";
|
|
8979
|
+
__privateGet$3(this, _view).dom.style.maxWidth = maxWidth;
|
|
8980
|
+
__privateGet$3(this, _view).dom.style.width = isFull ? "100%" : maxWidth;
|
|
8981
|
+
__privateGet$3(this, _view).dom.style.margin = isFull ? "0" : "0 auto";
|
|
8982
|
+
__privateGet$3(this, _view).dom.style.padding = `20px ${px} 0`;
|
|
8983
|
+
if (__privateGet$3(this, _headerContent)) {
|
|
8984
|
+
__privateGet$3(this, _headerContent).style.margin = isFull ? "0" : "0 auto";
|
|
8985
|
+
__privateGet$3(this, _headerContent).style.padding = `0px`;
|
|
8986
|
+
}
|
|
8564
8987
|
vue.nextTick(() => {
|
|
8565
8988
|
var _a;
|
|
8566
8989
|
(_a = __privateGet$3(this, _updateOutlineGeometry)) == null ? void 0 : _a.call(this);
|
|
@@ -8583,6 +9006,7 @@ _show$1 = new WeakMap();
|
|
|
8583
9006
|
_resizeObserver = new WeakMap();
|
|
8584
9007
|
_updateOutlineGeometry = new WeakMap();
|
|
8585
9008
|
_scrollContainers = new WeakMap();
|
|
9009
|
+
_view = new WeakMap();
|
|
8586
9010
|
const fixedToolbarPlugin = utils.$prose((ctx) => {
|
|
8587
9011
|
return new state.Plugin({
|
|
8588
9012
|
key: fixedToolbarKey,
|
|
@@ -8622,17 +9046,19 @@ const imageBlock = (editor, config) => {
|
|
|
8622
9046
|
};
|
|
8623
9047
|
});
|
|
8624
9048
|
ctx.update(imageBlock$1.imageBlockConfig.key, (value) => {
|
|
8625
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i;
|
|
9049
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k;
|
|
8626
9050
|
return {
|
|
8627
9051
|
uploadButton: (_a = config == null ? void 0 : config.blockUploadButton) != null ? _a : i18n(ctx, "imageBlock.blockUploadButton"),
|
|
8628
9052
|
imageIcon: (_b = config == null ? void 0 : config.blockImageIcon) != null ? _b : imageIcon,
|
|
8629
9053
|
captionIcon: (_c = config == null ? void 0 : config.blockCaptionIcon) != null ? _c : captionIcon,
|
|
8630
|
-
|
|
8631
|
-
|
|
8632
|
-
|
|
8633
|
-
|
|
9054
|
+
cropIcon: (_d = config == null ? void 0 : config.blockCropIcon) != null ? _d : cropIcon,
|
|
9055
|
+
borderIcon: (_e = config == null ? void 0 : config.blockBorderIcon) != null ? _e : borderIcon,
|
|
9056
|
+
confirmButton: (_f = config == null ? void 0 : config.blockConfirmButton) != null ? _f : i18n(ctx, "imageBlock.blockConfirmButton"),
|
|
9057
|
+
captionPlaceholderText: (_g = config == null ? void 0 : config.blockCaptionPlaceholderText) != null ? _g : i18n(ctx, "imageBlock.blockCaptionPlaceholder"),
|
|
9058
|
+
uploadPlaceholderText: (_h = config == null ? void 0 : config.blockUploadPlaceholderText) != null ? _h : i18n(ctx, "imageBlock.blockUploadPlaceholder"),
|
|
9059
|
+
onUpload: (_j = (_i = config == null ? void 0 : config.blockOnUpload) != null ? _i : config == null ? void 0 : config.onUpload) != null ? _j : value.onUpload,
|
|
8634
9060
|
proxyDomURL: config == null ? void 0 : config.proxyDomURL,
|
|
8635
|
-
onImageLoadError: (
|
|
9061
|
+
onImageLoadError: (_k = config == null ? void 0 : config.onImageLoadError) != null ? _k : value.onImageLoadError,
|
|
8636
9062
|
maxWidth: config == null ? void 0 : config.maxWidth,
|
|
8637
9063
|
maxHeight: config == null ? void 0 : config.maxHeight
|
|
8638
9064
|
};
|