@milkdown/crepe 7.8.0 → 7.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/confirm-CNveM9QH.js +26 -0
- package/lib/cjs/confirm-CNveM9QH.js.map +1 -0
- package/lib/cjs/edit-BUtBJHpV.js +24 -0
- package/lib/cjs/edit-BUtBJHpV.js.map +1 -0
- package/lib/cjs/functions-BAY51plB.js +39 -0
- package/lib/cjs/functions-BAY51plB.js.map +1 -0
- package/lib/cjs/image-BXLkOVnO.js +24 -0
- package/lib/cjs/image-BXLkOVnO.js.map +1 -0
- package/lib/cjs/{index-DAiGM2G1.js → index-B7gqgc1H.js} +484 -204
- package/lib/cjs/index-B7gqgc1H.js.map +1 -0
- package/lib/cjs/{index-Dub20F3z.js → index-B91KhPew.js} +4 -4
- package/lib/cjs/index-B91KhPew.js.map +1 -0
- package/lib/cjs/{index-nrFkJeLW.js → index-BsrJn8Jp.js} +22 -7
- package/lib/cjs/index-BsrJn8Jp.js.map +1 -0
- package/lib/cjs/{index-BReSN-JQ.js → index-C2CAbC2F.js} +2 -2
- package/lib/cjs/{index-BReSN-JQ.js.map → index-C2CAbC2F.js.map} +1 -1
- package/lib/cjs/{index-CGies6Iv.js → index-CnyNb_OH.js} +45 -45
- package/lib/cjs/index-CnyNb_OH.js.map +1 -0
- package/lib/cjs/{index-CJdEvN3_.js → index-CoTb-QdE.js} +123 -105
- package/lib/cjs/index-CoTb-QdE.js.map +1 -0
- package/lib/cjs/index-DEs_IHHy.js +91 -0
- package/lib/cjs/index-DEs_IHHy.js.map +1 -0
- package/lib/cjs/index-DGAwtnNK.js +349 -0
- package/lib/cjs/index-DGAwtnNK.js.map +1 -0
- package/lib/cjs/index-DLIudQKW.js +126 -0
- package/lib/cjs/index-DLIudQKW.js.map +1 -0
- package/lib/cjs/index-Dw6lXgs6.js +81 -0
- package/lib/cjs/index-Dw6lXgs6.js.map +1 -0
- package/lib/cjs/{index-AlHHvSR_.js → index-xbwf60wt.js} +1 -6
- package/lib/cjs/{index-AlHHvSR_.js.map → index-xbwf60wt.js.map} +1 -1
- package/lib/cjs/{index-CvmlYYXX.js → index-xbxqAqH2.js} +21 -7
- package/lib/cjs/index-xbxqAqH2.js.map +1 -0
- package/lib/cjs/index.js +6 -6
- package/lib/cjs/plus-XLomtlXf.js +24 -0
- package/lib/cjs/plus-XLomtlXf.js.map +1 -0
- package/lib/cjs/remove-Ba-ypwBf.js +17 -0
- package/lib/cjs/remove-Ba-ypwBf.js.map +1 -0
- package/lib/esm/confirm-DtE-HkVd.js +24 -0
- package/lib/esm/confirm-DtE-HkVd.js.map +1 -0
- package/lib/esm/edit-D--t_JAb.js +22 -0
- package/lib/esm/edit-D--t_JAb.js.map +1 -0
- package/lib/esm/functions-DlJPkGmE.js +36 -0
- package/lib/esm/functions-DlJPkGmE.js.map +1 -0
- package/lib/esm/image-DoB1o1sl.js +22 -0
- package/lib/esm/image-DoB1o1sl.js.map +1 -0
- package/lib/esm/index-BAQT-9au.js +347 -0
- package/lib/esm/index-BAQT-9au.js.map +1 -0
- package/lib/esm/{index-DOrkOhki.js → index-BCvtgOeI.js} +4 -4
- package/lib/esm/index-BCvtgOeI.js.map +1 -0
- package/lib/esm/{index-x2oo_GmY.js → index-BDZ_pnSv.js} +122 -104
- package/lib/esm/index-BDZ_pnSv.js.map +1 -0
- package/lib/esm/{index-D6fLMv29.js → index-BPG8iO8t.js} +2 -6
- package/lib/esm/{index-D6fLMv29.js.map → index-BPG8iO8t.js.map} +1 -1
- package/lib/esm/{index-DcRgwPLd.js → index-BUBXHhHG.js} +18 -3
- package/lib/esm/index-BUBXHhHG.js.map +1 -0
- package/lib/esm/{index-CsYl2WR5.js → index-Bvz1Yyiz.js} +2 -2
- package/lib/esm/{index-CsYl2WR5.js.map → index-Bvz1Yyiz.js.map} +1 -1
- package/lib/esm/index-C1aVAv1l.js +124 -0
- package/lib/esm/index-C1aVAv1l.js.map +1 -0
- package/lib/esm/{index-CEOsxgzJ.js → index-CM4urRY9.js} +470 -190
- package/lib/esm/index-CM4urRY9.js.map +1 -0
- package/lib/esm/{index-BFsG6770.js → index-ChR5Qhyf.js} +17 -3
- package/lib/esm/index-ChR5Qhyf.js.map +1 -0
- package/lib/esm/index-CwMVnVeI.js +89 -0
- package/lib/esm/index-CwMVnVeI.js.map +1 -0
- package/lib/esm/{index-BwTxn2hs.js → index-Dc_wWopW.js} +46 -46
- package/lib/esm/index-Dc_wWopW.js.map +1 -0
- package/lib/esm/index-E8UgFLeN.js +79 -0
- package/lib/esm/index-E8UgFLeN.js.map +1 -0
- package/lib/esm/index.js +6 -6
- package/lib/esm/plus-lrX0Q75O.js +22 -0
- package/lib/esm/plus-lrX0Q75O.js.map +1 -0
- package/lib/esm/remove-D3g0Cd6_.js +15 -0
- package/lib/esm/remove-D3g0Cd6_.js.map +1 -0
- package/lib/theme/_internal/classic-common.css +6 -0
- package/lib/theme/common/block-edit.css +23 -23
- package/lib/theme/common/code-mirror.css +43 -44
- package/lib/theme/common/image-block.css +79 -81
- package/lib/theme/common/latex.css +6 -6
- package/lib/theme/common/link-tooltip.css +21 -21
- package/lib/theme/common/list-item.css +11 -10
- package/lib/theme/common/table.css +39 -39
- package/lib/theme/common/toolbar.css +8 -8
- package/lib/tsconfig.tsbuildinfo +1 -0
- package/lib/types/core/crepe.d.ts +6 -6
- package/lib/types/core/crepe.d.ts.map +1 -1
- package/lib/types/core/slice.d.ts.map +1 -1
- package/lib/types/feature/block-edit/handle/component.d.ts +4 -8
- package/lib/types/feature/block-edit/handle/component.d.ts.map +1 -1
- package/lib/types/feature/block-edit/handle/index.d.ts +1 -1
- package/lib/types/feature/block-edit/handle/index.d.ts.map +1 -1
- package/lib/types/feature/block-edit/index.d.ts.map +1 -1
- package/lib/types/feature/block-edit/menu/component.d.ts +8 -11
- package/lib/types/feature/block-edit/menu/component.d.ts.map +1 -1
- package/lib/types/feature/block-edit/menu/config.d.ts.map +1 -1
- package/lib/types/feature/block-edit/menu/index.d.ts.map +1 -1
- package/lib/types/feature/block-edit/menu/utils.d.ts +2 -3
- package/lib/types/feature/block-edit/menu/utils.d.ts.map +1 -1
- package/lib/types/feature/code-mirror/index.d.ts +3 -4
- package/lib/types/feature/code-mirror/index.d.ts.map +1 -1
- package/lib/types/feature/cursor/index.d.ts.map +1 -1
- package/lib/types/feature/image-block/index.d.ts.map +1 -1
- package/lib/types/feature/index.d.ts +4 -4
- package/lib/types/feature/index.d.ts.map +1 -1
- package/lib/types/feature/latex/index.d.ts.map +1 -1
- package/lib/types/feature/latex/inline-tooltip/component.d.ts +6 -10
- package/lib/types/feature/latex/inline-tooltip/component.d.ts.map +1 -1
- package/lib/types/feature/latex/inline-tooltip/view.d.ts.map +1 -1
- package/lib/types/feature/latex/input-rule.d.ts.map +1 -1
- package/lib/types/feature/latex/remark.d.ts.map +1 -1
- package/lib/types/feature/link-tooltip/index.d.ts.map +1 -1
- package/lib/types/feature/list-item/index.d.ts.map +1 -1
- package/lib/types/feature/placeholder/index.d.ts.map +1 -1
- package/lib/types/feature/shared.d.ts +1 -2
- package/lib/types/feature/shared.d.ts.map +1 -1
- package/lib/types/feature/table/index.d.ts.map +1 -1
- package/lib/types/feature/toolbar/component.d.ts +9 -12
- 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/align-center.d.ts +1 -1
- package/lib/types/icons/align-center.d.ts.map +1 -1
- package/lib/types/icons/align-left.d.ts +1 -1
- package/lib/types/icons/align-left.d.ts.map +1 -1
- package/lib/types/icons/align-right.d.ts +1 -1
- package/lib/types/icons/align-right.d.ts.map +1 -1
- package/lib/types/icons/bold.d.ts +1 -1
- package/lib/types/icons/bold.d.ts.map +1 -1
- package/lib/types/icons/bullet-list.d.ts +1 -1
- package/lib/types/icons/bullet-list.d.ts.map +1 -1
- package/lib/types/icons/bullet.d.ts +1 -1
- package/lib/types/icons/bullet.d.ts.map +1 -1
- package/lib/types/icons/caption.d.ts +1 -1
- package/lib/types/icons/caption.d.ts.map +1 -1
- package/lib/types/icons/check-box-checked.d.ts +1 -1
- package/lib/types/icons/check-box-checked.d.ts.map +1 -1
- package/lib/types/icons/check-box-unchecked.d.ts +1 -1
- package/lib/types/icons/check-box-unchecked.d.ts.map +1 -1
- package/lib/types/icons/chevron-down.d.ts +1 -1
- package/lib/types/icons/chevron-down.d.ts.map +1 -1
- package/lib/types/icons/clear.d.ts +1 -1
- package/lib/types/icons/clear.d.ts.map +1 -1
- package/lib/types/icons/code.d.ts +1 -1
- package/lib/types/icons/code.d.ts.map +1 -1
- package/lib/types/icons/confirm.d.ts +1 -1
- package/lib/types/icons/confirm.d.ts.map +1 -1
- package/lib/types/icons/copy.d.ts +1 -1
- package/lib/types/icons/copy.d.ts.map +1 -1
- package/lib/types/icons/divider.d.ts +1 -1
- package/lib/types/icons/divider.d.ts.map +1 -1
- package/lib/types/icons/drag-handle.d.ts +1 -1
- package/lib/types/icons/drag-handle.d.ts.map +1 -1
- package/lib/types/icons/edit.d.ts +1 -1
- package/lib/types/icons/edit.d.ts.map +1 -1
- package/lib/types/icons/functions.d.ts +1 -1
- package/lib/types/icons/functions.d.ts.map +1 -1
- package/lib/types/icons/h1.d.ts +1 -1
- package/lib/types/icons/h1.d.ts.map +1 -1
- package/lib/types/icons/h2.d.ts +1 -1
- package/lib/types/icons/h2.d.ts.map +1 -1
- package/lib/types/icons/h3.d.ts +1 -1
- package/lib/types/icons/h3.d.ts.map +1 -1
- package/lib/types/icons/h4.d.ts +1 -1
- package/lib/types/icons/h4.d.ts.map +1 -1
- package/lib/types/icons/h5.d.ts +1 -1
- package/lib/types/icons/h5.d.ts.map +1 -1
- package/lib/types/icons/h6.d.ts +1 -1
- package/lib/types/icons/h6.d.ts.map +1 -1
- package/lib/types/icons/image.d.ts +1 -1
- package/lib/types/icons/image.d.ts.map +1 -1
- package/lib/types/icons/italic.d.ts +1 -1
- package/lib/types/icons/italic.d.ts.map +1 -1
- package/lib/types/icons/link.d.ts +1 -1
- package/lib/types/icons/link.d.ts.map +1 -1
- package/lib/types/icons/menu.d.ts +1 -1
- package/lib/types/icons/menu.d.ts.map +1 -1
- package/lib/types/icons/ordered-list.d.ts +1 -1
- package/lib/types/icons/ordered-list.d.ts.map +1 -1
- package/lib/types/icons/plus.d.ts +1 -1
- package/lib/types/icons/plus.d.ts.map +1 -1
- package/lib/types/icons/quote.d.ts +1 -1
- package/lib/types/icons/quote.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/icons/search.d.ts +1 -1
- package/lib/types/icons/search.d.ts.map +1 -1
- package/lib/types/icons/strikethrough.d.ts +1 -1
- package/lib/types/icons/strikethrough.d.ts.map +1 -1
- package/lib/types/icons/table.d.ts +1 -1
- package/lib/types/icons/table.d.ts.map +1 -1
- package/lib/types/icons/text.d.ts +1 -1
- package/lib/types/icons/text.d.ts.map +1 -1
- package/lib/types/icons/todo-list.d.ts +1 -1
- package/lib/types/icons/todo-list.d.ts.map +1 -1
- package/lib/types/icons/visibility-off.d.ts +1 -1
- package/lib/types/icons/visibility-off.d.ts.map +1 -1
- package/package.json +4 -26
- package/src/core/crepe.ts +13 -12
- package/src/core/slice.ts +2 -0
- package/src/feature/block-edit/handle/component.tsx +60 -0
- package/src/feature/block-edit/handle/index.ts +22 -14
- package/src/feature/block-edit/index.ts +3 -1
- package/src/feature/block-edit/menu/component.tsx +237 -0
- package/src/feature/block-edit/menu/config.ts +6 -3
- package/src/feature/block-edit/menu/index.ts +38 -18
- package/src/feature/block-edit/menu/utils.ts +3 -3
- package/src/feature/code-mirror/index.ts +20 -20
- package/src/feature/cursor/index.ts +1 -1
- package/src/feature/image-block/index.ts +3 -1
- package/src/feature/index.ts +5 -4
- package/src/feature/latex/index.ts +8 -8
- package/src/feature/latex/inline-tooltip/component.tsx +57 -0
- package/src/feature/latex/inline-tooltip/view.ts +30 -17
- package/src/feature/latex/input-rule.ts +4 -3
- package/src/feature/latex/remark.ts +3 -2
- package/src/feature/link-tooltip/index.ts +3 -1
- package/src/feature/list-item/index.ts +8 -16
- package/src/feature/placeholder/index.ts +6 -3
- package/src/feature/shared.ts +1 -2
- package/src/feature/table/index.ts +2 -0
- package/src/feature/toolbar/component.tsx +256 -0
- package/src/feature/toolbar/index.ts +34 -17
- package/src/icons/align-center.ts +1 -3
- package/src/icons/align-left.ts +1 -3
- package/src/icons/align-right.ts +1 -3
- package/src/icons/bold.ts +1 -3
- package/src/icons/bullet-list.ts +1 -3
- package/src/icons/bullet.ts +1 -3
- package/src/icons/caption.ts +1 -3
- package/src/icons/check-box-checked.ts +1 -3
- package/src/icons/check-box-unchecked.ts +1 -3
- package/src/icons/chevron-down.ts +1 -3
- package/src/icons/clear.ts +1 -3
- package/src/icons/code.ts +1 -3
- package/src/icons/confirm.ts +1 -3
- package/src/icons/copy.ts +1 -3
- package/src/icons/divider.ts +1 -3
- package/src/icons/drag-handle.ts +1 -3
- package/src/icons/edit.ts +1 -3
- package/src/icons/functions.ts +1 -3
- package/src/icons/h1.ts +1 -3
- package/src/icons/h2.ts +1 -3
- package/src/icons/h3.ts +1 -3
- package/src/icons/h4.ts +1 -3
- package/src/icons/h5.ts +1 -3
- package/src/icons/h6.ts +1 -3
- package/src/icons/image.ts +1 -3
- package/src/icons/italic.ts +1 -3
- package/src/icons/link.ts +1 -3
- package/src/icons/menu.ts +1 -3
- package/src/icons/ordered-list.ts +1 -3
- package/src/icons/plus.ts +1 -3
- package/src/icons/quote.ts +1 -3
- package/src/icons/remove.ts +1 -3
- package/src/icons/search.ts +1 -3
- package/src/icons/strikethrough.ts +1 -3
- package/src/icons/table.ts +1 -3
- package/src/icons/text.ts +1 -3
- package/src/icons/todo-list.ts +1 -3
- package/src/icons/visibility-off.ts +1 -3
- package/src/theme/_internal/classic-common.css +6 -0
- package/src/theme/common/block-edit.css +2 -2
- package/src/theme/common/code-mirror.css +5 -6
- package/src/theme/common/image-block.css +9 -11
- package/src/theme/common/latex.css +1 -1
- package/src/theme/common/link-tooltip.css +2 -2
- package/src/theme/common/list-item.css +3 -2
- package/src/theme/common/table.css +2 -2
- package/src/theme/common/toolbar.css +1 -1
- package/lib/cjs/functions-Dk90yOUc.js +0 -690
- package/lib/cjs/functions-Dk90yOUc.js.map +0 -1
- package/lib/cjs/index-CGies6Iv.js.map +0 -1
- package/lib/cjs/index-CJdEvN3_.js.map +0 -1
- package/lib/cjs/index-CvmlYYXX.js.map +0 -1
- package/lib/cjs/index-D3lu92SA.js +0 -39
- package/lib/cjs/index-D3lu92SA.js.map +0 -1
- package/lib/cjs/index-DAiGM2G1.js.map +0 -1
- package/lib/cjs/index-DKY_Kri2.js +0 -272
- package/lib/cjs/index-DKY_Kri2.js.map +0 -1
- package/lib/cjs/index-DQll67YS.js +0 -65
- package/lib/cjs/index-DQll67YS.js.map +0 -1
- package/lib/cjs/index-Dub20F3z.js.map +0 -1
- package/lib/cjs/index-hPk2gbSt.js +0 -35
- package/lib/cjs/index-hPk2gbSt.js.map +0 -1
- package/lib/cjs/index-nrFkJeLW.js.map +0 -1
- package/lib/esm/functions-Bsik6ikd.js +0 -652
- package/lib/esm/functions-Bsik6ikd.js.map +0 -1
- package/lib/esm/index-B3KiKTSt.js +0 -63
- package/lib/esm/index-B3KiKTSt.js.map +0 -1
- package/lib/esm/index-BFsG6770.js.map +0 -1
- package/lib/esm/index-BwTxn2hs.js.map +0 -1
- package/lib/esm/index-CBrOT1fW.js +0 -37
- package/lib/esm/index-CBrOT1fW.js.map +0 -1
- package/lib/esm/index-CEOsxgzJ.js.map +0 -1
- package/lib/esm/index-Cuk7cL-r.js +0 -33
- package/lib/esm/index-Cuk7cL-r.js.map +0 -1
- package/lib/esm/index-DOrkOhki.js.map +0 -1
- package/lib/esm/index-DcRgwPLd.js.map +0 -1
- package/lib/esm/index-H9uklzH0.js +0 -270
- package/lib/esm/index-H9uklzH0.js.map +0 -1
- package/lib/esm/index-x2oo_GmY.js.map +0 -1
- package/src/feature/block-edit/handle/component.ts +0 -54
- package/src/feature/block-edit/menu/component.ts +0 -241
- package/src/feature/latex/inline-tooltip/component.ts +0 -38
- package/src/feature/toolbar/component.ts +0 -236
|
@@ -1,23 +1,301 @@
|
|
|
1
1
|
import { blockConfig, block, BlockProvider } from '@milkdown/kit/plugin/block';
|
|
2
|
-
import { TextSelection } from '@milkdown/kit/prose/state';
|
|
3
2
|
import { editorViewCtx } from '@milkdown/kit/core';
|
|
4
3
|
import { paragraphSchema, headingSchema, blockquoteSchema, hrSchema, bulletListSchema, orderedListSchema, listItemSchema, codeBlockSchema } from '@milkdown/kit/preset/commonmark';
|
|
5
4
|
import { findParent } from '@milkdown/kit/prose';
|
|
5
|
+
import { TextSelection } from '@milkdown/kit/prose/state';
|
|
6
|
+
import { defineComponent, ref, computed, watch, watchEffect, onUnmounted, h, createApp, Fragment } from 'vue';
|
|
7
|
+
import { p as plusIcon } from './plus-lrX0Q75O.js';
|
|
6
8
|
import { slashFactory, SlashProvider } from '@milkdown/kit/plugin/slash';
|
|
7
9
|
import { $ctx } from '@milkdown/kit/utils';
|
|
8
|
-
import { i as isInCodeBlock, a as isInList
|
|
9
|
-
import {
|
|
10
|
+
import { i as isInCodeBlock, a as isInList } from './index-BPG8iO8t.js';
|
|
11
|
+
import { Icon } from '@milkdown/kit/component';
|
|
10
12
|
import { imageBlockSchema } from '@milkdown/kit/component/image-block';
|
|
11
13
|
import { createTable } from '@milkdown/kit/preset/gfm';
|
|
12
|
-
import { F as FeaturesCtx, C as CrepeFeature } from './index-
|
|
13
|
-
import {
|
|
14
|
+
import { F as FeaturesCtx, C as CrepeFeature } from './index-Dc_wWopW.js';
|
|
15
|
+
import { c as codeIcon, f as functionsIcon } from './functions-DlJPkGmE.js';
|
|
16
|
+
import { i as imageIcon } from './image-DoB1o1sl.js';
|
|
14
17
|
import { findWrapping } from '@milkdown/kit/prose/transform';
|
|
18
|
+
import '@milkdown/kit/plugin/clipboard';
|
|
15
19
|
import '@milkdown/kit/plugin/history';
|
|
16
20
|
import '@milkdown/kit/plugin/indent';
|
|
17
|
-
import '@milkdown/kit/plugin/
|
|
21
|
+
import '@milkdown/kit/plugin/listener';
|
|
18
22
|
import '@milkdown/kit/plugin/trailing';
|
|
19
23
|
import '@milkdown/kit/ctx';
|
|
20
|
-
|
|
24
|
+
|
|
25
|
+
const bulletListIcon = `
|
|
26
|
+
<svg
|
|
27
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
28
|
+
width="24"
|
|
29
|
+
height="24"
|
|
30
|
+
viewBox="0 0 24 24"
|
|
31
|
+
>
|
|
32
|
+
<g clip-path="url(#clip0_977_8070)">
|
|
33
|
+
<path
|
|
34
|
+
d="M4 10.5C3.17 10.5 2.5 11.17 2.5 12C2.5 12.83 3.17 13.5 4 13.5C4.83 13.5 5.5 12.83 5.5 12C5.5 11.17 4.83 10.5 4 10.5ZM4 4.5C3.17 4.5 2.5 5.17 2.5 6C2.5 6.83 3.17 7.5 4 7.5C4.83 7.5 5.5 6.83 5.5 6C5.5 5.17 4.83 4.5 4 4.5ZM4 16.5C3.17 16.5 2.5 17.18 2.5 18C2.5 18.82 3.18 19.5 4 19.5C4.82 19.5 5.5 18.82 5.5 18C5.5 17.18 4.83 16.5 4 16.5ZM8 19H20C20.55 19 21 18.55 21 18C21 17.45 20.55 17 20 17H8C7.45 17 7 17.45 7 18C7 18.55 7.45 19 8 19ZM8 13H20C20.55 13 21 12.55 21 12C21 11.45 20.55 11 20 11H8C7.45 11 7 11.45 7 12C7 12.55 7.45 13 8 13ZM7 6C7 6.55 7.45 7 8 7H20C20.55 7 21 6.55 21 6C21 5.45 20.55 5 20 5H8C7.45 5 7 5.45 7 6Z"
|
|
35
|
+
/>
|
|
36
|
+
</g>
|
|
37
|
+
<defs>
|
|
38
|
+
<clipPath id="clip0_977_8070">
|
|
39
|
+
<rect width="24" height="24" />
|
|
40
|
+
</clipPath>
|
|
41
|
+
</defs>
|
|
42
|
+
</svg>
|
|
43
|
+
`;
|
|
44
|
+
|
|
45
|
+
const dividerIcon = `
|
|
46
|
+
<svg
|
|
47
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
48
|
+
width="24"
|
|
49
|
+
height="24"
|
|
50
|
+
viewBox="0 0 24 24"
|
|
51
|
+
>
|
|
52
|
+
<g clip-path="url(#clip0_977_7900)">
|
|
53
|
+
<path
|
|
54
|
+
fill-rule="evenodd"
|
|
55
|
+
clip-rule="evenodd"
|
|
56
|
+
d="M19 13H5C4.45 13 4 12.55 4 12C4 11.45 4.45 11 5 11H19C19.55 11 20 11.45 20 12C20 12.55 19.55 13 19 13Z"
|
|
57
|
+
/>
|
|
58
|
+
</g>
|
|
59
|
+
<defs>
|
|
60
|
+
<clipPath id="clip0_977_7900">
|
|
61
|
+
<rect width="24" height="24" />
|
|
62
|
+
</clipPath>
|
|
63
|
+
</defs>
|
|
64
|
+
</svg>
|
|
65
|
+
`;
|
|
66
|
+
|
|
67
|
+
const h1Icon = `
|
|
68
|
+
<svg
|
|
69
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
70
|
+
width="24"
|
|
71
|
+
height="24"
|
|
72
|
+
viewBox="0 0 24 24"
|
|
73
|
+
>
|
|
74
|
+
<g clip-path="url(#clip0_992_5553)">
|
|
75
|
+
<path
|
|
76
|
+
d="M19 3H5C3.9 3 3 3.9 3 5V19C3 20.1 3.9 21 5 21H19C20.1 21 21 20.1 21 19V5C21 3.9 20.1 3 19 3ZM19 19H5V5H19V19ZM12 17H14V7H10V9H12V17Z"
|
|
77
|
+
/>
|
|
78
|
+
</g>
|
|
79
|
+
<defs>
|
|
80
|
+
<clipPath id="clip0_992_5553">
|
|
81
|
+
<rect width="24" height="24" />
|
|
82
|
+
</clipPath>
|
|
83
|
+
</defs>
|
|
84
|
+
</svg>
|
|
85
|
+
`;
|
|
86
|
+
|
|
87
|
+
const h2Icon = `
|
|
88
|
+
<svg
|
|
89
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
90
|
+
width="24"
|
|
91
|
+
height="24"
|
|
92
|
+
viewBox="0 0 24 24"
|
|
93
|
+
>
|
|
94
|
+
<g clip-path="url(#clip0_992_5559)">
|
|
95
|
+
<path
|
|
96
|
+
d="M19 3H5C3.9 3 3 3.9 3 5V19C3 20.1 3.9 21 5 21H19C20.1 21 21 20.1 21 19V5C21 3.9 20.1 3 19 3ZM19 19H5V5H19V19ZM15 15H11V13H13C14.1 13 15 12.11 15 11V9C15 7.89 14.1 7 13 7H9V9H13V11H11C9.9 11 9 11.89 9 13V17H15V15Z"
|
|
97
|
+
/>
|
|
98
|
+
</g>
|
|
99
|
+
<defs>
|
|
100
|
+
<clipPath id="clip0_992_5559">
|
|
101
|
+
<rect width="24" height="24" />
|
|
102
|
+
</clipPath>
|
|
103
|
+
</defs>
|
|
104
|
+
</svg>
|
|
105
|
+
`;
|
|
106
|
+
|
|
107
|
+
const h3Icon = `
|
|
108
|
+
<svg
|
|
109
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
110
|
+
width="24"
|
|
111
|
+
height="24"
|
|
112
|
+
viewBox="0 0 24 24"
|
|
113
|
+
>
|
|
114
|
+
<g clip-path="url(#clip0_992_5565)">
|
|
115
|
+
<path
|
|
116
|
+
d="M19 3H5C3.9 3 3 3.9 3 5V19C3 20.1 3.9 21 5 21H19C20.1 21 21 20.1 21 19V5C21 3.9 20.1 3 19 3ZM19 19H5V5H19V19ZM15 15V13.5C15 12.67 14.33 12 13.5 12C14.33 12 15 11.33 15 10.5V9C15 7.89 14.1 7 13 7H9V9H13V11H11V13H13V15H9V17H13C14.1 17 15 16.11 15 15Z"
|
|
117
|
+
/>
|
|
118
|
+
</g>
|
|
119
|
+
<defs>
|
|
120
|
+
<clipPath id="clip0_992_5565">
|
|
121
|
+
<rect width="24" height="24" />
|
|
122
|
+
</clipPath>
|
|
123
|
+
</defs>
|
|
124
|
+
</svg>
|
|
125
|
+
`;
|
|
126
|
+
|
|
127
|
+
const h4Icon = `
|
|
128
|
+
<svg
|
|
129
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
130
|
+
width="24"
|
|
131
|
+
height="24"
|
|
132
|
+
viewBox="0 0 24 24"
|
|
133
|
+
>
|
|
134
|
+
<g clip-path="url(#clip0_977_7757)">
|
|
135
|
+
<path
|
|
136
|
+
d="M19.04 3H5.04004C3.94004 3 3.04004 3.9 3.04004 5V19C3.04004 20.1 3.94004 21 5.04004 21H19.04C20.14 21 21.04 20.1 21.04 19V5C21.04 3.9 20.14 3 19.04 3ZM19.04 19H5.04004V5H19.04V19ZM13.04 17H15.04V7H13.04V11H11.04V7H9.04004V13H13.04V17Z"
|
|
137
|
+
/>
|
|
138
|
+
</g>
|
|
139
|
+
<defs>
|
|
140
|
+
<clipPath id="clip0_977_7757">
|
|
141
|
+
<rect width="24" height="24" />
|
|
142
|
+
</clipPath>
|
|
143
|
+
</defs>
|
|
144
|
+
</svg>
|
|
145
|
+
`;
|
|
146
|
+
|
|
147
|
+
const h5Icon = `
|
|
148
|
+
<svg
|
|
149
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
150
|
+
width="24"
|
|
151
|
+
height="24"
|
|
152
|
+
viewBox="0 0 24 24"
|
|
153
|
+
>
|
|
154
|
+
<g clip-path="url(#clip0_977_7760)">
|
|
155
|
+
<path
|
|
156
|
+
d="M19 3H5C3.9 3 3 3.9 3 5V19C3 20.1 3.9 21 5 21H19C20.1 21 21 20.1 21 19V5C21 3.9 20.1 3 19 3ZM19 19H5V5H19V19ZM15 15V13C15 11.89 14.1 11 13 11H11V9H15V7H9V13H13V15H9V17H13C14.1 17 15 16.11 15 15Z"
|
|
157
|
+
/>
|
|
158
|
+
</g>
|
|
159
|
+
<defs>
|
|
160
|
+
<clipPath id="clip0_977_7760">
|
|
161
|
+
<rect width="24" height="24" />
|
|
162
|
+
</clipPath>
|
|
163
|
+
</defs>
|
|
164
|
+
</svg>
|
|
165
|
+
`;
|
|
166
|
+
|
|
167
|
+
const h6Icon = `
|
|
168
|
+
<svg
|
|
169
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
170
|
+
width="24"
|
|
171
|
+
height="24"
|
|
172
|
+
viewBox="0 0 24 24"
|
|
173
|
+
>
|
|
174
|
+
<g clip-path="url(#clip0_977_7763)">
|
|
175
|
+
<path
|
|
176
|
+
d="M11 17H13C14.1 17 15 16.11 15 15V13C15 11.89 14.1 11 13 11H11V9H15V7H11C9.9 7 9 7.89 9 9V15C9 16.11 9.9 17 11 17ZM11 13H13V15H11V13ZM19 3H5C3.9 3 3 3.9 3 5V19C3 20.1 3.9 21 5 21H19C20.1 21 21 20.1 21 19V5C21 3.9 20.1 3 19 3ZM19 19H5V5H19V19Z"
|
|
177
|
+
/>
|
|
178
|
+
</g>
|
|
179
|
+
<defs>
|
|
180
|
+
<clipPath id="clip0_977_7763">
|
|
181
|
+
<rect width="24" height="24" />
|
|
182
|
+
</clipPath>
|
|
183
|
+
</defs>
|
|
184
|
+
</svg>
|
|
185
|
+
`;
|
|
186
|
+
|
|
187
|
+
const menuIcon = `
|
|
188
|
+
<svg
|
|
189
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
190
|
+
width="24"
|
|
191
|
+
height="24"
|
|
192
|
+
viewBox="0 0 24 24"
|
|
193
|
+
>
|
|
194
|
+
<g clip-path="url(#clip0_971_7680)">
|
|
195
|
+
<path
|
|
196
|
+
d="M11 18C11 19.1 10.1 20 9 20C7.9 20 7 19.1 7 18C7 16.9 7.9 16 9 16C10.1 16 11 16.9 11 18ZM9 10C7.9 10 7 10.9 7 12C7 13.1 7.9 14 9 14C10.1 14 11 13.1 11 12C11 10.9 10.1 10 9 10ZM9 4C7.9 4 7 4.9 7 6C7 7.1 7.9 8 9 8C10.1 8 11 7.1 11 6C11 4.9 10.1 4 9 4ZM15 8C16.1 8 17 7.1 17 6C17 4.9 16.1 4 15 4C13.9 4 13 4.9 13 6C13 7.1 13.9 8 15 8ZM15 10C13.9 10 13 10.9 13 12C13 13.1 13.9 14 15 14C16.1 14 17 13.1 17 12C17 10.9 16.1 10 15 10ZM15 16C13.9 16 13 16.9 13 18C13 19.1 13.9 20 15 20C16.1 20 17 19.1 17 18C17 16.9 16.1 16 15 16Z"
|
|
197
|
+
/>
|
|
198
|
+
</g>
|
|
199
|
+
<defs>
|
|
200
|
+
<clipPath id="clip0_971_7680">
|
|
201
|
+
<rect width="24" height="24" />
|
|
202
|
+
</clipPath>
|
|
203
|
+
</defs>
|
|
204
|
+
</svg>
|
|
205
|
+
`;
|
|
206
|
+
|
|
207
|
+
const orderedListIcon = `
|
|
208
|
+
<svg
|
|
209
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
210
|
+
width="24"
|
|
211
|
+
height="24"
|
|
212
|
+
viewBox="0 0 24 24"
|
|
213
|
+
>
|
|
214
|
+
<g clip-path="url(#clip0_977_8067)">
|
|
215
|
+
<path
|
|
216
|
+
d="M8 7H20C20.55 7 21 6.55 21 6C21 5.45 20.55 5 20 5H8C7.45 5 7 5.45 7 6C7 6.55 7.45 7 8 7ZM20 17H8C7.45 17 7 17.45 7 18C7 18.55 7.45 19 8 19H20C20.55 19 21 18.55 21 18C21 17.45 20.55 17 20 17ZM20 11H8C7.45 11 7 11.45 7 12C7 12.55 7.45 13 8 13H20C20.55 13 21 12.55 21 12C21 11.45 20.55 11 20 11ZM4.5 16H2.5C2.22 16 2 16.22 2 16.5C2 16.78 2.22 17 2.5 17H4V17.5H3.5C3.22 17.5 3 17.72 3 18C3 18.28 3.22 18.5 3.5 18.5H4V19H2.5C2.22 19 2 19.22 2 19.5C2 19.78 2.22 20 2.5 20H4.5C4.78 20 5 19.78 5 19.5V16.5C5 16.22 4.78 16 4.5 16ZM2.5 5H3V7.5C3 7.78 3.22 8 3.5 8C3.78 8 4 7.78 4 7.5V4.5C4 4.22 3.78 4 3.5 4H2.5C2.22 4 2 4.22 2 4.5C2 4.78 2.22 5 2.5 5ZM4.5 10H2.5C2.22 10 2 10.22 2 10.5C2 10.78 2.22 11 2.5 11H3.8L2.12 12.96C2.04 13.05 2 13.17 2 13.28V13.5C2 13.78 2.22 14 2.5 14H4.5C4.78 14 5 13.78 5 13.5C5 13.22 4.78 13 4.5 13H3.2L4.88 11.04C4.96 10.95 5 10.83 5 10.72V10.5C5 10.22 4.78 10 4.5 10Z"
|
|
217
|
+
/>
|
|
218
|
+
</g>
|
|
219
|
+
<defs>
|
|
220
|
+
<clipPath id="clip0_977_8067">
|
|
221
|
+
<rect width="24" height="24" />
|
|
222
|
+
</clipPath>
|
|
223
|
+
</defs>
|
|
224
|
+
</svg>
|
|
225
|
+
`;
|
|
226
|
+
|
|
227
|
+
const quoteIcon = `
|
|
228
|
+
<svg
|
|
229
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
230
|
+
width="24"
|
|
231
|
+
height="24"
|
|
232
|
+
viewBox="0 0 24 24"
|
|
233
|
+
>
|
|
234
|
+
<g clip-path="url(#clip0_977_7897)">
|
|
235
|
+
<path
|
|
236
|
+
d="M7.17 17C7.68 17 8.15 16.71 8.37 16.26L9.79 13.42C9.93 13.14 10 12.84 10 12.53V8C10 7.45 9.55 7 9 7H5C4.45 7 4 7.45 4 8V12C4 12.55 4.45 13 5 13H7L5.97 15.06C5.52 15.95 6.17 17 7.17 17ZM17.17 17C17.68 17 18.15 16.71 18.37 16.26L19.79 13.42C19.93 13.14 20 12.84 20 12.53V8C20 7.45 19.55 7 19 7H15C14.45 7 14 7.45 14 8V12C14 12.55 14.45 13 15 13H17L15.97 15.06C15.52 15.95 16.17 17 17.17 17Z"
|
|
237
|
+
/>
|
|
238
|
+
</g>
|
|
239
|
+
<defs>
|
|
240
|
+
<clipPath id="clip0_977_7897">
|
|
241
|
+
<rect width="24" height="24" />
|
|
242
|
+
</clipPath>
|
|
243
|
+
</defs>
|
|
244
|
+
</svg>
|
|
245
|
+
`;
|
|
246
|
+
|
|
247
|
+
const tableIcon = `
|
|
248
|
+
<svg
|
|
249
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
250
|
+
width="24"
|
|
251
|
+
height="24"
|
|
252
|
+
viewBox="0 0 24 24"
|
|
253
|
+
>
|
|
254
|
+
<g clip-path="url(#clip0_977_8078)">
|
|
255
|
+
<path
|
|
256
|
+
d="M20 3H5C3.9 3 3 3.9 3 5V19C3 20.1 3.9 21 5 21H20C21.1 21 22 20.1 22 19V5C22 3.9 21.1 3 20 3ZM20 5V8H5V5H20ZM15 19H10V10H15V19ZM5 10H8V19H5V10ZM17 19V10H20V19H17Z"
|
|
257
|
+
/>
|
|
258
|
+
</g>
|
|
259
|
+
<defs>
|
|
260
|
+
<clipPath id="clip0_977_8078">
|
|
261
|
+
<rect width="24" height="24" />
|
|
262
|
+
</clipPath>
|
|
263
|
+
</defs>
|
|
264
|
+
</svg>
|
|
265
|
+
`;
|
|
266
|
+
|
|
267
|
+
const textIcon = `
|
|
268
|
+
<svg
|
|
269
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
270
|
+
width="24"
|
|
271
|
+
height="24"
|
|
272
|
+
viewBox="0 0 24 24"
|
|
273
|
+
>
|
|
274
|
+
<g clip-path="url(#clip0_992_5547)">
|
|
275
|
+
<path
|
|
276
|
+
d="M5 5.5C5 6.33 5.67 7 6.5 7H10.5V17.5C10.5 18.33 11.17 19 12 19C12.83 19 13.5 18.33 13.5 17.5V7H17.5C18.33 7 19 6.33 19 5.5C19 4.67 18.33 4 17.5 4H6.5C5.67 4 5 4.67 5 5.5Z"
|
|
277
|
+
/>
|
|
278
|
+
</g>
|
|
279
|
+
<defs>
|
|
280
|
+
<clipPath id="clip0_992_5547">
|
|
281
|
+
<rect width="24" height="24" />
|
|
282
|
+
</clipPath>
|
|
283
|
+
</defs>
|
|
284
|
+
</svg>
|
|
285
|
+
`;
|
|
286
|
+
|
|
287
|
+
const todoListIcon = `
|
|
288
|
+
<svg
|
|
289
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
290
|
+
width="24"
|
|
291
|
+
height="24"
|
|
292
|
+
viewBox="0 0 24 24"
|
|
293
|
+
>
|
|
294
|
+
<path
|
|
295
|
+
d="M5.66936 16.3389L9.39244 12.6158C9.54115 12.4671 9.71679 12.3937 9.91936 12.3957C10.1219 12.3976 10.2975 12.4761 10.4463 12.6312C10.5847 12.7823 10.654 12.9585 10.654 13.1599C10.654 13.3613 10.5847 13.5363 10.4463 13.6851L6.32704 17.8197C6.14627 18.0004 5.93538 18.0908 5.69436 18.0908C5.45333 18.0908 5.24243 18.0004 5.06166 17.8197L3.01744 15.7754C2.87899 15.637 2.81136 15.4629 2.81456 15.2533C2.81776 15.0437 2.88859 14.8697 3.02706 14.7312C3.16551 14.5928 3.34008 14.5235 3.55076 14.5235C3.76144 14.5235 3.93494 14.5928 4.07126 14.7312L5.66936 16.3389ZM5.66936 8.72359L9.39244 5.00049C9.54115 4.85177 9.71679 4.77838 9.91936 4.78031C10.1219 4.78223 10.2975 4.86075 10.4463 5.01586C10.5847 5.16691 10.654 5.34314 10.654 5.54454C10.654 5.74592 10.5847 5.92097 10.4463 6.06969L6.32704 10.2043C6.14627 10.3851 5.93538 10.4755 5.69436 10.4755C5.45333 10.4755 5.24243 10.3851 5.06166 10.2043L3.01744 8.16009C2.87899 8.02162 2.81136 7.84759 2.81456 7.63799C2.81776 7.42837 2.88859 7.25433 3.02706 7.11586C3.16551 6.97741 3.34008 6.90819 3.55076 6.90819C3.76144 6.90819 3.93494 6.97741 4.07126 7.11586L5.66936 8.72359ZM13.7597 16.5581C13.5472 16.5581 13.3691 16.4862 13.2253 16.3424C13.0816 16.1986 13.0097 16.0204 13.0097 15.8078C13.0097 15.5952 13.0816 15.4171 13.2253 15.2735C13.3691 15.13 13.5472 15.0582 13.7597 15.0582H20.7597C20.9722 15.0582 21.1503 15.1301 21.2941 15.2739C21.4378 15.4177 21.5097 15.5959 21.5097 15.8085C21.5097 16.0211 21.4378 16.1992 21.2941 16.3427C21.1503 16.4863 20.9722 16.5581 20.7597 16.5581H13.7597ZM13.7597 8.94276C13.5472 8.94276 13.3691 8.87085 13.2253 8.72704C13.0816 8.58324 13.0097 8.40504 13.0097 8.19244C13.0097 7.97985 13.0816 7.80177 13.2253 7.65819C13.3691 7.5146 13.5472 7.44281 13.7597 7.44281H20.7597C20.9722 7.44281 21.1503 7.51471 21.2941 7.65851C21.4378 7.80233 21.5097 7.98053 21.5097 8.19311C21.5097 8.40571 21.4378 8.5838 21.2941 8.72739C21.1503 8.87097 20.9722 8.94276 20.7597 8.94276H13.7597Z"
|
|
296
|
+
/>
|
|
297
|
+
</svg>
|
|
298
|
+
`;
|
|
21
299
|
|
|
22
300
|
var __typeError$2 = (msg) => {
|
|
23
301
|
throw TypeError(msg);
|
|
@@ -355,60 +633,65 @@ function getGroups(filter, config, ctx) {
|
|
|
355
633
|
};
|
|
356
634
|
}
|
|
357
635
|
|
|
358
|
-
const
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
config
|
|
364
|
-
}) => {
|
|
365
|
-
const { groups, size } = useMemo(
|
|
366
|
-
() => getGroups(filter, config, ctx),
|
|
367
|
-
[filter]
|
|
368
|
-
);
|
|
369
|
-
const host = useHost();
|
|
370
|
-
const [hoverIndex, setHoverIndex] = useState(0);
|
|
371
|
-
const root = useMemo(() => host.current.getRootNode(), [host]);
|
|
372
|
-
const prevMousePosition = useRef({ x: -999, y: -999 });
|
|
373
|
-
const onMouseMove = useCallback((e) => {
|
|
374
|
-
const prevPos = prevMousePosition.current;
|
|
375
|
-
if (!prevPos) return;
|
|
376
|
-
const { x, y } = e;
|
|
377
|
-
prevPos.x = x;
|
|
378
|
-
prevPos.y = y;
|
|
379
|
-
}, []);
|
|
380
|
-
useEffect(() => {
|
|
381
|
-
if (size === 0 && show) hide == null ? void 0 : hide();
|
|
382
|
-
else if (hoverIndex >= size) setHoverIndex(0);
|
|
383
|
-
}, [size, show]);
|
|
384
|
-
const onHover = useCallback(
|
|
385
|
-
(index, after) => {
|
|
386
|
-
setHoverIndex((prev) => {
|
|
387
|
-
const next = typeof index === "function" ? index(prev) : index;
|
|
388
|
-
after == null ? void 0 : after(next);
|
|
389
|
-
return next;
|
|
390
|
-
});
|
|
636
|
+
const Menu = defineComponent({
|
|
637
|
+
props: {
|
|
638
|
+
ctx: {
|
|
639
|
+
type: Object,
|
|
640
|
+
required: true
|
|
391
641
|
},
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
const target = host.current.querySelector(
|
|
396
|
-
`[data-index="${index}"]`
|
|
397
|
-
);
|
|
398
|
-
const scrollRoot = host.current.querySelector(".menu-groups");
|
|
399
|
-
if (!target || !scrollRoot) return;
|
|
400
|
-
scrollRoot.scrollTop = target.offsetTop - scrollRoot.offsetTop;
|
|
401
|
-
}, []);
|
|
402
|
-
const runByIndex = useCallback(
|
|
403
|
-
(index) => {
|
|
404
|
-
const item = groups.flatMap((group) => group.items).at(index);
|
|
405
|
-
if (item && ctx) item.onRun(ctx);
|
|
406
|
-
hide == null ? void 0 : hide();
|
|
642
|
+
show: {
|
|
643
|
+
type: Object,
|
|
644
|
+
required: true
|
|
407
645
|
},
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
646
|
+
filter: {
|
|
647
|
+
type: Object,
|
|
648
|
+
required: true
|
|
649
|
+
},
|
|
650
|
+
hide: {
|
|
651
|
+
type: Function,
|
|
652
|
+
required: true
|
|
653
|
+
},
|
|
654
|
+
config: {
|
|
655
|
+
type: Object,
|
|
656
|
+
required: false
|
|
657
|
+
}
|
|
658
|
+
},
|
|
659
|
+
setup({ ctx, show, filter, hide, config }) {
|
|
660
|
+
const host = ref();
|
|
661
|
+
const groupInfo = computed(() => getGroups(filter.value, config, ctx));
|
|
662
|
+
const hoverIndex = ref(0);
|
|
663
|
+
const prevMousePosition = ref({ x: -999, y: -999 });
|
|
664
|
+
const onPointerMove = (e) => {
|
|
665
|
+
const { x, y } = e;
|
|
666
|
+
prevMousePosition.value = { x, y };
|
|
667
|
+
};
|
|
668
|
+
watch([groupInfo, show], () => {
|
|
669
|
+
const { size } = groupInfo.value;
|
|
670
|
+
if (size === 0 && show.value) hide();
|
|
671
|
+
else if (hoverIndex.value >= size) hoverIndex.value = 0;
|
|
672
|
+
});
|
|
673
|
+
const onHover = (index, after) => {
|
|
674
|
+
const prevHoverIndex = hoverIndex.value;
|
|
675
|
+
const next = typeof index === "function" ? index(prevHoverIndex) : index;
|
|
676
|
+
after == null ? void 0 : after(next);
|
|
677
|
+
hoverIndex.value = next;
|
|
678
|
+
};
|
|
679
|
+
const scrollToIndex = (index) => {
|
|
680
|
+
var _a, _b;
|
|
681
|
+
const target = (_a = host.value) == null ? void 0 : _a.querySelector(
|
|
682
|
+
`[data-index="${index}"]`
|
|
683
|
+
);
|
|
684
|
+
const scrollRoot = (_b = host.value) == null ? void 0 : _b.querySelector(".menu-groups");
|
|
685
|
+
if (!target || !scrollRoot) return;
|
|
686
|
+
scrollRoot.scrollTop = target.offsetTop - scrollRoot.offsetTop;
|
|
687
|
+
};
|
|
688
|
+
const runByIndex = (index) => {
|
|
689
|
+
const item = groupInfo.value.groups.flatMap((group) => group.items).at(index);
|
|
690
|
+
if (item && ctx) item.onRun(ctx);
|
|
691
|
+
hide();
|
|
692
|
+
};
|
|
693
|
+
const onKeydown = (e) => {
|
|
694
|
+
const { size, groups } = groupInfo.value;
|
|
412
695
|
if (e.key === "Escape") {
|
|
413
696
|
e.preventDefault();
|
|
414
697
|
hide == null ? void 0 : hide();
|
|
@@ -454,84 +737,59 @@ const menuComponent = ({
|
|
|
454
737
|
}
|
|
455
738
|
if (e.key === "Enter") {
|
|
456
739
|
e.preventDefault();
|
|
457
|
-
runByIndex(hoverIndex);
|
|
740
|
+
runByIndex(hoverIndex.value);
|
|
458
741
|
}
|
|
459
|
-
}
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
const onMouseEnter = useCallback((index) => {
|
|
463
|
-
return (e) => {
|
|
464
|
-
const prevPos = prevMousePosition.current;
|
|
742
|
+
};
|
|
743
|
+
const getOnPointerEnter = (index) => (e) => {
|
|
744
|
+
const prevPos = prevMousePosition.value;
|
|
465
745
|
if (!prevPos) return;
|
|
466
746
|
const { x, y } = e;
|
|
467
747
|
if (x === prevPos.x && y === prevPos.y) return;
|
|
468
748
|
onHover(index);
|
|
469
749
|
};
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
750
|
+
watchEffect(() => {
|
|
751
|
+
const isShown = show.value;
|
|
752
|
+
if (isShown) {
|
|
753
|
+
window.addEventListener("keydown", onKeydown, { capture: true });
|
|
754
|
+
} else {
|
|
755
|
+
window.removeEventListener("keydown", onKeydown, { capture: true });
|
|
756
|
+
}
|
|
757
|
+
});
|
|
758
|
+
onUnmounted(() => {
|
|
759
|
+
window.removeEventListener("keydown", onKeydown, { capture: true });
|
|
760
|
+
});
|
|
474
761
|
return () => {
|
|
475
|
-
|
|
762
|
+
return /* @__PURE__ */ h("div", { ref: host, onPointerdown: (e) => e.preventDefault() }, /* @__PURE__ */ h("nav", { class: "tab-group" }, /* @__PURE__ */ h("ul", null, groupInfo.value.groups.map((group) => /* @__PURE__ */ h(
|
|
763
|
+
"li",
|
|
764
|
+
{
|
|
765
|
+
key: group.key,
|
|
766
|
+
onPointerdown: () => onHover(group.range[0], scrollToIndex),
|
|
767
|
+
class: hoverIndex.value >= group.range[0] && hoverIndex.value < group.range[1] ? "selected" : ""
|
|
768
|
+
},
|
|
769
|
+
group.label
|
|
770
|
+
)))), /* @__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(
|
|
771
|
+
"li",
|
|
772
|
+
{
|
|
773
|
+
key: item.key,
|
|
774
|
+
"data-index": item.index,
|
|
775
|
+
class: hoverIndex.value === item.index ? "hover" : "",
|
|
776
|
+
onPointerenter: getOnPointerEnter(item.index),
|
|
777
|
+
onPointerdown: () => {
|
|
778
|
+
var _a, _b;
|
|
779
|
+
(_b = (_a = host.value) == null ? void 0 : _a.querySelector(`[data-index="${item.index}"]`)) == null ? void 0 : _b.classList.add("active");
|
|
780
|
+
},
|
|
781
|
+
onPointerup: () => {
|
|
782
|
+
var _a, _b;
|
|
783
|
+
(_b = (_a = host.value) == null ? void 0 : _a.querySelector(`[data-index="${item.index}"]`)) == null ? void 0 : _b.classList.remove("active");
|
|
784
|
+
runByIndex(item.index);
|
|
785
|
+
}
|
|
786
|
+
},
|
|
787
|
+
/* @__PURE__ */ h(Icon, { icon: item.icon }),
|
|
788
|
+
/* @__PURE__ */ h("span", null, item.label)
|
|
789
|
+
)))))));
|
|
476
790
|
};
|
|
477
|
-
}
|
|
478
|
-
|
|
479
|
-
<host onmousedown=${(e) => e.preventDefault()}>
|
|
480
|
-
<nav class="tab-group">
|
|
481
|
-
<ul>
|
|
482
|
-
${groups.map(
|
|
483
|
-
(group) => html`<li
|
|
484
|
-
key=${group.key}
|
|
485
|
-
onmousedown=${() => onHover(group.range[0], scrollToIndex)}
|
|
486
|
-
class=${hoverIndex >= group.range[0] && hoverIndex < group.range[1] ? "selected" : ""}
|
|
487
|
-
>
|
|
488
|
-
${group.label}
|
|
489
|
-
</li>`
|
|
490
|
-
)}
|
|
491
|
-
</ul>
|
|
492
|
-
</nav>
|
|
493
|
-
<div class="menu-groups" onmousemove=${onMouseMove}>
|
|
494
|
-
${groups.map((group) => {
|
|
495
|
-
return html`
|
|
496
|
-
<div key=${group.key} class="menu-group">
|
|
497
|
-
<h6>${group.label}</h6>
|
|
498
|
-
<ul>
|
|
499
|
-
${group.items.map(
|
|
500
|
-
(item) => html`<li
|
|
501
|
-
key=${item.key}
|
|
502
|
-
data-index=${item.index}
|
|
503
|
-
class=${hoverIndex === item.index ? "hover" : ""}
|
|
504
|
-
onmouseenter=${onMouseEnter(item.index)}
|
|
505
|
-
onmousedown=${() => {
|
|
506
|
-
var _a;
|
|
507
|
-
(_a = host.current.querySelector(`[data-index="${item.index}"]`)) == null ? void 0 : _a.classList.add("active");
|
|
508
|
-
}}
|
|
509
|
-
onmouseup=${() => {
|
|
510
|
-
var _a;
|
|
511
|
-
(_a = host.current.querySelector(`[data-index="${item.index}"]`)) == null ? void 0 : _a.classList.remove("active");
|
|
512
|
-
runByIndex(item.index);
|
|
513
|
-
}}
|
|
514
|
-
>
|
|
515
|
-
${item.icon}
|
|
516
|
-
<span>${item.label}</span>
|
|
517
|
-
</li>`
|
|
518
|
-
)}
|
|
519
|
-
</ul>
|
|
520
|
-
</div>
|
|
521
|
-
`;
|
|
522
|
-
})}
|
|
523
|
-
</div>
|
|
524
|
-
</host>
|
|
525
|
-
`;
|
|
526
|
-
};
|
|
527
|
-
menuComponent.props = {
|
|
528
|
-
ctx: Object,
|
|
529
|
-
config: Object,
|
|
530
|
-
show: Boolean,
|
|
531
|
-
filter: String,
|
|
532
|
-
hide: Function
|
|
533
|
-
};
|
|
534
|
-
const MenuElement = c(menuComponent);
|
|
791
|
+
}
|
|
792
|
+
});
|
|
535
793
|
|
|
536
794
|
var __typeError$1 = (msg) => {
|
|
537
795
|
throw TypeError(msg);
|
|
@@ -540,7 +798,7 @@ var __accessCheck$1 = (obj, member, msg) => member.has(obj) || __typeError$1("Ca
|
|
|
540
798
|
var __privateGet$1 = (obj, member, getter) => (__accessCheck$1(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
|
|
541
799
|
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);
|
|
542
800
|
var __privateSet$1 = (obj, member, value, setter) => (__accessCheck$1(obj, member, "write to private field"), member.set(obj, value), value);
|
|
543
|
-
var _content$1, _slashProvider, _programmaticallyPos;
|
|
801
|
+
var _content$1, _app$1, _filter, _slashProvider, _programmaticallyPos;
|
|
544
802
|
const menu = slashFactory("CREPE_MENU");
|
|
545
803
|
const menuAPI = $ctx(
|
|
546
804
|
{
|
|
@@ -551,7 +809,6 @@ const menuAPI = $ctx(
|
|
|
551
809
|
},
|
|
552
810
|
"menuAPICtx"
|
|
553
811
|
);
|
|
554
|
-
defIfNotExists("milkdown-slash-menu", MenuElement);
|
|
555
812
|
function configureMenu(ctx, config) {
|
|
556
813
|
ctx.set(menu.key, {
|
|
557
814
|
view: (view) => new MenuView(ctx, view, config)
|
|
@@ -560,6 +817,8 @@ function configureMenu(ctx, config) {
|
|
|
560
817
|
class MenuView {
|
|
561
818
|
constructor(ctx, view, config) {
|
|
562
819
|
__privateAdd$1(this, _content$1);
|
|
820
|
+
__privateAdd$1(this, _app$1);
|
|
821
|
+
__privateAdd$1(this, _filter);
|
|
563
822
|
__privateAdd$1(this, _slashProvider);
|
|
564
823
|
__privateAdd$1(this, _programmaticallyPos, null);
|
|
565
824
|
this.update = (view) => {
|
|
@@ -567,7 +826,7 @@ class MenuView {
|
|
|
567
826
|
};
|
|
568
827
|
this.show = (pos) => {
|
|
569
828
|
__privateSet$1(this, _programmaticallyPos, pos);
|
|
570
|
-
__privateGet$1(this,
|
|
829
|
+
__privateGet$1(this, _filter).value = "";
|
|
571
830
|
__privateGet$1(this, _slashProvider).show();
|
|
572
831
|
};
|
|
573
832
|
this.hide = () => {
|
|
@@ -576,12 +835,25 @@ class MenuView {
|
|
|
576
835
|
};
|
|
577
836
|
this.destroy = () => {
|
|
578
837
|
__privateGet$1(this, _slashProvider).destroy();
|
|
838
|
+
__privateGet$1(this, _app$1).unmount();
|
|
579
839
|
__privateGet$1(this, _content$1).remove();
|
|
580
840
|
};
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
841
|
+
const content = document.createElement("div");
|
|
842
|
+
content.classList.add("milkdown-slash-menu");
|
|
843
|
+
const show = ref(false);
|
|
844
|
+
const filter = ref("");
|
|
845
|
+
__privateSet$1(this, _filter, filter);
|
|
846
|
+
const hide = this.hide;
|
|
847
|
+
const app = createApp(Menu, {
|
|
848
|
+
ctx,
|
|
849
|
+
config,
|
|
850
|
+
show,
|
|
851
|
+
filter,
|
|
852
|
+
hide
|
|
853
|
+
});
|
|
854
|
+
__privateSet$1(this, _app$1, app);
|
|
855
|
+
app.mount(content);
|
|
856
|
+
__privateSet$1(this, _content$1, content);
|
|
585
857
|
const self = this;
|
|
586
858
|
__privateSet$1(this, _slashProvider, new SlashProvider({
|
|
587
859
|
content: __privateGet$1(this, _content$1),
|
|
@@ -598,7 +870,7 @@ class MenuView {
|
|
|
598
870
|
return false;
|
|
599
871
|
}
|
|
600
872
|
const pos = __privateGet$1(self, _programmaticallyPos);
|
|
601
|
-
|
|
873
|
+
filter.value = currentText.startsWith("/") ? currentText.slice(1) : currentText;
|
|
602
874
|
if (typeof pos === "number") {
|
|
603
875
|
if (view2.state.doc.resolve(pos).node() !== view2.state.doc.resolve(view2.state.selection.from).node()) {
|
|
604
876
|
__privateSet$1(self, _programmaticallyPos, null);
|
|
@@ -612,10 +884,10 @@ class MenuView {
|
|
|
612
884
|
offset: 10
|
|
613
885
|
}));
|
|
614
886
|
__privateGet$1(this, _slashProvider).onShow = () => {
|
|
615
|
-
|
|
887
|
+
show.value = true;
|
|
616
888
|
};
|
|
617
889
|
__privateGet$1(this, _slashProvider).onHide = () => {
|
|
618
|
-
|
|
890
|
+
show.value = false;
|
|
619
891
|
};
|
|
620
892
|
this.update(view);
|
|
621
893
|
ctx.set(menuAPI.key, {
|
|
@@ -625,6 +897,8 @@ class MenuView {
|
|
|
625
897
|
}
|
|
626
898
|
}
|
|
627
899
|
_content$1 = new WeakMap();
|
|
900
|
+
_app$1 = new WeakMap();
|
|
901
|
+
_filter = new WeakMap();
|
|
628
902
|
_slashProvider = new WeakMap();
|
|
629
903
|
_programmaticallyPos = new WeakMap();
|
|
630
904
|
function isSelectionAtEndOfNode(selection) {
|
|
@@ -635,50 +909,48 @@ function isSelectionAtEndOfNode(selection) {
|
|
|
635
909
|
return offset === parent.content.size;
|
|
636
910
|
}
|
|
637
911
|
|
|
638
|
-
const
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
}
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
};
|
|
681
|
-
const BlockHandleElement = c(blockHandleComponent);
|
|
912
|
+
const BlockHandle = defineComponent({
|
|
913
|
+
props: {
|
|
914
|
+
onAdd: {
|
|
915
|
+
type: Function,
|
|
916
|
+
required: true
|
|
917
|
+
},
|
|
918
|
+
addIcon: {
|
|
919
|
+
type: Function,
|
|
920
|
+
required: true
|
|
921
|
+
},
|
|
922
|
+
handleIcon: {
|
|
923
|
+
type: Function,
|
|
924
|
+
required: true
|
|
925
|
+
}
|
|
926
|
+
},
|
|
927
|
+
setup(props) {
|
|
928
|
+
const addButton = ref();
|
|
929
|
+
return () => {
|
|
930
|
+
return /* @__PURE__ */ h(Fragment, null, /* @__PURE__ */ h(
|
|
931
|
+
"div",
|
|
932
|
+
{
|
|
933
|
+
ref: addButton,
|
|
934
|
+
class: "operation-item",
|
|
935
|
+
onPointerdown: (e) => {
|
|
936
|
+
var _a;
|
|
937
|
+
e.preventDefault();
|
|
938
|
+
e.stopPropagation();
|
|
939
|
+
(_a = addButton.value) == null ? void 0 : _a.classList.add("active");
|
|
940
|
+
},
|
|
941
|
+
onPointerup: (e) => {
|
|
942
|
+
var _a;
|
|
943
|
+
e.preventDefault();
|
|
944
|
+
e.stopPropagation();
|
|
945
|
+
(_a = addButton.value) == null ? void 0 : _a.classList.remove("active");
|
|
946
|
+
props.onAdd();
|
|
947
|
+
}
|
|
948
|
+
},
|
|
949
|
+
/* @__PURE__ */ h(Icon, { icon: props.addIcon() })
|
|
950
|
+
), /* @__PURE__ */ h("div", { class: "operation-item" }, /* @__PURE__ */ h(Icon, { icon: props.handleIcon() })));
|
|
951
|
+
};
|
|
952
|
+
}
|
|
953
|
+
});
|
|
682
954
|
|
|
683
955
|
var __typeError = (msg) => {
|
|
684
956
|
throw TypeError(msg);
|
|
@@ -687,11 +959,12 @@ var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot
|
|
|
687
959
|
var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
|
|
688
960
|
var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
|
689
961
|
var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), member.set(obj, value), value);
|
|
690
|
-
var _content, _provider, _ctx;
|
|
962
|
+
var _content, _provider, _app, _ctx;
|
|
691
963
|
class BlockHandleView {
|
|
692
964
|
constructor(ctx, config) {
|
|
693
965
|
__privateAdd(this, _content);
|
|
694
966
|
__privateAdd(this, _provider);
|
|
967
|
+
__privateAdd(this, _app);
|
|
695
968
|
__privateAdd(this, _ctx);
|
|
696
969
|
this.update = () => {
|
|
697
970
|
__privateGet(this, _provider).update();
|
|
@@ -699,6 +972,7 @@ class BlockHandleView {
|
|
|
699
972
|
this.destroy = () => {
|
|
700
973
|
__privateGet(this, _provider).destroy();
|
|
701
974
|
__privateGet(this, _content).remove();
|
|
975
|
+
__privateGet(this, _app).unmount();
|
|
702
976
|
};
|
|
703
977
|
this.onAdd = () => {
|
|
704
978
|
const ctx = __privateGet(this, _ctx);
|
|
@@ -715,12 +989,18 @@ class BlockHandleView {
|
|
|
715
989
|
__privateGet(this, _provider).hide();
|
|
716
990
|
ctx.get(menuAPI.key).show(tr.selection.from);
|
|
717
991
|
};
|
|
992
|
+
var _a, _b;
|
|
718
993
|
__privateSet(this, _ctx, ctx);
|
|
719
|
-
const content =
|
|
994
|
+
const content = document.createElement("div");
|
|
995
|
+
content.classList.add("milkdown-block-handle");
|
|
996
|
+
const app = createApp(BlockHandle, {
|
|
997
|
+
onAdd: this.onAdd,
|
|
998
|
+
addIcon: (_a = config == null ? void 0 : config.handleAddIcon) != null ? _a : () => plusIcon,
|
|
999
|
+
handleIcon: (_b = config == null ? void 0 : config.handleDragIcon) != null ? _b : () => menuIcon
|
|
1000
|
+
});
|
|
1001
|
+
app.mount(content);
|
|
1002
|
+
__privateSet(this, _app, app);
|
|
720
1003
|
__privateSet(this, _content, content);
|
|
721
|
-
__privateGet(this, _content).onAdd = this.onAdd;
|
|
722
|
-
__privateGet(this, _content).addIcon = config == null ? void 0 : config.handleAddIcon;
|
|
723
|
-
__privateGet(this, _content).handleIcon = config == null ? void 0 : config.handleDragIcon;
|
|
724
1004
|
__privateSet(this, _provider, new BlockProvider({
|
|
725
1005
|
ctx,
|
|
726
1006
|
content,
|
|
@@ -747,8 +1027,8 @@ class BlockHandleView {
|
|
|
747
1027
|
}
|
|
748
1028
|
_content = new WeakMap();
|
|
749
1029
|
_provider = new WeakMap();
|
|
1030
|
+
_app = new WeakMap();
|
|
750
1031
|
_ctx = new WeakMap();
|
|
751
|
-
defIfNotExists("milkdown-block-handle", BlockHandleElement);
|
|
752
1032
|
function configureBlockHandle(ctx, config) {
|
|
753
1033
|
ctx.set(blockConfig.key, {
|
|
754
1034
|
filterNodes: (pos) => {
|
|
@@ -769,4 +1049,4 @@ const defineFeature = (editor, config) => {
|
|
|
769
1049
|
};
|
|
770
1050
|
|
|
771
1051
|
export { defineFeature };
|
|
772
|
-
//# sourceMappingURL=index-
|
|
1052
|
+
//# sourceMappingURL=index-CM4urRY9.js.map
|