@jvs-milkdown/crepe 1.2.17 → 1.2.20
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 +4 -0
- package/lib/cjs/builder.js.map +1 -1
- package/lib/cjs/feature/block-edit/index.js +4 -0
- package/lib/cjs/feature/block-edit/index.js.map +1 -1
- package/lib/cjs/feature/code-mirror/index.js +4 -0
- package/lib/cjs/feature/code-mirror/index.js.map +1 -1
- package/lib/cjs/feature/cursor/index.js +4 -0
- package/lib/cjs/feature/cursor/index.js.map +1 -1
- package/lib/cjs/feature/image-block/index.js +4 -0
- package/lib/cjs/feature/image-block/index.js.map +1 -1
- package/lib/cjs/feature/inline-diff/index.js +4 -0
- package/lib/cjs/feature/inline-diff/index.js.map +1 -1
- package/lib/cjs/feature/latex/index.js +4 -0
- package/lib/cjs/feature/latex/index.js.map +1 -1
- package/lib/cjs/feature/link-tooltip/index.js +4 -0
- package/lib/cjs/feature/link-tooltip/index.js.map +1 -1
- package/lib/cjs/feature/list-item/index.js +4 -0
- package/lib/cjs/feature/list-item/index.js.map +1 -1
- package/lib/cjs/feature/placeholder/index.js +4 -0
- package/lib/cjs/feature/placeholder/index.js.map +1 -1
- package/lib/cjs/feature/table/index.js +4 -0
- package/lib/cjs/feature/table/index.js.map +1 -1
- package/lib/cjs/feature/toolbar/index.js +56 -22
- package/lib/cjs/feature/toolbar/index.js.map +1 -1
- package/lib/cjs/index.js +533 -151
- package/lib/cjs/index.js.map +1 -1
- package/lib/esm/builder.js +4 -0
- package/lib/esm/builder.js.map +1 -1
- package/lib/esm/feature/block-edit/index.js +4 -0
- package/lib/esm/feature/block-edit/index.js.map +1 -1
- package/lib/esm/feature/code-mirror/index.js +4 -0
- package/lib/esm/feature/code-mirror/index.js.map +1 -1
- package/lib/esm/feature/cursor/index.js +4 -0
- package/lib/esm/feature/cursor/index.js.map +1 -1
- package/lib/esm/feature/image-block/index.js +4 -0
- package/lib/esm/feature/image-block/index.js.map +1 -1
- package/lib/esm/feature/inline-diff/index.js +4 -0
- package/lib/esm/feature/inline-diff/index.js.map +1 -1
- package/lib/esm/feature/latex/index.js +4 -0
- package/lib/esm/feature/latex/index.js.map +1 -1
- package/lib/esm/feature/link-tooltip/index.js +4 -0
- package/lib/esm/feature/link-tooltip/index.js.map +1 -1
- package/lib/esm/feature/list-item/index.js +4 -0
- package/lib/esm/feature/list-item/index.js.map +1 -1
- package/lib/esm/feature/placeholder/index.js +4 -0
- package/lib/esm/feature/placeholder/index.js.map +1 -1
- package/lib/esm/feature/table/index.js +4 -0
- package/lib/esm/feature/table/index.js.map +1 -1
- package/lib/esm/feature/toolbar/index.js +56 -22
- package/lib/esm/feature/toolbar/index.js.map +1 -1
- package/lib/esm/index.js +700 -318
- package/lib/esm/index.js.map +1 -1
- package/lib/theme/common/toolbar.css +9 -0
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/lib/types/core/crepe.d.ts +2 -1
- package/lib/types/core/crepe.d.ts.map +1 -1
- package/lib/types/core/locale.d.ts +4 -0
- package/lib/types/core/locale.d.ts.map +1 -1
- package/lib/types/feature/fixed-toolbar/component.d.ts +2 -0
- package/lib/types/feature/fixed-toolbar/component.d.ts.map +1 -1
- package/lib/types/feature/fixed-toolbar/config.d.ts.map +1 -1
- package/lib/types/feature/fixed-toolbar/index.d.ts +16 -0
- package/lib/types/feature/fixed-toolbar/index.d.ts.map +1 -1
- package/lib/types/feature/fixed-toolbar/menu-bar.d.ts.map +1 -1
- package/lib/types/feature/toolbar/component.d.ts.map +1 -1
- package/lib/types/icons/export.d.ts +2 -0
- package/lib/types/icons/export.d.ts.map +1 -0
- package/lib/types/icons/import.d.ts +2 -0
- package/lib/types/icons/import.d.ts.map +1 -0
- package/lib/types/icons/index.d.ts +4 -0
- package/lib/types/icons/index.d.ts.map +1 -1
- package/lib/types/icons/redo.d.ts +2 -0
- package/lib/types/icons/redo.d.ts.map +1 -0
- package/lib/types/icons/undo.d.ts +2 -0
- package/lib/types/icons/undo.d.ts.map +1 -0
- package/lib/types/utils/fixed-toolbar-popup-state.d.ts +1 -0
- package/lib/types/utils/fixed-toolbar-popup-state.d.ts.map +1 -1
- package/package.json +116 -62
- package/src/core/crepe.ts +122 -7
- package/src/core/locale.ts +4 -0
- package/src/feature/fixed-toolbar/component.tsx +154 -53
- package/src/feature/fixed-toolbar/config.ts +70 -2
- package/src/feature/fixed-toolbar/index.ts +85 -0
- package/src/feature/fixed-toolbar/menu-bar.tsx +17 -3
- package/src/feature/toolbar/component.tsx +61 -23
- package/src/icons/export.ts +5 -0
- package/src/icons/import.ts +6 -0
- package/src/icons/index.ts +4 -0
- package/src/icons/redo.ts +5 -0
- package/src/icons/undo.ts +5 -0
- package/src/theme/common/toolbar.css +19 -0
- package/src/utils/fixed-toolbar-popup-state.ts +5 -0
- package/LICENSE +0 -21
package/lib/esm/index.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
+
import { replaceAll, $prose as $prose$1, getHTML } from '@jvs-milkdown/utils';
|
|
1
2
|
import { defaultsDeep } from 'lodash-es';
|
|
2
3
|
import { languages } from '@codemirror/language-data';
|
|
3
4
|
import { oneDark } from '@codemirror/theme-one-dark';
|
|
4
5
|
import { createSlice } from '@jvs-milkdown/kit/ctx';
|
|
5
|
-
import { $ctx, $nodeSchema, $view, $remark, $markAttr, $markSchema, $command, $prose, $useKeymap, $inputRule
|
|
6
|
-
import { defineComponent, shallowRef, ref, computed, h, createApp, watchEffect, watch, onUnmounted, Fragment, reactive, onMounted, onBeforeUnmount, nextTick } from 'vue';
|
|
6
|
+
import { $ctx, $nodeSchema, $view, $remark, $markAttr, $markSchema, $command, $prose, $useKeymap, getMarkdown, $inputRule } from '@jvs-milkdown/kit/utils';
|
|
7
|
+
import { defineComponent, shallowRef, ref, computed, h as h$1, createApp, watchEffect, watch, onUnmounted, Fragment, reactive, onMounted, onBeforeUnmount, nextTick } from 'vue';
|
|
7
8
|
import { Icon } from '@jvs-milkdown/kit/component';
|
|
8
9
|
import { blockConfig, block, BlockProvider } from '@jvs-milkdown/kit/plugin/block';
|
|
9
10
|
import { commandsCtx, editorViewCtx, schemaCtx, editorCtx, EditorStatus, parserCtx, editorViewOptionsCtx, Editor, rootCtx, defaultValueCtx } from '@jvs-milkdown/kit/core';
|
|
@@ -25,16 +26,16 @@ import { basicSetup } from 'codemirror';
|
|
|
25
26
|
import { dropIndicatorConfig, cursor as cursor$1 } from '@jvs-milkdown/kit/plugin/cursor';
|
|
26
27
|
import { createVirtualCursor } from 'prosemirror-virtual-cursor';
|
|
27
28
|
import { diffBlockConfig, diffBlock } from '@jvs-milkdown/kit/component/diff-block';
|
|
29
|
+
import { undo, redo } from '@jvs-milkdown/prose/history';
|
|
28
30
|
import { Decoration, DecorationSet, EditorView } from '@jvs-milkdown/kit/prose/view';
|
|
29
31
|
import { mergeCells, splitCell, CellSelection, selectedRect, splitCellWithType } from '@jvs-milkdown/kit/prose/tables';
|
|
30
32
|
import clsx from 'clsx';
|
|
31
33
|
import { toggleLinkCommand, configureLinkTooltip, linkTooltipConfig, linkTooltipPlugin } from '@jvs-milkdown/kit/component/link-tooltip';
|
|
32
34
|
import { inlineImageConfig, imageInlineComponent } from '@jvs-milkdown/kit/component/image-inline';
|
|
33
35
|
import { Plugin as Plugin$1 } from '@jvs-milkdown/prose/state';
|
|
34
|
-
import { $prose as $prose$1 } from '@jvs-milkdown/utils';
|
|
35
36
|
import * as Diff from 'diff';
|
|
36
37
|
import { tooltipFactory, TooltipProvider } from '@jvs-milkdown/kit/plugin/tooltip';
|
|
37
|
-
import { redo, undo } from '@jvs-milkdown/kit/prose/history';
|
|
38
|
+
import { redo as redo$1, undo as undo$1 } from '@jvs-milkdown/kit/prose/history';
|
|
38
39
|
import { keymap as keymap$1 } from '@jvs-milkdown/kit/prose/keymap';
|
|
39
40
|
import { Schema } from '@jvs-milkdown/kit/prose/model';
|
|
40
41
|
import { textblockTypeInputRule } from '@jvs-milkdown/kit/prose/inputrules';
|
|
@@ -649,6 +650,31 @@ const formatPainterIcon = `
|
|
|
649
650
|
</svg>
|
|
650
651
|
`;
|
|
651
652
|
|
|
653
|
+
const undoIcon = `
|
|
654
|
+
<svg viewBox="0 0 1024 1024" version="1.1" width="20" height="20">
|
|
655
|
+
<path d="M328.768 243.52a42.688 42.688 0 0 0-60.352-60.352L97.92 353.664A43.008 43.008 0 0 0 85.248 384a42.56 42.56 0 0 0 12.48 30.208l170.688 170.624a42.688 42.688 0 1 0 60.352-60.288l-97.92-97.92h451.712a170.688 170.688 0 1 1 0 341.376H469.248a42.688 42.688 0 1 0 0 85.312h213.312a256 256 0 1 0 0-512H230.912l97.856-97.792z" fill="currentColor"></path>
|
|
656
|
+
</svg>
|
|
657
|
+
`;
|
|
658
|
+
|
|
659
|
+
const redoIcon = `
|
|
660
|
+
<svg viewBox="0 0 1024 1024" version="1.1" width="20" height="20">
|
|
661
|
+
<path d="M755.584 183.168a42.688 42.688 0 0 0-60.352 60.352l97.856 97.792H341.44a256 256 0 0 0 0 512h213.312a42.688 42.688 0 0 0 0-85.312H341.44a170.688 170.688 0 0 1 0-341.312h451.648l-97.856 97.856a42.688 42.688 0 0 0 60.352 60.288l170.048-170.048a42.56 42.56 0 0 0 0-61.568l-170.048-170.048z" fill="currentColor"></path>
|
|
662
|
+
</svg>
|
|
663
|
+
`;
|
|
664
|
+
|
|
665
|
+
const exportIcon = `
|
|
666
|
+
<svg viewBox="0 0 1024 1024" version="1.1" width="20" height="20">
|
|
667
|
+
<path d="M452.288 725.12L246.016 537.6c-4.928-4.48-10.432-8.832-14.72-13.696-20.8-23.232-21.312-42.944-2.304-59.52 17.664-15.36 43.392-14.976 65.536 4.48 49.088 43.328 32.256 27.712 80.512 71.744l69.376 63.36 11.968 10.688v-173.44c0-33.92-0.128-80.96-0.32-128.448-0.192-51.52-0.32-103.616-0.32-140.16L455.68 163.84a183.04 183.04 0 0 1 0.704-24.896c3.52-29.248 19.328-43.712 45.248-42.88 25.344 0.768 41.088 15.872 42.688 45.504 1.28 22.848 1.024 45.888 0.768 68.864l-0.128 27.136c0 50.048 0.128 112.832 0.256 176.384 0.192 71.552 0.384 144.192 0.32 200.704 74.432-68.224 131.968-119.68 162.688-147.584 7.424-6.72 14.912-14.272 24-18.304 18.688-8.448 37.76-7.808 52.8 7.36 14.72 14.72 16.384 31.36 3.968 48.192-3.84 5.248-8.64 10.112-13.44 14.656-45.76 41.92-189.76 173.248-236.16 214.464a62.336 62.336 0 0 1-8.064 6.016 43.712 43.712 0 0 1-15.872 9.792c-20.544 7.104-37.504-0.512-51.968-13.952l-11.2-10.24z m430.784-37.248c24-0.576 42.176 13.44 43.328 39.04 1.728 38.208 2.944 76.992-1.088 115.136-5.312 50.752-51.52 84.16-114.752 85.312-50.112 0.832-100.224 0.64-150.4 0.512l-64.832-0.128H422.272a26252.8 26252.8 0 0 1-194.432-0.192c-90.624-0.512-130.752-37.696-131.392-120.64l-0.192-17.408c-0.32-19.84-0.576-39.68 0.768-59.392 1.92-27.904 20.48-43.648 45.76-42.368 23.488 1.152 37.312 15.296 40.064 42.368 0.896 9.152 0.832 18.432 0.704 27.648l-0.064 10.816c0.384 71.744 7.36 78.208 88.128 78.272 117.248 0.128 234.432 0.128 351.68 0l43.968 0.192c36.096 0.064 72.192 0.192 108.288-0.448 52.672-0.96 64-12.096 65.152-60.288a494.464 494.464 0 0 0 0-21.76 365.632 365.632 0 0 1 0.704-35.84c2.24-26.048 17.92-40.32 41.664-40.832z" fill="currentColor"></path>
|
|
668
|
+
</svg>
|
|
669
|
+
`;
|
|
670
|
+
|
|
671
|
+
const importIcon = `
|
|
672
|
+
<svg viewBox="0 0 1024 1024" version="1.1" width="20" height="20">
|
|
673
|
+
<path d="M838.656 594.432a41.152 41.152 0 0 0-40.768 41.472v176.128c0 0.384-0.384 0.96-1.216 0.96H210.688c-0.768 0-1.216-0.576-1.216-0.96V275.968c0-0.384 0.448-0.96 1.216-0.96h143.616a41.088 41.088 0 0 0 41.28-41.472A41.088 41.088 0 0 0 354.304 192H210.688C165.12 192 128 229.76 128 275.968v536.064C128 858.368 165.12 896 210.688 896h585.984c45.632 0 82.688-37.632 82.688-83.968V635.904a41.152 41.152 0 0 0-40.704-41.472z" fill="currentColor"></path>
|
|
674
|
+
<path d="M895.744 229.056a40.896 40.896 0 0 0-44.864-36.8c-4.032 0.448-99.456 11.52-200.576 68.352-106.24 59.776-179.2 147.648-214.656 257.28l-44.672-131.584a40.576 40.576 0 0 0-51.84-25.792 41.664 41.664 0 0 0-25.152 52.928l80.064 235.968a40.576 40.576 0 0 0 51.84 25.6l0.512-0.128 232.192-85.312a41.728 41.728 0 0 0 24-52.928 40.576 40.576 0 0 0-51.648-25.152l-144 52.928c26.048-99.2 86.464-176.256 180.416-229.76a508.672 508.672 0 0 1 172.416-59.904c22.336-2.56 38.4-22.976 35.968-45.696z" fill="currentColor"></path>
|
|
675
|
+
</svg>
|
|
676
|
+
`;
|
|
677
|
+
|
|
652
678
|
const defaultConfig = {
|
|
653
679
|
[CrepeFeature.CodeMirror]: {
|
|
654
680
|
theme: oneDark,
|
|
@@ -780,6 +806,8 @@ const zhCN = {
|
|
|
780
806
|
"customMenu.colorPurple": "\u7D2B\u8272",
|
|
781
807
|
"customMenu.colorGray": "\u7070\u8272",
|
|
782
808
|
"customMenu.insertTable": "\u63D2\u5165\u652F\u6301\u5BCC\u6587\u672C\u7684\u8868\u683C",
|
|
809
|
+
"customMenu.export": "\u5BFC\u51FA",
|
|
810
|
+
"customMenu.import": "\u5BFC\u5165",
|
|
783
811
|
"customMenu.fontDefault": "\u9ED8\u8BA4",
|
|
784
812
|
"font.fangSong": "\u4EFF\u5B8B",
|
|
785
813
|
"font.stFangsong": "\u534E\u6587\u4EFF\u5B8B",
|
|
@@ -927,6 +955,8 @@ const enUS = {
|
|
|
927
955
|
"customMenu.colorPurple": "Purple",
|
|
928
956
|
"customMenu.colorGray": "Gray",
|
|
929
957
|
"customMenu.insertTable": "Insert Table",
|
|
958
|
+
"customMenu.export": "Export",
|
|
959
|
+
"customMenu.import": "Import",
|
|
930
960
|
"customMenu.fontDefault": "Default",
|
|
931
961
|
"font.fangSong": "FangSong",
|
|
932
962
|
"font.stFangsong": "STFangsong",
|
|
@@ -1208,7 +1238,7 @@ const MilkdownAttachmentBlock = defineComponent({
|
|
|
1208
1238
|
return () => {
|
|
1209
1239
|
var _a;
|
|
1210
1240
|
if (!((_a = src.value) == null ? void 0 : _a.length)) {
|
|
1211
|
-
return /* @__PURE__ */ h(
|
|
1241
|
+
return /* @__PURE__ */ h$1(
|
|
1212
1242
|
"div",
|
|
1213
1243
|
{
|
|
1214
1244
|
class: [
|
|
@@ -1216,7 +1246,7 @@ const MilkdownAttachmentBlock = defineComponent({
|
|
|
1216
1246
|
props.selected.value ? "selected" : ""
|
|
1217
1247
|
]
|
|
1218
1248
|
},
|
|
1219
|
-
/* @__PURE__ */ h("div", { class: "milkdown-attachment-uploader", onClick: triggerUpload }, /* @__PURE__ */ h(Icon, { icon: fileLinkIcon }), /* @__PURE__ */ h("span", { class: "milkdown-attachment-upload-text" }, isUploading.value ? "Uploading..." : props.config.uploadButton), /* @__PURE__ */ h(
|
|
1249
|
+
/* @__PURE__ */ h$1("div", { class: "milkdown-attachment-uploader", onClick: triggerUpload }, /* @__PURE__ */ h$1(Icon, { icon: fileLinkIcon }), /* @__PURE__ */ h$1("span", { class: "milkdown-attachment-upload-text" }, isUploading.value ? "Uploading..." : props.config.uploadButton), /* @__PURE__ */ h$1(
|
|
1220
1250
|
"input",
|
|
1221
1251
|
{
|
|
1222
1252
|
type: "file",
|
|
@@ -1230,7 +1260,7 @@ const MilkdownAttachmentBlock = defineComponent({
|
|
|
1230
1260
|
if (isVideo.value) {
|
|
1231
1261
|
const savedWidth = videoWidth.value;
|
|
1232
1262
|
const widthStyle = isResizing.value && currentWidth.value > 0 ? `${currentWidth.value}px` : savedWidth && savedWidth > 0 ? `${savedWidth}px` : "100%";
|
|
1233
|
-
return /* @__PURE__ */ h(
|
|
1263
|
+
return /* @__PURE__ */ h$1(
|
|
1234
1264
|
"div",
|
|
1235
1265
|
{
|
|
1236
1266
|
ref: videoWrapperRef,
|
|
@@ -1244,7 +1274,7 @@ const MilkdownAttachmentBlock = defineComponent({
|
|
|
1244
1274
|
position: "relative"
|
|
1245
1275
|
}
|
|
1246
1276
|
},
|
|
1247
|
-
/* @__PURE__ */ h(
|
|
1277
|
+
/* @__PURE__ */ h$1(
|
|
1248
1278
|
"video",
|
|
1249
1279
|
{
|
|
1250
1280
|
src: src.value,
|
|
@@ -1253,28 +1283,28 @@ const MilkdownAttachmentBlock = defineComponent({
|
|
|
1253
1283
|
onMousedown: (e) => e.stopPropagation()
|
|
1254
1284
|
}
|
|
1255
1285
|
),
|
|
1256
|
-
/* @__PURE__ */ h(
|
|
1286
|
+
/* @__PURE__ */ h$1(
|
|
1257
1287
|
"div",
|
|
1258
1288
|
{
|
|
1259
1289
|
class: "video-resize-handle top-left",
|
|
1260
1290
|
onPointerdown: (e) => onResizePointerDown(e, "top-left")
|
|
1261
1291
|
}
|
|
1262
1292
|
),
|
|
1263
|
-
/* @__PURE__ */ h(
|
|
1293
|
+
/* @__PURE__ */ h$1(
|
|
1264
1294
|
"div",
|
|
1265
1295
|
{
|
|
1266
1296
|
class: "video-resize-handle top-right",
|
|
1267
1297
|
onPointerdown: (e) => onResizePointerDown(e, "top-right")
|
|
1268
1298
|
}
|
|
1269
1299
|
),
|
|
1270
|
-
/* @__PURE__ */ h(
|
|
1300
|
+
/* @__PURE__ */ h$1(
|
|
1271
1301
|
"div",
|
|
1272
1302
|
{
|
|
1273
1303
|
class: "video-resize-handle bottom-left",
|
|
1274
1304
|
onPointerdown: (e) => onResizePointerDown(e, "bottom-left")
|
|
1275
1305
|
}
|
|
1276
1306
|
),
|
|
1277
|
-
/* @__PURE__ */ h(
|
|
1307
|
+
/* @__PURE__ */ h$1(
|
|
1278
1308
|
"div",
|
|
1279
1309
|
{
|
|
1280
1310
|
class: "video-resize-handle bottom-right",
|
|
@@ -1283,7 +1313,7 @@ const MilkdownAttachmentBlock = defineComponent({
|
|
|
1283
1313
|
)
|
|
1284
1314
|
);
|
|
1285
1315
|
}
|
|
1286
|
-
return /* @__PURE__ */ h(
|
|
1316
|
+
return /* @__PURE__ */ h$1(
|
|
1287
1317
|
"div",
|
|
1288
1318
|
{
|
|
1289
1319
|
class: [
|
|
@@ -1291,16 +1321,16 @@ const MilkdownAttachmentBlock = defineComponent({
|
|
|
1291
1321
|
props.selected.value ? "selected" : ""
|
|
1292
1322
|
]
|
|
1293
1323
|
},
|
|
1294
|
-
/* @__PURE__ */ h("div", { class: "milkdown-attachment-icon-wrapper" }, /* @__PURE__ */ h("div", { class: "milkdown-attachment-raw-icon-bg" }, /* @__PURE__ */ h(Icon, { icon: fileLinkIcon }))),
|
|
1295
|
-
/* @__PURE__ */ h("div", { class: "milkdown-attachment-info" }, /* @__PURE__ */ h("div", { class: "milkdown-attachment-name" }, name.value), /* @__PURE__ */ h("div", { class: "milkdown-attachment-size" }, (size.value || 0) > 0 ? formatBytes(size.value) : "")),
|
|
1296
|
-
/* @__PURE__ */ h(
|
|
1324
|
+
/* @__PURE__ */ h$1("div", { class: "milkdown-attachment-icon-wrapper" }, /* @__PURE__ */ h$1("div", { class: "milkdown-attachment-raw-icon-bg" }, /* @__PURE__ */ h$1(Icon, { icon: fileLinkIcon }))),
|
|
1325
|
+
/* @__PURE__ */ h$1("div", { class: "milkdown-attachment-info" }, /* @__PURE__ */ h$1("div", { class: "milkdown-attachment-name" }, name.value), /* @__PURE__ */ h$1("div", { class: "milkdown-attachment-size" }, (size.value || 0) > 0 ? formatBytes(size.value) : "")),
|
|
1326
|
+
/* @__PURE__ */ h$1(
|
|
1297
1327
|
"div",
|
|
1298
1328
|
{
|
|
1299
1329
|
class: "milkdown-attachment-action",
|
|
1300
1330
|
onClick: openLink,
|
|
1301
1331
|
title: props.config.downloadText
|
|
1302
1332
|
},
|
|
1303
|
-
/* @__PURE__ */ h(Icon, { icon: downloadIcon })
|
|
1333
|
+
/* @__PURE__ */ h$1(Icon, { icon: downloadIcon })
|
|
1304
1334
|
)
|
|
1305
1335
|
);
|
|
1306
1336
|
};
|
|
@@ -2493,7 +2523,7 @@ function getGroups$1(filter, config, ctx) {
|
|
|
2493
2523
|
};
|
|
2494
2524
|
}
|
|
2495
2525
|
|
|
2496
|
-
keepAlive(h);
|
|
2526
|
+
keepAlive(h$1);
|
|
2497
2527
|
const Menu = defineComponent({
|
|
2498
2528
|
props: {
|
|
2499
2529
|
ctx: {
|
|
@@ -2839,7 +2869,7 @@ const Menu = defineComponent({
|
|
|
2839
2869
|
const api = ctx.get(menuAPI.key);
|
|
2840
2870
|
const showListMenu = (api == null ? void 0 : api.getMode()) === "list" || !(api == null ? void 0 : api.isProgrammatic()) || filter.value !== "";
|
|
2841
2871
|
if (showListMenu) {
|
|
2842
|
-
return /* @__PURE__ */ h("div", { ref: host, onPointerdown: (e) => e.preventDefault() }, /* @__PURE__ */ h("div", { class: "menu-groups", onPointermove: onPointerMove }, groupInfo.value.groups.map((group) => /* @__PURE__ */ h("div", { key: group.key, class: "menu-group" }, /* @__PURE__ */ h("h6", null, group.label), /* @__PURE__ */ h("ul", null, group.items.map((item) => /* @__PURE__ */ h(
|
|
2872
|
+
return /* @__PURE__ */ h$1("div", { ref: host, onPointerdown: (e) => e.preventDefault() }, /* @__PURE__ */ h$1("div", { class: "menu-groups", onPointermove: onPointerMove }, groupInfo.value.groups.map((group) => /* @__PURE__ */ h$1("div", { key: group.key, class: "menu-group" }, /* @__PURE__ */ h$1("h6", null, group.label), /* @__PURE__ */ h$1("ul", null, group.items.map((item) => /* @__PURE__ */ h$1(
|
|
2843
2873
|
"li",
|
|
2844
2874
|
{
|
|
2845
2875
|
key: item.key,
|
|
@@ -2882,9 +2912,9 @@ const Menu = defineComponent({
|
|
|
2882
2912
|
runByIndex(item.index);
|
|
2883
2913
|
}
|
|
2884
2914
|
},
|
|
2885
|
-
/* @__PURE__ */ h(Icon, { icon: item.icon }),
|
|
2886
|
-
/* @__PURE__ */ h("span", { style: item.key === "table" ? { flex: 1 } : {} }, item.label),
|
|
2887
|
-
item.key === "table" ? /* @__PURE__ */ h(
|
|
2915
|
+
/* @__PURE__ */ h$1(Icon, { icon: item.icon }),
|
|
2916
|
+
/* @__PURE__ */ h$1("span", { style: item.key === "table" ? { flex: 1 } : {} }, item.label),
|
|
2917
|
+
item.key === "table" ? /* @__PURE__ */ h$1(
|
|
2888
2918
|
"div",
|
|
2889
2919
|
{
|
|
2890
2920
|
style: {
|
|
@@ -2894,9 +2924,9 @@ const Menu = defineComponent({
|
|
|
2894
2924
|
transform: "rotate(-90deg)"
|
|
2895
2925
|
}
|
|
2896
2926
|
},
|
|
2897
|
-
/* @__PURE__ */ h(Icon, { icon: chevronDownIcon })
|
|
2927
|
+
/* @__PURE__ */ h$1(Icon, { icon: chevronDownIcon })
|
|
2898
2928
|
) : null
|
|
2899
|
-
)))))), showTableMenu.value ? /* @__PURE__ */ h(
|
|
2929
|
+
)))))), showTableMenu.value ? /* @__PURE__ */ h$1(
|
|
2900
2930
|
"div",
|
|
2901
2931
|
{
|
|
2902
2932
|
class: "milkdown-slash-menu custom-submenu",
|
|
@@ -2919,7 +2949,7 @@ const Menu = defineComponent({
|
|
|
2919
2949
|
},
|
|
2920
2950
|
onPointerleave: handleTableLeave
|
|
2921
2951
|
},
|
|
2922
|
-
/* @__PURE__ */ h(
|
|
2952
|
+
/* @__PURE__ */ h$1(
|
|
2923
2953
|
"div",
|
|
2924
2954
|
{
|
|
2925
2955
|
style: {
|
|
@@ -2931,7 +2961,7 @@ const Menu = defineComponent({
|
|
|
2931
2961
|
},
|
|
2932
2962
|
i18n(ctx, "customMenu.insertTable")
|
|
2933
2963
|
),
|
|
2934
|
-
/* @__PURE__ */ h(
|
|
2964
|
+
/* @__PURE__ */ h$1(
|
|
2935
2965
|
"div",
|
|
2936
2966
|
{
|
|
2937
2967
|
style: {
|
|
@@ -2944,7 +2974,7 @@ const Menu = defineComponent({
|
|
|
2944
2974
|
Array.from({ length: 9 }).map(
|
|
2945
2975
|
(_, r) => Array.from({ length: 9 }).map((_2, c) => {
|
|
2946
2976
|
const isHovered = r < tableHoverIndices.value.r && c < tableHoverIndices.value.c;
|
|
2947
|
-
return /* @__PURE__ */ h(
|
|
2977
|
+
return /* @__PURE__ */ h$1(
|
|
2948
2978
|
"div",
|
|
2949
2979
|
{
|
|
2950
2980
|
key: `cell-${r}-${c}`,
|
|
@@ -2973,7 +3003,7 @@ const Menu = defineComponent({
|
|
|
2973
3003
|
})
|
|
2974
3004
|
)
|
|
2975
3005
|
),
|
|
2976
|
-
tableHoverIndices.value.r > 0 ? /* @__PURE__ */ h(
|
|
3006
|
+
tableHoverIndices.value.r > 0 ? /* @__PURE__ */ h$1(
|
|
2977
3007
|
"div",
|
|
2978
3008
|
{
|
|
2979
3009
|
style: {
|
|
@@ -2986,7 +3016,7 @@ const Menu = defineComponent({
|
|
|
2986
3016
|
tableHoverIndices.value.r,
|
|
2987
3017
|
" x ",
|
|
2988
3018
|
tableHoverIndices.value.c
|
|
2989
|
-
) : /* @__PURE__ */ h(
|
|
3019
|
+
) : /* @__PURE__ */ h$1(
|
|
2990
3020
|
"div",
|
|
2991
3021
|
{
|
|
2992
3022
|
style: {
|
|
@@ -3175,7 +3205,7 @@ const Menu = defineComponent({
|
|
|
3175
3205
|
const renderGridBtn = (key) => {
|
|
3176
3206
|
const item = findItem(key);
|
|
3177
3207
|
if (!item) return null;
|
|
3178
|
-
return /* @__PURE__ */ h(
|
|
3208
|
+
return /* @__PURE__ */ h$1(
|
|
3179
3209
|
"div",
|
|
3180
3210
|
{
|
|
3181
3211
|
title: item.label,
|
|
@@ -3196,11 +3226,11 @@ const Menu = defineComponent({
|
|
|
3196
3226
|
},
|
|
3197
3227
|
"data-index": item.index
|
|
3198
3228
|
},
|
|
3199
|
-
/* @__PURE__ */ h(Icon, { icon: item.icon })
|
|
3229
|
+
/* @__PURE__ */ h$1(Icon, { icon: item.icon })
|
|
3200
3230
|
);
|
|
3201
3231
|
};
|
|
3202
3232
|
const renderCustomRow = (iconHtml, label, hasArrow, onPointerEnter, onPointerLeave, onClick) => {
|
|
3203
|
-
return /* @__PURE__ */ h(
|
|
3233
|
+
return /* @__PURE__ */ h$1(
|
|
3204
3234
|
"div",
|
|
3205
3235
|
{
|
|
3206
3236
|
class: "custom-menu-row",
|
|
@@ -3216,12 +3246,12 @@ const Menu = defineComponent({
|
|
|
3216
3246
|
onClick == null ? void 0 : onClick();
|
|
3217
3247
|
}
|
|
3218
3248
|
},
|
|
3219
|
-
/* @__PURE__ */ h("div", { class: "custom-menu-row-left" }, /* @__PURE__ */ h(Icon, { icon: iconHtml }), /* @__PURE__ */ h("span", null, label)),
|
|
3220
|
-
hasArrow ? /* @__PURE__ */ h(Icon, { icon: chevronDownIcon }) : null
|
|
3249
|
+
/* @__PURE__ */ h$1("div", { class: "custom-menu-row-left" }, /* @__PURE__ */ h$1(Icon, { icon: iconHtml }), /* @__PURE__ */ h$1("span", null, label)),
|
|
3250
|
+
hasArrow ? /* @__PURE__ */ h$1(Icon, { icon: chevronDownIcon }) : null
|
|
3221
3251
|
);
|
|
3222
3252
|
};
|
|
3223
3253
|
const renderSubMenuItem = (iconHtml, label, isActive, onClick, disabled = false) => {
|
|
3224
|
-
return /* @__PURE__ */ h(
|
|
3254
|
+
return /* @__PURE__ */ h$1(
|
|
3225
3255
|
"div",
|
|
3226
3256
|
{
|
|
3227
3257
|
class: ["custom-menu-row", disabled ? "disabled" : ""],
|
|
@@ -3239,7 +3269,7 @@ const Menu = defineComponent({
|
|
|
3239
3269
|
if (!disabled) onClick();
|
|
3240
3270
|
}
|
|
3241
3271
|
},
|
|
3242
|
-
/* @__PURE__ */ h("div", { class: "custom-menu-row-left" }, /* @__PURE__ */ h(Icon, { icon: iconHtml }), /* @__PURE__ */ h(
|
|
3272
|
+
/* @__PURE__ */ h$1("div", { class: "custom-menu-row-left" }, /* @__PURE__ */ h$1(Icon, { icon: iconHtml }), /* @__PURE__ */ h$1(
|
|
3243
3273
|
"span",
|
|
3244
3274
|
{
|
|
3245
3275
|
style: {
|
|
@@ -3248,18 +3278,18 @@ const Menu = defineComponent({
|
|
|
3248
3278
|
},
|
|
3249
3279
|
label
|
|
3250
3280
|
)),
|
|
3251
|
-
isActive ? /* @__PURE__ */ h("span", { style: { color: "var(--crepe-color-primary)" } }, /* @__PURE__ */ h(Icon, { icon: confirmIcon })) : null
|
|
3281
|
+
isActive ? /* @__PURE__ */ h$1("span", { style: { color: "var(--crepe-color-primary)" } }, /* @__PURE__ */ h$1(Icon, { icon: confirmIcon })) : null
|
|
3252
3282
|
);
|
|
3253
3283
|
};
|
|
3254
|
-
return /* @__PURE__ */ h(
|
|
3284
|
+
return /* @__PURE__ */ h$1(
|
|
3255
3285
|
"div",
|
|
3256
3286
|
{
|
|
3257
3287
|
ref: host,
|
|
3258
3288
|
onPointerdown: (e) => e.preventDefault(),
|
|
3259
3289
|
class: "custom-block-menu"
|
|
3260
3290
|
},
|
|
3261
|
-
!isMedia ? /* @__PURE__ */ h("div", { class: "custom-grid-container" }, gridRows.map((rowKeys, rIndex) => /* @__PURE__ */ h("div", { class: "custom-grid-row", key: "row-" + rIndex }, rowKeys.map(renderGridBtn)))) : null,
|
|
3262
|
-
showAlign ? /* @__PURE__ */ h("div", { class: "custom-divider" }) : null,
|
|
3291
|
+
!isMedia ? /* @__PURE__ */ h$1("div", { class: "custom-grid-container" }, gridRows.map((rowKeys, rIndex) => /* @__PURE__ */ h$1("div", { class: "custom-grid-row", key: "row-" + rIndex }, rowKeys.map(renderGridBtn)))) : null,
|
|
3292
|
+
showAlign ? /* @__PURE__ */ h$1("div", { class: "custom-divider" }) : null,
|
|
3263
3293
|
showAlign && renderCustomRow(
|
|
3264
3294
|
alignLeftIcon,
|
|
3265
3295
|
i18n(ctx, "customMenu.indentAndAlign"),
|
|
@@ -3267,7 +3297,7 @@ const Menu = defineComponent({
|
|
|
3267
3297
|
handleIndentAlignEnter,
|
|
3268
3298
|
handleIndentAlignLeave
|
|
3269
3299
|
),
|
|
3270
|
-
showIndentAlignMenu.value ? /* @__PURE__ */ h(
|
|
3300
|
+
showIndentAlignMenu.value ? /* @__PURE__ */ h$1(
|
|
3271
3301
|
"div",
|
|
3272
3302
|
{
|
|
3273
3303
|
class: "milkdown-slash-menu custom-submenu",
|
|
@@ -3304,7 +3334,7 @@ const Menu = defineComponent({
|
|
|
3304
3334
|
currentAlign === "right",
|
|
3305
3335
|
() => setAlign("right")
|
|
3306
3336
|
),
|
|
3307
|
-
/* @__PURE__ */ h("div", { class: "custom-divider" }),
|
|
3337
|
+
/* @__PURE__ */ h$1("div", { class: "custom-divider" }),
|
|
3308
3338
|
renderSubMenuItem(
|
|
3309
3339
|
indentIncreaseIcon,
|
|
3310
3340
|
i18n(ctx, "customMenu.increaseIndent"),
|
|
@@ -3326,7 +3356,7 @@ const Menu = defineComponent({
|
|
|
3326
3356
|
handleColorEnter,
|
|
3327
3357
|
handleColorLeave
|
|
3328
3358
|
),
|
|
3329
|
-
showColorMenu.value ? /* @__PURE__ */ h(
|
|
3359
|
+
showColorMenu.value ? /* @__PURE__ */ h$1(
|
|
3330
3360
|
"div",
|
|
3331
3361
|
{
|
|
3332
3362
|
class: "milkdown-slash-menu custom-submenu",
|
|
@@ -3350,7 +3380,7 @@ const Menu = defineComponent({
|
|
|
3350
3380
|
},
|
|
3351
3381
|
onPointerleave: handleColorLeave
|
|
3352
3382
|
},
|
|
3353
|
-
/* @__PURE__ */ h(
|
|
3383
|
+
/* @__PURE__ */ h$1(
|
|
3354
3384
|
"div",
|
|
3355
3385
|
{
|
|
3356
3386
|
style: {
|
|
@@ -3361,7 +3391,7 @@ const Menu = defineComponent({
|
|
|
3361
3391
|
},
|
|
3362
3392
|
i18n(ctx, "customMenu.textColor")
|
|
3363
3393
|
),
|
|
3364
|
-
/* @__PURE__ */ h("div", { style: { display: "flex", gap: "4px", flexWrap: "wrap" } }, [
|
|
3394
|
+
/* @__PURE__ */ h$1("div", { style: { display: "flex", gap: "4px", flexWrap: "wrap" } }, [
|
|
3365
3395
|
"#000000",
|
|
3366
3396
|
"#8C8C8C",
|
|
3367
3397
|
"#F5222D",
|
|
@@ -3370,7 +3400,7 @@ const Menu = defineComponent({
|
|
|
3370
3400
|
"#52C41A",
|
|
3371
3401
|
"#1677FF",
|
|
3372
3402
|
"#722ED1"
|
|
3373
|
-
].map((color) => /* @__PURE__ */ h(
|
|
3403
|
+
].map((color) => /* @__PURE__ */ h$1(
|
|
3374
3404
|
"div",
|
|
3375
3405
|
{
|
|
3376
3406
|
key: color,
|
|
@@ -3400,7 +3430,7 @@ const Menu = defineComponent({
|
|
|
3400
3430
|
},
|
|
3401
3431
|
"A"
|
|
3402
3432
|
))),
|
|
3403
|
-
/* @__PURE__ */ h(
|
|
3433
|
+
/* @__PURE__ */ h$1(
|
|
3404
3434
|
"div",
|
|
3405
3435
|
{
|
|
3406
3436
|
style: {
|
|
@@ -3412,7 +3442,7 @@ const Menu = defineComponent({
|
|
|
3412
3442
|
},
|
|
3413
3443
|
i18n(ctx, "customMenu.bgColor")
|
|
3414
3444
|
),
|
|
3415
|
-
/* @__PURE__ */ h("div", { style: { display: "flex", gap: "4px", flexWrap: "wrap" } }, [
|
|
3445
|
+
/* @__PURE__ */ h$1("div", { style: { display: "flex", gap: "4px", flexWrap: "wrap" } }, [
|
|
3416
3446
|
"transparent",
|
|
3417
3447
|
"#F5F5F5",
|
|
3418
3448
|
"#FFCCC7",
|
|
@@ -3421,7 +3451,7 @@ const Menu = defineComponent({
|
|
|
3421
3451
|
"#D9F7BE",
|
|
3422
3452
|
"#D6E4FF",
|
|
3423
3453
|
"#EFDBFF"
|
|
3424
|
-
].map((color) => /* @__PURE__ */ h(
|
|
3454
|
+
].map((color) => /* @__PURE__ */ h$1(
|
|
3425
3455
|
"div",
|
|
3426
3456
|
{
|
|
3427
3457
|
key: color,
|
|
@@ -3445,7 +3475,7 @@ const Menu = defineComponent({
|
|
|
3445
3475
|
overflow: "hidden"
|
|
3446
3476
|
}
|
|
3447
3477
|
},
|
|
3448
|
-
color === "transparent" ? /* @__PURE__ */ h(
|
|
3478
|
+
color === "transparent" ? /* @__PURE__ */ h$1(
|
|
3449
3479
|
"div",
|
|
3450
3480
|
{
|
|
3451
3481
|
style: {
|
|
@@ -3469,7 +3499,7 @@ const Menu = defineComponent({
|
|
|
3469
3499
|
"#52C41A",
|
|
3470
3500
|
"#1677FF",
|
|
3471
3501
|
"#722ED1"
|
|
3472
|
-
].map((color) => /* @__PURE__ */ h(
|
|
3502
|
+
].map((color) => /* @__PURE__ */ h$1(
|
|
3473
3503
|
"div",
|
|
3474
3504
|
{
|
|
3475
3505
|
key: color,
|
|
@@ -3492,7 +3522,7 @@ const Menu = defineComponent({
|
|
|
3492
3522
|
}
|
|
3493
3523
|
}
|
|
3494
3524
|
))),
|
|
3495
|
-
/* @__PURE__ */ h(
|
|
3525
|
+
/* @__PURE__ */ h$1(
|
|
3496
3526
|
"button",
|
|
3497
3527
|
{
|
|
3498
3528
|
onPointerdown: (e) => {
|
|
@@ -3519,7 +3549,7 @@ const Menu = defineComponent({
|
|
|
3519
3549
|
i18n(ctx, "customMenu.restoreDefault")
|
|
3520
3550
|
)
|
|
3521
3551
|
) : null,
|
|
3522
|
-
!isMedia ? /* @__PURE__ */ h("div", { class: "custom-divider" }) : null,
|
|
3552
|
+
!isMedia ? /* @__PURE__ */ h$1("div", { class: "custom-divider" }) : null,
|
|
3523
3553
|
renderCustomRow(
|
|
3524
3554
|
clearIcon,
|
|
3525
3555
|
i18n(ctx, "customMenu.cut"),
|
|
@@ -3544,7 +3574,7 @@ const Menu = defineComponent({
|
|
|
3544
3574
|
void 0,
|
|
3545
3575
|
applyDelete
|
|
3546
3576
|
),
|
|
3547
|
-
/* @__PURE__ */ h("div", { class: "custom-divider" }),
|
|
3577
|
+
/* @__PURE__ */ h$1("div", { class: "custom-divider" }),
|
|
3548
3578
|
renderCustomRow(
|
|
3549
3579
|
plusIcon,
|
|
3550
3580
|
i18n(ctx, "customMenu.addBelow"),
|
|
@@ -3552,7 +3582,7 @@ const Menu = defineComponent({
|
|
|
3552
3582
|
handleAddBelowEnter,
|
|
3553
3583
|
handleAddBelowLeave
|
|
3554
3584
|
),
|
|
3555
|
-
showAddBelowMenu.value ? /* @__PURE__ */ h(
|
|
3585
|
+
showAddBelowMenu.value ? /* @__PURE__ */ h$1(
|
|
3556
3586
|
"div",
|
|
3557
3587
|
{
|
|
3558
3588
|
class: "milkdown-slash-menu custom-submenu",
|
|
@@ -3572,14 +3602,14 @@ const Menu = defineComponent({
|
|
|
3572
3602
|
},
|
|
3573
3603
|
onPointerleave: handleAddBelowLeave
|
|
3574
3604
|
},
|
|
3575
|
-
/* @__PURE__ */ h(
|
|
3605
|
+
/* @__PURE__ */ h$1(
|
|
3576
3606
|
"div",
|
|
3577
3607
|
{
|
|
3578
3608
|
class: "menu-groups",
|
|
3579
3609
|
onPointermove: onPointerMove,
|
|
3580
3610
|
style: { maxHeight: "300px", overflowY: "auto" }
|
|
3581
3611
|
},
|
|
3582
|
-
groupInfo.value.groups.map((group) => /* @__PURE__ */ h("div", { key: group.key, class: "menu-group" }, /* @__PURE__ */ h("h6", null, group.label), /* @__PURE__ */ h("ul", null, group.items.map((item) => /* @__PURE__ */ h(
|
|
3612
|
+
groupInfo.value.groups.map((group) => /* @__PURE__ */ h$1("div", { key: group.key, class: "menu-group" }, /* @__PURE__ */ h$1("h6", null, group.label), /* @__PURE__ */ h$1("ul", null, group.items.map((item) => /* @__PURE__ */ h$1(
|
|
3583
3613
|
"li",
|
|
3584
3614
|
{
|
|
3585
3615
|
key: item.key,
|
|
@@ -3606,8 +3636,8 @@ const Menu = defineComponent({
|
|
|
3606
3636
|
runByIndexForAddBelow(item.index);
|
|
3607
3637
|
}
|
|
3608
3638
|
},
|
|
3609
|
-
/* @__PURE__ */ h(Icon, { icon: item.icon }),
|
|
3610
|
-
/* @__PURE__ */ h("span", null, item.label)
|
|
3639
|
+
/* @__PURE__ */ h$1(Icon, { icon: item.icon }),
|
|
3640
|
+
/* @__PURE__ */ h$1("span", null, item.label)
|
|
3611
3641
|
)))))
|
|
3612
3642
|
)
|
|
3613
3643
|
) : null
|
|
@@ -3855,7 +3885,7 @@ function getBlockKey(node) {
|
|
|
3855
3885
|
}
|
|
3856
3886
|
}
|
|
3857
3887
|
|
|
3858
|
-
keepAlive(h, Fragment);
|
|
3888
|
+
keepAlive(h$1, Fragment);
|
|
3859
3889
|
const BlockHandle = defineComponent({
|
|
3860
3890
|
props: {
|
|
3861
3891
|
onAdd: {
|
|
@@ -3903,7 +3933,7 @@ const BlockHandle = defineComponent({
|
|
|
3903
3933
|
const addButton = ref();
|
|
3904
3934
|
const menuButton = ref();
|
|
3905
3935
|
return () => {
|
|
3906
|
-
return /* @__PURE__ */ h(Fragment, null, /* @__PURE__ */ h(
|
|
3936
|
+
return /* @__PURE__ */ h$1(Fragment, null, /* @__PURE__ */ h$1(
|
|
3907
3937
|
"div",
|
|
3908
3938
|
{
|
|
3909
3939
|
ref: addButton,
|
|
@@ -3929,8 +3959,8 @@ const BlockHandle = defineComponent({
|
|
|
3929
3959
|
props.onAdd(addButton.value);
|
|
3930
3960
|
}
|
|
3931
3961
|
},
|
|
3932
|
-
/* @__PURE__ */ h(Icon, { icon: props.addIcon })
|
|
3933
|
-
), /* @__PURE__ */ h(
|
|
3962
|
+
/* @__PURE__ */ h$1(Icon, { icon: props.addIcon })
|
|
3963
|
+
), /* @__PURE__ */ h$1(
|
|
3934
3964
|
"div",
|
|
3935
3965
|
{
|
|
3936
3966
|
ref: menuButton,
|
|
@@ -3948,14 +3978,14 @@ const BlockHandle = defineComponent({
|
|
|
3948
3978
|
props.onLeaveMenu();
|
|
3949
3979
|
}
|
|
3950
3980
|
},
|
|
3951
|
-
/* @__PURE__ */ h(Icon, { icon: props.state.icon })
|
|
3952
|
-
), /* @__PURE__ */ h("div", { class: "divider" }), /* @__PURE__ */ h(
|
|
3981
|
+
/* @__PURE__ */ h$1(Icon, { icon: props.state.icon })
|
|
3982
|
+
), /* @__PURE__ */ h$1("div", { class: "divider" }), /* @__PURE__ */ h$1(
|
|
3953
3983
|
"div",
|
|
3954
3984
|
{
|
|
3955
3985
|
class: "operation-item drag-item",
|
|
3956
3986
|
title: i18n(props.ctx, "handle.drag")
|
|
3957
3987
|
},
|
|
3958
|
-
/* @__PURE__ */ h(Icon, { icon: dragHandleIcon })
|
|
3988
|
+
/* @__PURE__ */ h$1(Icon, { icon: dragHandleIcon })
|
|
3959
3989
|
));
|
|
3960
3990
|
};
|
|
3961
3991
|
}
|
|
@@ -4851,6 +4881,10 @@ function decrementPopupCount() {
|
|
|
4851
4881
|
listeners.forEach((fn) => fn());
|
|
4852
4882
|
}
|
|
4853
4883
|
}
|
|
4884
|
+
function resetPopupCount() {
|
|
4885
|
+
_popupCount = 0;
|
|
4886
|
+
listeners.forEach((fn) => fn());
|
|
4887
|
+
}
|
|
4854
4888
|
|
|
4855
4889
|
function getGroups(config, ctx) {
|
|
4856
4890
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n;
|
|
@@ -5400,7 +5434,7 @@ const activeIconMap = {
|
|
|
5400
5434
|
[dividerIcon]: dividerIconActive
|
|
5401
5435
|
// [highLineCodeIcon]: highLineCodeIconActive,
|
|
5402
5436
|
};
|
|
5403
|
-
keepAlive(h, Fragment);
|
|
5437
|
+
keepAlive(h$1, Fragment);
|
|
5404
5438
|
const formatPainterStates = /* @__PURE__ */ new WeakMap();
|
|
5405
5439
|
const formatPainterHandlers = /* @__PURE__ */ new WeakMap();
|
|
5406
5440
|
const formatPainterIgnoreNext = /* @__PURE__ */ new WeakMap();
|
|
@@ -5706,7 +5740,8 @@ const Toolbar = defineComponent({
|
|
|
5706
5740
|
const container = toolbarContainerRef.value;
|
|
5707
5741
|
if (!isFixed) {
|
|
5708
5742
|
const view = ctx.get(editorViewCtx);
|
|
5709
|
-
|
|
5743
|
+
const containerDOM = view.dom.closest(".milkdown-editor-container") || view.dom.closest(".milkdown") || view.dom;
|
|
5744
|
+
container.style.maxWidth = `${containerDOM.clientWidth - 32}px`;
|
|
5710
5745
|
}
|
|
5711
5746
|
let containerWidth;
|
|
5712
5747
|
if (isFixed) {
|
|
@@ -5726,16 +5761,13 @@ const Toolbar = defineComponent({
|
|
|
5726
5761
|
}
|
|
5727
5762
|
} else {
|
|
5728
5763
|
const view = ctx.get(editorViewCtx);
|
|
5729
|
-
|
|
5764
|
+
const containerDOM = view.dom.closest(".milkdown-editor-container") || view.dom.closest(".milkdown") || view.dom;
|
|
5765
|
+
containerWidth = containerDOM.clientWidth - 32;
|
|
5730
5766
|
}
|
|
5731
|
-
if (containerWidth === lastContainerWidth) {
|
|
5732
|
-
return;
|
|
5733
|
-
}
|
|
5734
|
-
lastContainerWidth = containerWidth;
|
|
5735
5767
|
if (showOverflowMenu.value) {
|
|
5736
5768
|
showOverflowMenu.value = false;
|
|
5737
5769
|
}
|
|
5738
|
-
const MORE_BUTTON_WIDTH =
|
|
5770
|
+
const MORE_BUTTON_WIDTH = 56;
|
|
5739
5771
|
const children = Array.from(container.children);
|
|
5740
5772
|
const toolbarChildren = children.filter(
|
|
5741
5773
|
(el) => el.style.position !== "fixed" && el.dataset.overflowButton !== "true"
|
|
@@ -5745,6 +5777,13 @@ const Toolbar = defineComponent({
|
|
|
5745
5777
|
const child = toolbarChildren[i];
|
|
5746
5778
|
totalWidth += measureChild(child, i);
|
|
5747
5779
|
}
|
|
5780
|
+
if (totalWidth === 0) {
|
|
5781
|
+
return;
|
|
5782
|
+
}
|
|
5783
|
+
if (containerWidth === lastContainerWidth) {
|
|
5784
|
+
return;
|
|
5785
|
+
}
|
|
5786
|
+
lastContainerWidth = containerWidth;
|
|
5748
5787
|
if (totalWidth <= containerWidth) {
|
|
5749
5788
|
overflowVisibleCount.value = Infinity;
|
|
5750
5789
|
totalSectionCount.value = toolbarChildren.length;
|
|
@@ -5937,6 +5976,14 @@ const Toolbar = defineComponent({
|
|
|
5937
5976
|
} else {
|
|
5938
5977
|
const view = ctx.get(editorViewCtx);
|
|
5939
5978
|
overflowResizeObserver.observe(view.dom);
|
|
5979
|
+
const containerDOM = view.dom.closest(".milkdown-editor-container");
|
|
5980
|
+
if (containerDOM) {
|
|
5981
|
+
overflowResizeObserver.observe(containerDOM);
|
|
5982
|
+
}
|
|
5983
|
+
const rootDOM = view.dom.closest(".milkdown");
|
|
5984
|
+
if (rootDOM) {
|
|
5985
|
+
overflowResizeObserver.observe(rootDOM);
|
|
5986
|
+
}
|
|
5940
5987
|
}
|
|
5941
5988
|
computeOverflow();
|
|
5942
5989
|
};
|
|
@@ -5965,6 +6012,20 @@ const Toolbar = defineComponent({
|
|
|
5965
6012
|
lastContainerWidth = 0;
|
|
5966
6013
|
setTimeout(computeOverflow, 0);
|
|
5967
6014
|
});
|
|
6015
|
+
watch(
|
|
6016
|
+
() => {
|
|
6017
|
+
var _a;
|
|
6018
|
+
return (_a = props.show) == null ? void 0 : _a.value;
|
|
6019
|
+
},
|
|
6020
|
+
(val) => {
|
|
6021
|
+
if (val) {
|
|
6022
|
+
cachedWidths.clear();
|
|
6023
|
+
overflowVisibleCount.value = Infinity;
|
|
6024
|
+
lastContainerWidth = 0;
|
|
6025
|
+
setTimeout(computeOverflow, 0);
|
|
6026
|
+
}
|
|
6027
|
+
}
|
|
6028
|
+
);
|
|
5968
6029
|
const onClick = (fn) => (e) => {
|
|
5969
6030
|
e.preventDefault();
|
|
5970
6031
|
if (ctx) fn(ctx);
|
|
@@ -6282,7 +6343,7 @@ const Toolbar = defineComponent({
|
|
|
6282
6343
|
showFontSizeMenu.value = false;
|
|
6283
6344
|
};
|
|
6284
6345
|
const renderSubMenuItem = (iconHtml, label, isActive, onClick2, disabled = false) => {
|
|
6285
|
-
return /* @__PURE__ */ h(
|
|
6346
|
+
return /* @__PURE__ */ h$1(
|
|
6286
6347
|
"div",
|
|
6287
6348
|
{
|
|
6288
6349
|
class: ["custom-menu-row", disabled ? "disabled" : ""],
|
|
@@ -6314,13 +6375,13 @@ const Toolbar = defineComponent({
|
|
|
6314
6375
|
e.currentTarget.style.backgroundColor = "transparent";
|
|
6315
6376
|
}
|
|
6316
6377
|
},
|
|
6317
|
-
/* @__PURE__ */ h(
|
|
6378
|
+
/* @__PURE__ */ h$1(
|
|
6318
6379
|
"div",
|
|
6319
6380
|
{
|
|
6320
6381
|
class: "custom-menu-row-left",
|
|
6321
6382
|
style: { display: "flex", alignItems: "center", gap: "8px" }
|
|
6322
6383
|
},
|
|
6323
|
-
/* @__PURE__ */ h(
|
|
6384
|
+
/* @__PURE__ */ h$1(
|
|
6324
6385
|
"span",
|
|
6325
6386
|
{
|
|
6326
6387
|
style: {
|
|
@@ -6332,7 +6393,7 @@ const Toolbar = defineComponent({
|
|
|
6332
6393
|
innerHTML: iconHtml
|
|
6333
6394
|
}
|
|
6334
6395
|
),
|
|
6335
|
-
/* @__PURE__ */ h(
|
|
6396
|
+
/* @__PURE__ */ h$1(
|
|
6336
6397
|
"span",
|
|
6337
6398
|
{
|
|
6338
6399
|
style: {
|
|
@@ -6343,7 +6404,7 @@ const Toolbar = defineComponent({
|
|
|
6343
6404
|
label
|
|
6344
6405
|
)
|
|
6345
6406
|
),
|
|
6346
|
-
isActive ? /* @__PURE__ */ h(
|
|
6407
|
+
isActive ? /* @__PURE__ */ h$1(
|
|
6347
6408
|
"span",
|
|
6348
6409
|
{
|
|
6349
6410
|
style: {
|
|
@@ -6352,7 +6413,7 @@ const Toolbar = defineComponent({
|
|
|
6352
6413
|
color: "var(--crepe-color-primary)"
|
|
6353
6414
|
}
|
|
6354
6415
|
},
|
|
6355
|
-
/* @__PURE__ */ h(Icon, { icon: confirmIcon })
|
|
6416
|
+
/* @__PURE__ */ h$1(Icon, { icon: confirmIcon })
|
|
6356
6417
|
) : null
|
|
6357
6418
|
);
|
|
6358
6419
|
};
|
|
@@ -6378,7 +6439,7 @@ const Toolbar = defineComponent({
|
|
|
6378
6439
|
});
|
|
6379
6440
|
const isSectionOverflowed = (idx) => idx >= overflowVisibleCount.value;
|
|
6380
6441
|
const hasOverflow = overflowVisibleCount.value < totalSectionCount.value;
|
|
6381
|
-
return /* @__PURE__ */ h(
|
|
6442
|
+
return /* @__PURE__ */ h$1(
|
|
6382
6443
|
"div",
|
|
6383
6444
|
{
|
|
6384
6445
|
ref: toolbarContainerRef,
|
|
@@ -6389,7 +6450,7 @@ const Toolbar = defineComponent({
|
|
|
6389
6450
|
overflow: "hidden"
|
|
6390
6451
|
}
|
|
6391
6452
|
},
|
|
6392
|
-
/* @__PURE__ */ h(
|
|
6453
|
+
/* @__PURE__ */ h$1(
|
|
6393
6454
|
"div",
|
|
6394
6455
|
{
|
|
6395
6456
|
class: "toolbar-item",
|
|
@@ -6403,31 +6464,31 @@ const Toolbar = defineComponent({
|
|
|
6403
6464
|
flexShrink: 0
|
|
6404
6465
|
}
|
|
6405
6466
|
},
|
|
6406
|
-
/* @__PURE__ */ h(
|
|
6467
|
+
/* @__PURE__ */ h$1(
|
|
6407
6468
|
"span",
|
|
6408
6469
|
{
|
|
6409
6470
|
style: { display: "inline-flex", alignItems: "center" },
|
|
6410
6471
|
innerHTML: activeBlockItem.value || textIcon
|
|
6411
6472
|
}
|
|
6412
6473
|
),
|
|
6413
|
-
/* @__PURE__ */ h(
|
|
6474
|
+
/* @__PURE__ */ h$1(
|
|
6414
6475
|
"span",
|
|
6415
6476
|
{
|
|
6416
6477
|
style: { width: "20px", display: "flex", alignItems: "center" }
|
|
6417
6478
|
},
|
|
6418
|
-
/* @__PURE__ */ h(Icon, { icon: chevronDownIcon })
|
|
6479
|
+
/* @__PURE__ */ h$1(Icon, { icon: chevronDownIcon })
|
|
6419
6480
|
)
|
|
6420
6481
|
),
|
|
6421
|
-
/* @__PURE__ */ h(
|
|
6482
|
+
/* @__PURE__ */ h$1(
|
|
6422
6483
|
"div",
|
|
6423
6484
|
{
|
|
6424
6485
|
style: {
|
|
6425
6486
|
position: "relative",
|
|
6426
|
-
display: isSectionOverflowed(
|
|
6487
|
+
display: isSectionOverflowed(1) ? "none" : "flex",
|
|
6427
6488
|
flexShrink: 0
|
|
6428
6489
|
}
|
|
6429
6490
|
},
|
|
6430
|
-
/* @__PURE__ */ h(
|
|
6491
|
+
/* @__PURE__ */ h$1(
|
|
6431
6492
|
"button",
|
|
6432
6493
|
{
|
|
6433
6494
|
type: "button",
|
|
@@ -6448,7 +6509,7 @@ const Toolbar = defineComponent({
|
|
|
6448
6509
|
backgroundColor: formatPainterState.value ? "var(--crepe-color-selected, var(--crepe-color-hover))" : void 0
|
|
6449
6510
|
}
|
|
6450
6511
|
},
|
|
6451
|
-
/* @__PURE__ */ h(
|
|
6512
|
+
/* @__PURE__ */ h$1(
|
|
6452
6513
|
"span",
|
|
6453
6514
|
{
|
|
6454
6515
|
style: {
|
|
@@ -6461,19 +6522,19 @@ const Toolbar = defineComponent({
|
|
|
6461
6522
|
)
|
|
6462
6523
|
)
|
|
6463
6524
|
),
|
|
6464
|
-
/* @__PURE__ */ h(
|
|
6525
|
+
/* @__PURE__ */ h$1(
|
|
6465
6526
|
"div",
|
|
6466
6527
|
{
|
|
6467
6528
|
class: "divider",
|
|
6468
6529
|
style: {
|
|
6469
6530
|
margin: "0 4px",
|
|
6470
6531
|
alignSelf: "center",
|
|
6471
|
-
display: isSectionOverflowed(
|
|
6532
|
+
display: isSectionOverflowed(2) ? "none" : void 0,
|
|
6472
6533
|
flexShrink: 0
|
|
6473
6534
|
}
|
|
6474
6535
|
}
|
|
6475
6536
|
),
|
|
6476
|
-
/* @__PURE__ */ h(
|
|
6537
|
+
/* @__PURE__ */ h$1(
|
|
6477
6538
|
"div",
|
|
6478
6539
|
{
|
|
6479
6540
|
class: "toolbar-item custom-font-family-item",
|
|
@@ -6481,14 +6542,14 @@ const Toolbar = defineComponent({
|
|
|
6481
6542
|
onMouseleave: handleFontFamilyLeave,
|
|
6482
6543
|
style: {
|
|
6483
6544
|
position: "relative",
|
|
6484
|
-
display: isSectionOverflowed(
|
|
6545
|
+
display: isSectionOverflowed(3) ? "none" : "flex",
|
|
6485
6546
|
alignItems: "center",
|
|
6486
6547
|
padding: "0 6px",
|
|
6487
6548
|
minWidth: "50px",
|
|
6488
6549
|
flexShrink: 0
|
|
6489
6550
|
}
|
|
6490
6551
|
},
|
|
6491
|
-
/* @__PURE__ */ h(
|
|
6552
|
+
/* @__PURE__ */ h$1(
|
|
6492
6553
|
"span",
|
|
6493
6554
|
{
|
|
6494
6555
|
style: {
|
|
@@ -6502,7 +6563,7 @@ const Toolbar = defineComponent({
|
|
|
6502
6563
|
},
|
|
6503
6564
|
currentFontState.value.fontFamily && currentFontState.value.fontFamily !== "mixed" ? currentFontState.value.fontFamily.split(",")[0].replace(/['"]/g, "") || (ctx ? i18n(ctx, "customMenu.fontDefault") : "\u9ED8\u8BA4") : ctx ? i18n(ctx, "customMenu.fontDefault") : "\u9ED8\u8BA4"
|
|
6504
6565
|
),
|
|
6505
|
-
/* @__PURE__ */ h(
|
|
6566
|
+
/* @__PURE__ */ h$1(
|
|
6506
6567
|
"span",
|
|
6507
6568
|
{
|
|
6508
6569
|
style: {
|
|
@@ -6512,10 +6573,10 @@ const Toolbar = defineComponent({
|
|
|
6512
6573
|
marginLeft: "4px"
|
|
6513
6574
|
}
|
|
6514
6575
|
},
|
|
6515
|
-
/* @__PURE__ */ h(Icon, { icon: chevronDownIcon })
|
|
6576
|
+
/* @__PURE__ */ h$1(Icon, { icon: chevronDownIcon })
|
|
6516
6577
|
)
|
|
6517
6578
|
),
|
|
6518
|
-
/* @__PURE__ */ h(
|
|
6579
|
+
/* @__PURE__ */ h$1(
|
|
6519
6580
|
"div",
|
|
6520
6581
|
{
|
|
6521
6582
|
class: "toolbar-item custom-font-size-item",
|
|
@@ -6523,15 +6584,15 @@ const Toolbar = defineComponent({
|
|
|
6523
6584
|
onMouseleave: handleFontSizeLeave,
|
|
6524
6585
|
style: {
|
|
6525
6586
|
position: "relative",
|
|
6526
|
-
display: isSectionOverflowed(
|
|
6587
|
+
display: isSectionOverflowed(4) ? "none" : "flex",
|
|
6527
6588
|
alignItems: "center",
|
|
6528
6589
|
padding: "0 6px",
|
|
6529
6590
|
minWidth: "40px",
|
|
6530
6591
|
flexShrink: 0
|
|
6531
6592
|
}
|
|
6532
6593
|
},
|
|
6533
|
-
/* @__PURE__ */ h("span", { style: { fontSize: "13px", color: "#363B4C" } }, currentFontState.value.fontSize && currentFontState.value.fontSize !== "mixed" ? currentFontState.value.fontSize : "16px"),
|
|
6534
|
-
/* @__PURE__ */ h(
|
|
6594
|
+
/* @__PURE__ */ h$1("span", { style: { fontSize: "13px", color: "#363B4C" } }, currentFontState.value.fontSize && currentFontState.value.fontSize !== "mixed" ? currentFontState.value.fontSize : "16px"),
|
|
6595
|
+
/* @__PURE__ */ h$1(
|
|
6535
6596
|
"span",
|
|
6536
6597
|
{
|
|
6537
6598
|
style: {
|
|
@@ -6541,22 +6602,22 @@ const Toolbar = defineComponent({
|
|
|
6541
6602
|
marginLeft: "4px"
|
|
6542
6603
|
}
|
|
6543
6604
|
},
|
|
6544
|
-
/* @__PURE__ */ h(Icon, { icon: chevronDownIcon })
|
|
6605
|
+
/* @__PURE__ */ h$1(Icon, { icon: chevronDownIcon })
|
|
6545
6606
|
)
|
|
6546
6607
|
),
|
|
6547
|
-
/* @__PURE__ */ h(
|
|
6608
|
+
/* @__PURE__ */ h$1(
|
|
6548
6609
|
"div",
|
|
6549
6610
|
{
|
|
6550
6611
|
class: "divider",
|
|
6551
6612
|
style: {
|
|
6552
6613
|
margin: "0 4px",
|
|
6553
6614
|
alignSelf: "center",
|
|
6554
|
-
display: isSectionOverflowed(
|
|
6615
|
+
display: isSectionOverflowed(5) ? "none" : void 0,
|
|
6555
6616
|
flexShrink: 0
|
|
6556
6617
|
}
|
|
6557
6618
|
}
|
|
6558
6619
|
),
|
|
6559
|
-
/* @__PURE__ */ h(
|
|
6620
|
+
/* @__PURE__ */ h$1(
|
|
6560
6621
|
"div",
|
|
6561
6622
|
{
|
|
6562
6623
|
class: "toolbar-item",
|
|
@@ -6564,28 +6625,28 @@ const Toolbar = defineComponent({
|
|
|
6564
6625
|
onMouseleave: handleAlignLeave,
|
|
6565
6626
|
style: {
|
|
6566
6627
|
position: "relative",
|
|
6567
|
-
display: isSectionOverflowed(
|
|
6628
|
+
display: isSectionOverflowed(6) ? "none" : "flex",
|
|
6568
6629
|
alignItems: "center",
|
|
6569
6630
|
padding: "0 6px",
|
|
6570
6631
|
flexShrink: 0
|
|
6571
6632
|
}
|
|
6572
6633
|
},
|
|
6573
|
-
/* @__PURE__ */ h(
|
|
6634
|
+
/* @__PURE__ */ h$1(
|
|
6574
6635
|
"span",
|
|
6575
6636
|
{
|
|
6576
6637
|
style: { display: "inline-flex", alignItems: "center" },
|
|
6577
6638
|
innerHTML: currentAlignIndent.value.align === "center" ? alignCenterIcon : currentAlignIndent.value.align === "right" ? alignRightIcon : alignLeftIcon
|
|
6578
6639
|
}
|
|
6579
6640
|
),
|
|
6580
|
-
/* @__PURE__ */ h(
|
|
6641
|
+
/* @__PURE__ */ h$1(
|
|
6581
6642
|
"span",
|
|
6582
6643
|
{
|
|
6583
6644
|
style: { width: "20px", display: "flex", alignItems: "center" }
|
|
6584
6645
|
},
|
|
6585
|
-
/* @__PURE__ */ h(Icon, { icon: chevronDownIcon })
|
|
6646
|
+
/* @__PURE__ */ h$1(Icon, { icon: chevronDownIcon })
|
|
6586
6647
|
)
|
|
6587
6648
|
),
|
|
6588
|
-
/* @__PURE__ */ h(
|
|
6649
|
+
/* @__PURE__ */ h$1(
|
|
6589
6650
|
"div",
|
|
6590
6651
|
{
|
|
6591
6652
|
class: "toolbar-item",
|
|
@@ -6593,13 +6654,13 @@ const Toolbar = defineComponent({
|
|
|
6593
6654
|
onMouseleave: handleColorLeave,
|
|
6594
6655
|
style: {
|
|
6595
6656
|
position: "relative",
|
|
6596
|
-
display: isSectionOverflowed(
|
|
6657
|
+
display: isSectionOverflowed(7) ? "none" : "flex",
|
|
6597
6658
|
alignItems: "center",
|
|
6598
6659
|
padding: "0 4px",
|
|
6599
6660
|
flexShrink: 0
|
|
6600
6661
|
}
|
|
6601
6662
|
},
|
|
6602
|
-
/* @__PURE__ */ h(
|
|
6663
|
+
/* @__PURE__ */ h$1(
|
|
6603
6664
|
"span",
|
|
6604
6665
|
{
|
|
6605
6666
|
class: "milkdown-icon",
|
|
@@ -6612,22 +6673,22 @@ const Toolbar = defineComponent({
|
|
|
6612
6673
|
}
|
|
6613
6674
|
}
|
|
6614
6675
|
),
|
|
6615
|
-
/* @__PURE__ */ h(
|
|
6676
|
+
/* @__PURE__ */ h$1(
|
|
6616
6677
|
"span",
|
|
6617
6678
|
{
|
|
6618
6679
|
style: { width: "20px", display: "flex", alignItems: "center" }
|
|
6619
6680
|
},
|
|
6620
|
-
/* @__PURE__ */ h(Icon, { icon: chevronDownIcon })
|
|
6681
|
+
/* @__PURE__ */ h$1(Icon, { icon: chevronDownIcon })
|
|
6621
6682
|
)
|
|
6622
6683
|
),
|
|
6623
6684
|
(() => {
|
|
6624
|
-
let sectionIdx =
|
|
6685
|
+
let sectionIdx = 8;
|
|
6625
6686
|
return nonHeadingGroups.map((group, groupIndex) => {
|
|
6626
6687
|
const items = group.items.map((item) => {
|
|
6627
6688
|
const idx = sectionIdx;
|
|
6628
6689
|
sectionIdx++;
|
|
6629
6690
|
const isTable = item.icon === tableIcon;
|
|
6630
|
-
return /* @__PURE__ */ h(
|
|
6691
|
+
return /* @__PURE__ */ h$1(
|
|
6631
6692
|
"div",
|
|
6632
6693
|
{
|
|
6633
6694
|
key: item.label,
|
|
@@ -6639,7 +6700,7 @@ const Toolbar = defineComponent({
|
|
|
6639
6700
|
onMouseenter: isTable ? handleTableEnter : void 0,
|
|
6640
6701
|
onMouseleave: isTable ? handleTableLeave : void 0
|
|
6641
6702
|
},
|
|
6642
|
-
/* @__PURE__ */ h(
|
|
6703
|
+
/* @__PURE__ */ h$1(
|
|
6643
6704
|
"button",
|
|
6644
6705
|
{
|
|
6645
6706
|
type: "button",
|
|
@@ -6647,6 +6708,7 @@ const Toolbar = defineComponent({
|
|
|
6647
6708
|
"toolbar-item",
|
|
6648
6709
|
ctx && checkActive(item.active) && "active"
|
|
6649
6710
|
),
|
|
6711
|
+
"data-key": item.key,
|
|
6650
6712
|
onPointerdown: (e) => {
|
|
6651
6713
|
if (isTable) {
|
|
6652
6714
|
e.preventDefault();
|
|
@@ -6662,14 +6724,14 @@ const Toolbar = defineComponent({
|
|
|
6662
6724
|
justifyContent: "center"
|
|
6663
6725
|
}
|
|
6664
6726
|
},
|
|
6665
|
-
/* @__PURE__ */ h(
|
|
6727
|
+
/* @__PURE__ */ h$1(
|
|
6666
6728
|
"span",
|
|
6667
6729
|
{
|
|
6668
6730
|
style: { display: "inline-flex", alignItems: "center" },
|
|
6669
6731
|
innerHTML: ctx && checkActive(item.active) ? activeIconMap[item.icon] || item.icon : item.icon
|
|
6670
6732
|
}
|
|
6671
6733
|
),
|
|
6672
|
-
isTable ? /* @__PURE__ */ h(
|
|
6734
|
+
isTable ? /* @__PURE__ */ h$1(
|
|
6673
6735
|
"span",
|
|
6674
6736
|
{
|
|
6675
6737
|
style: {
|
|
@@ -6680,7 +6742,7 @@ const Toolbar = defineComponent({
|
|
|
6680
6742
|
opacity: 0.5
|
|
6681
6743
|
}
|
|
6682
6744
|
},
|
|
6683
|
-
/* @__PURE__ */ h(Icon, { icon: chevronDownIcon })
|
|
6745
|
+
/* @__PURE__ */ h$1(Icon, { icon: chevronDownIcon })
|
|
6684
6746
|
) : null
|
|
6685
6747
|
)
|
|
6686
6748
|
);
|
|
@@ -6689,7 +6751,7 @@ const Toolbar = defineComponent({
|
|
|
6689
6751
|
if (groupIndex < nonHeadingGroups.length - 1 && group.items.length > 0) {
|
|
6690
6752
|
sectionIdx++;
|
|
6691
6753
|
}
|
|
6692
|
-
return /* @__PURE__ */ h(Fragment, { key: group.key }, items, groupIndex < nonHeadingGroups.length - 1 && group.items.length > 0 ? /* @__PURE__ */ h(
|
|
6754
|
+
return /* @__PURE__ */ h$1(Fragment, { key: group.key }, items, groupIndex < nonHeadingGroups.length - 1 && group.items.length > 0 ? /* @__PURE__ */ h$1(
|
|
6693
6755
|
"div",
|
|
6694
6756
|
{
|
|
6695
6757
|
class: "divider",
|
|
@@ -6701,7 +6763,7 @@ const Toolbar = defineComponent({
|
|
|
6701
6763
|
) : null);
|
|
6702
6764
|
});
|
|
6703
6765
|
})(),
|
|
6704
|
-
hasOverflow ? /* @__PURE__ */ h(
|
|
6766
|
+
hasOverflow ? /* @__PURE__ */ h$1(
|
|
6705
6767
|
"div",
|
|
6706
6768
|
{
|
|
6707
6769
|
"data-overflow-button": "true",
|
|
@@ -6728,7 +6790,7 @@ const Toolbar = defineComponent({
|
|
|
6728
6790
|
showOverflowMenu.value = true;
|
|
6729
6791
|
}
|
|
6730
6792
|
},
|
|
6731
|
-
/* @__PURE__ */ h(
|
|
6793
|
+
/* @__PURE__ */ h$1(
|
|
6732
6794
|
"span",
|
|
6733
6795
|
{
|
|
6734
6796
|
style: { display: "inline-flex", alignItems: "center" },
|
|
@@ -6736,7 +6798,7 @@ const Toolbar = defineComponent({
|
|
|
6736
6798
|
}
|
|
6737
6799
|
)
|
|
6738
6800
|
) : null,
|
|
6739
|
-
showBlockMenu.value ? /* @__PURE__ */ h(
|
|
6801
|
+
showBlockMenu.value ? /* @__PURE__ */ h$1(
|
|
6740
6802
|
"div",
|
|
6741
6803
|
{
|
|
6742
6804
|
class: "milkdown-slash-menu custom-submenu",
|
|
@@ -6761,7 +6823,7 @@ const Toolbar = defineComponent({
|
|
|
6761
6823
|
},
|
|
6762
6824
|
onMouseleave: handleBlockLeave
|
|
6763
6825
|
},
|
|
6764
|
-
/* @__PURE__ */ h(
|
|
6826
|
+
/* @__PURE__ */ h$1(
|
|
6765
6827
|
"div",
|
|
6766
6828
|
{
|
|
6767
6829
|
style: {
|
|
@@ -6818,7 +6880,7 @@ const Toolbar = defineComponent({
|
|
|
6818
6880
|
);
|
|
6819
6881
|
})
|
|
6820
6882
|
) : null,
|
|
6821
|
-
showAlignMenu.value ? /* @__PURE__ */ h(
|
|
6883
|
+
showAlignMenu.value ? /* @__PURE__ */ h$1(
|
|
6822
6884
|
"div",
|
|
6823
6885
|
{
|
|
6824
6886
|
class: "milkdown-slash-menu custom-submenu",
|
|
@@ -6841,7 +6903,7 @@ const Toolbar = defineComponent({
|
|
|
6841
6903
|
},
|
|
6842
6904
|
onMouseleave: handleAlignLeave
|
|
6843
6905
|
},
|
|
6844
|
-
/* @__PURE__ */ h(
|
|
6906
|
+
/* @__PURE__ */ h$1(
|
|
6845
6907
|
"div",
|
|
6846
6908
|
{
|
|
6847
6909
|
style: {
|
|
@@ -6872,7 +6934,7 @@ const Toolbar = defineComponent({
|
|
|
6872
6934
|
currentAlignIndent.value.align === "right",
|
|
6873
6935
|
() => setAlign("right")
|
|
6874
6936
|
),
|
|
6875
|
-
/* @__PURE__ */ h(
|
|
6937
|
+
/* @__PURE__ */ h$1(
|
|
6876
6938
|
"div",
|
|
6877
6939
|
{
|
|
6878
6940
|
style: {
|
|
@@ -6894,7 +6956,7 @@ const Toolbar = defineComponent({
|
|
|
6894
6956
|
() => setIndent(-1),
|
|
6895
6957
|
currentAlignIndent.value.indent <= 0
|
|
6896
6958
|
),
|
|
6897
|
-
canMerge.value || canSplit.value ? /* @__PURE__ */ h(Fragment, null, /* @__PURE__ */ h(
|
|
6959
|
+
canMerge.value || canSplit.value ? /* @__PURE__ */ h$1(Fragment, null, /* @__PURE__ */ h$1(
|
|
6898
6960
|
"div",
|
|
6899
6961
|
{
|
|
6900
6962
|
style: {
|
|
@@ -6914,7 +6976,7 @@ const Toolbar = defineComponent({
|
|
|
6914
6976
|
onSplitCell
|
|
6915
6977
|
)) : null
|
|
6916
6978
|
) : null,
|
|
6917
|
-
showColorMenu.value ? /* @__PURE__ */ h(
|
|
6979
|
+
showColorMenu.value ? /* @__PURE__ */ h$1(
|
|
6918
6980
|
"div",
|
|
6919
6981
|
{
|
|
6920
6982
|
class: "milkdown-slash-menu custom-submenu",
|
|
@@ -6938,7 +7000,7 @@ const Toolbar = defineComponent({
|
|
|
6938
7000
|
},
|
|
6939
7001
|
onMouseleave: handleColorLeave
|
|
6940
7002
|
},
|
|
6941
|
-
/* @__PURE__ */ h(
|
|
7003
|
+
/* @__PURE__ */ h$1(
|
|
6942
7004
|
"div",
|
|
6943
7005
|
{
|
|
6944
7006
|
style: {
|
|
@@ -6951,7 +7013,7 @@ const Toolbar = defineComponent({
|
|
|
6951
7013
|
}
|
|
6952
7014
|
}
|
|
6953
7015
|
),
|
|
6954
|
-
/* @__PURE__ */ h(
|
|
7016
|
+
/* @__PURE__ */ h$1(
|
|
6955
7017
|
"div",
|
|
6956
7018
|
{
|
|
6957
7019
|
style: {
|
|
@@ -6962,7 +7024,7 @@ const Toolbar = defineComponent({
|
|
|
6962
7024
|
},
|
|
6963
7025
|
ctx ? i18n(ctx, "customMenu.textColor") : "\u5B57\u4F53\u989C\u8272"
|
|
6964
7026
|
),
|
|
6965
|
-
/* @__PURE__ */ h("div", { style: { display: "flex", gap: "4px", flexWrap: "wrap" } }, [
|
|
7027
|
+
/* @__PURE__ */ h$1("div", { style: { display: "flex", gap: "4px", flexWrap: "wrap" } }, [
|
|
6966
7028
|
"#000000",
|
|
6967
7029
|
"#8C8C8C",
|
|
6968
7030
|
"#F5222D",
|
|
@@ -6971,7 +7033,7 @@ const Toolbar = defineComponent({
|
|
|
6971
7033
|
"#52C41A",
|
|
6972
7034
|
"#1677FF",
|
|
6973
7035
|
"#722ED1"
|
|
6974
|
-
].map((color) => /* @__PURE__ */ h(
|
|
7036
|
+
].map((color) => /* @__PURE__ */ h$1(
|
|
6975
7037
|
"div",
|
|
6976
7038
|
{
|
|
6977
7039
|
key: color,
|
|
@@ -6994,7 +7056,7 @@ const Toolbar = defineComponent({
|
|
|
6994
7056
|
},
|
|
6995
7057
|
"A"
|
|
6996
7058
|
))),
|
|
6997
|
-
/* @__PURE__ */ h(
|
|
7059
|
+
/* @__PURE__ */ h$1(
|
|
6998
7060
|
"div",
|
|
6999
7061
|
{
|
|
7000
7062
|
style: {
|
|
@@ -7006,7 +7068,7 @@ const Toolbar = defineComponent({
|
|
|
7006
7068
|
},
|
|
7007
7069
|
ctx ? i18n(ctx, "customMenu.bgColor") : "\u80CC\u666F\u989C\u8272"
|
|
7008
7070
|
),
|
|
7009
|
-
/* @__PURE__ */ h("div", { style: { display: "flex", gap: "4px", flexWrap: "wrap" } }, [
|
|
7071
|
+
/* @__PURE__ */ h$1("div", { style: { display: "flex", gap: "4px", flexWrap: "wrap" } }, [
|
|
7010
7072
|
"transparent",
|
|
7011
7073
|
"#F5F5F5",
|
|
7012
7074
|
"#FFCCC7",
|
|
@@ -7015,7 +7077,7 @@ const Toolbar = defineComponent({
|
|
|
7015
7077
|
"#D9F7BE",
|
|
7016
7078
|
"#D6E4FF",
|
|
7017
7079
|
"#EFDBFF"
|
|
7018
|
-
].map((color) => /* @__PURE__ */ h(
|
|
7080
|
+
].map((color) => /* @__PURE__ */ h$1(
|
|
7019
7081
|
"div",
|
|
7020
7082
|
{
|
|
7021
7083
|
key: color,
|
|
@@ -7032,7 +7094,7 @@ const Toolbar = defineComponent({
|
|
|
7032
7094
|
overflow: "hidden"
|
|
7033
7095
|
}
|
|
7034
7096
|
},
|
|
7035
|
-
color === "transparent" ? /* @__PURE__ */ h(
|
|
7097
|
+
color === "transparent" ? /* @__PURE__ */ h$1(
|
|
7036
7098
|
"div",
|
|
7037
7099
|
{
|
|
7038
7100
|
style: {
|
|
@@ -7056,7 +7118,7 @@ const Toolbar = defineComponent({
|
|
|
7056
7118
|
"#52C41A",
|
|
7057
7119
|
"#1677FF",
|
|
7058
7120
|
"#722ED1"
|
|
7059
|
-
].map((color) => /* @__PURE__ */ h(
|
|
7121
|
+
].map((color) => /* @__PURE__ */ h$1(
|
|
7060
7122
|
"div",
|
|
7061
7123
|
{
|
|
7062
7124
|
key: color,
|
|
@@ -7072,7 +7134,7 @@ const Toolbar = defineComponent({
|
|
|
7072
7134
|
}
|
|
7073
7135
|
}
|
|
7074
7136
|
))),
|
|
7075
|
-
/* @__PURE__ */ h(
|
|
7137
|
+
/* @__PURE__ */ h$1(
|
|
7076
7138
|
"button",
|
|
7077
7139
|
{
|
|
7078
7140
|
onClick: clearColor,
|
|
@@ -7091,7 +7153,7 @@ const Toolbar = defineComponent({
|
|
|
7091
7153
|
ctx ? i18n(ctx, "customMenu.restoreDefault") : "\u6062\u590D\u9ED8\u8BA4"
|
|
7092
7154
|
)
|
|
7093
7155
|
) : null,
|
|
7094
|
-
showFontFamilyMenu.value ? /* @__PURE__ */ h(
|
|
7156
|
+
showFontFamilyMenu.value ? /* @__PURE__ */ h$1(
|
|
7095
7157
|
"div",
|
|
7096
7158
|
{
|
|
7097
7159
|
class: "milkdown-slash-menu custom-submenu",
|
|
@@ -7116,7 +7178,7 @@ const Toolbar = defineComponent({
|
|
|
7116
7178
|
},
|
|
7117
7179
|
onMouseleave: handleFontFamilyLeave
|
|
7118
7180
|
},
|
|
7119
|
-
/* @__PURE__ */ h(
|
|
7181
|
+
/* @__PURE__ */ h$1(
|
|
7120
7182
|
"div",
|
|
7121
7183
|
{
|
|
7122
7184
|
style: {
|
|
@@ -7177,7 +7239,7 @@ const Toolbar = defineComponent({
|
|
|
7177
7239
|
}
|
|
7178
7240
|
].map((font) => {
|
|
7179
7241
|
const supported = isFontSupported(font.value);
|
|
7180
|
-
return /* @__PURE__ */ h(
|
|
7242
|
+
return /* @__PURE__ */ h$1(
|
|
7181
7243
|
"div",
|
|
7182
7244
|
{
|
|
7183
7245
|
key: font.label,
|
|
@@ -7214,7 +7276,7 @@ const Toolbar = defineComponent({
|
|
|
7214
7276
|
e.currentTarget.style.backgroundColor = "transparent";
|
|
7215
7277
|
}
|
|
7216
7278
|
},
|
|
7217
|
-
/* @__PURE__ */ h(
|
|
7279
|
+
/* @__PURE__ */ h$1(
|
|
7218
7280
|
"span",
|
|
7219
7281
|
{
|
|
7220
7282
|
style: {
|
|
@@ -7224,7 +7286,7 @@ const Toolbar = defineComponent({
|
|
|
7224
7286
|
},
|
|
7225
7287
|
font.label
|
|
7226
7288
|
),
|
|
7227
|
-
currentFontState.value.fontFamily === font.value ? /* @__PURE__ */ h(
|
|
7289
|
+
currentFontState.value.fontFamily === font.value ? /* @__PURE__ */ h$1(
|
|
7228
7290
|
"span",
|
|
7229
7291
|
{
|
|
7230
7292
|
style: {
|
|
@@ -7233,12 +7295,12 @@ const Toolbar = defineComponent({
|
|
|
7233
7295
|
color: "var(--crepe-color-primary)"
|
|
7234
7296
|
}
|
|
7235
7297
|
},
|
|
7236
|
-
/* @__PURE__ */ h(Icon, { icon: confirmIcon })
|
|
7298
|
+
/* @__PURE__ */ h$1(Icon, { icon: confirmIcon })
|
|
7237
7299
|
) : null
|
|
7238
7300
|
);
|
|
7239
7301
|
})
|
|
7240
7302
|
) : null,
|
|
7241
|
-
showFontSizeMenu.value ? /* @__PURE__ */ h(
|
|
7303
|
+
showFontSizeMenu.value ? /* @__PURE__ */ h$1(
|
|
7242
7304
|
"div",
|
|
7243
7305
|
{
|
|
7244
7306
|
class: "milkdown-slash-menu custom-submenu",
|
|
@@ -7263,7 +7325,7 @@ const Toolbar = defineComponent({
|
|
|
7263
7325
|
},
|
|
7264
7326
|
onMouseleave: handleFontSizeLeave
|
|
7265
7327
|
},
|
|
7266
|
-
/* @__PURE__ */ h(
|
|
7328
|
+
/* @__PURE__ */ h$1(
|
|
7267
7329
|
"div",
|
|
7268
7330
|
{
|
|
7269
7331
|
style: {
|
|
@@ -7288,7 +7350,7 @@ const Toolbar = defineComponent({
|
|
|
7288
7350
|
{ label: "28px", value: "28px" },
|
|
7289
7351
|
{ label: "32px", value: "32px" },
|
|
7290
7352
|
{ label: "36px", value: "36px" }
|
|
7291
|
-
].map((size) => /* @__PURE__ */ h(
|
|
7353
|
+
].map((size) => /* @__PURE__ */ h$1(
|
|
7292
7354
|
"div",
|
|
7293
7355
|
{
|
|
7294
7356
|
key: size.label,
|
|
@@ -7319,7 +7381,7 @@ const Toolbar = defineComponent({
|
|
|
7319
7381
|
e.currentTarget.style.backgroundColor = "transparent";
|
|
7320
7382
|
}
|
|
7321
7383
|
},
|
|
7322
|
-
/* @__PURE__ */ h(
|
|
7384
|
+
/* @__PURE__ */ h$1(
|
|
7323
7385
|
"span",
|
|
7324
7386
|
{
|
|
7325
7387
|
style: {
|
|
@@ -7329,7 +7391,7 @@ const Toolbar = defineComponent({
|
|
|
7329
7391
|
},
|
|
7330
7392
|
size.label
|
|
7331
7393
|
),
|
|
7332
|
-
currentFontState.value.fontSize === size.value ? /* @__PURE__ */ h(
|
|
7394
|
+
currentFontState.value.fontSize === size.value ? /* @__PURE__ */ h$1(
|
|
7333
7395
|
"span",
|
|
7334
7396
|
{
|
|
7335
7397
|
style: {
|
|
@@ -7338,11 +7400,11 @@ const Toolbar = defineComponent({
|
|
|
7338
7400
|
color: "var(--crepe-color-primary)"
|
|
7339
7401
|
}
|
|
7340
7402
|
},
|
|
7341
|
-
/* @__PURE__ */ h(Icon, { icon: confirmIcon })
|
|
7403
|
+
/* @__PURE__ */ h$1(Icon, { icon: confirmIcon })
|
|
7342
7404
|
) : null
|
|
7343
7405
|
))
|
|
7344
7406
|
) : null,
|
|
7345
|
-
showTableMenu.value ? /* @__PURE__ */ h(
|
|
7407
|
+
showTableMenu.value ? /* @__PURE__ */ h$1(
|
|
7346
7408
|
"div",
|
|
7347
7409
|
{
|
|
7348
7410
|
class: "milkdown-slash-menu custom-submenu",
|
|
@@ -7365,7 +7427,7 @@ const Toolbar = defineComponent({
|
|
|
7365
7427
|
},
|
|
7366
7428
|
onMouseleave: handleTableLeave
|
|
7367
7429
|
},
|
|
7368
|
-
/* @__PURE__ */ h(
|
|
7430
|
+
/* @__PURE__ */ h$1(
|
|
7369
7431
|
"div",
|
|
7370
7432
|
{
|
|
7371
7433
|
style: {
|
|
@@ -7378,7 +7440,7 @@ const Toolbar = defineComponent({
|
|
|
7378
7440
|
}
|
|
7379
7441
|
}
|
|
7380
7442
|
),
|
|
7381
|
-
/* @__PURE__ */ h(
|
|
7443
|
+
/* @__PURE__ */ h$1(
|
|
7382
7444
|
"div",
|
|
7383
7445
|
{
|
|
7384
7446
|
style: {
|
|
@@ -7390,7 +7452,7 @@ const Toolbar = defineComponent({
|
|
|
7390
7452
|
},
|
|
7391
7453
|
i18n(ctx, "customMenu.insertTable")
|
|
7392
7454
|
),
|
|
7393
|
-
/* @__PURE__ */ h(
|
|
7455
|
+
/* @__PURE__ */ h$1(
|
|
7394
7456
|
"div",
|
|
7395
7457
|
{
|
|
7396
7458
|
style: {
|
|
@@ -7403,7 +7465,7 @@ const Toolbar = defineComponent({
|
|
|
7403
7465
|
Array.from({ length: 9 }).map(
|
|
7404
7466
|
(_, r) => Array.from({ length: 9 }).map((_2, c) => {
|
|
7405
7467
|
const isHovered = r < tableHoverIndices.value.r && c < tableHoverIndices.value.c;
|
|
7406
|
-
return /* @__PURE__ */ h(
|
|
7468
|
+
return /* @__PURE__ */ h$1(
|
|
7407
7469
|
"div",
|
|
7408
7470
|
{
|
|
7409
7471
|
key: `cell-${r}-${c}`,
|
|
@@ -7432,7 +7494,7 @@ const Toolbar = defineComponent({
|
|
|
7432
7494
|
})
|
|
7433
7495
|
)
|
|
7434
7496
|
),
|
|
7435
|
-
tableHoverIndices.value.r > 0 ? /* @__PURE__ */ h(
|
|
7497
|
+
tableHoverIndices.value.r > 0 ? /* @__PURE__ */ h$1(
|
|
7436
7498
|
"div",
|
|
7437
7499
|
{
|
|
7438
7500
|
style: {
|
|
@@ -7445,7 +7507,7 @@ const Toolbar = defineComponent({
|
|
|
7445
7507
|
tableHoverIndices.value.r,
|
|
7446
7508
|
" x ",
|
|
7447
7509
|
tableHoverIndices.value.c
|
|
7448
|
-
) : /* @__PURE__ */ h(
|
|
7510
|
+
) : /* @__PURE__ */ h$1(
|
|
7449
7511
|
"div",
|
|
7450
7512
|
{
|
|
7451
7513
|
style: {
|
|
@@ -7458,7 +7520,7 @@ const Toolbar = defineComponent({
|
|
|
7458
7520
|
"0 x 0"
|
|
7459
7521
|
)
|
|
7460
7522
|
) : null,
|
|
7461
|
-
showOverflowMenu.value ? /* @__PURE__ */ h(
|
|
7523
|
+
showOverflowMenu.value ? /* @__PURE__ */ h$1(
|
|
7462
7524
|
"div",
|
|
7463
7525
|
{
|
|
7464
7526
|
class: "overflow-menu-popup",
|
|
@@ -7483,11 +7545,12 @@ const Toolbar = defineComponent({
|
|
|
7483
7545
|
(() => {
|
|
7484
7546
|
const cutoff = overflowVisibleCount.value;
|
|
7485
7547
|
const items = [];
|
|
7486
|
-
const renderIconButton = (iconHtml, title, isActive, onClick2, hasDropdown = false, onMouseEnter, onMouseLeave) => /* @__PURE__ */ h(
|
|
7548
|
+
const renderIconButton = (iconHtml, title, isActive, onClick2, hasDropdown = false, onMouseEnter, onMouseLeave, key) => /* @__PURE__ */ h$1(
|
|
7487
7549
|
"button",
|
|
7488
7550
|
{
|
|
7489
7551
|
type: "button",
|
|
7490
7552
|
class: clsx("toolbar-item", isActive && "active"),
|
|
7553
|
+
"data-key": key,
|
|
7491
7554
|
title,
|
|
7492
7555
|
onPointerdown: (e) => {
|
|
7493
7556
|
e.preventDefault();
|
|
@@ -7506,14 +7569,14 @@ const Toolbar = defineComponent({
|
|
|
7506
7569
|
justifyContent: "center"
|
|
7507
7570
|
}
|
|
7508
7571
|
},
|
|
7509
|
-
/* @__PURE__ */ h(
|
|
7572
|
+
/* @__PURE__ */ h$1(
|
|
7510
7573
|
"span",
|
|
7511
7574
|
{
|
|
7512
7575
|
style: { display: "inline-flex", alignItems: "center" },
|
|
7513
7576
|
innerHTML: iconHtml
|
|
7514
7577
|
}
|
|
7515
7578
|
),
|
|
7516
|
-
hasDropdown ? /* @__PURE__ */ h(
|
|
7579
|
+
hasDropdown ? /* @__PURE__ */ h$1(
|
|
7517
7580
|
"span",
|
|
7518
7581
|
{
|
|
7519
7582
|
style: {
|
|
@@ -7523,7 +7586,7 @@ const Toolbar = defineComponent({
|
|
|
7523
7586
|
opacity: 0.5
|
|
7524
7587
|
}
|
|
7525
7588
|
},
|
|
7526
|
-
/* @__PURE__ */ h(Icon, { icon: chevronDownIcon })
|
|
7589
|
+
/* @__PURE__ */ h$1(Icon, { icon: chevronDownIcon })
|
|
7527
7590
|
) : null
|
|
7528
7591
|
);
|
|
7529
7592
|
if (0 >= cutoff) {
|
|
@@ -7539,7 +7602,7 @@ const Toolbar = defineComponent({
|
|
|
7539
7602
|
)
|
|
7540
7603
|
);
|
|
7541
7604
|
}
|
|
7542
|
-
if (
|
|
7605
|
+
if (3 >= cutoff) {
|
|
7543
7606
|
items.push(
|
|
7544
7607
|
renderIconButton(
|
|
7545
7608
|
textIcon,
|
|
@@ -7552,7 +7615,7 @@ const Toolbar = defineComponent({
|
|
|
7552
7615
|
)
|
|
7553
7616
|
);
|
|
7554
7617
|
}
|
|
7555
|
-
if (
|
|
7618
|
+
if (4 >= cutoff) {
|
|
7556
7619
|
items.push(
|
|
7557
7620
|
renderIconButton(
|
|
7558
7621
|
textIcon,
|
|
@@ -7565,7 +7628,7 @@ const Toolbar = defineComponent({
|
|
|
7565
7628
|
)
|
|
7566
7629
|
);
|
|
7567
7630
|
}
|
|
7568
|
-
if (
|
|
7631
|
+
if (6 >= cutoff) {
|
|
7569
7632
|
items.push(
|
|
7570
7633
|
renderIconButton(
|
|
7571
7634
|
currentAlignIndent.value.align === "center" ? alignCenterIcon : currentAlignIndent.value.align === "right" ? alignRightIcon : alignLeftIcon,
|
|
@@ -7578,7 +7641,7 @@ const Toolbar = defineComponent({
|
|
|
7578
7641
|
)
|
|
7579
7642
|
);
|
|
7580
7643
|
}
|
|
7581
|
-
if (
|
|
7644
|
+
if (7 >= cutoff) {
|
|
7582
7645
|
items.push(
|
|
7583
7646
|
renderIconButton(
|
|
7584
7647
|
fontColorIcon,
|
|
@@ -7591,7 +7654,7 @@ const Toolbar = defineComponent({
|
|
|
7591
7654
|
)
|
|
7592
7655
|
);
|
|
7593
7656
|
}
|
|
7594
|
-
let fmtIdx =
|
|
7657
|
+
let fmtIdx = 8;
|
|
7595
7658
|
for (const group of nonHeadingGroups) {
|
|
7596
7659
|
for (const item of group.items) {
|
|
7597
7660
|
const idx = fmtIdx;
|
|
@@ -7609,7 +7672,8 @@ const Toolbar = defineComponent({
|
|
|
7609
7672
|
},
|
|
7610
7673
|
isTable,
|
|
7611
7674
|
isTable ? handleTableEnter : void 0,
|
|
7612
|
-
isTable ? handleTableLeave : void 0
|
|
7675
|
+
isTable ? handleTableLeave : void 0,
|
|
7676
|
+
item.key
|
|
7613
7677
|
)
|
|
7614
7678
|
);
|
|
7615
7679
|
}
|
|
@@ -7789,7 +7853,15 @@ const MenuBar = defineComponent({
|
|
|
7789
7853
|
{ name: "\u6D45\u7D2B", value: "#F0E6FA" },
|
|
7790
7854
|
{ name: "\u6D45\u7C89", value: "#FDE8E9" }
|
|
7791
7855
|
];
|
|
7792
|
-
const menuKeys =
|
|
7856
|
+
const menuKeys = computed(() => {
|
|
7857
|
+
var _a;
|
|
7858
|
+
const allKeys = ["file", "edit", "view", "insert", "format"];
|
|
7859
|
+
const itemsConfig = (_a = props.config) == null ? void 0 : _a.menuBarItems;
|
|
7860
|
+
if (!itemsConfig) return allKeys;
|
|
7861
|
+
return allKeys.filter(
|
|
7862
|
+
(key) => itemsConfig[key] !== false
|
|
7863
|
+
);
|
|
7864
|
+
});
|
|
7793
7865
|
const hasSubmenu = (key) => key === "view";
|
|
7794
7866
|
return () => {
|
|
7795
7867
|
const state = viewState.value;
|
|
@@ -7878,7 +7950,7 @@ const MenuBar = defineComponent({
|
|
|
7878
7950
|
e.stopPropagation();
|
|
7879
7951
|
}
|
|
7880
7952
|
},
|
|
7881
|
-
menuKeys.map((menuKey) => {
|
|
7953
|
+
menuKeys.value.map((menuKey) => {
|
|
7882
7954
|
const isHovered = activeSubmenu.value === menuKey;
|
|
7883
7955
|
const label = i18n(props.ctx, `menuBar.${menuKey}`) || menuKey;
|
|
7884
7956
|
return /* @__PURE__ */ h(
|
|
@@ -8308,7 +8380,7 @@ const labelStyle = {
|
|
|
8308
8380
|
color: "var(--crepe-color-on-surface, #333)"
|
|
8309
8381
|
};
|
|
8310
8382
|
function renderGroup(ctx, group) {
|
|
8311
|
-
return /* @__PURE__ */ h("div", { style: { marginBottom: "16px" }, key: group.titleKey }, /* @__PURE__ */ h("div", { style: groupTitleStyle }, i18n(ctx, group.titleKey)), /* @__PURE__ */ h("div", { style: { display: "flex", flexDirection: "column" } }, group.items.map((item) => /* @__PURE__ */ h("div", { key: item.labelKey, style: rowStyle }, /* @__PURE__ */ h("span", { style: labelStyle }, i18n(ctx, item.labelKey)), /* @__PURE__ */ h("div", { style: { display: "flex", gap: "4px", alignItems: "center" } }, item.keys.map((key, i) => /* @__PURE__ */ h("span", { key: i, style: badgeStyle }, fmt(key))))))));
|
|
8383
|
+
return /* @__PURE__ */ h$1("div", { style: { marginBottom: "16px" }, key: group.titleKey }, /* @__PURE__ */ h$1("div", { style: groupTitleStyle }, i18n(ctx, group.titleKey)), /* @__PURE__ */ h$1("div", { style: { display: "flex", flexDirection: "column" } }, group.items.map((item) => /* @__PURE__ */ h$1("div", { key: item.labelKey, style: rowStyle }, /* @__PURE__ */ h$1("span", { style: labelStyle }, i18n(ctx, item.labelKey)), /* @__PURE__ */ h$1("div", { style: { display: "flex", gap: "4px", alignItems: "center" } }, item.keys.map((key, i) => /* @__PURE__ */ h$1("span", { key: i, style: badgeStyle }, fmt(key))))))));
|
|
8312
8384
|
}
|
|
8313
8385
|
const ShortcutHelpModal = defineComponent({
|
|
8314
8386
|
props: {
|
|
@@ -8324,7 +8396,7 @@ const ShortcutHelpModal = defineComponent({
|
|
|
8324
8396
|
};
|
|
8325
8397
|
onMounted(() => document.addEventListener("keydown", onKeydown));
|
|
8326
8398
|
onBeforeUnmount(() => document.removeEventListener("keydown", onKeydown));
|
|
8327
|
-
return () => /* @__PURE__ */ h(
|
|
8399
|
+
return () => /* @__PURE__ */ h$1(
|
|
8328
8400
|
"div",
|
|
8329
8401
|
{
|
|
8330
8402
|
style: {
|
|
@@ -8338,7 +8410,7 @@ const ShortcutHelpModal = defineComponent({
|
|
|
8338
8410
|
},
|
|
8339
8411
|
onClick: close
|
|
8340
8412
|
},
|
|
8341
|
-
/* @__PURE__ */ h(
|
|
8413
|
+
/* @__PURE__ */ h$1(
|
|
8342
8414
|
"div",
|
|
8343
8415
|
{
|
|
8344
8416
|
style: {
|
|
@@ -8352,7 +8424,7 @@ const ShortcutHelpModal = defineComponent({
|
|
|
8352
8424
|
},
|
|
8353
8425
|
onClick: (e) => e.stopPropagation()
|
|
8354
8426
|
},
|
|
8355
|
-
/* @__PURE__ */ h(
|
|
8427
|
+
/* @__PURE__ */ h$1(
|
|
8356
8428
|
"div",
|
|
8357
8429
|
{
|
|
8358
8430
|
style: {
|
|
@@ -8364,7 +8436,7 @@ const ShortcutHelpModal = defineComponent({
|
|
|
8364
8436
|
borderBottom: "1px solid var(--crepe-color-outline-variant, color-mix(in srgb, var(--crepe-color-outline), transparent 80%))"
|
|
8365
8437
|
}
|
|
8366
8438
|
},
|
|
8367
|
-
/* @__PURE__ */ h(
|
|
8439
|
+
/* @__PURE__ */ h$1(
|
|
8368
8440
|
"span",
|
|
8369
8441
|
{
|
|
8370
8442
|
style: {
|
|
@@ -8375,7 +8447,7 @@ const ShortcutHelpModal = defineComponent({
|
|
|
8375
8447
|
},
|
|
8376
8448
|
i18n(props.ctx, "shortcuts.title")
|
|
8377
8449
|
),
|
|
8378
|
-
/* @__PURE__ */ h(
|
|
8450
|
+
/* @__PURE__ */ h$1(
|
|
8379
8451
|
"button",
|
|
8380
8452
|
{
|
|
8381
8453
|
type: "button",
|
|
@@ -8393,10 +8465,10 @@ const ShortcutHelpModal = defineComponent({
|
|
|
8393
8465
|
color: "var(--crepe-color-on-surface-variant, #666)"
|
|
8394
8466
|
}
|
|
8395
8467
|
},
|
|
8396
|
-
/* @__PURE__ */ h(Icon, { icon: closeIcon })
|
|
8468
|
+
/* @__PURE__ */ h$1(Icon, { icon: closeIcon })
|
|
8397
8469
|
)
|
|
8398
8470
|
),
|
|
8399
|
-
/* @__PURE__ */ h("div", { style: { display: "flex", gap: "24px" } }, /* @__PURE__ */ h("div", { style: columnStyle }, leftGroups.map((g) => renderGroup(props.ctx, g))), /* @__PURE__ */ h(
|
|
8471
|
+
/* @__PURE__ */ h$1("div", { style: { display: "flex", gap: "24px" } }, /* @__PURE__ */ h$1("div", { style: columnStyle }, leftGroups.map((g) => renderGroup(props.ctx, g))), /* @__PURE__ */ h$1(
|
|
8400
8472
|
"div",
|
|
8401
8473
|
{
|
|
8402
8474
|
style: {
|
|
@@ -8405,7 +8477,7 @@ const ShortcutHelpModal = defineComponent({
|
|
|
8405
8477
|
backgroundColor: "var(--crepe-color-outline-variant, color-mix(in srgb, var(--crepe-color-outline), transparent 80%))"
|
|
8406
8478
|
}
|
|
8407
8479
|
}
|
|
8408
|
-
), /* @__PURE__ */ h("div", { style: columnStyle }, rightGroups.map((g) => renderGroup(props.ctx, g))))
|
|
8480
|
+
), /* @__PURE__ */ h$1("div", { style: columnStyle }, rightGroups.map((g) => renderGroup(props.ctx, g))))
|
|
8409
8481
|
)
|
|
8410
8482
|
);
|
|
8411
8483
|
}
|
|
@@ -8417,70 +8489,161 @@ const FixedToolbarComponent = defineComponent({
|
|
|
8417
8489
|
hide: { type: Function, required: true },
|
|
8418
8490
|
show: { type: Object, required: true },
|
|
8419
8491
|
selection: { type: Object, required: true },
|
|
8420
|
-
config: { type: Object, required: false }
|
|
8492
|
+
config: { type: Object, required: false },
|
|
8493
|
+
canUndo: { type: Object, required: true },
|
|
8494
|
+
canRedo: { type: Object, required: true }
|
|
8421
8495
|
},
|
|
8422
8496
|
setup(props) {
|
|
8423
8497
|
const showShortcuts = ref(false);
|
|
8424
|
-
|
|
8425
|
-
|
|
8426
|
-
|
|
8427
|
-
|
|
8428
|
-
|
|
8429
|
-
|
|
8430
|
-
|
|
8431
|
-
|
|
8432
|
-
|
|
8433
|
-
|
|
8434
|
-
}
|
|
8435
|
-
|
|
8436
|
-
|
|
8437
|
-
|
|
8438
|
-
|
|
8439
|
-
|
|
8440
|
-
|
|
8441
|
-
|
|
8442
|
-
height: "20px",
|
|
8443
|
-
backgroundColor: "var(--crepe-color-outline-variant, color-mix(in srgb, var(--crepe-color-outline), transparent 80%))"
|
|
8444
|
-
}
|
|
8445
|
-
}
|
|
8446
|
-
),
|
|
8447
|
-
/* @__PURE__ */ h(
|
|
8448
|
-
Toolbar,
|
|
8449
|
-
{
|
|
8450
|
-
ctx: props.ctx,
|
|
8451
|
-
hide: props.hide,
|
|
8452
|
-
show: props.show,
|
|
8453
|
-
selection: props.selection,
|
|
8454
|
-
config: props.config,
|
|
8455
|
-
isFixed: true
|
|
8456
|
-
}
|
|
8457
|
-
),
|
|
8458
|
-
/* @__PURE__ */ h(
|
|
8498
|
+
onMounted(() => {
|
|
8499
|
+
const handleShowShortcuts = () => {
|
|
8500
|
+
showShortcuts.value = true;
|
|
8501
|
+
};
|
|
8502
|
+
window.addEventListener("milkdown-show-shortcuts", handleShowShortcuts);
|
|
8503
|
+
onUnmounted(() => {
|
|
8504
|
+
window.removeEventListener(
|
|
8505
|
+
"milkdown-show-shortcuts",
|
|
8506
|
+
handleShowShortcuts
|
|
8507
|
+
);
|
|
8508
|
+
});
|
|
8509
|
+
});
|
|
8510
|
+
return () => {
|
|
8511
|
+
var _a, _b, _c, _d;
|
|
8512
|
+
props.selection.value;
|
|
8513
|
+
const canUndo = (typeof props.canUndo === "boolean" ? props.canUndo : (_a = props.canUndo) == null ? void 0 : _a.value) || false;
|
|
8514
|
+
const canRedo = (typeof props.canRedo === "boolean" ? props.canRedo : (_b = props.canRedo) == null ? void 0 : _b.value) || false;
|
|
8515
|
+
return /* @__PURE__ */ h(
|
|
8459
8516
|
"div",
|
|
8460
8517
|
{
|
|
8461
8518
|
style: {
|
|
8462
|
-
|
|
8463
|
-
|
|
8464
|
-
|
|
8465
|
-
|
|
8466
|
-
|
|
8467
|
-
|
|
8468
|
-
|
|
8469
|
-
),
|
|
8470
|
-
/* @__PURE__ */ h(
|
|
8471
|
-
"button",
|
|
8472
|
-
{
|
|
8473
|
-
type: "button",
|
|
8474
|
-
class: "toolbar-shortcut-btn",
|
|
8475
|
-
title: i18n(props.ctx, "shortcuts.title"),
|
|
8476
|
-
onClick: () => {
|
|
8477
|
-
showShortcuts.value = true;
|
|
8519
|
+
display: "flex",
|
|
8520
|
+
alignItems: "center",
|
|
8521
|
+
justifyContent: "center",
|
|
8522
|
+
width: "100%",
|
|
8523
|
+
gap: "0px",
|
|
8524
|
+
minWidth: "0",
|
|
8525
|
+
overflow: "hidden"
|
|
8478
8526
|
}
|
|
8479
8527
|
},
|
|
8480
|
-
|
|
8481
|
-
|
|
8482
|
-
|
|
8483
|
-
|
|
8528
|
+
((_c = props.config) == null ? void 0 : _c.showMenuBar) !== false && [
|
|
8529
|
+
/* @__PURE__ */ h(MenuBar, { ctx: props.ctx, config: props.config }),
|
|
8530
|
+
/* @__PURE__ */ h(
|
|
8531
|
+
"div",
|
|
8532
|
+
{
|
|
8533
|
+
style: {
|
|
8534
|
+
width: "1px",
|
|
8535
|
+
minWidth: "1px",
|
|
8536
|
+
height: "20px",
|
|
8537
|
+
backgroundColor: "var(--crepe-color-outline-variant, color-mix(in srgb, var(--crepe-color-outline), transparent 80%))"
|
|
8538
|
+
}
|
|
8539
|
+
}
|
|
8540
|
+
)
|
|
8541
|
+
],
|
|
8542
|
+
((_d = props.config) == null ? void 0 : _d.showHistory) !== false && [
|
|
8543
|
+
/* @__PURE__ */ h(
|
|
8544
|
+
"button",
|
|
8545
|
+
{
|
|
8546
|
+
type: "button",
|
|
8547
|
+
class: ["toolbar-item", !canUndo && "disabled"],
|
|
8548
|
+
disabled: !canUndo,
|
|
8549
|
+
title: "\u64A4\u9500",
|
|
8550
|
+
onPointerdown: (e) => {
|
|
8551
|
+
e.preventDefault();
|
|
8552
|
+
e.stopPropagation();
|
|
8553
|
+
},
|
|
8554
|
+
onClick: (e) => {
|
|
8555
|
+
e.preventDefault();
|
|
8556
|
+
e.stopPropagation();
|
|
8557
|
+
if (canUndo) {
|
|
8558
|
+
props.ctx.get(commandsCtx).call("Undo");
|
|
8559
|
+
}
|
|
8560
|
+
},
|
|
8561
|
+
style: {
|
|
8562
|
+
display: "flex",
|
|
8563
|
+
alignItems: "center",
|
|
8564
|
+
justifyContent: "center",
|
|
8565
|
+
border: "none",
|
|
8566
|
+
background: "transparent",
|
|
8567
|
+
cursor: canUndo ? "pointer" : "default",
|
|
8568
|
+
padding: "6px",
|
|
8569
|
+
borderRadius: "4px",
|
|
8570
|
+
color: canUndo ? "#363b4c" : "#c0c4cc",
|
|
8571
|
+
"--toolbar-icon-color": canUndo ? "#363b4c" : "#c0c4cc"
|
|
8572
|
+
}
|
|
8573
|
+
},
|
|
8574
|
+
/* @__PURE__ */ h(
|
|
8575
|
+
"span",
|
|
8576
|
+
{
|
|
8577
|
+
style: { display: "inline-flex", alignItems: "center" },
|
|
8578
|
+
innerHTML: undoIcon
|
|
8579
|
+
}
|
|
8580
|
+
)
|
|
8581
|
+
),
|
|
8582
|
+
/* @__PURE__ */ h(
|
|
8583
|
+
"button",
|
|
8584
|
+
{
|
|
8585
|
+
type: "button",
|
|
8586
|
+
class: ["toolbar-item", !canRedo && "disabled"],
|
|
8587
|
+
disabled: !canRedo,
|
|
8588
|
+
title: "\u6062\u590D",
|
|
8589
|
+
onPointerdown: (e) => {
|
|
8590
|
+
e.preventDefault();
|
|
8591
|
+
e.stopPropagation();
|
|
8592
|
+
},
|
|
8593
|
+
onClick: (e) => {
|
|
8594
|
+
e.preventDefault();
|
|
8595
|
+
e.stopPropagation();
|
|
8596
|
+
if (canRedo) {
|
|
8597
|
+
props.ctx.get(commandsCtx).call("Redo");
|
|
8598
|
+
}
|
|
8599
|
+
},
|
|
8600
|
+
style: {
|
|
8601
|
+
display: "flex",
|
|
8602
|
+
alignItems: "center",
|
|
8603
|
+
justifyContent: "center",
|
|
8604
|
+
border: "none",
|
|
8605
|
+
background: "transparent",
|
|
8606
|
+
cursor: canRedo ? "pointer" : "default",
|
|
8607
|
+
padding: "6px",
|
|
8608
|
+
borderRadius: "4px",
|
|
8609
|
+
color: canRedo ? "#363b4c" : "#c0c4cc",
|
|
8610
|
+
"--toolbar-icon-color": canRedo ? "#363b4c" : "#c0c4cc"
|
|
8611
|
+
}
|
|
8612
|
+
},
|
|
8613
|
+
/* @__PURE__ */ h(
|
|
8614
|
+
"span",
|
|
8615
|
+
{
|
|
8616
|
+
style: { display: "inline-flex", alignItems: "center" },
|
|
8617
|
+
innerHTML: redoIcon
|
|
8618
|
+
}
|
|
8619
|
+
)
|
|
8620
|
+
),
|
|
8621
|
+
/* @__PURE__ */ h(
|
|
8622
|
+
"div",
|
|
8623
|
+
{
|
|
8624
|
+
style: {
|
|
8625
|
+
width: "1px",
|
|
8626
|
+
minWidth: "1px",
|
|
8627
|
+
height: "20px",
|
|
8628
|
+
backgroundColor: "var(--crepe-color-outline-variant, color-mix(in srgb, var(--crepe-color-outline), transparent 80%))"
|
|
8629
|
+
}
|
|
8630
|
+
}
|
|
8631
|
+
)
|
|
8632
|
+
],
|
|
8633
|
+
/* @__PURE__ */ h(
|
|
8634
|
+
Toolbar,
|
|
8635
|
+
{
|
|
8636
|
+
ctx: props.ctx,
|
|
8637
|
+
hide: props.hide,
|
|
8638
|
+
show: props.show,
|
|
8639
|
+
selection: props.selection,
|
|
8640
|
+
config: props.config,
|
|
8641
|
+
isFixed: true
|
|
8642
|
+
}
|
|
8643
|
+
),
|
|
8644
|
+
showShortcuts.value && /* @__PURE__ */ h(ShortcutHelpModal, { ctx: props.ctx, visible: showShortcuts })
|
|
8645
|
+
);
|
|
8646
|
+
};
|
|
8484
8647
|
}
|
|
8485
8648
|
});
|
|
8486
8649
|
|
|
@@ -8906,10 +9069,69 @@ function buildDefaultFixedToolbar(builder, _config, ctx) {
|
|
|
8906
9069
|
}
|
|
8907
9070
|
});
|
|
8908
9071
|
}
|
|
9072
|
+
const documentGroup = builder.addGroup("document", "Document");
|
|
9073
|
+
if ((_config == null ? void 0 : _config.showExport) !== false) {
|
|
9074
|
+
documentGroup.addItem("export", {
|
|
9075
|
+
label: ctx ? i18n(ctx, "customMenu.export") || "\u5BFC\u51FA" : "\u5BFC\u51FA",
|
|
9076
|
+
icon: exportIcon,
|
|
9077
|
+
active: () => false,
|
|
9078
|
+
onRun: (ctx2) => {
|
|
9079
|
+
const markdown = getMarkdown()(ctx2);
|
|
9080
|
+
if (_config == null ? void 0 : _config.onExport) {
|
|
9081
|
+
_config.onExport(markdown, ctx2);
|
|
9082
|
+
} else {
|
|
9083
|
+
const blob = new Blob([markdown], {
|
|
9084
|
+
type: "text/markdown;charset=utf-8;"
|
|
9085
|
+
});
|
|
9086
|
+
const url = URL.createObjectURL(blob);
|
|
9087
|
+
const link = document.createElement("a");
|
|
9088
|
+
link.href = url;
|
|
9089
|
+
link.download = "document.md";
|
|
9090
|
+
link.click();
|
|
9091
|
+
URL.revokeObjectURL(url);
|
|
9092
|
+
}
|
|
9093
|
+
}
|
|
9094
|
+
});
|
|
9095
|
+
}
|
|
9096
|
+
if ((_config == null ? void 0 : _config.showImport) !== false) {
|
|
9097
|
+
documentGroup.addItem("import", {
|
|
9098
|
+
label: ctx ? i18n(ctx, "customMenu.import") || "\u5BFC\u5165" : "\u5BFC\u5165",
|
|
9099
|
+
icon: importIcon,
|
|
9100
|
+
active: () => false,
|
|
9101
|
+
onRun: (ctx2) => {
|
|
9102
|
+
if (_config == null ? void 0 : _config.onImport) {
|
|
9103
|
+
_config.onImport((markdown) => replaceAll(markdown)(ctx2), ctx2);
|
|
9104
|
+
} else {
|
|
9105
|
+
const input = document.createElement("input");
|
|
9106
|
+
input.type = "file";
|
|
9107
|
+
input.accept = ".md";
|
|
9108
|
+
input.onchange = (e) => {
|
|
9109
|
+
var _a;
|
|
9110
|
+
const file = (_a = e.target.files) == null ? void 0 : _a[0];
|
|
9111
|
+
if (!file) return;
|
|
9112
|
+
file.text().then((text) => {
|
|
9113
|
+
replaceAll(text)(ctx2);
|
|
9114
|
+
}).catch((err) => {
|
|
9115
|
+
console.error("Failed to read file:", err);
|
|
9116
|
+
});
|
|
9117
|
+
};
|
|
9118
|
+
input.click();
|
|
9119
|
+
}
|
|
9120
|
+
}
|
|
9121
|
+
});
|
|
9122
|
+
}
|
|
9123
|
+
documentGroup.addItem("shortcuts", {
|
|
9124
|
+
label: ctx ? i18n(ctx, "shortcuts.title") : "Shortcuts",
|
|
9125
|
+
icon: keyboardIcon,
|
|
9126
|
+
active: () => false,
|
|
9127
|
+
onRun: () => {
|
|
9128
|
+
window.dispatchEvent(new CustomEvent("milkdown-show-shortcuts"));
|
|
9129
|
+
}
|
|
9130
|
+
});
|
|
8909
9131
|
return builder.build();
|
|
8910
9132
|
}
|
|
8911
9133
|
|
|
8912
|
-
keepAlive(h);
|
|
9134
|
+
keepAlive(h$1);
|
|
8913
9135
|
const DocumentHeader = defineComponent({
|
|
8914
9136
|
props: {
|
|
8915
9137
|
ctx: { type: Object, required: true },
|
|
@@ -8986,13 +9208,13 @@ const DocumentHeader = defineComponent({
|
|
|
8986
9208
|
var _a, _b;
|
|
8987
9209
|
const state = viewState.value;
|
|
8988
9210
|
if (!state.showTitle && !state.showCover) return null;
|
|
8989
|
-
return /* @__PURE__ */ h(
|
|
9211
|
+
return /* @__PURE__ */ h$1(
|
|
8990
9212
|
"div",
|
|
8991
9213
|
{
|
|
8992
9214
|
class: "milkdown-document-header",
|
|
8993
9215
|
style: { width: "100%", display: "flex", flexDirection: "column" }
|
|
8994
9216
|
},
|
|
8995
|
-
state.showCover ? /* @__PURE__ */ h(
|
|
9217
|
+
state.showCover ? /* @__PURE__ */ h$1(
|
|
8996
9218
|
"div",
|
|
8997
9219
|
{
|
|
8998
9220
|
class: "milkdown-document-cover",
|
|
@@ -9010,7 +9232,7 @@ const DocumentHeader = defineComponent({
|
|
|
9010
9232
|
overflow: "hidden"
|
|
9011
9233
|
}
|
|
9012
9234
|
},
|
|
9013
|
-
/* @__PURE__ */ h(
|
|
9235
|
+
/* @__PURE__ */ h$1(
|
|
9014
9236
|
"img",
|
|
9015
9237
|
{
|
|
9016
9238
|
src: state.coverUrl,
|
|
@@ -9023,7 +9245,7 @@ const DocumentHeader = defineComponent({
|
|
|
9023
9245
|
}
|
|
9024
9246
|
}
|
|
9025
9247
|
),
|
|
9026
|
-
/* @__PURE__ */ h(
|
|
9248
|
+
/* @__PURE__ */ h$1(
|
|
9027
9249
|
"div",
|
|
9028
9250
|
{
|
|
9029
9251
|
style: {
|
|
@@ -9040,7 +9262,7 @@ const DocumentHeader = defineComponent({
|
|
|
9040
9262
|
background: "linear-gradient(transparent, rgba(0,0,0,0.7))"
|
|
9041
9263
|
}
|
|
9042
9264
|
},
|
|
9043
|
-
/* @__PURE__ */ h(
|
|
9265
|
+
/* @__PURE__ */ h$1(
|
|
9044
9266
|
"div",
|
|
9045
9267
|
{
|
|
9046
9268
|
style: {
|
|
@@ -9052,7 +9274,7 @@ const DocumentHeader = defineComponent({
|
|
|
9052
9274
|
},
|
|
9053
9275
|
(lastUploadedUrl.value ? [lastUploadedUrl.value] : []).concat(
|
|
9054
9276
|
((_b = (_a = props.config) == null ? void 0 : _a.defaultCoverImages) == null ? void 0 : _b.length) ? props.config.defaultCoverImages : builtInCoverImages
|
|
9055
|
-
).map((src, i) => /* @__PURE__ */ h(
|
|
9277
|
+
).map((src, i) => /* @__PURE__ */ h$1(
|
|
9056
9278
|
"img",
|
|
9057
9279
|
{
|
|
9058
9280
|
key: i,
|
|
@@ -9082,7 +9304,7 @@ const DocumentHeader = defineComponent({
|
|
|
9082
9304
|
}
|
|
9083
9305
|
))
|
|
9084
9306
|
),
|
|
9085
|
-
/* @__PURE__ */ h(
|
|
9307
|
+
/* @__PURE__ */ h$1(
|
|
9086
9308
|
"div",
|
|
9087
9309
|
{
|
|
9088
9310
|
onClick: () => {
|
|
@@ -9110,7 +9332,7 @@ const DocumentHeader = defineComponent({
|
|
|
9110
9332
|
e.currentTarget.style.backgroundColor = "rgba(255,255,255,0.2)";
|
|
9111
9333
|
}
|
|
9112
9334
|
},
|
|
9113
|
-
/* @__PURE__ */ h(
|
|
9335
|
+
/* @__PURE__ */ h$1(
|
|
9114
9336
|
"svg",
|
|
9115
9337
|
{
|
|
9116
9338
|
width: "14",
|
|
@@ -9122,14 +9344,14 @@ const DocumentHeader = defineComponent({
|
|
|
9122
9344
|
"stroke-linecap": "round",
|
|
9123
9345
|
"stroke-linejoin": "round"
|
|
9124
9346
|
},
|
|
9125
|
-
/* @__PURE__ */ h("path", { d: "M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4" }),
|
|
9126
|
-
/* @__PURE__ */ h("polyline", { points: "17 8 12 3 7 8" }),
|
|
9127
|
-
/* @__PURE__ */ h("line", { x1: "12", y1: "3", x2: "12", y2: "15" })
|
|
9347
|
+
/* @__PURE__ */ h$1("path", { d: "M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4" }),
|
|
9348
|
+
/* @__PURE__ */ h$1("polyline", { points: "17 8 12 3 7 8" }),
|
|
9349
|
+
/* @__PURE__ */ h$1("line", { x1: "12", y1: "3", x2: "12", y2: "15" })
|
|
9128
9350
|
),
|
|
9129
9351
|
"\u4E0A\u4F20"
|
|
9130
9352
|
)
|
|
9131
9353
|
),
|
|
9132
|
-
/* @__PURE__ */ h(
|
|
9354
|
+
/* @__PURE__ */ h$1(
|
|
9133
9355
|
"input",
|
|
9134
9356
|
{
|
|
9135
9357
|
type: "file",
|
|
@@ -9140,7 +9362,7 @@ const DocumentHeader = defineComponent({
|
|
|
9140
9362
|
}
|
|
9141
9363
|
)
|
|
9142
9364
|
) : null,
|
|
9143
|
-
state.showTitle ? /* @__PURE__ */ h(
|
|
9365
|
+
state.showTitle ? /* @__PURE__ */ h$1(
|
|
9144
9366
|
"div",
|
|
9145
9367
|
{
|
|
9146
9368
|
class: "milkdown-document-title-wrapper",
|
|
@@ -9151,8 +9373,8 @@ const DocumentHeader = defineComponent({
|
|
|
9151
9373
|
padding: `40px ${editorWidthMap[state.editorWidth] === "none" ? "80px" : "0"} 0`
|
|
9152
9374
|
}
|
|
9153
9375
|
},
|
|
9154
|
-
/* @__PURE__ */ h("style", null, `.milkdown-document-title::placeholder { color: #BFBFBF; }`),
|
|
9155
|
-
/* @__PURE__ */ h(
|
|
9376
|
+
/* @__PURE__ */ h$1("style", null, `.milkdown-document-title::placeholder { color: #BFBFBF; }`),
|
|
9377
|
+
/* @__PURE__ */ h$1(
|
|
9156
9378
|
"textarea",
|
|
9157
9379
|
{
|
|
9158
9380
|
ref: titleTextareaRef,
|
|
@@ -9526,7 +9748,7 @@ const OutlinePanel = defineComponent({
|
|
|
9526
9748
|
const state = viewState.value;
|
|
9527
9749
|
if (!state.outlineVisible) return null;
|
|
9528
9750
|
const isLeft = state.outlinePosition === "left";
|
|
9529
|
-
return /* @__PURE__ */ h(
|
|
9751
|
+
return /* @__PURE__ */ h$1(
|
|
9530
9752
|
"div",
|
|
9531
9753
|
{
|
|
9532
9754
|
class: "milkdown-outline-panel",
|
|
@@ -9547,7 +9769,7 @@ const OutlinePanel = defineComponent({
|
|
|
9547
9769
|
overflow: "hidden"
|
|
9548
9770
|
}
|
|
9549
9771
|
},
|
|
9550
|
-
/* @__PURE__ */ h(
|
|
9772
|
+
/* @__PURE__ */ h$1(
|
|
9551
9773
|
"div",
|
|
9552
9774
|
{
|
|
9553
9775
|
style: {
|
|
@@ -9561,8 +9783,8 @@ const OutlinePanel = defineComponent({
|
|
|
9561
9783
|
alignItems: "center"
|
|
9562
9784
|
}
|
|
9563
9785
|
},
|
|
9564
|
-
/* @__PURE__ */ h("span", null, i18n(props.ctx, "view.outline")),
|
|
9565
|
-
/* @__PURE__ */ h(
|
|
9786
|
+
/* @__PURE__ */ h$1("span", null, i18n(props.ctx, "view.outline")),
|
|
9787
|
+
/* @__PURE__ */ h$1(
|
|
9566
9788
|
"div",
|
|
9567
9789
|
{
|
|
9568
9790
|
style: {
|
|
@@ -9586,7 +9808,7 @@ const OutlinePanel = defineComponent({
|
|
|
9586
9808
|
},
|
|
9587
9809
|
title: "\u5173\u95ED\u5927\u7EB2"
|
|
9588
9810
|
},
|
|
9589
|
-
/* @__PURE__ */ h(
|
|
9811
|
+
/* @__PURE__ */ h$1(
|
|
9590
9812
|
"svg",
|
|
9591
9813
|
{
|
|
9592
9814
|
width: "16",
|
|
@@ -9598,12 +9820,12 @@ const OutlinePanel = defineComponent({
|
|
|
9598
9820
|
"stroke-linecap": "round",
|
|
9599
9821
|
"stroke-linejoin": "round"
|
|
9600
9822
|
},
|
|
9601
|
-
/* @__PURE__ */ h("line", { x1: "18", y1: "6", x2: "6", y2: "18" }),
|
|
9602
|
-
/* @__PURE__ */ h("line", { x1: "6", y1: "6", x2: "18", y2: "18" })
|
|
9823
|
+
/* @__PURE__ */ h$1("line", { x1: "18", y1: "6", x2: "6", y2: "18" }),
|
|
9824
|
+
/* @__PURE__ */ h$1("line", { x1: "6", y1: "6", x2: "18", y2: "18" })
|
|
9603
9825
|
)
|
|
9604
9826
|
)
|
|
9605
9827
|
),
|
|
9606
|
-
/* @__PURE__ */ h("div", { style: { flexGrow: 1, overflowY: "auto", padding: "12px 0" } }, items.value.length === 0 ? /* @__PURE__ */ h(
|
|
9828
|
+
/* @__PURE__ */ h$1("div", { style: { flexGrow: 1, overflowY: "auto", padding: "12px 0" } }, items.value.length === 0 ? /* @__PURE__ */ h$1(
|
|
9607
9829
|
"div",
|
|
9608
9830
|
{
|
|
9609
9831
|
style: {
|
|
@@ -9616,7 +9838,7 @@ const OutlinePanel = defineComponent({
|
|
|
9616
9838
|
) : null, visibleItems.value.map(({ item, hasChildren: hasKids }) => {
|
|
9617
9839
|
const isActive = activeId.value === item.id;
|
|
9618
9840
|
const collapsed = collapsedIds.value.has(item.id);
|
|
9619
|
-
return /* @__PURE__ */ h(
|
|
9841
|
+
return /* @__PURE__ */ h$1(
|
|
9620
9842
|
"div",
|
|
9621
9843
|
{
|
|
9622
9844
|
key: item.id,
|
|
@@ -9650,7 +9872,7 @@ const OutlinePanel = defineComponent({
|
|
|
9650
9872
|
}
|
|
9651
9873
|
}
|
|
9652
9874
|
},
|
|
9653
|
-
/* @__PURE__ */ h(
|
|
9875
|
+
/* @__PURE__ */ h$1(
|
|
9654
9876
|
"span",
|
|
9655
9877
|
{
|
|
9656
9878
|
onClick: (e) => {
|
|
@@ -9683,7 +9905,7 @@ const OutlinePanel = defineComponent({
|
|
|
9683
9905
|
"\u25BC",
|
|
9684
9906
|
" "
|
|
9685
9907
|
),
|
|
9686
|
-
/* @__PURE__ */ h(
|
|
9908
|
+
/* @__PURE__ */ h$1(
|
|
9687
9909
|
"span",
|
|
9688
9910
|
{
|
|
9689
9911
|
title: item.text,
|
|
@@ -9696,7 +9918,7 @@ const OutlinePanel = defineComponent({
|
|
|
9696
9918
|
)
|
|
9697
9919
|
);
|
|
9698
9920
|
})),
|
|
9699
|
-
/* @__PURE__ */ h(
|
|
9921
|
+
/* @__PURE__ */ h$1(
|
|
9700
9922
|
"div",
|
|
9701
9923
|
{
|
|
9702
9924
|
onPointerdown: onPointerDown,
|
|
@@ -9735,7 +9957,7 @@ var __accessCheck$4 = (obj, member, msg) => member.has(obj) || __typeError$4("Ca
|
|
|
9735
9957
|
var __privateGet$4 = (obj, member, getter) => (__accessCheck$4(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
|
|
9736
9958
|
var __privateAdd$4 = (obj, member, value) => member.has(obj) ? __typeError$4("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
|
9737
9959
|
var __privateSet$4 = (obj, member, value, setter) => (__accessCheck$4(obj, member, "write to private field"), member.set(obj, value), value);
|
|
9738
|
-
var _content$2, _app$2, _headerContent, _headerApp, _outlineContent, _outlineApp, _watcher, _selection$1, _show$1, _resizeObserver$1, _updateOutlineGeometry, _scrollContainers$1, _onDblClick, _view$1, _editorContainer;
|
|
9960
|
+
var _content$2, _app$2, _headerContent, _headerApp, _outlineContent, _outlineApp, _watcher, _selection$1, _show$1, _canUndo, _canRedo, _resizeObserver$1, _updateOutlineGeometry, _scrollContainers$1, _onDblClick, _view$1, _editorContainer;
|
|
9739
9961
|
const fixedToolbarConfig = $ctx(
|
|
9740
9962
|
{},
|
|
9741
9963
|
"fixedToolbarConfigCtx"
|
|
@@ -9752,6 +9974,8 @@ class FixedToolbarView {
|
|
|
9752
9974
|
__privateAdd$4(this, _watcher);
|
|
9753
9975
|
__privateAdd$4(this, _selection$1);
|
|
9754
9976
|
__privateAdd$4(this, _show$1, ref(true));
|
|
9977
|
+
__privateAdd$4(this, _canUndo, ref(false));
|
|
9978
|
+
__privateAdd$4(this, _canRedo, ref(false));
|
|
9755
9979
|
__privateAdd$4(this, _resizeObserver$1);
|
|
9756
9980
|
__privateAdd$4(this, _updateOutlineGeometry);
|
|
9757
9981
|
__privateAdd$4(this, _scrollContainers$1, []);
|
|
@@ -9760,6 +9984,11 @@ class FixedToolbarView {
|
|
|
9760
9984
|
__privateAdd$4(this, _editorContainer);
|
|
9761
9985
|
this.update = (view) => {
|
|
9762
9986
|
__privateGet$4(this, _selection$1).value = view.state.selection;
|
|
9987
|
+
try {
|
|
9988
|
+
__privateGet$4(this, _canUndo).value = undo(view.state);
|
|
9989
|
+
__privateGet$4(this, _canRedo).value = redo(view.state);
|
|
9990
|
+
} catch (e) {
|
|
9991
|
+
}
|
|
9763
9992
|
};
|
|
9764
9993
|
this.destroy = () => {
|
|
9765
9994
|
if (__privateGet$4(this, _watcher)) __privateGet$4(this, _watcher).call(this);
|
|
@@ -9784,6 +10013,60 @@ class FixedToolbarView {
|
|
|
9784
10013
|
};
|
|
9785
10014
|
__privateSet$4(this, _view$1, view);
|
|
9786
10015
|
const config = ctx.get(fixedToolbarConfig.key);
|
|
10016
|
+
const viewState = ctx.get(viewMenuStateCtx.key);
|
|
10017
|
+
if (config == null ? void 0 : config.useLocalStorage) {
|
|
10018
|
+
try {
|
|
10019
|
+
const stored = localStorage.getItem("jvs-milkdown-data");
|
|
10020
|
+
if (stored) {
|
|
10021
|
+
const parsed = JSON.parse(stored);
|
|
10022
|
+
if (parsed.outlineVisible !== void 0)
|
|
10023
|
+
viewState.outlineVisible = parsed.outlineVisible;
|
|
10024
|
+
if (parsed.outlinePosition !== void 0)
|
|
10025
|
+
viewState.outlinePosition = parsed.outlinePosition;
|
|
10026
|
+
if (parsed.outlineWidth !== void 0)
|
|
10027
|
+
viewState.outlineWidth = parsed.outlineWidth;
|
|
10028
|
+
if (parsed.documentBackground !== void 0)
|
|
10029
|
+
viewState.documentBackground = parsed.documentBackground;
|
|
10030
|
+
if (parsed.showTitle !== void 0)
|
|
10031
|
+
viewState.showTitle = parsed.showTitle;
|
|
10032
|
+
if (parsed.showCover !== void 0)
|
|
10033
|
+
viewState.showCover = parsed.showCover;
|
|
10034
|
+
if (parsed.coverUrl !== void 0)
|
|
10035
|
+
viewState.coverUrl = parsed.coverUrl;
|
|
10036
|
+
if (parsed.editorWidth !== void 0)
|
|
10037
|
+
viewState.editorWidth = parsed.editorWidth;
|
|
10038
|
+
}
|
|
10039
|
+
} catch (e) {
|
|
10040
|
+
console.error("Error loading view state from localStorage:", e);
|
|
10041
|
+
}
|
|
10042
|
+
watch(
|
|
10043
|
+
viewState,
|
|
10044
|
+
(newState) => {
|
|
10045
|
+
try {
|
|
10046
|
+
const stored = localStorage.getItem("jvs-milkdown-data");
|
|
10047
|
+
let parsed = {};
|
|
10048
|
+
if (stored) {
|
|
10049
|
+
parsed = JSON.parse(stored);
|
|
10050
|
+
}
|
|
10051
|
+
const merged = {
|
|
10052
|
+
...parsed,
|
|
10053
|
+
outlineVisible: newState.outlineVisible,
|
|
10054
|
+
outlinePosition: newState.outlinePosition,
|
|
10055
|
+
outlineWidth: newState.outlineWidth,
|
|
10056
|
+
documentBackground: newState.documentBackground,
|
|
10057
|
+
showTitle: newState.showTitle,
|
|
10058
|
+
showCover: newState.showCover,
|
|
10059
|
+
coverUrl: newState.coverUrl,
|
|
10060
|
+
editorWidth: newState.editorWidth
|
|
10061
|
+
};
|
|
10062
|
+
localStorage.setItem("jvs-milkdown-data", JSON.stringify(merged));
|
|
10063
|
+
} catch (e) {
|
|
10064
|
+
console.error("Error saving view state to localStorage:", e);
|
|
10065
|
+
}
|
|
10066
|
+
},
|
|
10067
|
+
{ deep: true }
|
|
10068
|
+
);
|
|
10069
|
+
}
|
|
9787
10070
|
const content = document.createElement("div");
|
|
9788
10071
|
content.className = "milkdown-fixed-toolbar";
|
|
9789
10072
|
__privateSet$4(this, _selection$1, shallowRef(view.state.selection));
|
|
@@ -9794,7 +10077,9 @@ class FixedToolbarView {
|
|
|
9794
10077
|
// No-op for fixed toolbar
|
|
9795
10078
|
config,
|
|
9796
10079
|
selection: __privateGet$4(this, _selection$1),
|
|
9797
|
-
show: __privateGet$4(this, _show$1)
|
|
10080
|
+
show: __privateGet$4(this, _show$1),
|
|
10081
|
+
canUndo: __privateGet$4(this, _canUndo),
|
|
10082
|
+
canRedo: __privateGet$4(this, _canRedo)
|
|
9798
10083
|
});
|
|
9799
10084
|
app.mount(content);
|
|
9800
10085
|
__privateSet$4(this, _content$2, content);
|
|
@@ -9851,9 +10136,9 @@ class FixedToolbarView {
|
|
|
9851
10136
|
});
|
|
9852
10137
|
view.dom.addEventListener("dblclick", __privateGet$4(this, _onDblClick));
|
|
9853
10138
|
__privateGet$4(this, _content$2).style.transition = "margin 0.1s ease-out, width 0.1s ease-out";
|
|
9854
|
-
const
|
|
10139
|
+
const viewState2 = ctx.get(viewMenuStateCtx.key);
|
|
9855
10140
|
if (config.outlinePosition) {
|
|
9856
|
-
|
|
10141
|
+
viewState2.outlinePosition = config.outlinePosition;
|
|
9857
10142
|
}
|
|
9858
10143
|
__privateSet$4(this, _updateOutlineGeometry, () => {
|
|
9859
10144
|
const rootRect = root.getBoundingClientRect();
|
|
@@ -9862,7 +10147,7 @@ class FixedToolbarView {
|
|
|
9862
10147
|
const toolbarRect = __privateGet$4(this, _content$2).getBoundingClientRect();
|
|
9863
10148
|
outlineTop = Math.max(outlineTop, toolbarRect.bottom);
|
|
9864
10149
|
}
|
|
9865
|
-
if (
|
|
10150
|
+
if (viewState2.showCover && __privateGet$4(this, _headerContent)) {
|
|
9866
10151
|
const coverEl = __privateGet$4(this, _headerContent).querySelector(
|
|
9867
10152
|
".milkdown-document-cover"
|
|
9868
10153
|
);
|
|
@@ -9879,8 +10164,8 @@ class FixedToolbarView {
|
|
|
9879
10164
|
}
|
|
9880
10165
|
outlineContent.style.top = `${outlineTop}px`;
|
|
9881
10166
|
outlineContent.style.height = `${height}px`;
|
|
9882
|
-
if (
|
|
9883
|
-
if (
|
|
10167
|
+
if (viewState2.outlineVisible) {
|
|
10168
|
+
if (viewState2.outlinePosition === "left") {
|
|
9884
10169
|
outlineContent.style.left = `${rootRect.left}px`;
|
|
9885
10170
|
outlineContent.style.right = "auto";
|
|
9886
10171
|
} else {
|
|
@@ -9930,16 +10215,16 @@ class FixedToolbarView {
|
|
|
9930
10215
|
}
|
|
9931
10216
|
__privateSet$4(this, _watcher, watch(
|
|
9932
10217
|
() => [
|
|
9933
|
-
|
|
9934
|
-
|
|
9935
|
-
|
|
9936
|
-
|
|
9937
|
-
|
|
9938
|
-
|
|
10218
|
+
viewState2.outlineVisible,
|
|
10219
|
+
viewState2.outlinePosition,
|
|
10220
|
+
viewState2.outlineWidth,
|
|
10221
|
+
viewState2.documentBackground,
|
|
10222
|
+
viewState2.showCover,
|
|
10223
|
+
viewState2.editorWidth
|
|
9939
10224
|
],
|
|
9940
10225
|
() => {
|
|
9941
|
-
if (
|
|
9942
|
-
root.style.backgroundColor =
|
|
10226
|
+
if (viewState2.documentBackground) {
|
|
10227
|
+
root.style.backgroundColor = viewState2.documentBackground;
|
|
9943
10228
|
} else {
|
|
9944
10229
|
root.style.backgroundColor = "";
|
|
9945
10230
|
}
|
|
@@ -9949,20 +10234,20 @@ class FixedToolbarView {
|
|
|
9949
10234
|
__privateGet$4(this, _content$2).style.marginLeft = "0";
|
|
9950
10235
|
__privateGet$4(this, _content$2).style.marginRight = "0";
|
|
9951
10236
|
if (__privateGet$4(this, _editorContainer)) {
|
|
9952
|
-
if (
|
|
9953
|
-
if (
|
|
9954
|
-
__privateGet$4(this, _editorContainer).style.paddingLeft = `${
|
|
10237
|
+
if (viewState2.outlineVisible) {
|
|
10238
|
+
if (viewState2.outlinePosition === "left") {
|
|
10239
|
+
__privateGet$4(this, _editorContainer).style.paddingLeft = `${viewState2.outlineWidth}px`;
|
|
9955
10240
|
__privateGet$4(this, _editorContainer).style.paddingRight = "0";
|
|
9956
10241
|
} else {
|
|
9957
10242
|
__privateGet$4(this, _editorContainer).style.paddingLeft = "0";
|
|
9958
|
-
__privateGet$4(this, _editorContainer).style.paddingRight = `${
|
|
10243
|
+
__privateGet$4(this, _editorContainer).style.paddingRight = `${viewState2.outlineWidth}px`;
|
|
9959
10244
|
}
|
|
9960
10245
|
} else {
|
|
9961
10246
|
__privateGet$4(this, _editorContainer).style.paddingLeft = "0";
|
|
9962
10247
|
__privateGet$4(this, _editorContainer).style.paddingRight = "0";
|
|
9963
10248
|
}
|
|
9964
10249
|
}
|
|
9965
|
-
const maxWidth = editorWidthMap[
|
|
10250
|
+
const maxWidth = editorWidthMap[viewState2.editorWidth];
|
|
9966
10251
|
const isFull = maxWidth === "none";
|
|
9967
10252
|
const px = isFull ? "80px" : "0";
|
|
9968
10253
|
__privateGet$4(this, _view$1).dom.style.maxWidth = maxWidth;
|
|
@@ -9970,7 +10255,7 @@ class FixedToolbarView {
|
|
|
9970
10255
|
__privateGet$4(this, _view$1).dom.style.margin = isFull ? "0" : "0 auto";
|
|
9971
10256
|
__privateGet$4(this, _view$1).dom.style.padding = `20px ${px} 36px`;
|
|
9972
10257
|
if (__privateGet$4(this, _headerContent)) {
|
|
9973
|
-
__privateGet$4(this, _headerContent).style.margin = isFull && !
|
|
10258
|
+
__privateGet$4(this, _headerContent).style.margin = isFull && !viewState2.showCover ? "0 auto" : "0";
|
|
9974
10259
|
__privateGet$4(this, _headerContent).style.padding = `0px`;
|
|
9975
10260
|
}
|
|
9976
10261
|
void nextTick(() => {
|
|
@@ -9996,6 +10281,8 @@ _outlineApp = new WeakMap();
|
|
|
9996
10281
|
_watcher = new WeakMap();
|
|
9997
10282
|
_selection$1 = new WeakMap();
|
|
9998
10283
|
_show$1 = new WeakMap();
|
|
10284
|
+
_canUndo = new WeakMap();
|
|
10285
|
+
_canRedo = new WeakMap();
|
|
9999
10286
|
_resizeObserver$1 = new WeakMap();
|
|
10000
10287
|
_updateOutlineGeometry = new WeakMap();
|
|
10001
10288
|
_scrollContainers$1 = new WeakMap();
|
|
@@ -10150,7 +10437,7 @@ function mountChangePanel(container, changes, onNavigate, onClose) {
|
|
|
10150
10437
|
}));
|
|
10151
10438
|
function renderTab(tab, label) {
|
|
10152
10439
|
const isActive = activeTab.value === tab;
|
|
10153
|
-
return h(
|
|
10440
|
+
return h$1(
|
|
10154
10441
|
"button",
|
|
10155
10442
|
{
|
|
10156
10443
|
style: {
|
|
@@ -10172,8 +10459,8 @@ function mountChangePanel(container, changes, onNavigate, onClose) {
|
|
|
10172
10459
|
function renderItem(change, index) {
|
|
10173
10460
|
const color = typeColors[change.type];
|
|
10174
10461
|
const children = [
|
|
10175
|
-
h("div", { style: { marginBottom: "4px" } }, [
|
|
10176
|
-
h(
|
|
10462
|
+
h$1("div", { style: { marginBottom: "4px" } }, [
|
|
10463
|
+
h$1(
|
|
10177
10464
|
"span",
|
|
10178
10465
|
{
|
|
10179
10466
|
style: {
|
|
@@ -10192,7 +10479,7 @@ function mountChangePanel(container, changes, onNavigate, onClose) {
|
|
|
10192
10479
|
];
|
|
10193
10480
|
if (change.oldText) {
|
|
10194
10481
|
children.push(
|
|
10195
|
-
h(
|
|
10482
|
+
h$1(
|
|
10196
10483
|
"div",
|
|
10197
10484
|
{
|
|
10198
10485
|
style: {
|
|
@@ -10204,19 +10491,19 @@ function mountChangePanel(container, changes, onNavigate, onClose) {
|
|
|
10204
10491
|
}
|
|
10205
10492
|
},
|
|
10206
10493
|
[
|
|
10207
|
-
h(
|
|
10494
|
+
h$1(
|
|
10208
10495
|
"span",
|
|
10209
10496
|
{ style: { color: "#999", fontSize: "11px" } },
|
|
10210
10497
|
"\u539F\u6587: "
|
|
10211
10498
|
),
|
|
10212
|
-
h("span", null, change.oldText)
|
|
10499
|
+
h$1("span", null, change.oldText)
|
|
10213
10500
|
]
|
|
10214
10501
|
)
|
|
10215
10502
|
);
|
|
10216
10503
|
}
|
|
10217
10504
|
if (change.newText) {
|
|
10218
10505
|
children.push(
|
|
10219
|
-
h(
|
|
10506
|
+
h$1(
|
|
10220
10507
|
"div",
|
|
10221
10508
|
{
|
|
10222
10509
|
style: {
|
|
@@ -10227,17 +10514,17 @@ function mountChangePanel(container, changes, onNavigate, onClose) {
|
|
|
10227
10514
|
}
|
|
10228
10515
|
},
|
|
10229
10516
|
[
|
|
10230
|
-
h(
|
|
10517
|
+
h$1(
|
|
10231
10518
|
"span",
|
|
10232
10519
|
{ style: { color: "#999", fontSize: "11px" } },
|
|
10233
10520
|
"\u5DEE\u5F02: "
|
|
10234
10521
|
),
|
|
10235
|
-
h("span", { style: { color } }, change.newText)
|
|
10522
|
+
h$1("span", { style: { color } }, change.newText)
|
|
10236
10523
|
]
|
|
10237
10524
|
)
|
|
10238
10525
|
);
|
|
10239
10526
|
}
|
|
10240
|
-
return h(
|
|
10527
|
+
return h$1(
|
|
10241
10528
|
"div",
|
|
10242
10529
|
{
|
|
10243
10530
|
style: {
|
|
@@ -10255,7 +10542,7 @@ function mountChangePanel(container, changes, onNavigate, onClose) {
|
|
|
10255
10542
|
children
|
|
10256
10543
|
);
|
|
10257
10544
|
}
|
|
10258
|
-
return () => h(
|
|
10545
|
+
return () => h$1(
|
|
10259
10546
|
"div",
|
|
10260
10547
|
{
|
|
10261
10548
|
style: {
|
|
@@ -10273,7 +10560,7 @@ function mountChangePanel(container, changes, onNavigate, onClose) {
|
|
|
10273
10560
|
},
|
|
10274
10561
|
[
|
|
10275
10562
|
// Header
|
|
10276
|
-
h(
|
|
10563
|
+
h$1(
|
|
10277
10564
|
"div",
|
|
10278
10565
|
{
|
|
10279
10566
|
style: {
|
|
@@ -10289,8 +10576,8 @@ function mountChangePanel(container, changes, onNavigate, onClose) {
|
|
|
10289
10576
|
}
|
|
10290
10577
|
},
|
|
10291
10578
|
[
|
|
10292
|
-
h("span", null, "\u6587\u6863\u5DEE\u5F02\u53D8\u66F4"),
|
|
10293
|
-
onClose ? h(
|
|
10579
|
+
h$1("span", null, "\u6587\u6863\u5DEE\u5F02\u53D8\u66F4"),
|
|
10580
|
+
onClose ? h$1(
|
|
10294
10581
|
"div",
|
|
10295
10582
|
{
|
|
10296
10583
|
style: {
|
|
@@ -10318,7 +10605,7 @@ function mountChangePanel(container, changes, onNavigate, onClose) {
|
|
|
10318
10605
|
title: "\u5173\u95ED\u5DEE\u5F02"
|
|
10319
10606
|
},
|
|
10320
10607
|
[
|
|
10321
|
-
h(
|
|
10608
|
+
h$1(
|
|
10322
10609
|
"svg",
|
|
10323
10610
|
{
|
|
10324
10611
|
width: "16",
|
|
@@ -10331,8 +10618,8 @@ function mountChangePanel(container, changes, onNavigate, onClose) {
|
|
|
10331
10618
|
strokeLinejoin: "round"
|
|
10332
10619
|
},
|
|
10333
10620
|
[
|
|
10334
|
-
h("line", { x1: "18", y1: "6", x2: "6", y2: "18" }),
|
|
10335
|
-
h("line", { x1: "6", y1: "6", x2: "18", y2: "18" })
|
|
10621
|
+
h$1("line", { x1: "18", y1: "6", x2: "6", y2: "18" }),
|
|
10622
|
+
h$1("line", { x1: "6", y1: "6", x2: "18", y2: "18" })
|
|
10336
10623
|
]
|
|
10337
10624
|
)
|
|
10338
10625
|
]
|
|
@@ -10340,7 +10627,7 @@ function mountChangePanel(container, changes, onNavigate, onClose) {
|
|
|
10340
10627
|
]
|
|
10341
10628
|
),
|
|
10342
10629
|
// Tabs
|
|
10343
|
-
h(
|
|
10630
|
+
h$1(
|
|
10344
10631
|
"div",
|
|
10345
10632
|
{
|
|
10346
10633
|
style: {
|
|
@@ -10357,7 +10644,7 @@ function mountChangePanel(container, changes, onNavigate, onClose) {
|
|
|
10357
10644
|
]
|
|
10358
10645
|
),
|
|
10359
10646
|
// List
|
|
10360
|
-
h(
|
|
10647
|
+
h$1(
|
|
10361
10648
|
"div",
|
|
10362
10649
|
{
|
|
10363
10650
|
style: {
|
|
@@ -11065,7 +11352,7 @@ const blockLatexSchema = codeBlockSchema.extendSchema((prev) => {
|
|
|
11065
11352
|
|
|
11066
11353
|
const inlineLatexTooltip = tooltipFactory("INLINE_LATEX");
|
|
11067
11354
|
|
|
11068
|
-
keepAlive(h);
|
|
11355
|
+
keepAlive(h$1);
|
|
11069
11356
|
const LatexTooltip = defineComponent({
|
|
11070
11357
|
props: {
|
|
11071
11358
|
ctx: {
|
|
@@ -11101,7 +11388,7 @@ const LatexTooltip = defineComponent({
|
|
|
11101
11388
|
}
|
|
11102
11389
|
};
|
|
11103
11390
|
return () => {
|
|
11104
|
-
return /* @__PURE__ */ h("div", { class: "container container-large" }, /* @__PURE__ */ h("div", { class: "input-container" }, props.innerView ? /* @__PURE__ */ h("div", { ref: innerViewRef }) : null), /* @__PURE__ */ h("div", { class: "footer" }, /* @__PURE__ */ h("span", { class: "left" }, i18n(props.ctx, "latex.escToExit")), /* @__PURE__ */ h(
|
|
11391
|
+
return /* @__PURE__ */ h$1("div", { class: "container container-large" }, /* @__PURE__ */ h$1("div", { class: "input-container" }, props.innerView ? /* @__PURE__ */ h$1("div", { ref: innerViewRef }) : null), /* @__PURE__ */ h$1("div", { class: "footer" }, /* @__PURE__ */ h$1("span", { class: "left" }, i18n(props.ctx, "latex.escToExit")), /* @__PURE__ */ h$1(
|
|
11105
11392
|
"a",
|
|
11106
11393
|
{
|
|
11107
11394
|
class: "right",
|
|
@@ -11109,7 +11396,7 @@ const LatexTooltip = defineComponent({
|
|
|
11109
11396
|
target: "_blank",
|
|
11110
11397
|
style: "display: none;"
|
|
11111
11398
|
},
|
|
11112
|
-
/* @__PURE__ */ h(Icon, { icon: helpIcon }),
|
|
11399
|
+
/* @__PURE__ */ h$1(Icon, { icon: helpIcon }),
|
|
11113
11400
|
" ",
|
|
11114
11401
|
i18n(props.ctx, "latex.helpDoc")
|
|
11115
11402
|
)));
|
|
@@ -11191,9 +11478,9 @@ class LatexInlineTooltip {
|
|
|
11191
11478
|
doc: innerDoc,
|
|
11192
11479
|
plugins: [
|
|
11193
11480
|
keymap$1({
|
|
11194
|
-
"Mod-z": undo,
|
|
11195
|
-
"Mod-Z": redo,
|
|
11196
|
-
"Mod-y": redo,
|
|
11481
|
+
"Mod-z": undo$1,
|
|
11482
|
+
"Mod-Z": redo$1,
|
|
11483
|
+
"Mod-y": redo$1,
|
|
11197
11484
|
Enter: () => {
|
|
11198
11485
|
if (__privateGet$2(this, _debounceTimer)) {
|
|
11199
11486
|
clearTimeout(__privateGet$2(this, _debounceTimer));
|
|
@@ -11870,25 +12157,120 @@ class Crepe extends CrepeBuilder {
|
|
|
11870
12157
|
/// The constructor of the crepe editor.
|
|
11871
12158
|
/// You can pass configs to the editor to configure the editor.
|
|
11872
12159
|
/// Calling the constructor will not create the editor, you need to call `create` to create the editor.
|
|
11873
|
-
constructor({
|
|
11874
|
-
|
|
11875
|
-
|
|
11876
|
-
...crepeBuilderConfig
|
|
11877
|
-
} = {}) {
|
|
11878
|
-
super(crepeBuilderConfig);
|
|
12160
|
+
constructor(config = {}) {
|
|
12161
|
+
var _a;
|
|
12162
|
+
resetPopupCount();
|
|
12163
|
+
const { features = {}, featureConfigs = {}, ...crepeBuilderConfig } = config;
|
|
11879
12164
|
const finalConfigs = defaultsDeep(featureConfigs, defaultConfig);
|
|
12165
|
+
const fixedToolbarConfig = finalConfigs[CrepeFeature.FixedToolbar];
|
|
12166
|
+
if (fixedToolbarConfig == null ? void 0 : fixedToolbarConfig.useLocalStorage) {
|
|
12167
|
+
try {
|
|
12168
|
+
const stored = localStorage.getItem("jvs-milkdown-data");
|
|
12169
|
+
if (stored) {
|
|
12170
|
+
const parsed = JSON.parse(stored);
|
|
12171
|
+
const docId = fixedToolbarConfig.id || "default";
|
|
12172
|
+
if (parsed.content && parsed.content[docId] !== void 0) {
|
|
12173
|
+
const entry = parsed.content[docId];
|
|
12174
|
+
const defaultValue = typeof entry === "string" ? entry : (_a = entry == null ? void 0 : entry.markdown) != null ? _a : "";
|
|
12175
|
+
crepeBuilderConfig.defaultValue = defaultValue;
|
|
12176
|
+
}
|
|
12177
|
+
}
|
|
12178
|
+
} catch (e) {
|
|
12179
|
+
console.error("Error loading content from localStorage:", e);
|
|
12180
|
+
}
|
|
12181
|
+
}
|
|
12182
|
+
super(crepeBuilderConfig);
|
|
12183
|
+
this.destroy = () => {
|
|
12184
|
+
resetPopupCount();
|
|
12185
|
+
return this.editor.destroy();
|
|
12186
|
+
};
|
|
11880
12187
|
const enabledFeatures = Object.entries({
|
|
11881
12188
|
...defaultFeatures,
|
|
11882
12189
|
...features
|
|
11883
12190
|
}).filter(([, enabled]) => enabled).map(([feature]) => feature);
|
|
11884
12191
|
enabledFeatures.forEach((feature) => {
|
|
11885
|
-
const
|
|
11886
|
-
loadFeature(feature, this.editor,
|
|
12192
|
+
const config2 = finalConfigs[feature];
|
|
12193
|
+
loadFeature(feature, this.editor, config2);
|
|
11887
12194
|
});
|
|
12195
|
+
if (fixedToolbarConfig == null ? void 0 : fixedToolbarConfig.useLocalStorage) {
|
|
12196
|
+
this.on((listener) => {
|
|
12197
|
+
listener.markdownUpdated((_, markdown) => {
|
|
12198
|
+
try {
|
|
12199
|
+
const html = this.editor.action(getHTML());
|
|
12200
|
+
const docId = fixedToolbarConfig.id || "default";
|
|
12201
|
+
const saveToLocalStorage = (mdVal, htmlVal) => {
|
|
12202
|
+
try {
|
|
12203
|
+
const stored = localStorage.getItem("jvs-milkdown-data");
|
|
12204
|
+
let parsed = {};
|
|
12205
|
+
if (stored) {
|
|
12206
|
+
parsed = JSON.parse(stored);
|
|
12207
|
+
}
|
|
12208
|
+
if (!parsed.content) {
|
|
12209
|
+
parsed.content = {};
|
|
12210
|
+
}
|
|
12211
|
+
const currentEntry = parsed.content[docId];
|
|
12212
|
+
const hasChanged = !currentEntry || typeof currentEntry === "string" && currentEntry !== mdVal || typeof currentEntry === "object" && (currentEntry.markdown !== mdVal || currentEntry.html !== htmlVal);
|
|
12213
|
+
if (hasChanged) {
|
|
12214
|
+
parsed.content[docId] = {
|
|
12215
|
+
markdown: mdVal,
|
|
12216
|
+
html: htmlVal
|
|
12217
|
+
};
|
|
12218
|
+
localStorage.setItem(
|
|
12219
|
+
"jvs-milkdown-data",
|
|
12220
|
+
JSON.stringify(parsed)
|
|
12221
|
+
);
|
|
12222
|
+
}
|
|
12223
|
+
} catch (e) {
|
|
12224
|
+
console.error("Error saving content to localStorage:", e);
|
|
12225
|
+
}
|
|
12226
|
+
};
|
|
12227
|
+
const hasBlobUrl = /blob:https?:\/\//.test(markdown) || /blob:https?:\/\//.test(html);
|
|
12228
|
+
if (hasBlobUrl) {
|
|
12229
|
+
Promise.all([
|
|
12230
|
+
replaceBlobUrlsWithBase64(markdown),
|
|
12231
|
+
replaceBlobUrlsWithBase64(html)
|
|
12232
|
+
]).then(([base64Markdown, base64Html]) => {
|
|
12233
|
+
saveToLocalStorage(base64Markdown, base64Html);
|
|
12234
|
+
}).catch((e) => {
|
|
12235
|
+
console.error("Error converting blob URLs:", e);
|
|
12236
|
+
saveToLocalStorage(markdown, html);
|
|
12237
|
+
});
|
|
12238
|
+
} else {
|
|
12239
|
+
saveToLocalStorage(markdown, html);
|
|
12240
|
+
}
|
|
12241
|
+
} catch (e) {
|
|
12242
|
+
console.error("Error saving content to localStorage:", e);
|
|
12243
|
+
}
|
|
12244
|
+
});
|
|
12245
|
+
});
|
|
12246
|
+
}
|
|
11888
12247
|
}
|
|
11889
12248
|
}
|
|
11890
12249
|
/// This is an alias for the `CrepeFeature` enum.
|
|
11891
12250
|
Crepe.Feature = CrepeFeature;
|
|
12251
|
+
async function replaceBlobUrlsWithBase64(content) {
|
|
12252
|
+
const blobRegex = /blob:https?:\/\/[^\s'")>]+/g;
|
|
12253
|
+
const matches = content.match(blobRegex);
|
|
12254
|
+
if (!matches) return content;
|
|
12255
|
+
let result = content;
|
|
12256
|
+
const uniqueBlobs = Array.from(new Set(matches));
|
|
12257
|
+
for (const blobUrl of uniqueBlobs) {
|
|
12258
|
+
try {
|
|
12259
|
+
const response = await fetch(blobUrl);
|
|
12260
|
+
const blob = await response.blob();
|
|
12261
|
+
const base64 = await new Promise((resolve, reject) => {
|
|
12262
|
+
const reader = new FileReader();
|
|
12263
|
+
reader.onloadend = () => resolve(reader.result);
|
|
12264
|
+
reader.onerror = reject;
|
|
12265
|
+
reader.readAsDataURL(blob);
|
|
12266
|
+
});
|
|
12267
|
+
result = result.replaceAll(blobUrl, base64);
|
|
12268
|
+
} catch (e) {
|
|
12269
|
+
console.error("Failed to convert blob URL to base64:", blobUrl, e);
|
|
12270
|
+
}
|
|
12271
|
+
}
|
|
12272
|
+
return result;
|
|
12273
|
+
}
|
|
11892
12274
|
|
|
11893
12275
|
export { Crepe, CrepeBuilder, CrepeFeature, enUS, i18n, localeCtx, translationsCtx, useCrepe, useCrepeFeatures, zhCN };
|
|
11894
12276
|
//# sourceMappingURL=index.js.map
|