From 171b012edda249bdf729f4122fc280461ca07884 Mon Sep 17 00:00:00 2001
From: Piotr Jasiun
Date: Fri, 9 May 2014 15:21:22 +0200
Subject: [PATCH 1/2] Encode widget data attribute using encodeURIComponent.
---
plugins/widget/plugin.js | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/plugins/widget/plugin.js b/plugins/widget/plugin.js
index a457178c4d7..fd41ae779d5 100644
--- a/plugins/widget/plugin.js
+++ b/plugins/widget/plugin.js
@@ -1868,7 +1868,7 @@
element = upcasted;
// Set initial data attr with data from upcast method.
- element.attributes[ 'data-cke-widget-data' ] = JSON.stringify( data );
+ element.attributes[ 'data-cke-widget-data' ] = encodeURIComponent( JSON.stringify( data ) );
element.attributes[ 'data-cke-widget-upcasted' ] = 1;
toBeWrapped.push( [ element, upcast[ 1 ] ] );
@@ -3091,7 +3091,7 @@
var widgetDataAttr = widget.element.data( 'cke-widget-data' );
if ( widgetDataAttr )
- widget.setData( JSON.parse( widgetDataAttr ) );
+ widget.setData( JSON.parse( decodeURIComponent( widgetDataAttr ) ) );
if ( startupData )
widget.setData( startupData );
@@ -3116,7 +3116,7 @@
}
function writeDataToElement( widget ) {
- widget.element.data( 'cke-widget-data', JSON.stringify( widget.data ) );
+ widget.element.data( 'cke-widget-data', encodeURIComponent( JSON.stringify( widget.data ) ) );
}
//
From 75a81ecbab7078903cd4841ad4e233dd7be18df2 Mon Sep 17 00:00:00 2001
From: Piotr Jasiun
Date: Mon, 12 May 2014 16:21:59 +0200
Subject: [PATCH 2/2] Changelog entry.
---
CHANGES.md | 1 +
1 file changed, 1 insertion(+)
diff --git a/CHANGES.md b/CHANGES.md
index 58e0580d91b..b509320cb4b 100644
--- a/CHANGES.md
+++ b/CHANGES.md
@@ -29,6 +29,7 @@ Fixed Issues:
* [#11798](http://dev.ckeditor.com/ticket/11798): Fixed: Inserting non-editable element inside a table cell breaks the table badly.
* [#11793](http://dev.ckeditor.com/ticket/11793): Fixed: Drop down is not "on" when clicking it while editor is blurred.
* [#11850](http://dev.ckeditor.com/ticket/11850): Fixed: Filter downcasting fake object to element it replaced is not applied if fake object element is non-editable.
+* [#11811](http://dev.ckeditor.com/ticket/11811): Fixed: Widget's data are not encoded correctly when passed to attribute.
Other changes: