@jvs-milkdown/crepe 1.2.3 → 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
package/lib/esm/index.js
CHANGED
|
@@ -8172,12 +8172,26 @@ const DocumentHeader = defineComponent({
|
|
|
8172
8172
|
titleTextareaRef.value.style.height = titleTextareaRef.value.scrollHeight + "px";
|
|
8173
8173
|
}
|
|
8174
8174
|
};
|
|
8175
|
+
let resizeObserver = null;
|
|
8176
|
+
onMounted(() => {
|
|
8177
|
+
setTimeout(adjustTitleHeight, 0);
|
|
8178
|
+
if (titleTextareaRef.value) {
|
|
8179
|
+
resizeObserver = new ResizeObserver(() => {
|
|
8180
|
+
adjustTitleHeight();
|
|
8181
|
+
});
|
|
8182
|
+
resizeObserver.observe(titleTextareaRef.value);
|
|
8183
|
+
}
|
|
8184
|
+
});
|
|
8185
|
+
onUnmounted(() => {
|
|
8186
|
+
if (resizeObserver) {
|
|
8187
|
+
resizeObserver.disconnect();
|
|
8188
|
+
}
|
|
8189
|
+
});
|
|
8175
8190
|
watch(
|
|
8176
8191
|
() => title.value,
|
|
8177
8192
|
() => {
|
|
8178
8193
|
setTimeout(adjustTitleHeight, 0);
|
|
8179
|
-
}
|
|
8180
|
-
{ immediate: true }
|
|
8194
|
+
}
|
|
8181
8195
|
);
|
|
8182
8196
|
watch(
|
|
8183
8197
|
() => viewState.value.showCover,
|
|
@@ -8388,7 +8402,11 @@ const DocumentHeader = defineComponent({
|
|
|
8388
8402
|
ref: titleTextareaRef,
|
|
8389
8403
|
class: "milkdown-document-title",
|
|
8390
8404
|
placeholder: "\u8BF7\u8F93\u5165\u6807\u9898",
|
|
8391
|
-
|
|
8405
|
+
value: title.value,
|
|
8406
|
+
onInput: (e) => {
|
|
8407
|
+
title.value = e.target.value;
|
|
8408
|
+
adjustTitleHeight();
|
|
8409
|
+
},
|
|
8392
8410
|
rows: 1,
|
|
8393
8411
|
style: {
|
|
8394
8412
|
width: "100%",
|