Index: typo3/sysext/rtehtmlarea/htmlarea/plugins/BlockElements/block-elements.js
===================================================================
--- typo3/sysext/rtehtmlarea/htmlarea/plugins/BlockElements/block-elements.js (révision 9755)
+++ typo3/sysext/rtehtmlarea/htmlarea/plugins/BlockElements/block-elements.js (copie de travail)
@@ -106,13 +106,13 @@
* Registering plugin "About" information
*/
var pluginInformation = {
- version : "1.4",
- developer : "Stanislas Rolland",
- developerUrl : "http://www.sjbr.ca/",
- copyrightOwner : "Stanislas Rolland",
- sponsor : this.localize("Technische Universitat Ilmenau"),
- sponsorUrl : "http://www.tu-ilmenau.de/",
- license : "GPL"
+ version : '1.5',
+ developer : 'Stanislas Rolland',
+ developerUrl : 'http://www.sjbr.ca/',
+ copyrightOwner : 'Stanislas Rolland',
+ sponsor : this.localize('Technische Universitat Ilmenau'),
+ sponsorUrl : 'http://www.tu-ilmenau.de/',
+ license : 'GPL'
};
this.registerPluginInformation(pluginInformation);
@@ -545,7 +545,7 @@
this.insertList(buttonId, parentElement);
break;
case "InsertHorizontalRule":
- this.editor.execCommand('InsertHorizontalRule');
+ this.insertHorizontalRule();
break;
case "none" :
if (this.isAllowedBlockElement(parentElement.nodeName)) {
@@ -934,6 +934,49 @@
}
},
/*
+ * Insert horizontal line
+ */
+ insertHorizontalRule: function() {
+ this.editor.execCommand('InsertHorizontalRule');
+ // Apply enterParagraphs rule
+ if (!Ext.isIE && !Ext.isOpera && !this.editor.config.disableEnterParagraphs) {
+ var range = this.editor._createRange(this.editor._getSelection());
+ var startContainer = range.startContainer;
+ if (/^body$/i.test(startContainer.nodeName)) {
+ startContainer.normalize();
+ var ruler = startContainer.childNodes[range.startOffset-1];
+ if (ruler.nextSibling) {
+ if (ruler.nextSibling.nodeType == HTMLArea.DOM.TEXT_NODE) {
+ if (/\S/.test(ruler.nextSibling.textContent)) {
+ var paragraph = this.editor.document.createElement('p');
+ paragraph = startContainer.appendChild(paragraph);
+ paragraph = startContainer.insertBefore(paragraph, ruler.nextSibling);
+ paragraph.appendChild(ruler.nextSibling);
+ } else {
+ HTMLArea.removeFromParent(ruler.nextSibling);
+ var paragraph = ruler.nextSibling;
+ }
+ } else {
+ var paragraph = ruler.nextSibling;
+ }
+ // Cannot set the cursor on the hr element
+ if (/^hr$/i.test(paragraph.nodeName)) {
+ var inBetweenParagraph = this.editor.document.createElement('p');
+ inBetweenParagraph.innerHTML = '
';
+ paragraph = startContainer.insertBefore(inBetweenParagraph, paragraph);
+ }
+ } else {
+ var paragraph = this.editor.document.createElement('p');
+ if (Ext.isWebKit) {
+ paragraph.innerHTML = '
';
+ }
+ paragraph = startContainer.appendChild(paragraph);
+ }
+ this.editor.selectNodeContents(paragraph, true);
+ }
+ }
+ },
+ /*
* This function gets called when the plugin is generated
*/
onGenerate: function () {