Example #1
0
        private void InitializeEditor()
        {
            config = TinyMceConfiguration.GetConfig();
            Editor.EmotionsBaseUrl = Editor.ResolveUrl("~/Data/SiteImages/emoticons/tinymce/");

            Editor.Height = editorHeight;
            Editor.Width = editorWidth;

            if (setFocusOnStart)
            {
                Editor.AutoFocus = true;
            }

            Editor.BasePath = WebConfigSettings.TinyMceBasePath;
            //Editor.Skin = WebConfigSettings.TinyMceSkin;

            SetToolBar();
        }
        public static TinyMceConfiguration GetConfig()
        {
            TinyMceConfiguration config = new TinyMceConfiguration();

            try
            {
                if (
                    (HttpRuntime.Cache["mojoTinyConfiguration"] != null)
                    && (HttpRuntime.Cache["mojoTinyConfiguration"] is TinyMceConfiguration)
                )
                {
                    return (TinyMceConfiguration)HttpRuntime.Cache["mojoTinyConfiguration"];
                }

                string pathToConfigFile = HostingEnvironment.MapPath("~/" + GetConfigFileName());

                XmlDocument configXml = new XmlDocument();
                configXml.Load(pathToConfigFile);
                if(WebConfigSettings.TinyMceUseV4)
                {
                    config.LoadV4FromConfigurationXml(configXml.DocumentElement);
                }
                else
                {
                    config.LoadValuesFromConfigurationXml(configXml.DocumentElement);
                }

                AggregateCacheDependency aggregateCacheDependency = new AggregateCacheDependency();

                string pathToWebConfig = HostingEnvironment.MapPath("~/Web.config");

                aggregateCacheDependency.Add(new CacheDependency(pathToWebConfig));

                HttpRuntime.Cache.Insert(
                    "mojoTinyConfiguration",
                    config,
                    aggregateCacheDependency,
                    DateTime.Now.AddYears(1),
                    TimeSpan.Zero,
                    CacheItemPriority.Default,
                    null);

                return (TinyMceConfiguration)HttpRuntime.Cache["mojoTinyConfiguration"];

            }
            catch (HttpException ex)
            {
                log.Error(ex);

            }
            catch (XmlException ex)
            {
                log.Error(ex);

            }
            catch (ArgumentException ex)
            {
                log.Error(ex);

            }
            catch (NullReferenceException ex)
            {
                log.Error(ex);

            }

            return config;
        }
Example #3
0
        private void InitializeEditor()
        {
            config = TinyMceConfiguration.GetConfig();

            Editor.AdvancedBlockFormats = config.AdvancedFormatBlocks;

            Editor.AdvancedStyles = SiteUtils.BuildStylesListForTinyMce();
            Editor.TemplatesUrl = SiteUtils.GetNavigationSiteRoot() + "/Services/TinyMceTemplates.ashx?cb=" + Guid.NewGuid().ToString(); //cache busting guid
            Editor.EmotionsBaseUrl = Editor.ResolveUrl("~/Data/SiteImages/emoticons/tinymce/");

            Editor.DialogType = config.DialogType;

            Editor.Height = editorHeight;
            Editor.Width = editorWidth;

            Editor.AdvancedSourceEditorWidth = config.AdvancedSourceEditorWidth;
            Editor.AdvancedSourceEditorHeight = config.AdvancedSourceEditorHeight;
            Editor.AdvancedToolbarLocation = config.AdvancedToolbarLocation;
            Editor.AdvancedToolbarAlign = config.AdvancedToolbarAlign;
            Editor.AdvancedStatusBarLocation = config.AdvancedStatusBarLocation;

            if (setFocusOnStart)
            {
                Editor.AutoFocus = true;
            }

            Editor.BasePath = WebConfigSettings.TinyMceBasePath;
            Editor.Skin = WebConfigSettings.TinyMceSkin;

            SetToolBar();
        }