Skip to content

Commit

Permalink
e
Browse files Browse the repository at this point in the history
  • Loading branch information
winetree94 committed Dec 21, 2023
1 parent ecd57c1 commit 06d1289
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion packages/core/src/commands/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export * from './transform-range-to-block';
export * from './set-text-align';
export * from './clear-marks';
export * from './toggle-mark';
export * from './toggle-mark-with-attrs';
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,14 @@ export const toggleMarkWithAttrs = (
if (missing) {
return false;
}
console.log(node);
missing =
!(
markType.isInSet(node.marks) &&
attrsComparator(attrs, node.attrs)
attrsComparator(
attrs,
node.marks.find((m) => m.type === markType)?.attrs || null,
)
) &&
!!parent &&
parent.type.allowsMarkType(markType) &&
Expand All @@ -70,6 +74,7 @@ export const toggleMarkWithAttrs = (
);
return undefined;
});
console.log(missing);
return !missing;
});
}
Expand Down
1 change: 1 addition & 0 deletions packages/font-family/src/commands/toggle-font-family.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ export const toggleFontFamily = (
return toggleMarkWithAttrs(markType, attr, {
removeWhenPresent: false,
attrComparator(a, b) {
console.log(a, b);
return (
(a as null | EdimFontFamilyAttrs)?.['fontFamily'] ===
(b as null | EdimFontFamilyAttrs)?.['fontFamily']
Expand Down

0 comments on commit 06d1289

Please sign in to comment.