tinymce4-languagetool
tinymce4-languagetool copied to clipboard
[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:
- How can I display suggestion lists in a side panel that interacts with underlined text, similar to the languagetool.org demo?
- 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!
The words should be in the LT.highlightList, the logic of connecting is split out with TinyMCE integration, so you can pull the data in LT in style it how you want
Within the current plugin, you would have to do a bit of work of formatting the OpenAI data to match the output format of LanguageTool and merge them. Then create another lt_setHighlight type and set up css for that type
Thank you @KnowZero !
Can you explain a bit about which part of the code is responsible for LT.highlightList?
I've been messing with the repo for over a week and ended up with a different direction which is not optimal
The library is divided into 2,
plugin and include/languagetool
The include/languagetool is a generic wrapper around languagetool and loads up all the common features. The plugin is a wrapper for tinymce that uses the data
Since the library is generic, it can be used outside tinymce like ck.html does for ckeditor
So back to the point, what you would do is modify the plugin.min.js which contains the tinymce bindings
var LT = new LanguageTool(tinymce.activeEditor.settings,$);
is what loads up the generic library into LT variable
So you can either build your own like ck.html does or modify plugin.min.js. There you can access the LT variable to get all the data you need will be there.
Here is a most basic version without any editor and just using contenteditable to demonstrate how the generic library works:
https://jsfiddle.net/kafnscte/
Thanks a lot for the guidance! The details and the jsFiddle example you provided are super helpful. I'll dive into it right away. Really appreciate your help!