Ticket #228 (closed defect: fixed)
prototype.addButton
| Reported by: | gocher / udo.schmal@… | Owned by: | niko |
|---|---|---|---|
| Priority: | normal | Milestone: | |
| Component: | Xinha Core | Version: | |
| Severity: | normal | Keywords: | prototype |
| Cc: |
Description
Sorry but i can't test this prototype for you because my xhina.toolbar based on div's not on table's and my toolbar has panels and groups but it should works!
position:
- -1 = insert button (id) one position before button (where)
- 0 = replace button (where) by button (id)
- +1 = insert button (id) one position after button (where)
HTMLArea.Config.prototype.addButton = function(id, where, position) {
var found = false;
for (var i = 0; !found && i < this.toolbar.length; ++i) {
var a = this.toolbar[i]
for (var j = 0; j < a.length; ++j) {
if (a[j] == where) {
found = true;
break;
}
}
if (found) {
if (position == -1) a.splice(j, 0, id);
else if (position == 0) a[j] = id;
else if (position == 1) a.splice(++j, 0, id);
}
else {
this.toolbar[0].splice(0, 0, "separator");
this.toolbar[0].splice(0, 0, id);
}
}
Change History
Note: See
TracTickets for help on using
tickets.
