From: Kohei Yoshino Date: Tue, 22 Jan 2019 15:55:27 +0000 (-0500) Subject: Bug 1520533 - Utilize Markdown in uplift form comments X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2d674d53097c70acb630d6be7a8b1ba7686fc8b5;p=thirdparty%2Fbugzilla.git Bug 1520533 - Utilize Markdown in uplift form comments --- diff --git a/extensions/FlagTypeComment/web/js/ftc.js b/extensions/FlagTypeComment/web/js/ftc.js index d4d6eab00..84ebda0fe 100644 --- a/extensions/FlagTypeComment/web/js/ftc.js +++ b/extensions/FlagTypeComment/web/js/ftc.js @@ -169,9 +169,14 @@ Bugzilla.FlagTypeComment = class FlagTypeComment { * @returns {Boolean} Always `true` to allow submitting the form. */ form_onsubmit() { + if (this.inserted_fieldsets.length) { + // Enable Markdown + this.$comment.form.querySelector('[name="markdown_off"]').remove(); + } + for (const $fieldset of this.inserted_fieldsets) { const text = [ - `[${$fieldset.querySelector('h3').innerText}]`, + `## ${$fieldset.querySelector('h3').innerText}`, ...[...$fieldset.querySelectorAll('tr')].map($tr => { const checkboxes = [...$tr.querySelectorAll('input[type="checkbox"]:checked')]; const $radio = $tr.querySelector('input[type="radio"]:checked'); @@ -203,7 +208,7 @@ Bugzilla.FlagTypeComment = class FlagTypeComment { } } - return `${label}: ${value}`; + return `### ${label}\n\n${value}`; }), ].join('\n\n');