diff --git a/fiduswriter/book/static/js/modules/books/exporter/epub/index.js b/fiduswriter/book/static/js/modules/books/exporter/epub/index.js index b176adf..d3dc60e 100644 --- a/fiduswriter/book/static/js/modules/books/exporter/epub/index.js +++ b/fiduswriter/book/static/js/modules/books/exporter/epub/index.js @@ -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() ) } @@ -168,8 +168,7 @@ export class EpubBookExporter extends DOMExporter { } ) }) - Promise.all(citRendererPromises).then(() => this.exportTwo()) - + return Promise.all(citRendererPromises).then(() => this.exportTwo()) } exportTwo() { @@ -199,7 +198,7 @@ export class EpubBookExporter extends DOMExporter { } }) ) - this.loadStyles().then( + return this.loadStyles().then( () => this.exportThree() ) } diff --git a/fiduswriter/book/static/js/modules/books/exporter/html/index.js b/fiduswriter/book/static/js/modules/books/exporter/html/index.js index d5cbf7b..e9fc391 100644 --- a/fiduswriter/book/static/js/modules/books/exporter/html/index.js +++ b/fiduswriter/book/static/js/modules/books/exporter/html/index.js @@ -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() ) } @@ -105,7 +105,7 @@ export class HTMLBookExporter extends DOMExporter { } ) }) - Promise.all(citRendererPromises).then(() => this.exportTwo()) + return Promise.all(citRendererPromises).then(() => this.exportTwo()) } @@ -180,9 +180,7 @@ export class HTMLBookExporter extends DOMExporter { }) }) - - - this.exportThree() + return this.exportThree() } @@ -196,7 +194,7 @@ export class HTMLBookExporter extends DOMExporter { }) } - this.loadStyles().then( + return this.loadStyles().then( () => { this.styleSheets.forEach(styleSheet => { if (styleSheet.filename) { diff --git a/fiduswriter/book/static/js/modules/books/exporter/latex/index.js b/fiduswriter/book/static/js/modules/books/exporter/latex/index.js index fe2b5a2..e04ff4a 100644 --- a/fiduswriter/book/static/js/modules/books/exporter/latex/index.js +++ b/fiduswriter/book/static/js/modules/books/exporter/latex/index.js @@ -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 = {} diff --git a/fiduswriter/book/static/js/modules/books/menu.js b/fiduswriter/book/static/js/modules/books/menu.js index bd50304..079a7dd 100644 --- a/fiduswriter/book/static/js/modules/books/menu.js +++ b/fiduswriter/book/static/js/modules/books/menu.js @@ -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