Formatting WYSIWYG for Jira description using virtual functions
Asked by Brian Karst:

I am having trouble getting my ConfiForm WYSIWYG Simple editor fields to be in the proper format for the description in the created Jira Issue. If I use the escapeJSON virtual function the description contains the HTML \<div\>\<ol\>\<li\> code. If I use the renderAsText virtual function it errors but gets rid of the HTML. I have seen a couple different errors, unterminated string, expects , or } etc. If I train .renderAsText.escapeJSON the HTML is still in the description, if I train .escapeJSON.renderAsText it errors.


Answers:
author: Alex Medved _ConfiForms_
body: Hi

You need to use

```
.extractText.escapeJSON
```

as "renderAsText" is for the wiki markup to render as text

Alex

comments: author: Brian Karst
body: Hi Alex,

.extractText removes all new lines, number lists, and bullet lists from the input that I would like to keep. I mean it is the whole reason to use the WYSIWYG instead of text area, so the user can input without knowing how to hard code text edits right?

Thank You,

Brian


author: Alex Medved _ConfiForms_
body: Well, that is correct.

It removes the markup and this is what works for description field in Jira. It simply cannot accept the HTML you are trying to transfer from a wysiwyg field in ConfiForms


author: Brian Karst
body: But Jira can handle Wiki Markup (or is it markdown?) right? I mean I can hard code asterisks for bullets and \\n for a new line with no issues. I can't find a virtual function to turn the HTML into Wiki markup, but two to convert to HTML (renderAsHtml \& renderWikiMarkup) It seems like there should be a virtual function to translate the other way around right? As always, thank you for all your help Alex, even if what I want to do can't be done.


author: Alex Medved _ConfiForms_
body: Yes, that is correct - you can have a wiki markup in Jira, but not wysiwyg (you can have wiki markup in ConfiForms as well, but this is another field type)

That's the problem here - Jira cannot accept the HTML..


author: Brian Karst
body: What field is that? The only field I found that has an editor is the wysiwyg. I tried the markdown editor but for all I can tell that is just a text area field; certainly has no editor bar. Does it just automatically escapeJSON or something?

Are there any efforts to create a virtual function to take the html input from the wysiwyg and convert it into markup? That would be a very powerful VF that I would think you have the groundwork laid down for with the renderWikiMarkup or renderAsHtml VFs


author: Alex Medved _ConfiForms_
body: Looks like it might be possible... <https://community.atlassian.com/t5/Jira-questions/How-to-convert-html-to-Atlassian-markup-in-java-app/qaq-p/657726>

We will do some research to see if this can be added to ConfiForms virtual functions


author: Alex Medved _ConfiForms_
body: Experimental function for converting HTML to wiki markup has been added to the <https://wiki.vertuna.com/display/CONFIFORMS/Release+Notes#ReleaseNotes-Version2.13.2>


author: Brian Karst
body: I'm excited to try it! Sometimes I wonder if you are man or machine Alex. Or perhaps a multi-user account. You are so supportive, Thank You.


author: Brian Karst
body: Unfortunately it doesn't work for me, but that has nothing to do with the VF. We are well behind in ConfiForms versions (2.3.1) and the request to update was put in well before me. Getting through the red tape has no estimated timeline that I know of.


author: Brian Karst
body: Hopefully in late July or August we will manage to update ConfiForms, and I can try this VF.


Tags: cloud

confiforms

jira