|
@@ -1,10 +1,10 @@
|
|
|
-<template lang="html">
|
|
|
- <div class="editor" >
|
|
|
- <div ref="toolbar" class="toolbar">
|
|
|
- </div>
|
|
|
- <div ref="editor" class="text">
|
|
|
- </div>
|
|
|
- </div>
|
|
|
+<template lang="html">
|
|
|
+ <div class="editor">
|
|
|
+ <div ref="toolbar" class="toolbar">
|
|
|
+ </div>
|
|
|
+ <div ref="editor" class="text">
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
@@ -34,9 +34,9 @@ export default {
|
|
|
type: Boolean,
|
|
|
default: false,
|
|
|
},
|
|
|
- placeholder:{
|
|
|
- type:String,
|
|
|
- default:"请输入正文"
|
|
|
+ placeholder: {
|
|
|
+ type: String,
|
|
|
+ default: "请输入正文"
|
|
|
}
|
|
|
},
|
|
|
watch: {
|
|
@@ -68,25 +68,25 @@ export default {
|
|
|
"head", //标题
|
|
|
"bold", //加粗
|
|
|
"fontSize", //字体大小
|
|
|
- "fontName", //字体
|
|
|
- "italic", //斜体
|
|
|
- "underline", //下划线
|
|
|
- "strikeThrough", //删除线
|
|
|
+ // "fontName", //字体
|
|
|
+ // "italic", //斜体
|
|
|
+ // "underline", //下划线
|
|
|
+ // "strikeThrough", //删除线
|
|
|
"indent", //缩进
|
|
|
- "lineHeight", //行高
|
|
|
+ // "lineHeight", //行高
|
|
|
// "foreColor",
|
|
|
// "backColor",
|
|
|
// "link",
|
|
|
"list",
|
|
|
- "todo",
|
|
|
+ // "todo",
|
|
|
"justify",
|
|
|
- "quote",
|
|
|
+ // "quote",
|
|
|
// "emoticon",
|
|
|
"image",
|
|
|
// "video",
|
|
|
"table",
|
|
|
// "code",
|
|
|
- "splitLine",
|
|
|
+ // "splitLine",
|
|
|
"undo",
|
|
|
"redo",
|
|
|
];
|
|
@@ -120,7 +120,7 @@ export default {
|
|
|
file.name.split(".")[0] +
|
|
|
new Date().getTime() +
|
|
|
"." +
|
|
|
- file.name.split(".")[file.name.split(".").length-1],
|
|
|
+ file.name.split(".")[file.name.split(".").length - 1],
|
|
|
ContentType: file.type,
|
|
|
Body: file,
|
|
|
"Access-Control-Allow-Credentials": "*",
|
|
@@ -138,7 +138,7 @@ export default {
|
|
|
// console.log("Uploaded : " + parseInt((evt.loaded * 80) / evt.total) + '%');
|
|
|
})
|
|
|
.send(function (err, data) {
|
|
|
- loading.close();
|
|
|
+ loading.close();
|
|
|
if (err) {
|
|
|
that.$message.error("上传失败");
|
|
|
} else {
|
|
@@ -149,6 +149,19 @@ export default {
|
|
|
}
|
|
|
}
|
|
|
};
|
|
|
+ //配置 自定义处理粘贴的文本内容
|
|
|
+ this.editor.config.pasteTextHandle = function (content) {
|
|
|
+ if (content == '' && !content) return ''
|
|
|
+ var str = content
|
|
|
+ str = str.replace(/<xml>[\s\S]*?<\/xml>/ig, '')
|
|
|
+ str = str.replace(/<style>[\s\S]*?<\/style>/ig, '')
|
|
|
+ str = str.replace(/<\/?[^>]*>/g, '')
|
|
|
+ str = str.replace(/[ | ]*\n/g, '\n')
|
|
|
+ str = str.replace(/ /ig, '')
|
|
|
+ // console.log('****', content)
|
|
|
+ // console.log('****', str)
|
|
|
+ return str
|
|
|
+ };
|
|
|
this.editor.config.onchange = (html) => {
|
|
|
this.info_ = html; // 绑定当前逐渐地值
|
|
|
this.$emit("change", this.info_); // 将内容同步到父组件中
|
|
@@ -167,9 +180,11 @@ export default {
|
|
|
position: relative;
|
|
|
z-index: 0;
|
|
|
}
|
|
|
+
|
|
|
.toolbar {
|
|
|
border: 1px solid #ccc;
|
|
|
}
|
|
|
+
|
|
|
.text {
|
|
|
border: 1px solid #ccc;
|
|
|
height: 230px;
|