Giter Site home page Giter Site logo

Comments (7)

jbridgy avatar jbridgy commented on September 26, 2024 1

I confirm that new feature works as desired in MM v3.3.2. Thank you!

from markdownmonster.

RickStrahl avatar RickStrahl commented on September 26, 2024

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:

  • If you copy the link text in HTML
    • HTML Clipboard with the full href link (ie. link and text that can be parsed)
    • Text with just the link text
  • If you Copy Link Address from context menu
    • Html is null
    • Link Address

So, I could check for HTML on the clipboard and if it follows the plain link pattern extract the link and use the text.

from markdownmonster.

jbridgy avatar jbridgy commented on September 26, 2024

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.

from markdownmonster.

RickStrahl avatar RickStrahl commented on September 26, 2024

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 ๐Ÿ˜„ 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...

from markdownmonster.

RickStrahl avatar RickStrahl commented on September 26, 2024

Added:

PasteLinkHtml

from markdownmonster.

jbridgy avatar jbridgy commented on September 26, 2024

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?

from markdownmonster.

RickStrahl avatar RickStrahl commented on September 26, 2024

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.

from markdownmonster.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.