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