private void OnNavigateLink(object sender, MSDN.Html.Editor.HtmlNavigationEventArgs e) { // Pass everything back to our parent for consistent handling ContentControlWnd.GoToLink(e.Url.ToLower(), m_HwndParent, Handle); e.Cancel = true; // always }
private void OnBaseNavigateLink(object sender, MSDN.Html.Editor.HtmlNavigationEventArgs e) { if (e.Url.ToLower() == "about:blank") { e.Cancel = false; // allow } else { e.Cancel = true; // everything else DoDrop(e.Url, e.Url); } }
private void OnNavigateLink(object sender, MSDN.Html.Editor.HtmlNavigationEventArgs e) { // Pass everything back to our parent for consistent handling ContentControlWnd.ParentNotify notify = new ContentControlWnd.ParentNotify(m_HwndParent, Handle); if (e.Url.ToLower().StartsWith("tdl://")) { notify.NotifyTaskLink(e.Url); } else { notify.NotifyFailedLink(e.Url); } e.Cancel = true; // always }
private void OnBaseNavigateLink(object sender, MSDN.Html.Editor.HtmlNavigationEventArgs e) { if (e.Url.ToLower() == "about:blank") { e.Cancel = false; // allow } else { e.Cancel = true; // everything else if (IsEditable) // Must be drag and drop { bool isImage = IsValidImageHref(e.Url); var rng = GetTextRange(); if (rng == null) { return; } // Get the element under the mouse and move the select // before or after whichever is closer var pos = WebBrowser.PointToClient(Cursor.Position); var element = this.WebBrowser.Document.GetElementFromPoint(pos); if (element == null) { return; } // Create a new element after var newElm = this.WebBrowser.Document.CreateElement("span"); if (newElm == null) { return; } newElm.InnerText = (isImage ? "." : e.Url); if (element.TagName == "BODY") { element.AppendChild(newElm); } else { element.InsertAdjacentElement(HtmlElementInsertionOrientation.AfterEnd, newElm); } rng.moveToElementText(newElm.DomElement as mshtml.IHTMLElement); rng.select(); bool success = false; if (isImage) { success = InsertImage(e.Url, "", MSDN.Html.Editor.ImageAlignOption.Default); } else { success = InsertLinkPrompt(e.Url); } if (!success) { element.OuterHtml = ""; } } } }