mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-13 21:05:19 +00:00
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:
@@ -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;
|
||||
|
||||
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user