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

Jira Need to Add Button to Comment Toolbar

所以我们目前在工作场所使用 Jira,但没有 Jira Administrator。我感觉可以胜任这项任务,想知道 Jira 是否具有我正在寻找的功能。

因此,当您在 Jira 中甚至在 Jira 工单正文中发表评论时。您可以将评论区中的文字设为斜体

如您所见,我对能够具有与 粗体斜体 或下划线相同的功能很感兴趣 但我希望能够突出显示我在票证评论中插入的一些代码,然后单击一个按钮并将其放入代码块中。或者添加大括号并使其成为引号...就像 Whosebug 的做法一样。

有谁知道我该怎么做吗?

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

或者您可以使用.....

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

{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}

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

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

更新 使用该插件,您可以获得类似的东西。我认为这会对您有所帮助。

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

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

例子

就我而言,我在两个自定义字段上添加了两个按钮以从 Summary/Description 复制原始内容。您可以调整代码以对任何自定义字段或评论字段执行任何操作。

截图

代码

要包含在自定义字段描述中的代码。调整您的代码以将 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 (this would be global JS for any Jira page). Alternatively, you can utilize simple yet powerful JsIncluder add-on 包含您的 JS 以仅针对某些 project/issuetype 或全局 and/or 仅针对 edit/transition 屏幕注入您自己的 JS 代码。