From f5c7ccaeffa7cd5d2f4a7a6b18b8e2c55d5e315e Mon Sep 17 00:00:00 2001 From: 0ko <0ko@noreply.codeberg.org> Date: Sun, 31 Mar 2024 09:19:40 +0500 Subject: [PATCH] Make display of EasyMDE in UI optional to template This commit adds EasyMDE field to combomarkdowneditor, as well as to all its calls. --- templates/repo/diff/box.tmpl | 1 + templates/repo/diff/comment_form.tmpl | 1 + templates/repo/diff/new_review.tmpl | 1 + templates/repo/issue/comment_tab.tmpl | 1 + templates/repo/issue/fields/textarea.tmpl | 1 + templates/repo/issue/view_content.tmpl | 1 + templates/repo/release/new.tmpl | 1 + templates/repo/wiki/new.tmpl | 1 + templates/shared/combomarkdowneditor.tmpl | 5 ++++- 9 files changed, 12 insertions(+), 1 deletion(-) diff --git a/templates/repo/diff/box.tmpl b/templates/repo/diff/box.tmpl index 9ede83dcb..ce0eee3b5 100644 --- a/templates/repo/diff/box.tmpl +++ b/templates/repo/diff/box.tmpl @@ -239,6 +239,7 @@ "MarkdownPreviewContext" $.RepoLink "TextareaName" "content" "DropzoneParentContainer" ".ui.form" + "EasyMDE" true )}} {{if .IsAttachmentEnabled}}
diff --git a/templates/repo/diff/comment_form.tmpl b/templates/repo/diff/comment_form.tmpl index 856b3da01..08ef8a4c8 100644 --- a/templates/repo/diff/comment_form.tmpl +++ b/templates/repo/diff/comment_form.tmpl @@ -17,6 +17,7 @@ "TextareaPlaceholder" (ctx.Locale.Tr "repo.diff.comment.placeholder") "DropzoneParentContainer" "form" "DisableAutosize" "true" + "EasyMDE" true )}} {{if $.root.IsAttachmentEnabled}} diff --git a/templates/repo/diff/new_review.tmpl b/templates/repo/diff/new_review.tmpl index a2eae007a..39e5ebe22 100644 --- a/templates/repo/diff/new_review.tmpl +++ b/templates/repo/diff/new_review.tmpl @@ -21,6 +21,7 @@ "TextareaName" "content" "TextareaPlaceholder" (ctx.Locale.Tr "repo.diff.review.placeholder") "DropzoneParentContainer" "form" + "EasyMDE" true )}}
{{if .IsAttachmentEnabled}} diff --git a/templates/repo/issue/comment_tab.tmpl b/templates/repo/issue/comment_tab.tmpl index 4197ea4f6..29d69a3de 100644 --- a/templates/repo/issue/comment_tab.tmpl +++ b/templates/repo/issue/comment_tab.tmpl @@ -11,6 +11,7 @@ "TextareaContent" $textareaContent "TextareaPlaceholder" (ctx.Locale.Tr "repo.diff.comment.placeholder") "DropzoneParentContainer" "form, .ui.form" + "EasyMDE" true )}} diff --git a/templates/repo/issue/fields/textarea.tmpl b/templates/repo/issue/fields/textarea.tmpl index 3ad69e122..b98ac39cf 100644 --- a/templates/repo/issue/fields/textarea.tmpl +++ b/templates/repo/issue/fields/textarea.tmpl @@ -13,6 +13,7 @@ "TextareaContent" .item.Attributes.value "TextareaPlaceholder" .item.Attributes.placeholder "DropzoneParentContainer" ".combo-editor-dropzone" + "EasyMDE" true )}} {{if .root.IsAttachmentEnabled}} diff --git a/templates/repo/issue/view_content.tmpl b/templates/repo/issue/view_content.tmpl index bb8863a17..2c3e72b81 100644 --- a/templates/repo/issue/view_content.tmpl +++ b/templates/repo/issue/view_content.tmpl @@ -151,6 +151,7 @@ "MarkdownPreviewContext" .RepoLink "TextareaName" "content" "DropzoneParentContainer" ".ui.form" + "EasyMDE" true )}} diff --git a/templates/repo/release/new.tmpl b/templates/repo/release/new.tmpl index 425cc2c87..81104a70d 100644 --- a/templates/repo/release/new.tmpl +++ b/templates/repo/release/new.tmpl @@ -57,6 +57,7 @@ "TextareaPlaceholder" (ctx.Locale.Tr "repo.release.message") "TextareaAriaLabel" (ctx.Locale.Tr "repo.release.message") "DropzoneParentContainer" "form" + "EasyMDE" true )}} {{range .attachments}} diff --git a/templates/repo/wiki/new.tmpl b/templates/repo/wiki/new.tmpl index 2f51a5fe2..81433db00 100644 --- a/templates/repo/wiki/new.tmpl +++ b/templates/repo/wiki/new.tmpl @@ -29,6 +29,7 @@ "TextareaPlaceholder" (ctx.Locale.Tr "repo.wiki.page_content") "TextareaAriaLabel" (ctx.Locale.Tr "repo.wiki.page_content") "TextareaContent" $content + "EasyMDE" true )}}
diff --git a/templates/shared/combomarkdowneditor.tmpl b/templates/shared/combomarkdowneditor.tmpl index f4d51f510..fb11a75be 100644 --- a/templates/shared/combomarkdowneditor.tmpl +++ b/templates/shared/combomarkdowneditor.tmpl @@ -10,6 +10,7 @@ Template Attributes: * TextareaAriaLabel: aria-label attribute for the textarea * DropzoneParentContainer: container for file upload (leave it empty if no upload) * DisableAutosize: whether to disable automatic height resizing +* EasyMDE: whether to display button for switching to legacy editor */}}
{{if .MarkdownPreviewUrl}} @@ -41,7 +42,9 @@ Template Attributes:
- + {{if .EasyMDE}} + + {{end}}