editablejs / editable

🌱 A collaborative rich-text editor framework that focuses on stability, controllability, extensibility, and performance. 一款强到离谱的富文本编辑器框架,专注于稳定性、可控性、扩展性和性能。
https://docs.editablejs.com
Apache License 2.0
1.79k stars 120 forks source link

如何通过点击一个按钮去实现清空编辑器内容呢? #136

Closed HAY0526 closed 11 months ago

HAY0526 commented 11 months ago

Problem 根据文件id获取不同文件的内容,然后传给编辑器,每次赋值时需要先清空编辑器然后再赋值,有没有类似清空编辑器的方法呢?

big-camel commented 11 months ago
import { Transforms } from '@editablejs/models'
Transforms.delete(editor, { at: {
 anchor: Editor.start(editor, editor),

 focus: Editor.end(editor, editor)
}})