* Fixed bug #7862: htmlArea RTE: incorrect nesting of ol/ul inside definition lists
authorStanislas Rolland <typo3@sjbr.ca>
Fri, 14 Mar 2008 15:47:18 +0000 (15:47 +0000)
committerStanislas Rolland <typo3@sjbr.ca>
Fri, 14 Mar 2008 15:47:18 +0000 (15:47 +0000)
git-svn-id: https://svn.typo3.org/TYPO3v4/Core/trunk@3424 709f56b5-9817-0410-a4d7-c38de5d9e867

ChangeLog
typo3/sysext/rtehtmlarea/ChangeLog
typo3/sysext/rtehtmlarea/htmlarea/htmlarea-gecko.js
typo3/sysext/rtehtmlarea/htmlarea/plugins/BlockElements/block-elements.js

index e8deffe..b7d144d 100755 (executable)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2008-03-14  Stanislas Rolland  <typo3@sjbr.ca>
+
+       * Fixed bug #7862: htmlArea RTE: incorrect nesting of ol/ul inside definition lists
+
 2008-03-14  Ingo Renner  <ingo@typo3.org>
 
        * Fixed bug #7850: error in publish.php if errors in TCE should be shown, credits Daniel Pötzinger
index 7e464ef..6346c66 100644 (file)
@@ -1,3 +1,7 @@
+2008-03-14  Stanislas Rolland  <typo3@sjbr.ca>
+
+       * Fixed bug #7862: htmlArea RTE: incorrect nesting of ol/ul inside definition lists
+
 2008-03-13  Stanislas Rolland  <typo3@sjbr.ca>
 
        * Fixed bug #7851: htmlArea RTE causes memory leaks in IE
index 90c2e4a..d5262b6 100644 (file)
@@ -681,7 +681,7 @@ HTMLArea.prototype._checkInsertP = function() {
                                left.removeChild(block);
                                range.setEndAfter(left);
                                range.collapse(false);
-                               p = this.convertNode(p, /^li$/i.test(left.parentNode.nodeName) ? "br" : "p");
+                               p = this.convertNode(p, /^(li|dd|td|th)$/i.test(left.parentNode.nodeName) ? "br" : "p");
                        }
                        range.insertNode(df);
                                // Remove any anchor created empty
@@ -689,6 +689,9 @@ HTMLArea.prototype._checkInsertP = function() {
                                var a = p.previousSibling.lastChild;
                                if (a && /^a$/i.test(a.nodeName) && !/\S/.test(a.innerHTML)) HTMLArea.removeFromParent(a);
                        }
+                       if (/^br$/i.test(p.nodeName)) {
+                               p = p.parentNode.insertBefore(this._doc.createTextNode("\x20"), p);
+                       }
                        this.selectNodeContents(p, true);
                } else {
                        if (/^(li|dt|dd)$/i.test(block.nodeName)) {
index 7285997..202132b 100644 (file)
@@ -477,14 +477,7 @@ BlockElements = HTMLArea.Plugin.extend({
                                break;
                        case "InsertOrderedList":
                        case "InsertUnorderedList":
-                               try {
-                                       this.editor._doc.execCommand(buttonId, false, null);
-                               } catch(e) {
-                                       this.appendToLog("onButtonPress", e + "\n\nby execCommand(" + buttonId + ");");
-                               }
-                               if (HTMLArea.is_safari) {
-                                       this.cleanAppleSpanTags(parentElement);
-                               }
+                               this.insertList(buttonId, parentElement);
                                break;
                        case "none" :
                                if (this.isAllowedBlockElement(parentElement.nodeName)) {
@@ -675,6 +668,24 @@ BlockElements = HTMLArea.Plugin.extend({
                this.editor.selectRange(range);
        },
        
+       insertList : function (buttonId, parentElement) {
+               if (/^(dd)$/i.test(parentElement.nodeName)) {
+                       var list = parentElement.appendChild(this.editor._doc.createElement((buttonId === "OrderedList") ? "ol" : "ul"));
+                       var first = list.appendChild(this.editor._doc.createElement("li"));
+                       first.innerHTML = "<br />";
+                       this.editor.selectNodeContents(first,true);
+               } else {
+                       try {
+                               this.editor._doc.execCommand(buttonId, false, null);
+                       } catch(e) {
+                               this.appendToLog("onButtonPress", e + "\n\nby execCommand(" + buttonId + ");");
+                       }
+                       if (HTMLArea.is_safari) {
+                               this.cleanAppleSpanTags(parentElement);
+                       }
+               }
+       },
+       
        /*
         * Indent selected list elements
         */
@@ -880,6 +891,14 @@ BlockElements = HTMLArea.Plugin.extend({
                                                this.editor.selectNodeContents(item, true);
                                                return false;
                                        }
+                               } else if (/^(li)$/i.test(parentElement.nodeName)
+                                               && !parentElement.innerText
+                                               && parentElement.parentNode.parentNode
+                                               && /^(dd|td|th)$/i.test(parentElement.parentNode.parentNode.nodeName)) {
+                                       var item = parentElement.parentNode.parentNode.insertBefore(this.editor._doc.createTextNode("\x20"), parentElement.parentNode.nextSibling);
+                                       this.editor.selectNodeContents(parentElement.parentNode.parentNode, false);
+                                       parentElement.parentNode.removeChild(parentElement);
+                                       return false;
                                }
                        }
                }