How to Apply Default Styles Only When Inserting a Table Using the Table Insert Command in Tiptap? #5749
Unanswered
its-me-dhina
asked this question in
Questions & Help
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I’m working on a custom table node in Tiptap where I want to apply default styles only when a table is inserted using the insertTable command via the editor's chainable commands.
Currently, I have extended the Table extension and added attributes like style, cellpadding, cellspacing, etc., and I’m using a utility to merge styles. Here’s a simplified version of the code:
Problem: I want the default styles (like table-layout, box-sizing, etc.) to be applied only when the table is inserted using the command:
However, I don’t want these styles to be applied in other cases, such as when pasting HTML with a table or when importing HTML. Is there a way to differentiate between these cases, so I can apply the default styles conditionally?
Any suggestions on how to approach this would be appreciated!
Beta Was this translation helpful? Give feedback.
All reactions