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.14% -0.38%
==========================================
Files 1329 1343 +14
Lines 30557 30773 +216
Branches 6925 6949 +24
==========================================
+ Hits 29186 29278 +92
- Misses 1303 1421 +118
- Partials 68 74 +6 ☔ 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.
| }; | ||
|
|
||
| export default { fileInput, fileSizeError, parseHandoutName }; | ||
| export const checkValidFileSize = ({ |
There was a problem hiding this comment.
nit: to reduce diff noise, this function could be moved back to its original location?
| @@ -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.
| }, | ||
| 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. :)
| const deriveFileName = (rawName: string) => { | ||
| const segments = rawName.split('/').reverse(); | ||
| const name = intl.formatMessage(messages.defaultName); | ||
| for (let segment of segments) { |
There was a problem hiding this comment.
I'm not sure falling back to other url segments for deriving the name will have the desired effect. Perhaps simply falling back to the defaultName if the first url segment doesn't work?
| > | ||
| {urlFieldMeta.error!} | ||
| </ErrorAlert> | ||
| {manualMode && <TextField label="PDF Url" id="pdf-url" name="url" />} |
There was a problem hiding this comment.
Just flagging an untranslated string "PDF Url".
| src={MoreHoriz} | ||
| iconAs={Icon} | ||
| variant="primary" | ||
| alt="Actions dropdown" |
There was a problem hiding this comment.
Another untranslated string that's user-facing.
| @@ -0,0 +1,53 @@ | |||
| import { Form } from '@openedx/paragon'; | |||
| import CollapsibleFormWidget | |||
| from '@src/editors/containers/VideoEditor/components/VideoSettingsModal/components/CollapsibleFormWidget'; | |||
There was a problem hiding this comment.
future refactoring opportunity: move CollapsibleFormWidget to sharedComponents.
| {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.
|
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.) |
d986993 to
ddd65e2
Compare
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'