fix(ui): fix markdown editor monospace preference in pages with multiple editors (#13329)

Makes sure the markdown editor's monospace preference gets applied even within pages containing multiple editors.

Fixes https://codeberg.org/forgejo/forgejo/issues/13186

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/13329
Reviewed-by: Gusted <gusted@noreply.codeberg.org>
This commit is contained in:
vsdl 2026-07-10 01:29:00 +02:00 committed by Gusted
commit fe8d4c3f3f
3 changed files with 49 additions and 7 deletions

View file

@ -52,13 +52,13 @@ Template Attributes:
</markdown-toolbar>
<div class="ui tab active" data-tab-panel="markdown-writer">
<text-expander keys=": @" suffix="">
<textarea class="markdown-text-editor js-quick-submit"{{if .TextareaName}} name="{{.TextareaName}}"{{end}}{{if .TextareaPlaceholder}} placeholder="{{.TextareaPlaceholder}}"{{end}}{{if .TextareaAriaLabel}} aria-label="{{.TextareaAriaLabel}}"{{end}}{{if .DisableAutosize}} data-disable-autosize="{{.DisableAutosize}}"{{end}}>{{.TextareaContent}}</textarea>
<textarea class="markdown-text-editor js-quick-submit"
{{- if .TextareaName}} name="{{.TextareaName}}"{{end -}}
{{if .TextareaPlaceholder}} placeholder="{{.TextareaPlaceholder}}"{{end -}}
{{if .TextareaAriaLabel}} aria-label="{{.TextareaAriaLabel}}"{{end -}}
{{if .DisableAutosize}} data-disable-autosize="{{.DisableAutosize}}"{{end -}}
>{{.TextareaContent}}</textarea>
</text-expander>
<script>
if (localStorage?.getItem('markdown-editor-monospace') === 'true') {
document.querySelector('.markdown-text-editor').classList.add('tw-font-mono');
}
</script>
</div>
<div class="ui tab markup" data-tab-panel="markdown-previewer">
{{ctx.Locale.Tr "loading"}}