Subversion Repositories Applications.papyrus

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
1318 alexandre_ 1
/*
2
	Copyright (c) 2004-2006, The Dojo Foundation
3
	All Rights Reserved.
4
 
5
	Licensed under the Academic Free License version 2.1 or above OR the
6
	modified BSD license. For more information on Dojo licensing, see:
7
 
8
		http://dojotoolkit.org/community/licensing.shtml
9
*/
10
 
11
dojo.provide("dojo.widget.RichText");
12
dojo.require("dojo.widget.*");
13
dojo.require("dojo.html.*");
14
dojo.require("dojo.html.layout");
15
dojo.require("dojo.html.selection");
16
dojo.require("dojo.event.*");
17
dojo.require("dojo.string.extras");
18
dojo.require("dojo.uri.Uri");
19
dojo.require("dojo.Deferred");
20
if (!djConfig["useXDomain"] || djConfig["allowXdRichTextSave"]) {
21
	if (dojo.hostenv.post_load_) {
22
		(function () {
23
			var savetextarea = dojo.doc().createElement("textarea");
24
			savetextarea.id = "dojo.widget.RichText.savedContent";
25
			savetextarea.style = "display:none;position:absolute;top:-100px;left:-100px;height:3px;width:3px;overflow:hidden;";
26
			dojo.body().appendChild(savetextarea);
27
		})();
28
	} else {
29
		try {
30
			dojo.doc().write("<textarea id=\"dojo.widget.RichText.savedContent\" " + "style=\"display:none;position:absolute;top:-100px;left:-100px;height:3px;width:3px;overflow:hidden;\"></textarea>");
31
		}
32
		catch (e) {
33
		}
34
	}
35
}
36
dojo.widget.defineWidget("dojo.widget.RichText", dojo.widget.HtmlWidget, function () {
37
	this.contentPreFilters = [];
38
	this.contentPostFilters = [];
39
	this.contentDomPreFilters = [];
40
	this.contentDomPostFilters = [];
41
	this.editingAreaStyleSheets = [];
42
	if (dojo.render.html.moz) {
43
		this.contentPreFilters.push(this._fixContentForMoz);
44
	}
45
	this._keyHandlers = {};
46
	if (dojo.Deferred) {
47
		this.onLoadDeferred = new dojo.Deferred();
48
	}
49
}, {inheritWidth:false, focusOnLoad:false, saveName:"", styleSheets:"", _content:"", height:"", minHeight:"1em", isClosed:true, isLoaded:false, useActiveX:false, relativeImageUrls:false, _SEPARATOR:"@@**%%__RICHTEXTBOUNDRY__%%**@@", onLoadDeferred:null, fillInTemplate:function () {
50
	dojo.event.topic.publish("dojo.widget.RichText::init", this);
51
	this.open();
52
	dojo.event.connect(this, "onKeyPressed", this, "afterKeyPress");
53
	dojo.event.connect(this, "onKeyPress", this, "keyPress");
54
	dojo.event.connect(this, "onKeyDown", this, "keyDown");
55
	dojo.event.connect(this, "onKeyUp", this, "keyUp");
56
	this.setupDefaultShortcuts();
57
}, setupDefaultShortcuts:function () {
58
	var ctrl = this.KEY_CTRL;
59
	var exec = function (cmd, arg) {
60
		return arguments.length == 1 ? function () {
61
			this.execCommand(cmd);
62
		} : function () {
63
			this.execCommand(cmd, arg);
64
		};
65
	};
66
	this.addKeyHandler("b", ctrl, exec("bold"));
67
	this.addKeyHandler("i", ctrl, exec("italic"));
68
	this.addKeyHandler("u", ctrl, exec("underline"));
69
	this.addKeyHandler("a", ctrl, exec("selectall"));
70
	this.addKeyHandler("s", ctrl, function () {
71
		this.save(true);
72
	});
73
	this.addKeyHandler("1", ctrl, exec("formatblock", "h1"));
74
	this.addKeyHandler("2", ctrl, exec("formatblock", "h2"));
75
	this.addKeyHandler("3", ctrl, exec("formatblock", "h3"));
76
	this.addKeyHandler("4", ctrl, exec("formatblock", "h4"));
77
	this.addKeyHandler("\\", ctrl, exec("insertunorderedlist"));
78
	if (!dojo.render.html.ie) {
79
		this.addKeyHandler("Z", ctrl, exec("redo"));
80
	}
81
}, events:["onBlur", "onFocus", "onKeyPress", "onKeyDown", "onKeyUp", "onClick"], open:function (element) {
82
	if (this.onLoadDeferred.fired >= 0) {
83
		this.onLoadDeferred = new dojo.Deferred();
84
	}
85
	var h = dojo.render.html;
86
	if (!this.isClosed) {
87
		this.close();
88
	}
89
	dojo.event.topic.publish("dojo.widget.RichText::open", this);
90
	this._content = "";
91
	if ((arguments.length == 1) && (element["nodeName"])) {
92
		this.domNode = element;
93
	}
94
	if ((this.domNode["nodeName"]) && (this.domNode.nodeName.toLowerCase() == "textarea")) {
95
		this.textarea = this.domNode;
96
		var html = this._preFilterContent(this.textarea.value);
97
		this.domNode = dojo.doc().createElement("div");
98
		dojo.html.copyStyle(this.domNode, this.textarea);
99
		var tmpFunc = dojo.lang.hitch(this, function () {
100
			with (this.textarea.style) {
101
				display = "block";
102
				position = "absolute";
103
				left = top = "-1000px";
104
				if (h.ie) {
105
					this.__overflow = overflow;
106
					overflow = "hidden";
107
				}
108
			}
109
		});
110
		if (h.ie) {
111
			setTimeout(tmpFunc, 10);
112
		} else {
113
			tmpFunc();
114
		}
115
		if (!h.safari) {
116
			dojo.html.insertBefore(this.domNode, this.textarea);
117
		}
118
		if (this.textarea.form) {
119
			dojo.event.connect("before", this.textarea.form, "onsubmit", dojo.lang.hitch(this, function () {
120
				this.textarea.value = this.getEditorContent();
121
			}));
122
		}
123
		var editor = this;
124
		dojo.event.connect(this, "postCreate", function () {
125
			dojo.html.insertAfter(editor.textarea, editor.domNode);
126
		});
127
	} else {
128
		var html = this._preFilterContent(dojo.string.trim(this.domNode.innerHTML));
129
	}
130
	if (html == "") {
131
		html = "&nbsp;";
132
	}
133
	var content = dojo.html.getContentBox(this.domNode);
134
	this._oldHeight = content.height;
135
	this._oldWidth = content.width;
136
	this._firstChildContributingMargin = this._getContributingMargin(this.domNode, "top");
137
	this._lastChildContributingMargin = this._getContributingMargin(this.domNode, "bottom");
138
	this.savedContent = html;
139
	this.domNode.innerHTML = "";
140
	this.editingArea = dojo.doc().createElement("div");
141
	this.domNode.appendChild(this.editingArea);
142
	if ((this.domNode["nodeName"]) && (this.domNode.nodeName == "LI")) {
143
		this.domNode.innerHTML = " <br>";
144
	}
145
	if (this.saveName != "" && (!djConfig["useXDomain"] || djConfig["allowXdRichTextSave"])) {
146
		var saveTextarea = dojo.doc().getElementById("dojo.widget.RichText.savedContent");
147
		if (saveTextarea.value != "") {
148
			var datas = saveTextarea.value.split(this._SEPARATOR);
149
			for (var i = 0; i < datas.length; i++) {
150
				var data = datas[i].split(":");
151
				if (data[0] == this.saveName) {
152
					html = data[1];
153
					datas.splice(i, 1);
154
					break;
155
				}
156
			}
157
		}
158
		dojo.event.connect("before", window, "onunload", this, "_saveContent");
159
	}
160
	if (h.ie70 && this.useActiveX) {
161
		dojo.debug("activeX in ie70 is not currently supported, useActiveX is ignored for now.");
162
		this.useActiveX = false;
163
	}
164
	if (this.useActiveX && h.ie) {
165
		var self = this;
166
		setTimeout(function () {
167
			self._drawObject(html);
168
		}, 0);
169
	} else {
170
		if (h.ie || this._safariIsLeopard() || h.opera) {
171
			this.iframe = dojo.doc().createElement("iframe");
172
			this.iframe.src = "javascript:void(0)";
173
			this.editorObject = this.iframe;
174
			with (this.iframe.style) {
175
				border = "0";
176
				width = "100%";
177
			}
178
			this.iframe.frameBorder = 0;
179
			this.editingArea.appendChild(this.iframe);
180
			this.window = this.iframe.contentWindow;
181
			this.document = this.window.document;
182
			this.document.open();
183
			this.document.write("<html><head><style>body{margin:0;padding:0;border:0;overflow:hidden;}</style></head><body><div></div></body></html>");
184
			this.document.close();
185
			this.editNode = this.document.body.firstChild;
186
			this.editNode.contentEditable = true;
187
			with (this.iframe.style) {
188
				if (h.ie70) {
189
					if (this.height) {
190
						height = this.height;
191
					}
192
					if (this.minHeight) {
193
						minHeight = this.minHeight;
194
					}
195
				} else {
196
					height = this.height ? this.height : this.minHeight;
197
				}
198
			}
199
			var formats = ["p", "pre", "address", "h1", "h2", "h3", "h4", "h5", "h6", "ol", "div", "ul"];
200
			var localhtml = "";
201
			for (var i in formats) {
202
				if (formats[i].charAt(1) != "l") {
203
					localhtml += "<" + formats[i] + "><span>content</span></" + formats[i] + ">";
204
				} else {
205
					localhtml += "<" + formats[i] + "><li>content</li></" + formats[i] + ">";
206
				}
207
			}
208
			with (this.editNode.style) {
209
				position = "absolute";
210
				left = "-2000px";
211
				top = "-2000px";
212
			}
213
			this.editNode.innerHTML = localhtml;
214
			var node = this.editNode.firstChild;
215
			while (node) {
216
				dojo.withGlobal(this.window, "selectElement", dojo.html.selection, [node.firstChild]);
217
				var nativename = node.tagName.toLowerCase();
218
				this._local2NativeFormatNames[nativename] = this.queryCommandValue("formatblock");
219
				this._native2LocalFormatNames[this._local2NativeFormatNames[nativename]] = nativename;
220
				node = node.nextSibling;
221
			}
222
			with (this.editNode.style) {
223
				position = "";
224
				left = "";
225
				top = "";
226
			}
227
			this.editNode.innerHTML = html;
228
			if (this.height) {
229
				this.document.body.style.overflowY = "scroll";
230
			}
231
			dojo.lang.forEach(this.events, function (e) {
232
				dojo.event.connect(this.editNode, e.toLowerCase(), this, e);
233
			}, this);
234
			this.onLoad();
235
		} else {
236
			this._drawIframe(html);
237
			this.editorObject = this.iframe;
238
		}
239
	}
240
	if (this.domNode.nodeName == "LI") {
241
		this.domNode.lastChild.style.marginTop = "-1.2em";
242
	}
243
	dojo.html.addClass(this.domNode, "RichTextEditable");
244
	this.isClosed = false;
245
}, _hasCollapseableMargin:function (element, side) {
246
	if (dojo.html.getPixelValue(element, "border-" + side + "-width", false)) {
247
		return false;
248
	} else {
249
		if (dojo.html.getPixelValue(element, "padding-" + side, false)) {
250
			return false;
251
		} else {
252
			return true;
253
		}
254
	}
255
}, _getContributingMargin:function (element, topOrBottom) {
256
	if (topOrBottom == "top") {
257
		var siblingAttr = "previousSibling";
258
		var childSiblingAttr = "nextSibling";
259
		var childAttr = "firstChild";
260
		var marginProp = "margin-top";
261
		var siblingMarginProp = "margin-bottom";
262
	} else {
263
		var siblingAttr = "nextSibling";
264
		var childSiblingAttr = "previousSibling";
265
		var childAttr = "lastChild";
266
		var marginProp = "margin-bottom";
267
		var siblingMarginProp = "margin-top";
268
	}
269
	var elementMargin = dojo.html.getPixelValue(element, marginProp, false);
270
	function isSignificantNode(element) {
271
		return !(element.nodeType == 3 && dojo.string.isBlank(element.data)) && dojo.html.getStyle(element, "display") != "none" && !dojo.html.isPositionAbsolute(element);
272
	}
273
	var childMargin = 0;
274
	var child = element[childAttr];
275
	while (child) {
276
		while ((!isSignificantNode(child)) && child[childSiblingAttr]) {
277
			child = child[childSiblingAttr];
278
		}
279
		childMargin = Math.max(childMargin, dojo.html.getPixelValue(child, marginProp, false));
280
		if (!this._hasCollapseableMargin(child, topOrBottom)) {
281
			break;
282
		}
283
		child = child[childAttr];
284
	}
285
	if (!this._hasCollapseableMargin(element, topOrBottom)) {
286
		return parseInt(childMargin);
287
	}
288
	var contextMargin = 0;
289
	var sibling = element[siblingAttr];
290
	while (sibling) {
291
		if (isSignificantNode(sibling)) {
292
			contextMargin = dojo.html.getPixelValue(sibling, siblingMarginProp, false);
293
			break;
294
		}
295
		sibling = sibling[siblingAttr];
296
	}
297
	if (!sibling) {
298
		contextMargin = dojo.html.getPixelValue(element.parentNode, marginProp, false);
299
	}
300
	if (childMargin > elementMargin) {
301
		return parseInt(Math.max((childMargin - elementMargin) - contextMargin, 0));
302
	} else {
303
		return 0;
304
	}
305
}, _drawIframe:function (html) {
306
	var oldMoz = Boolean(dojo.render.html.moz && (typeof window.XML == "undefined"));
307
	if (!this.iframe) {
308
		var currentDomain = (new dojo.uri.Uri(dojo.doc().location)).host;
309
		this.iframe = dojo.doc().createElement("iframe");
310
		with (this.iframe) {
311
			style.border = "none";
312
			style.lineHeight = "0";
313
			style.verticalAlign = "bottom";
314
			scrolling = this.height ? "auto" : "no";
315
		}
316
	}
317
	if (djConfig["useXDomain"] && !djConfig["dojoRichTextFrameUrl"]) {
318
		dojo.debug("dojo.widget.RichText: When using cross-domain Dojo builds," + " please save src/widget/templates/richtextframe.html to your domain and set djConfig.dojoRichTextFrameUrl" + " to the path on your domain to richtextframe.html");
319
	}
320
	this.iframe.src = (djConfig["dojoRichTextFrameUrl"] || dojo.uri.moduleUri("dojo.widget", "templates/richtextframe.html")) + ((dojo.doc().domain != currentDomain) ? ("#" + dojo.doc().domain) : "");
321
	this.iframe.width = this.inheritWidth ? this._oldWidth : "100%";
322
	if (this.height) {
323
		this.iframe.style.height = this.height;
324
	} else {
325
		var height = this._oldHeight;
326
		if (this._hasCollapseableMargin(this.domNode, "top")) {
327
			height += this._firstChildContributingMargin;
328
		}
329
		if (this._hasCollapseableMargin(this.domNode, "bottom")) {
330
			height += this._lastChildContributingMargin;
331
		}
332
		this.iframe.height = height;
333
	}
334
	var tmpContent = dojo.doc().createElement("div");
335
	tmpContent.innerHTML = html;
336
	this.editingArea.appendChild(tmpContent);
337
	if (this.relativeImageUrls) {
338
		var imgs = tmpContent.getElementsByTagName("img");
339
		for (var i = 0; i < imgs.length; i++) {
340
			imgs[i].src = (new dojo.uri.Uri(dojo.global().location, imgs[i].src)).toString();
341
		}
342
		html = tmpContent.innerHTML;
343
	}
344
	var firstChild = dojo.html.firstElement(tmpContent);
345
	var lastChild = dojo.html.lastElement(tmpContent);
346
	if (firstChild) {
347
		firstChild.style.marginTop = this._firstChildContributingMargin + "px";
348
	}
349
	if (lastChild) {
350
		lastChild.style.marginBottom = this._lastChildContributingMargin + "px";
351
	}
352
	this.editingArea.appendChild(this.iframe);
353
	if (dojo.render.html.safari) {
354
		this.iframe.src = this.iframe.src;
355
	}
356
	var _iframeInitialized = false;
357
	var ifrFunc = dojo.lang.hitch(this, function () {
358
		if (!_iframeInitialized) {
359
			_iframeInitialized = true;
360
		} else {
361
			return;
362
		}
363
		if (!this.editNode) {
364
			if (this.iframe.contentWindow) {
365
				this.window = this.iframe.contentWindow;
366
				this.document = this.iframe.contentWindow.document;
367
			} else {
368
				if (this.iframe.contentDocument) {
369
					this.window = this.iframe.contentDocument.window;
370
					this.document = this.iframe.contentDocument;
371
				}
372
			}
373
			var getStyle = (function (domNode) {
374
				return function (style) {
375
					return dojo.html.getStyle(domNode, style);
376
				};
377
			})(this.domNode);
378
			var font = getStyle("font-weight") + " " + getStyle("font-size") + " " + getStyle("font-family");
379
			var lineHeight = "1.0";
380
			var lineHeightStyle = dojo.html.getUnitValue(this.domNode, "line-height");
381
			if (lineHeightStyle.value && lineHeightStyle.units == "") {
382
				lineHeight = lineHeightStyle.value;
383
			}
384
			dojo.html.insertCssText("body,html{background:transparent;padding:0;margin:0;}" + "body{top:0;left:0;right:0;" + (((this.height) || (dojo.render.html.opera)) ? "" : "position:fixed;") + "font:" + font + ";" + "min-height:" + this.minHeight + ";" + "line-height:" + lineHeight + "}" + "p{margin: 1em 0 !important;}" + "body > *:first-child{padding-top:0 !important;margin-top:" + this._firstChildContributingMargin + "px !important;}" + "body > *:last-child{padding-bottom:0 !important;margin-bottom:" + this._lastChildContributingMargin + "px !important;}" + "li > ul:-moz-first-node, li > ol:-moz-first-node{padding-top:1.2em;}\n" + "li{min-height:1.2em;}" + "", this.document);
385
			dojo.html.removeNode(tmpContent);
386
			this.document.body.innerHTML = html;
387
			if (oldMoz || dojo.render.html.safari) {
388
				this.document.designMode = "on";
389
			}
390
			this.onLoad();
391
		} else {
392
			dojo.html.removeNode(tmpContent);
393
			this.editNode.innerHTML = html;
394
			this.onDisplayChanged();
395
		}
396
	});
397
	if (this.editNode) {
398
		ifrFunc();
399
	} else {
400
		if (dojo.render.html.moz) {
401
			this.iframe.onload = function () {
402
				setTimeout(ifrFunc, 250);
403
			};
404
		} else {
405
			this.iframe.onload = ifrFunc;
406
		}
407
	}
408
}, _applyEditingAreaStyleSheets:function () {
409
	var files = [];
410
	if (this.styleSheets) {
411
		files = this.styleSheets.split(";");
412
		this.styleSheets = "";
413
	}
414
	files = files.concat(this.editingAreaStyleSheets);
415
	this.editingAreaStyleSheets = [];
416
	if (files.length > 0) {
417
		for (var i = 0; i < files.length; i++) {
418
			var url = files[i];
419
			if (url) {
420
				this.addStyleSheet(dojo.uri.dojoUri(url));
421
			}
422
		}
423
	}
424
}, addStyleSheet:function (uri) {
425
	var url = uri.toString();
426
	if (dojo.lang.find(this.editingAreaStyleSheets, url) > -1) {
427
		dojo.debug("dojo.widget.RichText.addStyleSheet: Style sheet " + url + " is already applied to the editing area!");
428
		return;
429
	}
430
	if (url.charAt(0) == "." || (url.charAt(0) != "/" && !uri.host)) {
431
		url = (new dojo.uri.Uri(dojo.global().location, url)).toString();
432
	}
433
	this.editingAreaStyleSheets.push(url);
434
	if (this.document.createStyleSheet) {
435
		this.document.createStyleSheet(url);
436
	} else {
437
		var head = this.document.getElementsByTagName("head")[0];
438
		var stylesheet = this.document.createElement("link");
439
		with (stylesheet) {
440
			rel = "stylesheet";
441
			type = "text/css";
442
			href = url;
443
		}
444
		head.appendChild(stylesheet);
445
	}
446
}, removeStyleSheet:function (uri) {
447
	var url = uri.toString();
448
	if (url.charAt(0) == "." || (url.charAt(0) != "/" && !uri.host)) {
449
		url = (new dojo.uri.Uri(dojo.global().location, url)).toString();
450
	}
451
	var index = dojo.lang.find(this.editingAreaStyleSheets, url);
452
	if (index == -1) {
453
		dojo.debug("dojo.widget.RichText.removeStyleSheet: Style sheet " + url + " is not applied to the editing area so it can not be removed!");
454
		return;
455
	}
456
	delete this.editingAreaStyleSheets[index];
457
	var links = this.document.getElementsByTagName("link");
458
	for (var i = 0; i < links.length; i++) {
459
		if (links[i].href == url) {
460
			if (dojo.render.html.ie) {
461
				links[i].href = "";
462
			}
463
			dojo.html.removeNode(links[i]);
464
			break;
465
		}
466
	}
467
}, _drawObject:function (html) {
468
	this.object = dojo.html.createExternalElement(dojo.doc(), "object");
469
	with (this.object) {
470
		classid = "clsid:2D360201-FFF5-11D1-8D03-00A0C959BC0A";
471
		width = this.inheritWidth ? this._oldWidth : "100%";
472
		style.height = this.height ? this.height : (this._oldHeight + "px");
473
		Scrollbars = this.height ? true : false;
474
		Appearance = this._activeX.appearance.flat;
475
	}
476
	this.editorObject = this.object;
477
	this.editingArea.appendChild(this.object);
478
	this.object.attachEvent("DocumentComplete", dojo.lang.hitch(this, "onLoad"));
479
	dojo.lang.forEach(this.events, function (e) {
480
		this.object.attachEvent(e.toLowerCase(), dojo.lang.hitch(this, e));
481
	}, this);
482
	this.object.DocumentHTML = "<!doctype HTML PUBLIC \"-//W3C//DTD HTML 4.01//EN\" \"http://www.w3.org/TR/html4/strict.dtd\">" + "<html><title></title>" + "<style type=\"text/css\">" + "	body,html { padding: 0; margin: 0; }" + (this.height ? "" : "	body,  { overflow: hidden; }") + "</style>" + "<body><div>" + html + "<div></body></html>";
483
	this._cacheLocalBlockFormatNames();
484
}, _local2NativeFormatNames:{}, _native2LocalFormatNames:{}, _cacheLocalBlockFormatNames:function () {
485
	if (!this._native2LocalFormatNames["p"]) {
486
		var obj = this.object;
487
		var error = false;
488
		if (!obj) {
489
			try {
490
				obj = dojo.html.createExternalElement(dojo.doc(), "object");
491
				obj.classid = "clsid:2D360201-FFF5-11D1-8D03-00A0C959BC0A";
492
				dojo.body().appendChild(obj);
493
				obj.DocumentHTML = "<html><head></head><body></body></html>";
494
			}
495
			catch (e) {
496
				error = true;
497
			}
498
		}
499
		try {
500
			var oNamesParm = new ActiveXObject("DEGetBlockFmtNamesParam.DEGetBlockFmtNamesParam");
501
			obj.ExecCommand(this._activeX.command["getblockformatnames"], 0, oNamesParm);
502
			var vbNamesArray = new VBArray(oNamesParm.Names);
503
			var localFormats = vbNamesArray.toArray();
504
			var nativeFormats = ["p", "pre", "address", "h1", "h2", "h3", "h4", "h5", "h6", "ol", "ul", "", "", "", "", "div"];
505
			for (var i = 0; i < nativeFormats.length; ++i) {
506
				if (nativeFormats[i].length > 0) {
507
					this._local2NativeFormatNames[localFormats[i]] = nativeFormats[i];
508
					this._native2LocalFormatNames[nativeFormats[i]] = localFormats[i];
509
				}
510
			}
511
		}
512
		catch (e) {
513
			error = true;
514
		}
515
		if (obj && !this.object) {
516
			dojo.body().removeChild(obj);
517
		}
518
	}
519
	return !error;
520
}, _isResized:function () {
521
	return false;
522
}, onLoad:function (e) {
523
	this.isLoaded = true;
524
	if (this.object) {
525
		this.document = this.object.DOM;
526
		this.window = this.document.parentWindow;
527
		this.editNode = this.document.body.firstChild;
528
		this.editingArea.style.height = this.height ? this.height : this.minHeight;
529
		if (!this.height) {
530
			this.connect(this, "onDisplayChanged", "_updateHeight");
531
		}
532
		this.window._frameElement = this.object;
533
	} else {
534
		if (this.iframe && !dojo.render.html.ie) {
535
			this.editNode = this.document.body;
536
			if (!this.height) {
537
				this.connect(this, "onDisplayChanged", "_updateHeight");
538
			}
539
			try {
540
				this.document.execCommand("useCSS", false, true);
541
				this.document.execCommand("styleWithCSS", false, false);
542
			}
543
			catch (e2) {
544
			}
545
			if (dojo.render.html.safari) {
546
				this.connect(this.editNode, "onblur", "onBlur");
547
				this.connect(this.editNode, "onfocus", "onFocus");
548
				this.connect(this.editNode, "onclick", "onFocus");
549
				this.interval = setInterval(dojo.lang.hitch(this, "onDisplayChanged"), 750);
550
			} else {
551
				if (dojo.render.html.mozilla || dojo.render.html.opera) {
552
					var doc = this.document;
553
					var addListener = dojo.event.browser.addListener;
554
					var self = this;
555
					dojo.lang.forEach(this.events, function (e) {
556
						var l = addListener(self.document, e.substr(2).toLowerCase(), dojo.lang.hitch(self, e));
557
						if (e == "onBlur") {
558
							var unBlur = {unBlur:function (e) {
559
								dojo.event.browser.removeListener(doc, "blur", l);
560
							}};
561
							dojo.event.connect("before", self, "close", unBlur, "unBlur");
562
						}
563
					});
564
				}
565
			}
566
		} else {
567
			if (dojo.render.html.ie) {
568
				if (!this.height) {
569
					this.connect(this, "onDisplayChanged", "_updateHeight");
570
				}
571
				this.editNode.style.zoom = 1;
572
			}
573
		}
574
	}
575
	this._applyEditingAreaStyleSheets();
576
	if (this.focusOnLoad) {
577
		this.focus();
578
	}
579
	this.onDisplayChanged(e);
580
	if (this.onLoadDeferred) {
581
		this.onLoadDeferred.callback(true);
582
	}
583
}, onKeyDown:function (e) {
584
	if ((!e) && (this.object)) {
585
		e = dojo.event.browser.fixEvent(this.window.event);
586
	}
587
	if ((dojo.render.html.ie) && (e.keyCode == e.KEY_TAB)) {
588
		e.preventDefault();
589
		e.stopPropagation();
590
		this.execCommand((e.shiftKey ? "outdent" : "indent"));
591
	} else {
592
		if (dojo.render.html.ie) {
593
			if ((65 <= e.keyCode) && (e.keyCode <= 90)) {
594
				e.charCode = e.keyCode;
595
				this.onKeyPress(e);
596
			}
597
		}
598
	}
599
}, onKeyUp:function (e) {
600
	return;
601
}, KEY_CTRL:1, onKeyPress:function (e) {
602
	if ((!e) && (this.object)) {
603
		e = dojo.event.browser.fixEvent(this.window.event);
604
	}
605
	var modifiers = e.ctrlKey ? this.KEY_CTRL : 0;
606
	if (this._keyHandlers[e.key]) {
607
		var handlers = this._keyHandlers[e.key], i = 0, handler;
608
		while (handler = handlers[i++]) {
609
			if (modifiers == handler.modifiers) {
610
				e.preventDefault();
611
				handler.handler.call(this);
612
				break;
613
			}
614
		}
615
	}
616
	dojo.lang.setTimeout(this, this.onKeyPressed, 1, e);
617
}, addKeyHandler:function (key, modifiers, handler) {
618
	if (!(this._keyHandlers[key] instanceof Array)) {
619
		this._keyHandlers[key] = [];
620
	}
621
	this._keyHandlers[key].push({modifiers:modifiers || 0, handler:handler});
622
}, onKeyPressed:function (e) {
623
	this.onDisplayChanged();
624
}, onClick:function (e) {
625
	this.onDisplayChanged(e);
626
}, onBlur:function (e) {
627
}, _initialFocus:true, onFocus:function (e) {
628
	if ((dojo.render.html.mozilla) && (this._initialFocus)) {
629
		this._initialFocus = false;
630
		if (dojo.string.trim(this.editNode.innerHTML) == "&nbsp;") {
631
			this.placeCursorAtStart();
632
		}
633
	}
634
}, blur:function () {
635
	if (this.iframe) {
636
		this.window.blur();
637
	} else {
638
		if (this.object) {
639
			this.document.body.blur();
640
		} else {
641
			if (this.editNode) {
642
				this.editNode.blur();
643
			}
644
		}
645
	}
646
}, focus:function () {
647
	if (this.iframe && !dojo.render.html.ie) {
648
		this.window.focus();
649
	} else {
650
		if (this.object) {
651
			this.document.focus();
652
		} else {
653
			if (this.editNode && this.editNode.focus) {
654
				this.editNode.focus();
655
			} else {
656
				dojo.debug("Have no idea how to focus into the editor!");
657
			}
658
		}
659
	}
660
}, onDisplayChanged:function (e) {
661
}, _activeX:{command:{bold:5000, italic:5023, underline:5048, justifycenter:5024, justifyleft:5025, justifyright:5026, cut:5003, copy:5002, paste:5032, "delete":5004, undo:5049, redo:5033, removeformat:5034, selectall:5035, unlink:5050, indent:5018, outdent:5031, insertorderedlist:5030, insertunorderedlist:5051, inserttable:5022, insertcell:5019, insertcol:5020, insertrow:5021, deletecells:5005, deletecols:5006, deleterows:5007, mergecells:5029, splitcell:5047, setblockformat:5043, getblockformat:5011, getblockformatnames:5012, setfontname:5044, getfontname:5013, setfontsize:5045, getfontsize:5014, setbackcolor:5042, getbackcolor:5010, setforecolor:5046, getforecolor:5015, findtext:5008, font:5009, hyperlink:5016, image:5017, lockelement:5027, makeabsolute:5028, sendbackward:5036, bringforward:5037, sendbelowtext:5038, bringabovetext:5039, sendtoback:5040, bringtofront:5041, properties:5052}, ui:{"default":0, prompt:1, noprompt:2}, status:{notsupported:0, disabled:1, enabled:3, latched:7, ninched:11}, appearance:{flat:0, inset:1}, state:{unchecked:0, checked:1, gray:2}}, _normalizeCommand:function (cmd) {
662
	var drh = dojo.render.html;
663
	var command = cmd.toLowerCase();
664
	if (command == "formatblock") {
665
		if (drh.safari) {
666
			command = "heading";
667
		}
668
	} else {
669
		if (this.object) {
670
			switch (command) {
671
			  case "createlink":
672
				command = "hyperlink";
673
				break;
674
			  case "insertimage":
675
				command = "image";
676
				break;
677
			}
678
		} else {
679
			if (command == "hilitecolor" && !drh.mozilla) {
680
				command = "backcolor";
681
			}
682
		}
683
	}
684
	return command;
685
}, _safariIsLeopard:function () {
686
	var gt420 = false;
687
	if (dojo.render.html.safari) {
688
		var tmp = dojo.render.html.UA.split("AppleWebKit/")[1];
689
		var ver = parseFloat(tmp.split(" ")[0]);
690
		if (ver >= 420) {
691
			gt420 = true;
692
		}
693
	}
694
	return gt420;
695
}, queryCommandAvailable:function (command) {
696
	var ie = 1;
697
	var mozilla = 1 << 1;
698
	var safari = 1 << 2;
699
	var opera = 1 << 3;
700
	var safari420 = 1 << 4;
701
	var gt420 = this._safariIsLeopard();
702
	function isSupportedBy(browsers) {
703
		return {ie:Boolean(browsers & ie), mozilla:Boolean(browsers & mozilla), safari:Boolean(browsers & safari), safari420:Boolean(browsers & safari420), opera:Boolean(browsers & opera)};
704
	}
705
	var supportedBy = null;
706
	switch (command.toLowerCase()) {
707
	  case "bold":
708
	  case "italic":
709
	  case "underline":
710
	  case "subscript":
711
	  case "superscript":
712
	  case "fontname":
713
	  case "fontsize":
714
	  case "forecolor":
715
	  case "hilitecolor":
716
	  case "justifycenter":
717
	  case "justifyfull":
718
	  case "justifyleft":
719
	  case "justifyright":
720
	  case "delete":
721
	  case "selectall":
722
		supportedBy = isSupportedBy(mozilla | ie | safari | opera);
723
		break;
724
	  case "createlink":
725
	  case "unlink":
726
	  case "removeformat":
727
	  case "inserthorizontalrule":
728
	  case "insertimage":
729
	  case "insertorderedlist":
730
	  case "insertunorderedlist":
731
	  case "indent":
732
	  case "outdent":
733
	  case "formatblock":
734
	  case "inserthtml":
735
	  case "undo":
736
	  case "redo":
737
	  case "strikethrough":
738
		supportedBy = isSupportedBy(mozilla | ie | opera | safari420);
739
		break;
740
	  case "blockdirltr":
741
	  case "blockdirrtl":
742
	  case "dirltr":
743
	  case "dirrtl":
744
	  case "inlinedirltr":
745
	  case "inlinedirrtl":
746
		supportedBy = isSupportedBy(ie);
747
		break;
748
	  case "cut":
749
	  case "copy":
750
	  case "paste":
751
		supportedBy = isSupportedBy(ie | mozilla | safari420);
752
		break;
753
	  case "inserttable":
754
		supportedBy = isSupportedBy(mozilla | (this.object ? ie : 0));
755
		break;
756
	  case "insertcell":
757
	  case "insertcol":
758
	  case "insertrow":
759
	  case "deletecells":
760
	  case "deletecols":
761
	  case "deleterows":
762
	  case "mergecells":
763
	  case "splitcell":
764
		supportedBy = isSupportedBy(this.object ? ie : 0);
765
		break;
766
	  default:
767
		return false;
768
	}
769
	return (dojo.render.html.ie && supportedBy.ie) || (dojo.render.html.mozilla && supportedBy.mozilla) || (dojo.render.html.safari && supportedBy.safari) || (gt420 && supportedBy.safari420) || (dojo.render.html.opera && supportedBy.opera);
770
}, execCommand:function (command, argument) {
771
	var returnValue;
772
	this.focus();
773
	command = this._normalizeCommand(command);
774
	if (argument != undefined) {
775
		if (command == "heading") {
776
			throw new Error("unimplemented");
777
		} else {
778
			if (command == "formatblock") {
779
				if (this.object) {
780
					argument = this._native2LocalFormatNames[argument];
781
				} else {
782
					if (dojo.render.html.ie) {
783
						argument = "<" + argument + ">";
784
					}
785
				}
786
			}
787
		}
788
	}
789
	if (this.object) {
790
		switch (command) {
791
		  case "hilitecolor":
792
			command = "setbackcolor";
793
			break;
794
		  case "forecolor":
795
		  case "backcolor":
796
		  case "fontsize":
797
		  case "fontname":
798
			command = "set" + command;
799
			break;
800
		  case "formatblock":
801
			command = "setblockformat";
802
		}
803
		if (command == "strikethrough") {
804
			command = "inserthtml";
805
			var range = this.document.selection.createRange();
806
			if (!range.htmlText) {
807
				return;
808
			}
809
			argument = range.htmlText.strike();
810
		} else {
811
			if (command == "inserthorizontalrule") {
812
				command = "inserthtml";
813
				argument = "<hr>";
814
			}
815
		}
816
		if (command == "inserthtml") {
817
			var range = this.document.selection.createRange();
818
			if (this.document.selection.type.toUpperCase() == "CONTROL") {
819
				for (var i = 0; i < range.length; i++) {
820
					range.item(i).outerHTML = argument;
821
				}
822
			} else {
823
				range.pasteHTML(argument);
824
				range.select();
825
			}
826
			returnValue = true;
827
		} else {
828
			if (arguments.length == 1) {
829
				returnValue = this.object.ExecCommand(this._activeX.command[command], this._activeX.ui.noprompt);
830
			} else {
831
				returnValue = this.object.ExecCommand(this._activeX.command[command], this._activeX.ui.noprompt, argument);
832
			}
833
		}
834
	} else {
835
		if (command == "inserthtml") {
836
			if (dojo.render.html.ie) {
837
				var insertRange = this.document.selection.createRange();
838
				insertRange.pasteHTML(argument);
839
				insertRange.select();
840
				return true;
841
			} else {
842
				return this.document.execCommand(command, false, argument);
843
			}
844
		} else {
845
			if ((command == "unlink") && (this.queryCommandEnabled("unlink")) && (dojo.render.html.mozilla)) {
846
				var selection = this.window.getSelection();
847
				var selectionRange = selection.getRangeAt(0);
848
				var selectionStartContainer = selectionRange.startContainer;
849
				var selectionStartOffset = selectionRange.startOffset;
850
				var selectionEndContainer = selectionRange.endContainer;
851
				var selectionEndOffset = selectionRange.endOffset;
852
				var a = dojo.withGlobal(this.window, "getAncestorElement", dojo.html.selection, ["a"]);
853
				dojo.withGlobal(this.window, "selectElement", dojo.html.selection, [a]);
854
				returnValue = this.document.execCommand("unlink", false, null);
855
				var selectionRange = this.document.createRange();
856
				selectionRange.setStart(selectionStartContainer, selectionStartOffset);
857
				selectionRange.setEnd(selectionEndContainer, selectionEndOffset);
858
				selection.removeAllRanges();
859
				selection.addRange(selectionRange);
860
				return returnValue;
861
			} else {
862
				if ((command == "hilitecolor") && (dojo.render.html.mozilla)) {
863
					this.document.execCommand("useCSS", false, false);
864
					returnValue = this.document.execCommand(command, false, argument);
865
					this.document.execCommand("useCSS", false, true);
866
				} else {
867
					if ((dojo.render.html.ie) && ((command == "backcolor") || (command == "forecolor"))) {
868
						argument = arguments.length > 1 ? argument : null;
869
						returnValue = this.document.execCommand(command, false, argument);
870
					} else {
871
						argument = arguments.length > 1 ? argument : null;
872
						if (argument || command != "createlink") {
873
							returnValue = this.document.execCommand(command, false, argument);
874
						}
875
					}
876
				}
877
			}
878
		}
879
	}
880
	this.onDisplayChanged();
881
	return returnValue;
882
}, queryCommandEnabled:function (command) {
883
	command = this._normalizeCommand(command);
884
	if (this.object) {
885
		switch (command) {
886
		  case "hilitecolor":
887
			command = "setbackcolor";
888
			break;
889
		  case "forecolor":
890
		  case "backcolor":
891
		  case "fontsize":
892
		  case "fontname":
893
			command = "set" + command;
894
			break;
895
		  case "formatblock":
896
			command = "setblockformat";
897
			break;
898
		  case "strikethrough":
899
			command = "bold";
900
			break;
901
		  case "inserthorizontalrule":
902
			return true;
903
		}
904
		if (typeof this._activeX.command[command] == "undefined") {
905
			return false;
906
		}
907
		var status = this.object.QueryStatus(this._activeX.command[command]);
908
		return ((status != this._activeX.status.notsupported) && (status != this._activeX.status.disabled));
909
	} else {
910
		if (dojo.render.html.mozilla) {
911
			if (command == "unlink") {
912
				return dojo.withGlobal(this.window, "hasAncestorElement", dojo.html.selection, ["a"]);
913
			} else {
914
				if (command == "inserttable") {
915
					return true;
916
				}
917
			}
918
		}
919
		var elem = (dojo.render.html.ie) ? this.document.selection.createRange() : this.document;
920
		return elem.queryCommandEnabled(command);
921
	}
922
}, queryCommandState:function (command) {
923
	command = this._normalizeCommand(command);
924
	if (this.object) {
925
		if (command == "forecolor") {
926
			command = "setforecolor";
927
		} else {
928
			if (command == "backcolor") {
929
				command = "setbackcolor";
930
			} else {
931
				if (command == "strikethrough") {
932
					return dojo.withGlobal(this.window, "hasAncestorElement", dojo.html.selection, ["strike"]);
933
				} else {
934
					if (command == "inserthorizontalrule") {
935
						return false;
936
					}
937
				}
938
			}
939
		}
940
		if (typeof this._activeX.command[command] == "undefined") {
941
			return null;
942
		}
943
		var status = this.object.QueryStatus(this._activeX.command[command]);
944
		return ((status == this._activeX.status.latched) || (status == this._activeX.status.ninched));
945
	} else {
946
		return this.document.queryCommandState(command);
947
	}
948
}, queryCommandValue:function (command) {
949
	command = this._normalizeCommand(command);
950
	if (this.object) {
951
		switch (command) {
952
		  case "forecolor":
953
		  case "backcolor":
954
		  case "fontsize":
955
		  case "fontname":
956
			command = "get" + command;
957
			return this.object.execCommand(this._activeX.command[command], this._activeX.ui.noprompt);
958
		  case "formatblock":
959
			var retvalue = this.object.execCommand(this._activeX.command["getblockformat"], this._activeX.ui.noprompt);
960
			if (retvalue) {
961
				return this._local2NativeFormatNames[retvalue];
962
			}
963
		}
964
	} else {
965
		if (dojo.render.html.ie && command == "formatblock") {
966
			return this._local2NativeFormatNames[this.document.queryCommandValue(command)] || this.document.queryCommandValue(command);
967
		}
968
		return this.document.queryCommandValue(command);
969
	}
970
}, placeCursorAtStart:function () {
971
	this.focus();
972
	if (dojo.render.html.moz && this.editNode.firstChild && this.editNode.firstChild.nodeType != dojo.dom.TEXT_NODE) {
973
		dojo.withGlobal(this.window, "selectElementChildren", dojo.html.selection, [this.editNode.firstChild]);
974
	} else {
975
		dojo.withGlobal(this.window, "selectElementChildren", dojo.html.selection, [this.editNode]);
976
	}
977
	dojo.withGlobal(this.window, "collapse", dojo.html.selection, [true]);
978
}, placeCursorAtEnd:function () {
979
	this.focus();
980
	if (dojo.render.html.moz && this.editNode.lastChild && this.editNode.lastChild.nodeType != dojo.dom.TEXT_NODE) {
981
		dojo.withGlobal(this.window, "selectElementChildren", dojo.html.selection, [this.editNode.lastChild]);
982
	} else {
983
		dojo.withGlobal(this.window, "selectElementChildren", dojo.html.selection, [this.editNode]);
984
	}
985
	dojo.withGlobal(this.window, "collapse", dojo.html.selection, [false]);
986
}, replaceEditorContent:function (html) {
987
	html = this._preFilterContent(html);
988
	if (this.isClosed) {
989
		this.domNode.innerHTML = html;
990
	} else {
991
		if (this.window && this.window.getSelection && !dojo.render.html.moz) {
992
			this.editNode.innerHTML = html;
993
		} else {
994
			if ((this.window && this.window.getSelection) || (this.document && this.document.selection)) {
995
				this.execCommand("selectall");
996
				if (dojo.render.html.moz && !html) {
997
					html = "&nbsp;";
998
				}
999
				this.execCommand("inserthtml", html);
1000
			}
1001
		}
1002
	}
1003
}, _preFilterContent:function (html) {
1004
	var ec = html;
1005
	dojo.lang.forEach(this.contentPreFilters, function (ef) {
1006
		ec = ef(ec);
1007
	});
1008
	if (this.contentDomPreFilters.length > 0) {
1009
		var dom = dojo.doc().createElement("div");
1010
		dom.style.display = "none";
1011
		dojo.body().appendChild(dom);
1012
		dom.innerHTML = ec;
1013
		dojo.lang.forEach(this.contentDomPreFilters, function (ef) {
1014
			dom = ef(dom);
1015
		});
1016
		ec = dom.innerHTML;
1017
		dojo.body().removeChild(dom);
1018
	}
1019
	return ec;
1020
}, _postFilterContent:function (html) {
1021
	var ec = html;
1022
	if (this.contentDomPostFilters.length > 0) {
1023
		var dom = this.document.createElement("div");
1024
		dom.innerHTML = ec;
1025
		dojo.lang.forEach(this.contentDomPostFilters, function (ef) {
1026
			dom = ef(dom);
1027
		});
1028
		ec = dom.innerHTML;
1029
	}
1030
	dojo.lang.forEach(this.contentPostFilters, function (ef) {
1031
		ec = ef(ec);
1032
	});
1033
	return ec;
1034
}, _lastHeight:0, _updateHeight:function () {
1035
	if (!this.isLoaded) {
1036
		return;
1037
	}
1038
	if (this.height) {
1039
		return;
1040
	}
1041
	var height = dojo.html.getBorderBox(this.editNode).height;
1042
	if (!height) {
1043
		height = dojo.html.getBorderBox(this.document.body).height;
1044
	}
1045
	if (height == 0) {
1046
		dojo.debug("Can not figure out the height of the editing area!");
1047
		return;
1048
	}
1049
	this._lastHeight = height;
1050
	this.editorObject.style.height = this._lastHeight + "px";
1051
	this.window.scrollTo(0, 0);
1052
}, _saveContent:function (e) {
1053
	var saveTextarea = dojo.doc().getElementById("dojo.widget.RichText.savedContent");
1054
	saveTextarea.value += this._SEPARATOR + this.saveName + ":" + this.getEditorContent();
1055
}, getEditorContent:function () {
1056
	var ec = "";
1057
	try {
1058
		ec = (this._content.length > 0) ? this._content : this.editNode.innerHTML;
1059
		if (dojo.string.trim(ec) == "&nbsp;") {
1060
			ec = "";
1061
		}
1062
	}
1063
	catch (e) {
1064
	}
1065
	if (dojo.render.html.ie && !this.object) {
1066
		var re = new RegExp("(?:<p>&nbsp;</p>[\n\r]*)+$", "i");
1067
		ec = ec.replace(re, "");
1068
	}
1069
	ec = this._postFilterContent(ec);
1070
	if (this.relativeImageUrls) {
1071
		var siteBase = dojo.global().location.protocol + "//" + dojo.global().location.host;
1072
		var pathBase = dojo.global().location.pathname;
1073
		if (pathBase.match(/\/$/)) {
1074
		} else {
1075
			var pathParts = pathBase.split("/");
1076
			if (pathParts.length) {
1077
				pathParts.pop();
1078
			}
1079
			pathBase = pathParts.join("/") + "/";
1080
		}
1081
		var sameSite = new RegExp("(<img[^>]* src=[\"'])(" + siteBase + "(" + pathBase + ")?)", "ig");
1082
		ec = ec.replace(sameSite, "$1");
1083
	}
1084
	return ec;
1085
}, close:function (save, force) {
1086
	if (this.isClosed) {
1087
		return false;
1088
	}
1089
	if (arguments.length == 0) {
1090
		save = true;
1091
	}
1092
	this._content = this._postFilterContent(this.editNode.innerHTML);
1093
	var changed = (this.savedContent != this._content);
1094
	if (this.interval) {
1095
		clearInterval(this.interval);
1096
	}
1097
	if (dojo.render.html.ie && !this.object) {
1098
		dojo.event.browser.clean(this.editNode);
1099
	}
1100
	if (this.iframe) {
1101
		delete this.iframe;
1102
	}
1103
	if (this.textarea) {
1104
		with (this.textarea.style) {
1105
			position = "";
1106
			left = top = "";
1107
			if (dojo.render.html.ie) {
1108
				overflow = this.__overflow;
1109
				this.__overflow = null;
1110
			}
1111
		}
1112
		if (save) {
1113
			this.textarea.value = this._content;
1114
		} else {
1115
			this.textarea.value = this.savedContent;
1116
		}
1117
		dojo.html.removeNode(this.domNode);
1118
		this.domNode = this.textarea;
1119
	} else {
1120
		if (save) {
1121
			if (dojo.render.html.moz) {
1122
				var nc = dojo.doc().createElement("span");
1123
				this.domNode.appendChild(nc);
1124
				nc.innerHTML = this.editNode.innerHTML;
1125
			} else {
1126
				this.domNode.innerHTML = this._content;
1127
			}
1128
		} else {
1129
			this.domNode.innerHTML = this.savedContent;
1130
		}
1131
	}
1132
	dojo.html.removeClass(this.domNode, "RichTextEditable");
1133
	this.isClosed = true;
1134
	this.isLoaded = false;
1135
	delete this.editNode;
1136
	if (this.window._frameElement) {
1137
		this.window._frameElement = null;
1138
	}
1139
	this.window = null;
1140
	this.document = null;
1141
	this.object = null;
1142
	this.editingArea = null;
1143
	this.editorObject = null;
1144
	return changed;
1145
}, destroyRendering:function () {
1146
}, destroy:function () {
1147
	this.destroyRendering();
1148
	if (!this.isClosed) {
1149
		this.close(false);
1150
	}
1151
	dojo.widget.RichText.superclass.destroy.call(this);
1152
}, connect:function (targetObj, targetFunc, thisFunc) {
1153
	dojo.event.connect(targetObj, targetFunc, this, thisFunc);
1154
}, disconnect:function (targetObj, targetFunc, thisFunc) {
1155
	dojo.event.disconnect(targetObj, targetFunc, this, thisFunc);
1156
}, disconnectAllWithRoot:function (targetObj) {
1157
	dojo.deprecated("disconnectAllWithRoot", "is deprecated. No need to disconnect manually", "0.5");
1158
}, _fixContentForMoz:function (html) {
1159
	html = html.replace(/<strong([ \>])/gi, "<b$1");
1160
	html = html.replace(/<\/strong>/gi, "</b>");
1161
	html = html.replace(/<em([ \>])/gi, "<i$1");
1162
	html = html.replace(/<\/em>/gi, "</i>");
1163
	return html;
1164
}});
1165