<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:"Yu Gothic";
panose-1:2 11 4 0 0 0 0 0 0 0;}
@font-face
{font-family:Aptos;
panose-1:2 11 0 4 2 2 2 2 2 4;}
@font-face
{font-family:"Iosevka Fixed SS16";
panose-1:2 0 5 9 3 0 0 0 0 4;}
@font-face
{font-family:"Times New Roman \(Body CS\)";
panose-1:2 11 6 4 2 2 2 2 2 4;}
@font-face
{font-family:"\@Yu Gothic";
panose-1:2 11 4 0 0 0 0 0 0 0;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0in;
font-size:10.0pt;
font-family:"Aptos",sans-serif;}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}
span.EmailStyle21
{mso-style-type:personal-reply;
font-family:"Iosevka Fixed SS16";
color:windowtext;}
.MsoChpDefault
{mso-style-type:export-only;
font-size:10.0pt;
mso-ligatures:none;}
@page WordSection1
{size:8.5in 11.0in;
margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
{page:WordSection1;}
--></style>
</head>
<body lang="EN-US" link="blue" vlink="purple" style="word-wrap:break-word">
<div class="WordSection1">
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Iosevka Fixed SS16"">Hi,<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Iosevka Fixed SS16""><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Iosevka Fixed SS16"">Please create a self-contained code example (SCCE) illustrating the issue.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Iosevka Fixed SS16""><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Iosevka Fixed SS16"">Thanks!
<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Iosevka Fixed SS16""><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Iosevka Fixed SS16"">-andy<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Iosevka Fixed SS16""><o:p> </o:p></span></p>
<div id="mail-editor-reference-message-container">
<div>
<div style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal" style="margin-bottom:12.0pt"><b><span style="font-size:12.0pt;color:black">From:
</span></b><span style="font-size:12.0pt;color:black">openjfx-discuss <openjfx-discuss-retn@openjdk.org> on behalf of Tom Eugelink <tbee@tbee.org><br>
<b>Date: </b>Wednesday, July 24, 2024 at 11:56<br>
<b>To: </b>openjfx-discuss@openjdk.org <openjfx-discuss@openjdk.org><br>
<b>Subject: </b>Re: HTMLEditor customization<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:12.0pt">insertHTML has the same peculiar behavior. <o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:12.0pt"><o:p> </o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:12.0pt">I've added a button to the toolbar that calls insertHTML/insertImage with an embedded image.<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:12.0pt">- click at the end of the html, click button: call is unsuccessful (returns false)<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:12.0pt">- click at the end of the html, click button: call is successful (returns true, image is added)<o:p></o:p></span></p>
</div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:12.0pt">- click at the end of the html, click button: call is unsuccessful (returns false)<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:12.0pt">- click at the end of the html, click button: call is successful (returns true, image is added)<o:p></o:p></span></p>
</div>
<p class="MsoNormal"><span style="font-size:12.0pt">... <o:p></o:p></span></p>
<div>
<p class="MsoNormal"><span style="font-size:12.0pt"><o:p> </o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:12.0pt">It does not matter if it is an img-tag or a p-tag or whatever, the alternating behavior is the same. Also multiple clicks make no difference, all of them either fail or succeed, it is the regaining of the
focus of the WebPage that makes the difference. It can be any component that the focus is lost to, but webview.requestFocus is not enough (it does not really place the focus back to the webpage, e.g. the toolbar buttons stay disabled).<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:12.0pt"><o:p> </o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:12.0pt">Interestingly, when the insert*-commands succeed, the webpage.getHtml call returns an empty string, and when they fail you get the actual HTML. But for the rest none of the webPage methods make a difference.<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:12.0pt"><o:p> </o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:12.0pt">It would be nice to understand why the wrapped browser alternates between two states.<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:12.0pt"><o:p> </o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:12.0pt"><o:p> </o:p></span></p>
</div>
</div>
<div>
<p class="MsoNormal"><span style="font-size:12.0pt"><o:p> </o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:12.0pt">On 2024-07-24 09:15, Tom Eugelink wrote:<o:p></o:p></span></p>
</div>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<div>
<p class="MsoNormal"><span style="font-size:12.0pt">Apparently I had checked out an old repository where that code was missing. Should have looked again in the URL before posting.<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:12.0pt"><o:p> </o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:12.0pt">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).
<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:12.0pt"><o:p> </o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:12.0pt">I'll give the insertHtml command a try.<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:12.0pt"><o:p> </o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:12.0pt"><o:p> </o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:12.0pt">On 2024-07-22 17:27, Andy Goryachev wrote:<o:p></o:p></span></p>
</div>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<div>
<p style="margin:0in;background:white"><span style="font-family:"Iosevka Fixed SS16";color:black">
</span><span style="font-family:"Iosevka Fixed SS16";color:#FF2600">/**</span><o:p></o:p></p>
<p style="margin:0in;background:white"><span style="font-family:"Iosevka Fixed SS16";color:#FF2600"> * Represents commands that can be passed into the HTMLEditor web engine.</span><o:p></o:p></p>
<p style="margin:0in;background:white"><span style="font-family:"Iosevka Fixed SS16";color:#FF2600"> */</span><o:p></o:p></p>
<p style="margin:0in;background:white"><span style="font-family:"Iosevka Fixed SS16";color:black">
</span><span style="font-family:"Iosevka Fixed SS16";color:#4E8F00">public</span><span style="font-family:"Iosevka Fixed SS16";color:black">
</span><span style="font-family:"Iosevka Fixed SS16";color:#4E8F00">enum</span><span style="font-family:"Iosevka Fixed SS16";color:black">
<span style="background:#D4D4D4">Command</span> {</span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Iosevka Fixed SS16""> </span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Iosevka Fixed SS16"">line 1167</span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Iosevka Fixed SS16""> </span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Iosevka Fixed SS16"">-andy</span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Iosevka Fixed SS16""> </span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Iosevka Fixed SS16""> </span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Iosevka Fixed SS16""> </span><o:p></o:p></p>
<div id="mail-editor-reference-message-container">
<div>
<div style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal" style="margin-bottom:12.0pt"><b><span style="font-size:12.0pt;color:black">From:
</span></b><span style="font-size:12.0pt;color:black">openjfx-discuss <a href="mailto:openjfx-discuss-retn@openjdk.org">
<openjfx-discuss-retn@openjdk.org></a> on behalf of Tom Eugelink <a href="mailto:tbee@tbee.org">
<tbee@tbee.org></a><br>
<b>Date: </b>Saturday, July 20, 2024 at 00:21<br>
<b>To: </b><a href="mailto:openjfx-discuss@openjdk.org">openjfx-discuss@openjdk.org</a>
<a href="mailto:openjfx-discuss@openjdk.org"><openjfx-discuss@openjdk.org></a><br>
<b>Subject: </b>Re: HTMLEditor customization</span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal" style="margin-bottom:12.0pt"><span style="font-size:11.0pt">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.<br>
<br>
The other approach would be to extend the HTMLEditor implementation, because why not? While investigating that approach I got confused:<br>
<a href="https://github.com/javafxports/openjdk-jfx/blob/develop/modules/javafx.web/src/main/java/javafx/scene/web/HTMLEditorSkin.java">https://github.com/javafxports/openjdk-jfx/blob/develop/modules/javafx.web/src/main/java/javafx/scene/web/HTMLEditorSkin.java</a><br>
import static javafx.scene.web.HTMLEditorSkin.Command.*;<br>
<br>
Where did the Command enum hide? It should be in the HTMLEditorSkin class?<br>
<br>
<br>
On 2024-07-19 07:37, Tom Eugelink wrote:<br>
> 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?<br>
><br>
> Because the vanilla version of the HTML editor is limited; no image support and all.<br>
><br>
> Regards, Tom<br>
><br>
></span><o:p></o:p></p>
</div>
</div>
</div>
</div>
</blockquote>
<p><o:p> </o:p></p>
</blockquote>
<p><o:p> </o:p></p>
</div>
</div>
</div>
</body>
</html>