Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion frontend/src/utils/file.ts
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ const isSpecialEditorFileName = (value: string) => {
if (!normalized) {
return false;
}
return specialEditorFileNames.some((filename) => normalized === filename || normalized.startsWith(`${filename}.`));
return specialEditorFileNames.some((filename) => normalized === filename);
};

export const resolveEditorLanguage = (path: string, extension = '', name = '') => {
Expand Down
1 change: 1 addition & 0 deletions frontend/src/utils/monaco.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ export async function loadMonacoLanguageSupport() {
import('monaco-editor/esm/vs/editor/contrib/folding/browser/folding.js'),
import('monaco-editor/esm/vs/editor/contrib/contextmenu/browser/contextmenu.js'),
import('monaco-editor/esm/vs/editor/contrib/clipboard/browser/clipboard.js'),
import('monaco-editor/esm/vs/editor/contrib/comment/browser/comment.js'),
import('monaco-editor/esm/vs/editor/contrib/dropOrPasteInto/browser/copyPasteContribution.js'),
import('monaco-editor/esm/vs/editor/contrib/find/browser/findController.js'),
import('monaco-editor/esm/vs/editor/contrib/multicursor/browser/multicursor.js'),
Expand Down
6 changes: 6 additions & 0 deletions frontend/src/views/host/file-management/code-editor/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -965,6 +965,8 @@ const initEditor = async () => {
editor.getModel()?.pushEOL(config.eol);

editor.addCommand(monaco.KeyMod.CtrlCmd | monaco.KeyCode.KeyS, quickSave);
editor.addCommand(monaco.KeyMod.CtrlCmd | monaco.KeyCode.Slash, quickToggleComment);
editor.focus();

editor.onDidChangeModelContent(() => {
if (editor) {
Expand All @@ -980,6 +982,10 @@ const quickSave = () => {
saveContent();
};

const quickToggleComment = () => {
void editor?.getAction('editor.action.commentLine')?.run();
};

const openHistoryDrawer = () => {
if (!form.value.path) {
MsgWarning(i18n.global.t('file.historyNeedFile'));
Expand Down
Loading