Skip to content

Commit

Permalink
fix(portable-text-editor): emit new selection on mark toggle (#4881)
Browse files Browse the repository at this point in the history
* fix(portable-text-editor): always emit new selection when toggling marks

Always emit a new selection when toggling marks, even though the selection might still end up be the same.
This happens when there is only one span node in the editor and you toggle a mark on it.

It is very convenient for implementations to use selection as a dependency for updating toolbars etc,
so we should force a new selection here to support that dependency.

Note that the selection value is still the same, it's just emitted as a new object.

* test(portable-text-editor): add test for new selection object after toggling marks

This will both test the actual selection object and if the change event is emitted with the correct value.
  • Loading branch information
skogsmaskin authored Sep 4, 2023
1 parent 66afcd7 commit d91357f
Show file tree
Hide file tree
Showing 4 changed files with 797 additions and 715 deletions.
Loading

2 comments on commit d91357f

@vercel
Copy link

@vercel vercel bot commented on d91357f Sep 4, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

performance-studio – ./

performance-studio.sanity.build
performance-studio-git-next.sanity.build

@vercel
Copy link

@vercel vercel bot commented on d91357f Sep 4, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

test-studio – ./

test-studio.sanity.build
test-studio-git-next.sanity.build

Please sign in to comment.