From 4b0e8f227da63d0a50fafafc618c5e66059379eb 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. (cherry picked from commit f5c7ccaeffa7cd5d2f4a7a6b18b8e2c55d5e315e) --- 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 6b343e4ee0..71ad0f5377 100644 --- a/templates/repo/diff/box.tmpl +++ b/templates/repo/diff/box.tmpl @@ -241,6 +241,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 856b3da01a..08ef8a4c87 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 a2eae007a5..39e5ebe222 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 4197ea4f65..29d69a3de1 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 3ad69e1220..b98ac39cfc 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 bb8863a170..2c3e72b812 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 425cc2c87a..81104a70d2 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 2f51a5fe2e..81433db003 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 f4d51f510b..fb11a75bec 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}}