Skip to content

Commit

Permalink
fix for sub super
Browse files Browse the repository at this point in the history
  • Loading branch information
2wheeh committed May 11, 2024
1 parent 7f6820a commit 4385392
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions packages/lexical/src/nodes/LexicalTextNode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1313,22 +1313,25 @@ function applyTextFormatFromStyle(
if (!$isTextNode(lexicalNode)) {
return lexicalNode;
}
if (hasBoldFontWeight) {
if (hasBoldFontWeight && !lexicalNode.hasFormat('bold')) {
lexicalNode.toggleFormat('bold');
}
if (hasLinethroughTextDecoration) {
if (
hasLinethroughTextDecoration &&
!lexicalNode.hasFormat('strikethrough')
) {
lexicalNode.toggleFormat('strikethrough');
}
if (hasItalicFontStyle) {
if (hasItalicFontStyle && !lexicalNode.hasFormat('italic')) {
lexicalNode.toggleFormat('italic');
}
if (hasUnderlineTextDecoration) {
if (hasUnderlineTextDecoration && !lexicalNode.hasFormat('underline')) {
lexicalNode.toggleFormat('underline');
}
if (verticalAlign === 'sub') {
if (verticalAlign === 'sub' && !lexicalNode.hasFormat('subscript')) {
lexicalNode.toggleFormat('subscript');
}
if (verticalAlign === 'super') {
if (verticalAlign === 'super' && !lexicalNode.hasFormat('superscript')) {
lexicalNode.toggleFormat('superscript');
}

Expand Down

0 comments on commit 4385392

Please sign in to comment.