Template
1
0
Fork 0
mirror of https://codeberg.org/forgejo/forgejo synced 2024-11-29 05:06:11 +01:00

Make display of EasyMDE in UI optional to template

This commit adds EasyMDE field to combomarkdowneditor, as well as to all its calls.
This commit is contained in:
0ko 2024-03-31 09:19:40 +05:00
parent d780a9a47d
commit f5c7ccaeff
9 changed files with 12 additions and 1 deletions

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -10,6 +10,7 @@ Template Attributes:
* TextareaAriaLabel: aria-label attribute for the textarea * TextareaAriaLabel: aria-label attribute for the textarea
* DropzoneParentContainer: container for file upload (leave it empty if no upload) * DropzoneParentContainer: container for file upload (leave it empty if no upload)
* DisableAutosize: whether to disable automatic height resizing * 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}}"> <div {{if .ContainerId}}id="{{.ContainerId}}"{{end}} class="combo-markdown-editor {{.ContainerClasses}}" data-dropzone-parent-container="{{.DropzoneParentContainer}}">
{{if .MarkdownPreviewUrl}} {{if .MarkdownPreviewUrl}}
@ -41,7 +42,9 @@ Template Attributes:
</div> </div>
<div class="markdown-toolbar-group"> <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> <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> <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> </div>
</markdown-toolbar> </markdown-toolbar>
<text-expander keys=": @" suffix=""> <text-expander keys=": @" suffix="">