fix: 实现 removeDocument

This commit is contained in:
mario.gk 2020-08-24 17:04:51 +08:00
parent 9ca00c5ba6
commit c07b447fb5
2 changed files with 9 additions and 1 deletions

View File

@ -461,7 +461,7 @@ export class DocumentModel {
*
*/
remove() {
// this.project.removeDocument(this);
this.project.removeDocument(this);
// todo: ...
}

View File

@ -69,6 +69,14 @@ export class Project {
this.documents.forEach((doc) => doc.remove());
}
removeDocument(doc: DocumentModel) {
const index = this.documents.indexOf(doc);
if (index < 0) {
return;
}
this.documents.splice(index, 1);
}
/**
*
*/