-
Notifications
You must be signed in to change notification settings - Fork 99
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
Fix for tinymce editor not being initialized on richtext fields #628
Conversation
…re-collapsed meta boxes
@@ -110,10 +110,19 @@ | |||
if ( 'html' === core_editor_state || 'tinymce' === core_editor_state ) { | |||
setUserSetting( 'editor', core_editor_state ); | |||
} | |||
}, | |||
|
|||
should_readd_rte: function( e, el ) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this spelled correctly (readd)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As far as I'm aware?
js/richtext.js
Outdated
|
||
should_readd_rte: function( e, el ) { | ||
if ( ! $( el ).hasClass( 'closed' ) && $( el ).find( 'textarea.fm-richtext' ).length ) { | ||
if ( ! $( el ).find( 'textarea' ).hasClass( 'fm-tinymce' ) ) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You could combine these loops and do it without jQuery:
if (
!el.classList.contains( 'closed' ) &&
el.querySelector('textarea.fm-richtext') &&
!el.querySelector( 'textarea.fm-tinymce')
) {
fm.richtextarea.add_rte_to_visible_textareas();
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated this - thanks for the tip!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Before we can merge this, you need to bump the version number on the JS file.
Thanks @mslinnea! |
Meta boxes with
Fieldmanager_RichTextArea
fields inside of them that were collapsed on page load did not have their TinyMCE initialized due to not being visible. This PR will add code to check onpostbox-toggle
events whether or not the toggled postbox has such a field, and if so, whether or not it has been initialized. If it has a field that has not been initialized, the code will calladd_rte_to_visible_textareas()
again to add the TinyMCE to the textarea.