TinyMCE 中的可编辑下拉菜单
Editable dropdown in TinyMCE
有一个需求,要求在TinyMCE中使下拉框可编辑......
是否可以在libre和MS office产品等可编辑的select框中转换
希望我能够通过使用 combobox
作为自定义按钮中的类型来实现结果。
setup: function (editor) {
editor.addButton('mybutton', function() {
var items= ["8", "9", "10", "11", "12", "14", "16", "18", "20", "22", "24", "26", "28", "36", "48", "72"]
return {
type: 'combobox',
autofocus: true,
label: 'FontSizes',
values: items,
onChange: function(e){
console.log(this.value());
}
}
}
试试这个:
editor.addButton('mybutton', {
type: 'combobox',
icon: false,
text: 'FontSizes',
values: [{text: "8", value:"8"}, {text: "9", value:"9"}, {text: "10", value:"10"}, {text: "12", value:"12"}, {text: "14", value:"14"}, {text: "16", value:"16"}, {text: "18", value:"18"}],
onselect: function(e){
console.log(this.value());
}
});
编辑:添加了演示
有一个需求,要求在TinyMCE中使下拉框可编辑......
是否可以在libre和MS office产品等可编辑的select框中转换
希望我能够通过使用 combobox
作为自定义按钮中的类型来实现结果。
setup: function (editor) {
editor.addButton('mybutton', function() {
var items= ["8", "9", "10", "11", "12", "14", "16", "18", "20", "22", "24", "26", "28", "36", "48", "72"]
return {
type: 'combobox',
autofocus: true,
label: 'FontSizes',
values: items,
onChange: function(e){
console.log(this.value());
}
}
}
试试这个:
editor.addButton('mybutton', {
type: 'combobox',
icon: false,
text: 'FontSizes',
values: [{text: "8", value:"8"}, {text: "9", value:"9"}, {text: "10", value:"10"}, {text: "12", value:"12"}, {text: "14", value:"14"}, {text: "16", value:"16"}, {text: "18", value:"18"}],
onselect: function(e){
console.log(this.value());
}
});
编辑:添加了演示