@jvs-milkdown/crepe 1.2.11 → 1.2.13
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/feature/block-edit/index.js +1 -0
- package/lib/cjs/feature/block-edit/index.js.map +1 -1
- package/lib/cjs/feature/image-block/index.js +1 -1
- package/lib/cjs/feature/image-block/index.js.map +1 -1
- package/lib/cjs/feature/link-tooltip/index.js +1 -0
- package/lib/cjs/feature/link-tooltip/index.js.map +1 -1
- package/lib/cjs/feature/table/index.js +1 -0
- package/lib/cjs/feature/table/index.js.map +1 -1
- package/lib/cjs/feature/toolbar/index.js +123 -9
- package/lib/cjs/feature/toolbar/index.js.map +1 -1
- package/lib/cjs/index.js +248 -98
- package/lib/cjs/index.js.map +1 -1
- package/lib/esm/feature/block-edit/index.js +1 -0
- package/lib/esm/feature/block-edit/index.js.map +1 -1
- package/lib/esm/feature/image-block/index.js +1 -1
- package/lib/esm/feature/image-block/index.js.map +1 -1
- package/lib/esm/feature/link-tooltip/index.js +1 -0
- package/lib/esm/feature/link-tooltip/index.js.map +1 -1
- package/lib/esm/feature/table/index.js +1 -0
- package/lib/esm/feature/table/index.js.map +1 -1
- package/lib/esm/feature/toolbar/index.js +123 -9
- package/lib/esm/feature/toolbar/index.js.map +1 -1
- package/lib/esm/index.js +309 -159
- package/lib/esm/index.js.map +1 -1
- package/lib/theme/common/table.css +4 -4
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/lib/types/feature/attachment/view/components/attachment-block.d.ts.map +1 -1
- package/lib/types/feature/fixed-toolbar/component.d.ts.map +1 -1
- package/lib/types/feature/fixed-toolbar/document-header.d.ts.map +1 -1
- 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/feature/toolbar/index.d.ts.map +1 -1
- package/lib/types/icons/remove.d.ts +1 -1
- package/lib/types/icons/remove.d.ts.map +1 -1
- package/lib/types/utils/fixed-toolbar-popup-state.d.ts +7 -0
- package/lib/types/utils/fixed-toolbar-popup-state.d.ts.map +1 -0
- package/package.json +4 -4
- package/src/feature/attachment/view/components/attachment-block.tsx +1 -1
- package/src/feature/fixed-toolbar/component.tsx +1 -1
- package/src/feature/fixed-toolbar/document-header.tsx +5 -0
- package/src/feature/fixed-toolbar/index.ts +39 -2
- package/src/feature/fixed-toolbar/menu-bar.tsx +13 -2
- package/src/feature/fixed-toolbar/outline-panel.tsx +1 -1
- package/src/feature/fixed-toolbar/shortcut-help-modal.tsx +1 -1
- package/src/feature/fixed-toolbar/view-menu-state.ts +1 -1
- package/src/feature/image-block/index.ts +1 -1
- package/src/feature/toolbar/component.tsx +95 -8
- package/src/feature/toolbar/index.ts +33 -0
- package/src/icons/remove.ts +1 -0
- package/src/theme/common/table.css +4 -4
- package/src/utils/fixed-toolbar-popup-state.ts +27 -0
package/lib/esm/index.js
CHANGED
|
@@ -3,7 +3,7 @@ import { languages } from '@codemirror/language-data';
|
|
|
3
3
|
import { oneDark } from '@codemirror/theme-one-dark';
|
|
4
4
|
import { createSlice } from '@jvs-milkdown/kit/ctx';
|
|
5
5
|
import { $ctx, $nodeSchema, $view, $remark, $markAttr, $markSchema, $command, $prose, $useKeymap, $inputRule, getMarkdown } from '@jvs-milkdown/kit/utils';
|
|
6
|
-
import { defineComponent, shallowRef, ref, computed, createApp, watchEffect, watch, onUnmounted,
|
|
6
|
+
import { defineComponent, shallowRef, ref, computed, h, createApp, watchEffect, watch, onUnmounted, Fragment, reactive, onMounted, onBeforeUnmount, nextTick } from 'vue';
|
|
7
7
|
import { Icon } from '@jvs-milkdown/kit/component';
|
|
8
8
|
import { blockConfig, block, BlockProvider } from '@jvs-milkdown/kit/plugin/block';
|
|
9
9
|
import { commandsCtx, editorViewCtx, editorCtx, EditorStatus, schemaCtx, editorViewOptionsCtx, Editor, rootCtx, defaultValueCtx } from '@jvs-milkdown/kit/core';
|
|
@@ -439,6 +439,7 @@ const removeIcon = `
|
|
|
439
439
|
>
|
|
440
440
|
<path
|
|
441
441
|
d="M7.30775 20.4997C6.81058 20.4997 6.385 20.3227 6.031 19.9687C5.677 19.6147 5.5 19.1892 5.5 18.692V5.99973H5.25C5.0375 5.99973 4.85942 5.92782 4.71575 5.78398C4.57192 5.64015 4.5 5.46198 4.5 5.24948C4.5 5.03682 4.57192 4.85873 4.71575 4.71523C4.85942 4.57157 5.0375 4.49973 5.25 4.49973H9C9 4.2549 9.08625 4.04624 9.25875 3.87374C9.43108 3.7014 9.63967 3.61523 9.8845 3.61523H14.1155C14.3603 3.61523 14.5689 3.7014 14.7413 3.87374C14.9138 4.04624 15 4.2549 15 4.49973H18.75C18.9625 4.49973 19.1406 4.57165 19.2843 4.71548C19.4281 4.85932 19.5 5.03748 19.5 5.24998C19.5 5.46265 19.4281 5.64073 19.2843 5.78423C19.1406 5.9279 18.9625 5.99973 18.75 5.99973H18.5V18.692C18.5 19.1892 18.323 19.6147 17.969 19.9687C17.615 20.3227 17.1894 20.4997 16.6923 20.4997H7.30775ZM17 5.99973H7V18.692C7 18.7818 7.02883 18.8556 7.0865 18.9132C7.14417 18.9709 7.21792 18.9997 7.30775 18.9997H16.6923C16.7821 18.9997 16.8558 18.9709 16.9135 18.9132C16.9712 18.8556 17 18.7818 17 18.692V5.99973ZM10.1543 16.9997C10.3668 16.9997 10.5448 16.9279 10.6885 16.7842C10.832 16.6404 10.9037 16.4622 10.9037 16.2497V8.74973C10.9037 8.53723 10.8318 8.35907 10.688 8.21523C10.5443 8.07157 10.3662 7.99973 10.1535 7.99973C9.941 7.99973 9.76292 8.07157 9.61925 8.21523C9.47575 8.35907 9.404 8.53723 9.404 8.74973V16.2497C9.404 16.4622 9.47583 16.6404 9.6195 16.7842C9.76333 16.9279 9.94158 16.9997 10.1543 16.9997ZM13.8465 16.9997C14.059 16.9997 14.2371 16.9279 14.3807 16.7842C14.5243 16.6404 14.596 16.4622 14.596 16.2497V8.74973C14.596 8.53723 14.5242 8.35907 14.3805 8.21523C14.2367 8.07157 14.0584 7.99973 13.8458 7.99973C13.6333 7.99973 13.4552 8.07157 13.3115 8.21523C13.168 8.35907 13.0962 8.53723 13.0962 8.74973V16.2497C13.0962 16.4622 13.1682 16.6404 13.312 16.7842C13.4557 16.9279 13.6338 16.9997 13.8465 16.9997Z"
|
|
442
|
+
fill="#363B4C"
|
|
442
443
|
/>
|
|
443
444
|
</svg>
|
|
444
445
|
`;
|
|
@@ -2481,7 +2482,7 @@ function getGroups$1(filter, config, ctx) {
|
|
|
2481
2482
|
};
|
|
2482
2483
|
}
|
|
2483
2484
|
|
|
2484
|
-
keepAlive(h
|
|
2485
|
+
keepAlive(h);
|
|
2485
2486
|
const Menu = defineComponent({
|
|
2486
2487
|
props: {
|
|
2487
2488
|
ctx: {
|
|
@@ -2827,7 +2828,7 @@ const Menu = defineComponent({
|
|
|
2827
2828
|
const api = ctx.get(menuAPI.key);
|
|
2828
2829
|
const showListMenu = (api == null ? void 0 : api.getMode()) === "list" || !(api == null ? void 0 : api.isProgrammatic()) || filter.value !== "";
|
|
2829
2830
|
if (showListMenu) {
|
|
2830
|
-
return /* @__PURE__ */ h
|
|
2831
|
+
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(
|
|
2831
2832
|
"li",
|
|
2832
2833
|
{
|
|
2833
2834
|
key: item.key,
|
|
@@ -2870,9 +2871,9 @@ const Menu = defineComponent({
|
|
|
2870
2871
|
runByIndex(item.index);
|
|
2871
2872
|
}
|
|
2872
2873
|
},
|
|
2873
|
-
/* @__PURE__ */ h
|
|
2874
|
-
/* @__PURE__ */ h
|
|
2875
|
-
item.key === "table" ? /* @__PURE__ */ h
|
|
2874
|
+
/* @__PURE__ */ h(Icon, { icon: item.icon }),
|
|
2875
|
+
/* @__PURE__ */ h("span", { style: item.key === "table" ? { flex: 1 } : {} }, item.label),
|
|
2876
|
+
item.key === "table" ? /* @__PURE__ */ h(
|
|
2876
2877
|
"div",
|
|
2877
2878
|
{
|
|
2878
2879
|
style: {
|
|
@@ -2882,9 +2883,9 @@ const Menu = defineComponent({
|
|
|
2882
2883
|
transform: "rotate(-90deg)"
|
|
2883
2884
|
}
|
|
2884
2885
|
},
|
|
2885
|
-
/* @__PURE__ */ h
|
|
2886
|
+
/* @__PURE__ */ h(Icon, { icon: chevronDownIcon })
|
|
2886
2887
|
) : null
|
|
2887
|
-
)))))), showTableMenu.value ? /* @__PURE__ */ h
|
|
2888
|
+
)))))), showTableMenu.value ? /* @__PURE__ */ h(
|
|
2888
2889
|
"div",
|
|
2889
2890
|
{
|
|
2890
2891
|
class: "milkdown-slash-menu custom-submenu",
|
|
@@ -2907,7 +2908,7 @@ const Menu = defineComponent({
|
|
|
2907
2908
|
},
|
|
2908
2909
|
onPointerleave: handleTableLeave
|
|
2909
2910
|
},
|
|
2910
|
-
/* @__PURE__ */ h
|
|
2911
|
+
/* @__PURE__ */ h(
|
|
2911
2912
|
"div",
|
|
2912
2913
|
{
|
|
2913
2914
|
style: {
|
|
@@ -2919,7 +2920,7 @@ const Menu = defineComponent({
|
|
|
2919
2920
|
},
|
|
2920
2921
|
i18n(ctx, "customMenu.insertTable")
|
|
2921
2922
|
),
|
|
2922
|
-
/* @__PURE__ */ h
|
|
2923
|
+
/* @__PURE__ */ h(
|
|
2923
2924
|
"div",
|
|
2924
2925
|
{
|
|
2925
2926
|
style: {
|
|
@@ -2932,7 +2933,7 @@ const Menu = defineComponent({
|
|
|
2932
2933
|
Array.from({ length: 9 }).map(
|
|
2933
2934
|
(_, r) => Array.from({ length: 9 }).map((_2, c) => {
|
|
2934
2935
|
const isHovered = r < tableHoverIndices.value.r && c < tableHoverIndices.value.c;
|
|
2935
|
-
return /* @__PURE__ */ h
|
|
2936
|
+
return /* @__PURE__ */ h(
|
|
2936
2937
|
"div",
|
|
2937
2938
|
{
|
|
2938
2939
|
key: `cell-${r}-${c}`,
|
|
@@ -2961,7 +2962,7 @@ const Menu = defineComponent({
|
|
|
2961
2962
|
})
|
|
2962
2963
|
)
|
|
2963
2964
|
),
|
|
2964
|
-
tableHoverIndices.value.r > 0 ? /* @__PURE__ */ h
|
|
2965
|
+
tableHoverIndices.value.r > 0 ? /* @__PURE__ */ h(
|
|
2965
2966
|
"div",
|
|
2966
2967
|
{
|
|
2967
2968
|
style: {
|
|
@@ -2974,7 +2975,7 @@ const Menu = defineComponent({
|
|
|
2974
2975
|
tableHoverIndices.value.r,
|
|
2975
2976
|
" x ",
|
|
2976
2977
|
tableHoverIndices.value.c
|
|
2977
|
-
) : /* @__PURE__ */ h
|
|
2978
|
+
) : /* @__PURE__ */ h(
|
|
2978
2979
|
"div",
|
|
2979
2980
|
{
|
|
2980
2981
|
style: {
|
|
@@ -3144,7 +3145,7 @@ const Menu = defineComponent({
|
|
|
3144
3145
|
const renderGridBtn = (key) => {
|
|
3145
3146
|
const item = findItem(key);
|
|
3146
3147
|
if (!item) return null;
|
|
3147
|
-
return /* @__PURE__ */ h
|
|
3148
|
+
return /* @__PURE__ */ h(
|
|
3148
3149
|
"div",
|
|
3149
3150
|
{
|
|
3150
3151
|
title: item.label,
|
|
@@ -3165,11 +3166,11 @@ const Menu = defineComponent({
|
|
|
3165
3166
|
},
|
|
3166
3167
|
"data-index": item.index
|
|
3167
3168
|
},
|
|
3168
|
-
/* @__PURE__ */ h
|
|
3169
|
+
/* @__PURE__ */ h(Icon, { icon: item.icon })
|
|
3169
3170
|
);
|
|
3170
3171
|
};
|
|
3171
3172
|
const renderCustomRow = (iconHtml, label, hasArrow, onPointerEnter, onPointerLeave, onClick) => {
|
|
3172
|
-
return /* @__PURE__ */ h
|
|
3173
|
+
return /* @__PURE__ */ h(
|
|
3173
3174
|
"div",
|
|
3174
3175
|
{
|
|
3175
3176
|
class: "custom-menu-row",
|
|
@@ -3185,12 +3186,12 @@ const Menu = defineComponent({
|
|
|
3185
3186
|
onClick == null ? void 0 : onClick();
|
|
3186
3187
|
}
|
|
3187
3188
|
},
|
|
3188
|
-
/* @__PURE__ */ h
|
|
3189
|
-
hasArrow ? /* @__PURE__ */ h
|
|
3189
|
+
/* @__PURE__ */ h("div", { class: "custom-menu-row-left" }, /* @__PURE__ */ h(Icon, { icon: iconHtml }), /* @__PURE__ */ h("span", null, label)),
|
|
3190
|
+
hasArrow ? /* @__PURE__ */ h(Icon, { icon: chevronDownIcon }) : null
|
|
3190
3191
|
);
|
|
3191
3192
|
};
|
|
3192
3193
|
const renderSubMenuItem = (iconHtml, label, isActive, onClick, disabled = false) => {
|
|
3193
|
-
return /* @__PURE__ */ h
|
|
3194
|
+
return /* @__PURE__ */ h(
|
|
3194
3195
|
"div",
|
|
3195
3196
|
{
|
|
3196
3197
|
class: ["custom-menu-row", disabled ? "disabled" : ""],
|
|
@@ -3208,7 +3209,7 @@ const Menu = defineComponent({
|
|
|
3208
3209
|
if (!disabled) onClick();
|
|
3209
3210
|
}
|
|
3210
3211
|
},
|
|
3211
|
-
/* @__PURE__ */ h
|
|
3212
|
+
/* @__PURE__ */ h("div", { class: "custom-menu-row-left" }, /* @__PURE__ */ h(Icon, { icon: iconHtml }), /* @__PURE__ */ h(
|
|
3212
3213
|
"span",
|
|
3213
3214
|
{
|
|
3214
3215
|
style: {
|
|
@@ -3217,18 +3218,18 @@ const Menu = defineComponent({
|
|
|
3217
3218
|
},
|
|
3218
3219
|
label
|
|
3219
3220
|
)),
|
|
3220
|
-
isActive ? /* @__PURE__ */ h
|
|
3221
|
+
isActive ? /* @__PURE__ */ h("span", { style: { color: "var(--crepe-color-primary)" } }, /* @__PURE__ */ h(Icon, { icon: confirmIcon })) : null
|
|
3221
3222
|
);
|
|
3222
3223
|
};
|
|
3223
|
-
return /* @__PURE__ */ h
|
|
3224
|
+
return /* @__PURE__ */ h(
|
|
3224
3225
|
"div",
|
|
3225
3226
|
{
|
|
3226
3227
|
ref: host,
|
|
3227
3228
|
onPointerdown: (e) => e.preventDefault(),
|
|
3228
3229
|
class: "custom-block-menu"
|
|
3229
3230
|
},
|
|
3230
|
-
!isMedia ? /* @__PURE__ */ h
|
|
3231
|
-
showAlign ? /* @__PURE__ */ h
|
|
3231
|
+
!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,
|
|
3232
|
+
showAlign ? /* @__PURE__ */ h("div", { class: "custom-divider" }) : null,
|
|
3232
3233
|
showAlign && renderCustomRow(
|
|
3233
3234
|
alignLeftIcon,
|
|
3234
3235
|
i18n(ctx, "customMenu.indentAndAlign"),
|
|
@@ -3236,7 +3237,7 @@ const Menu = defineComponent({
|
|
|
3236
3237
|
handleIndentAlignEnter,
|
|
3237
3238
|
handleIndentAlignLeave
|
|
3238
3239
|
),
|
|
3239
|
-
showIndentAlignMenu.value ? /* @__PURE__ */ h
|
|
3240
|
+
showIndentAlignMenu.value ? /* @__PURE__ */ h(
|
|
3240
3241
|
"div",
|
|
3241
3242
|
{
|
|
3242
3243
|
class: "milkdown-slash-menu custom-submenu",
|
|
@@ -3273,7 +3274,7 @@ const Menu = defineComponent({
|
|
|
3273
3274
|
currentAlign === "right",
|
|
3274
3275
|
() => setAlign("right")
|
|
3275
3276
|
),
|
|
3276
|
-
/* @__PURE__ */ h
|
|
3277
|
+
/* @__PURE__ */ h("div", { class: "custom-divider" }),
|
|
3277
3278
|
renderSubMenuItem(
|
|
3278
3279
|
indentIncreaseIcon,
|
|
3279
3280
|
i18n(ctx, "customMenu.increaseIndent"),
|
|
@@ -3295,7 +3296,7 @@ const Menu = defineComponent({
|
|
|
3295
3296
|
handleColorEnter,
|
|
3296
3297
|
handleColorLeave
|
|
3297
3298
|
),
|
|
3298
|
-
showColorMenu.value ? /* @__PURE__ */ h
|
|
3299
|
+
showColorMenu.value ? /* @__PURE__ */ h(
|
|
3299
3300
|
"div",
|
|
3300
3301
|
{
|
|
3301
3302
|
class: "milkdown-slash-menu custom-submenu",
|
|
@@ -3319,7 +3320,7 @@ const Menu = defineComponent({
|
|
|
3319
3320
|
},
|
|
3320
3321
|
onPointerleave: handleColorLeave
|
|
3321
3322
|
},
|
|
3322
|
-
/* @__PURE__ */ h
|
|
3323
|
+
/* @__PURE__ */ h(
|
|
3323
3324
|
"div",
|
|
3324
3325
|
{
|
|
3325
3326
|
style: {
|
|
@@ -3330,7 +3331,7 @@ const Menu = defineComponent({
|
|
|
3330
3331
|
},
|
|
3331
3332
|
i18n(ctx, "customMenu.textColor")
|
|
3332
3333
|
),
|
|
3333
|
-
/* @__PURE__ */ h
|
|
3334
|
+
/* @__PURE__ */ h("div", { style: { display: "flex", gap: "4px", flexWrap: "wrap" } }, [
|
|
3334
3335
|
"#000000",
|
|
3335
3336
|
"#8C8C8C",
|
|
3336
3337
|
"#F5222D",
|
|
@@ -3339,7 +3340,7 @@ const Menu = defineComponent({
|
|
|
3339
3340
|
"#52C41A",
|
|
3340
3341
|
"#1677FF",
|
|
3341
3342
|
"#722ED1"
|
|
3342
|
-
].map((color) => /* @__PURE__ */ h
|
|
3343
|
+
].map((color) => /* @__PURE__ */ h(
|
|
3343
3344
|
"div",
|
|
3344
3345
|
{
|
|
3345
3346
|
key: color,
|
|
@@ -3369,7 +3370,7 @@ const Menu = defineComponent({
|
|
|
3369
3370
|
},
|
|
3370
3371
|
"A"
|
|
3371
3372
|
))),
|
|
3372
|
-
/* @__PURE__ */ h
|
|
3373
|
+
/* @__PURE__ */ h(
|
|
3373
3374
|
"div",
|
|
3374
3375
|
{
|
|
3375
3376
|
style: {
|
|
@@ -3381,7 +3382,7 @@ const Menu = defineComponent({
|
|
|
3381
3382
|
},
|
|
3382
3383
|
i18n(ctx, "customMenu.bgColor")
|
|
3383
3384
|
),
|
|
3384
|
-
/* @__PURE__ */ h
|
|
3385
|
+
/* @__PURE__ */ h("div", { style: { display: "flex", gap: "4px", flexWrap: "wrap" } }, [
|
|
3385
3386
|
"transparent",
|
|
3386
3387
|
"#F5F5F5",
|
|
3387
3388
|
"#FFCCC7",
|
|
@@ -3390,7 +3391,7 @@ const Menu = defineComponent({
|
|
|
3390
3391
|
"#D9F7BE",
|
|
3391
3392
|
"#D6E4FF",
|
|
3392
3393
|
"#EFDBFF"
|
|
3393
|
-
].map((color) => /* @__PURE__ */ h
|
|
3394
|
+
].map((color) => /* @__PURE__ */ h(
|
|
3394
3395
|
"div",
|
|
3395
3396
|
{
|
|
3396
3397
|
key: color,
|
|
@@ -3414,7 +3415,7 @@ const Menu = defineComponent({
|
|
|
3414
3415
|
overflow: "hidden"
|
|
3415
3416
|
}
|
|
3416
3417
|
},
|
|
3417
|
-
color === "transparent" ? /* @__PURE__ */ h
|
|
3418
|
+
color === "transparent" ? /* @__PURE__ */ h(
|
|
3418
3419
|
"div",
|
|
3419
3420
|
{
|
|
3420
3421
|
style: {
|
|
@@ -3438,7 +3439,7 @@ const Menu = defineComponent({
|
|
|
3438
3439
|
"#52C41A",
|
|
3439
3440
|
"#1677FF",
|
|
3440
3441
|
"#722ED1"
|
|
3441
|
-
].map((color) => /* @__PURE__ */ h
|
|
3442
|
+
].map((color) => /* @__PURE__ */ h(
|
|
3442
3443
|
"div",
|
|
3443
3444
|
{
|
|
3444
3445
|
key: color,
|
|
@@ -3461,7 +3462,7 @@ const Menu = defineComponent({
|
|
|
3461
3462
|
}
|
|
3462
3463
|
}
|
|
3463
3464
|
))),
|
|
3464
|
-
/* @__PURE__ */ h
|
|
3465
|
+
/* @__PURE__ */ h(
|
|
3465
3466
|
"button",
|
|
3466
3467
|
{
|
|
3467
3468
|
onPointerdown: (e) => {
|
|
@@ -3488,7 +3489,7 @@ const Menu = defineComponent({
|
|
|
3488
3489
|
i18n(ctx, "customMenu.restoreDefault")
|
|
3489
3490
|
)
|
|
3490
3491
|
) : null,
|
|
3491
|
-
!isMedia ? /* @__PURE__ */ h
|
|
3492
|
+
!isMedia ? /* @__PURE__ */ h("div", { class: "custom-divider" }) : null,
|
|
3492
3493
|
renderCustomRow(
|
|
3493
3494
|
clearIcon,
|
|
3494
3495
|
i18n(ctx, "customMenu.cut"),
|
|
@@ -3513,7 +3514,7 @@ const Menu = defineComponent({
|
|
|
3513
3514
|
void 0,
|
|
3514
3515
|
applyDelete
|
|
3515
3516
|
),
|
|
3516
|
-
/* @__PURE__ */ h
|
|
3517
|
+
/* @__PURE__ */ h("div", { class: "custom-divider" }),
|
|
3517
3518
|
renderCustomRow(
|
|
3518
3519
|
plusIcon,
|
|
3519
3520
|
i18n(ctx, "customMenu.addBelow"),
|
|
@@ -3521,7 +3522,7 @@ const Menu = defineComponent({
|
|
|
3521
3522
|
handleAddBelowEnter,
|
|
3522
3523
|
handleAddBelowLeave
|
|
3523
3524
|
),
|
|
3524
|
-
showAddBelowMenu.value ? /* @__PURE__ */ h
|
|
3525
|
+
showAddBelowMenu.value ? /* @__PURE__ */ h(
|
|
3525
3526
|
"div",
|
|
3526
3527
|
{
|
|
3527
3528
|
class: "milkdown-slash-menu custom-submenu",
|
|
@@ -3541,14 +3542,14 @@ const Menu = defineComponent({
|
|
|
3541
3542
|
},
|
|
3542
3543
|
onPointerleave: handleAddBelowLeave
|
|
3543
3544
|
},
|
|
3544
|
-
/* @__PURE__ */ h
|
|
3545
|
+
/* @__PURE__ */ h(
|
|
3545
3546
|
"div",
|
|
3546
3547
|
{
|
|
3547
3548
|
class: "menu-groups",
|
|
3548
3549
|
onPointermove: onPointerMove,
|
|
3549
3550
|
style: { maxHeight: "300px", overflowY: "auto" }
|
|
3550
3551
|
},
|
|
3551
|
-
groupInfo.value.groups.map((group) => /* @__PURE__ */ h
|
|
3552
|
+
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(
|
|
3552
3553
|
"li",
|
|
3553
3554
|
{
|
|
3554
3555
|
key: item.key,
|
|
@@ -3575,8 +3576,8 @@ const Menu = defineComponent({
|
|
|
3575
3576
|
runByIndexForAddBelow(item.index);
|
|
3576
3577
|
}
|
|
3577
3578
|
},
|
|
3578
|
-
/* @__PURE__ */ h
|
|
3579
|
-
/* @__PURE__ */ h
|
|
3579
|
+
/* @__PURE__ */ h(Icon, { icon: item.icon }),
|
|
3580
|
+
/* @__PURE__ */ h("span", null, item.label)
|
|
3580
3581
|
)))))
|
|
3581
3582
|
)
|
|
3582
3583
|
) : null
|
|
@@ -3824,7 +3825,7 @@ function getBlockKey(node) {
|
|
|
3824
3825
|
}
|
|
3825
3826
|
}
|
|
3826
3827
|
|
|
3827
|
-
keepAlive(h
|
|
3828
|
+
keepAlive(h, Fragment);
|
|
3828
3829
|
const BlockHandle = defineComponent({
|
|
3829
3830
|
props: {
|
|
3830
3831
|
onAdd: {
|
|
@@ -3872,7 +3873,7 @@ const BlockHandle = defineComponent({
|
|
|
3872
3873
|
const addButton = ref();
|
|
3873
3874
|
const menuButton = ref();
|
|
3874
3875
|
return () => {
|
|
3875
|
-
return /* @__PURE__ */ h
|
|
3876
|
+
return /* @__PURE__ */ h(Fragment, null, /* @__PURE__ */ h(
|
|
3876
3877
|
"div",
|
|
3877
3878
|
{
|
|
3878
3879
|
ref: addButton,
|
|
@@ -3898,8 +3899,8 @@ const BlockHandle = defineComponent({
|
|
|
3898
3899
|
props.onAdd(addButton.value);
|
|
3899
3900
|
}
|
|
3900
3901
|
},
|
|
3901
|
-
/* @__PURE__ */ h
|
|
3902
|
-
), /* @__PURE__ */ h
|
|
3902
|
+
/* @__PURE__ */ h(Icon, { icon: props.addIcon })
|
|
3903
|
+
), /* @__PURE__ */ h(
|
|
3903
3904
|
"div",
|
|
3904
3905
|
{
|
|
3905
3906
|
ref: menuButton,
|
|
@@ -3917,14 +3918,14 @@ const BlockHandle = defineComponent({
|
|
|
3917
3918
|
props.onLeaveMenu();
|
|
3918
3919
|
}
|
|
3919
3920
|
},
|
|
3920
|
-
/* @__PURE__ */ h
|
|
3921
|
-
), /* @__PURE__ */ h
|
|
3921
|
+
/* @__PURE__ */ h(Icon, { icon: props.state.icon })
|
|
3922
|
+
), /* @__PURE__ */ h("div", { class: "divider" }), /* @__PURE__ */ h(
|
|
3922
3923
|
"div",
|
|
3923
3924
|
{
|
|
3924
3925
|
class: "operation-item drag-item",
|
|
3925
3926
|
title: i18n(props.ctx, "handle.drag")
|
|
3926
3927
|
},
|
|
3927
|
-
/* @__PURE__ */ h
|
|
3928
|
+
/* @__PURE__ */ h(Icon, { icon: dragHandleIcon })
|
|
3928
3929
|
));
|
|
3929
3930
|
};
|
|
3930
3931
|
}
|
|
@@ -4294,6 +4295,29 @@ const cursor = (editor, config) => {
|
|
|
4294
4295
|
editor.use($prose(() => virtualCursor));
|
|
4295
4296
|
};
|
|
4296
4297
|
|
|
4298
|
+
const listeners = /* @__PURE__ */ new Set();
|
|
4299
|
+
let _popupCount = 0;
|
|
4300
|
+
function getIsAnyPopupOpen() {
|
|
4301
|
+
return _popupCount > 0;
|
|
4302
|
+
}
|
|
4303
|
+
function addPopupChangeListener(fn) {
|
|
4304
|
+
listeners.add(fn);
|
|
4305
|
+
return () => listeners.delete(fn);
|
|
4306
|
+
}
|
|
4307
|
+
function incrementPopupCount() {
|
|
4308
|
+
const wasZero = _popupCount === 0;
|
|
4309
|
+
_popupCount++;
|
|
4310
|
+
if (wasZero) {
|
|
4311
|
+
listeners.forEach((fn) => fn());
|
|
4312
|
+
}
|
|
4313
|
+
}
|
|
4314
|
+
function decrementPopupCount() {
|
|
4315
|
+
_popupCount = Math.max(0, _popupCount - 1);
|
|
4316
|
+
if (_popupCount === 0) {
|
|
4317
|
+
listeners.forEach((fn) => fn());
|
|
4318
|
+
}
|
|
4319
|
+
}
|
|
4320
|
+
|
|
4297
4321
|
const remarkHighlightMarkPlugin = $remark(
|
|
4298
4322
|
"remarkHighlightMark",
|
|
4299
4323
|
() => function() {
|
|
@@ -5325,7 +5349,7 @@ const activeIconMap = {
|
|
|
5325
5349
|
[dividerIcon]: dividerIconActive
|
|
5326
5350
|
// [highLineCodeIcon]: highLineCodeIconActive,
|
|
5327
5351
|
};
|
|
5328
|
-
keepAlive(h
|
|
5352
|
+
keepAlive(h, Fragment);
|
|
5329
5353
|
const formatPainterStates = /* @__PURE__ */ new WeakMap();
|
|
5330
5354
|
const formatPainterHandlers = /* @__PURE__ */ new WeakMap();
|
|
5331
5355
|
const formatPainterIgnoreNext = /* @__PURE__ */ new WeakMap();
|
|
@@ -5390,6 +5414,8 @@ const Toolbar = defineComponent({
|
|
|
5390
5414
|
const {
|
|
5391
5415
|
marks: savedMarks,
|
|
5392
5416
|
align: savedAlign,
|
|
5417
|
+
blockType: savedBlockType,
|
|
5418
|
+
blockAttrs: savedBlockAttrs,
|
|
5393
5419
|
isPersistent
|
|
5394
5420
|
} = formatPainterState.value;
|
|
5395
5421
|
let applied = false;
|
|
@@ -5411,6 +5437,30 @@ const Toolbar = defineComponent({
|
|
|
5411
5437
|
}
|
|
5412
5438
|
);
|
|
5413
5439
|
}
|
|
5440
|
+
if (savedBlockType) {
|
|
5441
|
+
curState.doc.nodesBetween(
|
|
5442
|
+
curSelection.from,
|
|
5443
|
+
curSelection.to,
|
|
5444
|
+
(node, pos) => {
|
|
5445
|
+
if (node.type.name === "paragraph") {
|
|
5446
|
+
tr.setNodeMarkup(
|
|
5447
|
+
pos,
|
|
5448
|
+
curState.schema.nodes[savedBlockType],
|
|
5449
|
+
{
|
|
5450
|
+
...savedBlockAttrs,
|
|
5451
|
+
...savedAlign ? { align: savedAlign } : {}
|
|
5452
|
+
}
|
|
5453
|
+
);
|
|
5454
|
+
} else if (node.type.name === "heading" && savedBlockAttrs) {
|
|
5455
|
+
tr.setNodeMarkup(pos, null, {
|
|
5456
|
+
...node.attrs,
|
|
5457
|
+
...savedBlockAttrs,
|
|
5458
|
+
...savedAlign ? { align: savedAlign } : {}
|
|
5459
|
+
});
|
|
5460
|
+
}
|
|
5461
|
+
}
|
|
5462
|
+
);
|
|
5463
|
+
}
|
|
5414
5464
|
dispatch(tr);
|
|
5415
5465
|
applied = true;
|
|
5416
5466
|
} else {
|
|
@@ -5443,6 +5493,22 @@ const Toolbar = defineComponent({
|
|
|
5443
5493
|
});
|
|
5444
5494
|
}
|
|
5445
5495
|
}
|
|
5496
|
+
if (savedBlockType) {
|
|
5497
|
+
const pos = curSelection.$from.before(curSelection.$from.depth);
|
|
5498
|
+
const node = curState.doc.nodeAt(pos);
|
|
5499
|
+
if (node && node.type.name === "paragraph") {
|
|
5500
|
+
tr.setNodeMarkup(pos, curState.schema.nodes[savedBlockType], {
|
|
5501
|
+
...savedBlockAttrs,
|
|
5502
|
+
...savedAlign ? { align: savedAlign } : {}
|
|
5503
|
+
});
|
|
5504
|
+
} else if (node && node.type.name === "heading" && savedBlockAttrs) {
|
|
5505
|
+
tr.setNodeMarkup(pos, null, {
|
|
5506
|
+
...node.attrs,
|
|
5507
|
+
...savedBlockAttrs,
|
|
5508
|
+
...savedAlign ? { align: savedAlign } : {}
|
|
5509
|
+
});
|
|
5510
|
+
}
|
|
5511
|
+
}
|
|
5446
5512
|
tr.setStoredMarks(savedMarks);
|
|
5447
5513
|
dispatch(tr);
|
|
5448
5514
|
applied = true;
|
|
@@ -5491,7 +5557,22 @@ const Toolbar = defineComponent({
|
|
|
5491
5557
|
}
|
|
5492
5558
|
}
|
|
5493
5559
|
align = foundAlign;
|
|
5494
|
-
|
|
5560
|
+
let blockType = null;
|
|
5561
|
+
let blockAttrs = null;
|
|
5562
|
+
{
|
|
5563
|
+
const parent = selection.$from.parent;
|
|
5564
|
+
if (parent.type.name === "heading") {
|
|
5565
|
+
blockType = "heading";
|
|
5566
|
+
blockAttrs = { level: parent.attrs.level };
|
|
5567
|
+
}
|
|
5568
|
+
}
|
|
5569
|
+
formatPainterState.value = {
|
|
5570
|
+
marks,
|
|
5571
|
+
align,
|
|
5572
|
+
blockType,
|
|
5573
|
+
blockAttrs,
|
|
5574
|
+
isPersistent
|
|
5575
|
+
};
|
|
5495
5576
|
document.removeEventListener("pointerup", formatPainterHandler);
|
|
5496
5577
|
setTimeout(() => {
|
|
5497
5578
|
document.addEventListener("pointerup", formatPainterHandler);
|
|
@@ -5544,6 +5625,13 @@ const Toolbar = defineComponent({
|
|
|
5544
5625
|
const showOverflowMenu = ref(false);
|
|
5545
5626
|
const overflowMenuPos = ref({ top: 0 });
|
|
5546
5627
|
const cachedWidths = /* @__PURE__ */ new Map();
|
|
5628
|
+
const anyFixedPopup = computed(
|
|
5629
|
+
() => !!isFixed && (showBlockMenu.value || showAlignMenu.value || showColorMenu.value || showFontFamilyMenu.value || showFontSizeMenu.value || showTableMenu.value || showOverflowMenu.value)
|
|
5630
|
+
);
|
|
5631
|
+
watch(anyFixedPopup, (val) => {
|
|
5632
|
+
if (val) incrementPopupCount();
|
|
5633
|
+
else decrementPopupCount();
|
|
5634
|
+
});
|
|
5547
5635
|
const getMenuLeftPos = (rect, menuWidth) => {
|
|
5548
5636
|
let left = rect.left;
|
|
5549
5637
|
if (left + menuWidth > window.innerWidth) {
|
|
@@ -5780,6 +5868,7 @@ const Toolbar = defineComponent({
|
|
|
5780
5868
|
if (hideFontFamilyTimer) clearTimeout(hideFontFamilyTimer);
|
|
5781
5869
|
if (hideFontSizeTimer) clearTimeout(hideFontSizeTimer);
|
|
5782
5870
|
if (hideTableTimer) clearTimeout(hideTableTimer);
|
|
5871
|
+
if (anyFixedPopup.value) decrementPopupCount();
|
|
5783
5872
|
});
|
|
5784
5873
|
let overflowResizeObserver = null;
|
|
5785
5874
|
let overflowSetupDone = false;
|
|
@@ -6129,7 +6218,7 @@ const Toolbar = defineComponent({
|
|
|
6129
6218
|
showFontSizeMenu.value = false;
|
|
6130
6219
|
};
|
|
6131
6220
|
const renderSubMenuItem = (iconHtml, label, isActive, onClick2, disabled = false) => {
|
|
6132
|
-
return /* @__PURE__ */ h
|
|
6221
|
+
return /* @__PURE__ */ h(
|
|
6133
6222
|
"div",
|
|
6134
6223
|
{
|
|
6135
6224
|
class: ["custom-menu-row", disabled ? "disabled" : ""],
|
|
@@ -6161,13 +6250,13 @@ const Toolbar = defineComponent({
|
|
|
6161
6250
|
e.currentTarget.style.backgroundColor = "transparent";
|
|
6162
6251
|
}
|
|
6163
6252
|
},
|
|
6164
|
-
/* @__PURE__ */ h
|
|
6253
|
+
/* @__PURE__ */ h(
|
|
6165
6254
|
"div",
|
|
6166
6255
|
{
|
|
6167
6256
|
class: "custom-menu-row-left",
|
|
6168
6257
|
style: { display: "flex", alignItems: "center", gap: "8px" }
|
|
6169
6258
|
},
|
|
6170
|
-
/* @__PURE__ */ h
|
|
6259
|
+
/* @__PURE__ */ h(
|
|
6171
6260
|
"span",
|
|
6172
6261
|
{
|
|
6173
6262
|
style: {
|
|
@@ -6179,7 +6268,7 @@ const Toolbar = defineComponent({
|
|
|
6179
6268
|
innerHTML: iconHtml
|
|
6180
6269
|
}
|
|
6181
6270
|
),
|
|
6182
|
-
/* @__PURE__ */ h
|
|
6271
|
+
/* @__PURE__ */ h(
|
|
6183
6272
|
"span",
|
|
6184
6273
|
{
|
|
6185
6274
|
style: {
|
|
@@ -6190,7 +6279,7 @@ const Toolbar = defineComponent({
|
|
|
6190
6279
|
label
|
|
6191
6280
|
)
|
|
6192
6281
|
),
|
|
6193
|
-
isActive ? /* @__PURE__ */ h
|
|
6282
|
+
isActive ? /* @__PURE__ */ h(
|
|
6194
6283
|
"span",
|
|
6195
6284
|
{
|
|
6196
6285
|
style: {
|
|
@@ -6199,7 +6288,7 @@ const Toolbar = defineComponent({
|
|
|
6199
6288
|
color: "var(--crepe-color-primary)"
|
|
6200
6289
|
}
|
|
6201
6290
|
},
|
|
6202
|
-
/* @__PURE__ */ h
|
|
6291
|
+
/* @__PURE__ */ h(Icon, { icon: confirmIcon })
|
|
6203
6292
|
) : null
|
|
6204
6293
|
);
|
|
6205
6294
|
};
|
|
@@ -6218,16 +6307,14 @@ const Toolbar = defineComponent({
|
|
|
6218
6307
|
});
|
|
6219
6308
|
}
|
|
6220
6309
|
});
|
|
6221
|
-
const nonHeadingGroups = toolbarGroupInfo.value.filter(
|
|
6222
|
-
(group)
|
|
6223
|
-
|
|
6224
|
-
|
|
6225
|
-
|
|
6226
|
-
}
|
|
6227
|
-
);
|
|
6310
|
+
const nonHeadingGroups = toolbarGroupInfo.value.filter((group) => {
|
|
6311
|
+
if (group.key === "heading") return false;
|
|
6312
|
+
if (props.isFixed && group.key === "function") return false;
|
|
6313
|
+
return true;
|
|
6314
|
+
});
|
|
6228
6315
|
const isSectionOverflowed = (idx) => idx >= overflowVisibleCount.value;
|
|
6229
6316
|
const hasOverflow = overflowVisibleCount.value < totalSectionCount.value;
|
|
6230
|
-
return /* @__PURE__ */ h
|
|
6317
|
+
return /* @__PURE__ */ h(
|
|
6231
6318
|
"div",
|
|
6232
6319
|
{
|
|
6233
6320
|
ref: toolbarContainerRef,
|
|
@@ -6238,7 +6325,7 @@ const Toolbar = defineComponent({
|
|
|
6238
6325
|
overflow: "hidden"
|
|
6239
6326
|
}
|
|
6240
6327
|
},
|
|
6241
|
-
/* @__PURE__ */ h
|
|
6328
|
+
/* @__PURE__ */ h(
|
|
6242
6329
|
"div",
|
|
6243
6330
|
{
|
|
6244
6331
|
class: "toolbar-item",
|
|
@@ -6252,22 +6339,22 @@ const Toolbar = defineComponent({
|
|
|
6252
6339
|
flexShrink: 0
|
|
6253
6340
|
}
|
|
6254
6341
|
},
|
|
6255
|
-
/* @__PURE__ */ h
|
|
6342
|
+
/* @__PURE__ */ h(
|
|
6256
6343
|
"span",
|
|
6257
6344
|
{
|
|
6258
6345
|
style: { display: "inline-flex", alignItems: "center" },
|
|
6259
6346
|
innerHTML: activeBlockItem.value || textIcon
|
|
6260
6347
|
}
|
|
6261
6348
|
),
|
|
6262
|
-
/* @__PURE__ */ h
|
|
6349
|
+
/* @__PURE__ */ h(
|
|
6263
6350
|
"span",
|
|
6264
6351
|
{
|
|
6265
6352
|
style: { width: "20px", display: "flex", alignItems: "center" }
|
|
6266
6353
|
},
|
|
6267
|
-
/* @__PURE__ */ h
|
|
6354
|
+
/* @__PURE__ */ h(Icon, { icon: chevronDownIcon })
|
|
6268
6355
|
)
|
|
6269
6356
|
),
|
|
6270
|
-
/* @__PURE__ */ h
|
|
6357
|
+
/* @__PURE__ */ h(
|
|
6271
6358
|
"div",
|
|
6272
6359
|
{
|
|
6273
6360
|
style: {
|
|
@@ -6276,7 +6363,7 @@ const Toolbar = defineComponent({
|
|
|
6276
6363
|
flexShrink: 0
|
|
6277
6364
|
}
|
|
6278
6365
|
},
|
|
6279
|
-
/* @__PURE__ */ h
|
|
6366
|
+
/* @__PURE__ */ h(
|
|
6280
6367
|
"button",
|
|
6281
6368
|
{
|
|
6282
6369
|
type: "button",
|
|
@@ -6297,7 +6384,7 @@ const Toolbar = defineComponent({
|
|
|
6297
6384
|
backgroundColor: formatPainterState.value ? "var(--crepe-color-selected, var(--crepe-color-hover))" : void 0
|
|
6298
6385
|
}
|
|
6299
6386
|
},
|
|
6300
|
-
/* @__PURE__ */ h
|
|
6387
|
+
/* @__PURE__ */ h(
|
|
6301
6388
|
"span",
|
|
6302
6389
|
{
|
|
6303
6390
|
style: {
|
|
@@ -6310,7 +6397,7 @@ const Toolbar = defineComponent({
|
|
|
6310
6397
|
)
|
|
6311
6398
|
)
|
|
6312
6399
|
),
|
|
6313
|
-
/* @__PURE__ */ h
|
|
6400
|
+
/* @__PURE__ */ h(
|
|
6314
6401
|
"div",
|
|
6315
6402
|
{
|
|
6316
6403
|
class: "divider",
|
|
@@ -6322,7 +6409,7 @@ const Toolbar = defineComponent({
|
|
|
6322
6409
|
}
|
|
6323
6410
|
}
|
|
6324
6411
|
),
|
|
6325
|
-
/* @__PURE__ */ h
|
|
6412
|
+
/* @__PURE__ */ h(
|
|
6326
6413
|
"div",
|
|
6327
6414
|
{
|
|
6328
6415
|
class: "toolbar-item custom-font-family-item",
|
|
@@ -6337,7 +6424,7 @@ const Toolbar = defineComponent({
|
|
|
6337
6424
|
flexShrink: 0
|
|
6338
6425
|
}
|
|
6339
6426
|
},
|
|
6340
|
-
/* @__PURE__ */ h
|
|
6427
|
+
/* @__PURE__ */ h(
|
|
6341
6428
|
"span",
|
|
6342
6429
|
{
|
|
6343
6430
|
style: {
|
|
@@ -6351,7 +6438,7 @@ const Toolbar = defineComponent({
|
|
|
6351
6438
|
},
|
|
6352
6439
|
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"
|
|
6353
6440
|
),
|
|
6354
|
-
/* @__PURE__ */ h
|
|
6441
|
+
/* @__PURE__ */ h(
|
|
6355
6442
|
"span",
|
|
6356
6443
|
{
|
|
6357
6444
|
style: {
|
|
@@ -6361,10 +6448,10 @@ const Toolbar = defineComponent({
|
|
|
6361
6448
|
marginLeft: "4px"
|
|
6362
6449
|
}
|
|
6363
6450
|
},
|
|
6364
|
-
/* @__PURE__ */ h
|
|
6451
|
+
/* @__PURE__ */ h(Icon, { icon: chevronDownIcon })
|
|
6365
6452
|
)
|
|
6366
6453
|
),
|
|
6367
|
-
/* @__PURE__ */ h
|
|
6454
|
+
/* @__PURE__ */ h(
|
|
6368
6455
|
"div",
|
|
6369
6456
|
{
|
|
6370
6457
|
class: "toolbar-item custom-font-size-item",
|
|
@@ -6379,8 +6466,8 @@ const Toolbar = defineComponent({
|
|
|
6379
6466
|
flexShrink: 0
|
|
6380
6467
|
}
|
|
6381
6468
|
},
|
|
6382
|
-
/* @__PURE__ */ h
|
|
6383
|
-
/* @__PURE__ */ h
|
|
6469
|
+
/* @__PURE__ */ h("span", { style: { fontSize: "13px", color: "#363B4C" } }, currentFontState.value.fontSize && currentFontState.value.fontSize !== "mixed" ? currentFontState.value.fontSize : "16px"),
|
|
6470
|
+
/* @__PURE__ */ h(
|
|
6384
6471
|
"span",
|
|
6385
6472
|
{
|
|
6386
6473
|
style: {
|
|
@@ -6390,10 +6477,10 @@ const Toolbar = defineComponent({
|
|
|
6390
6477
|
marginLeft: "4px"
|
|
6391
6478
|
}
|
|
6392
6479
|
},
|
|
6393
|
-
/* @__PURE__ */ h
|
|
6480
|
+
/* @__PURE__ */ h(Icon, { icon: chevronDownIcon })
|
|
6394
6481
|
)
|
|
6395
6482
|
),
|
|
6396
|
-
/* @__PURE__ */ h
|
|
6483
|
+
/* @__PURE__ */ h(
|
|
6397
6484
|
"div",
|
|
6398
6485
|
{
|
|
6399
6486
|
class: "divider",
|
|
@@ -6405,7 +6492,7 @@ const Toolbar = defineComponent({
|
|
|
6405
6492
|
}
|
|
6406
6493
|
}
|
|
6407
6494
|
),
|
|
6408
|
-
/* @__PURE__ */ h
|
|
6495
|
+
/* @__PURE__ */ h(
|
|
6409
6496
|
"div",
|
|
6410
6497
|
{
|
|
6411
6498
|
class: "toolbar-item",
|
|
@@ -6419,22 +6506,22 @@ const Toolbar = defineComponent({
|
|
|
6419
6506
|
flexShrink: 0
|
|
6420
6507
|
}
|
|
6421
6508
|
},
|
|
6422
|
-
/* @__PURE__ */ h
|
|
6509
|
+
/* @__PURE__ */ h(
|
|
6423
6510
|
"span",
|
|
6424
6511
|
{
|
|
6425
6512
|
style: { display: "inline-flex", alignItems: "center" },
|
|
6426
6513
|
innerHTML: currentAlignIndent.value.align === "center" ? alignCenterIcon : currentAlignIndent.value.align === "right" ? alignRightIcon : alignLeftIcon
|
|
6427
6514
|
}
|
|
6428
6515
|
),
|
|
6429
|
-
/* @__PURE__ */ h
|
|
6516
|
+
/* @__PURE__ */ h(
|
|
6430
6517
|
"span",
|
|
6431
6518
|
{
|
|
6432
6519
|
style: { width: "20px", display: "flex", alignItems: "center" }
|
|
6433
6520
|
},
|
|
6434
|
-
/* @__PURE__ */ h
|
|
6521
|
+
/* @__PURE__ */ h(Icon, { icon: chevronDownIcon })
|
|
6435
6522
|
)
|
|
6436
6523
|
),
|
|
6437
|
-
/* @__PURE__ */ h
|
|
6524
|
+
/* @__PURE__ */ h(
|
|
6438
6525
|
"div",
|
|
6439
6526
|
{
|
|
6440
6527
|
class: "toolbar-item",
|
|
@@ -6448,7 +6535,7 @@ const Toolbar = defineComponent({
|
|
|
6448
6535
|
flexShrink: 0
|
|
6449
6536
|
}
|
|
6450
6537
|
},
|
|
6451
|
-
/* @__PURE__ */ h
|
|
6538
|
+
/* @__PURE__ */ h(
|
|
6452
6539
|
"span",
|
|
6453
6540
|
{
|
|
6454
6541
|
class: "milkdown-icon",
|
|
@@ -6461,12 +6548,12 @@ const Toolbar = defineComponent({
|
|
|
6461
6548
|
}
|
|
6462
6549
|
}
|
|
6463
6550
|
),
|
|
6464
|
-
/* @__PURE__ */ h
|
|
6551
|
+
/* @__PURE__ */ h(
|
|
6465
6552
|
"span",
|
|
6466
6553
|
{
|
|
6467
6554
|
style: { width: "20px", display: "flex", alignItems: "center" }
|
|
6468
6555
|
},
|
|
6469
|
-
/* @__PURE__ */ h
|
|
6556
|
+
/* @__PURE__ */ h(Icon, { icon: chevronDownIcon })
|
|
6470
6557
|
)
|
|
6471
6558
|
),
|
|
6472
6559
|
(() => {
|
|
@@ -6476,7 +6563,7 @@ const Toolbar = defineComponent({
|
|
|
6476
6563
|
const idx = sectionIdx;
|
|
6477
6564
|
sectionIdx++;
|
|
6478
6565
|
const isTable = item.icon === tableIcon;
|
|
6479
|
-
return /* @__PURE__ */ h
|
|
6566
|
+
return /* @__PURE__ */ h(
|
|
6480
6567
|
"div",
|
|
6481
6568
|
{
|
|
6482
6569
|
key: item.label,
|
|
@@ -6488,7 +6575,7 @@ const Toolbar = defineComponent({
|
|
|
6488
6575
|
onMouseenter: isTable ? handleTableEnter : void 0,
|
|
6489
6576
|
onMouseleave: isTable ? handleTableLeave : void 0
|
|
6490
6577
|
},
|
|
6491
|
-
/* @__PURE__ */ h
|
|
6578
|
+
/* @__PURE__ */ h(
|
|
6492
6579
|
"button",
|
|
6493
6580
|
{
|
|
6494
6581
|
type: "button",
|
|
@@ -6511,14 +6598,14 @@ const Toolbar = defineComponent({
|
|
|
6511
6598
|
justifyContent: "center"
|
|
6512
6599
|
}
|
|
6513
6600
|
},
|
|
6514
|
-
/* @__PURE__ */ h
|
|
6601
|
+
/* @__PURE__ */ h(
|
|
6515
6602
|
"span",
|
|
6516
6603
|
{
|
|
6517
6604
|
style: { display: "inline-flex", alignItems: "center" },
|
|
6518
6605
|
innerHTML: ctx && checkActive(item.active) ? activeIconMap[item.icon] || item.icon : item.icon
|
|
6519
6606
|
}
|
|
6520
6607
|
),
|
|
6521
|
-
isTable ? /* @__PURE__ */ h
|
|
6608
|
+
isTable ? /* @__PURE__ */ h(
|
|
6522
6609
|
"span",
|
|
6523
6610
|
{
|
|
6524
6611
|
style: {
|
|
@@ -6529,7 +6616,7 @@ const Toolbar = defineComponent({
|
|
|
6529
6616
|
opacity: 0.5
|
|
6530
6617
|
}
|
|
6531
6618
|
},
|
|
6532
|
-
/* @__PURE__ */ h
|
|
6619
|
+
/* @__PURE__ */ h(Icon, { icon: chevronDownIcon })
|
|
6533
6620
|
) : null
|
|
6534
6621
|
)
|
|
6535
6622
|
);
|
|
@@ -6538,7 +6625,7 @@ const Toolbar = defineComponent({
|
|
|
6538
6625
|
if (groupIndex < nonHeadingGroups.length - 1 && group.items.length > 0) {
|
|
6539
6626
|
sectionIdx++;
|
|
6540
6627
|
}
|
|
6541
|
-
return /* @__PURE__ */ h
|
|
6628
|
+
return /* @__PURE__ */ h(Fragment, { key: group.key }, items, groupIndex < nonHeadingGroups.length - 1 && group.items.length > 0 ? /* @__PURE__ */ h(
|
|
6542
6629
|
"div",
|
|
6543
6630
|
{
|
|
6544
6631
|
class: "divider",
|
|
@@ -6550,7 +6637,7 @@ const Toolbar = defineComponent({
|
|
|
6550
6637
|
) : null);
|
|
6551
6638
|
});
|
|
6552
6639
|
})(),
|
|
6553
|
-
hasOverflow ? /* @__PURE__ */ h
|
|
6640
|
+
hasOverflow ? /* @__PURE__ */ h(
|
|
6554
6641
|
"div",
|
|
6555
6642
|
{
|
|
6556
6643
|
"data-overflow-button": "true",
|
|
@@ -6577,7 +6664,7 @@ const Toolbar = defineComponent({
|
|
|
6577
6664
|
showOverflowMenu.value = true;
|
|
6578
6665
|
}
|
|
6579
6666
|
},
|
|
6580
|
-
/* @__PURE__ */ h
|
|
6667
|
+
/* @__PURE__ */ h(
|
|
6581
6668
|
"span",
|
|
6582
6669
|
{
|
|
6583
6670
|
style: { display: "inline-flex", alignItems: "center" },
|
|
@@ -6585,7 +6672,7 @@ const Toolbar = defineComponent({
|
|
|
6585
6672
|
}
|
|
6586
6673
|
)
|
|
6587
6674
|
) : null,
|
|
6588
|
-
showBlockMenu.value ? /* @__PURE__ */ h
|
|
6675
|
+
showBlockMenu.value ? /* @__PURE__ */ h(
|
|
6589
6676
|
"div",
|
|
6590
6677
|
{
|
|
6591
6678
|
class: "milkdown-slash-menu custom-submenu",
|
|
@@ -6610,7 +6697,7 @@ const Toolbar = defineComponent({
|
|
|
6610
6697
|
},
|
|
6611
6698
|
onMouseleave: handleBlockLeave
|
|
6612
6699
|
},
|
|
6613
|
-
/* @__PURE__ */ h
|
|
6700
|
+
/* @__PURE__ */ h(
|
|
6614
6701
|
"div",
|
|
6615
6702
|
{
|
|
6616
6703
|
style: {
|
|
@@ -6667,7 +6754,7 @@ const Toolbar = defineComponent({
|
|
|
6667
6754
|
);
|
|
6668
6755
|
})
|
|
6669
6756
|
) : null,
|
|
6670
|
-
showAlignMenu.value ? /* @__PURE__ */ h
|
|
6757
|
+
showAlignMenu.value ? /* @__PURE__ */ h(
|
|
6671
6758
|
"div",
|
|
6672
6759
|
{
|
|
6673
6760
|
class: "milkdown-slash-menu custom-submenu",
|
|
@@ -6690,7 +6777,7 @@ const Toolbar = defineComponent({
|
|
|
6690
6777
|
},
|
|
6691
6778
|
onMouseleave: handleAlignLeave
|
|
6692
6779
|
},
|
|
6693
|
-
/* @__PURE__ */ h
|
|
6780
|
+
/* @__PURE__ */ h(
|
|
6694
6781
|
"div",
|
|
6695
6782
|
{
|
|
6696
6783
|
style: {
|
|
@@ -6721,7 +6808,7 @@ const Toolbar = defineComponent({
|
|
|
6721
6808
|
currentAlignIndent.value.align === "right",
|
|
6722
6809
|
() => setAlign("right")
|
|
6723
6810
|
),
|
|
6724
|
-
/* @__PURE__ */ h
|
|
6811
|
+
/* @__PURE__ */ h(
|
|
6725
6812
|
"div",
|
|
6726
6813
|
{
|
|
6727
6814
|
style: {
|
|
@@ -6743,7 +6830,7 @@ const Toolbar = defineComponent({
|
|
|
6743
6830
|
() => setIndent(-1),
|
|
6744
6831
|
currentAlignIndent.value.indent <= 0
|
|
6745
6832
|
),
|
|
6746
|
-
canMerge.value || canSplit.value ? /* @__PURE__ */ h
|
|
6833
|
+
canMerge.value || canSplit.value ? /* @__PURE__ */ h(Fragment, null, /* @__PURE__ */ h(
|
|
6747
6834
|
"div",
|
|
6748
6835
|
{
|
|
6749
6836
|
style: {
|
|
@@ -6763,7 +6850,7 @@ const Toolbar = defineComponent({
|
|
|
6763
6850
|
onSplitCell
|
|
6764
6851
|
)) : null
|
|
6765
6852
|
) : null,
|
|
6766
|
-
showColorMenu.value ? /* @__PURE__ */ h
|
|
6853
|
+
showColorMenu.value ? /* @__PURE__ */ h(
|
|
6767
6854
|
"div",
|
|
6768
6855
|
{
|
|
6769
6856
|
class: "milkdown-slash-menu custom-submenu",
|
|
@@ -6787,7 +6874,7 @@ const Toolbar = defineComponent({
|
|
|
6787
6874
|
},
|
|
6788
6875
|
onMouseleave: handleColorLeave
|
|
6789
6876
|
},
|
|
6790
|
-
/* @__PURE__ */ h
|
|
6877
|
+
/* @__PURE__ */ h(
|
|
6791
6878
|
"div",
|
|
6792
6879
|
{
|
|
6793
6880
|
style: {
|
|
@@ -6800,7 +6887,7 @@ const Toolbar = defineComponent({
|
|
|
6800
6887
|
}
|
|
6801
6888
|
}
|
|
6802
6889
|
),
|
|
6803
|
-
/* @__PURE__ */ h
|
|
6890
|
+
/* @__PURE__ */ h(
|
|
6804
6891
|
"div",
|
|
6805
6892
|
{
|
|
6806
6893
|
style: {
|
|
@@ -6811,7 +6898,7 @@ const Toolbar = defineComponent({
|
|
|
6811
6898
|
},
|
|
6812
6899
|
ctx ? i18n(ctx, "customMenu.textColor") : "\u5B57\u4F53\u989C\u8272"
|
|
6813
6900
|
),
|
|
6814
|
-
/* @__PURE__ */ h
|
|
6901
|
+
/* @__PURE__ */ h("div", { style: { display: "flex", gap: "4px", flexWrap: "wrap" } }, [
|
|
6815
6902
|
"#000000",
|
|
6816
6903
|
"#8C8C8C",
|
|
6817
6904
|
"#F5222D",
|
|
@@ -6820,7 +6907,7 @@ const Toolbar = defineComponent({
|
|
|
6820
6907
|
"#52C41A",
|
|
6821
6908
|
"#1677FF",
|
|
6822
6909
|
"#722ED1"
|
|
6823
|
-
].map((color) => /* @__PURE__ */ h
|
|
6910
|
+
].map((color) => /* @__PURE__ */ h(
|
|
6824
6911
|
"div",
|
|
6825
6912
|
{
|
|
6826
6913
|
key: color,
|
|
@@ -6843,7 +6930,7 @@ const Toolbar = defineComponent({
|
|
|
6843
6930
|
},
|
|
6844
6931
|
"A"
|
|
6845
6932
|
))),
|
|
6846
|
-
/* @__PURE__ */ h
|
|
6933
|
+
/* @__PURE__ */ h(
|
|
6847
6934
|
"div",
|
|
6848
6935
|
{
|
|
6849
6936
|
style: {
|
|
@@ -6855,7 +6942,7 @@ const Toolbar = defineComponent({
|
|
|
6855
6942
|
},
|
|
6856
6943
|
ctx ? i18n(ctx, "customMenu.bgColor") : "\u80CC\u666F\u989C\u8272"
|
|
6857
6944
|
),
|
|
6858
|
-
/* @__PURE__ */ h
|
|
6945
|
+
/* @__PURE__ */ h("div", { style: { display: "flex", gap: "4px", flexWrap: "wrap" } }, [
|
|
6859
6946
|
"transparent",
|
|
6860
6947
|
"#F5F5F5",
|
|
6861
6948
|
"#FFCCC7",
|
|
@@ -6864,7 +6951,7 @@ const Toolbar = defineComponent({
|
|
|
6864
6951
|
"#D9F7BE",
|
|
6865
6952
|
"#D6E4FF",
|
|
6866
6953
|
"#EFDBFF"
|
|
6867
|
-
].map((color) => /* @__PURE__ */ h
|
|
6954
|
+
].map((color) => /* @__PURE__ */ h(
|
|
6868
6955
|
"div",
|
|
6869
6956
|
{
|
|
6870
6957
|
key: color,
|
|
@@ -6881,7 +6968,7 @@ const Toolbar = defineComponent({
|
|
|
6881
6968
|
overflow: "hidden"
|
|
6882
6969
|
}
|
|
6883
6970
|
},
|
|
6884
|
-
color === "transparent" ? /* @__PURE__ */ h
|
|
6971
|
+
color === "transparent" ? /* @__PURE__ */ h(
|
|
6885
6972
|
"div",
|
|
6886
6973
|
{
|
|
6887
6974
|
style: {
|
|
@@ -6905,7 +6992,7 @@ const Toolbar = defineComponent({
|
|
|
6905
6992
|
"#52C41A",
|
|
6906
6993
|
"#1677FF",
|
|
6907
6994
|
"#722ED1"
|
|
6908
|
-
].map((color) => /* @__PURE__ */ h
|
|
6995
|
+
].map((color) => /* @__PURE__ */ h(
|
|
6909
6996
|
"div",
|
|
6910
6997
|
{
|
|
6911
6998
|
key: color,
|
|
@@ -6921,7 +7008,7 @@ const Toolbar = defineComponent({
|
|
|
6921
7008
|
}
|
|
6922
7009
|
}
|
|
6923
7010
|
))),
|
|
6924
|
-
/* @__PURE__ */ h
|
|
7011
|
+
/* @__PURE__ */ h(
|
|
6925
7012
|
"button",
|
|
6926
7013
|
{
|
|
6927
7014
|
onClick: clearColor,
|
|
@@ -6940,7 +7027,7 @@ const Toolbar = defineComponent({
|
|
|
6940
7027
|
ctx ? i18n(ctx, "customMenu.restoreDefault") : "\u6062\u590D\u9ED8\u8BA4"
|
|
6941
7028
|
)
|
|
6942
7029
|
) : null,
|
|
6943
|
-
showFontFamilyMenu.value ? /* @__PURE__ */ h
|
|
7030
|
+
showFontFamilyMenu.value ? /* @__PURE__ */ h(
|
|
6944
7031
|
"div",
|
|
6945
7032
|
{
|
|
6946
7033
|
class: "milkdown-slash-menu custom-submenu",
|
|
@@ -6965,7 +7052,7 @@ const Toolbar = defineComponent({
|
|
|
6965
7052
|
},
|
|
6966
7053
|
onMouseleave: handleFontFamilyLeave
|
|
6967
7054
|
},
|
|
6968
|
-
/* @__PURE__ */ h
|
|
7055
|
+
/* @__PURE__ */ h(
|
|
6969
7056
|
"div",
|
|
6970
7057
|
{
|
|
6971
7058
|
style: {
|
|
@@ -7026,7 +7113,7 @@ const Toolbar = defineComponent({
|
|
|
7026
7113
|
}
|
|
7027
7114
|
].map((font) => {
|
|
7028
7115
|
const supported = isFontSupported(font.value);
|
|
7029
|
-
return /* @__PURE__ */ h
|
|
7116
|
+
return /* @__PURE__ */ h(
|
|
7030
7117
|
"div",
|
|
7031
7118
|
{
|
|
7032
7119
|
key: font.label,
|
|
@@ -7063,7 +7150,7 @@ const Toolbar = defineComponent({
|
|
|
7063
7150
|
e.currentTarget.style.backgroundColor = "transparent";
|
|
7064
7151
|
}
|
|
7065
7152
|
},
|
|
7066
|
-
/* @__PURE__ */ h
|
|
7153
|
+
/* @__PURE__ */ h(
|
|
7067
7154
|
"span",
|
|
7068
7155
|
{
|
|
7069
7156
|
style: {
|
|
@@ -7073,7 +7160,7 @@ const Toolbar = defineComponent({
|
|
|
7073
7160
|
},
|
|
7074
7161
|
font.label
|
|
7075
7162
|
),
|
|
7076
|
-
currentFontState.value.fontFamily === font.value ? /* @__PURE__ */ h
|
|
7163
|
+
currentFontState.value.fontFamily === font.value ? /* @__PURE__ */ h(
|
|
7077
7164
|
"span",
|
|
7078
7165
|
{
|
|
7079
7166
|
style: {
|
|
@@ -7082,12 +7169,12 @@ const Toolbar = defineComponent({
|
|
|
7082
7169
|
color: "var(--crepe-color-primary)"
|
|
7083
7170
|
}
|
|
7084
7171
|
},
|
|
7085
|
-
/* @__PURE__ */ h
|
|
7172
|
+
/* @__PURE__ */ h(Icon, { icon: confirmIcon })
|
|
7086
7173
|
) : null
|
|
7087
7174
|
);
|
|
7088
7175
|
})
|
|
7089
7176
|
) : null,
|
|
7090
|
-
showFontSizeMenu.value ? /* @__PURE__ */ h
|
|
7177
|
+
showFontSizeMenu.value ? /* @__PURE__ */ h(
|
|
7091
7178
|
"div",
|
|
7092
7179
|
{
|
|
7093
7180
|
class: "milkdown-slash-menu custom-submenu",
|
|
@@ -7112,7 +7199,7 @@ const Toolbar = defineComponent({
|
|
|
7112
7199
|
},
|
|
7113
7200
|
onMouseleave: handleFontSizeLeave
|
|
7114
7201
|
},
|
|
7115
|
-
/* @__PURE__ */ h
|
|
7202
|
+
/* @__PURE__ */ h(
|
|
7116
7203
|
"div",
|
|
7117
7204
|
{
|
|
7118
7205
|
style: {
|
|
@@ -7137,7 +7224,7 @@ const Toolbar = defineComponent({
|
|
|
7137
7224
|
{ label: "28px", value: "28px" },
|
|
7138
7225
|
{ label: "32px", value: "32px" },
|
|
7139
7226
|
{ label: "36px", value: "36px" }
|
|
7140
|
-
].map((size) => /* @__PURE__ */ h
|
|
7227
|
+
].map((size) => /* @__PURE__ */ h(
|
|
7141
7228
|
"div",
|
|
7142
7229
|
{
|
|
7143
7230
|
key: size.label,
|
|
@@ -7168,7 +7255,7 @@ const Toolbar = defineComponent({
|
|
|
7168
7255
|
e.currentTarget.style.backgroundColor = "transparent";
|
|
7169
7256
|
}
|
|
7170
7257
|
},
|
|
7171
|
-
/* @__PURE__ */ h
|
|
7258
|
+
/* @__PURE__ */ h(
|
|
7172
7259
|
"span",
|
|
7173
7260
|
{
|
|
7174
7261
|
style: {
|
|
@@ -7178,7 +7265,7 @@ const Toolbar = defineComponent({
|
|
|
7178
7265
|
},
|
|
7179
7266
|
size.label
|
|
7180
7267
|
),
|
|
7181
|
-
currentFontState.value.fontSize === size.value ? /* @__PURE__ */ h
|
|
7268
|
+
currentFontState.value.fontSize === size.value ? /* @__PURE__ */ h(
|
|
7182
7269
|
"span",
|
|
7183
7270
|
{
|
|
7184
7271
|
style: {
|
|
@@ -7187,11 +7274,11 @@ const Toolbar = defineComponent({
|
|
|
7187
7274
|
color: "var(--crepe-color-primary)"
|
|
7188
7275
|
}
|
|
7189
7276
|
},
|
|
7190
|
-
/* @__PURE__ */ h
|
|
7277
|
+
/* @__PURE__ */ h(Icon, { icon: confirmIcon })
|
|
7191
7278
|
) : null
|
|
7192
7279
|
))
|
|
7193
7280
|
) : null,
|
|
7194
|
-
showTableMenu.value ? /* @__PURE__ */ h
|
|
7281
|
+
showTableMenu.value ? /* @__PURE__ */ h(
|
|
7195
7282
|
"div",
|
|
7196
7283
|
{
|
|
7197
7284
|
class: "milkdown-slash-menu custom-submenu",
|
|
@@ -7214,7 +7301,7 @@ const Toolbar = defineComponent({
|
|
|
7214
7301
|
},
|
|
7215
7302
|
onMouseleave: handleTableLeave
|
|
7216
7303
|
},
|
|
7217
|
-
/* @__PURE__ */ h
|
|
7304
|
+
/* @__PURE__ */ h(
|
|
7218
7305
|
"div",
|
|
7219
7306
|
{
|
|
7220
7307
|
style: {
|
|
@@ -7227,7 +7314,7 @@ const Toolbar = defineComponent({
|
|
|
7227
7314
|
}
|
|
7228
7315
|
}
|
|
7229
7316
|
),
|
|
7230
|
-
/* @__PURE__ */ h
|
|
7317
|
+
/* @__PURE__ */ h(
|
|
7231
7318
|
"div",
|
|
7232
7319
|
{
|
|
7233
7320
|
style: {
|
|
@@ -7239,7 +7326,7 @@ const Toolbar = defineComponent({
|
|
|
7239
7326
|
},
|
|
7240
7327
|
i18n(ctx, "customMenu.insertTable")
|
|
7241
7328
|
),
|
|
7242
|
-
/* @__PURE__ */ h
|
|
7329
|
+
/* @__PURE__ */ h(
|
|
7243
7330
|
"div",
|
|
7244
7331
|
{
|
|
7245
7332
|
style: {
|
|
@@ -7252,7 +7339,7 @@ const Toolbar = defineComponent({
|
|
|
7252
7339
|
Array.from({ length: 9 }).map(
|
|
7253
7340
|
(_, r) => Array.from({ length: 9 }).map((_2, c) => {
|
|
7254
7341
|
const isHovered = r < tableHoverIndices.value.r && c < tableHoverIndices.value.c;
|
|
7255
|
-
return /* @__PURE__ */ h
|
|
7342
|
+
return /* @__PURE__ */ h(
|
|
7256
7343
|
"div",
|
|
7257
7344
|
{
|
|
7258
7345
|
key: `cell-${r}-${c}`,
|
|
@@ -7281,7 +7368,7 @@ const Toolbar = defineComponent({
|
|
|
7281
7368
|
})
|
|
7282
7369
|
)
|
|
7283
7370
|
),
|
|
7284
|
-
tableHoverIndices.value.r > 0 ? /* @__PURE__ */ h
|
|
7371
|
+
tableHoverIndices.value.r > 0 ? /* @__PURE__ */ h(
|
|
7285
7372
|
"div",
|
|
7286
7373
|
{
|
|
7287
7374
|
style: {
|
|
@@ -7294,7 +7381,7 @@ const Toolbar = defineComponent({
|
|
|
7294
7381
|
tableHoverIndices.value.r,
|
|
7295
7382
|
" x ",
|
|
7296
7383
|
tableHoverIndices.value.c
|
|
7297
|
-
) : /* @__PURE__ */ h
|
|
7384
|
+
) : /* @__PURE__ */ h(
|
|
7298
7385
|
"div",
|
|
7299
7386
|
{
|
|
7300
7387
|
style: {
|
|
@@ -7307,7 +7394,7 @@ const Toolbar = defineComponent({
|
|
|
7307
7394
|
"0 x 0"
|
|
7308
7395
|
)
|
|
7309
7396
|
) : null,
|
|
7310
|
-
showOverflowMenu.value ? /* @__PURE__ */ h
|
|
7397
|
+
showOverflowMenu.value ? /* @__PURE__ */ h(
|
|
7311
7398
|
"div",
|
|
7312
7399
|
{
|
|
7313
7400
|
class: "overflow-menu-popup",
|
|
@@ -7332,7 +7419,7 @@ const Toolbar = defineComponent({
|
|
|
7332
7419
|
(() => {
|
|
7333
7420
|
const cutoff = overflowVisibleCount.value;
|
|
7334
7421
|
const items = [];
|
|
7335
|
-
const renderIconButton = (iconHtml, title, isActive, onClick2, hasDropdown = false, onMouseEnter, onMouseLeave) => /* @__PURE__ */ h
|
|
7422
|
+
const renderIconButton = (iconHtml, title, isActive, onClick2, hasDropdown = false, onMouseEnter, onMouseLeave) => /* @__PURE__ */ h(
|
|
7336
7423
|
"button",
|
|
7337
7424
|
{
|
|
7338
7425
|
type: "button",
|
|
@@ -7355,14 +7442,14 @@ const Toolbar = defineComponent({
|
|
|
7355
7442
|
justifyContent: "center"
|
|
7356
7443
|
}
|
|
7357
7444
|
},
|
|
7358
|
-
/* @__PURE__ */ h
|
|
7445
|
+
/* @__PURE__ */ h(
|
|
7359
7446
|
"span",
|
|
7360
7447
|
{
|
|
7361
7448
|
style: { display: "inline-flex", alignItems: "center" },
|
|
7362
7449
|
innerHTML: iconHtml
|
|
7363
7450
|
}
|
|
7364
7451
|
),
|
|
7365
|
-
hasDropdown ? /* @__PURE__ */ h
|
|
7452
|
+
hasDropdown ? /* @__PURE__ */ h(
|
|
7366
7453
|
"span",
|
|
7367
7454
|
{
|
|
7368
7455
|
style: {
|
|
@@ -7372,7 +7459,7 @@ const Toolbar = defineComponent({
|
|
|
7372
7459
|
opacity: 0.5
|
|
7373
7460
|
}
|
|
7374
7461
|
},
|
|
7375
|
-
/* @__PURE__ */ h
|
|
7462
|
+
/* @__PURE__ */ h(Icon, { icon: chevronDownIcon })
|
|
7376
7463
|
) : null
|
|
7377
7464
|
);
|
|
7378
7465
|
if (0 >= cutoff) {
|
|
@@ -7520,7 +7607,7 @@ const createViewMenuState = () => reactive({
|
|
|
7520
7607
|
outlineVisible: false,
|
|
7521
7608
|
outlinePosition: "left",
|
|
7522
7609
|
outlineWidth: 250,
|
|
7523
|
-
documentBackground:
|
|
7610
|
+
documentBackground: "#FFFFFF",
|
|
7524
7611
|
showTitle: false,
|
|
7525
7612
|
showCover: false,
|
|
7526
7613
|
coverUrl: "",
|
|
@@ -7620,10 +7707,15 @@ const MenuBar = defineComponent({
|
|
|
7620
7707
|
onUnmounted(() => {
|
|
7621
7708
|
document.removeEventListener("click", closeMenu);
|
|
7622
7709
|
if (rafId) cancelAnimationFrame(rafId);
|
|
7710
|
+
if (showMenu.value) decrementPopupCount();
|
|
7711
|
+
});
|
|
7712
|
+
watch(showMenu, (val) => {
|
|
7713
|
+
if (val) incrementPopupCount();
|
|
7714
|
+
else decrementPopupCount();
|
|
7623
7715
|
});
|
|
7624
7716
|
const viewState = computed(() => props.ctx.get(viewMenuStateCtx.key));
|
|
7625
7717
|
const bgColors = [
|
|
7626
|
-
{ name: "\
|
|
7718
|
+
{ name: "\u767D\u8272", value: "#FFFFFF" },
|
|
7627
7719
|
{ name: "\u6D45\u7070", value: "#F7F7F5" },
|
|
7628
7720
|
{ name: "\u6D45\u68D5", value: "#F4EEDB" },
|
|
7629
7721
|
{ name: "\u6D45\u6A59", value: "#FBECDD" },
|
|
@@ -8111,7 +8203,7 @@ const rightGroups = [
|
|
|
8111
8203
|
titleKey: "shortcuts.history",
|
|
8112
8204
|
items: [
|
|
8113
8205
|
{ labelKey: "shortcuts.undo", keys: ["Mod+z"] },
|
|
8114
|
-
{ labelKey: "shortcuts.redo", keys: ["Mod+y", "Shift+Mod+
|
|
8206
|
+
{ labelKey: "shortcuts.redo", keys: ["Mod+y", "Shift+Mod+Z"] }
|
|
8115
8207
|
]
|
|
8116
8208
|
}
|
|
8117
8209
|
];
|
|
@@ -8152,7 +8244,7 @@ const labelStyle = {
|
|
|
8152
8244
|
color: "var(--crepe-color-on-surface, #333)"
|
|
8153
8245
|
};
|
|
8154
8246
|
function renderGroup(ctx, group) {
|
|
8155
|
-
return /* @__PURE__ */ h
|
|
8247
|
+
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))))))));
|
|
8156
8248
|
}
|
|
8157
8249
|
const ShortcutHelpModal = defineComponent({
|
|
8158
8250
|
props: {
|
|
@@ -8168,7 +8260,7 @@ const ShortcutHelpModal = defineComponent({
|
|
|
8168
8260
|
};
|
|
8169
8261
|
onMounted(() => document.addEventListener("keydown", onKeydown));
|
|
8170
8262
|
onBeforeUnmount(() => document.removeEventListener("keydown", onKeydown));
|
|
8171
|
-
return () => /* @__PURE__ */ h
|
|
8263
|
+
return () => /* @__PURE__ */ h(
|
|
8172
8264
|
"div",
|
|
8173
8265
|
{
|
|
8174
8266
|
style: {
|
|
@@ -8182,7 +8274,7 @@ const ShortcutHelpModal = defineComponent({
|
|
|
8182
8274
|
},
|
|
8183
8275
|
onClick: close
|
|
8184
8276
|
},
|
|
8185
|
-
/* @__PURE__ */ h
|
|
8277
|
+
/* @__PURE__ */ h(
|
|
8186
8278
|
"div",
|
|
8187
8279
|
{
|
|
8188
8280
|
style: {
|
|
@@ -8196,7 +8288,7 @@ const ShortcutHelpModal = defineComponent({
|
|
|
8196
8288
|
},
|
|
8197
8289
|
onClick: (e) => e.stopPropagation()
|
|
8198
8290
|
},
|
|
8199
|
-
/* @__PURE__ */ h
|
|
8291
|
+
/* @__PURE__ */ h(
|
|
8200
8292
|
"div",
|
|
8201
8293
|
{
|
|
8202
8294
|
style: {
|
|
@@ -8208,7 +8300,7 @@ const ShortcutHelpModal = defineComponent({
|
|
|
8208
8300
|
borderBottom: "1px solid var(--crepe-color-outline-variant, color-mix(in srgb, var(--crepe-color-outline), transparent 80%))"
|
|
8209
8301
|
}
|
|
8210
8302
|
},
|
|
8211
|
-
/* @__PURE__ */ h
|
|
8303
|
+
/* @__PURE__ */ h(
|
|
8212
8304
|
"span",
|
|
8213
8305
|
{
|
|
8214
8306
|
style: {
|
|
@@ -8219,7 +8311,7 @@ const ShortcutHelpModal = defineComponent({
|
|
|
8219
8311
|
},
|
|
8220
8312
|
i18n(props.ctx, "shortcuts.title")
|
|
8221
8313
|
),
|
|
8222
|
-
/* @__PURE__ */ h
|
|
8314
|
+
/* @__PURE__ */ h(
|
|
8223
8315
|
"button",
|
|
8224
8316
|
{
|
|
8225
8317
|
type: "button",
|
|
@@ -8237,10 +8329,10 @@ const ShortcutHelpModal = defineComponent({
|
|
|
8237
8329
|
color: "var(--crepe-color-on-surface-variant, #666)"
|
|
8238
8330
|
}
|
|
8239
8331
|
},
|
|
8240
|
-
/* @__PURE__ */ h
|
|
8332
|
+
/* @__PURE__ */ h(Icon, { icon: closeIcon })
|
|
8241
8333
|
)
|
|
8242
8334
|
),
|
|
8243
|
-
/* @__PURE__ */ h
|
|
8335
|
+
/* @__PURE__ */ h("div", { style: { display: "flex", gap: "24px" } }, /* @__PURE__ */ h("div", { style: columnStyle }, leftGroups.map((g) => renderGroup(props.ctx, g))), /* @__PURE__ */ h(
|
|
8244
8336
|
"div",
|
|
8245
8337
|
{
|
|
8246
8338
|
style: {
|
|
@@ -8249,7 +8341,7 @@ const ShortcutHelpModal = defineComponent({
|
|
|
8249
8341
|
backgroundColor: "var(--crepe-color-outline-variant, color-mix(in srgb, var(--crepe-color-outline), transparent 80%))"
|
|
8250
8342
|
}
|
|
8251
8343
|
}
|
|
8252
|
-
), /* @__PURE__ */ h
|
|
8344
|
+
), /* @__PURE__ */ h("div", { style: columnStyle }, rightGroups.map((g) => renderGroup(props.ctx, g))))
|
|
8253
8345
|
)
|
|
8254
8346
|
);
|
|
8255
8347
|
}
|
|
@@ -8753,6 +8845,7 @@ function buildDefaultFixedToolbar(builder, _config, ctx) {
|
|
|
8753
8845
|
return builder.build();
|
|
8754
8846
|
}
|
|
8755
8847
|
|
|
8848
|
+
keepAlive(h);
|
|
8756
8849
|
const DocumentHeader = defineComponent({
|
|
8757
8850
|
props: {
|
|
8758
8851
|
ctx: { type: Object, required: true },
|
|
@@ -9438,7 +9531,7 @@ var __accessCheck$3 = (obj, member, msg) => member.has(obj) || __typeError$3("Ca
|
|
|
9438
9531
|
var __privateGet$3 = (obj, member, getter) => (__accessCheck$3(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
|
|
9439
9532
|
var __privateAdd$3 = (obj, member, value) => member.has(obj) ? __typeError$3("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
|
9440
9533
|
var __privateSet$3 = (obj, member, value, setter) => (__accessCheck$3(obj, member, "write to private field"), member.set(obj, value), value);
|
|
9441
|
-
var _content$2, _app$2, _headerContent, _headerApp, _outlineContent, _outlineApp, _watcher, _selection$1, _show$1, _resizeObserver, _updateOutlineGeometry, _scrollContainers, _view;
|
|
9534
|
+
var _content$2, _app$2, _headerContent, _headerApp, _outlineContent, _outlineApp, _watcher, _selection$1, _show$1, _resizeObserver, _updateOutlineGeometry, _scrollContainers, _onDblClick, _view;
|
|
9442
9535
|
const fixedToolbarConfig = $ctx(
|
|
9443
9536
|
{},
|
|
9444
9537
|
"fixedToolbarConfigCtx"
|
|
@@ -9458,12 +9551,16 @@ class FixedToolbarView {
|
|
|
9458
9551
|
__privateAdd$3(this, _resizeObserver);
|
|
9459
9552
|
__privateAdd$3(this, _updateOutlineGeometry);
|
|
9460
9553
|
__privateAdd$3(this, _scrollContainers, []);
|
|
9554
|
+
__privateAdd$3(this, _onDblClick);
|
|
9461
9555
|
__privateAdd$3(this, _view);
|
|
9462
9556
|
this.update = (view) => {
|
|
9463
9557
|
__privateGet$3(this, _selection$1).value = view.state.selection;
|
|
9464
9558
|
};
|
|
9465
9559
|
this.destroy = () => {
|
|
9466
9560
|
if (__privateGet$3(this, _watcher)) __privateGet$3(this, _watcher).call(this);
|
|
9561
|
+
if (__privateGet$3(this, _onDblClick)) {
|
|
9562
|
+
__privateGet$3(this, _view).dom.removeEventListener("dblclick", __privateGet$3(this, _onDblClick));
|
|
9563
|
+
}
|
|
9467
9564
|
if (__privateGet$3(this, _resizeObserver)) __privateGet$3(this, _resizeObserver).disconnect();
|
|
9468
9565
|
window.removeEventListener("resize", __privateGet$3(this, _updateOutlineGeometry));
|
|
9469
9566
|
window.removeEventListener("scroll", __privateGet$3(this, _updateOutlineGeometry), {
|
|
@@ -9514,6 +9611,31 @@ class FixedToolbarView {
|
|
|
9514
9611
|
__privateGet$3(this, _outlineApp).mount(outlineContent);
|
|
9515
9612
|
__privateSet$3(this, _outlineContent, outlineContent);
|
|
9516
9613
|
root.appendChild(outlineContent);
|
|
9614
|
+
__privateSet$3(this, _onDblClick, (event) => {
|
|
9615
|
+
const view2 = __privateGet$3(this, _view);
|
|
9616
|
+
if (!view2.editable) return;
|
|
9617
|
+
const dom = view2.dom;
|
|
9618
|
+
const children = dom.children;
|
|
9619
|
+
if (children.length === 0) return;
|
|
9620
|
+
const lastChild = children[children.length - 1];
|
|
9621
|
+
if (!lastChild) return;
|
|
9622
|
+
const lastRect = lastChild.getBoundingClientRect();
|
|
9623
|
+
if (event.clientY <= lastRect.bottom) return;
|
|
9624
|
+
const { doc } = view2.state;
|
|
9625
|
+
const lastNode = doc.lastChild;
|
|
9626
|
+
if (!lastNode) return;
|
|
9627
|
+
if (lastNode.type.name === "paragraph" && lastNode.content.size === 0)
|
|
9628
|
+
return;
|
|
9629
|
+
const paragraphType = view2.state.schema.nodes["paragraph"];
|
|
9630
|
+
if (!paragraphType) return;
|
|
9631
|
+
const pos = doc.content.size;
|
|
9632
|
+
const tr = view2.state.tr.insert(pos, paragraphType.create());
|
|
9633
|
+
const sel = TextSelection.create(tr.doc, pos + 1);
|
|
9634
|
+
tr.setSelection(sel);
|
|
9635
|
+
view2.dispatch(tr);
|
|
9636
|
+
view2.focus();
|
|
9637
|
+
});
|
|
9638
|
+
view.dom.addEventListener("dblclick", __privateGet$3(this, _onDblClick));
|
|
9517
9639
|
__privateGet$3(this, _content$2).style.transition = "margin 0.1s ease-out, width 0.1s ease-out";
|
|
9518
9640
|
const viewState = ctx.get(viewMenuStateCtx.key);
|
|
9519
9641
|
if (config.outlinePosition) {
|
|
@@ -9612,7 +9734,7 @@ class FixedToolbarView {
|
|
|
9612
9734
|
__privateGet$3(this, _view).dom.style.maxWidth = maxWidth;
|
|
9613
9735
|
__privateGet$3(this, _view).dom.style.width = isFull ? "100%" : maxWidth;
|
|
9614
9736
|
__privateGet$3(this, _view).dom.style.margin = isFull ? "0" : "0 auto";
|
|
9615
|
-
__privateGet$3(this, _view).dom.style.padding = `20px ${px}
|
|
9737
|
+
__privateGet$3(this, _view).dom.style.padding = `20px ${px} 36px`;
|
|
9616
9738
|
if (__privateGet$3(this, _headerContent)) {
|
|
9617
9739
|
__privateGet$3(this, _headerContent).style.margin = isFull && !viewState.showCover ? "0 auto" : "0";
|
|
9618
9740
|
__privateGet$3(this, _headerContent).style.padding = `0px`;
|
|
@@ -9639,6 +9761,7 @@ _show$1 = new WeakMap();
|
|
|
9639
9761
|
_resizeObserver = new WeakMap();
|
|
9640
9762
|
_updateOutlineGeometry = new WeakMap();
|
|
9641
9763
|
_scrollContainers = new WeakMap();
|
|
9764
|
+
_onDblClick = new WeakMap();
|
|
9642
9765
|
_view = new WeakMap();
|
|
9643
9766
|
const fixedToolbarPlugin = $prose((ctx) => {
|
|
9644
9767
|
return new Plugin({
|
|
@@ -9760,7 +9883,7 @@ const imageBlockConverter = $prose$1((ctx) => {
|
|
|
9760
9883
|
const r = replacements[i];
|
|
9761
9884
|
tr.replaceWith(r.from, r.to, r.blocks);
|
|
9762
9885
|
}
|
|
9763
|
-
return tr;
|
|
9886
|
+
return tr.setMeta("addToHistory", false);
|
|
9764
9887
|
}
|
|
9765
9888
|
});
|
|
9766
9889
|
});
|
|
@@ -9792,7 +9915,7 @@ const blockLatexSchema = codeBlockSchema.extendSchema((prev) => {
|
|
|
9792
9915
|
|
|
9793
9916
|
const inlineLatexTooltip = tooltipFactory("INLINE_LATEX");
|
|
9794
9917
|
|
|
9795
|
-
keepAlive(h
|
|
9918
|
+
keepAlive(h);
|
|
9796
9919
|
const LatexTooltip = defineComponent({
|
|
9797
9920
|
props: {
|
|
9798
9921
|
ctx: {
|
|
@@ -9828,7 +9951,7 @@ const LatexTooltip = defineComponent({
|
|
|
9828
9951
|
}
|
|
9829
9952
|
};
|
|
9830
9953
|
return () => {
|
|
9831
|
-
return /* @__PURE__ */ h
|
|
9954
|
+
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(
|
|
9832
9955
|
"a",
|
|
9833
9956
|
{
|
|
9834
9957
|
class: "right",
|
|
@@ -9836,7 +9959,7 @@ const LatexTooltip = defineComponent({
|
|
|
9836
9959
|
target: "_blank",
|
|
9837
9960
|
style: "display: none;"
|
|
9838
9961
|
},
|
|
9839
|
-
/* @__PURE__ */ h
|
|
9962
|
+
/* @__PURE__ */ h(Icon, { icon: helpIcon }),
|
|
9840
9963
|
" ",
|
|
9841
9964
|
i18n(props.ctx, "latex.helpDoc")
|
|
9842
9965
|
)));
|
|
@@ -10241,7 +10364,7 @@ var __accessCheck$1 = (obj, member, msg) => member.has(obj) || __typeError$1("Ca
|
|
|
10241
10364
|
var __privateGet$1 = (obj, member, getter) => (__accessCheck$1(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
|
|
10242
10365
|
var __privateAdd$1 = (obj, member, value) => member.has(obj) ? __typeError$1("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
|
10243
10366
|
var __privateSet$1 = (obj, member, value, setter) => (__accessCheck$1(obj, member, "write to private field"), member.set(obj, value), value);
|
|
10244
|
-
var _tooltipProvider, _content, _app, _selection, _show, _mousePressed;
|
|
10367
|
+
var _tooltipProvider, _content, _app, _selection, _show, _mousePressed, _removePopupListener, _onDocumentMouseUp;
|
|
10245
10368
|
const toolbarTooltip = tooltipFactory("CREPE_TOOLBAR");
|
|
10246
10369
|
class ToolbarView {
|
|
10247
10370
|
constructor(ctx, view, config) {
|
|
@@ -10251,11 +10374,18 @@ class ToolbarView {
|
|
|
10251
10374
|
__privateAdd$1(this, _selection);
|
|
10252
10375
|
__privateAdd$1(this, _show, ref(false));
|
|
10253
10376
|
__privateAdd$1(this, _mousePressed, false);
|
|
10377
|
+
__privateAdd$1(this, _removePopupListener);
|
|
10378
|
+
__privateAdd$1(this, _onDocumentMouseUp);
|
|
10254
10379
|
this.update = (view, prevState) => {
|
|
10255
10380
|
__privateGet$1(this, _tooltipProvider).update(view, prevState);
|
|
10256
10381
|
__privateGet$1(this, _selection).value = view.state.selection;
|
|
10257
10382
|
};
|
|
10258
10383
|
this.destroy = () => {
|
|
10384
|
+
var _a;
|
|
10385
|
+
(_a = __privateGet$1(this, _removePopupListener)) == null ? void 0 : _a.call(this);
|
|
10386
|
+
if (__privateGet$1(this, _onDocumentMouseUp)) {
|
|
10387
|
+
document.removeEventListener("mouseup", __privateGet$1(this, _onDocumentMouseUp));
|
|
10388
|
+
}
|
|
10259
10389
|
__privateGet$1(this, _tooltipProvider).destroy();
|
|
10260
10390
|
__privateGet$1(this, _app).unmount();
|
|
10261
10391
|
__privateGet$1(this, _content).remove();
|
|
@@ -10285,12 +10415,23 @@ class ToolbarView {
|
|
|
10285
10415
|
this.update(view);
|
|
10286
10416
|
}, 0);
|
|
10287
10417
|
});
|
|
10418
|
+
const onDocumentMouseUp = () => {
|
|
10419
|
+
if (__privateGet$1(this, _mousePressed)) {
|
|
10420
|
+
__privateSet$1(this, _mousePressed, false);
|
|
10421
|
+
setTimeout(() => {
|
|
10422
|
+
this.update(view);
|
|
10423
|
+
}, 0);
|
|
10424
|
+
}
|
|
10425
|
+
};
|
|
10426
|
+
document.addEventListener("mouseup", onDocumentMouseUp);
|
|
10427
|
+
__privateSet$1(this, _onDocumentMouseUp, onDocumentMouseUp);
|
|
10288
10428
|
__privateSet$1(this, _tooltipProvider, new TooltipProvider({
|
|
10289
10429
|
content: __privateGet$1(this, _content),
|
|
10290
10430
|
debounce: 20,
|
|
10291
10431
|
offset: 10,
|
|
10292
10432
|
shouldShow: (view2) => {
|
|
10293
10433
|
if (__privateGet$1(this, _mousePressed)) return false;
|
|
10434
|
+
if (getIsAnyPopupOpen()) return false;
|
|
10294
10435
|
const { doc, selection } = view2.state;
|
|
10295
10436
|
const { empty, from, to } = selection;
|
|
10296
10437
|
const isEmptyTextBlock = !doc.textBetween(from, to).length && selection instanceof TextSelection;
|
|
@@ -10310,6 +10451,13 @@ class ToolbarView {
|
|
|
10310
10451
|
__privateGet$1(this, _tooltipProvider).onHide = () => {
|
|
10311
10452
|
__privateGet$1(this, _show).value = false;
|
|
10312
10453
|
};
|
|
10454
|
+
__privateSet$1(this, _removePopupListener, addPopupChangeListener(() => {
|
|
10455
|
+
if (getIsAnyPopupOpen()) {
|
|
10456
|
+
__privateGet$1(this, _tooltipProvider).hide();
|
|
10457
|
+
} else {
|
|
10458
|
+
__privateGet$1(this, _tooltipProvider).update(view);
|
|
10459
|
+
}
|
|
10460
|
+
}));
|
|
10313
10461
|
this.update(view);
|
|
10314
10462
|
}
|
|
10315
10463
|
}
|
|
@@ -10319,6 +10467,8 @@ _app = new WeakMap();
|
|
|
10319
10467
|
_selection = new WeakMap();
|
|
10320
10468
|
_show = new WeakMap();
|
|
10321
10469
|
_mousePressed = new WeakMap();
|
|
10470
|
+
_removePopupListener = new WeakMap();
|
|
10471
|
+
_onDocumentMouseUp = new WeakMap();
|
|
10322
10472
|
const toolbar = (editor, config) => {
|
|
10323
10473
|
editor.config(crepeFeatureConfig(CrepeFeature.Toolbar)).config((ctx) => {
|
|
10324
10474
|
ctx.set(toolbarTooltip.key, {
|