Files
AFFiNE-Mirror/blocksuite/affine/blocks/table/src/table-cell-css.ts
T
DarkSky 6a2b73e76f feat(editor): improve database & table behavior (#15100)
fix #14982
fix #15028
fix #15099

#### PR Dependency Tree


* **PR #15100** 👈

This tree was auto-generated by
[Charcoal](https://github.com/danerwilliams/charcoal)

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

* **Bug Fixes**
* Prevented Enter handling during IME composition to avoid unintended
input.
* Avoided overwriting external native selections when interacting with
tables.
* Improved validation of inline text selection ranges for more reliable
behavior.

* **Enhancements**
* Scoped and refined text-selection styling and editability within
tables and cells.
  * Added managed sorting for Kanban views to control card ordering.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2026-06-11 13:50:23 +08:00

167 lines
3.5 KiB
TypeScript

import { cssVar, cssVarV2 } from '@blocksuite/affine-shared/theme';
import { css } from '@emotion/css';
export const cellContainerStyle = css({
position: 'relative',
alignItems: 'center',
border: '1px solid',
borderColor: cssVarV2.table.border,
borderCollapse: 'collapse',
isolation: 'auto',
textAlign: 'start',
verticalAlign: 'top',
'affine-table[data-internal-range-selection="true"] &': {
userSelect: 'text',
WebkitUserSelect: 'text',
},
'affine-table[data-internal-range-selection="true"] & rich-text': {
userSelect: 'text',
WebkitUserSelect: 'text',
},
'affine-table[data-internal-range-selection="true"] & rich-text *': {
userSelect: 'text',
WebkitUserSelect: 'text',
},
});
export const columnOptionsCellStyle = css({
position: 'absolute',
height: '0',
top: '0',
left: '0',
width: '100%',
display: 'flex',
alignItems: 'center',
justifyContent: 'center',
});
export const columnOptionsStyle = css({
cursor: 'pointer',
zIndex: 2,
width: '28px',
height: '16px',
backgroundColor: cssVarV2.table.headerBackground.default,
borderRadius: '8px',
boxShadow: cssVar('buttonShadow'),
opacity: 0,
transition: 'opacity 0.2s ease-in-out',
display: 'flex',
alignItems: 'center',
justifyContent: 'center',
'--three-pointer-icon-color': cssVarV2.icon.secondary,
':hover': {
opacity: 1,
},
'&.active': {
opacity: 1,
backgroundColor: cssVarV2.table.indicator.activated,
'--three-pointer-icon-color': cssVarV2.table.indicator.pointerActive,
},
});
export const rowOptionsCellStyle = css({
position: 'absolute',
top: '0',
left: '0',
width: '0',
height: '100%',
display: 'flex',
flexDirection: 'column',
alignItems: 'center',
justifyContent: 'center',
});
export const rowOptionsStyle = css({
cursor: 'pointer',
zIndex: 2,
width: '16px',
height: '28px',
backgroundColor: cssVarV2.table.headerBackground.default,
borderRadius: '8px',
boxShadow: cssVar('buttonShadow'),
opacity: 0,
transition: 'opacity 0.2s ease-in-out',
display: 'flex',
alignItems: 'center',
justifyContent: 'center',
'--three-pointer-icon-color': cssVarV2.icon.secondary,
':hover': {
opacity: 1,
},
'&.active': {
opacity: 1,
backgroundColor: cssVarV2.table.indicator.activated,
'--three-pointer-icon-color': cssVarV2.table.indicator.pointerActive,
},
});
export const threePointerIconStyle = css({
display: 'flex',
alignItems: 'center',
justifyContent: 'center',
gap: '2px',
});
export const threePointerIconDotStyle = css({
width: '3px',
height: '3px',
backgroundColor: 'var(--three-pointer-icon-color)',
borderRadius: '50%',
});
export const indicatorStyle = css({
position: 'absolute',
backgroundColor: cssVarV2.table.indicator.activated,
zIndex: 2,
transition: 'opacity 0.2s ease-in-out',
pointerEvents: 'none',
});
export const columnIndicatorStyle = css([
indicatorStyle,
{
top: '-1px',
height: 'calc(100% + 2px)',
width: '5px',
},
]);
export const columnRightIndicatorStyle = css([
columnIndicatorStyle,
{
cursor: 'ew-resize',
right: '-3px',
pointerEvents: 'auto',
},
]);
export const columnLeftIndicatorStyle = css([
columnIndicatorStyle,
{
left: '-2px',
},
]);
export const rowIndicatorStyle = css([
indicatorStyle,
{
left: '-1px',
width: 'calc(100% + 2px)',
height: '5px',
},
]);
export const rowBottomIndicatorStyle = css([
rowIndicatorStyle,
{
bottom: '-3px',
},
]);
export const rowTopIndicatorStyle = css([
rowIndicatorStyle,
{
top: '-2px',
},
]);