From 9d99c448291126f65d6c1344d80bcc8b9747cea5 Mon Sep 17 00:00:00 2001 From: Wojciech Wozniak Date: Tue, 19 Sep 2017 11:03:46 +0200 Subject: [PATCH 1/8] unit test and manual for anchor issue --- tests/plugins/link/link.js | 16 +++++++++++++++- tests/plugins/link/manual/getselectedlink.html | 13 +++++++++++++ tests/plugins/link/manual/getselectedlink.md | 15 +++++++++++++++ 3 files changed, 43 insertions(+), 1 deletion(-) create mode 100644 tests/plugins/link/manual/getselectedlink.html create mode 100644 tests/plugins/link/manual/getselectedlink.md diff --git a/tests/plugins/link/link.js b/tests/plugins/link/link.js index fea9648a366..906cc0f03b7 100644 --- a/tests/plugins/link/link.js +++ b/tests/plugins/link/link.js @@ -1,5 +1,5 @@ /* bender-tags: editor */ -/* bender-ckeditor-plugins: link,toolbar */ +/* bender-ckeditor-plugins: link,toolbar,image */ ( function() { 'use strict'; @@ -546,6 +546,20 @@ editor.ui.get( 'Unlink' ).click( editor ); assert.areSame( '

I am an instance of ^CKEditor.

', bot.htmlWithSelection() ); + }, + // 859 + 'test edit link with selction': function() { + var bot = this.editorBot; + + bot.setData( '

some button textsome text

', function() { + var editable = bot.editor.editable(); + + bot.editor.getSelection().selectElement( editable.findOne( 'a' ) ); + + bot.dialog( 'link', function( dialog ) { + assert.areSame( dialog.getValueOf( 'info', 'url' ), 'linkUrl' ); + } ); + } ); } } ); } )(); diff --git a/tests/plugins/link/manual/getselectedlink.html b/tests/plugins/link/manual/getselectedlink.html new file mode 100644 index 00000000000..28430f1fbd2 --- /dev/null +++ b/tests/plugins/link/manual/getselectedlink.html @@ -0,0 +1,13 @@ +
+

+ + + some button text + + some text +

+
+ + diff --git a/tests/plugins/link/manual/getselectedlink.md b/tests/plugins/link/manual/getselectedlink.md new file mode 100644 index 00000000000..4d676632b00 --- /dev/null +++ b/tests/plugins/link/manual/getselectedlink.md @@ -0,0 +1,15 @@ +@bender-tags: link, 4.8.0, 859, bug +@bender-ui: collapsed +@bender-ckeditor-plugins: link,toolbar,wysiwygarea,elementspath,contextmenu,image + +1. Right-click on the span ("some button text") and select "Edit Link". + +**Expected:** +* Link should have class `someClass`. +* Link should point to `https://www.google.pl`. + + +1. Double-click on the span ("some button text"). + +**Excepted:** +* link also should have class and href as above. From fb103e159fd334837e615268153faed28caf2fa8 Mon Sep 17 00:00:00 2001 From: Wojciech Wozniak Date: Tue, 19 Sep 2017 15:58:59 +0200 Subject: [PATCH 2/8] anchor shrink element in selected link --- plugins/link/plugin.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/link/plugin.js b/plugins/link/plugin.js index d5252ff7c8b..1e2b14ad1e9 100755 --- a/plugins/link/plugin.js +++ b/plugins/link/plugin.js @@ -335,7 +335,7 @@ range = selection.getRanges()[ i ]; // Skip bogus to cover cases of multiple selection inside tables (#tp2245). - range.shrink( CKEDITOR.SHRINK_TEXT, false, { skipBogus: true } ); + range.shrink( CKEDITOR.SHRINK_ELEMENT, true, { skipBogus: true } ); link = editor.elementPath( range.getCommonAncestor() ).contains( 'a', 1 ); if ( link && returnMultiple ) { From a46195188c1c51641b03576366f93bd73d83b5b1 Mon Sep 17 00:00:00 2001 From: Wojciech Wozniak Date: Tue, 19 Sep 2017 16:20:43 +0200 Subject: [PATCH 3/8] added comment to bugfix --- plugins/link/plugin.js | 1 + 1 file changed, 1 insertion(+) diff --git a/plugins/link/plugin.js b/plugins/link/plugin.js index 1e2b14ad1e9..5733115b374 100755 --- a/plugins/link/plugin.js +++ b/plugins/link/plugin.js @@ -335,6 +335,7 @@ range = selection.getRanges()[ i ]; // Skip bogus to cover cases of multiple selection inside tables (#tp2245). + // Shrink to element to prevent losing anchor (859). range.shrink( CKEDITOR.SHRINK_ELEMENT, true, { skipBogus: true } ); link = editor.elementPath( range.getCommonAncestor() ).contains( 'a', 1 ); From 6e59c24e15a60be71f4b84bb6ff9141e6adc007b Mon Sep 17 00:00:00 2001 From: Wojciech Wozniak Date: Tue, 10 Oct 2017 03:05:03 +0200 Subject: [PATCH 4/8] Typo fix and second manual test case. --- tests/plugins/link/link.js | 1 + .../plugins/link/manual/getselectedlink.html | 19 ++++++++++++++++++- tests/plugins/link/manual/getselectedlink.md | 4 ++-- 3 files changed, 21 insertions(+), 3 deletions(-) diff --git a/tests/plugins/link/link.js b/tests/plugins/link/link.js index 906cc0f03b7..f8e6d92c0a4 100644 --- a/tests/plugins/link/link.js +++ b/tests/plugins/link/link.js @@ -558,6 +558,7 @@ bot.dialog( 'link', function( dialog ) { assert.areSame( dialog.getValueOf( 'info', 'url' ), 'linkUrl' ); + dialog.hide(); } ); } ); } diff --git a/tests/plugins/link/manual/getselectedlink.html b/tests/plugins/link/manual/getselectedlink.html index 28430f1fbd2..f93f4f47aaf 100644 --- a/tests/plugins/link/manual/getselectedlink.html +++ b/tests/plugins/link/manual/getselectedlink.html @@ -5,9 +5,26 @@ some button text some text + + + + + + + + + + + +
  
+ + + some button text + +  

diff --git a/tests/plugins/link/manual/getselectedlink.md b/tests/plugins/link/manual/getselectedlink.md index 4d676632b00..6a5e7677554 100644 --- a/tests/plugins/link/manual/getselectedlink.md +++ b/tests/plugins/link/manual/getselectedlink.md @@ -1,11 +1,11 @@ @bender-tags: link, 4.8.0, 859, bug @bender-ui: collapsed -@bender-ckeditor-plugins: link,toolbar,wysiwygarea,elementspath,contextmenu,image +@bender-ckeditor-plugins: link,toolbar,wysiwygarea,elementspath,contextmenu,image,table 1. Right-click on the span ("some button text") and select "Edit Link". **Expected:** -* Link should have class `someClass`. +* Link should have class `linkClass`. * Link should point to `https://www.google.pl`. From 9db91ddeb773eca3f756b829ba5f20617064d9c7 Mon Sep 17 00:00:00 2001 From: Tomasz Jakut Date: Tue, 12 Dec 2017 15:42:57 +0100 Subject: [PATCH 5/8] Use local image instead of remote one. --- tests/plugins/link/manual/getselectedlink.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/plugins/link/manual/getselectedlink.html b/tests/plugins/link/manual/getselectedlink.html index f93f4f47aaf..38537af4ffd 100644 --- a/tests/plugins/link/manual/getselectedlink.html +++ b/tests/plugins/link/manual/getselectedlink.html @@ -1,7 +1,7 @@

- + some button text some text @@ -14,7 +14,7 @@ - + some button text From 266311549fa1aa5d2e35d29e1ea0fae645e780c8 Mon Sep 17 00:00:00 2001 From: Tomasz Jakut Date: Tue, 12 Dec 2017 15:47:26 +0100 Subject: [PATCH 6/8] Add misssing hash to the comment. --- plugins/link/plugin.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/link/plugin.js b/plugins/link/plugin.js index 5733115b374..33c1e278766 100755 --- a/plugins/link/plugin.js +++ b/plugins/link/plugin.js @@ -335,7 +335,7 @@ range = selection.getRanges()[ i ]; // Skip bogus to cover cases of multiple selection inside tables (#tp2245). - // Shrink to element to prevent losing anchor (859). + // Shrink to element to prevent losing anchor (#859). range.shrink( CKEDITOR.SHRINK_ELEMENT, true, { skipBogus: true } ); link = editor.elementPath( range.getCommonAncestor() ).contains( 'a', 1 ); From 9727540a2061a84cb9862ac96adb7cb73bde8453 Mon Sep 17 00:00:00 2001 From: Tomasz Jakut Date: Fri, 15 Dec 2017 11:48:26 +0100 Subject: [PATCH 7/8] Fix typo in unit test. --- tests/plugins/link/link.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/plugins/link/link.js b/tests/plugins/link/link.js index f8e6d92c0a4..15027c30e9e 100644 --- a/tests/plugins/link/link.js +++ b/tests/plugins/link/link.js @@ -547,8 +547,9 @@ assert.areSame( '

I am an instance of ^CKEditor.

', bot.htmlWithSelection() ); }, + // 859 - 'test edit link with selction': function() { + 'test edit link with selection': function() { var bot = this.editorBot; bot.setData( '

some button textsome text

', function() { From 960404ccf250ff8acedae46928f668266d51c5ea Mon Sep 17 00:00:00 2001 From: Tomasz Jakut Date: Fri, 15 Dec 2017 11:51:47 +0100 Subject: [PATCH 8/8] Update changelog [ci skip]. --- CHANGES.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGES.md b/CHANGES.md index 2698741c370..fe9f33ced95 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -7,6 +7,7 @@ Fixed Issues: * [#1048](https://github.com/ckeditor/ckeditor-dev/issues/1048): Fixed: [Balloon Panel](https://ckeditor.com/cke4/addon/balloonpanel) is not properly positioned when margin added to its non-static parent. * [#889](https://github.com/ckeditor/ckeditor-dev/issues/889): Fixed: Unclear error message for width and height fields in [Image](https://ckeditor.com/cke4/addon/image) and [Enhanced Image](https://ckeditor.com/cke4/addon/image2) plugins. +* [#859](https://github.com/ckeditor/ckeditor-dev/issues/859): Fixed: Can't edit link after double click on text in link. ## CKEditor 4.8