refactor(editor): improve border color (#11077)

close: BS-2781
This commit is contained in:
zzj3720
2025-03-21 11:22:54 +00:00
parent 9986b8b6bc
commit 5dc6fabdaf
19 changed files with 73 additions and 48 deletions

View File

@@ -16,10 +16,14 @@ import type { BlockModel } from '@blocksuite/store';
import type { TemplateResult } from 'lit';
export const getIcon = (
model: BlockModel & { type?: string }
model: BlockModel & {
props: {
type?: string;
};
}
): TemplateResult => {
if (model.flavour === 'affine:paragraph') {
const type = model.type as ParagraphType;
const type = model.props.type as ParagraphType;
return (
{
text: TextIcon(),
@@ -39,7 +43,7 @@ export const getIcon = (
bulleted: BulletedListIcon(),
numbered: NumberedListIcon(),
todo: CheckBoxCheckLinearIcon(),
}[model.type ?? 'bulleted'] ?? BulletedListIcon()
}[model.props.type ?? 'bulleted'] ?? BulletedListIcon()
);
}
return TextIcon();

View File

@@ -7,7 +7,8 @@ import type {
TableSingleView,
} from '@blocksuite/data-view/view-presets';
import { WithDisposable } from '@blocksuite/global/lit';
import { css, html } from 'lit';
import { cssVarV2 } from '@toeverything/theme/v2';
import { css, html, unsafeCSS } from 'lit';
import { property } from 'lit/decorators.js';
export class BlockRenderer
@@ -22,7 +23,7 @@ export class BlockRenderer
flex-direction: column;
gap: 16px;
margin-bottom: 12px;
border-bottom: 1px solid var(--affine-border-color);
border-bottom: 1px solid ${unsafeCSS(cssVarV2.layer.insideBorder.border)};
font-size: var(--affine-font-base);
line-height: var(--affine-line-height);
}

View File

@@ -14,7 +14,8 @@ import type { DetailSlotProps, SingleView } from '@blocksuite/data-view';
import { SignalWatcher, WithDisposable } from '@blocksuite/global/lit';
import type { BaseTextAttributes } from '@blocksuite/store';
import { computed } from '@preact/signals-core';
import { css, html } from 'lit';
import { cssVarV2 } from '@toeverything/theme/v2';
import { css, html, unsafeCSS } from 'lit';
import { property } from 'lit/decorators.js';
import { isPureText } from '../utils/title-doc.js';
@@ -92,7 +93,9 @@ export class NoteRenderer
protected override render(): unknown {
return html`
<div
style="height: 1px;max-width: var(--affine-editor-width);background-color: var(--affine-border-color);margin: auto;margin-bottom: 16px"
style="height: 1px;max-width: var(--affine-editor-width);background-color: ${unsafeCSS(
cssVarV2.layer.insideBorder.border
)};margin: auto;margin-bottom: 16px"
></div>
${this.renderNote()}
`;