我想要一个编辑器,只允许使用项目符号"光盘"名单。由于我只需要一个列表类型,因此按钮不应该是下拉列表。如何指定列表按钮应该是按钮,而不是下拉列表?
当前代码:
<script>
tinyMCE.PluginManager.add('stylebuttons', function (editor, url) {
['pre', 'p', 'code', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6'].forEach(function (name) {
editor.addButton("style-" + name, {
tooltip: "Toggle " + name,
text: name.toUpperCase(),
onClick: function () { editor.execCommand('mceToggleFormat', false, name); },
onPostRender: function () {
var self = this, setup = function () {
editor.formatter.formatChanged(name, function (state) {
self.active(state);
});
};
editor.formatter ? setup() : editor.on('init', setup);
}
})
});
});
tinymce.init({
selector: 'textarea',
plugins: "link advlist code stylebuttons",
advlist_bullet_styles: "disc",
target_list: false,
link_title: false,
menubar: false,
statusbar: false,
height: 600,
valid_elements: "p,br,b,i,a,h1,ul,li",
toolbar: 'undo redo | bold, italic | style-h1, bullist | link | code'
});
</script>