* Fixed bug #7923: htmlArea RTE cannot delete block via delete/backspace key in IE...
authorStanislas Rolland <typo3@sjbr.ca>
Sat, 22 Mar 2008 14:18:04 +0000 (14:18 +0000)
committerStanislas Rolland <typo3@sjbr.ca>
Sat, 22 Mar 2008 14:18:04 +0000 (14:18 +0000)
git-svn-id: https://svn.typo3.org/TYPO3v4/Core/trunk@3469 709f56b5-9817-0410-a4d7-c38de5d9e867

ChangeLog
typo3/sysext/rtehtmlarea/ChangeLog
typo3/sysext/rtehtmlarea/doc/manual.sxw
typo3/sysext/rtehtmlarea/htmlarea/htmlarea-ie.js

index 5b70af5..57426dc 100755 (executable)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,6 @@
+2008-03-22  Stanislas Rolland  <typo3@sjbr.ca>
+
+       * Fixed bug #7923: htmlArea RTE cannot delete block via delete/backspace keys in IE 6 and IE7
 
 2008-03-21  Martin Kutschker  <masi@typo3.org>
 
index 611d2ce..0dbe261 100644 (file)
@@ -1,3 +1,7 @@
+2008-03-22  Stanislas Rolland  <typo3@sjbr.ca>
+
+       * Fixed bug #7923: htmlArea RTE cannot delete block via delete/backspace keys in IE6 and IE7
+
 2008-03-20  Stanislas Rolland  <typo3@sjbr.ca>
 
        * Fixed bug #7918: HTMLArea RTE: table width unit default not honoured when width is not set
index a277773..2287335 100644 (file)
Binary files a/typo3/sysext/rtehtmlarea/doc/manual.sxw and b/typo3/sysext/rtehtmlarea/doc/manual.sxw differ
index b6ef8c8..05173a6 100644 (file)
@@ -253,18 +253,34 @@ HTMLArea.statusBarHandler = function (ev) {
  * Handle the backspace event in IE browsers
  */
 HTMLArea.prototype._checkBackspace = function() {
-       var sel = this._getSelection();
-       var range = this._createRange(sel);
-       if(sel.type == "Control"){
+       var selection = this._getSelection();
+       var range = this._createRange(selection);
+       if (selection.type == "Control"){ // Deleting or backspacing on a control selection : delete the element
                var el = this.getParentElement();
                var p = el.parentNode;
                p.removeChild(el);
                return true;
-       } else {
+       } else if (this._selectionEmpty(selection)) { // Check if deleting an empty block with a table as next sibling
+               var el = this.getParentElement();
+               if (!el.innerHTML && HTMLArea.isBlockElement(el) && el.nextSibling && /^table$/i.test(el.nextSibling.nodeName)) {
+                       var previous = el.previousSibling;
+                       if (!previous) {
+                               this.selectNodeContents(el.nextSibling.rows[0].cells[0], true);
+                       } else if (/^table$/i.test(previous.nodeName)) {
+                               this.selectNodeContents(previous.rows[previous.rows.length-1].cells[previous.rows[previous.rows.length-1].cells.length-1], false);
+                       } else {
+                               range.moveStart("character", -1);
+                               range.collapse(true);
+                               range.select();
+                       }
+                       el.parentNode.removeChild(el);
+                       return true;
+               }
+       } else { // Backspacing into a link
                var r2 = range.duplicate();
                r2.moveStart("character", -1);
                var a = r2.parentElement();
-               if(a != range.parentElement() && /^a$/i.test(a.tagName)) {
+               if (a != range.parentElement() && /^a$/i.test(a.nodeName)) {
                        r2.collapse(true);
                        r2.moveEnd("character", 1);
                        r2.pasteHTML('');