Skip to content
Open
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
12 changes: 11 additions & 1 deletion packages/render/src/render/RenderRegistry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,18 @@ export default class RenderRegistry {
}

getRendererConfigForTNode<T extends TNode>(tnode: T): RendererConfig<T> {
let custom = this.getCustomRendererForTNode(tnode);

// Allow overriding all text nodes via TText
if (!custom && tnode.type === 'text') {
const textRenderer = this.customRenderers['TText'];

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I also agree with Paweł that it should not be treated as a custom renderer, which are defined for HTML tags, not transient nodes. It's actually a lower level brick that would replace any TText rendering.

if (textRenderer) {
custom = textRenderer as any;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Definitely won't allow an any type assertion! That's a well established source of bugs, and it defies the purpose of using TypeScript.

}
}

return {
Custom: this.getCustomRendererForTNode(tnode),
Custom: custom,
Default: this.getDefaultRendererForTNode(tnode)
};
}
Expand Down