Commit f6115990 by yuananting

fix:wangeditor版本冲突

parent b92e5d38
......@@ -94,7 +94,6 @@ class QuestionEditor extends Component {
this.editorRoot.txt.html(
/^\<p/.test(content) ? content : `<p>${content}</p>`
);
this.editorRoot.change && this.editorRoot.change();
};
renderEditor() {
......@@ -104,12 +103,12 @@ class QuestionEditor extends Component {
`#editor${editorId}_tabbar`,
`#editor${editorId}_content`
);
editorRoot.customConfig.menus = [];
editorRoot.customConfig.uploadImgMaxSize = 1 * 1024 * 1024;
editorRoot.customConfig.customAlert = function (info) {
editorRoot.config.menus = [];
editorRoot.config.uploadImgMaxSize = 1 * 1024 * 1024;
editorRoot.config.customAlert = function (info) {
message.warning(/1M/.test(info) ? "图片大于1M,请使用图片上传" : info);
};
editorRoot.customConfig.customUploadImg = function (files, insert) {
editorRoot.config.customUploadImg = function (files, insert) {
// files 是 input 中选中的文件列表
// insert 是获取图片 url 后,插入到编辑器的方法
UploadOss.uploadBlobToOSS(files[0], window.random_string(16)).then(
......@@ -118,10 +117,10 @@ class QuestionEditor extends Component {
}
);
};
editorRoot.customConfig.zIndex = 999;
editorRoot.customConfig.pasteFilterStyle = false;
editorRoot.config.zIndex = 999;
editorRoot.config.pasteFilterStyle = false;
// 自定义处理粘贴的文本内容
editorRoot.customConfig.pasteTextHandle = function (content) {
editorRoot.config.pasteTextHandle = function (content) {
if (content == "" && !content) return "";
var str = content;
str = str.replace(/<xml>[\s\S]*?<\/xml>/gi, "");
......@@ -161,7 +160,7 @@ class QuestionEditor extends Component {
}
}
editorRoot.customConfig.onchange = (html) => {
editorRoot.config.onchange = (html) => {
const conLen = html.replace(/<(?!img|input).*?>/g, "").length;
counter++;
const { focusFlag } = this.state;
......@@ -209,9 +208,8 @@ class QuestionEditor extends Component {
);
};
editorRoot.customConfig.onblur = (html) => {
editorRoot.config.onblur = (html) => {
const conLen = html.replace(/<(?!img|input).*?>/g, "").length;
editorRoot.change && editorRoot.change();
this.setState({
focusFlag: false,
visibleMediaBox: false,
......@@ -220,7 +218,7 @@ class QuestionEditor extends Component {
});
};
editorRoot.customConfig.onfocus = () => {
editorRoot.config.onfocus = () => {
this.setState({
focusFlag: true,
visibleMediaBox: true,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment