Пример #1
0
        private void ConfigurEditor()
        {
            //editor1.Visible = false;
            //editor1.Enabled = false;
            //txtPlain.Visible = false;

            SiteSettings siteSettings = CacheHelper.GetCurrentSiteSettings();

            string siteRoot = SiteUtils.GetNavigationSiteRoot();;

            //ed1.SiteRoot = siteRoot;
            if (WebConfigSettings.UseSkinCssInEditor)
            {
                ed1.EditorCSSUrl = SiteUtils.GetEditorStyleSheetUrl(true, true, Page);
            }

            if (attributes.ContainsKey("$EditorConfigPath"))
            {
                ed1.CustomConfigPath = attributes["$EditorConfigPath"].ToString();
            }
            ed1.ToolBar = ToolBar.FullWithTemplates;
            ed1.Height  = Unit.Pixel(300);
            ed1.Skin    = WebConfigSettings.CKEditorSkin;

            if (siteSettings != null)
            {
                if (
                    (WebUser.IsInRoles(siteSettings.GeneralBrowseAndUploadRoles)) ||
                    (WebUser.IsInRoles(siteSettings.UserFilesBrowseAndUploadRoles))
                    )
                {
                    ed1.FileManagerUrl    = siteRoot + WebConfigSettings.FileDialogRelativeUrl;
                    ed1.EnableFileBrowser = true;
                }
            }

            ed1.TemplatesJsonUrl = siteRoot + "/Services/CKeditorTemplates.ashx?cb=" + Guid.NewGuid().ToString(); //prevent caching with a guid param
            ed1.StylesJsonUrl    = siteRoot + "/Services/CKeditorStyles.ashx?cb=" + Guid.NewGuid().ToString().Replace("-", string.Empty);


            CultureInfo defaultCulture = SiteUtils.GetDefaultUICulture();

            if (defaultCulture.TextInfo.IsRightToLeft)
            {
                ed1.TextDirection = Direction.RightToLeft;
            }
        }