-
Notifications
You must be signed in to change notification settings - Fork 81
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
feat: add an allowlist of for supported blocks in library [FC-0062] #1378
Conversation
Thanks for the pull request, @navinkarkera! What's next?Please work through the following steps to get your changes 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. 🔘 Let us know that your PR is ready for review:Who will review my changes?This repository is currently maintained by 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. |
b72bec2
to
96f922f
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #1378 +/- ##
=======================================
Coverage 93.01% 93.02%
=======================================
Files 1035 1035
Lines 19632 19646 +14
Branches 4172 4101 -71
=======================================
+ Hits 18261 18275 +14
- Misses 1306 1309 +3
+ Partials 65 62 -3 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👍
Thank you for your work, @navinkarkera!
- I tested this using the instructions from this pr
- I read through the code
- I checked for accessibility issues
- Includes documentation
axiosMock.onPost(pasteUrl).reply(() => Promise.reject({ | ||
customAttributes: { | ||
httpErrorStatus: 400, | ||
httpErrorResponseData: JSON.stringify({ block_type: errMsg }), | ||
}, | ||
})); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: Did you try the createAxiosError
function from the testUtils.tsx
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@rpenido Doesn't seem to match the error response from server when paste fails. We don't really need it now but it is nice to have for other paste related errors.
Yes, open response and drag and drop should be disabled as well for now. We only support text, problem and video. If we have time to get "advanced editors" working, we can turn on Drag and Drop. |
Libraries v2 currently don't support editing blocks other than problem, text and videos. This commit adds a configuration variable called `LIBRARY_SUPPORTED_BLOCKS` to setup allowed list of block types users can paste into libraries. By default it is set to support 'problem,text,video,html`.
@rpenido @bradenmacdonald I have moved the block type check here and also disabled/enabled add block buttons based on |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good work @navinkarkera! 👍
Co-authored-by: Rômulo Penido <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, only one nit and I will merge it 👍
@@ -133,6 +133,7 @@ initialize({ | |||
ENABLE_CHECKLIST_QUALITY: process.env.ENABLE_CHECKLIST_QUALITY || 'true', | |||
ENABLE_GRADING_METHOD_IN_PROBLEMS: process.env.ENABLE_GRADING_METHOD_IN_PROBLEMS === 'true', | |||
LIBRARY_MODE: process.env.LIBRARY_MODE || 'v1 only', | |||
LIBRARY_SUPPORTED_BLOCKS: (process.env.LIBRARY_SUPPORTED_BLOCKS || 'problem,video,html').split(','), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@navinkarkera Could you add this in .env, .env.development and .env.test?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Description
Libraries v2 currently don't support editing blocks other than problem,
text and videos. This commit adds a configuration variable called
LIBRARY_SUPPORTED_BLOCKS
to setup allowed list of block types userscan paste into libraries. By default it is set to support
'problem,text,video,html`.
Also, parse and display error message from server on paste from clipboard failure.
Depends on: openedx/edx-platform#35633Supporting information
feat: configuration to block unsupported types while pasting in library [FC-0062] edx-platform#35633Private-ref
: https://tasks.opencraft.com/browse/FAL-3860Testing instructions
LIBRARY_SUPPORTED_BLOCKS
setting in https://github.com/openedx/frontend-app-authoring/pull/1378/files#diff-ec767e14d91498b5b31a4ce826c4596061eb83a47d3dee00f6cbe1078232a75cR136