Skip to content

Commit

Permalink
fix: update add cell tooltip style
Browse files Browse the repository at this point in the history
  • Loading branch information
zhanba authored and sunshinesmilelk committed Sep 23, 2024
1 parent b1345e2 commit 2f7c349
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 4 deletions.
4 changes: 4 additions & 0 deletions packages/libro-core/src/components/dnd-component/index.less
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,7 @@
// overflow: auto !important;
// }
}

.libro-dnd-cells-container {
padding-top: 8px;
}
12 changes: 8 additions & 4 deletions packages/libro-jupyter/src/add-between-cell/add-between-cell.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ export const LibroCommonBetweenCellContent: BetweenCellProvider = forwardRef(
});

return (
<div className="libro-add-between-cell">
<div className="libro-add-between-cell" tabIndex={0}>
<Popover
content={<Menu items={items} />}
trigger="click"
Expand All @@ -116,20 +116,25 @@ export const LibroCommonBetweenCellContent: BetweenCellProvider = forwardRef(
overlayClassName="libro-add-cell-menu"
destroyTooltipOnHide
open={menuVisible}
arrow={false}
>
<div
tabIndex={10}
className="libro-add-between-cell-anchor"
style={{
position: 'absolute',
top: position.top + 5,
left: position.left + 5,
top: position.top - 10,
left: position.left + 0,
width: 1,
height: 1,
zIndex: 1000,
}}
ref={anchorRef}
onBlur={(e) => {
if (e.relatedTarget?.classList.contains('libro-add-between-cell')) {
return;
}

if (!anchorRef.current?.contains(e.relatedTarget)) {
setMenuVisible(false);
}
Expand Down Expand Up @@ -158,7 +163,6 @@ export const LibroCommonBetweenCellContent: BetweenCellProvider = forwardRef(
setGutterVisible(true);
setMenuVisible(true);

// TODO: 位置不准确
setPosition({ top: e.nativeEvent.offsetY, left: e.nativeEvent.offsetX });
anchorRef.current?.focus();
}}
Expand Down
1 change: 1 addition & 0 deletions packages/libro-jupyter/src/add-between-cell/index.less
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@
height: 4px;
background-color: var(--mana-libro-add-between-divider-color);
border-radius: 2px;
pointer-events: none;
}

.libro-add-between-cell-icon {
Expand Down

0 comments on commit 2f7c349

Please sign in to comment.