I'm creating simple editor in Java FX using codemirror.js library. I embeded codemirror editor in javafx using javafx.scene.web.WebView component, with the folowing html/js code:
<body>
<form>
<textarea id="code" name="code">
</textarea>
</form>
<script>
var editor = CodeMirror.fromTextArea(document.getElementById("code"), { lineNumbers: true});
</script>
</body>
Codemirror editor itself supports undo, redo, cut, copy and paste.
I have also javafx main menue in my application and I want to add actions like copy or paste to it. I want to somehow "bind" this menue actions with my codemirror editor, so if user click e.g. paste from main menue, the content from clipboard will be added to the codemirror editor.
I solved this problem for undo and redo operations: codemirror has two js functions undo() and redo() and I can invoke they from java level via javafx.scene.web.WebView.executeScript method.
My question is how to handle cut, copy and paste operations? How to bind this operations from main menue with codemirror editor? I can't find any js functions in codemirror.js that can handle this oprations.
Any help appreciated and thanks in advance.