mirror of
https://gitee.com/beijing_hongye_huicheng/lilishop-ui.git
synced 2026-09-21 04:12:03 +08:00
refactor(editor): 过滤弃用的TinyMCE插件并优化商品编辑流程
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
});
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user