Conditional globalAttribute? #1943
Unanswered
evanfuture
asked this question in
Questions & Help
Replies: 2 comments 1 reply
-
@philippkuehn I guess you'd be the one to help point me in the right direction here? It's enough of an issue that I might convert this into a proper Issue, but maybe there's already a better way to solve it? (specifically, I want to only add the attribute when there is a value) |
Beta Was this translation helpful? Give feedback.
0 replies
-
Hey, no. Attributes are always stored in JSON. You can try to delete elements from the JSON afterwards. I'm not sure if that will cause any issues. But that won't happen in the core. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi everyone. I've been migrating from Quill to Tiptap, and in reproducing the same behaviour, I've had to build some of my own extensions. It speaks to the power of tiptap that I can do so with ease. One of the extensions I've built (upon the work of @sereneinserenade as shared here ), is an indent/outdent command. You can see the extension here:
https://github.com/evanfuture/tiptaptop-extension-indent
My only issue with this is that it applies the node.attrs.indent property to all nodes, I guess because I'm using
addGlobalAttributes
. I wonder if anyone knows a way to avoid setting that value for a node if the indent value isnull
?.The reason this is important is because it adds
"attrs":{"indent":null}
to every single paragraph in the JSON, which can impact performance and balloon data-storage.Potentially, I can write a custom parser in my project, but it would be nice to handle this directly within the extension.
Thanks in advance for any ideas/pointers!
Beta Was this translation helpful? Give feedback.
All reactions