Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我不知道如何在 Slate v0.50+ 的编辑器中删除所有内容。
我曾经能够做这样的事情:
editor.moveToRangeOfDocument().delete()
我现在该怎么做?
你需要先得到Location编辑器的开始,然后是结束Location,最后是使用Transforms.delete,像这样:
Location
Transforms.delete
import { Transforms } from 'slate'; // ... Transforms.delete(editor, { at: { anchor: Editor.start(editor, []), focus: Editor.end(editor, []), }, });