|
@@ -97,12 +97,14 @@ export default {
|
|
[{ align: [] }], // 对齐方式
|
|
[{ align: [] }], // 对齐方式
|
|
["clean"], // 清除文本格式
|
|
["clean"], // 清除文本格式
|
|
["link", "image", "video"], // 链接、图片、视频
|
|
["link", "image", "video"], // 链接、图片、视频
|
|
- // [{clean: '源码编辑'}]
|
|
|
|
],
|
|
],
|
|
handlers: {
|
|
handlers: {
|
|
shadeBox: null,
|
|
shadeBox: null,
|
|
|
|
+ source: false,
|
|
// 添加工具方法
|
|
// 添加工具方法
|
|
sourceEditor: function () {
|
|
sourceEditor: function () {
|
|
|
|
+ this.source = true; //开启源码编辑
|
|
|
|
+ console.log("开启源码编辑")
|
|
// alert('我新添加的工具方法');
|
|
// alert('我新添加的工具方法');
|
|
const container = this.container;
|
|
const container = this.container;
|
|
const firstChild = container.nextElementSibling.firstChild;
|
|
const firstChild = container.nextElementSibling.firstChild;
|
|
@@ -114,6 +116,8 @@ export default {
|
|
container.appendChild(shadeBox);
|
|
container.appendChild(shadeBox);
|
|
firstChild.innerText = firstChild.innerHTML;
|
|
firstChild.innerText = firstChild.innerHTML;
|
|
shadeBox.addEventListener('click', function () {
|
|
shadeBox.addEventListener('click', function () {
|
|
|
|
+ this.source = false; //关闭源码编辑
|
|
|
|
+ console.log("关闭源码编辑")
|
|
this.style.display = 'none';
|
|
this.style.display = 'none';
|
|
firstChild.innerHTML = firstChild.innerText.trim();
|
|
firstChild.innerHTML = firstChild.innerText.trim();
|
|
}, false);
|
|
}, false);
|
|
@@ -121,6 +125,7 @@ export default {
|
|
this.shadeBox.style.display = 'block';
|
|
this.shadeBox.style.display = 'block';
|
|
firstChild.innerText = firstChild.innerHTML;
|
|
firstChild.innerText = firstChild.innerHTML;
|
|
}
|
|
}
|
|
|
|
+ // this.$emit("isSource",this.source); //父组件触发自定义事件,是否开启源码编辑
|
|
},
|
|
},
|
|
'image': function (value) {
|
|
'image': function (value) {
|
|
if (value) {
|
|
if (value) {
|
|
@@ -229,7 +234,7 @@ export default {
|
|
onEditorChange({editor, html, text}) {//内容改变事件
|
|
onEditorChange({editor, html, text}) {//内容改变事件
|
|
console.log("---内容改变事件---");
|
|
console.log("---内容改变事件---");
|
|
this.content = html
|
|
this.content = html
|
|
- console.log(html)
|
|
|
|
|
|
+ // console.log(html)
|
|
},
|
|
},
|
|
// 富文本图片上传前
|
|
// 富文本图片上传前
|
|
beforeUpload(file) {
|
|
beforeUpload(file) {
|