mirror of
https://github.com/ueberdosis/tiptap.git
synced 2024-11-23 19:19:03 +08:00
fix: add clear mark parse rules to bold & italic marks (#5705)
This commit is contained in:
parent
bfcf6d94e8
commit
6fae240f88
6
.changeset/calm-carpets-smile.md
Normal file
6
.changeset/calm-carpets-smile.md
Normal file
@ -0,0 +1,6 @@
|
||||
---
|
||||
"@tiptap/extension-italic": patch
|
||||
"@tiptap/extension-bold": patch
|
||||
---
|
||||
|
||||
Add parse rules that reset bold & italic marks
|
@ -75,6 +75,10 @@ export const Bold = Mark.create<BoldOptions>({
|
||||
tag: 'b',
|
||||
getAttrs: node => (node as HTMLElement).style.fontWeight !== 'normal' && null,
|
||||
},
|
||||
{
|
||||
style: 'font-weight=400',
|
||||
clearMark: mark => mark.type.name === this.name,
|
||||
},
|
||||
{
|
||||
style: 'font-weight',
|
||||
getAttrs: value => /^(bold(er)?|[5-9]\d{2,})$/.test(value as string) && null,
|
||||
|
@ -78,6 +78,10 @@ export const Italic = Mark.create<ItalicOptions>({
|
||||
tag: 'i',
|
||||
getAttrs: node => (node as HTMLElement).style.fontStyle !== 'normal' && null,
|
||||
},
|
||||
{
|
||||
style: 'font-style=normal',
|
||||
clearMark: mark => mark.type.name === this.name,
|
||||
},
|
||||
{
|
||||
style: 'font-style=italic',
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user