From 0185d84a1c8d4181b0d808a7a9d79cb4fa6f348f Mon Sep 17 00:00:00 2001 From: JulianPienaar <104741835+JulianPienaar@users.noreply.github.com> Date: Thu, 21 Sep 2023 17:45:43 +0200 Subject: [PATCH] Implemented functionality to test versioning --- frontend/src/app/edit/edit.component.ts | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/frontend/src/app/edit/edit.component.ts b/frontend/src/app/edit/edit.component.ts index 142f4f4f..c5ec5d15 100644 --- a/frontend/src/app/edit/edit.component.ts +++ b/frontend/src/app/edit/edit.component.ts @@ -788,15 +788,16 @@ export class EditComponent implements AfterViewInit, OnInit { insertContent(obj: any) { console.log("Just clicked on: " , obj); - // this.deselectAllHistory(); - // obj.isCurrent = true; - // if (obj.SnapshotID === 'LATEST') { - // this.disableReadOnly(); - // this.editor.setData(obj.Content); - // return; - // } - // this.enableReadOnly(); - // this.editor.setData(obj.Content); + if(!obj.Content) return; + this.deselectAllHistory(); + obj.isCurrent = true; + if (obj.Name === 'Latest') { + this.disableReadOnly(); + this.editor.setData(obj.Content); + return; + } + this.enableReadOnly(); + this.editor.setData(obj.Content); } deselectAllHistory() { @@ -821,7 +822,9 @@ export class EditComponent implements AfterViewInit, OnInit { //retrieve all diff content and previous snapshot content this.versioningApiService.loadHistorySet(this.editService.getMarkdownID() as string, snapshot.ChildDiffs, snapshot.snapshotID).then((data) => { if(data !== null){ - console.log("Process diff data."); + console.log("Process diff data.", data); + snapshot.Content =data.SnapshotHistory[0].Content; + } else { this.messageService.add({