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

Method loadDocument

src/ide.ts:2214–2237  ·  view source on GitHub ↗
(generation:number, text:string, packed:any[], attributes:{[id:string]: any|undefined}, css:string)

Source from the content-addressed store, hash-verified

2212 }
2213
2214 loadDocument(generation:number, text:string, packed:any[], attributes:{[id:string]: any|undefined}, css:string) {
2215 if(generation < this.generation && generation !== undefined) return;
2216 if(this.loaded) {
2217 this.editor.updateDocument(packed, attributes);
2218 } else {
2219 this.editor.loadDocument(this.documentId, text, packed, attributes);
2220 this.loaded = true;
2221 this.loading = false;
2222 }
2223
2224 if(this.documentId) {
2225 let name = this.documentId; // @FIXME
2226 this.navigator.loadDocument(this.documentId, name);
2227 this.navigator.currentId = this.documentId;
2228 this.comments.update();
2229 } else {
2230 // Empty file
2231 }
2232
2233 document.getElementById("app-styles").innerHTML = css;
2234 document.getElementsByClassName("CodeMirror")[0].classList.remove("cm-s-default"); // remove document wide code-styling
2235
2236 this.render();
2237 }
2238
2239 saveDocument() {
2240 if(!this.documentId || !this.loaded) return;

Callers 2

_parseMethod · 0.45
cloneDocumentMethod · 0.45

Calls 4

renderMethod · 0.95
updateDocumentMethod · 0.80
updateMethod · 0.65
removeMethod · 0.45

Tested by

no test coverage detected