|
@@ -369,6 +369,130 @@ export default {
|
|
|
addType: [{ required: true, message: "请选择", trigger: "change" }],
|
|
|
},
|
|
|
lastEditRange: null,
|
|
|
+ froalaConfig: {
|
|
|
+ toolbarButtons: [
|
|
|
+ "insertImage",
|
|
|
+ "insertVideo",
|
|
|
+ "insertLink",
|
|
|
+ "embedly",
|
|
|
+ "insertFile",
|
|
|
+ "textColor",
|
|
|
+ "bold",
|
|
|
+ "italic",
|
|
|
+ "underline",
|
|
|
+ "strikeThrough",
|
|
|
+ "subscript",
|
|
|
+ "superscript",
|
|
|
+ "fontFamily",
|
|
|
+ "fontSize",
|
|
|
+ "color",
|
|
|
+ "inlineClass",
|
|
|
+ "inlineStyle",
|
|
|
+ "paragraphStyle",
|
|
|
+ "lineHeight",
|
|
|
+ "paragraphFormat",
|
|
|
+ "align",
|
|
|
+ "formatOL",
|
|
|
+ "formatUL",
|
|
|
+ "outdent",
|
|
|
+ "indent",
|
|
|
+ "quote",
|
|
|
+ "insertTable",
|
|
|
+ "emoticons",
|
|
|
+ "fontAwesome",
|
|
|
+ "specialCharacters",
|
|
|
+ "insertHR",
|
|
|
+ "selectAll",
|
|
|
+ "clearFormatting",
|
|
|
+ "html",
|
|
|
+ "undo",
|
|
|
+ "redo",
|
|
|
+ ],
|
|
|
+ imageDefaultWidth: false,
|
|
|
+ imageInsertButtons: ["imageUpload", "imageByURL"],
|
|
|
+ height: 800,
|
|
|
+ fontSizeDefaultSelection: "16",
|
|
|
+ fontSize: ["12", "14", "16", "18", "20", "24", "28", "32", "36", "40"],
|
|
|
+ fontFamily:{
|
|
|
+ 'Arial,Helvetica,sans-serif': 'Arial',
|
|
|
+ 'Georgia,serif': 'Georgia',
|
|
|
+ 'Impact,Charcoal,sans-serif': 'Impact',
|
|
|
+ 'Tahoma,Geneva,sans-serif': 'Tahoma',
|
|
|
+ "'Times New Roman',Times,serif": 'Times New Roman',
|
|
|
+ 'Verdana,Geneva,sans-serif': 'Verdana',
|
|
|
+ '宋体': '宋体',
|
|
|
+ '黑体': '黑体',
|
|
|
+ '微软雅黑': '微软雅黑'
|
|
|
+ },
|
|
|
+ theme: "dark", //主题
|
|
|
+ placeholderText: "请输入内容",
|
|
|
+ language: "zh_cn", //国际化
|
|
|
+ imageUploadURL: process.env.VUE_APP_API_ROOT + "/report/uploadImg", //上传url
|
|
|
+ imagePaste: true,
|
|
|
+ imagePasteProcess: true,
|
|
|
+ imageResize: true,
|
|
|
+ videoUploadURL: process.env.VUE_APP_API_ROOT + "/report/uploadImg", //上传url
|
|
|
+ fileUploadURL: process.env.VUE_APP_API_ROOT + "/report/uploadImg", //上传url 更多上传介绍 请访问https://www.froala.com/wysiwyg-editor/docs/options
|
|
|
+ toolbarSticky: false, //操作栏是否自动吸顶
|
|
|
+ imageEditButtons: [
|
|
|
+ "imageLink",
|
|
|
+ "imageAlign",
|
|
|
+ "imageInfo",
|
|
|
+ "imageRemove",
|
|
|
+ ],
|
|
|
+ quickInsertButtons: ["image", "table", "ul", "ol", "hr"], //快速插入项
|
|
|
+ toolbarVisibleWithoutSelection: true, //是否开启 不选中模式
|
|
|
+ saveInterval: 0,
|
|
|
+ /* saveParam: 'Content',
|
|
|
+ saveURL: process.env.VUE_APP_API_ROOT+'/report/saveReportContent',
|
|
|
+ saveMethod: 'POST',
|
|
|
+ saveParams: {}, */
|
|
|
+ events: {
|
|
|
+ initialized: function () {
|
|
|
+ //this.editor 定义在vue data 中
|
|
|
+ that.editor = this;
|
|
|
+ },
|
|
|
+ keyup: function (e, editor) {
|
|
|
+ //添加事件,在每次按键按下时,都记录一下最后停留位置
|
|
|
+ that.lastEditRange = getSelection().getRangeAt(0) || 0;
|
|
|
+ },
|
|
|
+ click: function (e, editor) {
|
|
|
+ //添加事件,在每次鼠标点击时,都记录一下最后停留位置
|
|
|
+ if (getSelection().type === "None") return;
|
|
|
+ that.lastEditRange = getSelection().getRangeAt(0) || 0;
|
|
|
+ },
|
|
|
+ //内容改变事件
|
|
|
+ contentChanged: function () {
|
|
|
+ console.log("cont-change");
|
|
|
+ that.ischange = true;
|
|
|
+ if (getSelection().type !== "None") {
|
|
|
+ that.lastEditRange = getSelection().getRangeAt(0) || 0;
|
|
|
+ }
|
|
|
+ },
|
|
|
+ //粘贴图片上传事件
|
|
|
+ "image.beforePasteUpload": function (img) {
|
|
|
+ //console.log('image.beforePasteUpload',img)
|
|
|
+ //暂停自动保存
|
|
|
+ that.autoSaveFlag = false;
|
|
|
+ },
|
|
|
+ //点击toolbar上传图片事件
|
|
|
+ "image.beforeUpload": function (imgs) {
|
|
|
+ //console.log('image.beforeUpload',imgs)
|
|
|
+ //暂停自动保存
|
|
|
+ that.autoSaveFlag = false;
|
|
|
+ },
|
|
|
+ "image.inserted": function ($img, response) {
|
|
|
+ //console.log('img-inserted',$img)
|
|
|
+ //开启自动保存
|
|
|
+ that.autoSaveFlag = true;
|
|
|
+ },
|
|
|
+ //如果上传图片出错,重置autoSaveFlag
|
|
|
+ "image.error": function (error, response) {
|
|
|
+ that.autoSaveFlag = true;
|
|
|
+ },
|
|
|
+ },
|
|
|
+ charCounterCount: false,
|
|
|
+ },
|
|
|
reportloadding: false,
|
|
|
timer: null,
|
|
|
ischange: false,
|