From 866716516d22e910487150893494c5889c688c2e Mon Sep 17 00:00:00 2001 From: antoniopol06 Date: Tue, 4 Apr 2017 15:49:14 +0200 Subject: [PATCH 1/3] Add test to check this plugin works when config is passed (not by default) Fixes #716 --- src/ui/react/test/alloy-editor.js | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/src/ui/react/test/alloy-editor.js b/src/ui/react/test/alloy-editor.js index 8bf3d54211..c984d62baf 100644 --- a/src/ui/react/test/alloy-editor.js +++ b/src/ui/react/test/alloy-editor.js @@ -12,6 +12,13 @@ document.body.removeChild(this.el); }; + var doTestIE = function() { + if (!CKEDITOR.env.ie) { + this.skip(); + } + return; + }; + var initEditor = function(done, config) { this.el = document.createElement('div'); this.el.setAttribute('id', 'editable'); @@ -315,5 +322,25 @@ assert.sameMembers(['foo2', 'bar2'], buttons); }); }); + + describe('Plugin ae_addimages_ie', function (done) { + this.timeout(35000); + + beforeEach(function(done) { + initEditor.call(this, done, { + extraPlugins: 'ae_dragresize' + }); + }); + + afterEach(function() { + cleanUpEditor.call(this); + }); + + it('should use it instead of ae_dragresize when browsers are IE', function() { + doTestIE.call(this); + + assert.isTrue(this.alloyEditor.get('nativeEditor').config.extraPlugins.indexOf('ae_dragresize_ie') >= 0); + }); + }); }); }()); \ No newline at end of file From e6c4abfa40e5d19ad0a8e890850bac131816b43f Mon Sep 17 00:00:00 2001 From: antoniopol06 Date: Tue, 4 Apr 2017 15:50:04 +0200 Subject: [PATCH 2/3] Merges configuration before replacing the dragresize plugins to make sure our choice prevails Fixes #716 --- src/ui/react/src/adapter/alloy-editor.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ui/react/src/adapter/alloy-editor.js b/src/ui/react/src/adapter/alloy-editor.js index fc30260414..da0188b695 100644 --- a/src/ui/react/src/adapter/alloy-editor.js +++ b/src/ui/react/src/adapter/alloy-editor.js @@ -43,13 +43,13 @@ editor.config.selectionKeystrokes = this.get('selectionKeystrokes'); + AlloyEditor.Lang.mix(editor.config, config); + if (CKEDITOR.env.ie) { editor.config.extraPlugins = editor.config.extraPlugins.replace('ae_dragresize', 'ae_dragresize_ie'); editor.config.removePlugins = editor.config.removePlugins.replace('ae_dragresize', 'ae_dragresize_ie'); } - AlloyEditor.Lang.mix(editor.config, config); - editor.once('contentDom', function() { this._addReadOnlyLinkClickListener(editor); From f72f6e126247ef127dabd9969e924fa50e21c48f Mon Sep 17 00:00:00 2001 From: Chema Balsas Date: Tue, 11 Apr 2017 11:41:33 +0200 Subject: [PATCH 3/3] Updates test message and adds default case Fixes #716 --- src/ui/react/test/alloy-editor.js | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/src/ui/react/test/alloy-editor.js b/src/ui/react/test/alloy-editor.js index c984d62baf..7c64435dd1 100644 --- a/src/ui/react/test/alloy-editor.js +++ b/src/ui/react/test/alloy-editor.js @@ -323,23 +323,33 @@ }); }); - describe('Plugin ae_addimages_ie', function (done) { + describe('in IE browsers', function () { this.timeout(35000); - beforeEach(function(done) { - initEditor.call(this, done, { - extraPlugins: 'ae_dragresize' - }); + beforeEach(function() { + doTestIE.call(this); }); afterEach(function() { cleanUpEditor.call(this); }); - it('should use it instead of ae_dragresize when browsers are IE', function() { + it('should use the ae_dragresize_ie plugin instead of ae_dragresize by default', function(done) { doTestIE.call(this); - assert.isTrue(this.alloyEditor.get('nativeEditor').config.extraPlugins.indexOf('ae_dragresize_ie') >= 0); + initEditor.call(this, function() { + assert.isTrue(this.alloyEditor.get('nativeEditor').config.extraPlugins.indexOf('ae_dragresize_ie') >= 0); + done(); + }.bind(this)); + }); + + it('should use the ae_dragresize_ie plugin even if the ae_dragresize is passed in the editor configuration', function(done) { + initEditor.call(this, function() { + assert.isTrue(this.alloyEditor.get('nativeEditor').config.extraPlugins.indexOf('ae_dragresize_ie') >= 0); + done(); + }.bind(this), { + extraPlugins: 'ae_dragresize' + }); }); }); });