From 98f0a677178ec9801d982a2607123cfca0384879 Mon Sep 17 00:00:00 2001 From: j-dimension Date: Wed, 7 Aug 2024 23:06:54 +0200 Subject: [PATCH] if user selected content of the mail, pass only selected content to ingo. if nothing was selected, pass the entire mail text to ingo. issue #2395 --- .../com/jdimension/jlawyer/client/mail/MailContentUI.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/j-lawyer-client/src/com/jdimension/jlawyer/client/mail/MailContentUI.java b/j-lawyer-client/src/com/jdimension/jlawyer/client/mail/MailContentUI.java index 6547c121b..bf18271e7 100755 --- a/j-lawyer-client/src/com/jdimension/jlawyer/client/mail/MailContentUI.java +++ b/j-lawyer-client/src/com/jdimension/jlawyer/client/mail/MailContentUI.java @@ -2117,13 +2117,16 @@ public List getInputs(AiCapability c) { WebViewRegister reg = WebViewRegister.getInstance(); WebView webView1 = reg.get(webViewId); - Object selection = webView1.getEngine().executeScript("(function getSelectionText() {\n" + Object selection = webView1.getEngine().executeScript("(function getSelectionText() {\n" + " var text = \"\";\n" + " if (window.getSelection) {\n" + " text = window.getSelection().toString();\n" + " } else if (document.selection && document.selection.type != \"Control\") {\n" + " text = document.selection.createRange().text;\n" + " }\n" + + " if (text === \"\") {\n" + + " text = document.body.innerText || document.body.textContent;\n" + + " }\n" + " return text;\n" + "})()");