Skip to content

Commit

Permalink
Fix getting style via $getSelectionStyleValueForProperty when selecti…
Browse files Browse the repository at this point in the history
…on is collapsed (#5082)
  • Loading branch information
Piliuta committed Oct 4, 2023
1 parent c09ab73 commit 816ef98
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion packages/lexical-selection/src/range-selection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -538,7 +538,7 @@ export function $getSelectionStyleValueForProperty(
const endOffset = isBackward ? focus.offset : anchor.offset;
const endNode = isBackward ? focus.getNode() : anchor.getNode();

if (selection.style !== '') {
if (selection.isCollapsed() && selection.style !== '') {
const css = selection.style;
const styleObject = getStyleObjectFromCSS(css);

Expand Down

2 comments on commit 816ef98

@vercel
Copy link

@vercel vercel bot commented on 816ef98 Oct 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:

lexical – ./packages/lexical-website

lexicaljs.com
lexicaljs.org
lexical-git-main-fbopensource.vercel.app
lexical.dev
lexical-fbopensource.vercel.app
www.lexical.dev

@vercel
Copy link

@vercel vercel bot commented on 816ef98 Oct 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:

lexical-playground – ./packages/lexical-playground

lexical-playground-fbopensource.vercel.app
lexical-playground-git-main-fbopensource.vercel.app
lexical-playground.vercel.app
playground.lexical.dev

Please sign in to comment.