Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
cophilot committed Oct 9, 2023
1 parent 8d6ba28 commit f5eb1a5
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/app/edit/edit-chapter/edit-chapter.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,9 +114,15 @@ export class EditChapterComponent {

@HostListener('document:keydown.control.alt.a', ['$event'])
addPage(): void {
this.chapter.Pages.push(new Page('', '', ''));
this.currentPage = this.chapter.Pages.length - 1;
//this.chapter.Pages.push(new Page('', '', ''));
if (this.currentPage + 1 >= this.chapter.Pages.length) {
this.chapter.Pages.push(new Page('', '', ''));
} else {
this.chapter.Pages.splice(this.currentPage + 1, 0, new Page('', '', ''));
}
this.currentPage++;
this.pageInput = this.currentPage + 1;

window.scrollTo({ top: 0 });
this.changes = true;
}
Expand Down
2 changes: 2 additions & 0 deletions src/app/services/irisinterface.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,7 @@ export class IrisinterfaceService {
}

uploadImage(name: string, content: any): Observable<any> {
name = name.replace(/ /g, '_');
return this.http
.post(
'http://' +
Expand All @@ -264,6 +265,7 @@ export class IrisinterfaceService {
}

uploadFile(name: string, content: any): Observable<any> {
name = name.replace(/ /g, '_');
return this.http
.post(
'http://' +
Expand Down
8 changes: 8 additions & 0 deletions src/utils/classes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,14 @@ export class Chapter {
}
return -1;
}

addPageAt(page: Page, index: number) {
if (index >= this.Pages.length) {
this.Pages.push(page);
return;
}
this.Pages = this.Pages.splice(index, 0, page);
}
}

export class Page {
Expand Down

0 comments on commit f5eb1a5

Please sign in to comment.