本文整理汇总了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;
}
示例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;
}
示例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;
}
示例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;
}
示例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);
}
示例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;
}