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)
This commit is contained in:
0ko 2024-03-31 09:19:40 +05:00 committed by GitHub
parent 7784a6c331
commit 4b0e8f227d
9 changed files with 12 additions and 1 deletions

View file

@ -241,6 +241,7 @@
"MarkdownPreviewContext" $.RepoLink
"TextareaName" "content"
"DropzoneParentContainer" ".ui.form"
"EasyMDE" true
)}}
{{if .IsAttachmentEnabled}}
<div class="field">

View file

@ -17,6 +17,7 @@
"TextareaPlaceholder" (ctx.Locale.Tr "repo.diff.comment.placeholder")
"DropzoneParentContainer" "form"
"DisableAutosize" "true"
"EasyMDE" true
)}}
{{if $.root.IsAttachmentEnabled}}

View file

@ -21,6 +21,7 @@
"TextareaName" "content"
"TextareaPlaceholder" (ctx.Locale.Tr "repo.diff.review.placeholder")
"DropzoneParentContainer" "form"
"EasyMDE" true
)}}
</div>
{{if .IsAttachmentEnabled}}

View file

@ -11,6 +11,7 @@
"TextareaContent" $textareaContent
"TextareaPlaceholder" (ctx.Locale.Tr "repo.diff.comment.placeholder")
"DropzoneParentContainer" "form, .ui.form"
"EasyMDE" true
)}}
</div>

View file

@ -13,6 +13,7 @@
"TextareaContent" .item.Attributes.value
"TextareaPlaceholder" .item.Attributes.placeholder
"DropzoneParentContainer" ".combo-editor-dropzone"
"EasyMDE" true
)}}
{{if .root.IsAttachmentEnabled}}

View file

@ -151,6 +151,7 @@
"MarkdownPreviewContext" .RepoLink
"TextareaName" "content"
"DropzoneParentContainer" ".ui.form"
"EasyMDE" true
)}}
</div>

View file

@ -57,6 +57,7 @@
"TextareaPlaceholder" (ctx.Locale.Tr "repo.release.message")
"TextareaAriaLabel" (ctx.Locale.Tr "repo.release.message")
"DropzoneParentContainer" "form"
"EasyMDE" true
)}}
</div>
{{range .attachments}}

View file

@ -29,6 +29,7 @@
"TextareaPlaceholder" (ctx.Locale.Tr "repo.wiki.page_content")
"TextareaAriaLabel" (ctx.Locale.Tr "repo.wiki.page_content")
"TextareaContent" $content
"EasyMDE" true
)}}
<div class="field tw-mt-4">

View file

@ -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
*/}}
<div {{if .ContainerId}}id="{{.ContainerId}}"{{end}} class="combo-markdown-editor {{.ContainerClasses}}" data-dropzone-parent-container="{{.DropzoneParentContainer}}">
{{if .MarkdownPreviewUrl}}
@ -41,7 +42,9 @@ Template Attributes:
</div>
<div class="markdown-toolbar-group">
<button class="markdown-toolbar-button markdown-switch-monospace" role="switch" data-enable-text="{{ctx.Locale.Tr "editor.buttons.enable_monospace_font"}}" data-disable-text="{{ctx.Locale.Tr "editor.buttons.disable_monospace_font"}}">{{svg "octicon-typography"}}</button>
{{if .EasyMDE}}
<button class="markdown-toolbar-button markdown-switch-easymde" data-tooltip-content="{{ctx.Locale.Tr "editor.buttons.switch_to_legacy.tooltip"}}">{{svg "octicon-arrow-switch"}}</button>
{{end}}
</div>
</markdown-toolbar>
<text-expander keys=": @" suffix="">