Beginner documentation:
Listening to editor right-click menu
Listening to the user opening the right-click menu in the editor can be done using
Accept user input using modals
Reading and writing files
File system access through Node.js fs seems to be blocked as running the following code
import { writeFileSync } from "fs";
function writeFile() {
writeFileSync("dummy-file-name.txt", "random data");
}
will result in Uncaught Error: EROFS: read-only file system, open 'dummy-file-name.txt'
.
Instead of directly working with the file system, you are supposed to work through the Vault or the FileSystemAdapter.