Support

Account

Home Forums ACF PRO ACF PRO WYSIWYG not getting changed default settings

Solved

ACF PRO WYSIWYG not getting changed default settings

  • Hello,

    I’m using ACF Pro. It works quite well, the only problem I ran into is that even if I change the default TinyMCE settings (making different toolbar) and the ACF WYSIWYG Editor still loads the system default toolbar and TinyMCE settings. I tried adding my own code for TinyMCE and I also tried some plugins.

    Is it possible to overwrite ACF WYSIWYG settings? A hook maybe?

  • Hi @arpad

    What code are you using to modify the toolbars?
    Here is an article to help: http://www.advancedcustomfields.com/resources/customize-the-wysiwyg-toolbars/

    Thanks
    E

  • is it possible to edit other settings too?
    i had a hook that works for the default wysiwyg.
    but not for the acf_wysiwyg-fields. (it looks like my hook is not fully executed)

    add_action( 'wp_tiny_mce_init', function () {
        ?>
        <script>
         function editShortcut_tiny_mce_init(ed) {
            ed.on('init', function () {
             // Note these lists may not be complete & that other tinymce plugins can add their own shortcuts anyway.
                    var ctrls = [ 'u', '1', '2', '3', '4', '5', '6', '7', '8', '9', 's', 'k', 'Alt+F', 'P' ];
                    var modKeys = [ 'c', 'r', 'l', 'j', 'q', 'u', 'o', 'n', 's', 'm', 'z', 't', 'd', 'h', 'o', 'x', 'a', 'w' ];
                    // Overwrite shortcuts with no-op function. Key sequences will still be captured.
                    for (var i = 0; i < ctrls.length; i++ ) {
                        this.addShortcut('ctrl+' + ctrls[i], '', function () {});
                    }
                    for (var i = 0; i < modKeys.length; i++ ) {
                        this.addShortcut('alt+shift+' + modKeys[i], '', function () {});
                    }
        });
        }
        </script>
        <?php
        
    });
    
    function my_acf_editor( $mceInit, $editor_id ) {
    	$mceInit['setup'] = 'editShortcut_tiny_mce_init';
    	// What goes into the 'formatselect' list
    	$mceInit['block_formats'] = 'Header 3=h3;Header 4=h4;Header 5=h5;Paragraph=p;Code=code';
    	$mceInit['paste_word_valid_elements'] = '-strong/b,-em/i,-p,-ol,-ul,-li,-h3,-h4,-h5,-h6,-p,-table[width],-tr,-td[colspan|rowspan|width],-th,-thead,-tfoot,-tbody,-a[href|name],br,del';
    		
    	$mceInit['paste_strip_class_attributes'] = 'all';
    	$mceInit['toolbar1'] = 'bold,italic,formatselect,bullist,numlist,blockquote,link,unlink,undo,redo';
    
    	return $mceInit;
    }
    add_filter('tiny_mce_before_init', 'my_acf_editor')
    

    i need a solution that works inside function.php or better, inside my custom plugin.
    can anyone help me? please.

    my aim is: to have a verry simple wysiwyg that only allow things defined by me.
    only edit toolbar is not enough, because the user can avoid these restrictions with shortkeys and/or copy&paste from word.

Viewing 4 posts - 1 through 4 (of 4 total)

The topic ‘ACF PRO WYSIWYG not getting changed default settings’ is closed to new replies.