MCPcopy
hub / github.com/witheve/Eve / createDocument

Method createDocument

src/ide.ts:2365–2380  ·  view source on GitHub ↗
(folder:string)

Source from the content-addressed store, hash-verified

2363 }
2364
2365 createDocument(folder:string) {
2366 let newId:string|undefined;
2367 let ix = 0;
2368 while(!newId) {
2369 newId = `/${folder}/untitled${ix ? "-" + ix : ""}.eve`;
2370 if(this._fileCache[newId]) newId = undefined;
2371 }
2372 let emptyTemplate = `# Untitled`;
2373 this._fileCache[newId] = emptyTemplate;
2374 // @FIXME: Need a way to side-load a single node that isn't hardwired to a span.
2375 // Split the current updateNode up.
2376 // @FIXME: This won't work with multiple workspaces obviously.
2377 this.loadWorkspace("examples", this._fileCache);
2378 if(this.onSaveDocument) this.onSaveDocument(this, newId, emptyTemplate);
2379 this.loadFile(newId);
2380 }
2381
2382 injectSpans(packed:any[], attributes:{[id:string]: any|undefined}) {
2383 this.editor.injectSpans(packed, attributes);

Callers 1

NavigatorClass · 0.80

Calls 2

loadWorkspaceMethod · 0.95
loadFileMethod · 0.95

Tested by

no test coverage detected