mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-09-07 01:09:54 +08:00
fix(editor): should update color of edgeless text when switching theme (#11853)
Closes: [BS-3258](https://linear.app/affine-design/issue/BS-3258/edgeless-text-颜色不符合预期)
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import { TextUtils } from '@blocksuite/affine-block-surface';
|
||||
import { formatBlockCommand } from '@blocksuite/affine-inline-preset';
|
||||
import {
|
||||
DefaultTheme,
|
||||
EDGELESS_TEXT_BLOCK_MIN_HEIGHT,
|
||||
EDGELESS_TEXT_BLOCK_MIN_WIDTH,
|
||||
type EdgelessTextBlockModel,
|
||||
@@ -359,13 +360,17 @@ export class EdgelessTextBlockComponent extends GfxBlockComponent<EdgelessTextBl
|
||||
}
|
||||
|
||||
override renderPageContent() {
|
||||
const { fontFamily, fontStyle, fontWeight, textAlign } = this.model.props;
|
||||
const color = this.std
|
||||
.get(ThemeProvider)
|
||||
.generateColorProperty(this.model.props.color, '#000000');
|
||||
const { color, fontFamily, fontStyle, fontWeight, textAlign } =
|
||||
this.model.props;
|
||||
const themeProvider = this.std.get(ThemeProvider);
|
||||
const textColor = themeProvider.generateColorProperty(
|
||||
color,
|
||||
DefaultTheme.textColor,
|
||||
themeProvider.theme$.value
|
||||
);
|
||||
|
||||
const style = styleMap({
|
||||
'--edgeless-text-color': color,
|
||||
'--edgeless-text-color': textColor,
|
||||
'--edgeless-text-font-family': TextUtils.wrapFontFamily(fontFamily),
|
||||
'--edgeless-text-font-style': fontStyle,
|
||||
'--edgeless-text-font-weight': fontWeight,
|
||||
|
||||
Reference in New Issue
Block a user