Skip to content

Store images locally when copied from the browser #2462

Open

Description

@hokutonanto

Is there a way to save an image copied from the browser locally to the hard drive?
The way I have Marktext setup at the moment is as follows:

image
image

But when I right-click on an image and choose copy, what's being copied is the URL to that image.
Even if I edit the image properties and click on EMBED image, the path still shows the original URL (in fact, the local folder containing my images only shows the images I added via say screengrab).

Activity

  1. JonasPf commented on Apr 15, 2022

    @JonasPf

    I'm having the same problem with version 0.17.1 and Firefox on OSX. IT does work if I first save the image to disk and then open it via Preview and copy&paste from there.

    Is this intended behaviour or a bug?

  2. JonasPf commented on Apr 17, 2022

    @JonasPf

    I did a bit of testing today. Turns out that an image copied from a browser (I tested both Firefox and Chrome) contains the corresponding html in the clipboard (<img alt=... src=...>) even when copied via right-click and Copy Image. This causes the code in pasteCtrl.js to go down the html route and saves only the html. When copying via a different program, the clipboard doesn't contain html and the normal image handler gets triggered.

    Imho, even when copying html, MarkText should adhere to the settings and save images locally. This probably means parsing the html and downloading all referenced images.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions