Merge branch 'main' into dropdowncss

This commit is contained in:
silverwind
2026-02-13 06:36:57 +01:00
committed by GitHub
36 changed files with 12586 additions and 299 deletions
+17 -1
View File
@@ -1,4 +1,4 @@
import {showGlobalErrorMessage} from './bootstrap.ts';
import {showGlobalErrorMessage, shouldIgnoreError} from './bootstrap.ts';
test('showGlobalErrorMessage', () => {
document.body.innerHTML = '<div class="page-content"></div>';
@@ -10,3 +10,19 @@ test('showGlobalErrorMessage', () => {
expect(document.body.innerHTML).toContain('>test msg 2<');
expect(document.querySelectorAll('.js-global-error').length).toEqual(2);
});
test('shouldIgnoreError', () => {
for (const url of [
'https://gitea.test/assets/js/monaco.b359ef7e.js',
'https://gitea.test/assets/js/monaco-editor.4a969118.worker.js',
'https://gitea.test/assets/js/vendors-node_modules_pnpm_monaco-editor_0_55_1_node_modules_monaco-editor_esm_vs_base_common_-e11c7c.966a028d.js',
]) {
const err = new Error('test');
err.stack = `Error: test\n at ${url}:1:1`;
expect(shouldIgnoreError(err)).toEqual(true);
}
const otherError = new Error('test');
otherError.stack = 'Error: test\n at https://gitea.test/assets/js/index.js:1:1';
expect(shouldIgnoreError(otherError)).toEqual(false);
});
+7 -4
View File
@@ -8,12 +8,15 @@ import {html} from './utils/html.ts';
// This file must be imported before any lazy-loading is being attempted.
window.__webpack_public_path__ = `${window.config?.assetUrlPrefix ?? '/assets'}/`;
function shouldIgnoreError(err: Error) {
const ignorePatterns = [
'/assets/js/monaco.', // https://github.com/go-gitea/gitea/issues/30861 , https://github.com/microsoft/monaco-editor/issues/4496
export function shouldIgnoreError(err: Error) {
const ignorePatterns: Array<RegExp> = [
// https://github.com/go-gitea/gitea/issues/30861
// https://github.com/microsoft/monaco-editor/issues/4496
// https://github.com/microsoft/monaco-editor/issues/4679
/\/assets\/js\/.*monaco/,
];
for (const pattern of ignorePatterns) {
if (err.stack?.includes(pattern)) return true;
if (pattern.test(err.stack ?? '')) return true;
}
return false;
}
+1
View File
@@ -39,6 +39,7 @@ const baseOptions: MonacoOpts = {
wordWrapBreakAfterCharacters: '',
wordWrapBreakBeforeCharacters: '',
matchBrackets: 'never',
editContext: false, // https://github.com/microsoft/monaco-editor/issues/5081
};
function getCodeEditorConfig(input: HTMLInputElement): CodeEditorConfig | null {
+48 -36
View File
@@ -1,47 +1,59 @@
import {matchEmoji, matchMention} from './match.ts';
test('matchEmoji', () => {
expect(matchEmoji('')).toEqual([
'+1',
'-1',
'100',
'1234',
'1st_place_medal',
'2nd_place_medal',
]);
expect(matchEmoji('')).toMatchInlineSnapshot(`
[
"+1",
"-1",
"100",
"1234",
"1st_place_medal",
"2nd_place_medal",
]
`);
expect(matchEmoji('hea')).toEqual([
'headphones',
'headstone',
'health_worker',
'hear_no_evil',
'heard_mcdonald_islands',
'heart',
]);
expect(matchEmoji('hea')).toMatchInlineSnapshot(`
[
"head_shaking_horizontally",
"head_shaking_vertically",
"headphones",
"headstone",
"health_worker",
"hear_no_evil",
]
`);
expect(matchEmoji('hear')).toEqual([
'hear_no_evil',
'heard_mcdonald_islands',
'heart',
'heart_decoration',
'heart_eyes',
'heart_eyes_cat',
]);
expect(matchEmoji('hear')).toMatchInlineSnapshot(`
[
"hear_no_evil",
"heard_mcdonald_islands",
"heart",
"heart_decoration",
"heart_eyes",
"heart_eyes_cat",
]
`);
expect(matchEmoji('poo')).toEqual([
'poodle',
'hankey',
'spoon',
'bowl_with_spoon',
]);
expect(matchEmoji('poo')).toMatchInlineSnapshot(`
[
"poodle",
"hankey",
"spoon",
"bowl_with_spoon",
]
`);
expect(matchEmoji('1st_')).toEqual([
'1st_place_medal',
]);
expect(matchEmoji('1st_')).toMatchInlineSnapshot(`
[
"1st_place_medal",
]
`);
expect(matchEmoji('jellyfis')).toEqual([
'jellyfish',
]);
expect(matchEmoji('jellyfis')).toMatchInlineSnapshot(`
[
"jellyfish",
]
`);
});
test('matchMention', () => {