Code Monkey home page Code Monkey logo

tinymce4-languagetool's People

Contributors

knowzero avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

tinymce4-languagetool's Issues

Add/Ignore

I noticed that your plugin has an "Ignore" feature, which is nice.

However, when you refresh the page these settings seem to be lost. It would be valuable to me to have some kind of persistence for these settings. I have two ideas:

  1. LanguageTool's API supports adding words to a custom dictionary. Maybe this could be supported?
  2. Another option would be to use local storage.

There are advantages to each of them; maybe both a worthwhile. What do you think @KnowZero ?

Cannot read property 'insert' of undefined when status bar disabled

Hi,

When statusbar is disabled I have 2 errors:

Config:

tinymce.init({
        menubar:false,
        statusbar: false,
        selector: '#mytextarea',
        height: 300,
        lt_lang: 'pl',
        lt_mode: 'new_word',
        lt_highlight_click: 'right',

        plugins: ['code paste'],
        external_plugins: {
          languagetool: '/js/libs/languagetool/plugin.min.js'
        }
      });

Error 1:

Uncaught TypeError: Cannot read property 'insert' of undefined
    at plugin.min.js:197
    at LanguageTool.sgevent.init (languagetool.min.js:118)
    at Object.getEvent (languagetool.min.js:387)
    at Editor.<anonymous> (plugin.min.js:222)
    at Dispatcher.fire (tinymce.js:31460)
    at Editor.fire (tinymce.js:31700)
    at initEditor (tinymce.js:44882)
    at tinymce.js:45036
    at tinymce.js:7689
    at tinymce.js:7160
(anonymous) @ plugin.min.js:197
LanguageTool.sgevent.init @ languagetool.min.js:118
getEvent @ languagetool.min.js:387
(anonymous) @ plugin.min.js:222
fire @ tinymce.js:31460
fire @ tinymce.js:31700
initEditor @ tinymce.js:44882
(anonymous) @ tinymce.js:45036
(anonymous) @ tinymce.js:7689
(anonymous) @ tinymce.js:7160
setTimeout (async)
(anonymous) @ tinymce.js:7159
(anonymous) @ tinymce.js:7271
(anonymous) @ tinymce.js:7160
setTimeout (async)
(anonymous) @ tinymce.js:7159
(anonymous) @ tinymce.js:103
failed @ tinymce.js:7540

Error 2:

Uncaught TypeError: Cannot read property '$el' of undefined
    at plugin.min.js:191
    at lt_progress_bar (languagetool.min.js:1079)
    at languagetool.min.js:577
    at Function.grep (jquery.js:432)
    at Array.<anonymous> (languagetool.min.js:550)
    at Function.each (jquery.js:362)
    at lt_timer_func (languagetool.min.js:549)
(anonymous) @ plugin.min.js:191
lt_progress_bar @ languagetool.min.js:1079
(anonymous) @ languagetool.min.js:577
grep @ jquery.js:432
(anonymous) @ languagetool.min.js:550
each @ jquery.js:362
lt_timer_func @ languagetool.min.js:549
setTimeout (async)
lt_timer @ languagetool.min.js:915
lt_timer_func @ languagetool.min.js:756
setTimeout (async)
lt_timer @ languagetool.min.js:915
lt_timer_func @ languagetool.min.js:756
setTimeout (async)
lt_timer @ languagetool.min.js:915
lt_timer_func @ languagetool.min.js:756
setTimeout (async)
lt_timer @ languagetool.min.js:915
lt_timer_func @ languagetool.min.js:756
setTimeout (async)
lt_timer @ languagetool.min.js:915
lt_timer_func @ languagetool.min.js:756
setTimeout (async)
lt_timer @ languagetool.min.js:915
lt_timer_func @ languagetool.min.js:756
setTimeout (async)
lt_timer @ languagetool.min.js:915
lt_timer_func @ languagetool.min.js:756
setTimeout (async)
lt_timer @ languagetool.min.js:915
lt_timer_func @ languagetool.min.js:756
setTimeout (async)
lt_timer @ languagetool.min.js:915
lt_timer_func @ languagetool.min.js:756
setTimeout (async)
lt_timer @ languagetool.min.js:915
lt_timer_func @ languagetool.min.js:756
setTimeout (async)
lt_timer @ languagetool.min.js:915
lt_timer_func @ languagetool.min.js:756
setTimeout (async)
lt_timer @ languagetool.min.js:915
lt_timer_func @ languagetool.min.js:756
setTimeout (async)
lt_timer @ languagetool.min.js:915
lt_timer_func @ languagetool.min.js:756
setTimeout (async)
lt_timer @ languagetool.min.js:915
lt_timer_func @ languagetool.min.js:756
setTimeout (async)
lt_timer @ languagetool.min.js:915
lt_timer_func @ languagetool.min.js:756
setTimeout (async)
lt_timer @ languagetool.min.js:915
lt_timer_func @ languagetool.min.js:756
setTimeout (async)
lt_timer @ languagetool.min.js:915
lt_timer_func @ languagetool.min.js:756
setTimeout (async)
lt_timer @ languagetool.min.js:915
lt_timer_func @ languagetool.min.js:756
setTimeout (async)
lt_timer @ languagetool.min.js:915
lt_timer_func @ languagetool.min.js:756
setTimeout (async)
lt_timer @ languagetool.min.js:915
lt_timer_func @ languagetool.min.js:756
setTimeout (async)
lt_timer @ languagetool.min.js:915
lt_timer_func @ languagetool.min.js:756
setTimeout (async)
lt_timer @ languagetool.min.js:915
lt_timer_func @ languagetool.min.js:756
setTimeout (async)
lt_timer @ languagetool.min.js:915
lt_timer_func @ languagetool.min.js:756
setTimeout (async)
lt_timer @ languagetool.min.js:915
lt_timer_func @ languagetool.min.js:756
setTimeout (async)
lt_timer @ languagetool.min.js:915
lt_timer_func @ languagetool.min.js:756
setTimeout (async)
lt_timer @ languagetool.min.js:915
lt_timer_func @ languagetool.min.js:756
setTimeout (async)
lt_timer @ languagetool.min.js:915
lt_timer_func @ languagetool.min.js:756
setTimeout (async)
lt_timer @ languagetool.min.js:915
lt_timer_func @ languagetool.min.js:756
setTimeout (async)
lt_timer @ languagetool.min.js:915
lt_timer_func @ languagetool.min.js:756
setTimeout (async)
lt_timer @ languagetool.min.js:915
lt_timer_func @ languagetool.min.js:756
setTimeout (async)
lt_timer @ languagetool.min.js:915
lt_timer_func @ languagetool.min.js:756
setTimeout (async)
lt_timer @ languagetool.min.js:915
lt_timer_func @ languagetool.min.js:756

Cannot read property '$el' of undefined after Tinymce editor instance remove()

Hi,

I have angular-ui-router (this is router by frontend side). After leave page with tinymce editor I have to remove all ckeditor instances. And after second tinymce.init I have an error

Config:

tinymce.init({
      height: 150,
      lt_highlight_click: 'right',
      lt_lang: 'pl',
      lt_mode: 'new_word',
      menubar: false,
      selector: '#' + textarea.id,
      type: 'text',
      // statusbar: false,
      toolbar: false,

      external_plugins: {
        languagetool: '/js/libs/languagetool/plugin.min.js'
      }
    });

On page leave:

$onDestroy() {

      element('#fb-render textarea').each((index, textarea) => {
        tinymce.get(textarea.id).remove();
      })
    }

(It should remove all tinymce instances and it does)

After going back to the page it should call tinymce.init again

tinymce.init({
      height: 150,
      lt_highlight_click: 'right',
      lt_lang: 'pl',
      lt_mode: 'new_word',
      menubar: false,
      selector: '#' + textarea.id,
      type: 'text',
      // statusbar: false,
      toolbar: false,

      external_plugins: {
        languagetool: '/js/libs/languagetool/plugin.min.js'
      }
    });

But after second initialization I have an error:

Uncaught TypeError: Cannot read property '$el' of undefined
    at plugin.min.js:191
    at lt_progress_bar (languagetool.min.js:1079)
    at languagetool.min.js:577
    at Function.grep (jquery.js:432)
    at Array.<anonymous> (languagetool.min.js:550)
    at Function.each (jquery.js:362)
    at lt_timer_func (languagetool.min.js:549)
(anonymous) @ plugin.min.js:191
lt_progress_bar @ languagetool.min.js:1079
(anonymous) @ languagetool.min.js:577
grep @ jquery.js:432
(anonymous) @ languagetool.min.js:550
each @ jquery.js:362
lt_timer_func @ languagetool.min.js:549
setTimeout (async)
lt_timer @ languagetool.min.js:915
lt_timer_func @ languagetool.min.js:756
setTimeout (async)
lt_timer @ languagetool.min.js:915
lt_timer_func @ languagetool.min.js:756
setTimeout (async)
lt_timer @ languagetool.min.js:915
lt_timer_func @ languagetool.min.js:756
setTimeout (async)
lt_timer @ languagetool.min.js:915
lt_timer_func @ languagetool.min.js:756
setTimeout (async)
lt_timer @ languagetool.min.js:915
lt_timer_func @ languagetool.min.js:756
setTimeout (async)
lt_timer @ languagetool.min.js:915
lt_timer_func @ languagetool.min.js:756
setTimeout (async)
lt_timer @ languagetool.min.js:915
lt_timer_func @ languagetool.min.js:756
setTimeout (async)
lt_timer @ languagetool.min.js:915
lt_timer_func @ languagetool.min.js:756
setTimeout (async)
lt_timer @ languagetool.min.js:915
lt_timer_func @ languagetool.min.js:756
setTimeout (async)
lt_timer @ languagetool.min.js:915
lt_timer_func @ languagetool.min.js:756
setTimeout (async)
lt_timer @ languagetool.min.js:915
lt_timer_func @ languagetool.min.js:756
setTimeout (async)
lt_timer @ languagetool.min.js:915
lt_timer_func @ languagetool.min.js:756
setTimeout (async)
lt_timer @ languagetool.min.js:915
lt_timer_func @ languagetool.min.js:756
setTimeout (async)
lt_timer @ languagetool.min.js:915
lt_timer_func @ languagetool.min.js:756
setTimeout (async)
lt_timer @ languagetool.min.js:915
lt_timer_func @ languagetool.min.js:756
setTimeout (async)
lt_timer @ languagetool.min.js:915
lt_timer_func @ languagetool.min.js:756
setTimeout (async)
lt_timer @ languagetool.min.js:915
lt_timer_func @ languagetool.min.js:756
setTimeout (async)
lt_timer @ languagetool.min.js:915
lt_timer_func @ languagetool.min.js:756
setTimeout (async)
lt_timer @ languagetool.min.js:915
lt_timer_func @ languagetool.min.js:756
setTimeout (async)
lt_timer @ languagetool.min.js:915
lt_timer_func @ languagetool.min.js:756
setTimeout (async)
lt_timer @ languagetool.min.js:915
lt_timer_func @ languagetool.min.js:756
setTimeout (async)
lt_timer @ languagetool.min.js:915
lt_timer_func @ languagetool.min.js:756
setTimeout (async)
lt_timer @ languagetool.min.js:915
lt_timer_func @ languagetool.min.js:756
setTimeout (async)
lt_timer @ languagetool.min.js:915
lt_timer_func @ languagetool.min.js:756
setTimeout (async)
lt_timer @ languagetool.min.js:915
lt_timer_func @ languagetool.min.js:756
setTimeout (async)
lt_timer @ languagetool.min.js:915
lt_timer_func @ languagetool.min.js:756
setTimeout (async)
lt_timer @ languagetool.min.js:915
lt_timer_func @ languagetool.min.js:756
setTimeout (async)
lt_timer @ languagetool.min.js:915
lt_timer_func @ languagetool.min.js:756
setTimeout (async)
lt_timer @ languagetool.min.js:915
lt_timer_func @ languagetool.min.js:756
setTimeout (async)
lt_timer @ languagetool.min.js:915
lt_timer_func @ languagetool.min.js:756
setTimeout (async)
lt_timer @ languagetool.min.js:915
lt_timer_func @ languagetool.min.js:756
setTimeout (async)
lt_timer @ languagetool.min.js:915
lt_timer_func @ languagetool.min.js:756

Webpack

Hi, would it work with webpack?
Because I'm trying to import it via "require()" and it has errors

Language setting or the automatic detection

Hey

In lt_setLanguage
I can set the language static, but the languagetool API support a language detection.
Why do not use it?

In every language there are new word from other languages, in german we call it "anglizismen".
With a static set language we get a lot of trouble with these english words that are imported to other languages.

Help request and question

Hello

I have a problem.

I'm trying to figure out how your script works for ckeditor.
In my test phase (ck.html file), I get an error:
Uncaught TypeError: $ is not a function

I have the impression that, when loading the remote file
https://knowzero.github.io/tinymce4-languagetool/languagetool/include/languagetool.min.js

The latter does not take into account the jquery previously loaded.
I seek to understand your source code in order to translate it into pure javascript, without any third-party libraries

Could you tell me how to understand your code?

I thank you in advance.

leknoppix

NB: Sorry, my English is a bit rusty.

More compatibly

I try to integrate your plugin into drupal 7 (wysiwyg module with tinyMCE installed).
Changed some of the drupal module code and the plugin is correctly loaded if the tinymce is initiated at a texfield.

The javascript of the plugin looka little bit problematic.

languagetool.min.js:90 Uncaught TypeError: $ is not a function
at new LanguageTool (/sites/all/libraries/tinymce/js/tinymce/plugins/languagetool/include/languagetool.min.js:90:17)
at c. (/sites/all/libraries/tinymce/js/tinymce/plugins/languagetool/plugin.min.js:121:11)

I am not really the best at JS coding, but looks in the drupal eviroment the $ is only available after the document is fully loaded, document.ready.

Hope we can get it more robust and working on Drupal 7.

Let me know if If can help.

[Question] Output suggestion list like languagetool.org demo

Hi @KnowZero ,

I found great value in your repo and am very grateful that you open-source such a project!

I have two questions:

  1. How can I display suggestion lists in a side panel that interacts with underlined text, similar to the languagetool.org demo?
  2. How can I integrate suggestions from another API like OpenAI (for writing style suggestions) with a unique underline color?

Could you guide me on these?

Thanks!

Self Hosted LanguageServer

Here is my setup:

  • self hosted languagetool server (I followed their docs and it runs fine when sending data using curl).
  • I have a copy of jquery, tinymce, and your editor all locally on my server
  • i am using demo.html just and just modified it to point to my locally installed files and languagetool server

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!

Submit button mode

Hi,

You have 2 mods.

  1. Could you add next mode like 'submit_button_mode'.
    It should work like on languagetool page by clicking 'Check text' button.
  2. Is it possible to make 1 submit button to be used in 2 tinymce editor instances?

TinyMCE5

Hey @KnowZero thanks for writing this.

I'm using TinyMCE v5.8.1 for an existing webapp and I wanted to add spellchecking. And guess what? My app lives on a legacy Windows server with no Internet connectivity. That severely limits my spellchecking options.

I found your plugin here, which could do half the work. I downloaded your v5 port and threw it in and configured some params.

Next, I tried to install LT on my server but, sparing the details, there were system incompatibilities. So I pulled together a few libraries and wrote a Go server that simulates output from an LT server in the exact JSON format (or very close). Then I pointed your plugin at that custom backend.

However, I'm now running into some strange inconsistencies with your plugin:

  • ~>50% of the time when the page loads and I start typing, no network requests fire. There are no errors in the console, but there is debug output from the plugin. Sometimes the requests do fire, and in that case I do get results and the plugin can successfully highlight incorrect spellings. This happens on "word" and "sentence" mode. Chrome 55 (apologies in advance).
  • The context menu works and replacements can work.
  • I've had the plugin put a double- or triple-highlight on a single word, such that I had to use the context menu to "fix" the spelling several times before the underline cleared.
  • I've had the plugin put a highlight partly on a word, (starting on the 3rd character of the word) and extending into the space after a word. Then when I used the context menu to fix the spelling, it didn't do a clean replace but left part of the original word.
  • I had the plugin abruptly put a fragment of HTML a la span>> into the editor. (I know there's HTML in the editor and you can't see it; somehow the plugin generated a partial tag which made it appear since it wasn't valid HTML.)
  • I had it whre the plugin highlighted two words that were near each other, and then I did a suggest-replace on one of the words, the other word lost its highlight and the plugin would not highlight it again as I kept typing, even though the spelling was still wrong.

So: it's promising, but I'm guessing there are more incompatibilities with v5 than perhaps you first suspected. I would love to use v4 but I already have an app built with v5 and I don't know exactly how much work it would take to port back to v4. I'm hoping fixes could be made without too-too much effort.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.