TinyMCE editor is initialized once on page load. However, if there interaction is managed by Turbo, the initialization is not executed, causing the textarea to remain as a plain textarea.
To properly use TinyMCE with turbo, the initialization code is migrated into a Stimulus controller.
import { Controller } from "@hotwired/stimulus"
export default class extends Controller {
connect() {
tinymce.init({});
}
disconnect() {
tinymce.remove();
}
}
And in your view:
<div data-controller="editor">
<!-- your Textarea -->
</div>
This ties the initiation code with the connect/disconnect event from this view.