[BUG] Local images do not appear in preview pane
CompletedLocal image referencing only works with the preview pane if the image is in the same folder as the note that calls upon it. Seeing as how the editor even creates relative links based on where the image is located, I would consider it expected behaviour if the referenced image is `../../whatever.png`.
Absolute image references also seem to struggle, whether using `file://` links or full UNIX paths to the image.
It does not seem to make any difference if the image is located within the nvUltra folder, or if the image is located somewhere else on the disk.
I have created a test folder to make it easier for you to check the various types of image links.
-
There are a couple of things involved:
1. macOS restricts application access to files to those that are explicitly opened by the user. In this case, that means that access is limited to the folder and its contents. So `../../foo.png` won't work if it means that the image is outside of the root folder in a sandboxed application, regardless of how the preview is implemented.
2. Secondly, due to limitations with Apple's WKWebView, nvUltra uses a built-in webserver to drive the preview.
3. There is an error in your `Same folder` test. When you fix the image filename, it works properly for me.
4. The `Subfolder/Relative images` test works fine for me (again, assuming you open the root folder `test_images`)
Both of the first two factors mean that `file://` links won't work in the preview. But proper use of relative links are fine. When you drag an image to the editor, it should properly insert the relative path. Basically, if the image you reference is visible in the note list, it is accessible in the preview.
If you have an example where this is not the case, definitely let us know!
0 -
Oops, yeah I uploaded a slightly older version of tha test folder, with a broken image reference (the same folder one was meant to demonstrate a working example anyway). Well upon looking at the relative image today, I might have just run into an odd cache issue or something, having started out the test with the relative image *outside* of the main folder. It's working fine now after a fresh start.
Understood regarding sandboxing and absolute links. Is that going to be a limitation with the direct-sale version as well?
0 -
We have not decided exactly how nvUltra will be sold yet (App Store, direct, both, something else).
But again, it's a combination of points 1&2 that lead to the limitations, so these factors would affect all versions, until WKWebView functionality no longer requires a built-in web server. Then it *might* be feasible to change the underlying preview mechanism. Based on recent history, I wouldn't hold my breath waiting on Apple though.
0 -
I'll mark this as completed, but if you find a non-working example reach back out.
Thanks!
0
Please sign in to leave a comment.
Comments
4 comments