Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
Plate Editor
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Projekt HeadlessCMS-WS24-25
Plate Editor
Commits
10fa36f8
Commit
10fa36f8
authored
2 months ago
by
Leon Jung
Browse files
Options
Downloads
Patches
Plain Diff
refactor popover and table components for improved z-index management and type safety
parent
c589e7fc
Branches
main
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/components/plate-ui/popover.tsx
+1
-1
1 addition, 1 deletion
src/components/plate-ui/popover.tsx
src/components/plate-ui/table-element.tsx
+2
-4
2 additions, 4 deletions
src/components/plate-ui/table-element.tsx
src/components/plate-ui/toolbar.tsx
+1
-1
1 addition, 1 deletion
src/components/plate-ui/toolbar.tsx
with
4 additions
and
6 deletions
src/components/plate-ui/popover.tsx
+
1
−
1
View file @
10fa36f8
...
...
@@ -13,7 +13,7 @@ export const PopoverTrigger = PopoverPrimitive.Trigger;
export
const
PopoverAnchor
=
PopoverPrimitive
.
Anchor
;
export
const
popoverVariants
=
cva
(
'
z-
5
0 w-72 rounded-md border border-zinc-200 bg-white p-4 text-zinc-950 shadow-md outline-none print:hidden dark:border-zinc-800 dark:bg-zinc-950 dark:text-zinc-50
'
,
'
z-
1
0 w-72 rounded-md border border-zinc-200 bg-white p-4 text-zinc-950 shadow-md outline-none print:hidden dark:border-zinc-800 dark:bg-zinc-950 dark:text-zinc-50
'
,
{
defaultVariants
:
{
animate
:
true
,
...
...
This diff is collapsed.
Click to expand it.
src/components/plate-ui/table-element.tsx
+
2
−
4
View file @
10fa36f8
...
...
@@ -114,7 +114,7 @@ export const TableBordersDropdownMenuContent = withRef<
);
});
export
const
TableFloatingToolbar
=
({
popoverState
}:
{
popoverState
:
any
})
=>
{
export
const
TableFloatingToolbar
=
({
popoverState
}:
{
popoverState
:
"
top
"
|
'
bottom
'
|
null
})
=>
{
const
element
=
useElement
<
TTableElement
>
();
const
{
props
:
buttonProps
}
=
useRemoveNodeButton
({
element
});
...
...
@@ -128,7 +128,6 @@ export const TableFloatingToolbar = ({ popoverState }: { popoverState: any }) =>
const
editor
=
useEditorRef
();
const
collapsed
=
!
readOnly
&&
selected
&&
selectionCollapsed
;
const
open
=
!
readOnly
&&
selected
;
const
{
canMerge
,
canUnmerge
}
=
useTableMergeState
();
...
...
@@ -183,7 +182,7 @@ export const TableFloatingToolbar = ({ popoverState }: { popoverState: any }) =>
<
div
className
=
{
cn
(
popoverVariants
(),
'
flex w-[220px] flex-col p-1 absolute
left-0
'
,
'
flex w-[220px] flex-col p-1 absolute
right-1/2 translate-x-1/2
'
,
popoverState
===
'
top
'
?
'
top-0 -translate-y-full
'
:
popoverState
===
'
bottom
'
?
'
bottom-0 translate-y-full
'
:
''
)
}
>
...
...
@@ -261,7 +260,6 @@ export const TableElement = withHOC(
<
tbody
className
=
'min-w-full'
>
{
children
}
</
tbody
>
</
table
>
</
PlateElement
>
{
popoverState
&&
(
<
TableFloatingToolbar
popoverState
=
{
popoverState
}
/>
)
}
...
...
This diff is collapsed.
Click to expand it.
src/components/plate-ui/toolbar.tsx
+
1
−
1
View file @
10fa36f8
...
...
@@ -32,7 +32,7 @@ export const ToolbarSeparator = withCn(
const
toolbarButtonVariants
=
cva
(
cn
(
'
inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-xs font-medium text-zinc-950 ring-offset-white transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-zinc-950 focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 [&_svg:not([data-icon])]:size-3.5 dark:text-zinc-50 dark:ring-offset-zinc-950 dark:focus-visible:ring-zinc-300
'
'
z-20
inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-xs font-medium text-zinc-950 ring-offset-white transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-zinc-950 focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 [&_svg:not([data-icon])]:size-3.5 dark:text-zinc-50 dark:ring-offset-zinc-950 dark:focus-visible:ring-zinc-300
'
),
{
defaultVariants
:
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment