diff --git a/frontend/src/components/PostEditor.vue b/frontend/src/components/PostEditor.vue index 645f5ff4e..85b1ca9c5 100644 --- a/frontend/src/components/PostEditor.vue +++ b/frontend/src/components/PostEditor.vue @@ -19,10 +19,9 @@ import { clearVditorStorage } from '../utils/clearVditorStorage' import { hatch } from 'ldrs' hatch.register() - export default { name: 'PostEditor', - emits: ['update:modelValue'], + emits: ['update:modelValue', 'update:loading'], props: { modelValue: { type: String, @@ -43,6 +42,8 @@ export default { }, setup(props, { emit }) { const vditorInstance = ref(null) + let vditorRender = false + const getEditorTheme = getEditorThemeUtil const getPreviewTheme = getPreviewThemeUtil const applyTheme = () => { @@ -54,6 +55,7 @@ export default { watch( () => props.loading, val => { + if (!vditorRender) return if (val) { vditorInstance.value.disabled() } else { @@ -91,12 +93,15 @@ export default { ) onMounted(() => { + emit('update:loading', true) vditorInstance.value = createVditor(props.editorId, { placeholder: '请输入正文...', input(value) { emit('update:modelValue', value) }, after() { + vditorRender = true + emit('update:loading', false) vditorInstance.value.setValue(props.modelValue) if (props.loading || props.disabled) { vditorInstance.value.disabled() @@ -120,6 +125,7 @@ export default { .post-editor-container { border: 1px solid var(--normal-border-color); position: relative; + min-height: 200px; } .editor-loading-overlay { diff --git a/frontend/src/views/NewPostPageView.vue b/frontend/src/views/NewPostPageView.vue index 1038df159..a784ed202 100644 --- a/frontend/src/views/NewPostPageView.vue +++ b/frontend/src/views/NewPostPageView.vue @@ -3,7 +3,7 @@
- +