-
Notifications
You must be signed in to change notification settings - Fork 37
Enhance the post editor control #221
Comments
I am working on it here #222 |
@westonruter I cannot find any method to disable plus hide the buttons after the tinyMCE has been instantiated. I could do this which works well /**
* Toggle the editor buttons.
*
* @return {void}
*/
updateEditorButtons: function() {
var control = this, button,
editor = tinyMCE.get( 'customize-posts-content' ),
mediaButton = $( '#wp-customize-posts-content-media-buttons' ),
htmlTab = $( '#customize-posts-content-html' );
_.each( control.params.editor_settings.mce_buttons, function( buttonState, buttonName ) {
editor.controlManager.setDisabled( buttonName, ! buttonState );
button = $( '.mce-i-' + buttonName ).closest( '.mce-btn' );
button.toggleClass( 'hidden', ! buttonState );
} );
htmlTab.toggleClass( 'hidden', ! control.params.editor_settings.html_editor );
mediaButton.toggleClass( 'hidden', ! control.params.editor_settings.media_buttons );
}, however |
@sayedwp I'd say this is low priority, so it can be addressed later. |
Unless you have a direct need for this. |
Your solution looks pretty good. |
Regarding shortcuts causing the buttons to re-appear, that's a challenge I don't have an immediate suggestion for. My experience traversing the depths of TinyMCE is limited. |
There is no direct need for this, so okay we will do this later. |
Building off of #216 some ideas for how we can improve the post editor control:
closeEditor
andopenEditor
to belabels
defined on the registered post type object itself, allowing them to be customized per post type.wp_editor
into theWP_Customize_Post_Editor_Control
itself (static
methods added once):PostEditorControl
to haveparams
which include which TinyMCE buttons should be made available. For example, there may be somepostmeta
field where only basic HTML should be allowed. When the editor is shown for this expanded control, then only the relevant TinyMCE buttons should be displayed. The full suite of controls should then be displayed when going back to editpost_content
. Not totally sure of the feasibility of doing this declaratively via controlparams
, but it could be handy.The text was updated successfully, but these errors were encountered: