refactor(editor): remove selection global types (#9532)

Closes: [BS-2217](https://linear.app/affine-design/issue/BS-2217/remove-global-types-in-selection)
This commit is contained in:
Saul-Mirone
2025-01-06 03:45:10 +00:00
parent 8669936f2f
commit fc863e484c
105 changed files with 501 additions and 358 deletions

View File

@@ -1,5 +1,4 @@
import type { TextSelection } from '@blocksuite/block-std';
import { ShadowlessElement } from '@blocksuite/block-std';
import { ShadowlessElement, TextSelection } from '@blocksuite/block-std';
import type { RichText } from '@blocksuite/blocks';
import { WithDisposable } from '@blocksuite/global/utils';
import { css, html, nothing } from 'lit';
@@ -69,7 +68,7 @@ export class CommentInput extends WithDisposable(ShadowlessElement) {
}
override render() {
const textSelection = this.host.selection.find('text');
const textSelection = this.host.selection.find(TextSelection);
if (!textSelection) {
this.remove();
return nothing;

View File

@@ -1,4 +1,4 @@
import { ShadowlessElement } from '@blocksuite/block-std';
import { ShadowlessElement, TextSelection } from '@blocksuite/block-std';
import { WithDisposable } from '@blocksuite/global/utils';
import { css, html } from 'lit';
import { property, query } from 'lit/decorators.js';
@@ -60,7 +60,7 @@ export class CommentPanel extends WithDisposable(ShadowlessElement) {
commentManager: CommentManager | null = null;
private _addComment() {
const textSelection = this.editor.host?.selection.find('text');
const textSelection = this.editor.host?.selection.find(TextSelection);
if (!textSelection) return;
const commentInput = new CommentInput();