From 815edf1df7679730fbcea7dde55ee824ff8abf47 Mon Sep 17 00:00:00 2001 From: Tomasz Jakut Date: Sat, 24 Nov 2018 21:02:53 +0100 Subject: [PATCH 01/17] Add unit test. --- tests/plugins/button/button.js | 55 ++++++++++++++++++++++++++++++++-- 1 file changed, 53 insertions(+), 2 deletions(-) diff --git a/tests/plugins/button/button.js b/tests/plugins/button/button.js index 6e20d81b05f..92fb136a3c5 100644 --- a/tests/plugins/button/button.js +++ b/tests/plugins/button/button.js @@ -5,10 +5,16 @@ var customCls = 'my_btn'; bender.editor = { config: { - toolbar: [ [ 'custom_btn', 'expandable_btn' ] ], + toolbar: [ [ 'custom_btn', 'expandable_btn', 'clickable_btn' ] ], on: { pluginsLoaded: function( evt ) { - var ed = evt.editor; + var ed = evt.editor, + buttonCmd = new CKEDITOR.command( ed, { + exec: function() {} + } ); + + ed.addCommand( 'buttonCmd', buttonCmd ); + ed.ui.addButton( 'custom_btn', { label: 'button with custom class', className: customCls @@ -18,6 +24,11 @@ bender.editor = { label: 'expandable button', hasArrow: true } ); + + ed.ui.addButton( 'clickable_btn', { + label: 'clickable button', + command: 'buttonCmd' + } ); } } } @@ -41,5 +52,45 @@ bender.test( { btnEl = CKEDITOR.document.getById( btn._.id ); assert.isTrue( btnEl.hasClass( 'cke_button_expandable' ), 'check ui item expandable class name' ); + }, + + // (#2565) + 'test right-clicking button': function() { + if ( !CKEDITOR.env.ie ) { + assert.ignore(); + } + + var editor = this.editor, + btn = editor.ui.get( 'clickable_btn' ), + btnEl = CKEDITOR.document.getById( btn._.id ), + buttonCmd = editor.getCommand( 'buttonCmd' ), + spy = sinon.spy( buttonCmd, 'exec' ); + + dispatchMouseEvent( btnEl, 'mouseup', CKEDITOR.MOUSE_BUTTON_RIGHT ); + + assert.areSame( 0, spy.callCount ); } } ); + +function dispatchMouseEvent( element, type, button ) { + var ie8ButtonMap = { + 0: 1, + 1: 4, + 2: 2 + }, + mouseEvent; + element = element.$; + + // Thanks to http://help.dottoro.com/ljhlvomw.php + if ( document.createEventObject ) { + mouseEvent = document.createEventObject(); + + mouseEvent.button = ie8ButtonMap[ button ]; + element.fireEvent( 'on' + type, mouseEvent ); + } else { + mouseEvent = document.createEvent( 'MouseEvent' ); + + mouseEvent.initMouseEvent( type, true, true, window, 0, 0, 0, 80, 20, false, false, false, false, button, null ); + element.dispatchEvent( mouseEvent ); + } +} From d1194718bd8e2324696da5c5c99e88a957d3384f Mon Sep 17 00:00:00 2001 From: Tomasz Jakut Date: Sat, 24 Nov 2018 21:03:24 +0100 Subject: [PATCH 02/17] Add manual test. --- tests/plugins/button/manual/rightclick.html | 11 ++++++++ tests/plugins/button/manual/rightclick.md | 30 +++++++++++++++++++++ 2 files changed, 41 insertions(+) create mode 100644 tests/plugins/button/manual/rightclick.html create mode 100644 tests/plugins/button/manual/rightclick.md diff --git a/tests/plugins/button/manual/rightclick.html b/tests/plugins/button/manual/rightclick.html new file mode 100644 index 00000000000..6770072c3a7 --- /dev/null +++ b/tests/plugins/button/manual/rightclick.html @@ -0,0 +1,11 @@ +
+

Bold me!

+
+ + diff --git a/tests/plugins/button/manual/rightclick.md b/tests/plugins/button/manual/rightclick.md new file mode 100644 index 00000000000..915e90c6e53 --- /dev/null +++ b/tests/plugins/button/manual/rightclick.md @@ -0,0 +1,30 @@ +@bender-tags: 4.11.2, 2565, bug, button +@bender-ui: collapsed +@bender-ckeditor-plugins: wysiwygarea, toolbar, basicstyles, language + +## Procedure #1 + +1. Select "Bold me!" text. +2. Right click on "Bold" button. + +### Expected + +* Text remains unbolded. + +### Unexpected + +* Text is bolded. + +--- + +## Procedure #2 + +1. Right click "Language" button. + +### Expected + +* Language menu does not appear. + +### Unexpected + +* Language menu appears. From bf68e5aa05e1e885076b1f2177c78023970e2576 Mon Sep 17 00:00:00 2001 From: Tomasz Jakut Date: Sat, 24 Nov 2018 21:06:20 +0100 Subject: [PATCH 03/17] Add ability to get mouse button info from native DOM event. --- core/tools.js | 13 +++++++------ tests/core/tools.js | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 39 insertions(+), 6 deletions(-) diff --git a/core/tools.js b/core/tools.js index bb5b090f525..ee4fd9539cf 100644 --- a/core/tools.js +++ b/core/tools.js @@ -1464,17 +1464,18 @@ * Detects which mouse button generated a given DOM event. * * @since 4.7.3 - * @param {CKEDITOR.dom.event} evt DOM event. + * @param {CKEDITOR.dom.event/MouseEvent} evt DOM event. Since 4.11.2 native DOM event can be passed. * @returns {Number|Boolean} Returns a number indicating the mouse button or `false` * if the mouse button cannot be determined. */ getMouseButton: function( evt ) { - var evtData = evt.data, - domEvent = evtData && evtData.$; + var domEvent = evt.data && evt.data.$; - if ( !( evtData && domEvent ) ) { - // Added in case when there's no data available. That's the case in some unit test in built version which - // mock event but doesn't put data object. + if ( evt instanceof Event ) { + domEvent = evt; + } + + if ( !domEvent ) { return false; } diff --git a/tests/core/tools.js b/tests/core/tools.js index f628dda2eaa..20200ab343b 100644 --- a/tests/core/tools.js +++ b/tests/core/tools.js @@ -881,6 +881,38 @@ ] ); }, + // (#2565) + 'test getMouseButton with native DOM event': function() { + var isIe8 = CKEDITOR.env.ie && CKEDITOR.env.version < 9; + + function generateMouseButtonAsserts( inputs ) { + function generateEvent( button ) { + var event; + + if ( document.createEventObject ) { + event = document.createEventObject(); + event.button = button; + } else { + event = document.createEvent( 'MouseEvent' ); + event.initMouseEvent( 'click', true, true, window, 0, 0, 0, 80, 20, + false, false, false, false, button, null ); + } + + return event; + } + + CKEDITOR.tools.array.forEach( inputs, function( input ) { + assert.areSame( input[ 0 ], CKEDITOR.tools.getMouseButton( generateEvent( input[ 1 ] ) ) ); + } ); + } + + generateMouseButtonAsserts( [ + [ CKEDITOR.MOUSE_BUTTON_LEFT, isIe8 ? 1 : CKEDITOR.MOUSE_BUTTON_LEFT ], + [ CKEDITOR.MOUSE_BUTTON_MIDDLE, isIe8 ? 4 : CKEDITOR.MOUSE_BUTTON_MIDDLE ], + [ CKEDITOR.MOUSE_BUTTON_RIGHT, isIe8 ? 2 : CKEDITOR.MOUSE_BUTTON_RIGHT ] + ] ); + }, + // #662 'test hexstring to bytes converter': function() { var testCases = [ From 1e231712174411fb7188c21130bdf9d347eb0248 Mon Sep 17 00:00:00 2001 From: Tomasz Jakut Date: Sat, 24 Nov 2018 21:08:13 +0100 Subject: [PATCH 04/17] Add additional check if clicked mouse button is left to onmouseup handler. --- plugins/button/plugin.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/plugins/button/plugin.js b/plugins/button/plugin.js index 5d8604e0ca6..dc214cc6148 100644 --- a/plugins/button/plugin.js +++ b/plugins/button/plugin.js @@ -29,8 +29,9 @@ template += ' onkeydown="return CKEDITOR.tools.callFunction({keydownFn},event);"' + ' onfocus="return CKEDITOR.tools.callFunction({focusFn},event);" ' + - ( CKEDITOR.env.ie ? 'onclick="return false;" onmouseup' : 'onclick' ) + // https://dev.ckeditor.com/ticket/188 - '="CKEDITOR.tools.callFunction({clickFn},this);return false;">' + + // (#2565). + ( CKEDITOR.env.ie ? 'onclick="return false;" onmouseup="CKEDITOR.tools.getMouseButton(event)==CKEDITOR.MOUSE_BUTTON_LEFT&&' : 'onclick="' ) + // https://dev.ckeditor.com/ticket/188 + 'CKEDITOR.tools.callFunction({clickFn},this);return false;">' + ' Date: Sat, 24 Nov 2018 21:11:12 +0100 Subject: [PATCH 05/17] Add changelog entry. --- CHANGES.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGES.md b/CHANGES.md index 06e1a3b61dd..18fb6e15aa9 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -12,6 +12,7 @@ Fixed Issues: * [#2292](https://github.com/ckeditor/ckeditor-dev/issues/2292): Fixed: Dropping list with link on editor's margin cause console error and removing dragged text from editor. * [#2756](https://github.com/ckeditor/ckeditor-dev/issues/2756): Fixed: The [Auto Link](https://ckeditor.com/cke4/addon/autolink) plugin causes an error when typing in [Source Editing Mode](https://ckeditor.com/docs/ckeditor4/latest/guide/dev_sourcearea.html). * [#1986](https://github.com/ckeditor/ckeditor-dev/issues/1986): Fixed: Cell Properties dialog from [Table Tools](https://ckeditor.com/cke4/addon/tabletools) plugin shows styles that are not allowed through [`config.allowedContent`](https://ckeditor.com/docs/ckeditor4/latest/api/CKEDITOR_config.html#cfg-allowedContent). +* [#2565](https://github.com/ckeditor/ckeditor-dev/issues/2565): Fixed: Buttons in the [Editor Toolbar](https://ckeditor.com/cke4/addon/toolbar) are activated by clicking them with right mouse button. ## CKEditor 4.11.2 From ee9acb95dc62570ec463f6162802dd492529f1db Mon Sep 17 00:00:00 2001 From: Tomasz Jakut Date: Mon, 11 Feb 2019 17:52:10 +0100 Subject: [PATCH 06/17] Fix order of code. --- tests/core/tools.js | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/tests/core/tools.js b/tests/core/tools.js index 20200ab343b..464f597ae19 100644 --- a/tests/core/tools.js +++ b/tests/core/tools.js @@ -885,32 +885,32 @@ 'test getMouseButton with native DOM event': function() { var isIe8 = CKEDITOR.env.ie && CKEDITOR.env.version < 9; - function generateMouseButtonAsserts( inputs ) { - function generateEvent( button ) { - var event; - - if ( document.createEventObject ) { - event = document.createEventObject(); - event.button = button; - } else { - event = document.createEvent( 'MouseEvent' ); - event.initMouseEvent( 'click', true, true, window, 0, 0, 0, 80, 20, - false, false, false, false, button, null ); - } - - return event; - } + generateMouseButtonAsserts( [ + [ CKEDITOR.MOUSE_BUTTON_LEFT, isIe8 ? 1 : CKEDITOR.MOUSE_BUTTON_LEFT ], + [ CKEDITOR.MOUSE_BUTTON_MIDDLE, isIe8 ? 4 : CKEDITOR.MOUSE_BUTTON_MIDDLE ], + [ CKEDITOR.MOUSE_BUTTON_RIGHT, isIe8 ? 2 : CKEDITOR.MOUSE_BUTTON_RIGHT ] + ] ); + function generateMouseButtonAsserts( inputs ) { CKEDITOR.tools.array.forEach( inputs, function( input ) { assert.areSame( input[ 0 ], CKEDITOR.tools.getMouseButton( generateEvent( input[ 1 ] ) ) ); } ); } - generateMouseButtonAsserts( [ - [ CKEDITOR.MOUSE_BUTTON_LEFT, isIe8 ? 1 : CKEDITOR.MOUSE_BUTTON_LEFT ], - [ CKEDITOR.MOUSE_BUTTON_MIDDLE, isIe8 ? 4 : CKEDITOR.MOUSE_BUTTON_MIDDLE ], - [ CKEDITOR.MOUSE_BUTTON_RIGHT, isIe8 ? 2 : CKEDITOR.MOUSE_BUTTON_RIGHT ] - ] ); + function generateEvent( button ) { + var event; + + if ( document.createEventObject ) { + event = document.createEventObject(); + event.button = button; + } else { + event = document.createEvent( 'MouseEvent' ); + event.initMouseEvent( 'click', true, true, window, 0, 0, 0, 80, 20, + false, false, false, false, button, null ); + } + + return event; + } }, // #662 From a0b093452b0768748961da6e5e3010114ab7ecbb Mon Sep 17 00:00:00 2001 From: Tomasz Jakut Date: Mon, 11 Feb 2019 17:53:16 +0100 Subject: [PATCH 07/17] Update version tag in manual test. --- tests/plugins/button/manual/rightclick.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/plugins/button/manual/rightclick.md b/tests/plugins/button/manual/rightclick.md index 915e90c6e53..14db6680e95 100644 --- a/tests/plugins/button/manual/rightclick.md +++ b/tests/plugins/button/manual/rightclick.md @@ -1,4 +1,4 @@ -@bender-tags: 4.11.2, 2565, bug, button +@bender-tags: 4.11.3, 2565, bug, button @bender-ui: collapsed @bender-ckeditor-plugins: wysiwygarea, toolbar, basicstyles, language From 6d6e9081049f15b8240428d50707f0b6dfc786b0 Mon Sep 17 00:00:00 2001 From: Tomasz Jakut Date: Mon, 11 Feb 2019 18:06:40 +0100 Subject: [PATCH 08/17] Simplify mouse asserts. --- tests/core/tools.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/tests/core/tools.js b/tests/core/tools.js index 464f597ae19..bf109b29bd9 100644 --- a/tests/core/tools.js +++ b/tests/core/tools.js @@ -886,14 +886,15 @@ var isIe8 = CKEDITOR.env.ie && CKEDITOR.env.version < 9; generateMouseButtonAsserts( [ - [ CKEDITOR.MOUSE_BUTTON_LEFT, isIe8 ? 1 : CKEDITOR.MOUSE_BUTTON_LEFT ], - [ CKEDITOR.MOUSE_BUTTON_MIDDLE, isIe8 ? 4 : CKEDITOR.MOUSE_BUTTON_MIDDLE ], - [ CKEDITOR.MOUSE_BUTTON_RIGHT, isIe8 ? 2 : CKEDITOR.MOUSE_BUTTON_RIGHT ] + [ CKEDITOR.MOUSE_BUTTON_LEFT, 1 ], + [ CKEDITOR.MOUSE_BUTTON_MIDDLE, 4 ], + [ CKEDITOR.MOUSE_BUTTON_RIGHT, 2 ] ] ); function generateMouseButtonAsserts( inputs ) { CKEDITOR.tools.array.forEach( inputs, function( input ) { - assert.areSame( input[ 0 ], CKEDITOR.tools.getMouseButton( generateEvent( input[ 1 ] ) ) ); + assert.areSame( input[ 0 ], + CKEDITOR.tools.getMouseButton( generateEvent( input[ isIe8 ? 1 : 0 ] ) ) ); } ); } From b37a2c9e284cfcae5da159aa7a88d94dfcd37a95 Mon Sep 17 00:00:00 2001 From: Tomasz Jakut Date: Mon, 11 Feb 2019 18:07:54 +0100 Subject: [PATCH 09/17] Simplify another mouse button test. --- tests/core/tools.js | 33 +++++++++++++++++---------------- 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/tests/core/tools.js b/tests/core/tools.js index bf109b29bd9..0550266d37e 100644 --- a/tests/core/tools.js +++ b/tests/core/tools.js @@ -858,27 +858,28 @@ 'test getMouseButton': function() { var isIe8 = CKEDITOR.env.ie && CKEDITOR.env.version < 9; - function generateMouseButtonAsserts( inputs ) { - function generateEvent( button ) { - return { - data: { - $: { - button: button - } - } - }; - } + generateMouseButtonAsserts( [ + [ CKEDITOR.MOUSE_BUTTON_LEFT, 1 ], + [ CKEDITOR.MOUSE_BUTTON_MIDDLE, 4 ], + [ CKEDITOR.MOUSE_BUTTON_RIGHT, 2 ] + ] ); + function generateMouseButtonAsserts( inputs ) { CKEDITOR.tools.array.forEach( inputs, function( input ) { - assert.areSame( input[ 0 ], CKEDITOR.tools.getMouseButton( generateEvent( input[ 1 ] ) ) ); + assert.areSame( input[ 0 ], + CKEDITOR.tools.getMouseButton( generateEvent( input[ isIe8 ? 1 : 0 ] ) ) ); } ); } - generateMouseButtonAsserts( [ - [ CKEDITOR.MOUSE_BUTTON_LEFT, isIe8 ? 1 : CKEDITOR.MOUSE_BUTTON_LEFT ], - [ CKEDITOR.MOUSE_BUTTON_MIDDLE, isIe8 ? 4 : CKEDITOR.MOUSE_BUTTON_MIDDLE ], - [ CKEDITOR.MOUSE_BUTTON_RIGHT, isIe8 ? 2 : CKEDITOR.MOUSE_BUTTON_RIGHT ] - ] ); + function generateEvent( button ) { + return { + data: { + $: { + button: button + } + } + }; + } }, // (#2565) From 877f50cd848209159ff6931b30cd72a5155b3b00 Mon Sep 17 00:00:00 2001 From: Tomasz Jakut Date: Mon, 11 Feb 2019 18:08:12 +0100 Subject: [PATCH 10/17] Add comments for better readability. --- tests/plugins/button/button.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/plugins/button/button.js b/tests/plugins/button/button.js index 92fb136a3c5..a0d9de4595a 100644 --- a/tests/plugins/button/button.js +++ b/tests/plugins/button/button.js @@ -74,9 +74,9 @@ bender.test( { function dispatchMouseEvent( element, type, button ) { var ie8ButtonMap = { - 0: 1, - 1: 4, - 2: 2 + 0: 1, // CKEDITOR.MOUSE_BUTTON_LEFT + 1: 4, // CKEDITOR.MOUSE_BUTTON_MIDDLE + 2: 2 // // CKEDITOR.MOUSE_BUTTON_RIGHT }, mouseEvent; element = element.$; From b960d9bf79b2a83fb72801600885fe6608a6e6a6 Mon Sep 17 00:00:00 2001 From: Kajetan Litwinowicz Date: Thu, 14 Feb 2019 10:15:51 +0100 Subject: [PATCH 11/17] Updated version reference. --- core/tools.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/tools.js b/core/tools.js index ee4fd9539cf..25f85638543 100644 --- a/core/tools.js +++ b/core/tools.js @@ -1464,7 +1464,7 @@ * Detects which mouse button generated a given DOM event. * * @since 4.7.3 - * @param {CKEDITOR.dom.event/MouseEvent} evt DOM event. Since 4.11.2 native DOM event can be passed. + * @param {CKEDITOR.dom.event/MouseEvent} evt DOM event. Since 4.11.3 native DOM event can be passed. * @returns {Number|Boolean} Returns a number indicating the mouse button or `false` * if the mouse button cannot be determined. */ From b6f04f554ede78d16648bbf6ad6fb7e571b8b4ad Mon Sep 17 00:00:00 2001 From: Kajetan Litwinowicz Date: Thu, 14 Feb 2019 10:19:02 +0100 Subject: [PATCH 12/17] Tests: removed duplicated comment slash. --- tests/plugins/button/button.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/plugins/button/button.js b/tests/plugins/button/button.js index a0d9de4595a..1786edaf0c5 100644 --- a/tests/plugins/button/button.js +++ b/tests/plugins/button/button.js @@ -76,7 +76,7 @@ function dispatchMouseEvent( element, type, button ) { var ie8ButtonMap = { 0: 1, // CKEDITOR.MOUSE_BUTTON_LEFT 1: 4, // CKEDITOR.MOUSE_BUTTON_MIDDLE - 2: 2 // // CKEDITOR.MOUSE_BUTTON_RIGHT + 2: 2 // CKEDITOR.MOUSE_BUTTON_RIGHT }, mouseEvent; element = element.$; From 945bc65563169ee33dc3dd16032fbbcc6bc0b1ee Mon Sep 17 00:00:00 2001 From: Tomasz Jakut Date: Mon, 18 Feb 2019 13:30:28 +0100 Subject: [PATCH 13/17] Simplify heuristics for detecting native mouse event. --- core/tools.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/tools.js b/core/tools.js index 25f85638543..d3f4db15c43 100644 --- a/core/tools.js +++ b/core/tools.js @@ -1471,7 +1471,7 @@ getMouseButton: function( evt ) { var domEvent = evt.data && evt.data.$; - if ( evt instanceof Event ) { + if ( !( evt instanceof CKEDITOR.dom.event ) ) { domEvent = evt; } From 75dbefb8102061b03582d8d1c93bfba3cc8e6e1b Mon Sep 17 00:00:00 2001 From: Tomasz Jakut Date: Mon, 18 Feb 2019 13:31:33 +0100 Subject: [PATCH 14/17] Update changelog entry. --- CHANGES.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGES.md b/CHANGES.md index 18fb6e15aa9..9e5404ba376 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -13,6 +13,7 @@ Fixed Issues: * [#2756](https://github.com/ckeditor/ckeditor-dev/issues/2756): Fixed: The [Auto Link](https://ckeditor.com/cke4/addon/autolink) plugin causes an error when typing in [Source Editing Mode](https://ckeditor.com/docs/ckeditor4/latest/guide/dev_sourcearea.html). * [#1986](https://github.com/ckeditor/ckeditor-dev/issues/1986): Fixed: Cell Properties dialog from [Table Tools](https://ckeditor.com/cke4/addon/tabletools) plugin shows styles that are not allowed through [`config.allowedContent`](https://ckeditor.com/docs/ckeditor4/latest/api/CKEDITOR_config.html#cfg-allowedContent). * [#2565](https://github.com/ckeditor/ckeditor-dev/issues/2565): Fixed: Buttons in the [Editor Toolbar](https://ckeditor.com/cke4/addon/toolbar) are activated by clicking them with right mouse button. +* [#2565](https://github.com/ckeditor/ckeditor-dev/issues/2565): [IE, Edge] Fixed: Buttons in the [Editor Toolbar](https://ckeditor.com/cke4/addon/toolbar) are activated by clicking them with right mouse button. ## CKEditor 4.11.2 From cd32083ede10466585bbcbe96f5f908977483f81 Mon Sep 17 00:00:00 2001 From: Tomasz Jakut Date: Mon, 18 Feb 2019 14:10:45 +0100 Subject: [PATCH 15/17] Further simplify heuristics for detecting native mouse event. --- core/tools.js | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/core/tools.js b/core/tools.js index d3f4db15c43..73238fc81e2 100644 --- a/core/tools.js +++ b/core/tools.js @@ -1469,11 +1469,7 @@ * if the mouse button cannot be determined. */ getMouseButton: function( evt ) { - var domEvent = evt.data && evt.data.$; - - if ( !( evt instanceof CKEDITOR.dom.event ) ) { - domEvent = evt; - } + var domEvent = evt.data ? evt.data.$ : evt; if ( !domEvent ) { return false; From 7f45d97e97f5d4dd2c80f865c5336127df87050f Mon Sep 17 00:00:00 2001 From: Tomasz Jakut Date: Mon, 18 Feb 2019 14:11:01 +0100 Subject: [PATCH 16/17] Refactor button template. --- plugins/button/plugin.js | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/plugins/button/plugin.js b/plugins/button/plugin.js index dc214cc6148..8ec5d0b3072 100644 --- a/plugins/button/plugin.js +++ b/plugins/button/plugin.js @@ -27,11 +27,16 @@ if ( CKEDITOR.env.gecko ) template += ' onblur="this.style.cssText = this.style.cssText;"'; + // IE and Edge needs special click handler based on mouseup event with additional check + // of which mouse button was clicked (https://dev.ckeditor.com/ticket/188, #2565). + var specialClickHandler = ''; + if ( CKEDITOR.env.ie ) { + specialClickHandler = 'return false;" onmouseup="CKEDITOR.tools.getMouseButton(event)==CKEDITOR.MOUSE_BUTTON_LEFT&&'; + } + template += ' onkeydown="return CKEDITOR.tools.callFunction({keydownFn},event);"' + ' onfocus="return CKEDITOR.tools.callFunction({focusFn},event);" ' + - // (#2565). - ( CKEDITOR.env.ie ? 'onclick="return false;" onmouseup="CKEDITOR.tools.getMouseButton(event)==CKEDITOR.MOUSE_BUTTON_LEFT&&' : 'onclick="' ) + // https://dev.ckeditor.com/ticket/188 - 'CKEDITOR.tools.callFunction({clickFn},this);return false;">' + + 'onclick="' + specialClickHandler + 'CKEDITOR.tools.callFunction({clickFn},this);return false;">' + ' Date: Tue, 19 Feb 2019 13:04:12 +0100 Subject: [PATCH 17/17] Fixed duplicated changelog entry. [skip ci] --- CHANGES.md | 1 - 1 file changed, 1 deletion(-) diff --git a/CHANGES.md b/CHANGES.md index 9e5404ba376..fcec6485e69 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -12,7 +12,6 @@ Fixed Issues: * [#2292](https://github.com/ckeditor/ckeditor-dev/issues/2292): Fixed: Dropping list with link on editor's margin cause console error and removing dragged text from editor. * [#2756](https://github.com/ckeditor/ckeditor-dev/issues/2756): Fixed: The [Auto Link](https://ckeditor.com/cke4/addon/autolink) plugin causes an error when typing in [Source Editing Mode](https://ckeditor.com/docs/ckeditor4/latest/guide/dev_sourcearea.html). * [#1986](https://github.com/ckeditor/ckeditor-dev/issues/1986): Fixed: Cell Properties dialog from [Table Tools](https://ckeditor.com/cke4/addon/tabletools) plugin shows styles that are not allowed through [`config.allowedContent`](https://ckeditor.com/docs/ckeditor4/latest/api/CKEDITOR_config.html#cfg-allowedContent). -* [#2565](https://github.com/ckeditor/ckeditor-dev/issues/2565): Fixed: Buttons in the [Editor Toolbar](https://ckeditor.com/cke4/addon/toolbar) are activated by clicking them with right mouse button. * [#2565](https://github.com/ckeditor/ckeditor-dev/issues/2565): [IE, Edge] Fixed: Buttons in the [Editor Toolbar](https://ckeditor.com/cke4/addon/toolbar) are activated by clicking them with right mouse button. ## CKEditor 4.11.2