@jvs-milkdown/crepe 1.2.21 → 1.2.22
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 +20 -5
- package/lib/cjs/feature/toolbar/index.js.map +1 -1
- package/lib/cjs/index.js +73 -53
- package/lib/cjs/index.js.map +1 -1
- package/lib/esm/feature/toolbar/index.js +20 -5
- package/lib/esm/feature/toolbar/index.js.map +1 -1
- package/lib/esm/index.js +232 -212
- package/lib/esm/index.js.map +1 -1
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/lib/types/feature/attachment/view/components/attachment-block.d.ts.map +1 -1
- package/lib/types/feature/fixed-toolbar/component.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/toolbar/component.d.ts.map +1 -1
- package/package.json +4 -4
- package/src/feature/attachment/view/components/attachment-block.tsx +3 -0
- package/src/feature/fixed-toolbar/component.tsx +4 -0
- package/src/feature/fixed-toolbar/menu-bar.tsx +5 -0
- package/src/feature/fixed-toolbar/outline-panel.tsx +3 -0
- package/src/feature/fixed-toolbar/shortcut-help-modal.tsx +3 -0
- package/src/feature/toolbar/component.tsx +19 -5
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"attachment-block.d.ts","sourceRoot":"","sources":["../../../../../../src/feature/attachment/view/components/attachment-block.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,GAAG,EAAiD,MAAM,KAAK,CAAA;AAE7E,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,cAAc,CAAA;
|
|
1
|
+
{"version":3,"file":"attachment-block.d.ts","sourceRoot":"","sources":["../../../../../../src/feature/attachment/view/components/attachment-block.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,GAAG,EAAiD,MAAM,KAAK,CAAA;AAE7E,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,cAAc,CAAA;AAW3D,KAAK,KAAK,GAAG;IACX,GAAG,EAAE,MAAM,CAAA;IACX,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,MAAM,CAAA;IACZ,UAAU,EAAE,MAAM,CAAA;CACnB,CAAA;AAED,MAAM,MAAM,4BAA4B,GAAG;IACzC,QAAQ,EAAE,GAAG,CAAC,OAAO,CAAC,CAAA;IACtB,QAAQ,EAAE,GAAG,CAAC,OAAO,CAAC,CAAA;IACtB,OAAO,EAAE,CAAC,CAAC,SAAS,MAAM,KAAK,EAAE,IAAI,EAAE,CAAC,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC,KAAK,IAAI,CAAA;IAClE,MAAM,EAAE,uBAAuB,CAAA;CAChC,GAAG;KACD,CAAC,IAAI,MAAM,KAAK,GAAG,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,SAAS,CAAC;CAC9C,CAAA;AAWD,eAAO,MAAM,uBAAuB,0YAkPhC,CAAA"}
|
|
@@ -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,SAAS,EAAE,MAAM,+BAA+B,CAAA;AAI9D,OAAO,EAEL,KAAK,UAAU,EACf,KAAK,GAAG,
|
|
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,SAAS,EAAE,MAAM,+BAA+B,CAAA;AAI9D,OAAO,EAEL,KAAK,UAAU,EACf,KAAK,GAAG,EAKT,MAAM,KAAK,CAAA;AAIZ,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,GAAG,CAAA;AAOlD,KAAK,iBAAiB,GAAG;IACvB,GAAG,EAAE,GAAG,CAAA;IACR,IAAI,EAAE,MAAM,IAAI,CAAA;IAChB,IAAI,EAAE,GAAG,CAAC,OAAO,CAAC,CAAA;IAClB,SAAS,EAAE,UAAU,CAAC,SAAS,CAAC,CAAA;IAChC,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,oXA+JhC,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"menu-bar.d.ts","sourceRoot":"","sources":["../../../../src/feature/fixed-toolbar/menu-bar.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,uBAAuB,CAAA;
|
|
1
|
+
{"version":3,"file":"menu-bar.d.ts","sourceRoot":"","sources":["../../../../src/feature/fixed-toolbar/menu-bar.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,uBAAuB,CAAA;AAkBhD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAA;AAsDjD,eAAO,MAAM,OAAO;;cAEO,MAAM,GAAG;;;;cACN,MAAM,kBAAkB;;;;;cAD3B,MAAM,GAAG;;;;cACN,MAAM,kBAAkB;;;+GAkgBpD,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"outline-panel.d.ts","sourceRoot":"","sources":["../../../../src/feature/fixed-toolbar/outline-panel.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,uBAAuB,CAAA;
|
|
1
|
+
{"version":3,"file":"outline-panel.d.ts","sourceRoot":"","sources":["../../../../src/feature/fixed-toolbar/outline-panel.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,uBAAuB,CAAA;AAmBhD,eAAO,MAAM,YAAY;;cAEE,MAAM,GAAG;;;;;cAAT,MAAM,GAAG;;;+GA0oBlC,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shortcut-help-modal.d.ts","sourceRoot":"","sources":["../../../../src/feature/fixed-toolbar/shortcut-help-modal.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,uBAAuB,CAAA;AAIhD,OAAO,EAAmB,KAAK,GAAG,EAAiC,MAAM,KAAK,CAAA;
|
|
1
|
+
{"version":3,"file":"shortcut-help-modal.d.ts","sourceRoot":"","sources":["../../../../src/feature/fixed-toolbar/shortcut-help-modal.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,uBAAuB,CAAA;AAIhD,OAAO,EAAmB,KAAK,GAAG,EAAiC,MAAM,KAAK,CAAA;AAuE9E,KAAK,UAAU,GAAG;IAChB,GAAG,EAAE,GAAG,CAAA;IACR,OAAO,EAAE,GAAG,CAAC,OAAO,CAAC,CAAA;CACtB,CAAA;AAmED,eAAO,MAAM,iBAAiB,sWAsG5B,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;AAgBhD,OAAO,EACL,KAAK,SAAS,EAGf,MAAM,+BAA+B,CAAA;AAUtC,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,SAAS,EAAE,UAAU,CAAC,SAAS,CAAC,CAAA;IAChC,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;AAgBhD,OAAO,EACL,KAAK,SAAS,EAGf,MAAM,+BAA+B,CAAA;AAUtC,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,SAAS,EAAE,UAAU,CAAC,SAAS,CAAC,CAAA;IAChC,MAAM,CAAC,EAAE,oBAAoB,CAAA;IAC7B,OAAO,CAAC,EAAE,OAAO,CAAA;CAClB,CAAA;AAeD,eAAO,MAAM,OAAO,0WA+hFlB,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.22",
|
|
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.22",
|
|
111
|
+
"@jvs-milkdown/prose": "^1.2.22",
|
|
112
|
+
"@jvs-milkdown/utils": "^1.2.22",
|
|
113
113
|
"@types/lodash-es": "^4.17.12",
|
|
114
114
|
"clsx": "^2.0.0",
|
|
115
115
|
"codemirror": "^6.0.1",
|
|
@@ -5,6 +5,9 @@ import { type Ref, defineComponent, shallowRef, computed, ref, h } from 'vue'
|
|
|
5
5
|
import type { AttachmentFeatureConfig } from '../../config'
|
|
6
6
|
|
|
7
7
|
import { fileLinkIcon } from '../../../../icons/file-link'
|
|
8
|
+
import { keepAlive } from '../../../../utils/keep-alive'
|
|
9
|
+
|
|
10
|
+
keepAlive(h)
|
|
8
11
|
|
|
9
12
|
const downloadIcon = `<svg viewBox="0 0 1024 1024" width="20" height="20" fill="currentColor">
|
|
10
13
|
<path d="M464.96 743.936L194.304 479.68c-4.928-4.8-10.24-9.408-14.592-14.656-20.736-24.768-21.376-45.76-2.368-63.424 17.664-16.384 43.328-16 65.472 4.8 49.088 46.144 96.64 93.824 144.896 140.8l69.376 67.52 11.968 11.392v-184.96c0-36.096-0.128-86.272-0.32-136.96-0.192-54.912-0.32-110.464-0.32-149.504l-0.064-9.28a208 208 0 0 1 0.704-26.56c3.52-31.168 19.328-46.592 45.248-45.76 25.344 0.832 41.088 16.96 42.688 48.576 1.28 24.384 1.024 48.896 0.768 73.408l-0.128 28.928c0 53.376 0.128 120.32 0.256 188.096 0.192 76.352 0.384 153.792 0.32 214.016 74.432-72.704 185.6-181.12 216.32-210.88 7.424-7.168 14.912-15.168 24-19.52 18.688-8.96 37.632-8.32 52.672 7.872 14.72 15.744 16.448 33.408 4.032 51.392-3.84 5.632-8.576 10.816-13.44 15.616-45.696 44.736-243.328 238.272-289.728 282.24a62.592 62.592 0 0 1-8.064 6.4 43.392 43.392 0 0 1-15.872 10.432c-20.544 7.616-37.504-0.512-51.968-14.848l-11.2-10.88z m430.784-39.744c24-0.576 42.176 14.4 43.328 41.6 1.728 40.832 2.944 82.176-1.088 122.816-5.312 54.144-51.52 89.792-114.752 91.008-50.112 0.896-100.224 0.704-150.4 0.512L608 960H434.944c-64.832 0.128-129.6 0.192-194.432-0.192-90.624-0.512-130.752-40.192-131.392-128.64l-0.192-18.56c-0.32-21.12-0.576-42.304 0.768-63.36 1.92-29.76 20.48-46.528 45.76-45.184 23.488 1.28 37.312 16.32 40.064 45.184 0.896 9.792 0.832 19.648 0.704 29.504l-0.064 11.52c0.384 76.544 7.36 83.392 88.128 83.456a163213.952 163213.952 0 0 0 351.68 0.064l43.968 0.128c36.096 0.128 72.192 0.256 108.288-0.448 52.672-1.024 64-12.864 65.152-64.32 0.192-7.68 0.128-15.488 0-23.232a414.72 414.72 0 0 1 0.704-38.208c2.24-27.712 17.92-42.944 41.664-43.52z" fill="currentColor"></path>
|
|
@@ -10,8 +10,11 @@ import {
|
|
|
10
10
|
ref,
|
|
11
11
|
onMounted,
|
|
12
12
|
onUnmounted,
|
|
13
|
+
h,
|
|
13
14
|
} from 'vue'
|
|
14
15
|
|
|
16
|
+
import { keepAlive } from '../../utils/keep-alive'
|
|
17
|
+
|
|
15
18
|
import type { FixedToolbarFeatureConfig } from '.'
|
|
16
19
|
|
|
17
20
|
import { undoIcon, redoIcon } from '../../icons'
|
|
@@ -40,6 +43,7 @@ export const FixedToolbarComponent = defineComponent<FixedToolbarProps>({
|
|
|
40
43
|
canRedo: { type: Object, required: true },
|
|
41
44
|
},
|
|
42
45
|
setup(props: any) {
|
|
46
|
+
keepAlive(h)
|
|
43
47
|
const showShortcuts = ref(false)
|
|
44
48
|
|
|
45
49
|
onMounted(() => {
|
|
@@ -6,6 +6,9 @@ import { defineComponent, onMounted, onUnmounted, ref, computed, h } from 'vue'
|
|
|
6
6
|
|
|
7
7
|
import { i18n } from '../../core/locale'
|
|
8
8
|
import { viewMenuStateCtx } from './view-menu-state'
|
|
9
|
+
import { keepAlive } from '../../utils/keep-alive'
|
|
10
|
+
|
|
11
|
+
keepAlive(h)
|
|
9
12
|
|
|
10
13
|
interface OutlineItem {
|
|
11
14
|
text: string
|
|
@@ -8,6 +8,9 @@ import type { CrepeTranslations } from '../../core/locale'
|
|
|
8
8
|
|
|
9
9
|
import { i18n } from '../../core/locale'
|
|
10
10
|
import { closeIcon } from '../../icons'
|
|
11
|
+
import { keepAlive } from '../../utils/keep-alive'
|
|
12
|
+
|
|
13
|
+
keepAlive(h)
|
|
11
14
|
|
|
12
15
|
const isMac =
|
|
13
16
|
typeof navigator !== 'undefined' &&
|
|
@@ -545,15 +545,21 @@ export const Toolbar = defineComponent<ToolbarProps>({
|
|
|
545
545
|
|
|
546
546
|
const computeOverflow = () => {
|
|
547
547
|
if (!toolbarContainerRef.value) return
|
|
548
|
+
const status = ctx?.get(editorCtx)?.status
|
|
549
|
+
if (status !== EditorStatus.Created) return
|
|
550
|
+
const view = ctx.get(editorViewCtx)
|
|
551
|
+
if (!view || !view.dom) return
|
|
552
|
+
|
|
548
553
|
const container = toolbarContainerRef.value
|
|
549
554
|
|
|
550
555
|
if (!isFixed) {
|
|
551
|
-
const view = ctx.get(editorViewCtx)
|
|
552
556
|
const containerDOM =
|
|
553
557
|
view.dom.closest('.milkdown-editor-container') ||
|
|
554
558
|
view.dom.closest('.milkdown') ||
|
|
555
559
|
view.dom
|
|
556
|
-
|
|
560
|
+
if (containerDOM) {
|
|
561
|
+
container.style.maxWidth = `${containerDOM.clientWidth - 32}px`
|
|
562
|
+
}
|
|
557
563
|
}
|
|
558
564
|
|
|
559
565
|
// For fixed toolbar: use available space in parent (minus MenuBar & separator)
|
|
@@ -576,12 +582,11 @@ export const Toolbar = defineComponent<ToolbarProps>({
|
|
|
576
582
|
containerWidth = container.clientWidth
|
|
577
583
|
}
|
|
578
584
|
} else {
|
|
579
|
-
const view = ctx.get(editorViewCtx)
|
|
580
585
|
const containerDOM =
|
|
581
586
|
view.dom.closest('.milkdown-editor-container') ||
|
|
582
587
|
view.dom.closest('.milkdown') ||
|
|
583
588
|
view.dom
|
|
584
|
-
containerWidth = containerDOM.clientWidth - 32
|
|
589
|
+
containerWidth = containerDOM ? containerDOM.clientWidth - 32 : 0
|
|
585
590
|
}
|
|
586
591
|
|
|
587
592
|
if (showOverflowMenu.value) {
|
|
@@ -808,6 +813,16 @@ export const Toolbar = defineComponent<ToolbarProps>({
|
|
|
808
813
|
|
|
809
814
|
const setupOverflowObserver = () => {
|
|
810
815
|
if (!toolbarContainerRef.value || overflowSetupDone) return
|
|
816
|
+
const status = ctx?.get(editorCtx)?.status
|
|
817
|
+
if (status !== EditorStatus.Created) {
|
|
818
|
+
setTimeout(setupOverflowObserver, 50)
|
|
819
|
+
return
|
|
820
|
+
}
|
|
821
|
+
const view = ctx.get(editorViewCtx)
|
|
822
|
+
if (!view || !view.dom) {
|
|
823
|
+
setTimeout(setupOverflowObserver, 50)
|
|
824
|
+
return
|
|
825
|
+
}
|
|
811
826
|
overflowSetupDone = true
|
|
812
827
|
overflowResizeObserver = new ResizeObserver(() => {
|
|
813
828
|
computeOverflow()
|
|
@@ -818,7 +833,6 @@ export const Toolbar = defineComponent<ToolbarProps>({
|
|
|
818
833
|
const parent = toolbarContainerRef.value.parentElement
|
|
819
834
|
if (parent) overflowResizeObserver.observe(parent)
|
|
820
835
|
} else {
|
|
821
|
-
const view = ctx.get(editorViewCtx)
|
|
822
836
|
overflowResizeObserver.observe(view.dom)
|
|
823
837
|
|
|
824
838
|
const containerDOM = view.dom.closest('.milkdown-editor-container')
|