Hi,
I’m trying to add two custom toggleButton and insert html tags as action <sup></sub> around selection or at cursor position.
Here’s what I did so far :
$('#description').jqxEditor({
width: 650,
height: 333,
pasteMode: 'text',
tools : 'bold italic underline | sup sub | size color | left center right | outdent indent | ul ol | link | clean | html',
createCommand: function (name) {
switch (name) {
case "sup":
return {
type: 'toggleButton',
tooltip: 'Mettre en exposant',
init: function (widget) {
widget.jqxButton({ height: 25, width: 20 });
widget.html("<span style='line-height: 24px;'>x<sup>2</sup></span>");
},
refresh: function (widget, style) {
// toggle check/uncheck
},
action: function (widget, editor) {
// insert <sup></sup>
}
}
case "sub":
return {
type: 'toggleButton',
tooltip: 'Mettre en indice',
init: function (widget) {
widget.jqxButton({ height: 25, width: 20 });
widget.html("<span style='line-height: 24px;'>x<sub>2</sub></span>");
},
refresh: function (widget, style) {
// toggle check/uncheck
},
action: function (widget, editor) {
// insert <sup></sup>
}
}
}
}
});
Did anyone try something like this before ? Can anybody help ?
Thanks a lot