当前位置: 首页>>代码示例>>C#>>正文


C# MarkupRange.ParentElement方法代码示例

本文整理汇总了C#中OpenLiveWriter.Mshtml.MarkupRange.ParentElement方法的典型用法代码示例。如果您正苦于以下问题:C# MarkupRange.ParentElement方法的具体用法?C# MarkupRange.ParentElement怎么用?C# MarkupRange.ParentElement使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在OpenLiveWriter.Mshtml.MarkupRange的用法示例。


在下文中一共展示了MarkupRange.ParentElement方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GetSelectedChildEditField

        public static IHTMLElement GetSelectedChildEditField(IHTMLElement parent, MarkupRange selection)
        {
            if (selection == null || !selection.Positioned)
            {
                Trace.Fail("Selection is invalid!");
                return null;
            }

            IHTMLElement element = selection.ParentElement();
            if (element == null || !HTMLElementHelper.IsChildOrSameElement(parent, element))
                return null;

            do
            {
                if (InlineEditField.IsEditField(element))
                    return element;

                element = element.parentElement;
            } while (element != null && element.sourceIndex != parent.sourceIndex);

            return null;
        }
开发者ID:gmilazzoitag,项目名称:OpenLiveWriter,代码行数:22,代码来源:SmartContentElementBehavior.cs

示例2: TryMoveToValidSelection

        protected override bool TryMoveToValidSelection(MarkupRange range)
        {
            IHTMLElement element;

            element = range.ParentElement(ElementFilters.CreateTagIdFilter("DIV"));
            while (element != null)
            {
                if (ContentSourceManager.IsSmartContent(element))
                {
                    SmartContentSelection.SelectIfSmartContentElement(this, element);
                    return true;
                }

                element = element.parentElement;
            }

            return false;
        }
开发者ID:braegelno5,项目名称:OpenLiveWriter,代码行数:18,代码来源:BlogPostHtmlEditorControl.cs

示例3: SelectOuter

        /// <summary>
        /// Expands a range to the safest outter tags that can be contained without encompassing
        /// text that is not currently in this range.
        /// </summary>
        /// <param name="range"></param>
        private void SelectOuter(MarkupRange range)
        {
            IHTMLElement parent = range.ParentElement();
            MarkupRange editableRange = MarkupHelpers.GetEditableRange(parent, MarkupServices);
            if (editableRange == null)
                return;

            while (parent != null && range.MoveOutwardIfNoContent())
            {
                parent = range.Start.CurrentScope;
            }

            if (range.Start.IsLeftOf(editableRange.Start))
                range.Start.MoveToPointer(editableRange.Start);
            if (range.End.IsRightOf(editableRange.End))
                range.End.MoveToPointer(editableRange.End);
            return;
        }
开发者ID:gmilazzoitag,项目名称:OpenLiveWriter,代码行数:23,代码来源:HtmlEditorSelection.cs

示例4: IgnoreSuggestedUrl

 private void IgnoreSuggestedUrl(string matchText, GlossaryLinkItem linkItem, MarkupRange markupRange)
 {
     IHTMLElement parent = markupRange.ParentElement();
     while (parent != null && !(parent is IHTMLAnchorElement))
     {
         parent = parent.parentElement;
     }
     if (parent != null && matchText.ToLower(CultureInfo.CurrentCulture) == parent.innerText.ToLower(CultureInfo.CurrentCulture))
         _linkIgnoreWord = matchText;
 }
开发者ID:gmilazzoitag,项目名称:OpenLiveWriter,代码行数:10,代码来源:PostEditorKeyboardHandler.cs

示例5: InsertSuggestedUrl

        private void InsertSuggestedUrl(string matchText, GlossaryLinkItem linkItem, MarkupRange markupRange)
        {
            if (GlossarySettings.AutoLinkTermsOnlyOnce && TermAlreadyLinked(matchText, linkItem.Url))
                return;

            // Make sure we're not in the title and not in a hyperlink already
            IHTMLElement parentElement = _blogPostHtmlEditorControl.PostTitleElement;
            IHTMLElement currentElement = markupRange.ParentElement();
            while (currentElement != null)
            {
                if (parentElement == currentElement)
                    return; // in the title

                if (currentElement.tagName.ToLower(CultureInfo.InvariantCulture) == "a")
                    return; // in an anchor

                currentElement = currentElement.parentElement;
            }

            if (_linkIgnoreWord != null && matchText.ToLower(CultureInfo.CurrentCulture) == _linkIgnoreWord.ToLower(CultureInfo.CurrentCulture))
                return;

            _blogPostHtmlEditorControl.InsertLink(linkItem.Url, matchText, linkItem.Title, linkItem.Rel, linkItem.OpenInNewWindow, markupRange);
            _blogPostHtmlEditorControl.SelectedMarkupRange.Collapse(false);
        }
开发者ID:gmilazzoitag,项目名称:OpenLiveWriter,代码行数:25,代码来源:PostEditorKeyboardHandler.cs

示例6: GetContainingSmartContentElement

 public static IHTMLElement GetContainingSmartContentElement(MarkupRange range)
 {
     IHTMLElement containingSmartContent = range.ParentElement(IsSmartContentContainer);
     if (containingSmartContent != null)
     {
         return containingSmartContent;
     }
     else
     {
         IHTMLElement[] elements = range.GetTopLevelElements(MarkupRange.FilterNone);
         if (elements.Length == 1 && IsSmartContent(elements[0]))
         {
             return elements[0];
         }
     }
     return null;
 }
开发者ID:gmilazzoitag,项目名称:OpenLiveWriter,代码行数:17,代码来源:ContentSourceManager.cs


注:本文中的OpenLiveWriter.Mshtml.MarkupRange.ParentElement方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。