优化管理端代码结构

This commit is contained in:
paulGao
2022-09-02 17:51:33 +08:00
parent 36c4584970
commit 55aa57d812
147 changed files with 1759 additions and 114 deletions

View File

@@ -0,0 +1,61 @@
import plugins from "./plugins";
import toobar from "./toolbar";
import { upLoadFile } from "@/api/common";
export const initEditor = {
height: "400px",
language: "zh_CN",
menubar: "file edit insert view format table", // 菜单:指定应该出现哪些菜单
toolbar: toobar, // 分组工具栏控件
plugins: plugins, // 插件(比如: advlist | link | image | preview等)
object_resizing: false, // 是否禁用表格图片大小调整
end_container_on_empty_block: true, // enter键 分块
powerpaste_word_import: "merge", // 是否保留word粘贴样式 clean | merge
code_dialog_height: 450, // 代码框高度 、宽度
code_dialog_width: 1000,
advlist_bullet_styles: "square", // 无序列表 有序列表
maxSize: "2097152", // 设置图片大小
accept: "image/jpeg, image/png", // 设置图片上传规则
images_upload_handler: async function (blobInfo, success, failure) {
console.log("请求")
const formData = new FormData();
formData.append("file", blobInfo.blob());
try {
const res = await upLoadFile(formData);
if (res.result) {
success(res.result)
} else {
failure("上传文件有误请稍后重试");
}
} catch (e) {
failure('上传出错')
}
},
// init_instance_callback: function (editor) {
// var freeTiny = document.querySelector(".tox .tox-notification--in");
// freeTiny.style.display = "none";
// },
content_style: `
* { padding:0; margin:0; }
html, body height:100%; }
img { max-width:100%; display:block;height:auto; }
a { text-decoration: none; }
iframe{ width: 100%; }
p { line-height:1.6; margin: 0px; }
table{ word-wrap:break-word; word-break:break-all; max-width:100%; border:none; border-color:#999; }
.mce-object-iframe{ width:100%; box-sizing:border-box; margin:0; padding:0; }
ul,ol{ list-style-position:inside; }
`, // 设置样式
statusbar: false, // 隐藏编辑器底部的状态栏
elementpath: false, // 禁用编辑器底部的状态栏
paste_data_images: true, // 允许粘贴图像
};

View File

@@ -0,0 +1,4 @@
const plugins = [
'advlist anchor autolink autosave code codesample colorpicker colorpicker contextmenu directionality emoticons fullscreen hr image imagetools importcss insertdatetime link lists media nonbreaking noneditable pagebreak paste preview print save searchreplace spellchecker tabfocus table template textcolor textpattern visualblocks visualchars wordcount'
]
export default plugins

View File

@@ -0,0 +1,2 @@
const toolbar = ['searchreplace bold italic underline strikethrough alignleft aligncenter alignright outdent indent blockquote undo redo removeformat subscript superscript code codesample', 'hr bullist numlist link image charmap preview anchor pagebreak insertdatetime media table emoticons forecolor backcolor ']
export default toolbar