[BUGFIX] RTE: IE 11 always drops images at the end of text 42/36642/2
authorStanislas Rolland <typo3@sjbr.ca>
Wed, 4 Feb 2015 00:21:46 +0000 (19:21 -0500)
committerStanislas Rolland <typo3@sjbr.ca>
Wed, 4 Feb 2015 00:24:27 +0000 (01:24 +0100)
IE needs a delay before the dialogue window gets closed.

Releases: master
Resolves: #64839
Change-Id: I02d49cb124370c23ba14f8617dd4019586e184ea
Reviewed-on: http://review.typo3.org/36642
Reviewed-by: Stanislas Rolland <typo3@sjbr.ca>
Tested-by: Stanislas Rolland <typo3@sjbr.ca>
typo3/sysext/rtehtmlarea/Classes/SelectImage.php
typo3/sysext/rtehtmlarea/Resources/Public/JavaScript/Plugins/TYPO3Image.js

index 8e69370..e7ea49c 100644 (file)
@@ -310,7 +310,7 @@ class SelectImage extends \TYPO3\CMS\Recordlist\Browser\ElementBrowser {
                        function initEventListeners() {
                                require(["TYPO3/CMS/Rtehtmlarea/HTMLArea/UserAgent/UserAgent", "TYPO3/CMS/Rtehtmlarea/HTMLArea/Event/Event"], function (UserAgent, Event) {
                                        if (UserAgent.isWebKit) {
-                                               Event.one(window.document.body, "dragend", function (event) { plugin.onDrop(event); });
+                                               Event.one(window.document.body, "dragend.TYPO3Image", function (event) { plugin.onDrop(event); });
                                        }
                                });
                        }
index 6b007dd..1111f84 100644 (file)
@@ -118,7 +118,11 @@ define('TYPO3/CMS/Rtehtmlarea/Plugins/TYPO3Image',
                        if (UserAgent.isWebKit) {
                                this.editor.iframe.onDrop(event);
                        }
-                       this.close();
+                       // IE 11 needs the event to complete before the dialog gets closed, otherwise the image is always inserted at the end of body
+                       var self = this;
+                       window.setTimeout(function () {
+                               self.close();
+                       }, 50);
                        return true;
                },