-
Notifications
You must be signed in to change notification settings - Fork 432
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
fix(core): inherit readOnly state from ancestors in copyPaste function #7643
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
2 Skipped Deployments
|
No changes to documentation |
Component Testing Report Updated Oct 22, 2024 8:31 AM (UTC) ✅ All Tests Passed -- expand for details
|
⚡️ Editor Performance ReportUpdated Tue, 22 Oct 2024 08:34:15 GMT
Detailed information🏠 Reference resultThe performance result of
🧪 Experiment resultThe performance result of this branch
📚 Glossary
|
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 great, thank you!
d28d580
to
c8a8462
Compare
* next: v3.62.0 fix: warnings on React 19 (#7654) fix(deps): update dependency @sanity/ui to ^2.8.10 (#7652) fix(deps): update dependency @sanity/ui to ^2.8.10 (#7653) chore(deps): update dependency @sanity/visual-editing to v2.2.2 (#7651) fix(core): inherit readOnly state from ancestors in copyPaste function (#7643) fix(deps): update dependency @sanity/mutate to ^0.10.1 (#7650) fix(deps): Update dev-non-major (#7649) fix(deps): update dependency @sanity/presentation to v1.17.3 (#7648) fix(deps): update dependency @portabletext/editor to ^1.1.5 (#7638) fix(deps): update dependency @sanity/presentation to v1.17.2 (#7647) fix(deps): Update dev-non-major (#7646) fix(deps): update dependency @sanity/presentation to v1.17.1 (#7645) chore(deps): update dependency @sanity/preview-url-secret to v2 (#7641) fix(deps): update dependency @sanity/presentation to v1.17.0 (#7640) fix(deps): Update dev-non-major (#7639) chore(cli): update help copy for deploy command (#7624) chore(test-studio): add asset types to structure navigation (#7631)
Description
When pasting values into a field which inherits the
readOnly
from the parent this was not verified., so it was possible to paste into read only fields.This PR adds a function
resolveReadOnlyAncestor
to check if any ancestor of the path in which the user is pasting is read only, if it is, it won't allow pasting.E.g, pasting into
inheritedReadOnlyField
was allowed, the same is happening with arrays.Screen.Recording.2024-10-21.at.18.11.24.mov
What to review
Is the implementation correct? Accessing the parents using the
resolveReadOnlyAncestor
is that in line with the existing approaches?Testing
New tests have been added into the copy paste to guard this functionality.
You can test it manually visiting https://test-next-studio-git-sdx-1643.sanity.dev/test/structure/input-standard;objectsTest;0689d2c6-5305-42e5-b381-32c335b3fd60 and trying to copy-paste values into the disabled fields
Notes for release
fixes an issue in copy paste in which the
readOnly
state was not correctly inherited to the children fields.