Closed albrechtd closed 1 year ago
It appears that my evil hack from #134 would do the trick here, too – expose the internal rwe
as global JavaScript variable RWEGLOBAL
, and then in the custom JavaScript say
$('#issue_notes').val(txtVal);
if (!!RWEGLOBAL) {
switch(RWEGLOBAL._mode) {
case 'visual': RWEGLOBAL._setVisualContent(); break;
case 'preview': RWEGLOBAL._setPreview(); break;
}
}
However, I don't think this is the proper approach… Unfortunately, my knowledge of JavaScript is very limited. Maybe it would it be possible to define a custom event for the Wysiwyg editor, which executes the update as above in the handler? And which object should receive the event?
Hi @albrechtd
I have created prototype for getting RedmineWysiwygEditor object: Branch sandbox/editor-manager
You can get the object by:
editor = redmineWysiwygEditorManager.find(document.getElementById('issue_notes').parentElement)
What do you think about this solution?
Hi @taqueci,
What do you think about this solution?
it works perfectly for me! :+1:
IMHO a really useful extension for your plugin – which is one of the most useful ones for Redmine btw. – a huge THANK YOU for your great work! :smiley:
Thank you for your support! Version 0.32.0 has been released.
I use some JavaScript with the Redmine View Customize plugin to change the contents of other UI elements when the user changes e.g. the issue status. This works fine for most UI elements, including the comment text by just calling something like
$('#issue_notes').val("this is my new comment");
iff the Textile tab is selected. Switching to a different tab (Wysiwyg, preview) updates them.However, this approach does not work if the Wysiwyg or the preview tab is selected; the user has to switch to the Textile tab (which contains the changed comment), and then back to update.
Is there any possibility to force this update of the Wysiwyg and preview tabs from JavaScript, or at least to set the Wysiwyg contents programmatically?
Thanks in advance, Albrecht.