refactor(editor): 过滤弃用的TinyMCE插件并优化商品编辑流程

This commit is contained in:
pikachu1995@126.com
2026-08-26 10:07:11 +08:00
parent 457eda829d
commit 404492b7a3
13 changed files with 70 additions and 251 deletions

View File

@@ -2,13 +2,21 @@ import plugins from "./plugins";
import toobar from "./toolbar";
const localCDN = window.location.origin + process.env.BASE_URL + "tinymce"; //本地引入兼容子路径部署publicPath
const DEPRECATED_TINYMCE_PLUGINS = new Set(["template"]);
export function resolveTinymcePlugins(list = plugins) {
const names = Array.isArray(list) ? list : String(list || "").split(/[ ,]+/);
return names.filter((name) => name && !DEPRECATED_TINYMCE_PLUGINS.has(name)).join(" ");
}
export const initEditor = {
base_url: localCDN,
height: "400px",
language: "zh-Hans",
menubar: "file edit view format table", // 菜单:指定应该出现哪些菜单
toolbar: toobar, // 分组工具栏控件
plugins:plugins, // 插件(比如: advlist | link | image | preview等)
plugins: resolveTinymcePlugins(plugins),
object_resizing: false, // 是否禁用表格图片大小调整
end_container_on_empty_block: true, // enter键 分块
powerpaste_word_import: "merge", // 是否保留word粘贴样式 clean | merge

View File

@@ -9,7 +9,7 @@
</div>
</template>
<script>
import { initEditor } from "@/components/editor/config";
import { initEditor, resolveTinymcePlugins } from "@/components/editor/config";
import uploadImage from "@/components/editor/upload-image.vue";
export default {
components:{uploadImage},
@@ -100,7 +100,7 @@ export default {
});
},
..._this.initEditor,
plugins: resolveTinymcePlugins(_this.initEditor.plugins),
height:this.height
});
},