Support

Account

Home Forums Feature Requests easy way to change default ACF TinyMCE settings Reply To: easy way to change default ACF TinyMCE settings

  • Thanks @elliot this lead me to the solution.

    i can share now this code:

    function my_acf_input_admin_footer() {
    ?>
    <script type="text/javascript">
    acf.add_filter('wysiwyg_tinymce_settings', function( mceInit, id ){
    	
    	// do something to mceInit
    	mceInit.setup = function( 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', '1', '2', '3', '4', '5', '6', '7', '8', '9' ];
                    // 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 () {}); //use if tinyMCE <=4.1.7
                        this.addShortcut('Meta+' + ctrls[i], '', function () {});
                    }
                    for (var i = 0; i < modKeys.length; i++ ) {
                        //this.addShortcut('alt+shift+' + modKeys[i], '', function () {});//use if tinyMCE <=4.1.7
                        this.addShortcut('access+' + modKeys[i], '', function () {});
                    }
        });
    	};
    	// return
    	return mceInit;
    			
    });
    </script>
    <?php
    }
    
    add_action('acf/input/admin_footer', 'my_acf_input_admin_footer');

    can be inserted into function.php or a own plugin and should work. and provide the disable of tinymce shortcuts. (at my example it removes: headings, underline, and more. bold and italic shortcuts would still work)

    I will update this post with the other options that wish to use. as soon i tested it

    EDIT:
    TinyMCE <= 4.1.7, and >= 4.1.8 use different code