Closed jbridgy closed 5 months ago
What are you doing exactly to capture the link to the clipboard?
Are you copying the Html link to the clipboard by selecting the Link text in the HTML?
What I see is:
So, I could check for HTML on the clipboard and if it follows the plain link pattern extract the link and use the text.
What is copied depends on the browser and on the context within the browser. For example when you copy a link in a webpage or a bookmark using Firefox then the clipboard contains a proper HTML link. However when you copy the URL from the URL bar then only the URL is captured. Edge always copies just the URL regardless of the context. So yes, you have to check whether the clipboard contains HTML or only plain text.
Yes I see - options too. I'm using Brave and it doesn't do the HTML linking, but Edge does. I might have turned this off because frankly that feature is really annoying as it causes some weird issues if you paste into an app that doesn't explicitly support the links (visual editors mainly).
Implementation is easy enough, but I'm not sure how useful this is. In 90% of cases you're going to be selecting some text, then press Ctrl-K to add the link. If you have selected text this type of pasting should not replace what was selected. It would only apply if you Ctrl-K with no selection which I can't remember EVER doing in any application :smile: Even if you don't do it, more frequently than not the title contains crap that's not really usable like the site name, or other context info that's not useful in a link.
Perfectly good example is the link text for this page:
Feature Request: Improve Embed Link dialog (
Ctrl+K
) when clipboard contains HTML link · Issue #1121
Probably not what you'd use for link text...
Added:
Yes I see - options too. I'm using Brave and it doesn't do the HTML linking, but Edge does. I might have turned this off because frankly that feature is really annoying as it causes some weird issues if you paste into an app that doesn't explicitly support the links (visual editors mainly).
To my vague understanding an app can copy data to the clipboard in multiple formats simultaneously. A HTML link is supposed to be copied in two formats. Firstly the URL should always be copied as plain text and secondly the full link (URL and description) could be copied as HTML text. Simple apps will see only the primary format if it is plain text, otherwise the clipboard appears empty to them. However, more complex apps like the apps of LibreOffice or Microsoft Office check for other formats.
... In 90% of cases you're going to be selecting some text, then press Ctrl-K to add the link.
The percentage of this use case varies greatly. I would say on average it makes about 75% for me and the absolute daily occurrence count is considerable.
If you have selected text this type of pasting should not replace what was selected. It would only apply if you Ctrl-K with no selection which I can't remember EVER doing in any application ?? Even if you don't do it, more frequently than not the title contains crap that's not really usable like the site name, or other context info that's not useful in a link.
I agree that the selected text should have higher priority than the link text in the HTML link. I also agree that the original link text sometimes needs to be adjusted, but usually it is easier to delete some parts you don't want than to type all the text you want. Furthermore often I use a bookmark that I want to keep anyway. So I clean its description before I copy the bookmark and paste it into a document of any type (not just Markdown).
Do you access the clipboard from C# or JavaScript?
The clipboard data comes from C# and I can get at the HTML (not supported directly, but I have clipboard helpers that get it as it's used for other things in MM - like Paste HTML as Markdown).
IAC, take a look in 3.3.2 - I think what's there now is good to go.
I confirm that new feature works as desired in MM v3.3.2. Thank you!
Browsers like Firefox and Google Chrome can copy HTML links to the clipboard. EXAMPLE:
<a href="https://markdownmonster.west-wind.com/">Markdown Monster: The Markdown Editor for Windows</a>
.When embedding a link using the button or
Ctrl+K
, MM currently pastes only the URL from the clipboard, but not the link text (description).Please enhance the 'Embed Link' dialog to detect HTML links in the clipboard and pre-fill both the 'Link Text' field and the 'Link' field properly. LibreOffice and Microsoft Office also preserve the full information when pasting a HTML link. This saves time and ensures accurate link embedding.