示例#1
0
        protected override bool LoadPostData(string postDataKey, System.Collections.Specialized.NameValueCollection postCollection)
        {
            base.LoadPostData(postDataKey, postCollection);

            var contentForce = false;

            var post = postCollection[ContentForceId];

            if (!String.IsNullOrEmpty(post))
            {
                contentForce = true;
            }

            post = postCollection[ActiveModeId];
            if (!String.IsNullOrEmpty(post))
            {
                ActiveMode = (ActiveModeType)(Int64.Parse(post, CultureInfo.InvariantCulture));
            }

            _contentChanged = false;
            post            = postCollection[ContentId];
            if (post != null && contentForce)
            {
                var cont = (String)post.Replace("&lt;", "<").Replace("&gt;", ">").Replace("&quot;", "\"").Replace("&amp;", "&");
                if (cont == "<br />")
                {
                    cont = String.Empty;
                }

                if (EnableSanitization)
                {
                    cont = _sanitizer.GetSafeHtmlFragment(cont, _elementWhiteList.Value);
                }

                _contentChanged = (Content.Replace("\n", String.Empty).Replace("\r", String.Empty) != cont.Replace("\n", String.Empty).Replace("\r", String.Empty));
                Content         = cont;
            }

            post = postCollection[ContentChangedId];
            if (!String.IsNullOrEmpty(post))
            {
                _contentChanged = true;
            }

            return(_contentChanged);
        }