Add rich text editor to textarea from javascript

lasrik July 17, 2018

I am fiddling with the threaded-comments plugin and the rich text editing is somewhat broken. So I was wondering if there is a normal way to enrich a plaintext input with the new editor (from javascript)?

After all we are talking about tinyMCE and normally you would use something like

tinymce.init({ selector: '#some-selector'})

 and get everything automated for free. Is there something similar in the JIRA Javascript API?

I have found out that some html parts and certain classes if appended via JS are processed and transformed automatically. But I have not found yet a documentation about which ones are possible.

<div class="field-group aui-field-wikiedit comment-input">
<div class="jira-wikifield" field-id="comment" renderer-type="atlassian-wiki-renderer" issue-key="{$issueKey}" resolved="">
<div class="wiki-edit">
<div id="comment-wiki-edit" class="wiki-edit-content">
<textarea class="textarea long-field wiki-textfield mentionable wiki-editor-initialised wiki-edit-wrapped"
cols="60" id="comment" name="comment" wrap="virtual" data-projectkey="{$projectKey}" data-issuekey="{$issueKey}"
resolved="" style="overflow-y: auto; min-height: 174px; max-height: 629px;box-sizing:border-box;"></textarea>
<div class="rte-container">
<rich-editor contenteditable="true" data-issue-key="{$issueKey}" data-content-present="true" resolved=""></rich-editor>
</div>
</div>
</div>
</div>
</div>

This will give a full editor but without submit buttons and - more importantly - no dropdown for visibility restriction.

And I guess it will break if you disable rich text editing in your JIRA instance (or use another editor).

0 answers

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events