[BUGFIX] RTE doesn't allow to create links around images in IE8
authorStanislas Rolland <typo3@sjbr.ca>
Thu, 10 Nov 2011 15:17:42 +0000 (10:17 -0500)
committerStanislas Rolland <typo3@sjbr.ca>
Mon, 5 Dec 2011 22:45:50 +0000 (23:45 +0100)
Solution: Workaround IE bookmarking not being possible on control range

Change-Id: I72767041702ca03498ed6cdca04cf7e68512b0b7
Resolves: #30631
Releases: 4.5, 4.6, 4.7
Reviewed-on: http://review.typo3.org/7002
Reviewed-by: Wouter Wolters
Tested-by: Wouter Wolters
Reviewed-by: Stanislas Rolland
Tested-by: Stanislas Rolland
typo3/sysext/rtehtmlarea/htmlarea/htmlarea-ie.js

index 4313bf2..652d986 100644 (file)
@@ -188,7 +188,12 @@ HTMLArea.Editor.prototype._selectionEmpty = function(selection) {
  * Get a bookmark
  */
 HTMLArea.Editor.prototype.getBookmark = function (range) {
-       return range.getBookmark();
+               // Bookmarking will not work on control ranges
+       try {
+               return range.getBookmark();
+       } catch (e) {
+               return null;
+       }
 };
 
 /*
@@ -196,7 +201,9 @@ HTMLArea.Editor.prototype.getBookmark = function (range) {
  */
 HTMLArea.Editor.prototype.moveToBookmark = function (bookmark) {
        var range = this._createRange();
-       range.moveToBookmark(bookmark);
+       if (bookmark) {
+               range.moveToBookmark(bookmark);
+       }
        return range;
 };