How can I convert a Mark when the tag to be converted as a Mark itself contains information related to other Marks? #5912
Replies: 1 comment 3 replies
-
By default, ProseMirror does not perform secondary matching on tags that have already been matched. For example, if a Fortunately, ProseMirror provides a solution: by setting You only need the following code to complete the task:
const TextStyle = TiptapTextStyle.extend({
priority: 1000,
parseHTML() {
const parent = this.parent?.() || [];
return [
...parent,
{
tag: "[style]",
consuming: false,
},
];
},
}); The solution above parses a wide range of elements. You can use I have tried using The following CodeSandbox is an example. |
Beta Was this translation helpful? Give feedback.
-
When converting the DOM as follows.
Then, when the following extensions were enabled.
The result of the conversion is as follows.
As you can see, font color is not enabled.
I tried to fix it by extending Bold, Color and TextStyle, but it did not work.
This occurs not only with Bold, but also with other Marks (Underline, Strike, Italic, etc.).
Is there any good solution?
Any advice is welcome!
Beta Was this translation helpful? Give feedback.
All reactions