/// <summary>
        /// 得到配置信息
        /// </summary>
        /// <returns></returns>
        public static UEditorWrapperSettings GetConfig()
        {
            UEditorWrapperSettings result = (UEditorWrapperSettings)ConfigurationBroker.GetSection("ueditorWrapperSettings");

            if (result == null)
                result = new UEditorWrapperSettings();

            return result;
        }
Exemplo n.º 2
0
        /// <summary>
        /// 得到配置信息
        /// </summary>
        /// <returns></returns>
        public static UEditorWrapperSettings GetConfig()
        {
            UEditorWrapperSettings result = (UEditorWrapperSettings)ConfigurationBroker.GetSection("ueditorWrapperSettings");

            if (result == null)
            {
                result = new UEditorWrapperSettings();
            }

            return(result);
        }
        private void RegisterScriptAndCss()
        {
            string rootPath = UriHelper.ResolveUri(UEditorWrapperSettings.GetConfig().ScriptRootPath).ToString();

            Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "ueditorConfig",
                                                        string.Format("<script type=\"text/javascript\" src=\"{0}\"></script>",
                                                                      UriHelper.CombinePath(rootPath, "/editor_config.js")));

            string editorAllScript = "/editor_all.js"; // WebUtility.IsWebApplicationCompilationDebug() ?"/editor_all.js" : "/editor_all_min.js";

            Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "ueditorAll",
                                                        string.Format("<script type=\"text/javascript\" src=\"{0}\"></script>",
                                                                      UriHelper.CombinePath(rootPath, editorAllScript)));

            Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "ueditorCSS",
                                                        string.Format("<link rel=\"stylesheet\" type=\"text/css\" href=\"{0}\" />",
                                                                      UriHelper.CombinePath(rootPath, "/themes/default/ueditor.css")));
        }
        private UEditorConfigWrapper PrepareConfigWrapper(string strToolBars)
        {
            var    settings = UEditorWrapperSettings.GetConfig();
            string rootPath = UriHelper.ResolveUri(settings.ScriptRootPath).ToString();

            UEditorConfigWrapper config = new UEditorConfigWrapper();

            config.UEDITOR_HOME_URL  = rootPath;
            config.AutoHeightEnabled = settings.AutoHeightEnabled;
            //config.Toolbars = new string[] {
            //    "|", "Undo", "Redo", "|",
            //    "Bold", "Italic", "Underline", "StrikeThrough", "Superscript", "Subscript", "RemoveFormat", "FormatMatch", "|",
            //    "BlockQuote", "|", "PastePlain", "|", "ForeColor", "BackColor", "InsertOrderedList", "InsertUnorderedList", "|", "CustomStyle",
            //    "Paragraph", "RowSpacing", "LineHeight", "FontFamily", "FontSize", "|",
            //    "DirectionalityLtr", "DirectionalityRtl", "|", "", "Indent", "|",
            //    "JustifyLeft", "JustifyCenter", "JustifyRight", "JustifyJustify", "|",
            //    "Link", "Unlink", "Anchor", "|", "InsertFrame", "PageBreak", "HighlightCode", "|",
            //    "Horizontal", "Date", "Time", "Spechars", "|",
            //    "InsertTable", "DeleteTable", "InsertParagraphBeforeTable", "InsertRow", "DeleteRow", "InsertCol", "DeleteCol", "MergeCells", "MergeRight", "MergeDown", "SplittoCells", "SplittoRows", "SplittoCols", "|",
            //    "SelectAll", "ClearDoc", "SearchReplace", "Print", "Preview", "CheckImage","WordImage","InsertImage","DownloadImage",
            //    "Source"};

            if (strToolBars.IsNotEmpty())
            {
                config.Toolbars = strToolBars.Trim().Replace("\r\n", "").Split(',');
            }

            config.RelativePath    = true;
            config.HighlightJsUrl  = UriHelper.CombinePath(rootPath, "/third-party/SyntaxHighlighter/shCore.js");
            config.HighlightCssUrl = UriHelper.CombinePath(rootPath, "/third-party/SyntaxHighlighter/shCoreDefault.css");

            //config.InitialContent = this._InitialData;

            //请参见RenderFakeElement
            config.TextArea = this.PostedDataFormName;

            return(config);
        }