Merge pull request #121 from hashhar/issue-103
Fix error #103 when inserting image from web
This commit is contained in:
commit
599eb052f0
|
@ -649,7 +649,7 @@
|
|||
Type="Exclamation"
|
||||
Buttons="YesNo"
|
||||
Title="Open Live Writer"
|
||||
Text="{0}
Not a valid URL.
Do you want to continue?"
|
||||
Text="{0}
Not a valid URL.
Do you want to go back and edit the URL?"
|
||||
comment:Text="{0} - the url that was entered"/>
|
||||
<Message
|
||||
Identifier="InvalidInsertionPoint"
|
||||
|
|
|
@ -2835,7 +2835,7 @@ Check the file name and try again.</value>
|
|||
<data name="DisplayMessage.InputIsNotUrl.Text" xml:space="preserve">
|
||||
<value>{0}
|
||||
Not a valid URL.
|
||||
Do you want to continue?</value>
|
||||
Do you want to go back and edit the URL?</value>
|
||||
<comment>{0} - the url that was entered</comment></data>
|
||||
<data name="DisplayMessage.InputIsNotUrl.Title" xml:space="preserve">
|
||||
<value>Open Live Writer</value>
|
||||
|
|
|
@ -48,8 +48,12 @@ namespace OpenLiveWriter.PostEditor.ImageInsertion.WebImages
|
|||
{
|
||||
if (!UrlHelper.IsUrl(_source.SourceImageLink))
|
||||
{
|
||||
if (DisplayMessage.Show(MessageId.InputIsNotUrl, this, _source.SourceImageLink) == System.Windows.Forms.DialogResult.No)
|
||||
//Ask if they want to go back and correct the link or just abort it altogether
|
||||
if (DisplayMessage.Show(MessageId.InputIsNotUrl, this, _source.SourceImageLink) == System.Windows.Forms.DialogResult.Yes)
|
||||
{
|
||||
_source.TabSelected();
|
||||
return;
|
||||
}
|
||||
}
|
||||
DialogResult = System.Windows.Forms.DialogResult.OK;
|
||||
}
|
||||
|
|
|
@ -7,8 +7,10 @@ using System.Drawing;
|
|||
using System.Globalization;
|
||||
using System.IO;
|
||||
using mshtml;
|
||||
using OpenLiveWriter.Controls;
|
||||
using OpenLiveWriter.CoreServices;
|
||||
using OpenLiveWriter.Extensibility.ImageEditing;
|
||||
using OpenLiveWriter.Localization;
|
||||
using OpenLiveWriter.PostEditor.PostHtmlEditing.ImageEditing.Decorators;
|
||||
|
||||
namespace OpenLiveWriter.PostEditor.PostHtmlEditing
|
||||
|
@ -93,8 +95,15 @@ namespace OpenLiveWriter.PostEditor.PostHtmlEditing
|
|||
imgHtmlElement.setAttribute("height", oldHeight, 0);
|
||||
if (!String.IsNullOrEmpty(oldWidth))
|
||||
imgHtmlElement.setAttribute("width", oldWidth, 0);
|
||||
|
||||
info = new ImagePropertiesInfo(new Uri(imgSrc), new Size(width, height), remoteImageDecoratorsList);
|
||||
Uri infoUri;
|
||||
if (Uri.TryCreate(imgSrc, UriKind.Absolute, out infoUri))
|
||||
{
|
||||
info = new ImagePropertiesInfo(infoUri, new Size(width, height), remoteImageDecoratorsList);
|
||||
}
|
||||
else
|
||||
{
|
||||
info = new ImagePropertiesInfo(new Uri("http://www.example.com"), new Size(width, height), remoteImageDecoratorsList);
|
||||
}
|
||||
info.ImgElement = imgHtmlElement;
|
||||
|
||||
// Sets the correct inline image size and image size name for the remote image.
|
||||
|
|
Loading…
Reference in New Issue