fix: set the preview mode as the default for only view access users

pull/3464/head
ultwcz 2024-09-06 09:57:45 +08:00
parent bb5d192095
commit 43ca56d7cd
1 changed files with 7 additions and 1 deletions

View File

@ -80,6 +80,10 @@ onMounted(() => {
const fileContent = fileStore.req?.content || "";
watchEffect(async () => {
if (!authStore.user?.perm.modify) {
isPreview.value = true;
}
if (isMarkdownFile && isPreview.value) {
const new_value = editor.value?.getValue() || "";
try {
@ -178,6 +182,8 @@ const close = () => {
};
const preview = () => {
isPreview.value = !isPreview.value;
if (authStore.user?.perm.modify) {
isPreview.value = !isPreview.value;
}
};
</script>