From 657a2856508442632b5cfe62088cbd27dc5a3bf4 Mon Sep 17 00:00:00 2001 From: Sipke Schoorstra Date: Wed, 4 Mar 2015 11:27:18 +0100 Subject: [PATCH] Fixed "Are you sure you want to leave this page?" even when layout is not dirty. The issue was that during page initialization, the Content element's HTML would be serialized with the URL encoded version of its contents, but shortly after that HTML would be URL decoded, causing a difference in the serialized JSON between the initial serialization and final serialization (upon page unload). --- src/Orchard.Web/Modules/Orchard.Layouts/Scripts/Models.js | 2 +- src/Orchard.Web/Modules/Orchard.Layouts/Scripts/Models.min.js | 2 +- .../Modules/Orchard.Layouts/Scripts/Models/Content.js | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Orchard.Web/Modules/Orchard.Layouts/Scripts/Models.js b/src/Orchard.Web/Modules/Orchard.Layouts/Scripts/Models.js index 7f6dafe8a..356f1f366 100644 --- a/src/Orchard.Web/Modules/Orchard.Layouts/Scripts/Models.js +++ b/src/Orchard.Web/Modules/Orchard.Layouts/Scripts/Models.js @@ -919,7 +919,7 @@ var LayoutEditor; value.contentType, value.contentTypeLabel, value.contentTypeClass, - value.html, + decodeURIComponent(value.html.replace(/\+/g, "%20")), value.hasEditor); return result; diff --git a/src/Orchard.Web/Modules/Orchard.Layouts/Scripts/Models.min.js b/src/Orchard.Web/Modules/Orchard.Layouts/Scripts/Models.min.js index c9c2f1fe4..a3dd4f8fa 100644 --- a/src/Orchard.Web/Modules/Orchard.Layouts/Scripts/Models.min.js +++ b/src/Orchard.Web/Modules/Orchard.Layouts/Scripts/Models.min.js @@ -1 +1 @@ -var LayoutEditor;(function(n){Array.prototype.move=function(n,t){this.splice(t,0,this.splice(n,1)[0])};n.childrenFrom=function(t){return _(t).map(function(t){return n.elementFrom(t)})};var t=n.registerFactory=function(t,i){var r=n.factories=n.factories||{};r[t]=i};t("Grid",function(t){return n.Grid.from(t)});t("Row",function(t){return n.Row.from(t)});t("Column",function(t){return n.Column.from(t)});t("Content",function(t){return n.Content.from(t)});n.elementFrom=function(t){var i=n.factories[t.type];if(!i)throw new Error('No element with type "'+t.type+'" was found.');return i(t)};n.setModel=function(n,t){$(n).scope().element=t};n.getModel=function(n){return $(n).scope().element}})(LayoutEditor||(LayoutEditor={})),function(n){n.Editor=function(t,i){this.config=t;this.canvas=n.Canvas.from(i);this.initialState=JSON.stringify(this.canvas.toObject());this.activeElement=null;this.focusedElement=null;this.dropTargetElement=null;this.isDragging=!1;this.inlineEditingIsActive=!1;this.isResizing=!1;this.resetToolboxElements=function(){this.toolboxElements=[n.Row.from({children:[]})]};this.isDirty=function(){var n=JSON.stringify(this.canvas.toObject());return this.initialState!=n};this.resetToolboxElements();this.canvas.setEditor(this)}}(LayoutEditor||(LayoutEditor={})),function(n){n.Element=function(n,t,i,r,u,f){if(!n)throw new Error("Parameter 'type' is required.");this.type=n;this.data=t;this.htmlId=i;this.htmlClass=r;this.htmlStyle=u;this.isTemplated=f;this.editor=null;this.parent=null;this.setIsFocusedEventHandlers=[];this.setEditor=function(n){this.editor=n;!!this.children&&_.isArray(this.children)&&_(this.children).each(function(t){t.setEditor(n)})};this.setParent=function(n){this.parent=n;!this.parent.linkChild||this.parent.linkChild(this)};this.setIsTemplated=function(n){this.isTemplated=n;!!this.children&&_.isArray(this.children)&&_(this.children).each(function(t){t.setIsTemplated(n)})};this.getIsActive=function(){return this.editor?this.editor.activeElement===this&&!this.getIsFocused():!1};this.setIsActive=function(n){this.editor&&(this.editor.isDragging||this.editor.inlineEditingIsActive||this.editor.isResizing||(this.editor.activeElement=n?this:this.parent))};this.getIsFocused=function(){return this.editor?this.editor.focusedElement===this:!1};this.setIsFocused=function(){this.editor&&(this.isTemplated||this.editor.isDragging||this.editor.inlineEditingIsActive||this.editor.isResizing||(this.editor.focusedElement=this,_(this.setIsFocusedEventHandlers).each(function(n){try{n()}catch(t){}})))};this.getIsSelected=function(){return this.getIsFocused()?!0:!!this.children&&_.isArray(this.children)?_(this.children).any(function(n){return n.getIsSelected()}):!1};this.getIsDropTarget=function(){return this.editor?this.editor.dropTargetElement===this:!1};this.setIsDropTarget=function(n){this.editor&&(this.editor.dropTargetElement=n?this:null)};this.delete=function(){!this.parent||this.parent.deleteChild(this)};this.canMoveUp=function(){return this.parent?this.parent.canMoveChildUp(this):!1};this.moveUp=function(){!this.parent||this.parent.moveChildUp(this)};this.canMoveDown=function(){return this.parent?this.parent.canMoveChildDown(this):!1};this.moveDown=function(){!this.parent||this.parent.moveChildDown(this)};this.elementToObject=function(){return{type:this.type,data:this.data,htmlId:this.htmlId,htmlClass:this.htmlClass,htmlStyle:this.htmlStyle,isTemplated:this.isTemplated}};this.getEditorObject=function(){return{}};this.copy=function(n){var t=this.getInnerText(),i,r;n.setData("text/plain",t);console.log(t);i=this.toObject();r=JSON.stringify(i,null,"\t");n.setData("text/json",r)};this.cut=function(n){this.copy(n);this.delete()};this.paste=function(n){!this.parent||this.parent.paste(n)}}}(LayoutEditor||(LayoutEditor={})),function(n){n.Container=function(t,i){this.allowedChildTypes=t;this.children=i;this.isContainer=!0;var r=this;this.setChildren=function(n){this.children=n;_(this.children).each(function(n){n.parent=r})};this.setChildren(i);this.getIsSealed=function(){return _(this.children).any(function(n){return n.isTemplated})};this.addChild=function(n){!_(this.children).contains(n)&&(_(this.allowedChildTypes).contains(n.type)||n.isContainable)&&this.children.push(n);n.setEditor(this.editor);n.setIsTemplated(!1);n.parent=this};this.deleteChild=function(n){var t=_(this.children).indexOf(n);t>=0&&(this.children.splice(t,1),n.getIsActive()&&(this.editor.activeElement=null),n.getIsFocused()&&(this.children.length>t?this.children[t].setIsFocused():t>0?this.children[t-1].setIsFocused():this.setIsFocused()))};this.moveFocusPrevChild=function(n){if(!(this.children.length<2)){var t=_(this.children).indexOf(n);t>0&&this.children[t-1].setIsFocused()}};this.moveFocusNextChild=function(n){if(!(this.children.length<2)){var t=_(this.children).indexOf(n);t0};this.canMoveChildDown=function(n){var t=_(this.children).indexOf(n);return t0?n.width<12:t<0?n.width>1:!1}var t,f,r,u;if(n==0)return!0;for(t=n,t<0&&(f=12-l(),t+=f,t>0&&(t=0));t<0&&_(s.children).any(function(n){return n.offset>0});)for(i=0;i0&&(r.offset--,t++);while(t!=0){if(!_(s.children).any(e))break;for(i=0;i=0?n.width>1:!1};this.contractColumnRight=function(n,t){var i,r;this.canContractColumnRight(n,t)&&(i=_(this.children).indexOf(n),i>=0&&n.width>1&&(n.width--,this.children.length>i+1&&(r=this.children[i+1],t&&r.offset==0?r.width++:r.offset++)))};this.canExpandColumnRight=function(n,t){var r=_(this.children).indexOf(n),i;return r>=0?n.width>=12?!1:this.children.length>r+1?(i=this.children[r+1],t&&i.offset==0?i.width>1:i.offset>0):l()<12:!1};this.expandColumnRight=function(n,t){var i,r;this.canExpandColumnRight(n,t)&&(i=_(this.children).indexOf(n),i>=0&&(this.children.length>i+1&&(r=this.children[i+1],t&&r.offset==0?r.width--:r.offset--),n.width++))};this.canExpandColumnLeft=function(n,t){var i=_(this.children).indexOf(n),r;return i>=0?n.width>=12?!1:i>0&&(r=this.children[i-1],t&&n.offset==0)?r.width>1:n.offset>0:!1};this.expandColumnLeft=function(n,t){var i,r;this.canExpandColumnLeft(n,t)&&(i=_(this.children).indexOf(n),i>=0&&(i>0?(r=this.children[i-1],t&&n.offset==0?r.width--:n.offset--):n.offset--,n.width++))};this.canContractColumnLeft=function(n){var t=_(this.children).indexOf(n);return t>=0?n.width>1:!1};this.contractColumnLeft=function(n,t){var i,r;this.canContractColumnLeft(n,t)&&(i=_(this.children).indexOf(n),i>=0&&(i>0?(r=this.children[i-1],t&&n.offset==0?r.width++:n.offset++):n.offset++,n.width--))};this.evenColumns=function(){var t,n;this.children.length!=0&&(t=Math.floor(12/this.children.length),_(this.children).each(function(n){n.width=t;n.offset=0}),n=12%this.children.length,n>0&&c(n))};v=this.pasteChild;this.pasteChild=function(n){n.type=="Column"?this.beginAddColumn(n.width)&&(this.commitAddColumn(),v.call(this,n)):!this.parent||this.parent.pasteChild(n)};this.toObject=function(){var n=this.elementToObject();return n.children=this.childrenToObject(),n}};n.Row.from=function(t){var i=new n.Row(t.data,t.htmlId,t.htmlClass,t.htmlStyle,t.isTemplated,n.childrenFrom(t.children));return i.toolboxIcon=t.toolboxIcon,i.toolboxLabel=t.toolboxLabel,i.toolboxDescription=t.toolboxDescription,i}}(LayoutEditor||(LayoutEditor={})),function(n){n.Column=function(t,i,r,u,f,e,o,s){n.Element.call(this,"Column",t,i,r,u,f);n.Container.call(this,["Grid","Content"],s);this.width=e;this.offset=o;var h=!1,c=0,l=0;this.beginChange=function(){if(!!h)throw new Error("Column already has a pending change.");h=!0;c=this.width;l=this.offset};this.commitChange=function(){if(!h)throw new Error("Column has no pending change.");c=0;l=0;h=!1};this.rollbackChange=function(){if(!h)throw new Error("Column has no pending change.");this.width=c;this.offset=l;c=0;l=0;h=!1};this.canSplit=function(){return this.width>1};this.split=function(){if(this.canSplit()){var t=Math.floor(this.width/2),i=n.Column.from({data:null,htmlId:null,htmlClass:null,htmlStyle:null,width:t,offset:0,children:[]});this.width=this.width-t;this.parent.insertChild(i,this);i.setIsFocused()}};this.canContractRight=function(n){return this.parent.canContractColumnRight(this,n)};this.contractRight=function(n){this.parent.contractColumnRight(this,n)};this.canExpandRight=function(n){return this.parent.canExpandColumnRight(this,n)};this.expandRight=function(n){this.parent.expandColumnRight(this,n)};this.canExpandLeft=function(n){return this.parent.canExpandColumnLeft(this,n)};this.expandLeft=function(n){this.parent.expandColumnLeft(this,n)};this.canContractLeft=function(n){return this.parent.canContractColumnLeft(this,n)};this.contractLeft=function(n){this.parent.contractColumnLeft(this,n)};this.toObject=function(){var n=this.elementToObject();return n.width=this.width,n.offset=this.offset,n.children=this.childrenToObject(),n}};n.Column.from=function(t){var i=new n.Column(t.data,t.htmlId,t.htmlClass,t.htmlStyle,t.isTemplated,t.width,t.offset,n.childrenFrom(t.children));return i.toolboxIcon=t.toolboxIcon,i.toolboxLabel=t.toolboxLabel,i.toolboxDescription=t.toolboxDescription,i};n.Column.times=function(t){return _.times(t,function(){return n.Column.from({data:null,htmlId:null,htmlClass:null,isTemplated:!1,width:12/t,offset:0,children:[]})})}}(LayoutEditor||(LayoutEditor={})),function(n){n.Content=function(t,i,r,u,f,e,o,s,h,c){n.Element.call(this,"Content",t,i,r,u,f);this.contentType=e;this.contentTypeLabel=o;this.contentTypeClass=s;this.html=h;this.hasEditor=c;this.getInnerText=function(){return $($.parseHTML("
"+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 +var LayoutEditor;(function(n){Array.prototype.move=function(n,t){this.splice(t,0,this.splice(n,1)[0])};n.childrenFrom=function(t){return _(t).map(function(t){return n.elementFrom(t)})};var t=n.registerFactory=function(t,i){var r=n.factories=n.factories||{};r[t]=i};t("Grid",function(t){return n.Grid.from(t)});t("Row",function(t){return n.Row.from(t)});t("Column",function(t){return n.Column.from(t)});t("Content",function(t){return n.Content.from(t)});n.elementFrom=function(t){var i=n.factories[t.type];if(!i)throw new Error('No element with type "'+t.type+'" was found.');return i(t)};n.setModel=function(n,t){$(n).scope().element=t};n.getModel=function(n){return $(n).scope().element}})(LayoutEditor||(LayoutEditor={})),function(n){n.Editor=function(t,i){this.config=t;this.canvas=n.Canvas.from(i);this.initialState=JSON.stringify(this.canvas.toObject());this.activeElement=null;this.focusedElement=null;this.dropTargetElement=null;this.isDragging=!1;this.inlineEditingIsActive=!1;this.isResizing=!1;this.resetToolboxElements=function(){this.toolboxElements=[n.Row.from({children:[]})]};this.isDirty=function(){var n=JSON.stringify(this.canvas.toObject());return this.initialState!=n};this.resetToolboxElements();this.canvas.setEditor(this)}}(LayoutEditor||(LayoutEditor={})),function(n){n.Element=function(n,t,i,r,u,f){if(!n)throw new Error("Parameter 'type' is required.");this.type=n;this.data=t;this.htmlId=i;this.htmlClass=r;this.htmlStyle=u;this.isTemplated=f;this.editor=null;this.parent=null;this.setIsFocusedEventHandlers=[];this.setEditor=function(n){this.editor=n;!!this.children&&_.isArray(this.children)&&_(this.children).each(function(t){t.setEditor(n)})};this.setParent=function(n){this.parent=n;!this.parent.linkChild||this.parent.linkChild(this)};this.setIsTemplated=function(n){this.isTemplated=n;!!this.children&&_.isArray(this.children)&&_(this.children).each(function(t){t.setIsTemplated(n)})};this.getIsActive=function(){return this.editor?this.editor.activeElement===this&&!this.getIsFocused():!1};this.setIsActive=function(n){this.editor&&(this.editor.isDragging||this.editor.inlineEditingIsActive||this.editor.isResizing||(this.editor.activeElement=n?this:this.parent))};this.getIsFocused=function(){return this.editor?this.editor.focusedElement===this:!1};this.setIsFocused=function(){this.editor&&(this.isTemplated||this.editor.isDragging||this.editor.inlineEditingIsActive||this.editor.isResizing||(this.editor.focusedElement=this,_(this.setIsFocusedEventHandlers).each(function(n){try{n()}catch(t){}})))};this.getIsSelected=function(){return this.getIsFocused()?!0:!!this.children&&_.isArray(this.children)?_(this.children).any(function(n){return n.getIsSelected()}):!1};this.getIsDropTarget=function(){return this.editor?this.editor.dropTargetElement===this:!1};this.setIsDropTarget=function(n){this.editor&&(this.editor.dropTargetElement=n?this:null)};this.delete=function(){!this.parent||this.parent.deleteChild(this)};this.canMoveUp=function(){return this.parent?this.parent.canMoveChildUp(this):!1};this.moveUp=function(){!this.parent||this.parent.moveChildUp(this)};this.canMoveDown=function(){return this.parent?this.parent.canMoveChildDown(this):!1};this.moveDown=function(){!this.parent||this.parent.moveChildDown(this)};this.elementToObject=function(){return{type:this.type,data:this.data,htmlId:this.htmlId,htmlClass:this.htmlClass,htmlStyle:this.htmlStyle,isTemplated:this.isTemplated}};this.getEditorObject=function(){return{}};this.copy=function(n){var t=this.getInnerText(),i,r;n.setData("text/plain",t);console.log(t);i=this.toObject();r=JSON.stringify(i,null,"\t");n.setData("text/json",r)};this.cut=function(n){this.copy(n);this.delete()};this.paste=function(n){!this.parent||this.parent.paste(n)}}}(LayoutEditor||(LayoutEditor={})),function(n){n.Container=function(t,i){this.allowedChildTypes=t;this.children=i;this.isContainer=!0;var r=this;this.setChildren=function(n){this.children=n;_(this.children).each(function(n){n.parent=r})};this.setChildren(i);this.getIsSealed=function(){return _(this.children).any(function(n){return n.isTemplated})};this.addChild=function(n){!_(this.children).contains(n)&&(_(this.allowedChildTypes).contains(n.type)||n.isContainable)&&this.children.push(n);n.setEditor(this.editor);n.setIsTemplated(!1);n.parent=this};this.deleteChild=function(n){var t=_(this.children).indexOf(n);t>=0&&(this.children.splice(t,1),n.getIsActive()&&(this.editor.activeElement=null),n.getIsFocused()&&(this.children.length>t?this.children[t].setIsFocused():t>0?this.children[t-1].setIsFocused():this.setIsFocused()))};this.moveFocusPrevChild=function(n){if(!(this.children.length<2)){var t=_(this.children).indexOf(n);t>0&&this.children[t-1].setIsFocused()}};this.moveFocusNextChild=function(n){if(!(this.children.length<2)){var t=_(this.children).indexOf(n);t0};this.canMoveChildDown=function(n){var t=_(this.children).indexOf(n);return t0?n.width<12:t<0?n.width>1:!1}var t,f,r,u;if(n==0)return!0;for(t=n,t<0&&(f=12-l(),t+=f,t>0&&(t=0));t<0&&_(s.children).any(function(n){return n.offset>0});)for(i=0;i0&&(r.offset--,t++);while(t!=0){if(!_(s.children).any(e))break;for(i=0;i=0?n.width>1:!1};this.contractColumnRight=function(n,t){var i,r;this.canContractColumnRight(n,t)&&(i=_(this.children).indexOf(n),i>=0&&n.width>1&&(n.width--,this.children.length>i+1&&(r=this.children[i+1],t&&r.offset==0?r.width++:r.offset++)))};this.canExpandColumnRight=function(n,t){var r=_(this.children).indexOf(n),i;return r>=0?n.width>=12?!1:this.children.length>r+1?(i=this.children[r+1],t&&i.offset==0?i.width>1:i.offset>0):l()<12:!1};this.expandColumnRight=function(n,t){var i,r;this.canExpandColumnRight(n,t)&&(i=_(this.children).indexOf(n),i>=0&&(this.children.length>i+1&&(r=this.children[i+1],t&&r.offset==0?r.width--:r.offset--),n.width++))};this.canExpandColumnLeft=function(n,t){var i=_(this.children).indexOf(n),r;return i>=0?n.width>=12?!1:i>0&&(r=this.children[i-1],t&&n.offset==0)?r.width>1:n.offset>0:!1};this.expandColumnLeft=function(n,t){var i,r;this.canExpandColumnLeft(n,t)&&(i=_(this.children).indexOf(n),i>=0&&(i>0?(r=this.children[i-1],t&&n.offset==0?r.width--:n.offset--):n.offset--,n.width++))};this.canContractColumnLeft=function(n){var t=_(this.children).indexOf(n);return t>=0?n.width>1:!1};this.contractColumnLeft=function(n,t){var i,r;this.canContractColumnLeft(n,t)&&(i=_(this.children).indexOf(n),i>=0&&(i>0?(r=this.children[i-1],t&&n.offset==0?r.width++:n.offset++):n.offset++,n.width--))};this.evenColumns=function(){var t,n;this.children.length!=0&&(t=Math.floor(12/this.children.length),_(this.children).each(function(n){n.width=t;n.offset=0}),n=12%this.children.length,n>0&&c(n))};v=this.pasteChild;this.pasteChild=function(n){n.type=="Column"?this.beginAddColumn(n.width)&&(this.commitAddColumn(),v.call(this,n)):!this.parent||this.parent.pasteChild(n)};this.toObject=function(){var n=this.elementToObject();return n.children=this.childrenToObject(),n}};n.Row.from=function(t){var i=new n.Row(t.data,t.htmlId,t.htmlClass,t.htmlStyle,t.isTemplated,n.childrenFrom(t.children));return i.toolboxIcon=t.toolboxIcon,i.toolboxLabel=t.toolboxLabel,i.toolboxDescription=t.toolboxDescription,i}}(LayoutEditor||(LayoutEditor={})),function(n){n.Column=function(t,i,r,u,f,e,o,s){n.Element.call(this,"Column",t,i,r,u,f);n.Container.call(this,["Grid","Content"],s);this.width=e;this.offset=o;var h=!1,c=0,l=0;this.beginChange=function(){if(!!h)throw new Error("Column already has a pending change.");h=!0;c=this.width;l=this.offset};this.commitChange=function(){if(!h)throw new Error("Column has no pending change.");c=0;l=0;h=!1};this.rollbackChange=function(){if(!h)throw new Error("Column has no pending change.");this.width=c;this.offset=l;c=0;l=0;h=!1};this.canSplit=function(){return this.width>1};this.split=function(){if(this.canSplit()){var t=Math.floor(this.width/2),i=n.Column.from({data:null,htmlId:null,htmlClass:null,htmlStyle:null,width:t,offset:0,children:[]});this.width=this.width-t;this.parent.insertChild(i,this);i.setIsFocused()}};this.canContractRight=function(n){return this.parent.canContractColumnRight(this,n)};this.contractRight=function(n){this.parent.contractColumnRight(this,n)};this.canExpandRight=function(n){return this.parent.canExpandColumnRight(this,n)};this.expandRight=function(n){this.parent.expandColumnRight(this,n)};this.canExpandLeft=function(n){return this.parent.canExpandColumnLeft(this,n)};this.expandLeft=function(n){this.parent.expandColumnLeft(this,n)};this.canContractLeft=function(n){return this.parent.canContractColumnLeft(this,n)};this.contractLeft=function(n){this.parent.contractColumnLeft(this,n)};this.toObject=function(){var n=this.elementToObject();return n.width=this.width,n.offset=this.offset,n.children=this.childrenToObject(),n}};n.Column.from=function(t){var i=new n.Column(t.data,t.htmlId,t.htmlClass,t.htmlStyle,t.isTemplated,t.width,t.offset,n.childrenFrom(t.children));return i.toolboxIcon=t.toolboxIcon,i.toolboxLabel=t.toolboxLabel,i.toolboxDescription=t.toolboxDescription,i};n.Column.times=function(t){return _.times(t,function(){return n.Column.from({data:null,htmlId:null,htmlClass:null,isTemplated:!1,width:12/t,offset:0,children:[]})})}}(LayoutEditor||(LayoutEditor={})),function(n){n.Content=function(t,i,r,u,f,e,o,s,h,c){n.Element.call(this,"Content",t,i,r,u,f);this.contentType=e;this.contentTypeLabel=o;this.contentTypeClass=s;this.html=h;this.hasEditor=c;this.getInnerText=function(){return $($.parseHTML("
"+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,decodeURIComponent(t.html.replace(/\+/g,"%20")),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 83b3310cc..202eebf7b 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, - value.html, + decodeURIComponent(value.html.replace(/\+/g, "%20")), value.hasEditor); return result;