From 0ef8fad83ccc0446e1e0ca6419e24d74a0cd59ac Mon Sep 17 00:00:00 2001 From: danshihao Date: Fri, 2 Aug 2024 15:05:00 +0800 Subject: [PATCH] =?UTF-8?q?[update=20ueditor]=20=E5=88=87=E6=8D=A2?= =?UTF-8?q?=E8=AF=AD=E8=A8=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/ueditor/lang/en/en.js | 2 +- public/ueditor/lang/zh-cn/zh-cn.js | 2 +- src/components/uEditor/UEditor.vue | 10 ++++++++++ 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/public/ueditor/lang/en/en.js b/public/ueditor/lang/en/en.js index c9ef275..ac6ed08 100644 --- a/public/ueditor/lang/en/en.js +++ b/public/ueditor/lang/en/en.js @@ -74,7 +74,7 @@ UE.I18N['en'] = { 'jsonEncodeError': 'Server Return Format Error', 'loading':"loading...", 'loadError':"load error", - 'errorLoadConfig': 'Server config not loaded, upload can not work.', + 'errorLoadConfig': 'Cannot upload images by pasting or dragging.', }, 'simpleupload':{ 'exceedSizeError': 'File Size Exceed', diff --git a/public/ueditor/lang/zh-cn/zh-cn.js b/public/ueditor/lang/zh-cn/zh-cn.js index b71af48..79d60a8 100644 --- a/public/ueditor/lang/zh-cn/zh-cn.js +++ b/public/ueditor/lang/zh-cn/zh-cn.js @@ -74,7 +74,7 @@ UE.I18N['zh-cn'] = { 'jsonEncodeError': '服务器返回格式错误', 'loading':"正在上传...", 'loadError':"上传错误", - 'errorLoadConfig': '后端配置项没有正常加载,上传插件不能正常使用!' + 'errorLoadConfig': '不支持通过粘贴或拖拽上传图片!' }, 'simpleupload':{ 'exceedSizeError': '文件大小超出限制', diff --git a/src/components/uEditor/UEditor.vue b/src/components/uEditor/UEditor.vue index 3315c12..adca935 100644 --- a/src/components/uEditor/UEditor.vue +++ b/src/components/uEditor/UEditor.vue @@ -62,6 +62,16 @@ export default { } }, mounted () { + // 首次加载完所有语言包后,浅拷贝存备份(没有找到正常切换语言的api,暂时先这么处理) + if (Object.keys(UE.I18N).length > 1) { + window.__COPY_UE_I18N__ = { ...UE.I18N } + } + // 更新语言包(将备份语言包浅拷贝回来,只保留需要的一个需要的语言包) + if (localStorage.getItem('language') === 'en-us') { + UE.I18N = { en: window.__COPY_UE_I18N__.en } + } else { + UE.I18N = { ['zh-cn']: window.__COPY_UE_I18N__['zh-cn'] } + } UEDITOR_CONFIG.UEDITOR_HOME_URL = '../../../public/ueditor/' // 初始化UE this.editor = UE.delEditor('editor')