Are all of the configurations that you've hard-coded actually necessary? It seems like most of them are likely TinyMCE defaults already, no?
Either way, perhaps it would make sense to expose the options via the Stimulus values API so that people could set their own options via data attributes?
One thing you most likely should consider adding if you're targeting Turbolinks is a check to make sure that Turbolinks is not in cache preview mode. Just add a getter, like so:
And then wrap your init and remove methods in a gate, eg:
disconnect(){if(!this.preview)tinymce.remove()}
Just a thought! If you do take these ideas forward, please do consider cutting an npm package and releasing it. I'd definitely list it on StimulusConnect.
Thanks for the suggestions, which I'll certainly try out.
The configuration is just a suggestion, showing the settings I've been using for a long time for all text boxes right across the site, so it's fine in my case to hardcode them, but exposing the settings would be a useful addition to make it more universally useful, I agree.
As far as I remember, all of the settings I've changed are different from the defaults, but I could be wrong.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Interesting!
Are all of the configurations that you've hard-coded actually necessary? It seems like most of them are likely TinyMCE defaults already, no?
Either way, perhaps it would make sense to expose the options via the Stimulus values API so that people could set their own options via data attributes?
One thing you most likely should consider adding if you're targeting Turbolinks is a check to make sure that Turbolinks is not in cache preview mode. Just add a getter, like so:
And then wrap your
init
andremove
methods in a gate, eg:Just a thought! If you do take these ideas forward, please do consider cutting an npm package and releasing it. I'd definitely list it on StimulusConnect.
Thanks for the suggestions, which I'll certainly try out.
The configuration is just a suggestion, showing the settings I've been using for a long time for all text boxes right across the site, so it's fine in my case to hardcode them, but exposing the settings would be a useful addition to make it more universally useful, I agree.
As far as I remember, all of the settings I've changed are different from the defaults, but I could be wrong.