On Wed, Oct 23, 2024 at 6:25 PM Thomas Passin <[email protected]> wrote:
I think many of us would like to be able to stick images into Leo nodes. > It's easy to insert one. You get the text cursor for the insertion point, > give it the image URL, and call insertImage(). The editor component will > let you cut and paste the image without any other code being written. > > For Leo nodes the main problem I see is how to restore the image when the > outline is saved and re-opened. To get a text representation of the > editor's contents, one calls toPlainText() on the editor. There is no image > encoded in the plain text, but Qt does insert a special marker character in > place. This unicode character will not be used in any normal text. On > save, we can add the image url for a marker right after it, perhaps like > this (using "x" to represent the marker): > > x[[image1.png]] > > When we want to reload the outline, we scan though the node, pick up these > markers, and remove the URL string, get the cursor for that position, and > use it to insert the image. > > The parts of this scheme that I have tested so far are to insert an image > and to observe the special marker character in the toPlainText() output. > The other steps seem doable, but you never know for sure until you get into > the details. > I remember doing exactly what you describe above several years ago. I gave up in frustration, but I don't remember why. Edward -- 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 visit https://groups.google.com/d/msgid/leo-editor/CAMF8tS0%3DMMKsNJozHg3peex4KdMQUKn08sCKk%2B4yKVmRB1g%3DoA%40mail.gmail.com.
