fix(ui): make unicode escape work in wiki (#8923)

Fixes #4118

- Unicode escape now works in wiki
- edit and escape buttons are better placed
- edit icon is now under the warning

Before: https://codeberg.org/attachments/4414f0cb-776a-4e62-a3b5-99de0914bf26
After: https://codeberg.org/attachments/93aad13f-e36b-42f9-a827-7ff7259da581

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/8923
Reviewed-by: 0ko <0ko@noreply.codeberg.org>
Co-authored-by: zokki <zokki.softwareschmiede@gmail.com>
Co-committed-by: zokki <zokki.softwareschmiede@gmail.com>
This commit is contained in:
zokki 2025-09-10 08:10:23 +02:00 committed by 0ko
commit 262a2253aa
5 changed files with 52 additions and 16 deletions

View file

@ -19,6 +19,10 @@
min-height: 340px; /* This height matches the markdown editor's height */
}
.repository.wiki .ui.message.unicode-escape-prompt {
margin-bottom: 0.5em;
}
.repository.wiki .wiki-content-parts .markup {
border: 1px solid var(--color-secondary);
border-radius: var(--border-radius);

View file

@ -9,6 +9,11 @@ export function initUnicodeEscapeButton() {
const fileContent = btn.closest('.file-content, .non-diff-file-content, .file-preview-box');
const fileView = fileContent?.querySelectorAll('.file-code, .file-view, .file-preview');
if (!fileContent || !fileView) {
console.error('initUnicodeEscapeButton file-content or view not found');
return;
}
if (btn.matches('.escape-button')) {
for (const el of fileView) el.classList.add('unicode-escaped');
hideElem(btn);