@jvs-milkdown/crepe 1.2.4 → 1.2.5
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 +21 -3
- package/lib/cjs/index.js.map +1 -1
- package/lib/esm/index.js +21 -3
- package/lib/esm/index.js.map +1 -1
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/lib/types/feature/fixed-toolbar/document-header.d.ts.map +1 -1
- package/package.json +4 -4
- package/src/feature/fixed-toolbar/document-header.tsx +25 -4
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"document-header.d.ts","sourceRoot":"","sources":["../../../../src/feature/fixed-toolbar/document-header.tsx"],"names":[],"mappings":"AASA,eAAO,MAAM,cAAc,
|
|
1
|
+
{"version":3,"file":"document-header.d.ts","sourceRoot":"","sources":["../../../../src/feature/fixed-toolbar/document-header.tsx"],"names":[],"mappings":"AASA,eAAO,MAAM,cAAc,KAiSzB,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.5",
|
|
4
4
|
"keywords": [
|
|
5
5
|
"crepe",
|
|
6
6
|
"editor",
|
|
@@ -97,9 +97,9 @@
|
|
|
97
97
|
"@codemirror/theme-one-dark": "^6.1.2",
|
|
98
98
|
"@codemirror/view": "^6.26.0",
|
|
99
99
|
"@floating-ui/dom": "^1.7.6",
|
|
100
|
-
"@jvs-milkdown/kit": "^1.2.
|
|
101
|
-
"@jvs-milkdown/prose": "^1.2.
|
|
102
|
-
"@jvs-milkdown/utils": "^1.2.
|
|
100
|
+
"@jvs-milkdown/kit": "^1.2.5",
|
|
101
|
+
"@jvs-milkdown/prose": "^1.2.5",
|
|
102
|
+
"@jvs-milkdown/utils": "^1.2.5",
|
|
103
103
|
"@types/lodash-es": "^4.17.12",
|
|
104
104
|
"clsx": "^2.0.0",
|
|
105
105
|
"codemirror": "^6.0.1",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Ctx } from '@jvs-milkdown/kit/ctx'
|
|
2
2
|
|
|
3
|
-
import { defineComponent, computed, ref, watch, h } from 'vue'
|
|
3
|
+
import { defineComponent, computed, ref, watch, h, onMounted, onUnmounted } from 'vue'
|
|
4
4
|
|
|
5
5
|
import type { FixedToolbarConfig } from './index'
|
|
6
6
|
|
|
@@ -30,12 +30,29 @@ export const DocumentHeader = defineComponent({
|
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
+
let resizeObserver: ResizeObserver | null = null
|
|
34
|
+
|
|
35
|
+
onMounted(() => {
|
|
36
|
+
setTimeout(adjustTitleHeight, 0)
|
|
37
|
+
if (titleTextareaRef.value) {
|
|
38
|
+
resizeObserver = new ResizeObserver(() => {
|
|
39
|
+
adjustTitleHeight()
|
|
40
|
+
})
|
|
41
|
+
resizeObserver.observe(titleTextareaRef.value)
|
|
42
|
+
}
|
|
43
|
+
})
|
|
44
|
+
|
|
45
|
+
onUnmounted(() => {
|
|
46
|
+
if (resizeObserver) {
|
|
47
|
+
resizeObserver.disconnect()
|
|
48
|
+
}
|
|
49
|
+
})
|
|
50
|
+
|
|
33
51
|
watch(
|
|
34
52
|
() => title.value,
|
|
35
53
|
() => {
|
|
36
54
|
setTimeout(adjustTitleHeight, 0)
|
|
37
|
-
}
|
|
38
|
-
{ immediate: true }
|
|
55
|
+
}
|
|
39
56
|
)
|
|
40
57
|
|
|
41
58
|
watch(
|
|
@@ -251,7 +268,11 @@ export const DocumentHeader = defineComponent({
|
|
|
251
268
|
ref={titleTextareaRef}
|
|
252
269
|
class="milkdown-document-title"
|
|
253
270
|
placeholder="请输入标题"
|
|
254
|
-
|
|
271
|
+
value={title.value}
|
|
272
|
+
onInput={(e) => {
|
|
273
|
+
title.value = (e.target as HTMLTextAreaElement).value
|
|
274
|
+
adjustTitleHeight()
|
|
275
|
+
}}
|
|
255
276
|
rows={1}
|
|
256
277
|
style={{
|
|
257
278
|
width: '100%',
|