diff --git a/.circleci/config.yml b/.circleci/config.yml index 4c635e3..e7d121c 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -2,7 +2,10 @@ version: 2 jobs: build: docker: - - image: circleci/node:lts-browsers + - image: circleci/node:8.10-browsers + environment: + JOBS: 2 + parallelism: 1 working_directory: ~/repo steps: - checkout diff --git a/addon/components/printable-pages.js b/addon/components/printable-pages.js index fa9ecaa..b43b276 100644 --- a/addon/components/printable-pages.js +++ b/addon/components/printable-pages.js @@ -4,6 +4,7 @@ import { inject as service } from "@ember/service"; import { alias } from "@ember/object/computed"; import { next } from "@ember/runloop"; import { task } from "ember-concurrency"; +import { Promise } from "rsvp"; export default Component.extend({ layout, @@ -28,19 +29,34 @@ export default Component.extend({ // TASKS renderStartTask: task(function*(currentPage) { if (this.onRenderStart) { - next(() => this.onRenderStart(currentPage)); + yield new Promise(resolve => { + next(() => { + this.onRenderStart(currentPage); + resolve(); + }); + }); } }).keepLatest(), renderProgressTask: task(function*() { if (this.onRenderProgress) { - next(() => this.onRenderProgress(this.reportObject.lastPage)); + yield new Promise(resolve => { + next(() => { + this.onRenderProgress(this.reportObject.lastPage); + resolve(); + }); + }); } }).keepLatest(), reportIfCompleteTask: task(function*() { if (this.reportObject.isFinishedRendering && this.onRenderComplete) { - next(() => this.onRenderComplete(this.reportObject.lastPage)); + yield new Promise(resolve => { + next(() => { + this.onRenderComplete(this.reportObject.lastPage); + resolve(); + }); + }); } }).keepLatest(), diff --git a/addon/components/printable-pages/section.js b/addon/components/printable-pages/section.js index 8963932..c59cd1e 100644 --- a/addon/components/printable-pages/section.js +++ b/addon/components/printable-pages/section.js @@ -1,7 +1,6 @@ import Component from "@ember/component"; import layout from "../../templates/components/printable-pages/section"; import { getBy, array, sum, raw } from "ember-awesome-macros"; -import { alias } from "@ember/object/computed"; import { htmlSafe } from "@ember/template"; export default Component.extend({ @@ -18,7 +17,10 @@ export default Component.extend({ this._super(...arguments); if (!this.shouldRender) return; - let id = this.register({data: this.data || [], columnCount: this.columnCount}); + let id = this.register({ + data: this.data || [], + columnCount: this.columnCount + }); this.set("id", id); }, diff --git a/addon/services/document-data.js b/addon/services/document-data.js index 6be9f10..59e5427 100644 --- a/addon/services/document-data.js +++ b/addon/services/document-data.js @@ -1,7 +1,7 @@ import Service from "@ember/service"; import EmberObject, { computed } from "@ember/object"; import { A } from "@ember/array"; -import { array, equal, raw, difference } from "ember-awesome-macros"; +import { array, equal, difference } from "ember-awesome-macros"; import { alias } from "@ember/object/computed"; import { run } from "@ember/runloop"; diff --git a/addon/templates/components/printable-pages.hbs b/addon/templates/components/printable-pages.hbs index 904cf98..8c50fb2 100644 --- a/addon/templates/components/printable-pages.hbs +++ b/addon/templates/components/printable-pages.hbs @@ -1,15 +1,15 @@ {{yield (hash - title-page=(component 'printable-pages/title-page' + title-page=(component "printable-pages/title-page" pageLayout=this.pageLayout pageCount=this.reportObject.lastPage ) - chapter=(component 'printable-pages/chapter' + chapter=(component "printable-pages/chapter" chapters=this.chapters lastReportPage=this.reportObject.lastPage pageLayout=this.pageLayout - register=(action 'registerChapter') - registerSection=(action 'registerSection' this.elementId) - addPage=(action 'addPage') + register=(action "registerChapter") + registerSection=(action "registerSection" this.elementId) + addPage=(action "addPage") checkIfComplete=(perform this.reportIfCompleteTask) ) )}} diff --git a/addon/templates/components/printable-pages/chapter-page.hbs b/addon/templates/components/printable-pages/chapter-page.hbs index a1b463e..36e4b9a 100644 --- a/addon/templates/components/printable-pages/chapter-page.hbs +++ b/addon/templates/components/printable-pages/chapter-page.hbs @@ -1,25 +1,27 @@ {{yield (hash - block='header' - meta=@pageMeta + block="header" + meta=pageMeta )}} -
+{{! template-lint-disable no-inline-styles }} +
{{yield (hash - block='body' + block="body" element=this.element - meta=@pageMeta - registerSection=(action 'registerSection') - onReadyForNextItem=(action 'onReadyForNextItem') + meta=pageMeta + registerSection=(action "registerSection") + onReadyForNextItem=(action "onReadyForNextItem") ) }} {{! element used to check if the content has overflowed page body}} -
+
+{{! template-lint-enable no-inline-styles }} {{yield (hash - block='footer' - meta=@pageMeta + block="footer" + meta=pageMeta )}}
diff --git a/addon/templates/components/printable-pages/chapter.hbs b/addon/templates/components/printable-pages/chapter.hbs index e70cd2b..3dd2368 100644 --- a/addon/templates/components/printable-pages/chapter.hbs +++ b/addon/templates/components/printable-pages/chapter.hbs @@ -1,38 +1,38 @@ {{#each this.pages as |page pageIndexInChapter|}} - {{#printable-pages/page-layout pageLayout=@pageLayout}} + {{#printable-pages/page-layout pageLayout=pageLayout}} {{#printable-pages/chapter-page pageIndexInChapter=pageIndexInChapter pageMeta=(hash current=(add this.startPage pageIndexInChapter) chapterNumber=(inc this.chapter.index) - total=@lastReportPage + total=lastReportPage isFirst=(eq page.number 1) isFirstInChapter=(eq page.number this.startPage) - isLast=(eq page.number @lastReportPage) + isLast=(eq page.number lastReportPage) isLastInChapter=(eq page.number this.endPage) ) registerSection=(action this.registerSection this.elementId) - renderNextItem=(action 'renderNextItem' pageIndexInChapter) - onPageOverflow=(action 'onPageOverflow' pageIndexInChapter) + renderNextItem=(action "renderNextItem" pageIndexInChapter) + onPageOverflow=(action "onPageOverflow" pageIndexInChapter) as |pageComponent| }} - {{#if (eq pageComponent.block 'header')}} + {{#if (eq pageComponent.block "header")}} {{yield (hash - page-header=(component 'printable-pages/page-header' pageMeta=pageComponent.meta) - section=(component 'printable-pages/section' shouldRender=false) - page-footer=(component 'printable-pages/page-footer' shouldRender=false) + page-header=(component "printable-pages/page-header" pageMeta=pageComponent.meta) + section=(component "printable-pages/section" shouldRender=false) + page-footer=(component "printable-pages/page-footer" shouldRender=false) )}} {{/if}} - {{#if (eq pageComponent.block 'body')}} + {{#if (eq pageComponent.block "body")}} {{yield (hash number=pageComponent.meta - page-header=(component 'printable-pages/page-header' shouldRender=false) - page-footer=(component 'printable-pages/page-footer' shouldRender=false) + page-header=(component "printable-pages/page-header" shouldRender=false) + page-footer=(component "printable-pages/page-footer" shouldRender=false) - section=(component 'printable-pages/section' + section=(component "printable-pages/section" sectionMap=this.chapter.sectionMap pageIndexInChapter=pageIndexInChapter pageElement=pageComponent.element @@ -43,11 +43,11 @@ )}} {{/if}} - {{#if (eq pageComponent.block 'footer')}} + {{#if (eq pageComponent.block "footer")}} {{yield (hash - page-header=(component 'printable-pages/page-header' shouldRender=false) - section=(component 'printable-pages/section' shouldRender=false) - page-footer=(component 'printable-pages/page-footer' pageMeta=pageComponent.meta) + page-header=(component "printable-pages/page-header" shouldRender=false) + section=(component "printable-pages/section" shouldRender=false) + page-footer=(component "printable-pages/page-footer" pageMeta=pageComponent.meta) )}} {{/if}} {{/printable-pages/chapter-page}} diff --git a/addon/templates/components/printable-pages/page-footer.hbs b/addon/templates/components/printable-pages/page-footer.hbs index e48ade8..2d058d1 100644 --- a/addon/templates/components/printable-pages/page-footer.hbs +++ b/addon/templates/components/printable-pages/page-footer.hbs @@ -1,5 +1,5 @@ {{#if shouldRender}} -