From ddc408690cf0931ca5d640a49a2de5091dc5edd6 Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Tue, 12 Oct 2021 11:02:06 +0100 Subject: [PATCH] Fix EditorModel clone to actually be useful --- src/editor/model.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/editor/model.ts b/src/editor/model.ts index 212a7d17c0..b9850a7ba7 100644 --- a/src/editor/model.ts +++ b/src/editor/model.ts @@ -91,7 +91,8 @@ export default class EditorModel { } public clone(): EditorModel { - return new EditorModel(this._parts, this._partCreator, this.updateCallback); + const clonedParts = this.parts.map(p => this.partCreator.deserializePart(p.serialize())); + return new EditorModel(clonedParts, this._partCreator, this.updateCallback); } private insertPart(index: number, part: Part): void {