Jira需要在评论工具栏中添加按钮

时间:2015-10-07 19:51:17

标签: button comments jira

所以我们目前在工作场所有Jira而没有Jira Administrator。我能够完成任务,想知道Jira是否具备我正在寻找的功能。

所以当你在Jira或甚至在Jira票的正文中有评论时。您可以从评论功能区JiraComment

中删除文本

如您所见,我感兴趣的是能够使用与粗体 italicize 相同的功能或下划线 但我希望能够突出显示我在票证评论中插入的一些代码,然后单击一个按钮并将其转换为代码块。或者添加大括号并使其成为引用...与StackOverflow完全一样。

任何人都知道如何做到这一点?

2 个答案:

答案 0 :(得分:0)

我认为你可以使用插件。 jeditor plugin为您提供了更多文本编辑器选项。您需要的所有信息都在上面的链接中提供。安装此插件后,您可以将文本渲染器更改为“JEditor Renderer”。 市场:https://marketplace.atlassian.com/plugins/com.jiraeditor.jeditor

或者你可以使用 .....

注意: - 我想这不是您需要的确切答案,但我认为您可以在评论字段中使用宏。例如:如果你想在评论里面添加面板,你可以简单地使用

{panel}Some text{panel}
{panel:title=My Title}Some text with a title{panel}
{panel:title=My Title| borderStyle=dashed| borderColor=#ccc| titleBGColor=#F7D6C1| bgColor=#FFFFCE}
a block of text surrounded with a *panel*
yet _another_ line
{panel} 

如果您想添加代码,可以使用...

--- Java example ---
{code:title=Bar.java|borderStyle=solid}
// Some comments here
public String getFoo()
{
    return foo;
}
{code}
*--- XML example ---*
{code:xml}
<test>
  <another tag="attribute"/>
</test>
{code}

这是一个示例屏幕截图..

enter image description here

关注this link了解更多信息..

<强>更新 使用插件你可以得到这样的东西......我想这会对你有帮助。enter image description here

答案 1 :(得分:0)

这是一个很老的问题,但可能会帮助其他人稍后寻找答案...

如果您熟悉JavaScript,只需通过JS将按钮插入工具栏即可。我已经针对几个自定义字段进行了此操作。这样的JS可以包含在自定义字段的描述中。

示例

就我而言,我在两个自定义字段上添加了两个按钮,以从“摘要/描述”中复制原始内容。您可以调整代码以对任何自定义字段或注释字段执行任何操作。

屏幕截图

enter image description here

代码

要包含在自定义字段说明中的代码。调整您的代码以将JS放入适当的元素。

<script>
var cfAltDescription = 14705;
var elAltDescription = AJS.$("#customfield_" + cfAltDescription);

function addDescriptionButton() {
    var buttonHTML = ' <button type="button" class="aui-button" style="font-size: 11px;padding: 1px 5px;" title="Paste original description into this field" onclick="copyDescription()">&lt; Description</button>';
    AJS.$(".jira-wikifield[field-id=customfield_" + cfAltDescription + "] ~ .wiki-button-bar").append(buttonHTML);
}

function copyDescription() {
    var origDescription = AJS.$("#description").attr("value");
    elAltDescription.attr("value", origDescription);
    // set focus in the input box after copying...
    elAltDescription.focus()[0].setSelectionRange(0, 0);
    elAltDescription.scrollTop(0);
}

addDescriptionButton();
</script>

对于注释,您不能将JS注入自定义字段描述中(注释不是自定义字段)。您将需要通过Announcement Banner包含JS(对于任何Jira页面,这都是全局JS)。另外,您可以利用简单而功能强大的JsIncluder add-on来仅针对某些项目/问题类型或全局和/或仅针对编辑/转换屏幕注入您自己的JS代码。

相关问题