@jvs-milkdown/crepe 1.2.4 → 1.2.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/builder.js +2 -0
- package/lib/cjs/builder.js.map +1 -1
- package/lib/cjs/feature/block-edit/index.js +6 -2
- package/lib/cjs/feature/block-edit/index.js.map +1 -1
- package/lib/cjs/feature/code-mirror/index.js +2 -0
- package/lib/cjs/feature/code-mirror/index.js.map +1 -1
- package/lib/cjs/feature/cursor/index.js +2 -0
- package/lib/cjs/feature/cursor/index.js.map +1 -1
- package/lib/cjs/feature/image-block/index.js +3 -4
- package/lib/cjs/feature/image-block/index.js.map +1 -1
- package/lib/cjs/feature/latex/index.js +2 -0
- package/lib/cjs/feature/latex/index.js.map +1 -1
- package/lib/cjs/feature/link-tooltip/index.js +2 -0
- package/lib/cjs/feature/link-tooltip/index.js.map +1 -1
- package/lib/cjs/feature/list-item/index.js +2 -0
- package/lib/cjs/feature/list-item/index.js.map +1 -1
- package/lib/cjs/feature/placeholder/index.js +4 -1
- package/lib/cjs/feature/placeholder/index.js.map +1 -1
- package/lib/cjs/feature/table/index.js +2 -0
- package/lib/cjs/feature/table/index.js.map +1 -1
- package/lib/cjs/feature/toolbar/index.js +242 -7
- package/lib/cjs/feature/toolbar/index.js.map +1 -1
- package/lib/cjs/index.js +1254 -960
- package/lib/cjs/index.js.map +1 -1
- package/lib/esm/builder.js +2 -0
- package/lib/esm/builder.js.map +1 -1
- package/lib/esm/feature/block-edit/index.js +6 -2
- package/lib/esm/feature/block-edit/index.js.map +1 -1
- package/lib/esm/feature/code-mirror/index.js +2 -0
- package/lib/esm/feature/code-mirror/index.js.map +1 -1
- package/lib/esm/feature/cursor/index.js +2 -0
- package/lib/esm/feature/cursor/index.js.map +1 -1
- package/lib/esm/feature/image-block/index.js +3 -4
- package/lib/esm/feature/image-block/index.js.map +1 -1
- package/lib/esm/feature/latex/index.js +2 -0
- package/lib/esm/feature/latex/index.js.map +1 -1
- package/lib/esm/feature/link-tooltip/index.js +2 -0
- package/lib/esm/feature/link-tooltip/index.js.map +1 -1
- package/lib/esm/feature/list-item/index.js +2 -0
- package/lib/esm/feature/list-item/index.js.map +1 -1
- package/lib/esm/feature/placeholder/index.js +4 -1
- package/lib/esm/feature/placeholder/index.js.map +1 -1
- package/lib/esm/feature/table/index.js +2 -0
- package/lib/esm/feature/table/index.js.map +1 -1
- package/lib/esm/feature/toolbar/index.js +242 -7
- package/lib/esm/feature/toolbar/index.js.map +1 -1
- package/lib/esm/index.js +1329 -1035
- package/lib/esm/index.js.map +1 -1
- package/lib/theme/common/table.css +11 -7
- package/lib/theme/common/toolbar.css +6 -6
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/lib/types/core/locale.d.ts +2 -0
- package/lib/types/core/locale.d.ts.map +1 -1
- package/lib/types/feature/attachment/view/components/attachment-block.d.ts.map +1 -1
- package/lib/types/feature/attachment/view/index.d.ts.map +1 -1
- package/lib/types/feature/block-edit/handle/component.d.ts.map +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/api.d.ts.map +1 -1
- package/lib/types/feature/block-edit/menu/component.d.ts.map +1 -1
- package/lib/types/feature/block-edit/menu/index.d.ts.map +1 -1
- package/lib/types/feature/fixed-toolbar/component.d.ts.map +1 -1
- package/lib/types/feature/fixed-toolbar/config.d.ts +9 -1
- package/lib/types/feature/fixed-toolbar/config.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/fixed-toolbar/outline-panel.d.ts.map +1 -1
- package/lib/types/feature/fixed-toolbar/shortcut-help-modal.d.ts.map +1 -1
- package/lib/types/feature/fixed-toolbar/view-menu-state.d.ts.map +1 -1
- package/lib/types/feature/index.d.ts +1 -1
- package/lib/types/feature/index.d.ts.map +1 -1
- 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/loader.d.ts.map +1 -1
- package/lib/types/feature/placeholder/index.d.ts.map +1 -1
- package/lib/types/feature/toolbar/color.d.ts +1 -1
- package/lib/types/feature/toolbar/color.d.ts.map +1 -1
- package/lib/types/feature/toolbar/component.d.ts.map +1 -1
- package/lib/types/feature/toolbar/font.d.ts +1 -1
- package/lib/types/feature/toolbar/highlight-mark.d.ts +1 -1
- package/lib/types/feature/toolbar/index.d.ts.map +1 -1
- package/lib/types/feature/toolbar/underline.d.ts +1 -1
- package/lib/types/icons/crop.d.ts +1 -1
- package/lib/types/icons/crop.d.ts.map +1 -1
- package/lib/types/icons/format-painter.d.ts +2 -0
- package/lib/types/icons/format-painter.d.ts.map +1 -0
- package/lib/types/icons/index.d.ts +1 -0
- package/lib/types/icons/index.d.ts.map +1 -1
- package/package.json +4 -4
- package/src/core/locale.ts +2 -0
- package/src/feature/attachment/view/components/attachment-block.tsx +12 -7
- package/src/feature/attachment/view/index.ts +1 -0
- package/src/feature/block-edit/handle/component.tsx +5 -4
- package/src/feature/block-edit/handle/index.ts +1 -0
- package/src/feature/block-edit/index.ts +4 -1
- package/src/feature/block-edit/menu/api.ts +6 -1
- package/src/feature/block-edit/menu/component.tsx +49 -46
- package/src/feature/block-edit/menu/index.ts +1 -0
- package/src/feature/fixed-toolbar/component.tsx +3 -2
- package/src/feature/fixed-toolbar/config.ts +198 -146
- package/src/feature/fixed-toolbar/document-header.tsx +45 -14
- package/src/feature/fixed-toolbar/index.ts +2 -1
- package/src/feature/fixed-toolbar/menu-bar.tsx +15 -10
- package/src/feature/fixed-toolbar/outline-panel.tsx +17 -16
- package/src/feature/fixed-toolbar/shortcut-help-modal.tsx +3 -2
- package/src/feature/fixed-toolbar/view-menu-state.ts +1 -0
- package/src/feature/index.ts +1 -1
- package/src/feature/latex/inline-tooltip/component.tsx +3 -2
- package/src/feature/latex/inline-tooltip/view.ts +1 -0
- package/src/feature/loader.ts +1 -1
- package/src/feature/placeholder/index.ts +2 -1
- package/src/feature/toolbar/color.ts +77 -73
- package/src/feature/toolbar/component.tsx +321 -35
- package/src/feature/toolbar/index.ts +1 -0
- package/src/icons/align-center.ts +1 -1
- package/src/icons/bold.ts +1 -1
- package/src/icons/bullet-list.ts +1 -1
- package/src/icons/crop.ts +1 -4
- package/src/icons/divider.ts +1 -1
- package/src/icons/format-painter.ts +5 -0
- package/src/icons/h2.ts +1 -1
- package/src/icons/index.ts +1 -0
- package/src/icons/ordered-list.ts +1 -1
- package/src/icons/quote.ts +1 -1
- package/src/icons/strikethrough.ts +1 -1
- package/src/icons/text.ts +0 -1
- package/src/theme/common/table.css +11 -7
- package/src/theme/common/toolbar.css +6 -6
- package/src/feature/table/test.ts +0 -9
|
@@ -9,6 +9,7 @@ import {
|
|
|
9
9
|
} from '@jvs-milkdown/kit/preset/commonmark'
|
|
10
10
|
import { createTable } from '@jvs-milkdown/kit/preset/gfm'
|
|
11
11
|
import { TextSelection, NodeSelection } from '@jvs-milkdown/kit/prose/state'
|
|
12
|
+
// @ts-ignore
|
|
12
13
|
import {
|
|
13
14
|
computed,
|
|
14
15
|
defineComponent,
|
|
@@ -81,7 +82,7 @@ export const Menu = defineComponent<MenuProps>({
|
|
|
81
82
|
required: false,
|
|
82
83
|
},
|
|
83
84
|
},
|
|
84
|
-
setup({ ctx, show, filter, hide, config, activeKey }) {
|
|
85
|
+
setup({ ctx, show, filter, hide, config, activeKey }: any) {
|
|
85
86
|
const host = ref<HTMLElement>()
|
|
86
87
|
const groupInfo = computed(() => getGroups(filter.value, config, ctx))
|
|
87
88
|
const hoverIndex = ref(0)
|
|
@@ -240,7 +241,7 @@ export const Menu = defineComponent<MenuProps>({
|
|
|
240
241
|
|
|
241
242
|
watch(
|
|
242
243
|
[groupInfo, show],
|
|
243
|
-
([newGroupInfo, newShow], [oldGroupInfo, oldShow]) => {
|
|
244
|
+
([newGroupInfo, newShow]: any, [oldGroupInfo, oldShow]: any) => {
|
|
244
245
|
const { size } = newGroupInfo
|
|
245
246
|
if (size === 0 && newShow) {
|
|
246
247
|
hide()
|
|
@@ -248,7 +249,7 @@ export const Menu = defineComponent<MenuProps>({
|
|
|
248
249
|
}
|
|
249
250
|
|
|
250
251
|
if (newShow && newShow !== oldShow) {
|
|
251
|
-
const items = newGroupInfo.groups.flatMap((g) => g.items)
|
|
252
|
+
const items = newGroupInfo.groups.flatMap((g: any) => g.items)
|
|
252
253
|
const api = ctx.get(menuAPI.key)
|
|
253
254
|
const isSlash = api?.getMode() === 'list' || !api?.isProgrammatic()
|
|
254
255
|
|
|
@@ -262,7 +263,7 @@ export const Menu = defineComponent<MenuProps>({
|
|
|
262
263
|
}
|
|
263
264
|
}, 0)
|
|
264
265
|
} else {
|
|
265
|
-
const target = items.find((i) => i.key === activeKey.value)
|
|
266
|
+
const target = items.find((i: any) => i.key === activeKey.value)
|
|
266
267
|
hoverIndex.value = target ? target.index : 0
|
|
267
268
|
setTimeout(() => scrollToIndex(hoverIndex.value), 0)
|
|
268
269
|
}
|
|
@@ -304,7 +305,7 @@ export const Menu = defineComponent<MenuProps>({
|
|
|
304
305
|
|
|
305
306
|
const runByIndex = (index: number) => {
|
|
306
307
|
const item = groupInfo.value.groups
|
|
307
|
-
.flatMap((group) => group.items)
|
|
308
|
+
.flatMap((group: any) => group.items)
|
|
308
309
|
.at(index)
|
|
309
310
|
if (item && ctx) {
|
|
310
311
|
const api = ctx.get(menuAPI.key)
|
|
@@ -332,7 +333,7 @@ export const Menu = defineComponent<MenuProps>({
|
|
|
332
333
|
|
|
333
334
|
const runByIndexForAddBelow = (index: number) => {
|
|
334
335
|
const item = groupInfo.value.groups
|
|
335
|
-
.flatMap((group) => group.items)
|
|
336
|
+
.flatMap((group: any) => group.items)
|
|
336
337
|
.at(index)
|
|
337
338
|
if (item && ctx) {
|
|
338
339
|
const api = ctx.get(menuAPI.key)
|
|
@@ -390,7 +391,7 @@ export const Menu = defineComponent<MenuProps>({
|
|
|
390
391
|
e.preventDefault()
|
|
391
392
|
return onHover((index) => {
|
|
392
393
|
const group = groups.find(
|
|
393
|
-
(group) => group.range[0] <= index && group.range[1] > index
|
|
394
|
+
(group: any) => group.range[0] <= index && group.range[1] > index
|
|
394
395
|
)
|
|
395
396
|
if (!group) return index
|
|
396
397
|
|
|
@@ -405,7 +406,7 @@ export const Menu = defineComponent<MenuProps>({
|
|
|
405
406
|
e.preventDefault()
|
|
406
407
|
return onHover((index) => {
|
|
407
408
|
const group = groups.find(
|
|
408
|
-
(group) => group.range[0] <= index && group.range[1] > index
|
|
409
|
+
(group: any) => group.range[0] <= index && group.range[1] > index
|
|
409
410
|
)
|
|
410
411
|
if (!group) return index
|
|
411
412
|
|
|
@@ -447,7 +448,7 @@ export const Menu = defineComponent<MenuProps>({
|
|
|
447
448
|
return () => {
|
|
448
449
|
// Force vue to track the `show` ref so it correctly re-evaluates `api.isProgrammatic()`
|
|
449
450
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
450
|
-
show.value
|
|
451
|
+
void show.value
|
|
451
452
|
const api = ctx.get(menuAPI.key)
|
|
452
453
|
const showListMenu =
|
|
453
454
|
api?.getMode() === 'list' ||
|
|
@@ -456,13 +457,13 @@ export const Menu = defineComponent<MenuProps>({
|
|
|
456
457
|
|
|
457
458
|
if (showListMenu) {
|
|
458
459
|
return (
|
|
459
|
-
<div ref={host} onPointerdown={(e) => e.preventDefault()}>
|
|
460
|
+
<div ref={host} onPointerdown={(e: any) => e.preventDefault()}>
|
|
460
461
|
<div class="menu-groups" onPointermove={onPointerMove}>
|
|
461
|
-
{groupInfo.value.groups.map((group) => (
|
|
462
|
+
{groupInfo.value.groups.map((group: any) => (
|
|
462
463
|
<div key={group.key} class="menu-group">
|
|
463
464
|
<h6>{group.label}</h6>
|
|
464
465
|
<ul>
|
|
465
|
-
{group.items.map((item) => (
|
|
466
|
+
{group.items.map((item: any) => (
|
|
466
467
|
<li
|
|
467
468
|
key={item.key}
|
|
468
469
|
data-index={item.index}
|
|
@@ -472,7 +473,7 @@ export const Menu = defineComponent<MenuProps>({
|
|
|
472
473
|
hoverIndex.value === item.index ? 'hover' : '',
|
|
473
474
|
item.key === activeKey.value ? 'selected' : '',
|
|
474
475
|
]}
|
|
475
|
-
onPointerenter={(e) => {
|
|
476
|
+
onPointerenter={(e: any) => {
|
|
476
477
|
getOnPointerEnter(item.index)(e)
|
|
477
478
|
if (item.key === 'table') handleTableEnter(e)
|
|
478
479
|
else {
|
|
@@ -484,7 +485,7 @@ export const Menu = defineComponent<MenuProps>({
|
|
|
484
485
|
onPointerleave={() => {
|
|
485
486
|
if (item.key === 'table') handleTableLeave()
|
|
486
487
|
}}
|
|
487
|
-
onPointerdown={(e) => {
|
|
488
|
+
onPointerdown={(e: any) => {
|
|
488
489
|
if (item.key === 'table') {
|
|
489
490
|
e.preventDefault()
|
|
490
491
|
e.stopPropagation()
|
|
@@ -494,7 +495,7 @@ export const Menu = defineComponent<MenuProps>({
|
|
|
494
495
|
?.querySelector(`[data-index="${item.index}"]`)
|
|
495
496
|
?.classList.add('active')
|
|
496
497
|
}}
|
|
497
|
-
onPointerup={(e) => {
|
|
498
|
+
onPointerup={(e: any) => {
|
|
498
499
|
if (item.key === 'table') {
|
|
499
500
|
e.preventDefault()
|
|
500
501
|
e.stopPropagation()
|
|
@@ -592,11 +593,11 @@ export const Menu = defineComponent<MenuProps>({
|
|
|
592
593
|
onPointerenter={() => {
|
|
593
594
|
tableHoverIndices.value = { r: r + 1, c: c + 1 }
|
|
594
595
|
}}
|
|
595
|
-
onPointerdown={(e) => {
|
|
596
|
+
onPointerdown={(e: any) => {
|
|
596
597
|
e.preventDefault()
|
|
597
598
|
e.stopPropagation()
|
|
598
599
|
}}
|
|
599
|
-
onPointerup={(e) => {
|
|
600
|
+
onPointerup={(e: any) => {
|
|
600
601
|
e.preventDefault()
|
|
601
602
|
e.stopPropagation()
|
|
602
603
|
runTableInsert(r + 1, c + 1)
|
|
@@ -635,8 +636,8 @@ export const Menu = defineComponent<MenuProps>({
|
|
|
635
636
|
)
|
|
636
637
|
}
|
|
637
638
|
|
|
638
|
-
const allItems = groupInfo.value.groups.flatMap((g) => g.items)
|
|
639
|
-
const findItem = (key: string) => allItems.find((i) => i.key === key)
|
|
639
|
+
const allItems = groupInfo.value.groups.flatMap((g: any) => g.items)
|
|
640
|
+
const findItem = (key: string) => allItems.find((i: any) => i.key === key)
|
|
640
641
|
|
|
641
642
|
const allGridKeys = [
|
|
642
643
|
'text',
|
|
@@ -663,7 +664,7 @@ export const Menu = defineComponent<MenuProps>({
|
|
|
663
664
|
|
|
664
665
|
let hasImageChild = false
|
|
665
666
|
if (node?.type.name === 'paragraph') {
|
|
666
|
-
node.content.forEach((child) => {
|
|
667
|
+
node.content.forEach((child: any) => {
|
|
667
668
|
if (child.type.name.includes('image')) {
|
|
668
669
|
hasImageChild = true
|
|
669
670
|
}
|
|
@@ -728,16 +729,16 @@ export const Menu = defineComponent<MenuProps>({
|
|
|
728
729
|
let activeBgColor: string | null = null
|
|
729
730
|
|
|
730
731
|
if (node && node.nodeSize > 2) {
|
|
731
|
-
node.descendants((childNode) => {
|
|
732
|
+
node.descendants((childNode: any) => {
|
|
732
733
|
if (childNode.isText) {
|
|
733
734
|
const tcType = textColorSchema.type(ctx)
|
|
734
735
|
const bcType = bgColorSchema.type(ctx)
|
|
735
736
|
if (!activeTextColor) {
|
|
736
|
-
const tcMark = childNode.marks.find((m) => m.type === tcType)
|
|
737
|
+
const tcMark = childNode.marks.find((m: any) => m.type === tcType)
|
|
737
738
|
if (tcMark) activeTextColor = tcMark.attrs.color
|
|
738
739
|
}
|
|
739
740
|
if (!activeBgColor) {
|
|
740
|
-
const bcMark = childNode.marks.find((m) => m.type === bcType)
|
|
741
|
+
const bcMark = childNode.marks.find((m: any) => m.type === bcType)
|
|
741
742
|
if (bcMark) activeBgColor = bcMark.attrs.color
|
|
742
743
|
}
|
|
743
744
|
}
|
|
@@ -874,11 +875,11 @@ export const Menu = defineComponent<MenuProps>({
|
|
|
874
875
|
class="custom-menu-row"
|
|
875
876
|
onPointerenter={onPointerEnter}
|
|
876
877
|
onPointerleave={onPointerLeave}
|
|
877
|
-
onPointerdown={(e) => {
|
|
878
|
+
onPointerdown={(e: any) => {
|
|
878
879
|
e.preventDefault()
|
|
879
880
|
e.stopPropagation()
|
|
880
881
|
}}
|
|
881
|
-
onPointerup={(e) => {
|
|
882
|
+
onPointerup={(e: any) => {
|
|
882
883
|
e.preventDefault()
|
|
883
884
|
e.stopPropagation()
|
|
884
885
|
onClick?.()
|
|
@@ -907,11 +908,11 @@ export const Menu = defineComponent<MenuProps>({
|
|
|
907
908
|
opacity: disabled ? 0.5 : 1,
|
|
908
909
|
cursor: disabled ? 'not-allowed' : 'pointer',
|
|
909
910
|
}}
|
|
910
|
-
onPointerdown={(e) => {
|
|
911
|
+
onPointerdown={(e: any) => {
|
|
911
912
|
e.preventDefault()
|
|
912
913
|
e.stopPropagation()
|
|
913
914
|
}}
|
|
914
|
-
onPointerup={(e) => {
|
|
915
|
+
onPointerup={(e: any) => {
|
|
915
916
|
e.preventDefault()
|
|
916
917
|
e.stopPropagation()
|
|
917
918
|
if (!disabled) onClick()
|
|
@@ -939,12 +940,12 @@ export const Menu = defineComponent<MenuProps>({
|
|
|
939
940
|
return (
|
|
940
941
|
<div
|
|
941
942
|
ref={host}
|
|
942
|
-
onPointerdown={(e) => e.preventDefault()}
|
|
943
|
+
onPointerdown={(e: any) => e.preventDefault()}
|
|
943
944
|
class="custom-block-menu"
|
|
944
945
|
>
|
|
945
946
|
{!isMedia ? (
|
|
946
947
|
<div class="custom-grid-container">
|
|
947
|
-
{gridRows.map((rowKeys, rIndex) => (
|
|
948
|
+
{gridRows.map((rowKeys: any, rIndex: any) => (
|
|
948
949
|
<div class="custom-grid-row" key={'row-' + rIndex}>
|
|
949
950
|
{rowKeys.map(renderGridBtn)}
|
|
950
951
|
</div>
|
|
@@ -1064,14 +1065,14 @@ export const Menu = defineComponent<MenuProps>({
|
|
|
1064
1065
|
'#52C41A',
|
|
1065
1066
|
'#1677FF',
|
|
1066
1067
|
'#722ED1',
|
|
1067
|
-
].map((color) => (
|
|
1068
|
+
].map((color: any) => (
|
|
1068
1069
|
<div
|
|
1069
1070
|
key={color}
|
|
1070
|
-
onPointerdown={(e) => {
|
|
1071
|
+
onPointerdown={(e: any) => {
|
|
1071
1072
|
e.preventDefault()
|
|
1072
1073
|
e.stopPropagation()
|
|
1073
1074
|
}}
|
|
1074
|
-
onPointerup={(e) => {
|
|
1075
|
+
onPointerup={(e: any) => {
|
|
1075
1076
|
e.preventDefault()
|
|
1076
1077
|
e.stopPropagation()
|
|
1077
1078
|
setTextColor(color)
|
|
@@ -1119,14 +1120,14 @@ export const Menu = defineComponent<MenuProps>({
|
|
|
1119
1120
|
'#D9F7BE',
|
|
1120
1121
|
'#D6E4FF',
|
|
1121
1122
|
'#EFDBFF',
|
|
1122
|
-
].map((color) => (
|
|
1123
|
+
].map((color: any) => (
|
|
1123
1124
|
<div
|
|
1124
1125
|
key={color}
|
|
1125
|
-
onPointerdown={(e) => {
|
|
1126
|
+
onPointerdown={(e: any) => {
|
|
1126
1127
|
e.preventDefault()
|
|
1127
1128
|
e.stopPropagation()
|
|
1128
1129
|
}}
|
|
1129
|
-
onPointerup={(e) => {
|
|
1130
|
+
onPointerup={(e: any) => {
|
|
1130
1131
|
e.preventDefault()
|
|
1131
1132
|
e.stopPropagation()
|
|
1132
1133
|
setBgColor(color === 'transparent' ? null : color)
|
|
@@ -1172,14 +1173,14 @@ export const Menu = defineComponent<MenuProps>({
|
|
|
1172
1173
|
'#52C41A',
|
|
1173
1174
|
'#1677FF',
|
|
1174
1175
|
'#722ED1',
|
|
1175
|
-
].map((color) => (
|
|
1176
|
+
].map((color: any) => (
|
|
1176
1177
|
<div
|
|
1177
1178
|
key={color}
|
|
1178
|
-
onPointerdown={(e) => {
|
|
1179
|
+
onPointerdown={(e: any) => {
|
|
1179
1180
|
e.preventDefault()
|
|
1180
1181
|
e.stopPropagation()
|
|
1181
1182
|
}}
|
|
1182
|
-
onPointerup={(e) => {
|
|
1183
|
+
onPointerup={(e: any) => {
|
|
1183
1184
|
e.preventDefault()
|
|
1184
1185
|
e.stopPropagation()
|
|
1185
1186
|
setBgColor(color)
|
|
@@ -1200,11 +1201,11 @@ export const Menu = defineComponent<MenuProps>({
|
|
|
1200
1201
|
</div>
|
|
1201
1202
|
|
|
1202
1203
|
<button
|
|
1203
|
-
onPointerdown={(e) => {
|
|
1204
|
+
onPointerdown={(e: any) => {
|
|
1204
1205
|
e.preventDefault()
|
|
1205
1206
|
e.stopPropagation()
|
|
1206
1207
|
}}
|
|
1207
|
-
onPointerup={(e) => {
|
|
1208
|
+
onPointerup={(e: any) => {
|
|
1208
1209
|
e.preventDefault()
|
|
1209
1210
|
e.stopPropagation()
|
|
1210
1211
|
clearColor()
|
|
@@ -1284,11 +1285,11 @@ export const Menu = defineComponent<MenuProps>({
|
|
|
1284
1285
|
onPointermove={onPointerMove}
|
|
1285
1286
|
style={{ maxHeight: '300px', overflowY: 'auto' }}
|
|
1286
1287
|
>
|
|
1287
|
-
{groupInfo.value.groups.map((group) => (
|
|
1288
|
+
{groupInfo.value.groups.map((group: any) => (
|
|
1288
1289
|
<div key={group.key} class="menu-group">
|
|
1289
1290
|
<h6>{group.label}</h6>
|
|
1290
1291
|
<ul>
|
|
1291
|
-
{group.items.map((item) => (
|
|
1292
|
+
{group.items.map((item: any) => (
|
|
1292
1293
|
<li
|
|
1293
1294
|
key={item.key}
|
|
1294
1295
|
data-index={item.index}
|
|
@@ -1298,19 +1299,21 @@ export const Menu = defineComponent<MenuProps>({
|
|
|
1298
1299
|
item.key === activeKey.value ? 'selected' : '',
|
|
1299
1300
|
]}
|
|
1300
1301
|
onPointerenter={getOnPointerEnter(item.index)}
|
|
1301
|
-
onPointerdown={(e) => {
|
|
1302
|
+
onPointerdown={(e: PointerEvent) => {
|
|
1302
1303
|
e.preventDefault()
|
|
1303
1304
|
e.stopPropagation()
|
|
1304
1305
|
host.value
|
|
1305
1306
|
?.querySelectorAll(`[data-index="${item.index}"]`)
|
|
1306
|
-
.forEach((el) => el.classList.add('active'))
|
|
1307
|
+
.forEach((el: any) => el.classList.add('active'))
|
|
1307
1308
|
}}
|
|
1308
|
-
onPointerup={(e) => {
|
|
1309
|
+
onPointerup={(e: PointerEvent) => {
|
|
1309
1310
|
e.preventDefault()
|
|
1310
1311
|
e.stopPropagation()
|
|
1311
1312
|
host.value
|
|
1312
1313
|
?.querySelectorAll(`[data-index="${item.index}"]`)
|
|
1313
|
-
.forEach((el) =>
|
|
1314
|
+
.forEach((el: any) =>
|
|
1315
|
+
el.classList.remove('active')
|
|
1316
|
+
)
|
|
1314
1317
|
runByIndexForAddBelow(item.index)
|
|
1315
1318
|
}}
|
|
1316
1319
|
>
|
|
@@ -2,7 +2,8 @@ import type { Ctx } from '@jvs-milkdown/kit/ctx'
|
|
|
2
2
|
import type { Selection } from '@jvs-milkdown/kit/prose/state'
|
|
3
3
|
|
|
4
4
|
import { Icon } from '@jvs-milkdown/kit/component'
|
|
5
|
-
|
|
5
|
+
// @ts-ignore
|
|
6
|
+
import { defineComponent, type ShallowRef, type Ref, ref } from 'vue'
|
|
6
7
|
|
|
7
8
|
import type { FixedToolbarFeatureConfig } from '.'
|
|
8
9
|
|
|
@@ -28,7 +29,7 @@ export const FixedToolbarComponent = defineComponent<FixedToolbarProps>({
|
|
|
28
29
|
selection: { type: Object, required: true },
|
|
29
30
|
config: { type: Object, required: false },
|
|
30
31
|
},
|
|
31
|
-
setup(props) {
|
|
32
|
+
setup(props: any) {
|
|
32
33
|
const showShortcuts = ref(false)
|
|
33
34
|
|
|
34
35
|
return () => (
|