mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-08-06 11:59:51 +08: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,6 +1,6 @@
|
||||
import type { IndentContext } from '@blocksuite/affine-shared/types';
|
||||
import { matchFlavours } from '@blocksuite/affine-shared/utils';
|
||||
import type { Command } from '@blocksuite/block-std';
|
||||
import { type Command, TextSelection } from '@blocksuite/block-std';
|
||||
|
||||
import { correctNumberedListsOrderToPrev } from './utils.js';
|
||||
|
||||
@@ -13,7 +13,7 @@ export const canDedentListCommand: Command<
|
||||
const { std } = ctx;
|
||||
const { selection, doc } = std;
|
||||
if (!blockId) {
|
||||
const text = selection.find('text');
|
||||
const text = selection.find(TextSelection);
|
||||
/**
|
||||
* Do nothing if the selection:
|
||||
* - is not a text selection
|
||||
@@ -148,7 +148,7 @@ export const dedentListCommand: Command<'indentContext'> = (ctx, next) => {
|
||||
doc.moveBlocks([model], grandParent, parent, false);
|
||||
correctNumberedListsOrderToPrev(doc, model);
|
||||
|
||||
const textSelection = selection.find('text');
|
||||
const textSelection = selection.find(TextSelection);
|
||||
if (textSelection) {
|
||||
host.updateComplete
|
||||
.then(() => {
|
||||
|
||||
@@ -3,7 +3,7 @@ import {
|
||||
getNearestHeadingBefore,
|
||||
matchFlavours,
|
||||
} from '@blocksuite/affine-shared/utils';
|
||||
import type { Command } from '@blocksuite/block-std';
|
||||
import { type Command, TextSelection } from '@blocksuite/block-std';
|
||||
|
||||
import { correctNumberedListsOrderToPrev } from './utils.js';
|
||||
|
||||
@@ -16,7 +16,7 @@ export const canIndentListCommand: Command<
|
||||
const { std } = ctx;
|
||||
const { selection, doc } = std;
|
||||
if (!blockId) {
|
||||
const text = selection.find('text');
|
||||
const text = selection.find(TextSelection);
|
||||
/**
|
||||
* Do nothing if the selection:
|
||||
* - is not a text selection
|
||||
@@ -133,7 +133,7 @@ export const indentListCommand: Command<'indentContext', never> = (
|
||||
});
|
||||
}
|
||||
|
||||
const textSelection = selection.find('text');
|
||||
const textSelection = selection.find(TextSelection);
|
||||
if (textSelection) {
|
||||
host.updateComplete
|
||||
.then(() => {
|
||||
|
||||
Reference in New Issue
Block a user