-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: #3540 Ability to preserve marks on lists #3541
Conversation
✅ Deploy Preview for tiptap-embed ready!
To edit notification comments on pull requests, go to your Netlify site settings. |
@bdbch can you please review this when you get a chance, also do let me know if it would be ideal to do the same |
} | ||
if (config.keepAttributes) { | ||
/** If the nodeType is `bulletList` or `orderedList` set the `nodeType` as `listItem` */ | ||
const nodeType = config.type.name === 'bulletList' || config.type.name === 'orderedList' ? 'listItem' : 'taskList' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@bdbch I'm just worried about this piece of code, please let me know if there's any better way of doing this. The idea here is
- When there's a paragraph with say colored text
- When we switch over to 2nd line, we apply the color to the whole
<li>
only then it is color is also applied for thelist-style
indicator.
Thanks @gethari I'll take a look as soon as I can! 💪 |
@bdbch did you get a chance to check this out ? Please share your thoughts / feedback |
@bdbch , I hope this message finds you well. I wanted to inform you that I have recently updated the branch to reflect the latest fork and resolved any conflicts that arose. I would be grateful if you could take a moment to review these changes at your earliest convenience. Thank you! |
Sure thing. I'll check your PR out as soon as I find some time. |
StarterKit.configure({ | ||
bulletList: { | ||
keepMarks: true, | ||
keepAttributes: false, // TODO : Making this as `false` becase marks are not preserved when I try to preserve attrs, awaiting a bit of help |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What exactly happens with marks when list items keep their attributes?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's say I have my first line with Purple
color and Italic
mark applied. When we set keepAttributes
to true
I am trying to update it with whatever attributes that are there from the previous line. But while doing so, if we have any mark it is not being preserved. But even without keeping the keepAttributes
to true
the color from the <p>
is being preserved on the bullet list.
return chain().toggleList(this.name, this.options.itemTypeName, this.options.keepMarks).updateAttributes(ListItem.name, this.editor.getAttributes(TextStyle.name)).run()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My doubt is do we need to chain the updateAttributes
here in the above mentioned line ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think so - but shouldn't be a problem. Thanks for coming up with more information! I think this should also close #3768
getAttributes: match => ({ start: +match[1] }), | ||
joinPredicate: (match, node) => node.childCount + node.attrs.start === +match[1], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe these removed lines broke support for creating ordered lists with a start
offset. I’ve opened an issue with more details: #3831
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
…3541) * feat: ueberdosis#3540 Ability to preserve marks on lists * feat: preserveAttrs in list items * `keepMarks` is working, but need help with `keepAttrs` * fix: conflict * avoid casting
…3833) * fix: ueberdosis#3831 * fix: default attribute + predicate
Fixes #3540
Attaching a sample clip on the demo.
keepMarks
flag similar tohardBreak
extensionchrome_PJzxiKCJzg.mp4