Skip to content

Commit

Permalink
make exporters promise based
Browse files Browse the repository at this point in the history
  • Loading branch information
johanneswilm committed Apr 11, 2020
1 parent 8021ae6 commit 2cd296f
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export class EpubBookExporter extends DOMExporter {
addAlert('error', gettext('Book cannot be exported due to lack of chapters.'))
return false
}
getMissingChapterData(this.book, this.docList, this.schema).then(
return getMissingChapterData(this.book, this.docList, this.schema).then(
() => this.exportOne()
)
}
Expand Down Expand Up @@ -168,8 +168,7 @@ export class EpubBookExporter extends DOMExporter {
}
)
})
Promise.all(citRendererPromises).then(() => this.exportTwo())

return Promise.all(citRendererPromises).then(() => this.exportTwo())
}

exportTwo() {
Expand Down Expand Up @@ -199,7 +198,7 @@ export class EpubBookExporter extends DOMExporter {
}
})
)
this.loadStyles().then(
return this.loadStyles().then(
() => this.exportThree()
)
}
Expand Down
10 changes: 4 additions & 6 deletions fiduswriter/book/static/js/modules/books/exporter/html/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export class HTMLBookExporter extends DOMExporter {
return false
}

getMissingChapterData(this.book, this.docList, this.schema).then(
return getMissingChapterData(this.book, this.docList, this.schema).then(
() => this.exportOne()
)
}
Expand Down Expand Up @@ -105,7 +105,7 @@ export class HTMLBookExporter extends DOMExporter {
}
)
})
Promise.all(citRendererPromises).then(() => this.exportTwo())
return Promise.all(citRendererPromises).then(() => this.exportTwo())

}

Expand Down Expand Up @@ -180,9 +180,7 @@ export class HTMLBookExporter extends DOMExporter {
})
})



this.exportThree()
return this.exportThree()

}

Expand All @@ -196,7 +194,7 @@ export class HTMLBookExporter extends DOMExporter {
})
}

this.loadStyles().then(
return this.loadStyles().then(
() => {
this.styleSheets.forEach(styleSheet => {
if (styleSheet.filename) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,15 @@ export class LatexBookExporter {

this.textFiles = []
this.httpFiles = []
}

getMissingChapterData(this.book, this.docList, this.schema).then(
() => this.init()
init() {
return getMissingChapterData(this.book, this.docList, this.schema).then(
() => this.export()
)
}

init() {
export() {
this.zipFileName = `${createSlug(this.book.title)}.latex.zip`
let bibIds = [], imageIds = []
const features = {}, combinedBibliography = {}, combinedImages = {}
Expand Down
3 changes: 2 additions & 1 deletion fiduswriter/book/static/js/modules/books/menu.js
Original file line number Diff line number Diff line change
Expand Up @@ -132,13 +132,14 @@ export const bulkMenuModel = () => ({
const book = overview.bookList.find(book => book.id===id)
addAlert('info', book.title + ': ' + gettext(
'LaTeX export has been initiated.'))
new LatexBookExporter(
const exporter = new LatexBookExporter(
overview.schema,
book,
overview.user,
overview.documentList,
new Date(book.updated * 1000)
)
return exporter.init()
})
},
disabled: overview => !overview.getSelected().length
Expand Down

0 comments on commit 2cd296f

Please sign in to comment.