本文示例使用的
- html
- vue
- ckeditor4
监听代码如下,作用是会在粘贴的文本外面包含一层p标签属性增加方法内的属性,可以自行修改
<textarea class="border" id="contentText"
name="docContentText" rows="5" cols="80"></textarea>
mounted: function () {
const that = this;
//初始化
that.buildckeditor = CKEDITOR.replace('contentText', {height: '500px', width: '99%'});
that.buildckeditor.on('instanceReady', function(ev) {
ev.editor.dataProcessor.htmlFilter.addRules({
elements: {
p: function (e) { e.attributes.style = 'font-family:' + '仿宋_GB2312' + ';'; }
}
});
});
},