Resolve "PagedJS CSS editor."
Closes #1440 (closed)
With this MR we have the following feature:
- Enables user to use his own njk templates ONLY for the PDF case.
- We can have different templates per Group. Which means that a template will be the same across all manuscripts of the same group.
- Upgraded The pagedJs to version cokoapps/pagedjs:1.6.9
- Added CodeMirror for the users to edit template , css easier.
- Added ArticleTemplate model to save the templates per group.
- Added at the group seed a script to seed the above template from the default file template.
- 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.