我正在尝试自定义默认值styleselect
工具栏菜单,这样我就可以向其中添加自定义菜单元素。这个想法是将字体大小设置为styleselect
子菜单:
我初始化了一个TinyMCE 4.0.5
通过以下方式:
tinymce.init(
{
language_url : '/webobbywebapp/js/tiny_mce/language/es.js',
selector:'textarea',
plugins: "image, link, print",
toolbar: "styleselect | undo redo | removeformat | bold italic underline | aligncenter alignjustify | bullist numlist outdent indent | link | print | fontselect fontsizeselect",
menubar: false,
statusbar: true,
resize: true
});
由于我无法找到如何自定义默认样式选择菜单,因此我还尝试创建一个完整的新菜单,在其中可以添加字体大小控制。但我不想显示任何工具栏,我想要一个菜单栏。
编辑:现在我正在尝试使用以下代码修改 styleselect 菜单,但 fontselect 和 fontsizeselect 显示为禁用
,style_formats:
[{
title: "Headers_",
items: [{title: "Header 1",format: "h1"}, {title: "Header 2",format: "h2"}, {title: "Header 3",format: "h3"}, {title: "Header 4",format: "h4"}, {title: "Header 5",format: "h5"}, {title: "Header 6",format: "h6"}]
},
{title: "_Inline",items: [{title: "Bold",icon: "bold",format: "bold"}, {title: "Italic",icon: "italic",format: "italic"},
{title: "_Underline",icon: "underline",format: "underline"}, {title: "Strikethrough",icon: "strikethrough",format: "strikethrough"}, {title: "Superscript",icon: "superscript",format: "superscript"}, {title: "Subscript",icon: "subscript",format: "subscript"}, {title: "Code",icon: "code",format: "code"}]},
{title: "_Blocks",items: [{title: "Paragraph",format: "p"}, {title: "Blockquote",format: "blockquote"}, {title: "Div",format: "div"}, {title: "Pre",format: "pre"}]},
{title: "_Alignment",items: [{title: "Left",icon: "alignleft",format: "alignleft"}, {title: "Center",icon: "aligncenter",format: "aligncenter"}, {title: "Right",icon: "alignright",format: "alignright"}, {title: "Justify",icon: "alignjustify",format: "alignjustify"}]},
{title: "Classes", items: 'fontsizeselect'},
{title: "dddClasses", items: 'fontselect'
}]