Skip to content

Commit

Permalink
fix: toggle text align marks
Browse files Browse the repository at this point in the history
  • Loading branch information
sibiraj-s committed May 15, 2024
1 parent 0b65fb0 commit 617ab34
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion projects/ngx-editor/src/lib/commands/TextAlign.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ class TextAlign implements ToggleCommand {
const nodeType = node.type;
if ([schema.nodes['paragraph'], schema.nodes['heading']].includes(nodeType)) {
applicable = true;
tr.setNodeMarkup(pos, nodeType, { ...node.attrs, align: this.align });
const align = node.attrs['align'] === this.align ? null : this.align;
tr.setNodeMarkup(pos, nodeType, { ...node.attrs, align });
}
return true;
});
Expand Down

0 comments on commit 617ab34

Please sign in to comment.