Custom wiki renderer collapsed by default?! and how to get Preview and Undo buttons?

koenemann December 9, 2022

After upgrading from Jira 8.5 to 8.20.11, my custom wiki-style renderer (which extends the AtlassianWikiRenderer) is not shown properly any more.

This is how the description is rendered with my renderer on the regular issue page:

image.png

When opening the quick-edit popup via the "Edit" button, the description is shown like this - the text is not visible:

image.png

I can pull down the text field with the highlighted control, then the text is properly displayed and I can edit it. Checking the html code reveals that the textarea-tag has the following attribute, which is probably why the text is not visible:

style="overflow: hidden; height: 0px;"

This is how the field looks like with the Jira "Wiki Style Renderer":

image.png

It is properly sized and it has additional buttons for preview and for undo/redo.

Question 1: how can I fix my own renderer to be shown properly again in the Quick-edit dialog?

Question 2: how can I get the Preview and undo/redo buttons into my custom renderer?


This is how I implemented my renderer:

package com.example.renderer;

import com.atlassian.event.api.EventPublisher;
import com.atlassian.jira.component.pico.ComponentManager;
import com.atlassian.jira.config.FeatureManager;
import com.atlassian.jira.config.properties.ApplicationProperties;
import com.atlassian.jira.issue.fields.renderer.IssueRenderContext;
import com.atlassian.jira.issue.fields.renderer.wiki.AtlassianWikiRenderer;
import com.atlassian.jira.util.velocity.VelocityRequestContextFactory;
import com.atlassian.plugin.spring.scanner.annotation.component.JiraComponent;
import com.atlassian.plugin.spring.scanner.annotation.imports.JiraImport;
import javax.inject.Inject;

@JiraComponent
public class MyWikiRenderer extends AtlassianWikiRenderer {

private static final String TYPE = "my-wiki-renderer";

@Inject
public MyWikiRenderer( // @JiraImport EventPublisher eventPlublisher,
@JiraImport ApplicationProperties applicationProperties,
@JiraImport VelocityRequestContextFactory velocityRequestContextFactory,
@JiraImport FeatureManager featureManager) {
// Using EventPublisher with import annotation yields an exception in the log:
// "No qualifying bean of type 'com.atlassian.event.api.EventPublisher' available"
// but getting it via ComponentManager works fine:
super(ComponentManager.getInstance().getComponentInstanceOfType(EventPublisher.class),
applicationProperties, velocityRequestContextFactory, featureManager);
}

@Override
public String getRendererType() {
return TYPE;
}

@Override
public String render(String string, IssueRenderContext issueRenderContext) {
final String renderedString = super.render(string, issueRenderContext);
// custom code...
return renderedString;
}
}

This is how it's registered in atlassian-plugin.xml:

<atlassian-plugin key="${atlassian.plugin.key}" name="${project.name}"
plugins-version="2">
<plugin-info>
<description>${project.description}</description>
<version>${project.version}</version>
<vendor name="${project.organization.name}" url="${project.organization.url}" />
</plugin-info>

<jira-renderer system="true" key="custom-renderer"
name="My Wiki Style Renderer" class="com.example.renderer.MyWikiRenderer">
<description>My extended wiki style renderer.</description>
<resource type="velocity" name="edit"
location="templates/plugins/renderers/wiki/wiki-renderer-edit.vm" />
</jira-renderer>
</atlassian-plugin>

 

1 answer

0 votes
Anton Martinovic
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
April 11, 2024

Hi @koenemann, were you able to solve this problem? We are experiencing the exact same issue with a custom renderer since Jira 8.20.

koenemann April 11, 2024

Nope.. same problem, now Jira 9.4.15.

Suggest an answer

Log in or Sign up to answer