Files
AFFiNE-Mirror/blocksuite/affine/shared/src/styles/scrollbar-style.ts
T
DarkSky ef6717e59a fix(editor): editor behavior and styles (#14498)
fix #14269 
fix #13920
fix #13977
fix #13953
fix #13895
fix #13905
fix #14136
fix #14357
fix #14491

#### PR Dependency Tree


* **PR #14498** 👈

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**
  * Callout and toolbar defaults now reliably show grey backgrounds
  * Keyboard shortcuts behave better across layouts and non-ASCII input
  * Deleted workspaces no longer appear in local listings

* **New Features**
  * Cell editing now respects pre-entry validation hooks
* Scrollbars use themeable variables and include Chromium compatibility
fixes

* **Style**
  * Minor UI color adjustment for hidden properties

* **Tests**
  * Added unit tests for table column handling and keymap behavior
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2026-02-23 06:37:16 +08:00

40 lines
1.1 KiB
TypeScript

import { css, unsafeCSS } from 'lit';
import { unsafeCSSVarV2 } from '../theme/css-variables';
/**
* You should add a container before the scrollbar style to prevent the style pollution of the whole doc.
*/
export const scrollbarStyle = (container: string) => {
if (!container) {
console.error(
'To prevent style pollution of the whole doc, you must add a container before the scrollbar style.'
);
return css``;
}
// sanitize container name
if (container.includes('{') || container.includes('}')) {
console.error('Invalid container name! Please use a valid CSS selector.');
return css``;
}
return css`
${unsafeCSS(container)} {
scrollbar-gutter: stable;
}
${unsafeCSS(container)}::-webkit-scrollbar {
-webkit-appearance: none;
width: 4px;
height: 4px;
}
${unsafeCSS(container)}::-webkit-scrollbar-thumb {
border-radius: 2px;
background-color: ${unsafeCSSVarV2('icon/secondary', '#b1b1b1')};
}
${unsafeCSS(container)}::-webkit-scrollbar-corner {
display: none;
}
`;
};