mirror of https://github.com/halo-dev/halo
Add loading indicator to DefaultEditor initialization (#7756)
parent
83117058bc
commit
8a7805f869
|
@ -63,6 +63,7 @@ import {
|
||||||
IconFolder,
|
IconFolder,
|
||||||
IconLink,
|
IconLink,
|
||||||
IconUserFollow,
|
IconUserFollow,
|
||||||
|
VLoading,
|
||||||
VTabItem,
|
VTabItem,
|
||||||
VTabs,
|
VTabs,
|
||||||
} from "@halo-dev/components";
|
} from "@halo-dev/components";
|
||||||
|
@ -75,6 +76,7 @@ import {
|
||||||
defineAsyncComponent,
|
defineAsyncComponent,
|
||||||
inject,
|
inject,
|
||||||
markRaw,
|
markRaw,
|
||||||
|
nextTick,
|
||||||
onBeforeUnmount,
|
onBeforeUnmount,
|
||||||
onMounted,
|
onMounted,
|
||||||
ref,
|
ref,
|
||||||
|
@ -412,6 +414,8 @@ const presetExtensions = [
|
||||||
}),
|
}),
|
||||||
];
|
];
|
||||||
|
|
||||||
|
const isInitialized = ref(false);
|
||||||
|
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
const extensionsFromPlugins: Extensions = [];
|
const extensionsFromPlugins: Extensions = [];
|
||||||
|
|
||||||
|
@ -451,11 +455,14 @@ onMounted(async () => {
|
||||||
debounceOnUpdate();
|
debounceOnUpdate();
|
||||||
},
|
},
|
||||||
onCreate() {
|
onCreate() {
|
||||||
|
isInitialized.value = true;
|
||||||
|
nextTick(() => {
|
||||||
if (editor.value?.isEmpty && !props.title) {
|
if (editor.value?.isEmpty && !props.title) {
|
||||||
editorTitleRef.value.focus();
|
editorTitleRef.value.focus();
|
||||||
} else {
|
} else {
|
||||||
editor.value?.commands.focus();
|
editor.value?.commands.focus();
|
||||||
}
|
}
|
||||||
|
});
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -501,7 +508,8 @@ function handleFocusEditor(event) {
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div>
|
<VLoading v-if="!isInitialized" />
|
||||||
|
<div v-else>
|
||||||
<AttachmentSelectorModal
|
<AttachmentSelectorModal
|
||||||
v-bind="attachmentOptions"
|
v-bind="attachmentOptions"
|
||||||
v-model:visible="attachmentSelectorModal"
|
v-model:visible="attachmentSelectorModal"
|
||||||
|
|
Loading…
Reference in New Issue