Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Getting Rails 7 Stimulus controllers to work with Tinymce #299

Open
arjunrajkumar opened this issue Feb 13, 2023 · 0 comments
Open

Getting Rails 7 Stimulus controllers to work with Tinymce #299

arjunrajkumar opened this issue Feb 13, 2023 · 0 comments

Comments

@arjunrajkumar
Copy link

Hey! Not sure if this should go here, but was wondering if I need to do anything extra to get Tinymce-rails working properly with Rails 7 + stimulus + importmaps

The editor is working fine except for stimulus.

Things i've done for setting up TinyMCE

  1. Added the gem - gem 'tinymce-rails', '~> 6.3.1'
  2. Added config/tinymce.yml with the default settings
  3. Included TinyMCE assets using the tinymce_assets helper:
<%= tinymce_assets %>
#=> <script type="text/javascript" src="/assets/tinymce.js">
  1. Initialized TinyMCE in the views
<%= form.text_area :description_html, value: product.description_html, class: "tinymce", rows: 40, cols: 120 %>
<%= tinymce %>

Problem: Whenever the description_html colum is edited I also want to to send an event to a stimulus javascript controller. Normally, I would call it like this:
<%= form.text_area :description_html, value: product.description_html, class: "tinymce", rows: 40, cols: 120, data: {action: "input->submit#activate"} %>

But as an iframe is loaded when I use TinyMCE, i'm wondering how to do this.

Just wondering how to go forward with this. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant