Index: /CKEditor.NET/trunk/CHANGES.html
===================================================================
--- /CKEditor.NET/trunk/CHANGES.html (revision 6669)
+++ /CKEditor.NET/trunk/CHANGES.html (revision 6670)
@@ -65,4 +65,12 @@
+ CKEditor.NET 3.5.3 (SVN)
+
+
+ Fixed issues:
+
+ - #7283 : Entered text is not HTML encoded.
+
+
CKEditor.NET 3.5.2
Index: /CKEditor.NET/trunk/CKEditor.NET/CKEditorControl.cs
===================================================================
--- /CKEditor.NET/trunk/CKEditor.NET/CKEditorControl.cs (revision 6669)
+++ /CKEditor.NET/trunk/CKEditor.NET/CKEditorControl.cs (revision 6670)
@@ -22,5 +22,5 @@
[ParseChildren(false)]
[Designer("CKEditor.NET.CKEditorControlDesigner")]
- public class CKEditorControl : TextBox
+ public class CKEditorControl : TextBox, IPostBackDataHandler
{
#region Changed TextBox Property
@@ -33,12 +33,8 @@
get
{
- if (!string.IsNullOrEmpty(base.Text))
- base.Text = base.Text.Replace("<", "<").Replace(">", ">").Replace("&", "&");
return base.Text;
}
set
{
- if (!string.IsNullOrEmpty(value))
- value = value.Replace("<", "<").Replace(">", ">").Replace("&", "&");
base.Text = value;
}
@@ -1000,44 +996,47 @@
this.RegisterStartupScript(this.GetType(), "CKEDITOR_BASEPATH", string.Format("window.CKEDITOR_BASEPATH = '{0}/';\n", (this.CKEditorJSFile.StartsWith("~") ? this.ResolveUrl(this.BasePath) : this.BasePath)), true);
this.RegisterStartupScript(this.GetType(), "ckeditor", "", false);
- if (HasMsAjax)
- {
- string scriptInit = string.Empty;
-
- // Sys.Application.add_load does not work on browsers != IE
- // http://msdn.microsoft.com/en-us/library/bb386417.aspx
- // Check _dev/msajax.js for an uncompressed version (available in CKEditor.Net downloaded from SVN).
- scriptInit += @"var CKEditor_Controls=[];function CKEditor_TextBoxEncode(c,d){if(typeof CKEDITOR=='undefined'||typeof CKEDITOR.instances[c]=='undefined'){var e=document.getElementById(c);e.value=e.value.replace(//g,'>');}else{var f=CKEDITOR.instances[c];if(d)f.destroy();else f.updateElement();}};(function(){var c=function(){var d=CKEditor_Controls,e=window.pageLoad,f=function(){for(i=d.length;i--;){var g=document.getElementById(d[i]);g.value=g.value.replace(/</g,'<').replace(/>/g,'>');}};window.pageLoad=function(g,h){if(h.get_isPartialLoad())f();if(e&&typeof e=='function')e.call(this,g,h);};f();};if(window.addEventListener)window.addEventListener('load',c,false);else if(window.attachEvent)window.attachEvent('onload',c);})();
+ string scriptInit = string.Empty;
+
+ // Sys.Application.add_load does not work on browsers != IE
+ // http://msdn.microsoft.com/en-us/library/bb386417.aspx
+ // Check _dev/msajax.js for an uncompressed version (available in CKEditor.Net downloaded from SVN).
+ scriptInit += @"var CKEditor_Controls=[],CKEditor_Init=[];function CKEditor_TextBoxEncode(d,e){if(typeof CKEDITOR=='undefined'||typeof CKEDITOR.instances[d]=='undefined'){var f=document.getElementById(d);f.value=f.value.replace(//g,'>');}else{var g=CKEDITOR.instances[d];if(e)g.destroy();else g.updateElement();}};(function(){var d=function(){var e=CKEditor_Controls,f=CKEditor_Init,g=window.pageLoad,h=function(){for(var i=e.length;i--;){var j=document.getElementById(e[i]);if(j&&j.value&&(j.value.indexOf('<')==-1||j.value.indexOf('>')==-1))j.value=j.value.replace(/</g,'<').replace(/>/g,'>').replace(/&/g,'&');}if(typeof CKEDITOR!='undefined')for(var i=0;i 0)
+ {
+ string proSour = string.Empty;
+ foreach (string item in this.config.protectedSource)
+ proSour += @"
+ckeditor.config.protectedSource.push( " + item + " );";
+ script += string.Format(@"CKEditor_Init.push(function(){{if(typeof CKEDITOR.instances['{0}']!='undefined') return;var ckeditor = CKEDITOR.replace('{0}',{1}); {2}}});
+", this.ClientID, prepareJSON(), proSour);
+ }
+ else
+ script += string.Format(@"CKEditor_Init.push(function(){{if(typeof CKEDITOR.instances['{0}']!='undefined') return;CKEDITOR.replace('{0}',{1});}});
", this.ClientID, prepareJSON());
- if (HasMsAjax)
- {
- bool isInUpdatePanel = false;
- Control con = this.Parent;
- if (updatePanel != null)
- while (con != null)
+ bool isInUpdatePanel = false;
+ Control con = this.Parent;
+ if (updatePanel != null)
+ while (con != null)
+ {
+ if (con.GetType() == updatePanel)
{
- if (con.GetType() == updatePanel)
- {
- isInUpdatePanel = true;
- break;
- }
- con = con.Parent;
+ isInUpdatePanel = true;
+ break;
}
- this.RegisterOnSubmitStatement(this.GetType(), "aspintegrator_Postback" + this.ClientID, string.Format("CKEditor_TextBoxEncode('{0}', {1}); ", this.ClientID, isInUpdatePanel ? 1 : 0));
- }
+ con = con.Parent;
+ }
+ this.RegisterOnSubmitStatement(this.GetType(), "aspintegrator_Postback" + this.ClientID, string.Format("CKEditor_TextBoxEncode('{0}', {1}); ", this.ClientID, isInUpdatePanel ? 1 : 0));
this.RegisterStartupScript(this.GetType(), "aspintegratorInitial_" + this.ClientID, script, true);
}
@@ -1051,4 +1050,25 @@
return JSONSerializer.ToJavaScriptObjectNotation(this.config);
}
+
+ #endregion
+
+ #region IPostBackDataHandler
+
+ bool IPostBackDataHandler.LoadPostData(string postDataKey, NameValueCollection postCollection)
+ {
+ if (this.config.htmlEncodeOutput)
+ {
+ string postedValue = postCollection[postDataKey];
+ postedValue = postedValue.Replace("<", "<").Replace(">", ">").Replace("&", "&");
+ if (this.Text != postedValue)
+ {
+ this.Text = postedValue;
+ return true;
+ }
+ }
+ return false;
+ }
+
+ void IPostBackDataHandler.RaisePostDataChangedEvent() { }
#endregion
Index: /CKEditor.NET/trunk/_dev/msajax.js
===================================================================
--- /CKEditor.NET/trunk/_dev/msajax.js (revision 6669)
+++ /CKEditor.NET/trunk/_dev/msajax.js (revision 6670)
@@ -5,5 +5,6 @@
// The following script is used in CKEditorControl:OnPreRender
-var CKEditor_Controls = [];
+var CKEditor_Controls = [],
+ CKEditor_Init = [];
function CKEditor_TextBoxEncode(cID, inUpdatePanel) {
@@ -26,10 +27,18 @@
{
var ids = CKEditor_Controls,
+ initFunctions = CKEditor_Init,
oldPageLoad = window.pageLoad;
- var fixValues = function () {
- for (i = ids.length; i--;) {
+ var loadEditors = function() {
+ for (var i = ids.length; i--;) {
var e = document.getElementById(ids[i]);
- e.value = e.value.replace(/</g, '<').replace(/>/g, '>');
+ if (e && e.value && (e.value.indexOf('<') ==-1 || e.value.indexOf('>') ==-1)) {
+ e.value = e.value.replace(/</g, '<').replace(/>/g, '>').replace(/&/g, '&');
+ }
+ }
+ if (typeof CKEDITOR != 'undefined') {
+ for (var i = 0; i < initFunctions.length; i++) {
+ initFunctions[i].call(this);
+ }
}
};
@@ -37,11 +46,12 @@
window.pageLoad = function(sender, args) {
if (args.get_isPartialLoad()) {
- fixValues();
+ setTimeout(loadEditors, 0);
}
- if (oldPageLoad && typeof oldPageLoad == 'function')
- oldPageLoad.call(this, sender, args);
+ if (oldPageLoad && typeof oldPageLoad == 'function') {
+ oldPageLoad.call(this, sender, args);
+ }
};
- fixValues();
+ setTimeout(loadEditors, 0);
};