private void BackupStyles(HtmlDocument htmlDocument)
 {
     _inlineStyles = new Dictionary<HtmlTag, HtmlStyleCollection>();
     foreach (var tag in htmlDocument.FindElements(e => e.ElementType == HtmlElementType.Tag).Cast<HtmlTag>().Where(tag => tag.Styles.Count > 0))
     {
         _inlineStyles.Add(tag, tag.Styles.CloneAs<HtmlStyleCollection>());
         tag.Styles.Clear();
     }
 }
Beispiel #2
0
        private void InitializeForm(string selection)
        {
            if (!string.IsNullOrEmpty(selection))
            {
                var doc = new HtmlDocument(selection);
                var root = doc.FindElements(t => t.Attributes["class"] == "umbMacroHolder" && t.Attributes["ismacro"] == "true").FirstOrDefault();
                if (root != null)
                {
                    MacroAlias = root.Attributes["umb_macroalias"];
                    BuildEditorForm(root.Attributes);
                    mvItems.ActiveViewIndex = 1;
                    return;
                }
            }

            ddlMacroType.Items.Add(new ListItem("", ""));
            foreach (var macro in Macro.GetAll())
            {
                if (!macro.UseInEditor)
                    continue;

                ddlMacroType.Items.Add(new ListItem(macro.Name, macro.Alias));
            }
            mvItems.ActiveViewIndex = 0;
        }