-
Notifications
You must be signed in to change notification settings - Fork 9
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
fix p1 accordion issues #1730
fix p1 accordion issues #1730
Conversation
This stack of pull requests is managed by Graphite. Learn more about stacking. Join @kishore03109 and the rest of your teammates on Graphite |
03035e5
to
9447813
Compare
children, | ||
}: PropsWithChildren<BlockWrapperProps>): JSX.Element => { | ||
return ( | ||
<Box as={NodeViewWrapper}> | ||
<Box position="relative" maxW="36.5rem" data-group> | ||
{isSelected && <>{otherButtons}</>} |
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.
could i ask why we require this? i think an alternative that we might wish to consider here would be to create another component that uses BlockViewWrapper
and does this functionality. the reason for doing so is that this otherButtons
is kind of a unique use case and kinda pollutes the responsibility of BlockWrapper
(thus tempting other devs to add mroe things here)
if that doesn't work well, i'm ok w/ this if we have a better fitting name
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.
Well, ideally we should be using bubble menu for this, but somehow I couldnt get the bubble menu to work to target the component as a whole, it targets the individual cells which does not fit our requirement.
I am not sure if I understood your suggestion correctly, if I were to create another component wouldnt that copy over quite a bit of code ah? Maybe can quick pair if you have bandwidth please!
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.
if it's the bubble menu, wouldn't it be possible to check if the node that's active is the detailSummary
?
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.
Hmm the issue is not to check whether the node is active, the issue was revolving more around detailSummary
being selected but the popper js targeting each detail summary rather than the entire detail group
src/layouts/components/Editor/extensions/Details/IsomerDetailGroupView.tsx
Show resolved
Hide resolved
src/layouts/components/Editor/extensions/Details/IsomerDetailGroupView.tsx
Show resolved
Hide resolved
Backspace: () => { | ||
const { schema, selection } = this.editor.state | ||
const { empty, $anchor } = selection | ||
|
||
if (!empty || $anchor.parent.type !== schema.nodes.detailsSummary) { | ||
return false | ||
} | ||
|
||
if ($anchor.parentOffset !== 0) { | ||
return this.editor.commands.command(({ tr }) => { | ||
const start = $anchor.pos - 1 | ||
const end = $anchor.pos | ||
tr.delete(start, end) | ||
return true | ||
}) | ||
} | ||
return this.editor.commands.removeDetail() | ||
}, | ||
} |
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.
idt this works - adding a keyboard shortcut would invoke it for every associated keypress (Backspace
) here (unless we copied over the backspace logic from tiptap)
i think if the intended outcome is to delete the block as a whole, we might wanna just make the parent node defining
so that backspace consumes it atomically.
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.
oh the purpose of this is not to delete the block as a whole, is to actually have a functional backspace key press for the titles, but I should not be able to backspace on an empty title to delete the entire block (deletion of the entire block should be in the button)!
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.
that's fine, but because this triggers for every keypress on backspace, it might destructively interfere with other nodes that don't adhere to the default backspace behaviour.
have we tried deleting:
- nested nodes (cards) with this?
defining
nodes?- plain text?
as this uses the selection
and checks if the selection is empty, we might mess up on deletion on plain text w/o a selection (haven't tried)
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.
hey good point!
regarding the selection, the delete button selects the node as a whole, and therefore this should not accidently delete another selected text for example.
regarding the
- nested card, deletion works as expected, the cards is deleted as expected
- defining nodes, eg text? abit confused about this point ps, can clarify here
- plain text works too
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.
defining
nodes are those that should be deleted as a group! (i think iframe is, for one)
if this works, then am ok w/ it as chance of destructive interference seems low - tiptap might dispatch the event to the specific node itself, in which case idt my concerns stand.
9447813
to
7771112
Compare
Backspace: () => { | ||
const { schema, selection } = this.editor.state | ||
const { empty, $anchor } = selection | ||
|
||
if (!empty || $anchor.parent.type !== schema.nodes.detailsSummary) { | ||
return false | ||
} | ||
|
||
if ($anchor.parentOffset !== 0) { | ||
return this.editor.commands.command(({ tr }) => { | ||
const start = $anchor.pos - 1 | ||
const end = $anchor.pos | ||
tr.delete(start, end) | ||
return true | ||
}) | ||
} | ||
return this.editor.commands.removeDetail() | ||
}, | ||
} |
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.
defining
nodes are those that should be deleted as a group! (i think iframe is, for one)
if this works, then am ok w/ it as chance of destructive interference seems low - tiptap might dispatch the event to the specific node itself, in which case idt my concerns stand.
This pull request has been stale for more than 30 days! Could someone please take a look at it @isomerpages/iso-engineers |
c517c84
to
de4b616
Compare
Problem
This PR attempts to fix the functional issues wrt to Accordions.
Will leave paddings as separate since those will be easier to fix + don't really need much context to be worked on.
Fix bunch of stuff here
To test template stuff, need to make changes to kishore-test
Corresponding template pr: isomerpages/isomerpages-template#361 (doesnt block this pr since complex blocks are behind feature flag anyway)
deprior padding related fix as design is not 100% sure about it yet + padding are easier to fix so no biggie
Reviewer notes
The approach for this PR would look weird considering the buttons are not bubble-menued.
I did try it but it kept popping up on every individual cell (similar behaviour to our table stuff). I somehow couldnt get it to work since (note that there were 2 levels of abstraction here bubbleMenu in react/src -> bubblemenu in the extensions). As of now, the API is not extensible enough to allow for this to happen, and this wasnt just a trivial as a
.extend
that we do for our other extensions liketable
.There might be a way, please let me know if that is the case, but i time boxed this effort and just wrapped it aroundNodeViewWrapper
to at least land something in main line first.This is still feature flagged and thus safe to merge to production for now, but hopefully p1 issues are all fixed and the pending stuff are just padding css stuff