From 77d8d6507cca5148c3a73ac3b889673c88b5b658 Mon Sep 17 00:00:00 2001 From: Artur Delura Date: Wed, 4 Jun 2014 16:37:11 +0200 Subject: [PATCH 1/3] Anchor href attribute is not encoded in image plugin. --- plugins/image/dialogs/image.js | 2 +- tests/plugins/image/image.js | 21 ++++++++++++++++++++- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/plugins/image/dialogs/image.js b/plugins/image/dialogs/image.js index 63e6a123624..a200010b027 100644 --- a/plugins/image/dialogs/image.js +++ b/plugins/image/dialogs/image.js @@ -963,7 +963,7 @@ commit: function( type, element ) { if ( type == LINK ) { if ( this.getValue() || this.isChanged() ) { - var url = decodeURI( this.getValue() ); + var url = this.getValue(); element.data( 'cke-saved-href', url ); element.setAttribute( 'href', url ); diff --git a/tests/plugins/image/image.js b/tests/plugins/image/image.js index 3231fe7e67f..3dd763a92a9 100644 --- a/tests/plugins/image/image.js +++ b/tests/plugins/image/image.js @@ -1,5 +1,5 @@ /* bender-tags: editor,unit */ -/* bender-ckeditor-plugins: image,button,toolbar */ +/* bender-ckeditor-plugins: image,button,toolbar,link */ bender.editor = { config : { autoParagraph : false } }; @@ -314,6 +314,25 @@ bender.test( '

' ); } ); + }, + + 'test set iso uri in image dialog': function() { + var bot = this.editorBot, + isoUri = 'http://ckeditor.dev/?q=%C5rsrapport'; + + bot.setHtmlWithSelection( '[

]' ); + bot.dialog( 'image', function( dialog ) { + var linkInput = dialog.getContentElement( 'Link', 'txtUrl' ); + + linkInput.setValue( isoUri ); + + dialog.getButton( 'ok' ).click(); + assert.isTrue(true); + + var anchor = bot.editor.document.findOne( 'a' ); + assert.isNotNull( anchor, 'Anchor should be present.' ); + assert.areSame( anchor.getAttribute( 'href' ), isoUri, 'Href attributes should be set.' ) + } ); } } ); From fba6329ba71c2fc99eb9d7c3d5e8d21767d8662b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Piotrek=20Reinmar=20Koszuli=C5=84ski?= Date: Tue, 10 Jun 2014 16:22:12 +0200 Subject: [PATCH 2/3] Simplified test. --- tests/plugins/image/image.js | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/tests/plugins/image/image.js b/tests/plugins/image/image.js index 3dd763a92a9..0186a51d48a 100644 --- a/tests/plugins/image/image.js +++ b/tests/plugins/image/image.js @@ -316,22 +316,20 @@ bender.test( } ); }, - 'test set iso uri in image dialog': function() { + // #10867 + 'test set encoded URI as image\'s link': function() { var bot = this.editorBot, - isoUri = 'http://ckeditor.dev/?q=%C5rsrapport'; + uri = 'http://ckeditor.dev/?q=%C5rsrapport'; - bot.setHtmlWithSelection( '[

]' ); + bot.setHtmlWithSelection( '

[]

' ); bot.dialog( 'image', function( dialog ) { var linkInput = dialog.getContentElement( 'Link', 'txtUrl' ); - linkInput.setValue( isoUri ); + linkInput.setValue( uri ); dialog.getButton( 'ok' ).click(); - assert.isTrue(true); - var anchor = bot.editor.document.findOne( 'a' ); - assert.isNotNull( anchor, 'Anchor should be present.' ); - assert.areSame( anchor.getAttribute( 'href' ), isoUri, 'Href attributes should be set.' ) + assert.areSame( '

', bot.editor.getData() ); } ); } } ); From ca7fd3872826af5a33e06136b64f14126fce13f6 Mon Sep 17 00:00:00 2001 From: Artur Delura Date: Wed, 11 Jun 2014 09:58:00 +0200 Subject: [PATCH 3/3] Changelog entry. --- CHANGES.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGES.md b/CHANGES.md index ef6073bb691..09dd8486deb 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -5,6 +5,7 @@ CKEditor 4 Changelog Fixed Issues: +* [#10867](http://dev.ckeditor.com/ticket/10867): Fixed: Issue with setting encoded URI as image's link. * [#10091](http://dev.ckeditor.com/ticket/10091): Blockquote should be treated like an object by the styles system. Thanks to [dan-james-deeson](https://github.com/dan-james-deeson)! * [#11983](http://dev.ckeditor.com/ticket/11983): Fixed: Clicking a nested widget does not focus it. Additionally, performance of the [`widget.repository.getByElement()`](http://docs.ckeditor.com/#!/api/CKEDITOR.plugins.widget.repository-method-getByElement) method has been improved. * [#12000](http://dev.ckeditor.com/ticket/12000): Fixed: Nested widgets should be initialized on [`editor.setData()`](http://docs.ckeditor.com/#!/api/CKEDITOR.editor-method-setData) and [`nestedEditable.setData()`](http://docs.ckeditor.com/#!/api/CKEDITOR.plugins.widget.nestedEditable-method-setData).