@jvs-milkdown/crepe 1.2.31 → 1.2.32
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/index.js +90 -61
- package/lib/cjs/index.js.map +1 -1
- package/lib/esm/index.js +90 -61
- 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/package.json +4 -4
- package/src/feature/fixed-toolbar/component.tsx +84 -59
- package/src/feature/fixed-toolbar/index.ts +1 -1
|
@@ -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,oXAgRhC,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.32",
|
|
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.32",
|
|
111
|
+
"@jvs-milkdown/prose": "^1.2.32",
|
|
112
|
+
"@jvs-milkdown/utils": "^1.2.32",
|
|
113
113
|
"@types/lodash-es": "^4.17.12",
|
|
114
114
|
"clsx": "^2.0.0",
|
|
115
115
|
"codemirror": "^6.0.1",
|
|
@@ -78,46 +78,69 @@ 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
|
-
style={{
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
98
|
+
<div
|
|
99
|
+
style={{
|
|
100
|
+
position: 'relative',
|
|
101
|
+
width: '100%',
|
|
102
|
+
maxWidth: isFull.value ? '100%' : maxWidth.value,
|
|
103
|
+
margin: isFull.value ? '0' : '0 auto',
|
|
104
|
+
height: '100%',
|
|
105
|
+
}}
|
|
106
|
+
>
|
|
107
|
+
<button
|
|
108
|
+
type="button"
|
|
109
|
+
class="fixed-toolbar-expand-btn"
|
|
110
|
+
title="展开工具栏"
|
|
111
|
+
onClick={(e: MouseEvent) => {
|
|
112
|
+
e.preventDefault()
|
|
113
|
+
e.stopPropagation()
|
|
114
|
+
viewState.fixedToolbarVisible = true
|
|
115
|
+
}}
|
|
116
|
+
style={{
|
|
117
|
+
position: 'absolute',
|
|
118
|
+
top: '0',
|
|
119
|
+
right: '6px',
|
|
120
|
+
display: 'flex',
|
|
121
|
+
alignItems: 'center',
|
|
122
|
+
justifyContent: 'center',
|
|
123
|
+
width: '28px',
|
|
124
|
+
height: '24px',
|
|
125
|
+
border:
|
|
126
|
+
'1px solid var(--crepe-color-outline-variant, color-mix(in srgb, var(--crepe-color-outline), transparent 85%))',
|
|
127
|
+
borderTop: 'none',
|
|
128
|
+
background: 'var(--crepe-color-surface, #ffffff)',
|
|
129
|
+
cursor: 'pointer',
|
|
130
|
+
borderRadius: '0 0 6px 6px',
|
|
131
|
+
boxShadow: '0 4px 8px rgba(0, 0, 0, 0.06)',
|
|
132
|
+
color: 'var(--crepe-color-on-surface, #363b4c)',
|
|
133
|
+
pointerEvents: 'auto',
|
|
134
|
+
zIndex: 200,
|
|
135
|
+
}}
|
|
136
|
+
>
|
|
137
|
+
<span
|
|
138
|
+
style={{ display: 'inline-flex', alignItems: 'center' }}
|
|
139
|
+
innerHTML={chevronDownIcon}
|
|
140
|
+
/>
|
|
141
|
+
</button>
|
|
142
|
+
</div>
|
|
143
|
+
</div>
|
|
121
144
|
)
|
|
122
145
|
}
|
|
123
146
|
|
|
@@ -134,12 +157,14 @@ export const FixedToolbarComponent = defineComponent<FixedToolbarProps>({
|
|
|
134
157
|
>
|
|
135
158
|
<div
|
|
136
159
|
style={{
|
|
160
|
+
position: 'relative',
|
|
137
161
|
display: 'flex',
|
|
138
162
|
alignItems: 'center',
|
|
139
|
-
justifyContent: '
|
|
163
|
+
justifyContent: 'flex-start',
|
|
140
164
|
width: '100%',
|
|
141
165
|
maxWidth: isFull.value ? '100%' : maxWidth.value,
|
|
142
166
|
margin: isFull.value ? '0' : '0 auto',
|
|
167
|
+
paddingRight: '40px',
|
|
143
168
|
gap: '0px',
|
|
144
169
|
minWidth: '0',
|
|
145
170
|
overflow: 'hidden',
|
|
@@ -247,38 +272,38 @@ export const FixedToolbarComponent = defineComponent<FixedToolbarProps>({
|
|
|
247
272
|
{showShortcuts.value && (
|
|
248
273
|
<ShortcutHelpModal ctx={props.ctx} visible={showShortcuts} />
|
|
249
274
|
)}
|
|
250
|
-
</div>
|
|
251
275
|
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
style={{
|
|
262
|
-
position: 'absolute',
|
|
263
|
-
top: '6px',
|
|
264
|
-
right: '32px',
|
|
265
|
-
margin: '0',
|
|
266
|
-
display: 'flex',
|
|
267
|
-
alignItems: 'center',
|
|
268
|
-
justifyContent: 'center',
|
|
269
|
-
pointerEvents: 'auto',
|
|
270
|
-
zIndex: 200,
|
|
271
|
-
}}
|
|
272
|
-
>
|
|
273
|
-
<span
|
|
276
|
+
<button
|
|
277
|
+
type="button"
|
|
278
|
+
class="toolbar-item collapse-btn"
|
|
279
|
+
title="折叠工具栏"
|
|
280
|
+
onClick={(e: MouseEvent) => {
|
|
281
|
+
e.preventDefault()
|
|
282
|
+
e.stopPropagation()
|
|
283
|
+
viewState.fixedToolbarVisible = false
|
|
284
|
+
}}
|
|
274
285
|
style={{
|
|
275
|
-
|
|
286
|
+
position: 'absolute',
|
|
287
|
+
top: '6px',
|
|
288
|
+
right: '6px',
|
|
289
|
+
margin: '0',
|
|
290
|
+
display: 'flex',
|
|
276
291
|
alignItems: 'center',
|
|
277
|
-
|
|
292
|
+
justifyContent: 'center',
|
|
293
|
+
pointerEvents: 'auto',
|
|
294
|
+
zIndex: 200,
|
|
278
295
|
}}
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
296
|
+
>
|
|
297
|
+
<span
|
|
298
|
+
style={{
|
|
299
|
+
display: 'inline-flex',
|
|
300
|
+
alignItems: 'center',
|
|
301
|
+
transform: 'rotate(180deg)',
|
|
302
|
+
}}
|
|
303
|
+
innerHTML={chevronDownIcon}
|
|
304
|
+
/>
|
|
305
|
+
</button>
|
|
306
|
+
</div>
|
|
282
307
|
</div>
|
|
283
308
|
)
|
|
284
309
|
}
|
|
@@ -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,
|