@jvs-milkdown/crepe 1.2.31 → 1.2.33
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/toolbar/index.js.map +1 -1
- package/lib/cjs/index.js +48 -31
- package/lib/cjs/index.js.map +1 -1
- package/lib/esm/feature/toolbar/index.js.map +1 -1
- package/lib/esm/index.js +48 -31
- package/lib/esm/index.js.map +1 -1
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/lib/types/feature/fixed-toolbar/component.d.ts.map +1 -1
- package/lib/types/feature/toolbar/component.d.ts.map +1 -1
- package/package.json +4 -4
- package/src/feature/fixed-toolbar/component.tsx +47 -32
- package/src/feature/fixed-toolbar/index.ts +1 -1
- package/src/feature/toolbar/component.tsx +19 -20
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"component.d.ts","sourceRoot":"","sources":["../../../../src/feature/fixed-toolbar/component.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,uBAAuB,CAAA;AAChD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAA;AAGhE,OAAO,EAEL,KAAK,UAAU,EACf,KAAK,GAAG,EAMT,MAAM,KAAK,CAAA;AAEZ,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,GAAG,CAAA;AAalD,KAAK,iBAAiB,GAAG;IACvB,GAAG,EAAE,GAAG,CAAA;IACR,IAAI,EAAE,MAAM,IAAI,CAAA;IAChB,IAAI,EAAE,GAAG,CAAC,OAAO,CAAC,CAAA;IAClB,KAAK,EAAE,UAAU,CAAC,WAAW,CAAC,CAAA;IAC9B,MAAM,CAAC,EAAE,yBAAyB,CAAA;IAClC,OAAO,EAAE,GAAG,CAAC,OAAO,CAAC,CAAA;IACrB,OAAO,EAAE,GAAG,CAAC,OAAO,CAAC,CAAA;CACtB,CAAA;AAED,eAAO,MAAM,qBAAqB,
|
|
1
|
+
{"version":3,"file":"component.d.ts","sourceRoot":"","sources":["../../../../src/feature/fixed-toolbar/component.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,uBAAuB,CAAA;AAChD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAA;AAGhE,OAAO,EAEL,KAAK,UAAU,EACf,KAAK,GAAG,EAMT,MAAM,KAAK,CAAA;AAEZ,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,GAAG,CAAA;AAalD,KAAK,iBAAiB,GAAG;IACvB,GAAG,EAAE,GAAG,CAAA;IACR,IAAI,EAAE,MAAM,IAAI,CAAA;IAChB,IAAI,EAAE,GAAG,CAAC,OAAO,CAAC,CAAA;IAClB,KAAK,EAAE,UAAU,CAAC,WAAW,CAAC,CAAA;IAC9B,MAAM,CAAC,EAAE,yBAAyB,CAAA;IAClC,OAAO,EAAE,GAAG,CAAC,OAAO,CAAC,CAAA;IACrB,OAAO,EAAE,GAAG,CAAC,OAAO,CAAC,CAAA;CACtB,CAAA;AAED,eAAO,MAAM,qBAAqB,oXAsQhC,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"component.d.ts","sourceRoot":"","sources":["../../../../src/feature/toolbar/component.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,uBAAuB,CAAA;AAEhD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAA;AAyBhE,OAAO,EAEL,KAAK,GAAG,EACR,KAAK,UAAU,EAQhB,MAAM,KAAK,CAAA;AAEZ,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,GAAG,CAAA;AAmG7C,KAAK,YAAY,GAAG;IAClB,GAAG,EAAE,GAAG,CAAA;IACR,IAAI,EAAE,MAAM,IAAI,CAAA;IAChB,IAAI,EAAE,GAAG,CAAC,OAAO,CAAC,CAAA;IAClB,KAAK,EAAE,UAAU,CAAC,WAAW,CAAC,CAAA;IAC9B,MAAM,CAAC,EAAE,oBAAoB,CAAA;IAC7B,OAAO,CAAC,EAAE,OAAO,CAAA;CAClB,CAAA;AAeD,eAAO,MAAM,OAAO,
|
|
1
|
+
{"version":3,"file":"component.d.ts","sourceRoot":"","sources":["../../../../src/feature/toolbar/component.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,uBAAuB,CAAA;AAEhD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAA;AAyBhE,OAAO,EAEL,KAAK,GAAG,EACR,KAAK,UAAU,EAQhB,MAAM,KAAK,CAAA;AAEZ,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,GAAG,CAAA;AAmG7C,KAAK,YAAY,GAAG;IAClB,GAAG,EAAE,GAAG,CAAA;IACR,IAAI,EAAE,MAAM,IAAI,CAAA;IAChB,IAAI,EAAE,GAAG,CAAC,OAAO,CAAC,CAAA;IAClB,KAAK,EAAE,UAAU,CAAC,WAAW,CAAC,CAAA;IAC9B,MAAM,CAAC,EAAE,oBAAoB,CAAA;IAC7B,OAAO,CAAC,EAAE,OAAO,CAAA;CAClB,CAAA;AAeD,eAAO,MAAM,OAAO,0WA8iFlB,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jvs-milkdown/crepe",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.33",
|
|
4
4
|
"keywords": [
|
|
5
5
|
"crepe",
|
|
6
6
|
"editor",
|
|
@@ -107,9 +107,9 @@
|
|
|
107
107
|
"@codemirror/theme-one-dark": "^6.1.2",
|
|
108
108
|
"@codemirror/view": "^6.26.0",
|
|
109
109
|
"@floating-ui/dom": "^1.7.6",
|
|
110
|
-
"@jvs-milkdown/kit": "^1.2.
|
|
111
|
-
"@jvs-milkdown/prose": "^1.2.
|
|
112
|
-
"@jvs-milkdown/utils": "^1.2.
|
|
110
|
+
"@jvs-milkdown/kit": "^1.2.33",
|
|
111
|
+
"@jvs-milkdown/prose": "^1.2.33",
|
|
112
|
+
"@jvs-milkdown/utils": "^1.2.33",
|
|
113
113
|
"@types/lodash-es": "^4.17.12",
|
|
114
114
|
"clsx": "^2.0.0",
|
|
115
115
|
"codemirror": "^6.0.1",
|
|
@@ -78,46 +78,59 @@ export const FixedToolbarComponent = defineComponent<FixedToolbarProps>({
|
|
|
78
78
|
: props.canRedo?.value) || false
|
|
79
79
|
|
|
80
80
|
const viewState = props.ctx.get(viewMenuStateCtx.key)
|
|
81
|
-
const maxWidth = computed(
|
|
81
|
+
const maxWidth = computed(
|
|
82
|
+
() => editorWidthMap[viewState.editorWidth as EditorWidth]
|
|
83
|
+
)
|
|
82
84
|
const isFull = computed(() => maxWidth.value === 'none')
|
|
83
85
|
|
|
84
86
|
if (!viewState.fixedToolbarVisible) {
|
|
85
87
|
return (
|
|
86
|
-
<
|
|
87
|
-
type="button"
|
|
88
|
-
class="fixed-toolbar-expand-btn"
|
|
89
|
-
title="展开工具栏"
|
|
90
|
-
onClick={(e: MouseEvent) => {
|
|
91
|
-
e.preventDefault()
|
|
92
|
-
e.stopPropagation()
|
|
93
|
-
viewState.fixedToolbarVisible = true
|
|
94
|
-
}}
|
|
88
|
+
<div
|
|
95
89
|
style={{
|
|
96
|
-
position: '
|
|
97
|
-
|
|
98
|
-
|
|
90
|
+
position: 'relative',
|
|
91
|
+
width: '100%',
|
|
92
|
+
height: '100%',
|
|
99
93
|
display: 'flex',
|
|
100
94
|
alignItems: 'center',
|
|
101
95
|
justifyContent: 'center',
|
|
102
|
-
width: '32px',
|
|
103
|
-
height: '24px',
|
|
104
|
-
border:
|
|
105
|
-
'1px solid var(--crepe-color-outline-variant, color-mix(in srgb, var(--crepe-color-outline), transparent 85%))',
|
|
106
|
-
borderTop: 'none',
|
|
107
|
-
background: 'var(--crepe-color-surface, #ffffff)',
|
|
108
|
-
cursor: 'pointer',
|
|
109
|
-
borderRadius: '0 0 6px 6px',
|
|
110
|
-
boxShadow: '0 4px 8px rgba(0, 0, 0, 0.06)',
|
|
111
|
-
color: 'var(--crepe-color-on-surface, #363b4c)',
|
|
112
|
-
pointerEvents: 'auto',
|
|
113
|
-
zIndex: 200,
|
|
114
96
|
}}
|
|
115
97
|
>
|
|
116
|
-
<
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
98
|
+
<button
|
|
99
|
+
type="button"
|
|
100
|
+
class="fixed-toolbar-expand-btn"
|
|
101
|
+
title="展开工具栏"
|
|
102
|
+
onClick={(e: MouseEvent) => {
|
|
103
|
+
e.preventDefault()
|
|
104
|
+
e.stopPropagation()
|
|
105
|
+
viewState.fixedToolbarVisible = true
|
|
106
|
+
}}
|
|
107
|
+
style={{
|
|
108
|
+
position: 'absolute',
|
|
109
|
+
top: '0',
|
|
110
|
+
right: '40px',
|
|
111
|
+
display: 'flex',
|
|
112
|
+
alignItems: 'center',
|
|
113
|
+
justifyContent: 'center',
|
|
114
|
+
width: '28px',
|
|
115
|
+
height: '24px',
|
|
116
|
+
border:
|
|
117
|
+
'1px solid var(--crepe-color-outline-variant, color-mix(in srgb, var(--crepe-color-outline), transparent 85%))',
|
|
118
|
+
borderTop: 'none',
|
|
119
|
+
background: 'var(--crepe-color-surface, #ffffff)',
|
|
120
|
+
cursor: 'pointer',
|
|
121
|
+
borderRadius: '0 0 6px 6px',
|
|
122
|
+
boxShadow: '0 4px 8px rgba(0, 0, 0, 0.06)',
|
|
123
|
+
color: 'var(--crepe-color-on-surface, #363b4c)',
|
|
124
|
+
pointerEvents: 'auto',
|
|
125
|
+
zIndex: 200,
|
|
126
|
+
}}
|
|
127
|
+
>
|
|
128
|
+
<span
|
|
129
|
+
style={{ display: 'inline-flex', alignItems: 'center' }}
|
|
130
|
+
innerHTML={chevronDownIcon}
|
|
131
|
+
/>
|
|
132
|
+
</button>
|
|
133
|
+
</div>
|
|
121
134
|
)
|
|
122
135
|
}
|
|
123
136
|
|
|
@@ -134,12 +147,14 @@ export const FixedToolbarComponent = defineComponent<FixedToolbarProps>({
|
|
|
134
147
|
>
|
|
135
148
|
<div
|
|
136
149
|
style={{
|
|
150
|
+
position: 'relative',
|
|
137
151
|
display: 'flex',
|
|
138
152
|
alignItems: 'center',
|
|
139
|
-
justifyContent: '
|
|
153
|
+
justifyContent: 'flex-start',
|
|
140
154
|
width: '100%',
|
|
141
155
|
maxWidth: isFull.value ? '100%' : maxWidth.value,
|
|
142
156
|
margin: isFull.value ? '0' : '0 auto',
|
|
157
|
+
// paddingRight: '40px',
|
|
143
158
|
gap: '0px',
|
|
144
159
|
minWidth: '0',
|
|
145
160
|
overflow: 'hidden',
|
|
@@ -261,7 +276,7 @@ export const FixedToolbarComponent = defineComponent<FixedToolbarProps>({
|
|
|
261
276
|
style={{
|
|
262
277
|
position: 'absolute',
|
|
263
278
|
top: '6px',
|
|
264
|
-
right: '
|
|
279
|
+
right: '40px',
|
|
265
280
|
margin: '0',
|
|
266
281
|
display: 'flex',
|
|
267
282
|
alignItems: 'center',
|
|
@@ -198,7 +198,7 @@ class FixedToolbarView implements PluginView {
|
|
|
198
198
|
|
|
199
199
|
const app = createApp(FixedToolbarComponent, {
|
|
200
200
|
ctx,
|
|
201
|
-
hide: () => {
|
|
201
|
+
hide: () => {}, // No-op for fixed toolbar
|
|
202
202
|
config,
|
|
203
203
|
state: this.#state,
|
|
204
204
|
show: this.#show,
|
|
@@ -635,7 +635,6 @@ export const Toolbar = defineComponent<ToolbarProps>({
|
|
|
635
635
|
overflowVisibleCount.value = visibleCount
|
|
636
636
|
totalSectionCount.value = toolbarChildren.length
|
|
637
637
|
}
|
|
638
|
-
|
|
639
638
|
const handleTableEnter = (e: MouseEvent) => {
|
|
640
639
|
if (hideTableTimer) clearTimeout(hideTableTimer)
|
|
641
640
|
const rect = (e.currentTarget as HTMLElement).getBoundingClientRect()
|
|
@@ -1337,7 +1336,7 @@ export const Toolbar = defineComponent<ToolbarProps>({
|
|
|
1337
1336
|
'var(--crepe-color-hover)'
|
|
1338
1337
|
}}
|
|
1339
1338
|
onMouseleave={(e: MouseEvent) => {
|
|
1340
|
-
;(e.currentTarget as HTMLElement).style.backgroundColor =
|
|
1339
|
+
; (e.currentTarget as HTMLElement).style.backgroundColor =
|
|
1341
1340
|
'transparent'
|
|
1342
1341
|
}}
|
|
1343
1342
|
>
|
|
@@ -1536,9 +1535,9 @@ export const Toolbar = defineComponent<ToolbarProps>({
|
|
|
1536
1535
|
const fontFamily = fontState?.fontFamily
|
|
1537
1536
|
return fontFamily && fontFamily !== 'mixed'
|
|
1538
1537
|
? fontFamily.split(',')[0]!.replace(/['"]/g, '') ||
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
|
|
1538
|
+
(ctx
|
|
1539
|
+
? i18n(ctx, 'customMenu.fontDefault' as any)
|
|
1540
|
+
: '默认')
|
|
1542
1541
|
: ctx
|
|
1543
1542
|
? i18n(ctx, 'customMenu.fontDefault' as any)
|
|
1544
1543
|
: '默认'
|
|
@@ -1649,12 +1648,12 @@ export const Toolbar = defineComponent<ToolbarProps>({
|
|
|
1649
1648
|
display: 'inline-flex',
|
|
1650
1649
|
color:
|
|
1651
1650
|
currentColorState.value.textColor &&
|
|
1652
|
-
|
|
1651
|
+
currentColorState.value.textColor !== 'mixed'
|
|
1653
1652
|
? currentColorState.value.textColor
|
|
1654
1653
|
: '#363B4C',
|
|
1655
1654
|
backgroundColor:
|
|
1656
1655
|
currentColorState.value.bgColor &&
|
|
1657
|
-
|
|
1656
|
+
currentColorState.value.bgColor !== 'mixed'
|
|
1658
1657
|
? currentColorState.value.bgColor
|
|
1659
1658
|
: undefined,
|
|
1660
1659
|
borderRadius: '4px',
|
|
@@ -1744,7 +1743,7 @@ export const Toolbar = defineComponent<ToolbarProps>({
|
|
|
1744
1743
|
<Fragment key={(group as any).key}>
|
|
1745
1744
|
{items}
|
|
1746
1745
|
{groupIndex < nonHeadingGroups.length - 1 &&
|
|
1747
|
-
|
|
1746
|
+
group.items.length > 0 ? (
|
|
1748
1747
|
<div
|
|
1749
1748
|
class="divider"
|
|
1750
1749
|
style={{
|
|
@@ -1982,7 +1981,7 @@ export const Toolbar = defineComponent<ToolbarProps>({
|
|
|
1982
1981
|
mergeCellIcon,
|
|
1983
1982
|
ctx
|
|
1984
1983
|
? i18n(ctx, 'customMenu.mergeCells' as any) ||
|
|
1985
|
-
|
|
1984
|
+
'合并单元格'
|
|
1986
1985
|
: '合并单元格',
|
|
1987
1986
|
false,
|
|
1988
1987
|
onMergeCells
|
|
@@ -1992,7 +1991,7 @@ export const Toolbar = defineComponent<ToolbarProps>({
|
|
|
1992
1991
|
splitCellIcon,
|
|
1993
1992
|
ctx
|
|
1994
1993
|
? i18n(ctx, 'customMenu.splitCell' as any) ||
|
|
1995
|
-
|
|
1994
|
+
'拆分单元格'
|
|
1996
1995
|
: '拆分单元格',
|
|
1997
1996
|
false,
|
|
1998
1997
|
onSplitCell
|
|
@@ -2120,9 +2119,9 @@ export const Toolbar = defineComponent<ToolbarProps>({
|
|
|
2120
2119
|
boxSizing: 'border-box',
|
|
2121
2120
|
border:
|
|
2122
2121
|
currentColorState.value.bgColor === color ||
|
|
2123
|
-
|
|
2124
|
-
|
|
2125
|
-
|
|
2122
|
+
(color === 'transparent' &&
|
|
2123
|
+
!currentColorState.value.bgColor &&
|
|
2124
|
+
currentColorState.value.bgColor !== 'mixed')
|
|
2126
2125
|
? '2px solid var(--crepe-color-primary)'
|
|
2127
2126
|
: '1px solid var(--crepe-color-outline-variant)',
|
|
2128
2127
|
backgroundColor:
|
|
@@ -2311,13 +2310,13 @@ export const Toolbar = defineComponent<ToolbarProps>({
|
|
|
2311
2310
|
}}
|
|
2312
2311
|
onMouseenter={(e: MouseEvent) => {
|
|
2313
2312
|
if (supported) {
|
|
2314
|
-
;(
|
|
2313
|
+
; (
|
|
2315
2314
|
e.currentTarget as HTMLElement
|
|
2316
2315
|
).style.backgroundColor = 'var(--crepe-color-hover)'
|
|
2317
2316
|
}
|
|
2318
2317
|
}}
|
|
2319
2318
|
onMouseleave={(e: MouseEvent) => {
|
|
2320
|
-
;(e.currentTarget as HTMLElement).style.backgroundColor =
|
|
2319
|
+
; (e.currentTarget as HTMLElement).style.backgroundColor =
|
|
2321
2320
|
'transparent'
|
|
2322
2321
|
}}
|
|
2323
2322
|
>
|
|
@@ -2420,11 +2419,11 @@ export const Toolbar = defineComponent<ToolbarProps>({
|
|
|
2420
2419
|
setFontSize(size.value)
|
|
2421
2420
|
}}
|
|
2422
2421
|
onMouseenter={(e: MouseEvent) => {
|
|
2423
|
-
;(e.currentTarget as HTMLElement).style.backgroundColor =
|
|
2422
|
+
; (e.currentTarget as HTMLElement).style.backgroundColor =
|
|
2424
2423
|
'var(--crepe-color-hover)'
|
|
2425
2424
|
}}
|
|
2426
2425
|
onMouseleave={(e: MouseEvent) => {
|
|
2427
|
-
;(e.currentTarget as HTMLElement).style.backgroundColor =
|
|
2426
|
+
; (e.currentTarget as HTMLElement).style.backgroundColor =
|
|
2428
2427
|
'transparent'
|
|
2429
2428
|
}}
|
|
2430
2429
|
>
|
|
@@ -2745,9 +2744,9 @@ export const Toolbar = defineComponent<ToolbarProps>({
|
|
|
2745
2744
|
isTable
|
|
2746
2745
|
? undefined
|
|
2747
2746
|
: (_e: MouseEvent) => {
|
|
2748
|
-
|
|
2749
|
-
|
|
2750
|
-
|
|
2747
|
+
item.onRun(ctx)
|
|
2748
|
+
showOverflowMenu.value = false
|
|
2749
|
+
},
|
|
2751
2750
|
isTable,
|
|
2752
2751
|
isTable ? handleTableEnter : undefined,
|
|
2753
2752
|
isTable ? handleTableLeave : undefined,
|