Skip to content

Commit

Permalink
fix: 🐛 align left cant work bug
Browse files Browse the repository at this point in the history
  • Loading branch information
Leecason committed Jan 3, 2020
1 parent 5488647 commit 859224b
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/extensions/text_align.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,11 @@ export default class TextAlign extends Extension {
return this.options.alignments.reduce((commands, alignment) => {
if (!ALIGN_PATTERN.test(alignment)) return commands;

alignment = alignment === 'left' ? null : alignment;

return {
...commands,
[`align_${alignment}`]: () => this.setTextAlign({ alignment }),
[`align_${alignment}`]: () => this.setTextAlign({
alignment: alignment === 'left' ? null : alignment,
}),
};
}, {});
}
Expand All @@ -55,7 +55,7 @@ export default class TextAlign extends Extension {

doc.nodesBetween(from, to, (node, pos) => {
const nodeType = node.type;
const align = node.attrs.align || null;
const align = node.attrs.textAlign || null;
if (align !== alignment && ALLOWED_NODE_TYPES.includes(nodeType.name)) {
jobs.push({
node,
Expand Down

0 comments on commit 859224b

Please sign in to comment.