Skip to content

Commit

Permalink
if user selected content of the mail, pass only selected content to i…
Browse files Browse the repository at this point in the history
…ngo. if nothing was selected, pass the entire mail text to ingo. issue #2395
  • Loading branch information
j-dimension committed Aug 7, 2024
1 parent 88b1059 commit 98f0a67
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -2117,13 +2117,16 @@ public List<InputData> 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"
+ "})()");

Expand Down

0 comments on commit 98f0a67

Please sign in to comment.