@jvs-milkdown/crepe 1.2.32 → 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.
@@ -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,oXAgRhC,CAAA"}
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,0WA+iFlB,CAAA"}
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.32",
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.32",
111
- "@jvs-milkdown/prose": "^1.2.32",
112
- "@jvs-milkdown/utils": "^1.2.32",
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",
@@ -95,51 +95,41 @@ export const FixedToolbarComponent = defineComponent<FixedToolbarProps>({
95
95
  justifyContent: 'center',
96
96
  }}
97
97
  >
98
- <div
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
+ }}
99
107
  style={{
100
- position: 'relative',
101
- width: '100%',
102
- maxWidth: isFull.value ? '100%' : maxWidth.value,
103
- margin: isFull.value ? '0' : '0 auto',
104
- height: '100%',
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,
105
126
  }}
106
127
  >
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>
128
+ <span
129
+ style={{ display: 'inline-flex', alignItems: 'center' }}
130
+ innerHTML={chevronDownIcon}
131
+ />
132
+ </button>
143
133
  </div>
144
134
  )
145
135
  }
@@ -164,7 +154,7 @@ export const FixedToolbarComponent = defineComponent<FixedToolbarProps>({
164
154
  width: '100%',
165
155
  maxWidth: isFull.value ? '100%' : maxWidth.value,
166
156
  margin: isFull.value ? '0' : '0 auto',
167
- paddingRight: '40px',
157
+ // paddingRight: '40px',
168
158
  gap: '0px',
169
159
  minWidth: '0',
170
160
  overflow: 'hidden',
@@ -272,38 +262,38 @@ export const FixedToolbarComponent = defineComponent<FixedToolbarProps>({
272
262
  {showShortcuts.value && (
273
263
  <ShortcutHelpModal ctx={props.ctx} visible={showShortcuts} />
274
264
  )}
265
+ </div>
275
266
 
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
- }}
267
+ <button
268
+ type="button"
269
+ class="toolbar-item collapse-btn"
270
+ title="折叠工具栏"
271
+ onClick={(e: MouseEvent) => {
272
+ e.preventDefault()
273
+ e.stopPropagation()
274
+ viewState.fixedToolbarVisible = false
275
+ }}
276
+ style={{
277
+ position: 'absolute',
278
+ top: '6px',
279
+ right: '40px',
280
+ margin: '0',
281
+ display: 'flex',
282
+ alignItems: 'center',
283
+ justifyContent: 'center',
284
+ pointerEvents: 'auto',
285
+ zIndex: 200,
286
+ }}
287
+ >
288
+ <span
285
289
  style={{
286
- position: 'absolute',
287
- top: '6px',
288
- right: '6px',
289
- margin: '0',
290
- display: 'flex',
290
+ display: 'inline-flex',
291
291
  alignItems: 'center',
292
- justifyContent: 'center',
293
- pointerEvents: 'auto',
294
- zIndex: 200,
292
+ transform: 'rotate(180deg)',
295
293
  }}
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>
294
+ innerHTML={chevronDownIcon}
295
+ />
296
+ </button>
307
297
  </div>
308
298
  )
309
299
  }
@@ -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
- (ctx
1540
- ? i18n(ctx, 'customMenu.fontDefault' as any)
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
- currentColorState.value.textColor !== 'mixed'
1651
+ currentColorState.value.textColor !== 'mixed'
1653
1652
  ? currentColorState.value.textColor
1654
1653
  : '#363B4C',
1655
1654
  backgroundColor:
1656
1655
  currentColorState.value.bgColor &&
1657
- currentColorState.value.bgColor !== 'mixed'
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
- group.items.length > 0 ? (
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
- (color === 'transparent' &&
2124
- !currentColorState.value.bgColor &&
2125
- currentColorState.value.bgColor !== 'mixed')
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
- item.onRun(ctx)
2749
- showOverflowMenu.value = false
2750
- },
2747
+ item.onRun(ctx)
2748
+ showOverflowMenu.value = false
2749
+ },
2751
2750
  isTable,
2752
2751
  isTable ? handleTableEnter : undefined,
2753
2752
  isTable ? handleTableLeave : undefined,