From 035084d8e83243065fad69bfac1b69559fbad5fb Mon Sep 17 00:00:00 2001
From: outlook84 <96007761+outlook84@users.noreply.github.com>
Date: Mon, 14 Jul 2025 02:44:50 +0800
Subject: [PATCH] feat: add font size botton to text editor (#5290)
---
frontend/src/views/files/Editor.vue | 36 +++++++++++++++++++++++++++++
1 file changed, 36 insertions(+)
diff --git a/frontend/src/views/files/Editor.vue b/frontend/src/views/files/Editor.vue
index 95867033..f40fa392 100644
--- a/frontend/src/views/files/Editor.vue
+++ b/frontend/src/views/files/Editor.vue
@@ -4,6 +4,18 @@
{{ fileStore.req?.name ?? "" }}
+
+ {{ fontSize }}px
+
+
(null);
+const fontSize = ref(parseInt(localStorage.getItem("editorFontSize") || "14"));
const isPreview = ref(false);
const previewContent = ref("");
@@ -121,6 +134,7 @@ onMounted(() => {
editor.value!.setTheme("ace/theme/twilight");
}
+ editor.value.setFontSize(fontSize.value);
editor.value.focus();
});
@@ -186,6 +200,21 @@ const save = async () => {
$showError(e);
}
};
+
+const increaseFontSize = () => {
+ fontSize.value += 1;
+ editor.value?.setFontSize(fontSize.value);
+ localStorage.setItem("editorFontSize", fontSize.value.toString());
+};
+
+const decreaseFontSize = () => {
+ if (fontSize.value > 1) {
+ fontSize.value -= 1;
+ editor.value?.setFontSize(fontSize.value);
+ localStorage.setItem("editorFontSize", fontSize.value.toString());
+ }
+};
+
const close = () => {
if (!editor.value?.session.getUndoManager().isClean()) {
layoutStore.showHover("discardEditorChanges");
@@ -202,3 +231,10 @@ const preview = () => {
isPreview.value = !isPreview.value;
};
+
+