void commandSemanticHtml_ExecuteWithArgs(object sender, ExecuteEventHandlerArgs args)
        {
            int selectedIndex          = args.GetInt(CommandId.SemanticHtmlGallery.ToString());
            IHtmlFormattingStyle style = commandSemanticHtml.Items[selectedIndex] as IHtmlFormattingStyle;

            ApplyHtmlFormattingStyle(style);
        }
Esempio n. 2
0
 void IHtmlEditorCommandSource.ApplyHtmlFormattingStyle(IHtmlFormattingStyle style)
 {
     ApplyFormattingTag(style.ElementName, null);
 }
        void IHtmlEditorCommandSource.ApplyHtmlFormattingStyle(IHtmlFormattingStyle style)
        {
            if (_initialDocumentLoaded)
            {
                MarkupRange selectedMarkupRange = SelectedMarkupRange;
                IHTMLElement maxEditableElement = null;
                MarkupRange maxEditableRange = MarkupServices.CreateMarkupRange();
                IHTMLElement[] editableElements = EditableElements;
                for (int i = editableElements.Length - 1; i >= 0 && maxEditableElement == null; i--)
                {
                    maxEditableRange.MoveToElement(editableElements[i], false);
                    if (maxEditableRange.InRange(selectedMarkupRange.Start) || maxEditableRange.InRange(selectedMarkupRange.End))
                        maxEditableElement = editableElements[i];
                }
                if (maxEditableElement != null)
                {
                    using (IUndoUnit undo = CreateUndoUnit())
                    {
                        MarkupRange selection = SelectedMarkupRange;
                        using (DamageServices.CreateDamageTracker(selection, true))
                        {
                            HtmlBlockFormatHelper.ApplyBlockStyle(this, style.ElementTagId, selection, maxEditableRange, selection.Clone());
                        }

                        //reselect the selected text.
                        selection.ToTextRange().select();
                        undo.Commit();
                    }
                }
            }
        }
 void IHtmlEditorCommandSource.ApplyHtmlFormattingStyle(IHtmlFormattingStyle style)
 {
     ApplyFormattingTag(style.ElementName, null);
 }
 public void ApplyHtmlFormattingStyle(IHtmlFormattingStyle style)
 {
     _currentEditor.CommandSource.ApplyHtmlFormattingStyle(style);
 }
 public StyleItem(IHtmlFormattingStyle style)
 {
     _style = style;
 }
 public StyleItem(IHtmlFormattingStyle style)
 {
     _style = style;
 }
        public void SetStyles(IHtmlFormattingStyle[] styles)
        {
            //clear any existing styles
            styleComboBox.Items.Clear();
            styleTable.Clear();

            //add the new styles
            foreach (IHtmlFormattingStyle style in styles)
            {
                StyleItem styleItem = new StyleItem(style);
                styleComboBox.Items.Add(styleItem);
                styleTable[style.ElementName] = styleItem;
            }
        }