Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Result of the document content is not updated #12

Closed
chqu1012 opened this issue Nov 12, 2020 · 1 comment
Closed

Result of the document content is not updated #12

chqu1012 opened this issue Nov 12, 2020 · 1 comment

Comments

@chqu1012
Copy link

After editing some text in monacofx, I tried to get the result of the document, but for some times, it doesn't represents the whole text by calling Document#getText(). I added a another method to get the text value and this seems to work

public class Document{
...
    public String getValue() {
    	 return (String) editor.call("getValue");
    }
}

In some case this method wasn't called.

 window.setMember("contentChangeListener", new JFunction( args -> {

            String text = (String) editor.call("getValue");
            if(text!=null) {
                setText(text);
                numberOfLinesProperty.setValue(text.split("\\R").length);
            }
            return null;
        }));

@miho
Copy link
Owner

miho commented Mar 5, 2021

It looks like this issue is caused by this https://www.hissenit.com/javafx-webview-webkit-fehler-javascript-java-kommunikation-java-8-frank-hissen-it-blog.html

We will keep a reference to the callback function. this should fix the issue.

miho added a commit that referenced this issue Mar 5, 2021
@miho miho closed this as completed Mar 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants