當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。