Skip to content

Commit

Permalink
fix: broken toggle align command
Browse files Browse the repository at this point in the history
  • Loading branch information
sibiraj-s committed Jan 11, 2021
1 parent 56e0f50 commit ee0556c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/lib/EditorCommands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ class EditorCommands {

align(p: Align): this {
const command = new TextAlignCommand(p);
command.apply()(this.state, this.dispatch);
command.toggle()(this.state, this.dispatch);
return this;
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/lib/commands/TextAlign.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class TextAlign {
this.align = align;
}

apply(): Command {
toggle(): Command {
return (state: EditorState, dispatch?: (tr: Transaction) => void): boolean => {

const { doc, selection, tr, schema } = state;
Expand Down Expand Up @@ -53,7 +53,7 @@ class TextAlign {
}

canExecute(state: EditorState): boolean {
return this.apply()(state, null);
return this.toggle()(state, null);
}
}

Expand Down

0 comments on commit ee0556c

Please sign in to comment.