Skip to content

Resolve "PagedJS CSS editor."

Giannis Kopanas requested to merge 1440-pagedjs-css-editor into main

Closes #1440 (closed)

With this MR we have the following feature:

  1. Enables user to use his own njk templates ONLY for the PDF case.
  2. We can have different templates per Group. Which means that a template will be the same across all manuscripts of the same group.
  3. Upgraded The pagedJs to version cokoapps/pagedjs:1.6.9
  4. Added CodeMirror for the users to edit template , css easier.
  5. Added ArticleTemplate model to save the templates per group.
  6. Added at the group seed a script to seed the above template from the default file template.
  7. Added Tabs at the manuscript page in order for the user to add css , a template article.njk content. and added a simple version of asset manager just to upload files that can be used from the template to show images.

Parts of changes need to be discussed :

So The changes should only affect the PAGEDJS case and nothing more. During the first run of the app , i check the the default template file and i seed the article_templates table. After that the user will update only that table through the UI. if we add a new template (article.njk) file at the config/journal/export or at the server/pdfexport/pdfTemplates/article.njk will be ignored. i do that by just checking if there is a row at the table for that specific group.

I did that by changing the applyTemplate function. So now it first checks if a specific template is passed as argument( which comes from article_templates) if there is not template then it loads the user defined template that exists in the server/pdfexport/pdfTemplates/article.njk if that doesnt exist then falls back to the default article .

Something similar is happening to the Css i use the generateCss function in order to load the css to the pagedjs function.

Edited by Giannis Kopanas

Merge request reports