1
// ListType Plugin for HTMLArea-3.0
2
// Sponsored by MEdTech Unit - Queen's University
3
// Implementation by Mihai Bazon, http://dynarch.com/mishoo/
5
// (c) dynarch.com 2003.
6
// Distributed under the same terms as HTMLArea itself.
7
// This notice MUST stay intact for use (see license.txt).
9
// $Id: list-type.js,v 1.1 2004/03/19 14:14:27 mishoo Exp $
11
function ListType(editor) {
13
var cfg = editor.config;
14
var toolbar = cfg.toolbar;
16
var i18n = ListType.I18N;
18
options[i18n["Decimal"]] = "decimal";
19
options[i18n["Lower roman"]] = "lower-roman";
20
options[i18n["Upper roman"]] = "upper-roman";
21
options[i18n["Lower latin"]] = "lower-alpha";
22
options[i18n["Upper latin"]] = "upper-alpha";
24
// IE doesn't support this property; even worse, it complains
25
// with a gross error message when we tried to select it,
26
// therefore let's hide it from the damn "browser".
27
options[i18n["Lower greek"]] = "lower-greek";
30
tooltip : i18n["ListStyleTooltip"],
32
action : function(editor) { self.onSelect(editor, this); },
33
refresh : function(editor) { self.updateValue(editor, this); },
36
cfg.registerDropdown(obj);
37
var a, i, j, found = false;
38
for (i = 0; !found && i < toolbar.length; ++i) {
40
for (j = 0; j < a.length; ++j) {
41
if (a[j] == "unorderedlist") {
48
a.splice(j, 0, "space", "ListType", "space");
51
ListType._pluginInfo = {
54
developer : "Mihai Bazon",
55
developer_url : "http://dynarch.com/mishoo/",
56
c_owner : "dynarch.com",
57
sponsor : "MEdTech Unit - Queen's University",
58
sponsor_url : "http://www.queensu.ca/",
62
ListType.prototype.onSelect = function(editor, combo) {
63
var tbobj = editor._toolbarObjects[combo.id].element;
64
var parent = editor.getParentElement();
65
while (!/^ol$/i.test(parent.tagName)) {
66
parent = parent.parentNode;
68
parent.style.listStyleType = tbobj.value;
71
ListType.prototype.updateValue = function(editor, combo) {
72
var tbobj = editor._toolbarObjects[combo.id].element;
73
var parent = editor.getParentElement();
74
while (parent && !/^ol$/i.test(parent.tagName)) {
75
parent = parent.parentNode;
78
tbobj.selectedIndex = 0;
81
var type = parent.style.listStyleType;
83
tbobj.selectedIndex = 0;
85
for (var i = tbobj.firstChild; i; i = i.nextSibling) {
86
i.selected = (type.indexOf(i.value) != -1);