Bug #18371 ยป rtehtmlarea_bugfix_7755.patch
typo3/sysext/rtehtmlarea/htmlarea/htmlarea-gecko.js (working copy) | ||
---|---|---|
*
|
||
* (c) 2002-2004, interactivetools.com, inc.
|
||
* (c) 2003-2004 dynarch.com
|
||
* (c) 2004-2007 Stanislas Rolland <stanislas.rolland(arobas)fructifor.ca>
|
||
* (c) 2004-2008 Stanislas Rolland <stanislas.rolland(arobas)fructifor.ca>
|
||
* All rights reserved
|
||
*
|
||
* This script is part of the TYPO3 project. The TYPO3 project is
|
||
... | ... | |
a = null,
|
||
doc = this._doc;
|
||
for (i = 0; i < p.length; ++i) {
|
||
if (HTMLArea.isBlockElement(p[i]) && !/^(html|body|table|tbody|thead|tr)$/i.test(p[i].nodeName)) {
|
||
if (HTMLArea.isBlockElement(p[i]) && !/^(html|body|table|tbody|thead|tfoot|tr|dl)$/i.test(p[i].nodeName)) {
|
||
block = p[i];
|
||
break;
|
||
}
|
||
}
|
||
if (block && /^(td|th|table|tbody|thead|tr)$/i.test(block.nodeName) && this.config.buttons.table && this.config.buttons.table.disableEnterParagraphs) return false;
|
||
if (block && /^(td|th|tr|tbody|thead|tfoot|table)$/i.test(block.nodeName) && this.config.buttons.table && this.config.buttons.table.disableEnterParagraphs) return false;
|
||
if (!range.collapsed) {
|
||
range.deleteContents();
|
||
}
|
||
... | ... | |
}
|
||
p = df.firstChild;
|
||
if (p) {
|
||
if (!/\S/.test(p.innerHTML)) {
|
||
if (!/\S/.test(p.textContent)) {
|
||
if (/^h[1-6]$/i.test(p.nodeName)) {
|
||
p = this.convertNode(p, "p");
|
||
}
|
||
if (/^(dt|dd)$/i.test(p.nodeName)) {
|
||
p = this.convertNode(p, (p.nodeName.toLowerCase() === "dt") ? "dd" : "dt");
|
||
}
|
||
if (!HTMLArea.is_opera) {
|
||
p.innerHTML = "<br />";
|
||
}
|
||
... | ... | |
}
|
||
this.selectNodeContents(p, true);
|
||
} else {
|
||
if (block.nodeName.toLowerCase() === "li") {
|
||
p = doc.createElement("li");
|
||
if (/^(li|dt|dd)$/i.test(block.nodeName)) {
|
||
p = doc.createElement(block.nodeName);
|
||
} else {
|
||
p = doc.createElement("p");
|
||
}
|
typo3/sysext/rtehtmlarea/htmlarea/plugins/BlockElements/block-elements.js (working copy) | ||
---|---|---|
},
|
||
|
||
/*
|
||
* This function gets called by the main editor event handler when a key was pressed.
|
||
* It will process the enter key for IE when the cursor is at the end of a dt or a dd element
|
||
*/
|
||
onKeyPress : function (ev) {
|
||
if (HTMLArea.is_ie && ev.keyCode == 13 && !ev.shiftKey) {
|
||
var selection = this.editor._getSelection();
|
||
if (this.editor._selectionEmpty(selection)) {
|
||
var range = this.editor._createRange(selection);
|
||
var parentElement = this.editor.getParentElement(selection, range);
|
||
while (parentElement && !HTMLArea.isBlockElement(parentElement)) {
|
||
parentElement = parentElement.parentNode;
|
||
}
|
||
if (/^(dt|dd)$/i.test(parentElement.nodeName)) {
|
||
var nodeRange = this.editor._createRange();
|
||
nodeRange.moveToElementText(parentElement);
|
||
range.setEndPoint("EndToEnd", nodeRange);
|
||
if (!range.text || range.text == "\x20") {
|
||
var item = parentElement.parentNode.insertBefore(this.editor._doc.createElement((parentElement.nodeName.toLowerCase() === "dt") ? "dd" : "dt"), parentElement.nextSibling);
|
||
item.innerHTML = "\x20";
|
||
this.editor.selectNodeContents(item, true);
|
||
return false;
|
||
}
|
||
}
|
||
}
|
||
}
|
||
return true;
|
||
},
|
||
|
||
/*
|
||
* This function gets called when the toolbar is updated
|
||
*/
|
||
onUpdateToolbar : function () {
|