"+this.html+"<\/div>")).text()};this.setHtml=function(n){this.html=n;this.htmlUnsafe=n};this.toObject=function(){return{type:"Content"}};this.toObject=function(){var n=this.elementToObject();return n.contentType=this.contentType,n.contentTypeLabel=this.contentTypeLabel,n.contentTypeClass=this.contentTypeClass,n.html=this.html,n.hasEditor=c,n};var l=this.getEditorObject;this.getEditorObject=function(){var n=l();return $.extend(n,{Content:this.html})};this.setHtml(h)};n.Content.from=function(t){return new n.Content(t.data,t.htmlId,t.htmlClass,t.htmlStyle,t.isTemplated,t.contentType,t.contentTypeLabel,t.contentTypeClass,t.html,t.hasEditor)}}(LayoutEditor||(LayoutEditor={}));
\ No newline at end of file
diff --git a/src/Orchard.Web/Modules/Orchard.Layouts/Scripts/Models/Content.js b/src/Orchard.Web/Modules/Orchard.Layouts/Scripts/Models/Content.js
index 202eebf7b..83b3310cc 100644
--- a/src/Orchard.Web/Modules/Orchard.Layouts/Scripts/Models/Content.js
+++ b/src/Orchard.Web/Modules/Orchard.Layouts/Scripts/Models/Content.js
@@ -57,7 +57,7 @@
value.contentType,
value.contentTypeLabel,
value.contentTypeClass,
- decodeURIComponent(value.html.replace(/\+/g, "%20")),
+ value.html,
value.hasEditor);
return result;
diff --git a/src/Orchard.Web/Modules/Orchard.Layouts/Scripts/designer.canvas.js b/src/Orchard.Web/Modules/Orchard.Layouts/Scripts/designer.canvas.js
index 9977d51fd..d97fa982f 100644
--- a/src/Orchard.Web/Modules/Orchard.Layouts/Scripts/designer.canvas.js
+++ b/src/Orchard.Web/Modules/Orchard.Layouts/Scripts/designer.canvas.js
@@ -38,7 +38,7 @@
elements: [
{
typeName: data.element.typeName,
- data: data.element.data ? decodeURIComponent(data.element.data) : null
+ data: data.element.data
}
]
}
@@ -53,7 +53,7 @@
this.refreshElement = function (elementUI, elementData) {
// Serialize the element UI into an object graph.
var graph = {};
- var data = elementData ? decodeURIComponent(elementData) : null;
+ var data = elementData;
var stateFormValues = data ? $.deserialize(data) : null;
var formData = $.extend({}, stateFormValues);
window.Orchard.Layouts.Serializer.serialize(graph, elementUI);
diff --git a/src/Orchard.Web/Modules/Orchard.Layouts/Scripts/serializer.js b/src/Orchard.Web/Modules/Orchard.Layouts/Scripts/serializer.js
deleted file mode 100644
index 57019bf33..000000000
--- a/src/Orchard.Web/Modules/Orchard.Layouts/Scripts/serializer.js
+++ /dev/null
@@ -1,51 +0,0 @@
-(function ($) {
-
- var serializer = {
- serialize: function (graph, scope) {
- scope = scope.wrap("
").parent();
- serializeInternal(graph, scope);
- return graph;
- },
-
- deserialize: function() {
- var layoutEditor = $(".layout-editor");
- var form = layoutEditor.closest("form");
- var stateFieldName = layoutEditor.data("Data-field-name");
- var stateField = form.find("input[name=\"" + stateFieldName + "\"]");
- return JSON.parse(stateField.val());
- }
- };
-
- var serializeInternal = function (graph, scope) {
- var children = scope.children();
- var index = 0;
-
- for (var i = 0; i < children.length; i++) {
- var child = $(children.get(i));
- var isElement = child.hasClass("x-element");
- var subGraph = graph;
-
- if (isElement) {
- var elementData = child.data("element");
- var elements = graph.elements = graph.elements || [];
- var element = {
- typeName: elementData.typeName,
- state: elementData.state,
- settings: elementData.settings,
- index: elementData.index || index,
- isTemplated: elementData.isTemplated || false
- };
- elements.push(element);
- subGraph = element;
- index++;
- }
-
- serializeInternal(subGraph, child);
- }
- }
-
- // Export types.
- window.Orchard = window.Orchard || {};
- window.Orchard.Layouts = window.Orchard.Layouts || {};
- window.Orchard.Layouts.Serializer = serializer;
-})(jQuery);
\ No newline at end of file
diff --git a/src/Orchard.Web/Modules/Orchard.Layouts/Views/EditorTemplates/LayoutEditor.cshtml b/src/Orchard.Web/Modules/Orchard.Layouts/Views/EditorTemplates/LayoutEditor.cshtml
index 03ec6768f..04201d3c5 100644
--- a/src/Orchard.Web/Modules/Orchard.Layouts/Views/EditorTemplates/LayoutEditor.cshtml
+++ b/src/Orchard.Web/Modules/Orchard.Layouts/Views/EditorTemplates/LayoutEditor.cshtml
@@ -21,7 +21,7 @@
Style.Include("dialog.css");
Script.Include("dialog.js");
Script.Include("frame.js");
- Script.Include("serializer.js");
+ Script.Include("LayoutDecoder.js");
// The actual layout editor.
Style.Include("LayoutEditor.css", "LayoutEditor.min.css");
@@ -39,6 +39,8 @@
(function() {
var editorConfig = @Html.Raw(Model.ConfigurationData);
var editorCanvasData = @Html.Raw(Model.Data);
+
+ LayoutEditor.DecodeLayoutGraph(editorCanvasData);
window.layoutEditor = new LayoutEditor.Editor(editorConfig, editorCanvasData);
})(jQuery);
diff --git a/src/Orchard.Web/Modules/Orchard.Layouts/Views/ElementEditor.cshtml b/src/Orchard.Web/Modules/Orchard.Layouts/Views/ElementEditor.cshtml
index ccf074401..b2c51544c 100644
--- a/src/Orchard.Web/Modules/Orchard.Layouts/Views/ElementEditor.cshtml
+++ b/src/Orchard.Web/Modules/Orchard.Layouts/Views/ElementEditor.cshtml
@@ -5,6 +5,7 @@
@{
Style.Include("element-editor.css");
Script.Require("jQuery");
+ Script.Include("LayoutDecoder.js");
Script.Include("element-editor.js");
Layout.LocalNavigation.Add(New.ElementEditor_LocalNav(Tabs: Model.Tabs));
@@ -31,7 +32,7 @@
using (Script.Foot()) {
}