mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-11-15 02:45:22 +00:00
Merge pull request '[v7.0/forgejo] Remove EasyMDE from various areas' (#3331) from bp-v7.0/forgejo-089e370-703aee4-f5c7cca into v7.0/forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3331 Reviewed-by: 0ko <0ko@noreply.codeberg.org>
This commit is contained in:
commit
59cfbf2070
|
@ -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}}
|
||||||
|
|
|
@ -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">
|
||||||
|
|
|
@ -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="">
|
||||||
|
|
25
tests/integration/easymde_test.go
Normal file
25
tests/integration/easymde_test.go
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
// Copyright 2024 The Forgejo Authors. All rights reserved.
|
||||||
|
// SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
|
package integration
|
||||||
|
|
||||||
|
import (
|
||||||
|
"net/http"
|
||||||
|
"testing"
|
||||||
|
)
|
||||||
|
|
||||||
|
func TestEasyMDESwitch(t *testing.T) {
|
||||||
|
session := loginUser(t, "user2")
|
||||||
|
testEasyMDESwitch(t, session, "user2/glob/issues/1", false)
|
||||||
|
testEasyMDESwitch(t, session, "user2/glob/issues/new", false)
|
||||||
|
testEasyMDESwitch(t, session, "user2/glob/wiki?action=_new", true)
|
||||||
|
testEasyMDESwitch(t, session, "user2/glob/releases/new", true)
|
||||||
|
}
|
||||||
|
|
||||||
|
func testEasyMDESwitch(t *testing.T, session *TestSession, url string, expected bool) {
|
||||||
|
t.Helper()
|
||||||
|
req := NewRequest(t, "GET", url)
|
||||||
|
resp := session.MakeRequest(t, req, http.StatusOK)
|
||||||
|
doc := NewHTMLParser(t, resp.Body)
|
||||||
|
doc.AssertElement(t, ".combo-markdown-editor button.markdown-switch-easymde", expected)
|
||||||
|
}
|
Loading…
Reference in a new issue