HTMLEditor customization
Tom Eugelink
tbee at tbee.org
Wed Jul 24 07:15:44 UTC 2024
Apparently I had checked out an old repository where that code was missing. Should have looked again in the URL before posting.
Anyhow, I've progressed to the point where I can insert an image using the W3C insertImage command. Works fine, but it is picky when it can be executed. However, the queryCommandEnabled does not return a correct value; the true or false does not actually match whether the insertImage command will succeed. The value is only correct after focus is moved out of the WebView, but that doesn't work practically (you can hardly bounce the focus after every keystroke).
I'll give the insertHtml command a try.
On 2024-07-22 17:27, Andy Goryachev wrote:
>
> /**
>
> * Represents commands that can be passed into the HTMLEditor web engine.
>
> */
>
> publicenumCommand {
>
> line 1167
>
> -andy
>
> *From: *openjfx-discuss <openjfx-discuss-retn at openjdk.org> on behalf of Tom Eugelink <tbee at tbee.org>
> *Date: *Saturday, July 20, 2024 at 00:21
> *To: *openjfx-discuss at openjdk.org <openjfx-discuss at openjdk.org>
> *Subject: *Re: HTMLEditor customization
>
> It seems those 10 year old hacks are not working anymore. All of the 'selection' objects in javascript appear to be either null, or unwilling to return a range.
>
> The other approach would be to extend the HTMLEditor implementation, because why not? While investigating that approach I got confused:
> https://github.com/javafxports/openjdk-jfx/blob/develop/modules/javafx.web/src/main/java/javafx/scene/web/HTMLEditorSkin.java
> import static javafx.scene.web.HTMLEditorSkin.Command.*;
>
> Where did the Command enum hide? It should be in the HTMLEditorSkin class?
>
>
> On 2024-07-19 07:37, Tom Eugelink wrote:
> > I was wondering; is the HTML editor still at the point where any customization is done by executing javascript code via the WebEngine? I find some 10 year old or so articles on how to insert things at the cursor position using that approach. And inserting additional buttons in the toolbar by finding it via its CSS class?
> >
> > Because the vanilla version of the HTML editor is limited; no image support and all.
> >
> > Regards, Tom
> >
> >
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/openjfx-discuss/attachments/20240724/937f1d5a/attachment.htm>
More information about the openjfx-discuss
mailing list