Skip to content

fix: Removed warning when node attribute does not correspond to a prop #391

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 30, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 0 additions & 13 deletions packages/core/src/api/nodeConversions/nodeConversions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import {
BlockSchema,
PartialBlock,
} from "../../extensions/Blocks/api/blockTypes";
import { defaultProps } from "../../extensions/Blocks/api/defaultProps";
import {
ColorStyle,
InlineContent,
Expand Down Expand Up @@ -394,18 +393,6 @@ export function nodeToBlock<BSchema extends BlockSchema>(
if (attr in propSchema) {
props[attr] = value;
}
// Block ids are stored as node attributes the same way props are, so we
// need to ensure we don't attempt to read block ids as props.

// the second check is for the backgroundColor & textColor props.
// Since we want them to be inherited by child blocks, we can't put them on the blockContent node,
// and instead have to put them on the blockContainer node.
// The blockContainer node is the same for all block types, but some custom blocks might not use backgroundColor & textColor,
// so these 2 props are technically unexpected but we shouldn't log a warning.
// (this is a bit hacky)
else if (attr !== "id" && !(attr in defaultProps)) {
console.warn("Block has an unrecognized attribute: " + attr);
}
}

const blockSpec = blockSchema[blockInfo.contentType.name];
Expand Down