So, one last update. That javascript enables tinyMCE on every textarea.
Yikes. Changed it to this so it only enables on textarea tags with class
of mceEditor which is what AS does when you do:
config.columns[:notes].form_ui = :text_editor
(function($) {
$(document).on('as:action_success', 'a.as_action', function(e,
action_link) {
tinyMCE.init({ selector: 'textarea.mceEditor' });
});
})(jQuery);
Sorry for the confusion.
Mike
On Friday, February 28, 2014 12:16:24 PM UTC-8, mvargo wrote:
>
> Well, I got this workaround going. In my javascript I put this:
>
> (function($) {
> $(document).on('as:action_success', 'a.as_action', function(e,
> action_link) {
> tinyMCE.init({ mode: 'textareas' });
> });
> })(jQuery);
>
> and now the editor is loaded. I got the clue from:
>
> https://github.com/activescaffold/active_scaffold/wiki/Customizing-with-Javascript
>
> Thanks wiki peeps
>
> Mike Vargo
>
> On Thursday, February 27, 2014 9:34:45 AM UTC-8, mvargo wrote:
>>
>> from Gemfile.lock:
>>
>> active_scaffold (3.2.20)
>> rails (>= 3.1.3)
>> rails (3.2.13)
>> tinymce-rails (4.0.1)
>>
>> Sorry if this is dumb. I did search for this in the group but have not
>> seen this specific problem.
>>
>> I have a text field that has
>> config.columns[:notes].form_ui = :text_editor
>>
>> When I edit a record for that I see the markup has the right classes added
>>
>> <textarea class="notes-input mceEditor" id="record_notes_1"
>> name="record[notes]">
>> ...
>> </textarea>
>>
>> But the editor code is not run. If I pop open a javascript console in
>> the browser and type in
>>
>> tinyMCE.init({ mode: 'textareas' });
>>
>> the editor activates correctly. So the asset pipeline is all setup. the
>> javascript all loads. It's just the javascript that loads the edit window
>> in the dom is not initializing the editor.
>>
>> Anybody else see this?
>>
>> I could try to figure out a way to hack the javascript so that it calls
>> the init afterwards but it seems I just have a config error.
>>
>> Mike Vargo
>>
>> PS: I see the tiny_mce_bridge.js code load in the browser, but that only
>> has to do with unloading it on close, not loading it on open. I don't
>> think I can do a $(document).ready thing either cause AS loads the edit
>> window via ajax and not a page load.
>>
>> Thank you in advance for your patience.
>>
>>
>>
--
You received this message because you are subscribed to the Google Groups
"ActiveScaffold : Ruby on Rails Gem" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/activescaffold.
For more options, visit https://groups.google.com/groups/opt_out.