asciidocfx / AsciidocFX

Asciidoc Editor and Toolchain written with JavaFX 21 (Build PDF, Epub, Mobi and HTML books, documents and slides)
http://www.asciidocfx.com/
Apache License 2.0
1.86k stars 296 forks source link

Use imagesdir when pasting images #567

Open widle opened 1 year ago

widle commented 1 year ago

When pasting images from clipboard, it would be nice to look if the imagesdir attribute is set. If it is, the image should be placed in that directory and the link adjusted accordingly.

Alternatively, setting the pasting directory manually (somewhere in the settings) could work too.

Discussed in https://github.com/asciidocfx/AsciidocFX/discussions/564

Originally posted by **widle** September 22, 2022 Hello, I have a question about the feature that allows pasting an image from clipboard to the doc (#219). Is there a way to set up the target directory? It seems to automatically paste to /images and also appends images/ to the path pasted in the document, but that only works if the image directory is the default one (same as the doc). I'd like to set an imagesdir for my document and paste into that, but setting the attribute does not change the pasting behaviour. I have found the setting to change the generated image name, but not the folder. Am I missing something, or is it not implemented?
rahmanusta commented 1 year ago

Hi, I implemented the feature. I hope it works as you expected. You can test it here https://github.com/asciidocfx/AsciidocFX/releases/tag/v1.8.4

widle commented 1 year ago

Hello and thank you. I am trying out the feature now and it's looking good, the image is pasted in the correct directory and displayed in the document.

I am wondering about the inserted path, though. It is relative to the document, as it was before, but I am thinking that maybe a path relative to the image directory (i. e. none) would make more sense here. So that the path doesn't need to be repeated with each image.

Both paths seem to work fine, it is just a matter of convenience. What do you think?