(neueId:string)
| 2295 | } |
| 2296 | |
| 2297 | cloneDocument(neueId:string) { |
| 2298 | let oldId = this.documentId; |
| 2299 | this.documentId = neueId; |
| 2300 | |
| 2301 | let navNode = this.navigator.nodes[oldId]; |
| 2302 | if(navNode) { |
| 2303 | let neueNode:TreeNode = {} as any; |
| 2304 | for(let attr in navNode) { |
| 2305 | neueNode[attr] = navNode[attr]; |
| 2306 | } |
| 2307 | neueNode.id = neueId; |
| 2308 | neueNode.name = neueId.split("/").pop(); |
| 2309 | neueNode.children = []; |
| 2310 | this.navigator.nodes[neueId] = neueNode; |
| 2311 | } |
| 2312 | |
| 2313 | if(this.navigator.currentId === oldId) this.navigator.currentId = neueId; |
| 2314 | |
| 2315 | let currentHashChunks = location.hash.split("#").slice(1); |
| 2316 | let modified = neueId; |
| 2317 | if(currentHashChunks[1]) { |
| 2318 | modified += `/#` + currentHashChunks[1]; |
| 2319 | } |
| 2320 | location.hash = modified; |
| 2321 | |
| 2322 | this.saveDocument(); |
| 2323 | this.navigator.loadDocument(neueId, neueId); |
| 2324 | |
| 2325 | // @FIXME: Will break in multi-workspace. |
| 2326 | this.navigator.nodes[this.navigator.rootId].children.push(neueId); |
| 2327 | } |
| 2328 | |
| 2329 | saveToGist() { |
| 2330 | // @FIXME: We really need a display name setup for documents. |
no test coverage detected