-
Notifications
You must be signed in to change notification settings - Fork 430
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(pte): tools are active only when all blocks use the tool (#6524)
* fix(pte): show toolbar as active only if all blocks have tool active * fix(pte): show toolbar as active only if all blocks have tool active * fix(pte): correct toggling of marks when part mark is selected * fix(core): change scrollintoview block to be nearest (#6328) * fix(core): set scroll boundary to nearest (#6310) * fix(core): set scroll boundary to nearest * fix(core): add smooth scroll behavior * fix(sanity): remove smooth behavior --------- Co-authored-by: RitaDias <[email protected]> * fix(@sanity): issue where hidden unicode characters were bloating document 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 * chore: add codeowners to block-tools * chore(deps): dedupe pnpm-lock.yaml (#6508) Co-authored-by: github-merge-queue[bot] <118344674+github-merge-queue[bot]@users.noreply.github.com> * fix(pte): tidying implementation * fix(@sanity): issue where hidden unicode characters were bloating document 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 * chore(deps): dedupe pnpm-lock.yaml (#6508) Co-authored-by: github-merge-queue[bot] <118344674+github-merge-queue[bot]@users.noreply.github.com> * chore(deps): update dependency @sanity/pkg-utils to v6.8.8 (#6509) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * feat: use prefersLatestPublished parameter in DocumentPaneProvider (#6486) * fix(@sanity): issue where hidden unicode characters were bloating document 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 * chore(deps): dedupe pnpm-lock.yaml (#6508) Co-authored-by: github-merge-queue[bot] <118344674+github-merge-queue[bot]@users.noreply.github.com> * chore(deps): update dependency @sanity/pkg-utils to v6.8.8 (#6509) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * fix(pte): simplifying activeAnnotations logic * fix(pte): new isAnnotationActive static method * fix(pte): retoring activeAnnotations method in editor * fix(pte): retoring activeAnnotations method in editor * fix(pte): fixing issue with multiple annotations in a single block * fix(pte): fixing issue with multiple annotations in a single block * fix(pte): fixing typing issue with PortableTextSpan * fix(pte): fixing failing test since mark toggling has changed * fix(pte): improving usage of isTextBlock for createWithPortableTextLists * fix(portable-text-editor): fix issue where decoration would not target correctly (#6532) * fix(pte): remove unused function in createWithPortableTextMarkModel * exploration * fix(pte): reverting incorrect merge * fix(pte): testing new logic for tools in PTE * fix(pte): reorg test cases --------- Co-authored-by: Nina Andal Aarvik <[email protected]> Co-authored-by: RitaDias <[email protected]> Co-authored-by: RitaDias <[email protected]> Co-authored-by: Per-Kristian Nordnes <[email protected]> Co-authored-by: ecospark[bot] <128108030+ecospark[bot]@users.noreply.github.com> 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> Co-authored-by: cngonzalez <[email protected]>
- Loading branch information
1 parent
869b698
commit 169e5fd
Showing
8 changed files
with
261 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
65 changes: 65 additions & 0 deletions
65
.../@sanity/portable-text-editor/src/editor/plugins/__tests__/withPortableTextLists.test.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
import {describe, expect, it, jest} from '@jest/globals' | ||
import {render, waitFor} from '@testing-library/react' | ||
import {createRef, type RefObject} from 'react' | ||
|
||
import {PortableTextEditorTester, schemaType} from '../../__tests__/PortableTextEditorTester' | ||
import {PortableTextEditor} from '../../PortableTextEditor' | ||
|
||
describe('plugin:withPortableTextLists', () => { | ||
it('should return active list styles that cover the whole selection', async () => { | ||
const editorRef: RefObject<PortableTextEditor> = createRef() | ||
const initialValue = [ | ||
{ | ||
_key: 'a', | ||
_type: 'myTestBlockType', | ||
children: [ | ||
{ | ||
_key: 'a1', | ||
_type: 'span', | ||
marks: [], | ||
text: '12', | ||
}, | ||
], | ||
markDefs: [], | ||
style: 'normal', | ||
}, | ||
{ | ||
_key: 'b', | ||
_type: 'myTestBlockType', | ||
children: [ | ||
{ | ||
_key: '2', | ||
_type: 'span', | ||
marks: [], | ||
text: '34', | ||
level: 1, | ||
listItem: 'bullet', | ||
}, | ||
], | ||
markDefs: [], | ||
style: 'normal', | ||
}, | ||
] | ||
const onChange = jest.fn() | ||
await waitFor(() => { | ||
render( | ||
<PortableTextEditorTester | ||
onChange={onChange} | ||
ref={editorRef} | ||
schemaType={schemaType} | ||
value={initialValue} | ||
/>, | ||
) | ||
}) | ||
const editor = editorRef.current! | ||
expect(editor).toBeDefined() | ||
await waitFor(() => { | ||
PortableTextEditor.focus(editor) | ||
PortableTextEditor.select(editor, { | ||
focus: {path: [{_key: 'a'}, 'children', {_key: 'a1'}], offset: 0}, | ||
anchor: {path: [{_key: '2'}, 'children', {_key: '2'}], offset: 2}, | ||
}) | ||
expect(PortableTextEditor.hasListStyle(editor, 'bullet')).toBe(false) | ||
}) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters