Back to LanguageTool Homepage - Privacy - Imprint

Is it possible to take the corrected text from the web form via java-script, for example, back to back into a database?


(Andreas Waaser) #1

Is it possible to take the corrected text from the web form via java-script,
for example, back to back into a database?


(Daniel Naber) #2

Not sure if I get your question, but the web form is just an enhanced textarea, you should be able to access it like any other textarea.


(Andreas Waaser) #3

By Copy/Paste yes, but not via script,

The result is shown in an iframe full of HTML elements, as an overlay over the textarea.

I could remove the HTML elements in the Iframe content
But perhaps there is an easier way?


Paste your own text here... or check check this text.










Rich Text Area













(Daniel Naber) #4

I see - from inside the editor we use this to get the plain text (not sure how to call it from outside):

var textContent = plugin.editor.core.getPlainText();

You can also have a look at the sources here:

https://github.com/languagetool-org/languagetool-website/tree/master/www/online-check/tiny_mce/plugins/atd-tinymce/src


(Andreas Waaser) #5

this is working

var p = $("#checktext_ifr").contents().find("body p");
str = $(p).html();
var regex = /
/gi;
$(p).html(str.replace(regex,"\n"));
var t = $(p).text();
alert(t);