@snippetify/book-reader-component
Version:
Book Reader Component
15 lines (14 loc) • 459 B
JavaScript
export class Selection {
constructor(data) {
this.content = data.content;
this.pages = data.pages || [];
this.serialized = data.serialized;
this.references = data.references || []; // Paragraph positions in page start from 1
}
isOnSinglePage() {
return this.pages.length === 1 || this.pages[0] === this.pages[1];
}
isOnSingleELement() {
return this.references.length === 1 || this.references[0] === this.references[1];
}
}