Fix for tinymce editor not being initialized on richtext fields#628
Merged
Fix for tinymce editor not being initialized on richtext fields#628
Conversation
added 2 commits
July 14, 2017 14:03
…re-collapsed meta boxes
| } | ||
| }, | ||
|
|
||
| should_readd_rte: function( e, el ) { |
There was a problem hiding this comment.
is this spelled correctly (readd)?
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.
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();
}
Author
There was a problem hiding this comment.
Updated this - thanks for the tip!
mboynes
approved these changes
Jul 18, 2017
Contributor
mboynes
left a comment
There was a problem hiding this comment.
Before we can merge this, you need to bump the version number on the JS file.
mboynes
approved these changes
Oct 12, 2017
Member
Member
|
Thanks @mslinnea! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Meta boxes with
Fieldmanager_RichTextAreafields 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-toggleevents 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.