init_instance_callback: (editor) => {
if (_this.value) {
editor.setContent(_this.value); // 设置编辑器的内容为传入的 this.value 值
}
// 添加一个新的格式方案
editor.formatter.register('my_custom_format', {
block:'p',
styles: {
'font-size': '14pt',
'line-height': '1.5',
'text-indent': '4ch'
}
});
// 自动应用该方案到任何新的段落
editor.on('NewBlock', function(e) {
editor.formatter.apply('my_custom_format');
});
// 应用该方案到已有内容和新的内容
editor.formatter.apply('my_custom_format');
_this.hasInit = true;
// 当编辑器内容发生变化时,触发这个函数
editor.on("NodeChange Change KeyUp SetContent", () => {
this.hasChange = true;
// 在内容发生变化时触发 this.$emit("input", editor.getContent()),
this.$emit("input", editor.getContent());
});
},
tinymce编辑器设置默认格式并且可以在内容中携带出来
于 2024-01-07 15:16:05 首次发布