diff --git a/ShareX/Forms/MainForm.Designer.cs b/ShareX/Forms/MainForm.Designer.cs index 17000e2ba..7e20c3c6d 100644 --- a/ShareX/Forms/MainForm.Designer.cs +++ b/ShareX/Forms/MainForm.Designer.cs @@ -189,8 +189,10 @@ private void InitializeComponent() this.tsmiTrayUploadFile = new System.Windows.Forms.ToolStripMenuItem(); this.tsmiTrayUploadFolder = new System.Windows.Forms.ToolStripMenuItem(); this.tsmiTrayUploadClipboard = new System.Windows.Forms.ToolStripMenuItem(); + this.tsmiTrayUploadText = new System.Windows.Forms.ToolStripMenuItem(); this.tsmiTrayUploadURL = new System.Windows.Forms.ToolStripMenuItem(); this.tsmiTrayUploadDragDrop = new System.Windows.Forms.ToolStripMenuItem(); + this.tsmiTrayShortenURL = new System.Windows.Forms.ToolStripMenuItem(); this.tsmiTrayWorkflows = new System.Windows.Forms.ToolStripMenuItem(); this.tsmiTrayTools = new System.Windows.Forms.ToolStripMenuItem(); this.tsmiTrayColorPicker = new System.Windows.Forms.ToolStripMenuItem(); @@ -246,8 +248,10 @@ private void InitializeComponent() this.ucNews = new ShareX.NewsListControl(); this.pNews = new System.Windows.Forms.Panel(); this.btnCloseNews = new System.Windows.Forms.Button(); - this.tsmiTrayUploadText = new System.Windows.Forms.ToolStripMenuItem(); - this.tsmiTrayShortenURL = new System.Windows.Forms.ToolStripMenuItem(); + this.tsmiCopyMarkdownLink = new System.Windows.Forms.ToolStripMenuItem(); + this.tsmiCopyMarkdownImage = new System.Windows.Forms.ToolStripMenuItem(); + this.tsmiCopyMarkdownLinkedImage = new System.Windows.Forms.ToolStripMenuItem(); + this.tssCopy6 = new System.Windows.Forms.ToolStripSeparator(); ((System.ComponentModel.ISupportInitialize)(this.scMain)).BeginInit(); this.scMain.Panel1.SuspendLayout(); this.scMain.Panel2.SuspendLayout(); @@ -1044,11 +1048,15 @@ private void InitializeComponent() this.tsmiCopyForumImage, this.tsmiCopyForumLinkedImage, this.tssCopy4, + this.tsmiCopyMarkdownLink, + this.tsmiCopyMarkdownImage, + this.tsmiCopyMarkdownLinkedImage, + this.tssCopy5, this.tsmiCopyFilePath, this.tsmiCopyFileName, this.tsmiCopyFileNameWithExtension, this.tsmiCopyFolder, - this.tssCopy5}); + this.tssCopy6}); this.tsmiCopy.Image = global::ShareX.Properties.Resources.document_copy; this.tsmiCopy.Name = "tsmiCopy"; resources.ApplyResources(this.tsmiCopy, "tsmiCopy"); @@ -1515,6 +1523,13 @@ private void InitializeComponent() resources.ApplyResources(this.tsmiTrayUploadClipboard, "tsmiTrayUploadClipboard"); this.tsmiTrayUploadClipboard.Click += new System.EventHandler(this.tsbClipboardUpload_Click); // + // tsmiTrayUploadText + // + this.tsmiTrayUploadText.Image = global::ShareX.Properties.Resources.notebook; + this.tsmiTrayUploadText.Name = "tsmiTrayUploadText"; + resources.ApplyResources(this.tsmiTrayUploadText, "tsmiTrayUploadText"); + this.tsmiTrayUploadText.Click += new System.EventHandler(this.tsmiUploadText_Click); + // // tsmiTrayUploadURL // this.tsmiTrayUploadURL.Image = global::ShareX.Properties.Resources.drive; @@ -1529,6 +1544,13 @@ private void InitializeComponent() resources.ApplyResources(this.tsmiTrayUploadDragDrop, "tsmiTrayUploadDragDrop"); this.tsmiTrayUploadDragDrop.Click += new System.EventHandler(this.tsbDragDropUpload_Click); // + // tsmiTrayShortenURL + // + this.tsmiTrayShortenURL.Image = global::ShareX.Properties.Resources.edit_scale; + this.tsmiTrayShortenURL.Name = "tsmiTrayShortenURL"; + resources.ApplyResources(this.tsmiTrayShortenURL, "tsmiTrayShortenURL"); + this.tsmiTrayShortenURL.Click += new System.EventHandler(this.tsmiShortenURL_Click); + // // tsmiTrayWorkflows // this.tsmiTrayWorkflows.Image = global::ShareX.Properties.Resources.categories; @@ -1921,19 +1943,28 @@ private void InitializeComponent() this.btnCloseNews.UseVisualStyleBackColor = true; this.btnCloseNews.Click += new System.EventHandler(this.btnCloseNews_Click); // - // tsmiTrayUploadText + // tsmiCopyMarkdownLink // - this.tsmiTrayUploadText.Image = global::ShareX.Properties.Resources.notebook; - this.tsmiTrayUploadText.Name = "tsmiTrayUploadText"; - resources.ApplyResources(this.tsmiTrayUploadText, "tsmiTrayUploadText"); - this.tsmiTrayUploadText.Click += new System.EventHandler(this.tsmiUploadText_Click); + this.tsmiCopyMarkdownLink.Name = "tsmiCopyMarkdownLink"; + resources.ApplyResources(this.tsmiCopyMarkdownLink, "tsmiCopyMarkdownLink"); + this.tsmiCopyMarkdownLink.Click += new System.EventHandler(this.tsmiCopyMarkdownLink_Click); // - // tsmiTrayShortenURL + // tsmiCopyMarkdownImage // - this.tsmiTrayShortenURL.Image = global::ShareX.Properties.Resources.edit_scale; - this.tsmiTrayShortenURL.Name = "tsmiTrayShortenURL"; - resources.ApplyResources(this.tsmiTrayShortenURL, "tsmiTrayShortenURL"); - this.tsmiTrayShortenURL.Click += new System.EventHandler(this.tsmiShortenURL_Click); + this.tsmiCopyMarkdownImage.Name = "tsmiCopyMarkdownImage"; + resources.ApplyResources(this.tsmiCopyMarkdownImage, "tsmiCopyMarkdownImage"); + this.tsmiCopyMarkdownImage.Click += new System.EventHandler(this.tsmiCopyMarkdownImage_Click); + // + // tsmiCopyMarkdownLinkedImage + // + this.tsmiCopyMarkdownLinkedImage.Name = "tsmiCopyMarkdownLinkedImage"; + resources.ApplyResources(this.tsmiCopyMarkdownLinkedImage, "tsmiCopyMarkdownLinkedImage"); + this.tsmiCopyMarkdownLinkedImage.Click += new System.EventHandler(this.tsmiCopyMarkdownLinkedImage_Click); + // + // tssCopy6 + // + this.tssCopy6.Name = "tssCopy6"; + resources.ApplyResources(this.tssCopy6, "tssCopy6"); // // MainForm // @@ -2194,5 +2225,9 @@ private void InitializeComponent() private System.Windows.Forms.ToolStripMenuItem tsmiShortenURL; private System.Windows.Forms.ToolStripMenuItem tsmiTrayUploadText; private System.Windows.Forms.ToolStripMenuItem tsmiTrayShortenURL; + private System.Windows.Forms.ToolStripMenuItem tsmiCopyMarkdownLink; + private System.Windows.Forms.ToolStripMenuItem tsmiCopyMarkdownImage; + private System.Windows.Forms.ToolStripMenuItem tsmiCopyMarkdownLinkedImage; + private System.Windows.Forms.ToolStripSeparator tssCopy6; } } \ No newline at end of file diff --git a/ShareX/Forms/MainForm.cs b/ShareX/Forms/MainForm.cs index 70faf3bb2..d8a908fe5 100644 --- a/ShareX/Forms/MainForm.cs +++ b/ShareX/Forms/MainForm.cs @@ -600,6 +600,10 @@ private void UpdateContextMenu() tsmiCopyForumImage.Enabled = uim.SelectedItems.Any(x => x.IsImageURL && x.IsURLExist); tsmiCopyForumLinkedImage.Enabled = uim.SelectedItems.Any(x => x.IsImageURL && x.IsThumbnailURLExist); + tsmiCopyMarkdownLink.Enabled = uim.SelectedItems.Any(x => x.IsURLExist); + tsmiCopyMarkdownImage.Enabled = uim.SelectedItems.Any(x => x.IsImageURL); + tsmiCopyMarkdownLinkedImage.Enabled = uim.SelectedItems.Any(x => x.IsImageURL && x.IsThumbnailURLExist); + tsmiCopyFilePath.Enabled = uim.SelectedItems.Any(x => x.IsFilePathValid); tsmiCopyFileName.Enabled = uim.SelectedItems.Any(x => x.IsFilePathValid); tsmiCopyFileNameWithExtension.Enabled = uim.SelectedItems.Any(x => x.IsFilePathValid); @@ -609,7 +613,7 @@ private void UpdateContextMenu() if (Program.Settings.ClipboardContentFormats != null && Program.Settings.ClipboardContentFormats.Count > 0) { - tssCopy5.Visible = true; + tssCopy6.Visible = true; foreach (ClipboardFormat cf in Program.Settings.ClipboardContentFormats) { @@ -655,11 +659,11 @@ private void UpdateContextMenu() private void CleanCustomClipboardFormats() { - tssCopy5.Visible = false; + tssCopy6.Visible = false; - int tssCopy5Index = tsmiCopy.DropDownItems.IndexOf(tssCopy5); + int tssCopy6Index = tsmiCopy.DropDownItems.IndexOf(tssCopy6); - while (tssCopy5Index < tsmiCopy.DropDownItems.Count - 1) + while (tssCopy6Index < tsmiCopy.DropDownItems.Count - 1) { using (ToolStripItem tsi = tsmiCopy.DropDownItems[tsmiCopy.DropDownItems.Count - 1]) { @@ -1883,6 +1887,21 @@ private void tsmiCopyForumLinkedImage_Click(object sender, EventArgs e) uim.CopyForumLinkedImage(); } + private void tsmiCopyMarkdownLink_Click(object sender, EventArgs e) + { + uim.CopyMarkdownLink(); + } + + private void tsmiCopyMarkdownImage_Click(object sender, EventArgs e) + { + uim.CopyMarkdownImage(); + } + + private void tsmiCopyMarkdownLinkedImage_Click(object sender, EventArgs e) + { + uim.CopyMarkdownLinkedImage(); + } + private void tsmiCopyFilePath_Click(object sender, EventArgs e) { uim.CopyFilePath(); diff --git a/ShareX/Forms/MainForm.resx b/ShareX/Forms/MainForm.resx index f0685e333..95f17fde5 100644 --- a/ShareX/Forms/MainForm.resx +++ b/ShareX/Forms/MainForm.resx @@ -159,45 +159,6 @@ 0 - - Filename - - - 150 - - - Status - - - Progress - - - 125 - - - Speed - - - 75 - - - Elapsed - - - 45 - - - Remaining - - - 45 - - - URL - - - 145 - Fill @@ -294,12 +255,105 @@ 4 + + Filename + + + 150 + + + Status + + + Progress + + + 125 + + + Speed + + + 75 + + + Elapsed + + + 45 + + + Remaining + + + 45 + + + URL + + + 145 + Bottom, Right True + + pbPatreonOpen + + + System.Windows.Forms.PictureBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + flpPatreon + + + 0 + + + pbPatreonHide + + + System.Windows.Forms.PictureBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + flpPatreon + + + 1 + + + 613, 378 + + + 215, 45 + + + 3 + + + False + + + False + + + flpPatreon + + + System.Windows.Forms.FlowLayoutPanel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + $this + + + 3 + + + 567, 17 + 0, 0 @@ -315,9 +369,6 @@ 0 - - 567, 17 - Open ShareX Patreon campaign web page @@ -363,33 +414,6 @@ 1 - - 613, 378 - - - 215, 45 - - - 3 - - - False - - - False - - - flpPatreon - - - System.Windows.Forms.FlowLayoutPanel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - $this - - - 3 - 17, 17 @@ -399,6 +423,42 @@ Left + + 0, 0 + + + 6, 6, 6, 6 + + + 160, 429 + + + 1 + + + tsMain + + + ShareX.HelpersLib.ToolStripBorderRight, ShareX.HelpersLib, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + + + $this + + + 5 + + + MiddleLeft + + + Magenta + + + 147, 20 + + + Capture + 191, 22 @@ -477,17 +537,17 @@ Auto capture... - + MiddleLeft - + Magenta - + 147, 20 - - Capture + + Upload 203, 22 @@ -531,18 +591,6 @@ Shorten URL... - - MiddleLeft - - - Magenta - - - 147, 20 - - - Upload - BottomLeft @@ -555,6 +603,18 @@ Workflows + + MiddleLeft + + + Magenta + + + 147, 20 + + + Tools + 184, 22 @@ -645,18 +705,6 @@ Monitor test... - - MiddleLeft - - - Magenta - - - 147, 20 - - - Tools - 147, 6 @@ -684,6 +732,18 @@ After upload tasks + + MiddleLeft + + + Magenta + + + 147, 20 + + + Destinations + 187, 22 @@ -723,18 +783,6 @@ Destination settings... - - MiddleLeft - - - Magenta - - - 147, 20 - - - Destinations - MiddleLeft @@ -822,6 +870,18 @@ News + + MiddleLeft + + + Magenta + + + 147, 20 + + + Debug + 172, 22 @@ -858,18 +918,6 @@ Test URL sharing - - MiddleLeft - - - Magenta - - - 147, 20 - - - Debug - MiddleLeft @@ -894,30 +942,6 @@ About... - - 0, 0 - - - 6, 6, 6, 6 - - - 160, 429 - - - 1 - - - tsMain - - - ShareX.HelpersLib.ToolStripBorderRight, ShareX.HelpersLib, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null - - - $this - - - 5 - 286, 17 @@ -933,60 +957,6 @@ Stop upload - - Enter - - - 173, 22 - - - URL - - - 173, 22 - - - Shortened URL - - - 173, 22 - - - Thumbnail URL - - - 173, 22 - - - Deletion URL - - - 170, 6 - - - Ctrl+Enter - - - 173, 22 - - - File - - - Shift+Enter - - - 173, 22 - - - Folder - - - 173, 22 - - - Thumbnail file - 228, 22 @@ -1104,6 +1074,27 @@ 230, 6 + + 233, 22 + + + Markdown link + + + 233, 22 + + + Markdown image + + + 233, 22 + + + Markdown linked image + + + 230, 6 + Ctrl+Shift+C @@ -1131,10 +1122,10 @@ Folder - + 230, 6 - + False @@ -1251,6 +1242,75 @@ Hide columns + + 228, 22 + + + Image preview + + + 229, 472 + + + cmsTaskInfo + + + System.Windows.Forms.ContextMenuStrip, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Enter + + + 173, 22 + + + URL + + + 173, 22 + + + Shortened URL + + + 173, 22 + + + Thumbnail URL + + + 173, 22 + + + Deletion URL + + + 170, 6 + + + Ctrl+Enter + + + 173, 22 + + + File + + + Shift+Enter + + + 173, 22 + + + Folder + + + 173, 22 + + + Thumbnail file + 130, 22 @@ -1269,27 +1329,30 @@ Automatic - - 228, 22 - - - Image preview - - - 229, 450 - - - cmsTaskInfo - - - System.Windows.Forms.ContextMenuStrip, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - 105, 17 190, 17 + + 193, 484 + + + cmsTray + + + System.Windows.Forms.ContextMenuStrip, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + ShareX + + + 192, 22 + + + Capture + 191, 22 @@ -1368,11 +1431,11 @@ Auto capture... - + 192, 22 - - Capture + + Upload 203, 22 @@ -1416,18 +1479,18 @@ Shorten URL... - - 192, 22 - - - Upload - 192, 22 Workflows + + 192, 22 + + + Tools + 184, 22 @@ -1518,12 +1581,6 @@ Monitor test... - - 192, 22 - - - Tools - 189, 6 @@ -1539,6 +1596,12 @@ After upload tasks + + 192, 22 + + + Destinations + 187, 22 @@ -1578,12 +1641,6 @@ Destination settings... - - 192, 22 - - - Destinations - 192, 22 @@ -1629,6 +1686,12 @@ Image history... + + 192, 22 + + + Debug + 172, 22 @@ -1665,12 +1728,6 @@ Test URL sharing - - 192, 22 - - - Debug - 192, 22 @@ -1713,21 +1770,12 @@ Exit - - 193, 506 - - - cmsTray - - - System.Windows.Forms.ContextMenuStrip, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - ShareX - 405, 17 + + 567, 17 + Fill @@ -1755,21 +1803,6 @@ 1 - - Bottom, Right - - - 560, 400 - - - 91, 23 - - - 5 - - - Close - btnCloseNews @@ -1809,6 +1842,33 @@ 2 + + Bottom, Right + + + 560, 400 + + + 91, 23 + + + 5 + + + Close + + + btnCloseNews + + + System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + pNews + + + 0 + True @@ -2721,6 +2781,12 @@ System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + tsmiTrayUploadText + + + System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + tsmiTrayUploadURL @@ -2733,6 +2799,12 @@ System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + tsmiTrayShortenURL + + + System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + tsmiTrayWorkflows @@ -3045,18 +3117,30 @@ System.Windows.Forms.ToolTip, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - tsmiTrayUploadText + + tsmiCopyMarkdownLink - + System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - tsmiTrayShortenURL + + tsmiCopyMarkdownImage - + System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + tsmiCopyMarkdownLinkedImage + + + System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + tssCopy6 + + + System.Windows.Forms.ToolStripSeparator, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + MainForm diff --git a/ShareX/UploadInfoManager.cs b/ShareX/UploadInfoManager.cs index af64c436d..de83c0384 100644 --- a/ShareX/UploadInfoManager.cs +++ b/ShareX/UploadInfoManager.cs @@ -229,6 +229,21 @@ public void CopyForumLinkedImage() if (IsItemSelected) CopyTexts(SelectedItems.Where(x => x.IsImageURL && x.IsThumbnailURLExist).Select(x => parser.Parse(x.Info, UploadInfoParser.ForumLinkedImage))); } + public void CopyMarkdownLink() + { + if (IsItemSelected) CopyTexts(SelectedItems.Where(x => x.IsURLExist).Select(x => parser.Parse(x.Info, UploadInfoParser.MarkdownLink))); + } + + public void CopyMarkdownImage() + { + if (IsItemSelected) CopyTexts(SelectedItems.Where(x => x.IsImageURL).Select(x => parser.Parse(x.Info, UploadInfoParser.MarkdownImage))); + } + + public void CopyMarkdownLinkedImage() + { + if (IsItemSelected) CopyTexts(SelectedItems.Where(x => x.IsImageURL && x.IsThumbnailURLExist).Select(x => parser.Parse(x.Info, UploadInfoParser.MarkdownLinkedImage))); + } + public void CopyFilePath() { if (IsItemSelected) CopyTexts(SelectedItems.Where(x => x.IsFilePathValid).Select(x => x.Info.FilePath)); diff --git a/ShareX/UploadInfoParser.cs b/ShareX/UploadInfoParser.cs index 1a69562a9..c0b30ee6d 100644 --- a/ShareX/UploadInfoParser.cs +++ b/ShareX/UploadInfoParser.cs @@ -31,13 +31,16 @@ namespace ShareX public class UploadInfoParser : NameParser { public const string HTMLLink = "$url"; - public const string HTMLImage = ""; - public const string HTMLLinkedImage = ""; + public const string HTMLImage = ""; + public const string HTMLLinkedImage = ""; public const string ForumLink = "[url]$url[/url]"; public const string ForumImage = "[img]$url[/img]"; public const string ForumLinkedImage = "[url=$url][img]$thumbnailurl[/img][/url]"; public const string WikiImage = "[$url]"; public const string WikiLinkedImage = "[$url $thumbnailurl]"; + public const string MarkdownLink = "[$url]($url)"; + public const string MarkdownImage = "![]($url)"; + public const string MarkdownLinkedImage = "[![]($thumbnailurl)]($url)"; public string Parse(TaskInfo info, string pattern) {