fix(core): some editor issues (#13096)

fix AI-313, BS-3611

#### PR Dependency Tree


* **PR #13096** 👈

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

* **Refactor**
* Improved performance and resource management in code block
highlighting by using a shared highlighter instance across all code
blocks.
* Enhanced the text rendering component with additional reactive
capabilities.

* **Style**
* Updated the comment sidebar header with a new background color for
improved visual consistency.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
Peng Xiao
2025-07-08 18:38:07 +08:00
committed by GitHub
parent 81a76634f2
commit 072fff1460
3 changed files with 41 additions and 8 deletions

View File

@@ -4,7 +4,7 @@ import { getViewManager } from '@affine/core/blocksuite/manager/view';
import type { FeatureFlagService } from '@affine/core/modules/feature-flag';
import { PeekViewProvider } from '@blocksuite/affine/components/peek';
import { Container, type ServiceProvider } from '@blocksuite/affine/global/di';
import { WithDisposable } from '@blocksuite/affine/global/lit';
import { SignalWatcher, WithDisposable } from '@blocksuite/affine/global/lit';
import { RefNodeSlotsProvider } from '@blocksuite/affine/inlines/reference';
import {
codeBlockWrapMiddleware,
@@ -106,7 +106,9 @@ export type TextRendererOptions = {
};
// todo: refactor it for more general purpose usage instead of AI only?
export class TextRenderer extends WithDisposable(ShadowlessElement) {
export class TextRenderer extends SignalWatcher(
WithDisposable(ShadowlessElement)
) {
static override styles = css`
.ai-answer-text-editor.affine-page-viewport {
background: transparent;

View File

@@ -20,7 +20,7 @@ export const header = style({
height: '40px',
position: 'sticky',
top: 0,
backgroundColor: cssVarV2('layer/background/overlayPanel'),
backgroundColor: cssVarV2('layer/background/primary'),
zIndex: 2,
});