ListType/list-type.js
Summary
No overview generated for 'ListType/list-type.js'
function ListType(editor) {
this.editor = editor;
var cfg = editor.config;
var toolbar = cfg.toolbar;
var self = this;
var options = {};
options[this._lc("Decimal numbers")] = "decimal";
options[this._lc("Lower roman numbers")] = "lower-roman";
options[this._lc("Upper roman numbers")] = "upper-roman";
options[this._lc("Lower latin letters")] = "lower-alpha";
options[this._lc("Upper latin letters")] = "upper-alpha";
if (!HTMLArea.is_ie)
options[this._lc("Lower greek letters")] = "lower-greek";
var obj = {
id : "ListType",
tooltip : this._lc("Choose list style type (for ordered lists)"),
options : options,
action : function(editor) { self.onSelect(editor, this); },
refresh : function(editor) { self.updateValue(editor, this); },
context : "ol"
};
cfg.registerDropdown(obj);
var a, i, j, found = false;
for (i = 0; !found && i < toolbar.length; ++i) {
a = toolbar[i];
for (j = 0; j < a.length; ++j) {
if (a[j] == "insertunorderedlist") {
found = true;
break;
}
}
}
if (found)
a.splice(j, 0, "space", "ListType", "space");
};
ListType._pluginInfo = {
name : "ListType",
version : "1.0",
developer : "Mihai Bazon",
developer_url : "http://dynarch.com/mishoo/",
c_owner : "dynarch.com",
sponsor : "MEdTech Unit - Queen's University",
sponsor_url : "http://www.queensu.ca/",
license : "htmlArea"
};
ListType.prototype._lc = function(string) {
return HTMLArea._lc(string, 'ListType');
}
ListType.prototype.onSelect = function(editor, combo) {
var tbobj = editor._toolbarObjects[combo.id].element;
var parent = editor.getParentElement();
while (!/^ol$/i.test(parent.tagName)) {
parent = parent.parentNode;
}
parent.style.listStyleType = tbobj.value;
};
ListType.prototype.updateValue = function(editor, combo) {
var tbobj = editor._toolbarObjects[combo.id].element;
var parent = editor.getParentElement();
while (parent && !/^ol$/i.test(parent.tagName)) {
parent = parent.parentNode;
}
if (!parent) {
tbobj.selectedIndex = 0;
return;
}
var type = parent.style.listStyleType;
if (!type) {
tbobj.selectedIndex = 0;
} else {
for (var i = tbobj.firstChild; i; i = i.nextSibling) {
i.selected = (type.indexOf(i.value) != -1);
}
}
};
Documentation generated by
JSDoc on Mon Jun 13 20:27:40 2005