In my Delphi application, I have a TWebDocument that loads a document with a TextArea.
Here is the document content:
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<script src="file://c:/projects/tinymce/tinymce.min.js" referrerpolicy="origin"></script>
<script>tinymce.init({selector:'textarea'});</script>
</head>
<body>
<textarea id="texto">TEXT HERE</textarea>
</body>
</html>
I can get the text in the textarea with the following code:
Element := (wb1.Document as IHTMLDocument3).getElementById('texto');
Edit1.Text := Element.Value;
But how about if the user modifies the text in the textarea at runtime? How can I get the modified value?
Edit: It was because of tinyMCE script. So the real question is how to get the value from a TextArea in TWebBrowser if tinyMCE is active.
Well, answering my own question: I changed the tinymce.init to:
tinymce.init({
selector:'textarea',
setup: function (editor) {
editor.on('change', function () {
tinymce.triggerSave();
})
}
});