我正在使用WordPress插件,并且可以添加TinyMCE按钮,单击时会显示下拉菜单。但是,我想添加一个水平分隔符(即水平线)到该下拉菜单中以对选项进行分组。如何在TinyMCE下拉菜单中添加分隔符
我已经搜索了一段时间,我发现的唯一信息是关于在菜单上的按钮之间添加垂直分隔符(即垂直线)。
是否可以在TinyMCE的下拉菜单中添加水平分隔符,如果有,我该怎么做?或者,我是通过使用子菜单将这些其他项目分组的唯一选项?
ed.addButton('d12-mb-button-2', {
title:'Add a message block with a custom title',
type:'menubutton',
image: url + '/d12-mb-mce-button-2.png',
menu: [
{
text: 'Part of a series',
value: 'Part',
icon: 'icon d12mb-part',
onclick: function() {
ed.windowManager.open({
title: 'Please enter the data for this message box',
body: [{
type: 'textbox',
name: 'title',
label: 'This series of articles is about:'
},
{
type: 'textbox',
minHeight: 200,
minWidth: 400,
multiline: 'true',
name: 'description',
label: 'Description of this series:'
}
],
onsubmit: function(epart) {
ed.selection.setContent('[d12-part series="' + epart.data.title + '"]' + epart.data.description + '[/d12-part]');
}
});
}
}, // End of "Part"
{
text: 'Add a support message',
value: 'Support',
icon: 'icon d12mb-support',
onclick: function() {
ed.windowManager.open({
title: 'Please enter the support information',
body: [{
type: 'textbox',
name: 'title',
label: 'Support title:'
},
{
type: 'textbox',
minHeight: 200,
minWidth: 400,
multiline: 'true',
name: 'description',
label: 'Support message:'
}
],
onsubmit: function(esupport) {
ed.selection.setContent('[d12-support title="' + esupport.data.title + '"]' + esupport.data.description + '[/d12-support]');
}
});
}
}, // End of "Support"
我需要添加一个水平分隔符''部分“'项目结束后。
(FWIW,我的工作在整个文件是here)
正如我在kopernik_elfka的回答中所说的那样,我假设? –
他链接处理菜单项的页面,而不是下拉菜单。但无论如何,代码几乎都是一样的。我很惊讶这没有记录在某处。 –
官方文件有许多含糊之处。谢谢! – DerpyNerd