Follow-up to bug #16431: htmlArea RTE: in WebKit, clicking on image does not select it
authorStanislas Rolland <typo3@sjbr.ca>
Fri, 19 Nov 2010 16:06:39 +0000 (16:06 +0000)
committerStanislas Rolland <typo3@sjbr.ca>
Fri, 19 Nov 2010 16:06:39 +0000 (16:06 +0000)
git-svn-id: https://svn.typo3.org/TYPO3v4/Core/trunk@9492 709f56b5-9817-0410-a4d7-c38de5d9e867

ChangeLog
typo3/sysext/rtehtmlarea/ChangeLog
typo3/sysext/rtehtmlarea/htmlarea/htmlarea-gecko.js

index cac5055..f97091c 100755 (executable)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2010-11-19  Stanislas Rolland  <typo3@sjbr.ca>
+
+       * Follow-up to bug #16431: htmlArea RTE: in WebKit, clicking on image does not select it
+
 2010-11-18  Rupert Germann  <rupi@gmx.li>
 
        * Follow-up to bug #7942: "Next" buttons where missing in update wizard.
index 0ba4b59..97224df 100644 (file)
@@ -1,3 +1,7 @@
+2010-11-19  Stanislas Rolland  <typo3@sjbr.ca>
+
+       * Follow-up to bug #16431: htmlArea RTE: in WebKit, clicking on image does not select it
+
 2010-11-18  Stanislas Rolland  <typo3@sjbr.ca>
 
        * Fixed bug #16343: htmlArea RTE: JS-Error when closing "Insert Picture" dialogue
index 665e295..8efb161 100644 (file)
@@ -120,27 +120,26 @@ HTMLArea.Editor.prototype._createRange = function(sel) {
 HTMLArea.Editor.prototype.selectNode = function(node, endPoint) {
        this.focus();
        var selection = this._getSelection();
-       var range = this._doc.createRange();
-       if (node.nodeType == 1 && node.nodeName.toLowerCase() == "body") {
-               if (Ext.isWebKit) {
-                       range.setStart(node, 0);
-                       range.setEnd(node, node.childNodes.length);
-               } else {
-                       range.selectNodeContents(node);
-               }
+       if (Ext.isWebKit && /^(img)$/i.test(node.nodeName)) {
+               this._getSelection().setBaseAndExtent(node, 0, node, 1);
        } else {
-               if (node.nodeType == HTMLArea.DOM.ELEMENT_NODE && (Ext.isWebKit || Ext.isOpera)) {
-                       range.setStart(node, 0);
-                       range.setEnd(node, 0);
+               var range = this._doc.createRange();
+               if (node.nodeType == 1 && node.nodeName.toLowerCase() == "body") {
+                       if (Ext.isWebKit) {
+                               range.setStart(node, 0);
+                               range.setEnd(node, node.childNodes.length);
+                       } else {
+                               range.selectNodeContents(node);
+                       }
                } else {
                        range.selectNode(node);
                }
+               if (typeof(endPoint) != "undefined") {
+                       range.collapse(endPoint);
+               }
+               this.emptySelection(selection);
+               this.addRangeToSelection(selection, range);
        }
-       if (typeof(endPoint) != "undefined") {
-               range.collapse(endPoint);
-       }
-       this.emptySelection(selection);
-       this.addRangeToSelection(selection, range);
 };
 /*
  * Select ONLY the contents inside the given node