allow setting aceEditorTheme from profile settings
parent
e4b322d80a
commit
0b5deb4556
|
@ -0,0 +1,24 @@
|
||||||
|
<template>
|
||||||
|
<select name="selectAceEditorTheme" v-on:change="change" :value="aceEditorTheme">
|
||||||
|
<option v-for="theme in themes" :value="theme.theme" :key="theme.theme">
|
||||||
|
{{ theme.name }}
|
||||||
|
</option>
|
||||||
|
</select>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts">
|
||||||
|
import { type SelectHTMLAttributes } from "vue";
|
||||||
|
import { themes } from "ace-builds/src-noconflict/ext-themelist";
|
||||||
|
|
||||||
|
defineProps<{
|
||||||
|
aceEditorTheme: string;
|
||||||
|
}>();
|
||||||
|
|
||||||
|
const emit = defineEmits<{
|
||||||
|
(e: "update:aceEditorTheme", val: string | null): void;
|
||||||
|
}>();
|
||||||
|
|
||||||
|
const change = (event: Event) => {
|
||||||
|
emit("update:aceEditorTheme", (event.target as SelectHTMLAttributes)?.value);
|
||||||
|
};
|
||||||
|
</script>
|
|
@ -154,6 +154,7 @@
|
||||||
"video": "Video"
|
"video": "Video"
|
||||||
},
|
},
|
||||||
"settings": {
|
"settings": {
|
||||||
|
"aceEditorTheme": "Ace editor theme",
|
||||||
"admin": "Admin",
|
"admin": "Admin",
|
||||||
"administrator": "Administrator",
|
"administrator": "Administrator",
|
||||||
"allowCommands": "Execute commands",
|
"allowCommands": "Execute commands",
|
||||||
|
|
|
@ -24,6 +24,13 @@
|
||||||
class="input input--block"
|
class="input input--block"
|
||||||
v-model:locale="locale"
|
v-model:locale="locale"
|
||||||
></languages>
|
></languages>
|
||||||
|
|
||||||
|
<h3>{{ t("settings.aceEditorTheme") }}</h3>
|
||||||
|
<AceEditorTheme
|
||||||
|
class="input input--block"
|
||||||
|
v-model:aceEditorTheme="aceEditorTheme"
|
||||||
|
id="aceTheme"
|
||||||
|
></AceEditorTheme>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="card-action">
|
<div class="card-action">
|
||||||
|
@ -81,6 +88,7 @@
|
||||||
import { useAuthStore } from "@/stores/auth";
|
import { useAuthStore } from "@/stores/auth";
|
||||||
import { useLayoutStore } from "@/stores/layout";
|
import { useLayoutStore } from "@/stores/layout";
|
||||||
import { users as api } from "@/api";
|
import { users as api } from "@/api";
|
||||||
|
import AceEditorTheme from "@/components/settings/AceEditorTheme.vue";
|
||||||
import Languages from "@/components/settings/Languages.vue";
|
import Languages from "@/components/settings/Languages.vue";
|
||||||
import { computed, inject, onMounted, ref } from "vue";
|
import { computed, inject, onMounted, ref } from "vue";
|
||||||
import { useI18n } from "vue-i18n";
|
import { useI18n } from "vue-i18n";
|
||||||
|
@ -98,6 +106,7 @@ const hideDotfiles = ref<boolean>(false);
|
||||||
const singleClick = ref<boolean>(false);
|
const singleClick = ref<boolean>(false);
|
||||||
const dateFormat = ref<boolean>(false);
|
const dateFormat = ref<boolean>(false);
|
||||||
const locale = ref<string>("");
|
const locale = ref<string>("");
|
||||||
|
const aceEditorTheme = ref<string>("");
|
||||||
|
|
||||||
const passwordClass = computed(() => {
|
const passwordClass = computed(() => {
|
||||||
const baseClass = "input input--block";
|
const baseClass = "input input--block";
|
||||||
|
@ -113,13 +122,14 @@ const passwordClass = computed(() => {
|
||||||
return `${baseClass} input--red`;
|
return `${baseClass} input--red`;
|
||||||
});
|
});
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(async () => {
|
||||||
layoutStore.loading = true;
|
layoutStore.loading = true;
|
||||||
if (authStore.user === null) return false;
|
if (authStore.user === null) return false;
|
||||||
locale.value = authStore.user.locale;
|
locale.value = authStore.user.locale;
|
||||||
hideDotfiles.value = authStore.user.hideDotfiles;
|
hideDotfiles.value = authStore.user.hideDotfiles;
|
||||||
singleClick.value = authStore.user.singleClick;
|
singleClick.value = authStore.user.singleClick;
|
||||||
dateFormat.value = authStore.user.dateFormat;
|
dateFormat.value = authStore.user.dateFormat;
|
||||||
|
aceEditorTheme.value = authStore.user.aceEditorTheme;
|
||||||
layoutStore.loading = false;
|
layoutStore.loading = false;
|
||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
|
@ -163,6 +173,7 @@ const updateSettings = async (event: Event) => {
|
||||||
hideDotfiles: hideDotfiles.value,
|
hideDotfiles: hideDotfiles.value,
|
||||||
singleClick: singleClick.value,
|
singleClick: singleClick.value,
|
||||||
dateFormat: dateFormat.value,
|
dateFormat: dateFormat.value,
|
||||||
|
aceEditorTheme: aceEditorTheme.value,
|
||||||
};
|
};
|
||||||
|
|
||||||
await api.update(data, [
|
await api.update(data, [
|
||||||
|
@ -170,6 +181,7 @@ const updateSettings = async (event: Event) => {
|
||||||
"hideDotfiles",
|
"hideDotfiles",
|
||||||
"singleClick",
|
"singleClick",
|
||||||
"dateFormat",
|
"dateFormat",
|
||||||
|
"aceEditorTheme",
|
||||||
]);
|
]);
|
||||||
authStore.updateUser(data);
|
authStore.updateUser(data);
|
||||||
$showSuccess(t("settings.settingsUpdated"));
|
$showSuccess(t("settings.settingsUpdated"));
|
||||||
|
|
Loading…
Reference in New Issue