taqueci / redmine_wysiwyg_editor

Redmine WYSIWYG Editor plugin
GNU General Public License v2.0
114 stars 27 forks source link

Add watcher #125

Closed lcasanova78 closed 3 years ago

lcasanova78 commented 3 years ago

I am creating a script to be added as a watcher when a user is mentioned with @user, but I am unable to capture the text using javaScript. Could you give me some hints on how to capture what the user is typing in the editor?

taqueci commented 3 years ago

Hi @lcasanova78

I guess you can capture editor text by:

$(function() {
  $('input[type="submit"]').on('click', function() {
    $(this).closest('form').find('.jstEditor textarea').each(function() {
      var text = $(this).val();

      // Parse text and set watcher here.
    });
  });
});

(Some more improvement is needed.)