basecamp / basecamp/trix

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

Open Beginner friendly
#903 0 comments 2 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
20k
Forks
1.1k
Avg merge
3d 12h
Merged PRs (30d)
13

Description

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](https://github.com/basecamp/trix#inserting-and-deleting-text)? I would think this is a common use case. I could open up a PR for this.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the README section titled “Inserting & Deleting Text” and review the clearing approach referenced from issue #728. Add a concise example showing how to clear the editor programmatically for a form-submission use case. Done means the README documents this common operation under the requested heading.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
documentation
Issue type
Documentation
Difficulty
1/5
Estimated time
Under an hour
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.