xiaoxian521 преди 2 години
родител
ревизия
0d694e9870

+ 5 - 1
src/layout/components/navbar.vue

@@ -25,13 +25,17 @@ const {
   pureApp,
   username,
   avatarsStyle,
-  getDropdownItemStyle
+  getDropdownItemStyle,
+  changeWangeditorLanguage
 } = useNav();
 
 watch(
   () => locale.value,
   () => {
     changeTitle(route.meta);
+    locale.value === "en"
+      ? changeWangeditorLanguage(locale.value)
+      : changeWangeditorLanguage("zh-CN");
   }
 );
 

+ 2 - 0
src/layout/components/setting/index.vue

@@ -186,6 +186,8 @@ function setFalse(Doms): any {
 }
 
 watch(instance, ({ layout }) => {
+  // 设置wangeditorV5主题色
+  body.style.setProperty("--w-e-toolbar-active-color", layout["epThemeColor"]);
   switch (layout["layout"]) {
     case "vertical":
       toggleClass(true, isSelect, unref(verticalRef));

+ 5 - 1
src/layout/components/sidebar/horizontal.vue

@@ -31,7 +31,8 @@ const {
   menuSelect,
   username,
   avatarsStyle,
-  getDropdownItemStyle
+  getDropdownItemStyle,
+  changeWangeditorLanguage
 } = useNav();
 
 onMounted(() => {
@@ -44,6 +45,9 @@ watch(
   () => locale.value,
   () => {
     changeTitle(route.meta);
+    locale.value === "en"
+      ? changeWangeditorLanguage(locale.value)
+      : changeWangeditorLanguage("zh-CN");
   }
 );
 

+ 5 - 1
src/layout/components/sidebar/mixNav.vue

@@ -34,7 +34,8 @@ const {
   pureApp,
   username,
   avatarsStyle,
-  getDropdownItemStyle
+  getDropdownItemStyle,
+  changeWangeditorLanguage
 } = useNav();
 
 let defaultActive = ref(null);
@@ -60,6 +61,9 @@ watch(
   () => locale.value,
   () => {
     changeTitle(route.meta);
+    locale.value === "en"
+      ? changeWangeditorLanguage(locale.value)
+      : changeWangeditorLanguage("zh-CN");
   }
 );
 

+ 12 - 1
src/layout/hooks/nav.ts

@@ -7,6 +7,7 @@ import { remainingPaths } from "/@/router";
 import { transformI18n } from "/@/plugins/i18n";
 import { storageSession } from "/@/utils/storage";
 import { useAppStoreHook } from "/@/store/modules/app";
+import { i18nChangeLanguage } from "@wangeditor/editor";
 import { useEpThemeStoreHook } from "/@/store/modules/epTheme";
 
 const errorInfo = "当前路由配置不正确,请检查配置";
@@ -109,6 +110,15 @@ export function useNav() {
     return remainingPaths.includes(path);
   }
 
+  /**
+   * 切换wangEditorV5国际化
+   * @param language string 可选值 en、zh-CN
+   * @returns void
+   */
+  function changeWangeditorLanguage(language: string): void {
+    i18nChangeLanguage(language);
+  }
+
   return {
     logout,
     backHome,
@@ -122,6 +132,7 @@ export function useNav() {
     pureApp,
     username,
     avatarsStyle,
-    getDropdownItemStyle
+    getDropdownItemStyle,
+    changeWangeditorLanguage
   };
 }

+ 1 - 1
src/views/editor/index.vue

@@ -24,7 +24,7 @@ onMounted(() => {
   }, 1500);
 });
 
-const toolbarConfig = {};
+const toolbarConfig = { excludeKeys: "fullScreen" };
 const editorConfig = { placeholder: "请输入内容..." };
 
 // 组件销毁时,也及时销毁编辑器