Closed bryanjtc closed 1 week ago
The MenuSelect and Extension work as expected.
https://github.com/sjdemartini/mui-tiptap/assets/49354825/fc0761c5-cf5b-434d-9327-e19916d39853
I have a small problem with the table bubble menu, It keeps closing when I open the menu select control. Any idea on how to fix it? @sjdemartini
https://github.com/sjdemartini/mui-tiptap/assets/49354825/ea558c6e-37bf-43a6-a506-475b9ae8cc41
@bryanjtc Nice work getting what you have together so far!
That's a tricky issue. As you've probably seen, the logic for the controlling the table bubble menu open
is whether (1) the editor is in focus and (2) Tiptap's state shows a "table" element is active, which is based on the current caret/selection location:
https://github.com/sjdemartini/mui-tiptap/blob/876722786cfaa4c248dec3764514224be3241c6f/src/TableBubbleMenu.tsx#L149
In this case, the editor is losing focus due to the Select
's Menu
(which uses a Popover
). You can see this by removing the isEditorFocusedDebounced &&
part of the condition. I'm not sure what the best option would be in this case. In general it seems we shouldn't keep bubble menus open if the user has clicked away from the editor, so I think that part of the logic is generally useful, though that's obviously causing this undesirable side effect here. Maybe the open={...}
logic could be extended somehow to account for a case that there's a menu open? I'm not sure what the right way to do that would be. Do you have any ideas?
Side note: if the table bubble menu is appearing near the bottom of the page currently, and the border style select is opened, it overlaps in an awkward way that can make it tricky to interact with (though maybe partially because of the MenuSelect's tooltip logic):
I'm not sure what the right UI/UX should be since this is leading to "nested" menus. 🤔
I refactored the code and created another bubble menu inside the table bubble menu. It works better.
https://github.com/sjdemartini/mui-tiptap/assets/49354825/1355a96f-322b-413a-a27f-66ba13dff3f1
@sjdemartini Can you review the pr? I now that it doesn't have comments, i'm waiting for review to add the comments. Just in case there is something else that needs to be moved or changed.
@bryanjtc Cool, wasn't sure if you'd settled in a place where you thought it was ready for review again. Things have been super busy on my end unfortunately, but I'll try to review some time soon (hopefully next week). Sorry for the delay.
Nice that you took the time to review everything. I will try to push the fixes/changes today and reply/resolve each conversatioon.
Since there hasn't been activity in a while, I'm going to close this out. Thanks again for looking into it, since it can be a useful model if folks want to add their own implementation of these bubble menus to use elsewhere.
Adds two new extensions and one control to modify the table border style.
Relates to https://github.com/sjdemartini/mui-tiptap/issues/184