Add loading indicator to DefaultEditor initialization (#7756)

pull/7762/head^2
Ryan Wang 2025-09-20 23:35:01 +08:00 committed by GitHub
parent 83117058bc
commit 8a7805f869
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 14 additions and 6 deletions

View File

@ -63,6 +63,7 @@ import {
IconFolder,
IconLink,
IconUserFollow,
VLoading,
VTabItem,
VTabs,
} from "@halo-dev/components";
@ -75,6 +76,7 @@ import {
defineAsyncComponent,
inject,
markRaw,
nextTick,
onBeforeUnmount,
onMounted,
ref,
@ -412,6 +414,8 @@ const presetExtensions = [
}),
];
const isInitialized = ref(false);
onMounted(async () => {
const extensionsFromPlugins: Extensions = [];
@ -451,11 +455,14 @@ onMounted(async () => {
debounceOnUpdate();
},
onCreate() {
if (editor.value?.isEmpty && !props.title) {
editorTitleRef.value.focus();
} else {
editor.value?.commands.focus();
}
isInitialized.value = true;
nextTick(() => {
if (editor.value?.isEmpty && !props.title) {
editorTitleRef.value.focus();
} else {
editor.value?.commands.focus();
}
});
},
});
});
@ -501,7 +508,8 @@ function handleFocusEditor(event) {
</script>
<template>
<div>
<VLoading v-if="!isInitialized" />
<div v-else>
<AttachmentSelectorModal
v-bind="attachmentOptions"
v-model:visible="attachmentSelectorModal"