Mte90 / GlotDict

This extension for WordPress polyglots implements new features to improve the quality of translation/reviews!
https://translate.wordpress.org
GNU General Public License v2.0
54 stars 24 forks source link

Introduce in-Textarea highlighting #162

Open garretthyder opened 6 years ago

garretthyder commented 6 years ago

This ticket will house the efforts for introducing in-Textarea highlighting for spaces, terms and other items.

Originally the idea stems from this GlotPress issue; https://github.com/GlotPress/GlotPress-WP/issues/863

This is quite an involved implementation as we'd probably have to retrofit the textarea with a complimentary div which visually replaces the textarea to support highlighting. We could potentially use a library like this - https://codersblock.com/blog/highlight-text-inside-a-textarea/

Some ideas for what should be highlighted in the text area are;

In some cases such as the term highlight and the trailing ... highlight we can take advantage of the 'Fix Warning' functionality being built for 1.5 in #145 so that on-click those highlights can execute replace logic.

garretthyder commented 6 years ago

We may want to look at the Grammarly extension to get some ideas as they have a really nice in-textarea highlight with tooltip that contains replace actions. card_correct

garretthyder commented 6 years ago

There's also the 'contenteditable' path as mentioned on GP ticket https://github.com/GlotPress/GlotPress-WP/issues/166

Mte90 commented 6 years ago

If we can use a library is better to have less custom code untested a lot but we will find something :-)

garretthyder commented 6 years ago

Agreed a library is going to be best, hopefully something lightweight. We'll want to avoid WYSIWYG editors and maybe contenteditable now that I look at it more since both support injecting markup (Bold, Italics, etc) which affects the integrity of the string as we shouldn't be injecting markup that's not already present.