【问题标题】:How add custom button to ACF Wysiwyg tinymce?如何将自定义按钮添加到 ACF Wysiwyg tinymce?
【发布时间】:2020-11-16 13:44:27
【问题描述】:

我需要将自定义按钮添加到工具栏 ACF Wysiwyg tinymce。我使用此代码:

tinymce.PluginManager.add( 'wdd_mce_format', function ( editor, url ) {
    editor.addButton( 'wdd_mce_format', {
        active: true,
        tooltip: 'Formating the List',
        text : 'Formating the List',
        icon : false,
        type : 'button',
        onclick : function () {
            do_stuff_here('')
        }
    } );
} );

它适用于标准的 Wordpress tinymce 编辑器。但不适用于 ACF Wysiwyg tinymce。

【问题讨论】:

    标签: wordpress advanced-custom-fields wysiwyg


    【解决方案1】:

    ACF 所见即所得工具栏的初始化忽略了 tinymce 插件的加载
    这段代码解决了问题:

    add_filter( 'acf/fields/wysiwyg/toolbars' , 'my_toolbars'  );
    function my_toolbars( $toolbars )
    {
        return array();
    }
    

    所有插件tinymce正常工作

    【讨论】:

      猜你喜欢
      • 2021-05-02
      • 1970-01-01
      • 2017-11-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多