Allow the type of the extensionStorage field of the Editor class to be customizable #6113
arnaugomez
started this conversation in
Feature Requests
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Description
The
Editor.extensionStorage
field has a type ofRecord<string, any>
. I suggest it could be strongly typed and customizable, like the type of editor commands.The pros would be improved TypeScript type safety. The cons would be that the extension storage is not as frequently used as the commands, and that it could make the code more complex, thus making the creation of new extensions more difficult.
I created a PR, you can see it here. Tell me if it's a good feature and what you think about it :)
Use Case
For example, we could make the characterCount extension strongly typed by adding this code
Then, when accessing
Editor.extensionStorage
, it would have a type of{characterCount: CharacterCountStorage}
. So the developer would have autocomplete in the code editor :)Type
New Tiptap API
Beta Was this translation helpful? Give feedback.
All reactions