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