mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-12-22 12:54:53 -05:00
Merge pull request 'Remove EasyMDE from various areas' (#2916) from 0ko/forgejo:easymde into forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/2916 Reviewed-by: Gusted <gusted@noreply.codeberg.org>
This commit is contained in:
commit
67d6c674df
4 changed files with 31 additions and 1 deletions
|
@ -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}}
|
||||
|
|
|
@ -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">
|
||||
|
|
|
@ -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>
|
||||
<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>
|
||||
{{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="">
|
||||
|
|
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