-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
✨(frontend) Pad to PDF #31
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
AntoLC
added
javascript
Pull requests that update Javascript code
frontend
feature
labels
Apr 9, 2024
AntoLC
force-pushed
the
feature/frontend/print-pdf
branch
6 times, most recently
from
April 10, 2024 18:05
bfeffa9
to
cd58140
Compare
To spread the data editor to different feature of our app, we add the editor in the pad store. It will give an easy access to the editor data.
To allow the frontend to make requests to the backend, we need to add the frontend's origin to the CSRF_TRUSTED_ORIGINS setting.
Add the hook useCreatePdfFromMarkdown, it will be used to generate a pdf from a a template and a markdown.
Feature to print the pad to pdf. It display a button in the pad toolbar, when clicked it will convert the pad to markdown, send the markdown with a template to the backend to convert it to pdf and then download the pdf.
When we converted from markdown to html, we didn't format the html, so it was displayed like a string in our pdf. We now format_html the html before we generate the pdf.
.devcontainer is used to create virtual environment for development. It is not necessary to be included in the git repository.
Create the create_demo command. It creates a demo template for the backend. We add it in the makefile bootstrap. We force the template id, this id is the same as used in the frontend for the moment. When the template feature will be created in the frontend side we will not have to force it anymore.
Add a test to check the pdf export of the impress app. It intercept the download of the PDF and read its content. We can assert that the template is correctly rendered, and that the pad text is present as well.
AntoLC
force-pushed
the
feature/frontend/print-pdf
branch
from
April 10, 2024 20:06
cd58140
to
9828bf3
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Purpose
Generate a PDF thank to the pad with a template integrated.
Proposal
make demo
)Demo
scrnli_4_10_2024_4-43-24.PM.webm
Improvement
The frontend editor is in
json
at the base, when we want to print to pdf, we convert fromjson
tomarkdown
on the frontside, then frommarkdown
tohtml
on the back side. Each conversion make us loose some data accuracy.We could improve that by converting directly from the frontend from
json
tohtml
, the backend will just have to inject the data.