Skip to content

Commit 4cd5e3b

Browse files
authored
Merge branch 'main' into fix-math
2 parents a8b5398 + 82c59d5 commit 4cd5e3b

File tree

4 files changed

+22
-12
lines changed

4 files changed

+22
-12
lines changed

modules/lfs/shared.go

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,12 @@ import (
1414
const (
1515
// MediaType contains the media type for LFS server requests
1616
MediaType = "application/vnd.git-lfs+json"
17-
// Some LFS servers offer content with other types, so fallback to '*/*' if application/vnd.git-lfs+json cannot be served
18-
AcceptHeader = "application/vnd.git-lfs+json;q=0.9, */*;q=0.8"
19-
UserAgentHeader = "git-lfs"
17+
// AcceptHeader Some LFS servers offer content with other types, so fallback to '*/*' if application/vnd.git-lfs+json cannot be served
18+
AcceptHeader = "application/vnd.git-lfs+json;q=0.9, */*;q=0.8"
19+
// UserAgentHeader Add User-Agent for gitea's self-implemented lfs client,
20+
// and the version is consistent with the latest version of git lfs can be avoided incompatibilities.
21+
// Some lfs servers will check this
22+
UserAgentHeader = "git-lfs/3.6.0 (Gitea)"
2023
)
2124

2225
// BatchRequest contains multiple requests processed in one batch operation.

package-lock.json

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
"esbuild-loader": "4.2.2",
3030
"escape-goat": "4.0.0",
3131
"fast-glob": "3.3.2",
32-
"htmx.org": "2.0.3",
32+
"htmx.org": "2.0.4",
3333
"idiomorph": "0.3.0",
3434
"jquery": "3.7.1",
3535
"katex": "0.16.11",

web_src/js/features/codeeditor.ts

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,12 @@ function initLanguages(monaco: Monaco): void {
5858
for (const extension of extensions || []) {
5959
languagesByExt[extension] = id;
6060
}
61+
if (id === 'typescript') {
62+
monaco.languages.typescript.typescriptDefaults.setCompilerOptions({
63+
// this is needed to suppress error annotations in tsx regarding missing --jsx flag.
64+
jsx: monaco.languages.typescript.JsxEmit.Preserve,
65+
});
66+
}
6167
}
6268
}
6369

@@ -72,6 +78,8 @@ function updateEditor(monaco: Monaco, editor: IStandaloneCodeEditor, filename: s
7278
const language = model.getLanguageId();
7379
const newLanguage = getLanguage(filename);
7480
if (language !== newLanguage) monaco.editor.setModelLanguage(model, newLanguage);
81+
// TODO: Need to update the model uri with the new filename, but there is no easy way currently, see
82+
// https://github.com/microsoft/monaco-editor/discussions/3751
7583
}
7684

7785
// export editor for customization - https://github.com/go-gitea/gitea/issues/10409
@@ -135,19 +143,18 @@ export async function createMonaco(textarea: HTMLTextAreaElement, filename: stri
135143
});
136144
updateTheme(monaco);
137145

146+
const model = monaco.editor.createModel(textarea.value, language, monaco.Uri.file(filename));
147+
138148
const editor = monaco.editor.create(container, {
139-
value: textarea.value,
149+
model,
140150
theme: 'gitea',
141-
language,
142151
...other,
143152
});
144153

145154
monaco.editor.addKeybindingRules([
146155
{keybinding: monaco.KeyCode.Enter, command: null}, // disable enter from accepting code completion
147156
]);
148157

149-
const model = editor.getModel();
150-
if (!model) throw new Error('Unable to get editor model');
151158
model.onDidChangeContent(() => {
152159
textarea.value = editor.getValue({
153160
preserveBOM: true,

0 commit comments

Comments
 (0)