trix icon indicating copy to clipboard operation
trix copied to clipboard

Can we add how to programmatically clear the editor to the README/Documentation?

Open alejo4373 opened this issue 4 years ago • 0 comments

I spent some time trying to find in the API a way to clear the contents of the editor programmatically. After a few keyword searches across the repo I found #728 where @maximedupre shows a method of clearing the content of the editor that could be used upon form submission (my use case)

You could also clear your trix editor dynamically by loading an empty state:

trixEditorElement.editor.loadJSON(JSON.parse('{"document": []}'))

Can we add this to the documentation under the heading Inserting & Deleting Text? I would think this is a common use case. I could open up a PR for this.

alejo4373 avatar May 04 '21 05:05 alejo4373