Add Fold: Toggle Fold command
This commit is contained in:
parent
5f1f02e8b9
commit
eefd8a5245
@ -94,6 +94,7 @@ export {
|
|||||||
StreamLanguage,
|
StreamLanguage,
|
||||||
syntaxHighlighting,
|
syntaxHighlighting,
|
||||||
syntaxTree,
|
syntaxTree,
|
||||||
|
toggleFold,
|
||||||
unfoldAll,
|
unfoldAll,
|
||||||
unfoldCode,
|
unfoldCode,
|
||||||
} from "@codemirror/language";
|
} from "@codemirror/language";
|
||||||
|
@ -139,6 +139,10 @@ export function unfold() {
|
|||||||
return syscall("editor.unfold");
|
return syscall("editor.unfold");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function toggleFold() {
|
||||||
|
return syscall("editor.toggleFold");
|
||||||
|
}
|
||||||
|
|
||||||
export function foldAll() {
|
export function foldAll() {
|
||||||
return syscall("editor.foldAll");
|
return syscall("editor.foldAll");
|
||||||
}
|
}
|
||||||
|
@ -382,6 +382,12 @@ functions:
|
|||||||
name: "Fold: Unfold"
|
name: "Fold: Unfold"
|
||||||
mac: "Cmd-Alt-]"
|
mac: "Cmd-Alt-]"
|
||||||
key: "Ctrl-Shift-]"
|
key: "Ctrl-Shift-]"
|
||||||
|
toggleFoldCommand:
|
||||||
|
path: ./editor.ts:toggleFoldCommand
|
||||||
|
command:
|
||||||
|
name: "Fold: Toggle Fold"
|
||||||
|
mac: "Cmd-Alt-f"
|
||||||
|
key: "Ctrl-Shift-f"
|
||||||
foldAllCommand:
|
foldAllCommand:
|
||||||
path: ./editor.ts:foldAllCommand
|
path: ./editor.ts:foldAllCommand
|
||||||
command:
|
command:
|
||||||
|
@ -26,6 +26,10 @@ export async function unfoldCommand() {
|
|||||||
await editor.unfold();
|
await editor.unfold();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export async function toggleFoldCommand() {
|
||||||
|
await editor.toggleFold();
|
||||||
|
}
|
||||||
|
|
||||||
export async function foldAllCommand() {
|
export async function foldAllCommand() {
|
||||||
await editor.foldAll();
|
await editor.foldAll();
|
||||||
}
|
}
|
||||||
|
@ -3,6 +3,7 @@ import {
|
|||||||
EditorView,
|
EditorView,
|
||||||
foldAll,
|
foldAll,
|
||||||
foldCode,
|
foldCode,
|
||||||
|
toggleFold,
|
||||||
Transaction,
|
Transaction,
|
||||||
unfoldAll,
|
unfoldAll,
|
||||||
unfoldCode,
|
unfoldCode,
|
||||||
@ -188,6 +189,9 @@ export function editorSyscalls(editor: Editor): SysCallMapping {
|
|||||||
"editor.unfold": () => {
|
"editor.unfold": () => {
|
||||||
unfoldCode(editor.editorView!);
|
unfoldCode(editor.editorView!);
|
||||||
},
|
},
|
||||||
|
"editor.toggleFold": () => {
|
||||||
|
toggleFold(editor.editorView!);
|
||||||
|
},
|
||||||
"editor.foldAll": () => {
|
"editor.foldAll": () => {
|
||||||
foldAll(editor.editorView!);
|
foldAll(editor.editorView!);
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user