Conversation
|
Thanks for the pull request, @Kelketek! This repository is currently maintained by Once you've gone through the following steps feel free to tag them in a comment and let them know that your changes are ready for engineering review. 🔘 Get product approvalIf you haven't already, check this list to see if your contribution needs to go through the product review process.
🔘 Provide contextTo help your reviewers and other members of the community understand the purpose and larger context of your changes, feel free to add as much of the following information to the PR description as you can:
🔘 Get a green buildIf one or more checks are failing, continue working on your changes until this is no longer the case and your build turns green. 🔘 Update the status of your PRYour PR is currently marked as a draft. After completing the steps above, update its status by clicking "Ready for Review", or removing "WIP" from the title, as appropriate. Where can I find more information?If you'd like to get more details on all aspects of the review process for open source pull requests (OSPRs), check out the following resources: When can I expect my changes to be merged?Our goal is to get community contributions seen and reviewed as efficiently as possible. However, the amount of time that it takes to review and merge a PR can vary significantly based on factors such as:
💡 As a result it may take up to several weeks or months to complete a review and merge your PR. |
1926631 to
1847a88
Compare
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #2916 +/- ##
==========================================
+ Coverage 95.51% 95.52% +0.01%
==========================================
Files 1329 1349 +20
Lines 30557 30816 +259
Branches 6930 6965 +35
==========================================
+ Hits 29186 29437 +251
- Misses 1303 1323 +20
+ Partials 68 56 -12 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
01e348a to
129b7e5
Compare
samuelallan72
left a comment
There was a problem hiding this comment.
@Kelketek I tested this locally and found it worked as advertised, including testing with and without PDFXBLOCK_DISABLE_ALL_DOWNLOAD = True in openedx-platform settings. I've made some comments inline for consideration.
...tors/containers/VideoEditor/components/VideoSettingsModal/components/HandoutWidget/hooks.jsx
Outdated
Show resolved
Hide resolved
| @@ -0,0 +1,30 @@ | |||
| import React from 'react'; | |||
There was a problem hiding this comment.
This checkbox field is somewhat generic, and probably could go under src/editors/sharedComponents somewhere.
Also, there is an existing FormCheckbox; I'm not sure if that can simply be reused?
There was a problem hiding this comment.
The existing one is part of the SelectableBox set. It appears to be deprecated? It doesn't support Formik, either, so it has a lot of manual machinery that has to be managed.
I'll see about putting it somewhere else.
There was a problem hiding this comment.
That's fair, I guessed it could be related to deprecated code. +1
| }, | ||
| easyMode: { | ||
| id: 'authoring.pdfEditor.widgets.uploadWidget.easyMode', | ||
| defaultMessage: 'Easy Mode', |
There was a problem hiding this comment.
I feel like "easy mode" is slightly confusing, although I'm not sure what it should be. Something for Cassie to look at in product review. :)
src/editors/containers/PdfEditor/components/fields/UploadWidget.tsx
Outdated
Show resolved
Hide resolved
src/editors/containers/PdfEditor/components/fields/UploadWidget.tsx
Outdated
Show resolved
Hide resolved
src/editors/containers/PdfEditor/components/fields/UploadWidget.tsx
Outdated
Show resolved
Hide resolved
src/editors/containers/PdfEditor/components/sections/DownloadOptions.tsx
Outdated
Show resolved
Hide resolved
| {manualMode && <TextField label="PDF Url" id="pdf-url" name="url" />} | ||
| {!manualMode && ( | ||
| <> | ||
| <FileInput supportedFileFormats={supportedFileFormats} fileInput={fileInput} /> |
There was a problem hiding this comment.
Currently the file input behaviour here when you select a file using the "replace" button is:
- Immediately upload the new file to studio assets without confirmation. This means if you change your mind and pick a different file, or cancel the editor altogether, the file is still uploaded to studio assets.
- Ignore any previously uploaded file, leaving it in studio assets.
I don't think this behaviour matches user expectations or the expected meaning of "replace" here. I'm not sure what would be best, but some inline information to explain the behaviour, and/or changing the behaviour, might be helpful here. Eg. adding a warning about how uploads work and where they're uploaded to, and maybe only performing the upload when the editor is saved?
There was a problem hiding this comment.
@samuelallan72 This behavior matches the behavior of the video handout upload field. While I agree that the auto-upload could be surprising, I believe the reason for it makes sense here based on the following:
- The 'save' button isn't something the block can capture and modify the behavior of. That machinery is outside of the editor's control.
- The only way to determine the URL value for the field is to have performed the upload, so it must be done before the user hits save.
- No other field on a block editor requires an additional extra save action. Users expect that hitting 'save' saves everything they've done, and if they forget to hit an additional 'upload' button, they may think things broke.
One way that this field departs from the Handout widget is that there is no 'delete handout' equivalent, because the URL is a required field. Even when you select that option, though, it only sets the field 'null' and doesn't remove the file from the course assets.
There was a problem hiding this comment.
Thanks @Kelketek , that makes sense.
Perhaps just adding some informational text next to the field so users aren't surprised by the behaviour.
There was a problem hiding this comment.
The 'save' button isn't something the block can capture and modify the behavior of. That machinery is outside of the editor's control.
Ah this must be different to the legacy studio editor views then? As I was reminded of for BB-10556, in the branching xblock, we do override the save method.
There was a problem hiding this comment.
@samuelallan72 Yep, it's different. The state management and callbacks are all centralized in the redux definitions. All of the editors take the same path after the save button is hit, with a big if chain changing how the data is massaged before hitting the endpoint.
By contrast, the XBlocks loaded in the legacy view set up their own save buttons and handlers not connected to the redux code, and send a signal to close when they're done.
I'll add a blurb warning the user.
|
Some notes on how I set things up locally for testing this PR along with openedx/openedx-platform#38148 and openedx/xblocks-contrib#193 , since there were several steps. Waffle flagfor the This flag didn't work for me. Testing the frontend
Testing globally disabling the pdf download buttonI used this single-file tutor plugin: And did (This worked fine.) |
edaaa5d to
a2dfb41
Compare
|
@Kelketek This is looking great! I have a couple of questions from a UX perspective, mostly to understand the intention a bit better:
|
This file is the default of the PDF XBlock, and predates this MR. It links to this PDF: https://tutorial.math.lamar.edu/pdf/Trig_Cheat_Sheet.pdf . You can learn more about the document by reading the home page: https://tutorial.math.lamar.edu/ Removing it is an option but would expand the scope, since it would mean changing the behavior of the block to accommodate not having the field set and giving the user reasonable feedback about it. I think that's a reasonable improvement, but I'd like to suggest it not be part of this PR.
The source document URL is optional, and is there to give you the source the PDF is from, which might be a Powerpoint, Word Document, or other editable and/or accessible format. If we remove this from Download options, we should also remove Source Button Text, which sets the text of the source download link (perhaps it should be called 'source link text' since the source 'button' appears to just be a link when rendered, but that's what the previous version called it.) That would leave only one option in download options, whether you can download at all. However, that toggle also implies whether you can download the source version, too, which is why they're in a group. When unchecking the 'allow download' button, the source fields disable, as they won't be used. There's no point in providing a source if you're not even providing the rendered document. If you'd like an alternative arrangement (or maybe, an alternative label for the "Download Options" group?), please let me know what you think would work best. |
14f6985 to
1203335
Compare
1203335 to
2e47927
Compare
2e47927 to
1f33696
Compare
|
@cassiezamparini and cc @samuelallan72 Here's the revised interface, based on both of your feedback: pdf-authoring-revised.mp4 |
728f243 to
7e59e76
Compare
7e59e76 to
e78610a
Compare
|
@samuelallan72 This is ready for review now. Thanks! |

Description
This pull request adds PDF Authoring.
Visual Changes
Before
pdf-old-screencast.mp4
After
pdf-block-demo.mp4
Supporting information
https://openedx.atlassian.net/wiki/spaces/OEPM/pages/5335908397/Proposal+Add+PDF+Block+to+Base+Installation
Testing instructions
Other information
These changes create much more generalizable parallel functionality to some of the functionality which already exists but is mired in Redux. They're worth examining and may be used by the next developer looking to add official MFE editing support for another block.
Best Practices Checklist
We're trying to move away from some deprecated patterns in this codebase. Please
check if your PR meets these recommendations before asking for a review:
.ts,.tsx).propTypesanddefaultPropsin any new or modified code.src/testUtils.tsx(specificallyinitializeMocks)apiHooks.tsin this repo for examples.messages.tsfiles have adescriptionfor translators to use.../in import paths. To import from parent folders, use@src, e.g.import { initializeMocks } from '@src/testUtils';instead offrom '../../../../testUtils'