You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Application-Web/src/editor/ContentVersions.ts

23 lines
628 B

import { StepContent } from "../model/tactic/TacticInfo.ts"
export class ContentVersions {
private index = 0
private contents: StepContent[] = []
public insertAndCut(content: StepContent) {
this.contents.splice(this.index + 1)
this.contents.push(content)
this.index = this.contents.length - 1
}
public previous(): StepContent | null {
if (this.index == 0) return null
return this.contents[--this.index]
}
public next(): StepContent | null {
if (this.index == this.contents.length - 1) return null
return this.contents[++this.index]
}
}