-
Notifications
You must be signed in to change notification settings - Fork 450
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(pte): tools are active only when all blocks use the tool #6524
Conversation
* fix(core): set scroll boundary to nearest * fix(core): add smooth scroll behavior * fix(sanity): remove smooth behavior --------- Co-authored-by: RitaDias <[email protected]>
…ument in PTE (#6440) * fix(portable-text-editor): issue shown in tests re stega. use duplicate code * test(playwright-ct): add test * chore(sanity): remove prettier linting * test(sanity): fix missing snapshot * test(sanity): update test after realising the test would pass always if comparing object number * chore: test unicode removal * chore: test unicode removal * chore(@sanity): remove old solution * fix(@sanity/block-tools): unicode issue. remove vercel/stega and move to block-tools * test(@sanity/block-tools): for unicode * fix(@sanity/block-tools): utf8 characters weren't beign filtered. using the vercel/stega * chore: update lock file * (chore): update pnpm lock
Co-authored-by: github-merge-queue[bot] <118344674+github-merge-queue[bot]@users.noreply.github.com>
…ument in PTE (#6440) * fix(portable-text-editor): issue shown in tests re stega. use duplicate code * test(playwright-ct): add test * chore(sanity): remove prettier linting * test(sanity): fix missing snapshot * test(sanity): update test after realising the test would pass always if comparing object number * chore: test unicode removal * chore: test unicode removal * chore(@sanity): remove old solution * fix(@sanity/block-tools): unicode issue. remove vercel/stega and move to block-tools * test(@sanity/block-tools): for unicode * fix(@sanity/block-tools): utf8 characters weren't beign filtered. using the vercel/stega * chore: update lock file * (chore): update pnpm lock
Co-authored-by: github-merge-queue[bot] <118344674+github-merge-queue[bot]@users.noreply.github.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
…ument in PTE (#6440) * fix(portable-text-editor): issue shown in tests re stega. use duplicate code * test(playwright-ct): add test * chore(sanity): remove prettier linting * test(sanity): fix missing snapshot * test(sanity): update test after realising the test would pass always if comparing object number * chore: test unicode removal * chore: test unicode removal * chore(@sanity): remove old solution * fix(@sanity/block-tools): unicode issue. remove vercel/stega and move to block-tools * test(@sanity/block-tools): for unicode * fix(@sanity/block-tools): utf8 characters weren't beign filtered. using the vercel/stega * chore: update lock file * (chore): update pnpm lock
Co-authored-by: github-merge-queue[bot] <118344674+github-merge-queue[bot]@users.noreply.github.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
The latest updates on your projects. Learn more about Vercel for Git ↗︎
1 Ignored Deployment
|
No changes to documentation |
Component Testing Report Updated May 2, 2024 2:28 PM (UTC)
|
if (selectedBlocks.length > 0) { | ||
return true | ||
return selectedBlocks.every( |
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.
do we need to return every
here or do we just care that there is > 0
blocks that meet this condition?
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.
We do care that every block has the list style. For example if the selection was on the following:
First block
- List second block
Third block
we'd have 3 selectedBlocks
, but only 1 would have bullet list style, so we'd want to return false
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.
👍 - thanks for adding more tests!
Description
EDX-801
What to review
Different approaches are needed for each of marks, annotations and lists
The high level approach is that instead of a condition on
some
of the selected blocks being bold, or a link, or bullet list, nowevery
selected block must be.The most cumbersome implementation is for annotations (links). This requires a new
isAnnotationActive
method inpackages/@sanity/portable-text-editor/src/editor/plugins/createWithEditableAPI.ts
which must expand every selected block to determine the type of mark definitions in the selection, before then applying theevery
logic to all spans in the selectionTesting
Notes for release
fixes issues in the PTE where tools would show as being active for a selection when only part of the selection used the tool.
Now tools will show as active only when all highlighted selections use the tool