KnowZero / tinymce4-languagetool

Attempt to port Language Tool Spelling and Grammar Check to TinyMCE 4 [ALPHA/EXPIREMENTAL]
Apache License 2.0
21 stars 11 forks source link

Self Hosted LanguageServer #8

Closed acknowledgeHim closed 3 years ago

acknowledgeHim commented 4 years ago

Here is my setup:

Here are my issues:

  1. self hosted languagetool server says "ERROR org.languagetool.server.LanguageToolHttpHandler An error has occurred: 'Missing 'text' or 'data' parameter'" when this plugin tries to communicate with it. With my curl i pass it a 'text' parameter and it works great.
  2. when i type in text in the textarea with bad spelling i don't get the bottom bar that shows the # errors that i can click on to show the errors. likewise if i hit the spelling button and try to run i get this error: "Uncaught ReferenceError: lt_issueDialog is not defined" in javascript console

Any help pointing me to what i am doing wrong would be greatly appreciated.

Thanks!

KnowZero commented 4 years ago

A) By locally, are we talking about http://localhost or file:// ? cause browsers block some import methods on file://

B) When you are pointing it to your server, are you talking about through lt_url or did you modify the source?

C) If you can include a copy of your modifications and a copy of the trace log that might help

acknowledgeHim commented 4 years ago

Here is my code:

tinymce.init({
  selector: "textarea",
  toolbar: 'undo redo | languagetool',
  height: 100,
  lt_debug: 5,
  lt_lang: 'en-US',
  lt_mode: 'new_word',
  lt_highlight_click: 'right',
  lt_full_message: 0,
  lt_timer: 10000,
  lt_url: 'https://languagetool.org/api/v2/languages',
  lt_viewport_process: 'nearby',
  lt_show_progress_bar: true,

  plugins: ['code paste'],
  external_plugins: {
    'languagetool': 'https://knowzero.github.io/tinymce4-languagetool/languagetool/plugin.min.js'
  }
});

The textarea that gets the tinymce is in a div after the form is loaded from an ajax call. (main page edit icon hit -> ajax call to retrieve form and put retrieved form in a div which is displayed).

And here is how it looks on my page (nothing here works, no right-click, no markup, no progress bar indication): image

Here is your demo page (which shows the issues in the progress bar and correctly marks up wrong text and the right-click all work): image

I want it to apply to all textboxes. I do have my own languagetool server (can't get to work like this using languagetools' URL either) and figure once I get this working i will just change the lt_url to point to my local instance (https://).

jquery version: jQuery v3.5.1 tinymce version: 4.9.11

-------------------------- Update ----------------- So it almost works in Chrome. Status/progressbar works (although not always), and occasionally it underscores the problem but does not always do it (probably about 60% of the time). Firefox, the other browser I was testing it on ended up getting the progressbar to show but nothing actually worked. I tried my local (http://) languagetool server as well (using lt_url) and got the same results for each browser.

Thanks!

KnowZero commented 4 years ago

Okay, testing step by step to isolate the issue:

Changed jquery to 3.5.1: works Set textarea to selector for single instance: works toolbar - lang settings: works lt_mode new word: doesn't work on public instances, but will work on private server, this is intentional to prevent people from accidently using it and sending too much to the public server highlight - timer: works url change: failed - proper public url should be: https://languagetool.org/api/v2/check but you put "https://languagetool.org/api/v2/**languages**" which is the url to check for supported language. After fixing the url it works. lt_viewport_process seems to be working lt_progressbar seems to be flashing, so it doesn't work but it isn't breaking anything

So isolating those 2 variables, your issue is improper url and use of new word on public server.(I haven't tried private server cause I don't have it on this pc, try testing without it then when you get it working try using it)

Hope this helps

KnowZero commented 3 years ago

There has been no response for 2 months now so I am assuming the issue is fixed and closing the issue.