import Vue from "vue"
import "font-awesome/css/font-awesome.css"
import VueHtml5Editor from" vue-html5-editor"
export default function () {
let opt = {
// new VueHtml5Editor(options)
name: "vue-html5-editor",
//
showModuleName: true,
// classfont-awesome
icons: {
text: "fa fa-pencil",
color: "fa fa-paint-brush",
font: "fa fa-font",
align: "fa fa-align-justify",
list: "fa fa-list",
link: "fa fa-chain",
unlink: "fa fa-chain-broken",
tabulation: "fa fa-table",
image: "fa fa-file-image-o",
hr: "fa fa-minus",
eraser: "fa fa-eraser",
undo: "fa-undo fa",
"full-screen": "fa fa-arrows-alt",
info: "fa fa-info",
},
//
image: {
//
sizeLimit: 512 * 1024 * 10,
// ,base64
// upload config,default null and convert image to base64
upload: {
url: null,
headers: {},
params: {},
fieldName: {}
},
// ,localResizeIMG,null
// widthheight
compress: {
width: 600,
height: 600,
quality: 80
},
// ,
uploadHandler(responseText){
//default accept json data like {ok:false,msg:"unexpected"} or {ok:true,data:"image url"}
var json = JSON.parse(responseText);
console.info(json);
if (!json.ok) {
alert(json.msg)
} else {
return json.data
}
}
},
// en-uszh-cn
language: "zh-cn",
//
i18n: {
"zh-cn": {
"align": "",
"image": "",
"list": "",
"link": "",
"unlink": "",
"table": "",
"font": "",
"full screen": "",
"text": "",
"eraser": "",
"info": "",
"color": "",
"please enter a url": "",
"create link": "",
"bold": "",
"italic": "",
"underline": "",
"strike through": "",
"subscript": "",
"superscript": "",
"heading": "",
"font name": "",
"font size": "",
"left justify": "",
"center justify": "",
"right justify": "",
"ordered list": "",
"unordered list": "",
"fore color": "",
"background color": "",
"row count": "",
"column count": "",
"save": "",
"upload": "",
"progress": "",
"unknown": "",
"please wait": "",
"error": "",
"abort": "",
"reset": ""
}
},
//
hiddenModules: [],
//
visibleModules: [
"text",
"color",
"font",
"align",
"list",
"link",
"unlink",
"tabulation",
"image",
"hr",
"eraser",
"undo",
"full-screen",
"info",
],
// examples
// extended modules
modules: {
//omit,reference to source code of build-in modules
}
};
Vue.use (VueHtml5Editor, opt);
}
main.js