Index: typo3/sysext/rtehtmlarea/htmlarea/htmlarea-ie.js
===================================================================
--- typo3/sysext/rtehtmlarea/htmlarea/htmlarea-ie.js	(révision 5291)
+++ typo3/sysext/rtehtmlarea/htmlarea/htmlarea-ie.js	(copie de travail)
@@ -53,11 +53,13 @@
  * Create a range for the current selection
  */
 HTMLArea.prototype._createRange = function(sel) {
-	this.focusEditor();
-	if (typeof(sel) != "undefined") {
-		return sel.createRange();
+	if (typeof(sel) == "undefined") {
+		var sel = this._getSelection();
 	}
-	return this._doc.selection.createRange();
+	if (sel.type.toLowerCase() == "none") {
+		this.focusEditor();
+	}
+	return sel.createRange();
 };
 
 /*
@@ -126,13 +128,13 @@
 HTMLArea.prototype.getParentElement = function(sel) {
 	if(!sel) var sel = this._getSelection();
 	var range = this._createRange(sel);
-	switch (sel.type) {
-		case "Text":
-		case "None":
+	switch (sel.type.toLowerCase()) {
+		case "text":
+		case "none":
 			var el = range.parentElement();
 			if(el.nodeName.toLowerCase() == "li" && range.htmlText.replace(/\s/g,"") == el.parentNode.outerHTML.replace(/\s/g,"")) return el.parentNode;
 			return el;
-		case "Control": return range.item(0);
+		case "control": return range.item(0);
 		default: return this._doc.body;
 	}
 };
@@ -147,7 +149,6 @@
 HTMLArea.prototype._activeElement = function(sel) {
 	if(sel == null) return null;
 	if(this._selectionEmpty(sel)) return null;
-	this.focusEditor();
 	if(sel.type.toLowerCase() == "control") {
 		return sel.createRange().item(0);
 	} else {
Index: typo3/sysext/rtehtmlarea/htmlarea/htmlarea.js
===================================================================
--- typo3/sysext/rtehtmlarea/htmlarea/htmlarea.js	(révision 5291)
+++ typo3/sysext/rtehtmlarea/htmlarea/htmlarea.js	(copie de travail)
@@ -1586,7 +1586,11 @@
 		if ((HTMLArea.is_gecko && !HTMLArea.is_opera) || (HTMLArea.is_ie && selection.type.toLowerCase() != "control")) {
 				// catch error in FF when the selection contains no usable range
 			try {
-				bookmark = this.getBookmark(this._createRange(selection));
+					// Work around IE8 bug: can't create a range correctly if the selection is empty and the focus is not on the editor window
+					// But we cannot grab focus from an opened window just for the sake of taking this bookmark
+				if (!HTMLArea.is_ie || !this.hasOpenedWindow() || selection.type.toLowerCase() != "none") {
+					bookmark = this.getBookmark(this._createRange(selection));
+				}
 			} catch (e) {
 				bookmark = null;
 			}
@@ -1647,6 +1651,20 @@
 };
 
 /*
+ * Check if any plugin has an opened window
+ */
+HTMLArea.prototype.hasOpenedWindow = function () {
+	for (var plugin in this.plugins) {
+		if (this.plugins.hasOwnProperty(plugin)) {
+			if (HTMLArea.Dialog[plugin.name] && HTMLArea.Dialog[plugin.name].hasOpenedWindow && HTMLArea.Dialog[plugin.name].hasOpenedWindow()) {
+				return true;
+			}
+		}
+	}
+	return false
+};
+
+/*
  * Update the enabled/disabled/active state of the toolbar elements
  */
 HTMLArea.updateToolbar = function(editorNumber) {
@@ -3697,7 +3715,9 @@
 	 * @return	void
 	 */
 	focus : function () {
-		this.dialogWindow.focus();
+		if (this.hasOpenedWindow()) {
+			this.dialogWindow.focus();
+		}
 	},
 
 	/**
@@ -3805,10 +3825,8 @@
 		this.escapeFunctionReference = this.makeFunctionReference("closeOnEscape");
 		HTMLArea._addEvent(this.dialogWindow.document, "keypress", this.escapeFunctionReference);
 			// Capture focus events on the opener window and its frames
-		if (HTMLArea.is_gecko) {
-			this.recoverFocusFunctionReference = this.makeFunctionReference("recoverFocus");
-			this.captureFocus(this.dialogWindow.opener);
-		}
+		this.recoverFocusFunctionReference = this.makeFunctionReference("recoverFocus");
+		this.captureFocus(this.dialogWindow.opener);
 	 },
 
 	/**
Index: typo3/sysext/rtehtmlarea/htmlarea/plugins/Acronym/acronym.js
===================================================================
--- typo3/sysext/rtehtmlarea/htmlarea/plugins/Acronym/acronym.js	(révision 5291)
+++ typo3/sysext/rtehtmlarea/htmlarea/plugins/Acronym/acronym.js	(copie de travail)
@@ -1,7 +1,7 @@
 /***************************************************************
 *  Copyright notice
 *
-*  (c) 2005-2008 Stanislas Rolland <typo3(arobas)sjbr.ca>
+*  (c) 2005-2009 Stanislas Rolland <typo3(arobas)sjbr.ca>
 *  All rights reserved
 *
 *  This script is part of the TYPO3 project. The TYPO3 project is
@@ -83,6 +83,23 @@
 	 * @return	boolean		false if action is completed
 	 */
 	onButtonPress : function(editor, id) {
+		var selection = editor._getSelection();
+		var html = editor.getSelectedHTML();
+		this.abbr = editor._activeElement(selection);
+		this.abbrType = null;
+			// Working around Safari issue
+		if (!this.abbr && editor._statusBarTree.selected) {
+			this.abbr = editor._statusBarTree.selected;
+		}
+		if (!(this.abbr != null && /^(acronym|abbr)$/i.test(this.abbr.nodeName))) {
+			this.abbr = editor._getFirstAncestor(selection, ["acronym", "abbr"]);
+		}
+		if (this.abbr != null && /^(acronym|abbr)$/i.test(this.abbr.nodeName)) {
+			this.param = { title : this.abbr.title, text : this.abbr.innerHTML};
+			this.abbrType = this.abbr.nodeName.toLowerCase();
+		} else {
+			this.param = { title : "", text : html};
+		}
 		this.dialog = this.openDialog("Acronym", this.makeUrlFromModulePath(this.acronymModulePath), null, null, {width:580, height:280});
 		return false;
 	},
@@ -112,6 +129,9 @@
 					this.editor._toolbarObjects[buttonId].state("enabled", !((el.nodeName.toLowerCase() == "acronym" && this.pageTSConfiguration.noAcronym) || (el.nodeName.toLowerCase() == "abbr" && this.pageTSConfiguration.noAbbr)));
 					this.editor._toolbarObjects[buttonId].state("active", ((el.nodeName.toLowerCase() == "acronym" && !this.pageTSConfiguration.noAcronym) || (el.nodeName.toLowerCase() == "abbr" && !this.pageTSConfiguration.noAbbr)));
 				}
+				if (this.dialog) {
+					this.dialog.focus();
+				}
 			}
 		}
 	}
Index: typo3/sysext/rtehtmlarea/htmlarea/plugins/CharacterMap/character-map.js
===================================================================
--- typo3/sysext/rtehtmlarea/htmlarea/plugins/CharacterMap/character-map.js	(révision 5291)
+++ typo3/sysext/rtehtmlarea/htmlarea/plugins/CharacterMap/character-map.js	(copie de travail)
@@ -3,7 +3,7 @@
 *
 *  (c) 2004 Bernhard Pfeifer novocaine@gmx.net
 *  (c) 2004 systemconcept.de. Authored by Holger Hees based on HTMLArea XTD 1.5 (http://mosforge.net/projects/htmlarea3xtd/).
-*  (c) 2005-2008 Stanislas Rolland <stanislas.rolland(arobas)fructifor.ca>
+*  (c) 2005-2009 Stanislas Rolland <typo3(arobas)sjbr.ca>
 *  All rights reserved
 *
 *  This script is part of the TYPO3 project. The TYPO3 project is
@@ -95,11 +95,22 @@
 	 */
 	insertCharacter : function(entity) {
 		if (typeof(entity) != "undefined") {
-			this.editor.focusEditor();
 			this.editor.insertHTML(entity);
 			this.dialog.focus();
 		}
 		return false;
-	}
+	},
+
+	/*
+	 * This function gets called when the toolbar is updated
+	 *
+	 * @return	void
+	 */
+	onUpdateToolbar : function () {
+			// Reclaim focus
+		if (this.dialog) {
+			this.dialog.focus();
+		}
+ 	}
 });
 
Index: typo3/sysext/rtehtmlarea/mod2/class.tx_rtehtmlarea_acronym_mod.php
===================================================================
--- typo3/sysext/rtehtmlarea/mod2/class.tx_rtehtmlarea_acronym_mod.php	(révision 5291)
+++ typo3/sysext/rtehtmlarea/mod2/class.tx_rtehtmlarea_acronym_mod.php	(copie de travail)
@@ -59,28 +59,13 @@
 		$JScode='
 			var dialog = window.opener.HTMLArea.Dialog.Acronym;
 			var editor = dialog.plugin.editor;
-			var param = null;
-			var html = editor.getSelectedHTML();
-			var sel = editor._getSelection();
-			var range = editor._createRange(sel);
-			var abbr = editor._activeElement(sel);
-				// Working around Safari issue
-			if (!abbr && editor._statusBarTree.selected) {
-				abbr = editor._statusBarTree.selected;
-			}
-			var abbrType = null;
-			var acronyms = new Object();
-			var abbreviations = new Object();
-			if (!(abbr != null && /^(acronym|abbr)$/i.test(abbr.nodeName))) {
-				abbr = editor._getFirstAncestor(sel, ["acronym", "abbr"]);
-			}
-			if (abbr != null && /^(acronym|abbr)$/i.test(abbr.nodeName)) {
-				param = { title : abbr.title, text : abbr.innerHTML};
-				abbrType = abbr.nodeName.toLowerCase();
-			} else {
-				param = { title : "", text : html};
-			}
-			
+			var param = dialog.plugin.param,
+				abbr = dialog.plugin.abbr,
+				abbrType = dialog.plugin.abbrType,
+				html = "",
+				acronyms = new Object(),
+				abbreviations = new Object();
+
 			function setType() {
 				if(document.content.acronym.checked) {
 					abbrType = "acronym";
@@ -170,8 +155,7 @@
 							html = document.content.acronymSelector.options[document.content.acronymSelector.selectedIndex].value;
 						}
 						abbr.innerHTML = html;
-						if (HTMLArea.is_ie) range.pasteHTML(abbr.outerHTML);
-							else editor.insertNodeAtSelection(abbr);
+						editor.insertNodeAtSelection(abbr);
 					} else {
 						abbr.title = title;
 						if(document.content.acronymSelector.options.length != 1 && document.content.termSelector.selectedIndex > 0 && document.content.termSelector.options[document.content.termSelector.selectedIndex].value == title) abbr.innerHTML = document.content.acronymSelector.options[document.content.acronymSelector.selectedIndex].value;
