Skip to content

Commit

Permalink
fix: adding empty tag return when color attribute is not passed
Browse files Browse the repository at this point in the history
  • Loading branch information
ademarCardoso committed May 18, 2023
1 parent f88233a commit 208afbc
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,10 @@ const anchor: MarkSchema = (node: ISbNode) => {
}

const highlight: MarkSchema = (node: ISbNode) => {
if (!node.attrs?.color) return {
tag: '',
}

const attrs = {
['style']: `background-color:${node.attrs.color};`,
}
Expand All @@ -209,6 +213,10 @@ const highlight: MarkSchema = (node: ISbNode) => {
}

const textStyle: MarkSchema = (node: ISbNode) => {
if (!node.attrs?.color) return {
tag: '',
}

const attrs = {
['style']: `color:${node.attrs.color}`,
}
Expand Down

0 comments on commit 208afbc

Please sign in to comment.