(generation:number, text:string, packed:any[], attributes:{[id:string]: any|undefined}, css:string)
| 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; |
no test coverage detected