tiptap-php
tiptap-php copied to clipboard
Don't fail on missing code tag in code block parsing
When parsing an HTML input using this library, that contains a <pre>
-tag without any child element like the code tag generated by TipTap itself, the parser will generate an error, as it tries to call the getAttribute
method on a child node, that is of type DOMText
(or even null, if the block is empty). The error occurs, while infering the language of the code block.
This might not happen, if using the tip tap editor, but it breaks the use case of the sanitize method, as it would fail and not sanitize in this case.
This PR adds a check for the type of the respective child node.