Project

General

Profile

Bug #20280 » rtehtmlarea_bugfix_10847_trunk.patch

Administrator Admin, 2009-04-09 07:11

View differences:

typo3/sysext/rtehtmlarea/htmlarea/htmlarea-ie.js (copie de travail)
* 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();
};
/*
......
if (typeof(range) === "undefined") {
var range = this._createRange(selection);
}
switch (selection.type) {
case "Text":
case "None":
switch (selection.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;
}
};
......
* Borrowed from Xinha (is not htmlArea) - http://xinha.gogo.co.nz/
*/
HTMLArea.prototype._activeElement = function(sel) {
if(sel == null) return null;
if(this._selectionEmpty(sel)) return null;
this.focusEditor();
if(sel.type.toLowerCase() == "control") {
if (sel == null) {
return null;
}
if (this._selectionEmpty(sel)) {
return null;
}
if (sel.type.toLowerCase() == "control") {
return sel.createRange().item(0);
} else {
// If it's not a control, then we need to see if the selection is the _entire_ text of a parent node
typo3/sysext/rtehtmlarea/htmlarea/htmlarea.js (copie de travail)
};
/*
* 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) {
......
* @return void
*/
focus : function () {
this.dialogWindow.focus();
if (this.hasOpenedWindow()) {
this.dialogWindow.focus();
}
},
/**
......
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);
},
/**
typo3/sysext/rtehtmlarea/htmlarea/plugins/Acronym/acronym.js (copie de travail)
* @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 && this.getPluginInstance("StatusBar") && this.getPluginInstance("StatusBar").getSelection()) {
this.abbr = this.getPluginInstance("StatusBar").getSelection();
}
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;
},
......
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();
}
}
}
}
typo3/sysext/rtehtmlarea/htmlarea/plugins/CharacterMap/character-map.js (copie de travail)
*
* (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-2009 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
......
*/
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();
}
}
});
typo3/sysext/rtehtmlarea/htmlarea/plugins/UndoRedo/undo-redo.js (copie de travail)
}
}
},
/*
* Build the snapshot entry
*
......
if (this.editor.getMode() == "wysiwyg" && this.editor.isEditable()) {
var selection = this.editor._getSelection();
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
// Catch error in FF when the selection contains no usable range
try {
bookmark = this.editor.getBookmark(this.editor._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.editor.hasOpenedWindow() || selection.type.toLowerCase() != "none") {
bookmark = this.editor.getBookmark(this.editor._createRange(selection));
}
} catch (e) {
bookmark = null;
}
typo3/sysext/rtehtmlarea/mod2/class.tx_rtehtmlarea_acronym_mod.php (copie de travail)
var dialog = window.opener.HTMLArea.Dialog.Acronym;
var plugin = dialog.plugin;
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 && plugin.getPluginInstance("StatusBar") && plugin.getPluginInstance("StatusBar").getSelection()) {
abbr = plugin.getPluginInstance("StatusBar").getSelection();
}
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) {
......
if (languageObject && plugin.isButtonInToolbar("Language")) {
languageObject.setLanguageAttributes(abbr, language);
}
if (HTMLArea.is_ie) range.pasteHTML(abbr.outerHTML);
else editor.insertNodeAtSelection(abbr);
editor.insertNodeAtSelection(abbr);
} else {
abbr.title = title;
if (languageObject && plugin.isButtonInToolbar("Language")) {
(1-1/2)