From 304361455014761a018f87ed78d9e9d6dfd00d4c Mon Sep 17 00:00:00 2001 From: Steffen Date: Mon, 3 Aug 2020 06:29:32 +0000 Subject: [PATCH] Gives the possibility to translate or modify the text. --- src/inject/inject.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/inject/inject.js b/src/inject/inject.js index c59392b..e9be4e3 100644 --- a/src/inject/inject.js +++ b/src/inject/inject.js @@ -1,35 +1,42 @@ const semanticLabels = { praise: { + text: "praise", icon: "fa-trophy", blocking: false, }, nitpick: { + text: "nitpick", icon: "fa-search", blocking: true, }, suggestion: { + text: "suggestion", icon: "fa-exclamation", blocking: true, }, issue: { + text: "issue", icon: "fa-bug", blocking: true, }, question: { + text: "question", icon: "fa-question", blocking: true, }, thought: { + text: "thought", icon: "fa-comment", blocking: false, }, chore: { + text: "chore", icon: "fa-home", blocking: true, }, }; -const semanticCommentStructure = `**%label%decoration:** `; +const semanticCommentStructure = `**%text%decoration:** `; const fillTextAreaValue = (textarea, value, emptySubject = true) => { textarea.value = value; @@ -46,7 +53,7 @@ const semanticButtonClickHandler = (e, { textarea, label, blocking }) => { e.preventDefault(); const decoration = blocking ? "" : " (non-blocking)"; const semanticComment = semanticCommentStructure - .replace("%label", label) + .replace("%text", semanticLabels[label].text) .replace("%decoration", decoration); const cleanedValue = textarea.value.replace(/\*\*\w+(\s\(non-blocking\))?:\*\*\s?/, '');