mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-11-27 21:03:56 +01:00
export monaco editor on window.codeEditors (#11739)
Fixes: https://github.com/go-gitea/gitea/issues/10409 Co-authored-by: Lauris BH <lauris@nix.lv>
This commit is contained in:
parent
4280d44a45
commit
160c23c4ab
1 changed files with 8 additions and 0 deletions
|
@ -35,6 +35,12 @@ function updateEditor(monaco, editor, filenameInput) {
|
||||||
if (language !== newLanguage) monaco.editor.setModelLanguage(model, newLanguage);
|
if (language !== newLanguage) monaco.editor.setModelLanguage(model, newLanguage);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// export editor for customization - https://github.com/go-gitea/gitea/issues/10409
|
||||||
|
function exportEditor(editor) {
|
||||||
|
if (!window.codeEditors) window.codeEditors = [];
|
||||||
|
if (!window.codeEditors.includes(editor)) window.codeEditors.push(editor);
|
||||||
|
}
|
||||||
|
|
||||||
export async function createCodeEditor(textarea, filenameInput, previewFileModes) {
|
export async function createCodeEditor(textarea, filenameInput, previewFileModes) {
|
||||||
const filename = basename(filenameInput.value);
|
const filename = basename(filenameInput.value);
|
||||||
const previewLink = document.querySelector('a[data-tab=preview]');
|
const previewLink = document.querySelector('a[data-tab=preview]');
|
||||||
|
@ -81,6 +87,8 @@ export async function createCodeEditor(textarea, filenameInput, previewFileModes
|
||||||
const loading = document.querySelector('.editor-loading');
|
const loading = document.querySelector('.editor-loading');
|
||||||
if (loading) loading.remove();
|
if (loading) loading.remove();
|
||||||
|
|
||||||
|
exportEditor(editor);
|
||||||
|
|
||||||
return editor;
|
return editor;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue