On Sunday, April 23, 2023 at 7:06:36 AM UTC-4 Edward K. Ream wrote:

On Saturday, April 22, 2023 at 4:51:13 PM UTC-5 Edward K. Ream wrote:


Iirc, the lack of identifying data with the 0xfffc character was why I 
abandoned this project years ago. It would be natural to allow body text to 
contain more than one image. Ordinary editing operations could change the 
order in which those images appear (or, as you say, delete images).

You're correct, Leo could use uAs to associate images with 0xfffc 
characters *initially*, but I see no good (easy) way of *maintaining *those 
associations after *all* of Leo's editing operations.


I've just reread Thomas's comment 
<https://github.com/leo-editor/leo-editor/issues/3256#issuecomment-1499892716> 
in 
#3256. It suggests using the @image directive. Leo already supports this 
directive. Instead, Leo could support a new *@embedded-image* directive. 
This directive would specify a path to an image file in the usual way 
(relative to the outline, with support for @path, etc.).

This plan should work:

- When loading/reloading the body pane, Leo would scan for @embedded-image 
directives and add the "magic byte" for Qt.
- Leo's *onBodyChanged* event handler would do the same.

In short, Leo could easily update the correspondence between magic bytes 
and images. There is no need for uAs.


uAs would avoid the need to put an image file in another directory, where 
it could get separated from the outline.  This separation (and a need for 
uAs) could be avoided if we had an archive format for Leo outlines.  Maybe 
images could be cached so they would reload faster while Leo has the 
outline open.

As for the magic byte, Qt is going to put it there when the image is 
inserted, and that byte is going to be associated with a private bitmap 
stored invisibly by Qt outside of the text content.  So these bytes will 
need to be managed on every reload.

We would also want to make sure that the image does not get re-inserted 
unless the magic byte becomes moved away from the position of the 
*@embedded-image* directive.  Otherwise I suspect that the latency after a 
few keystrokes would become annoying, especially if a node contained 
several images.

-- 
You received this message because you are subscribed to the Google Groups 
"leo-editor" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/leo-editor/4a792613-ea08-431f-92ad-ef58ef23a8adn%40googlegroups.com.

Reply via email to