繁体   English   中英

Wordpress TinyMCE在弹出表单中添加描述

[英]Wordpress TinyMCE add a description to a popup form

今天,我一直在为Wordpress中的TinyMCE编辑器创建自定义按钮,它们已链接到简码,并且在单击时会打开一个弹出窗口,用户可以在其中为给定的简码填写参数。 一切正常,但是我觉得它需要为用户提供更多指导,因此我想在弹出窗口的每个参数下添加说明。

这是处理弹出窗口的javascript的示例-您将看到这会创建一个包含5个项目的下拉列表,供用户选择。

(function() {
tinymce.PluginManager.add('skizzar_container', function( editor, url ) {
    editor.addButton( 'skizzar_container', {
        title: 'Add a Container',
        icon: 'icon dashicons-media-text',
        onclick: function() {
editor.windowManager.open( {
    title: 'Container',
    body: [{
        type: 'listbox',
        name: 'style',
        label: 'Style',
        'values': [
            {text: 'Clear', value: 'clear'},
            {text: 'White', value: 'white'},                
            {text: 'Colour 1', value: 'colour1'},
            {text: 'Colour 2', value: 'colour2'},
            {text: 'Colour 3', value: 'colour3'},
        ]
    }],
    onsubmit: function( e ) {
        editor.insertContent( '[container style="' + e.data.style + '"]<br /><br />[/container]');
    }
});
}

    });
});
})();

我想做的是在下拉菜单下方添加一些说明文字-如何实现此目的?

在选择列表之后,您可以添加一个容器并将html放入其中。

editor.windowManager.open( {
title: 'Container',
body: [{
    type: 'listbox',
    name: 'style',
    label: 'Style',
    'values': [
        {text: 'Clear', value: 'clear'},
        {text: 'White', value: 'white'},                
        {text: 'Colour 1', value: 'colour1'},
        {text: 'Colour 2', value: 'colour2'},
        {text: 'Colour 3', value: 'colour3'},
    ]
} /*add in the following with the comma */ ,
{   type: 'container',
    html: '<p>Enter your Text here</p>'
    }
],
onsubmit: function( e ) {
    editor.insertContent( '[container style="' + e.data.style + '"]<br /><br />[/container]');
}

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM