sjdemartini / mui-tiptap

A Material UI (MUI) styled WYSIWYG rich text editor, using Tiptap
MIT License
320 stars 44 forks source link

Read and reassign selected text marks when editing a link #238

Open maatMa opened 5 months ago

maatMa commented 5 months ago

Pull request related to the issue #237

sjdemartini commented 5 months ago

@maatMa Thanks for looking into this. You mentioned here https://github.com/sjdemartini/mui-tiptap/issues/237#issuecomment-2188309329

Unfortunately, editing the Text is not possible anymore. It looks like the marks are overriding the updated Text.

Is that still true of this solution? I haven't had a chance to test this out.


At first glance, this seems like it may work in a large number of cases, though I'm not sure if it will work 100% of the time. For instance, if the link has part of the text in bold and part not, what will happen to the resulting link? Based on the code, I'd guess it'll end up being either all bold or all not bold, even though users will likely expect the original styling to be preserved. Tricky, and still perhaps an improvement over the behavior today!


Also side note that the TS type-checking failed on this branch (with a minor issue related to Tiptap generics); see the build result.

maatMa commented 5 months ago

Yes, the Text Edit Problem is still the case. I can't think of a good soulution there.


At first glance, this seems like it may work in a large number of cases, though I'm not sure if it will work 100% of the time. For instance, if the link has part of the text in bold and part not, what will happen to the resulting link?

Multiple marks are supported, the function reads every existing text mark and reassign it to the edited link. I allready tested this with multiple marks and it looks like it works.

Thats why it is so hard to implement the text changes. I don't know how to assign the changed text inside the mark array.

maatMa commented 5 months ago

I tried to fix the Typescript errors. Looks like I've got some more issues in my code regarding the mapping between the node and content marks. I hope to find time this week to take a look into that.

maatMa commented 5 months ago

Thanks to @semanticist21 the text update is working now.

maatMa commented 4 months ago

@sjdemartini Is this Pull request fine, or do you need some more intormations, testing, refactoring, etc.

sjdemartini commented 4 months ago

@maatMa I'll play around with this when I get some time and will follow up once I do. As you've seen through a couple of the iterations here, link editing/creation is quite finicky in Tiptap, so I'd like to make sure there isn't any regression in behavior.

maatMa commented 4 months ago

@sjdemartini Sure, no problem. Just wanted to make sure you're not waiting for me.

maatMa commented 3 months ago

@sjdemartini Did you had time to test the pull-request?

sjdemartini commented 3 months ago

@maatMa Sorry for the delay. I haven't had time to test this out yet but plan to soon. (I want to be thorough to try to ensure we avoid any bugs, since I've found this to be a delicate piece of functionality.) Thanks for your patience.