Add [img] BBCode tag to the link on the clipboard

Add [img] BBCode tag to the link on the clipboard
This commit is contained in:
Jan 2018-11-30 16:03:39 +01:00
commit 560f4cbfa3
4 changed files with 14 additions and 1 deletions

View file

@ -54,6 +54,10 @@ namespace Greenshot.Addon.Imgur
[Description("Use pagelink instead of direct link on the clipboard")] [Description("Use pagelink instead of direct link on the clipboard")]
[DefaultValue(false)] [DefaultValue(false)]
bool UsePageLink { get; set; } bool UsePageLink { get; set; }
[Description("Add [img] BBCode tag to the link on the clipboard")]
[DefaultValue(false)]
bool addImgBBCode { get; set; }
[Description("Use anonymous access to Imgur")] [Description("Use anonymous access to Imgur")]
[DefaultValue(true)] [DefaultValue(true)]

View file

@ -60,6 +60,8 @@ namespace Greenshot.Addon.Imgur
string UploadSuccess { get; } string UploadSuccess { get; }
string UsePageLink { get; } string UsePageLink { get; }
string addImgBBCode { get; }
string AnonymousAccess { get; } string AnonymousAccess { get; }

View file

@ -171,7 +171,13 @@ namespace Greenshot.Addon.Imgur
using (var clipboardAccessToken = ClipboardNative.Access()) using (var clipboardAccessToken = ClipboardNative.Access())
{ {
clipboardAccessToken.ClearContents(); clipboardAccessToken.ClearContents();
clipboardAccessToken.SetAsUrl(uploadUrl.AbsoluteUri);
// EDIT
if (_imgurConfiguration.addImgBBCode && !_imgurConfiguration.UsePageLink) {
clipboardAccessToken.SetAsUnicodeString("[img]" + uploadUrl.AbsoluteUri + "[/img]");
} else {
clipboardAccessToken.SetAsUrl(uploadUrl.AbsoluteUri);
}
} }
} }
catch (Exception ex) catch (Exception ex)

View file

@ -14,6 +14,7 @@
<ContentControl x:Name="FileConfigPartViewModel"/> <ContentControl x:Name="FileConfigPartViewModel"/>
<CheckBox IsChecked="{Binding ImgurConfiguration.AnonymousAccess}" Content="{Binding ImgurLanguage.AnonymousAccess}"/> <CheckBox IsChecked="{Binding ImgurConfiguration.AnonymousAccess}" Content="{Binding ImgurLanguage.AnonymousAccess}"/>
<CheckBox IsChecked="{Binding ImgurConfiguration.UsePageLink}" Content="{Binding ImgurLanguage.UsePageLink}"/> <CheckBox IsChecked="{Binding ImgurConfiguration.UsePageLink}" Content="{Binding ImgurLanguage.UsePageLink}"/>
<CheckBox IsChecked="{Binding ImgurConfiguration.addImgBBCode}" Content="{Binding ImgurLanguage.addImgBBCode}"/>
<Button x:Name="ShowHistory" Content="{Binding ImgurLanguage.History}"/> <Button x:Name="ShowHistory" Content="{Binding ImgurLanguage.History}"/>
<Button Content="{Binding ImgurLanguage.ResetCredentialsButton}" x:Name="ResetCredentials" /> <Button Content="{Binding ImgurLanguage.ResetCredentialsButton}" x:Name="ResetCredentials" />
</StackPanel> </StackPanel>