spohlenz / tinymce-rails

Integration of TinyMCE with the Rails asset pipeline
Other
816 stars 256 forks source link

Multiple Instance on same page #42

Closed nazarhussain closed 12 years ago

nazarhussain commented 12 years ago

Hi, Your gem is great in reference to including the tinnyMCE,

I was having an issue with your current version 3.4.8, I want to have multiple tinnyMCE instances on the same page.

I tried it out as:

$('textarea.editor').tinymce({
            theme:'simple'
        });

This makes all textareas with editor available but when i post the form for each editor new text does not posted.

if i use it like

$("textarea.editor").live('focus', function () {
        $(this).tinymce({
            theme:'simple'
        });
    });

Every time i focus on any of the text-area, only the first text-area in the DOM is converted into the editor.

Why is i am facing such a behavior?

nazarhussain commented 12 years ago

Since all the text-area objects were the attributes of the same model. So all generated text-areas was having same id attribute. I just changed the code to generate unique id for every textarea and its working now.

Can you please add this information in README, so that no one else face this issue.

lukerollans commented 9 years ago

This isn't fixing the issue for me. My textarea elements have unique IDs, but changes going in to the TinyMCE editor are not being applied to the textarea itself, so on a new record, my validates_presence_of validation is failing, and on updating, the new content is not being applied. The old content is going through to the controller

Does anyone have any other insight?

thegentleman100 commented 8 years ago

nazarhussain thank you, your comment really helped me!