mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-07-25 14:28:51 +08:00
refactor(editor): remove dependency of command global types (#9903)
Closes: [BS-2216](https://linear.app/affine-design/issue/BS-2216/remove-global-types-in-command)
This commit is contained in:
@@ -1,5 +1,13 @@
|
||||
import { focusBlockEnd, focusBlockStart } from '@blocksuite/affine-block-note';
|
||||
import {
|
||||
getNextBlockCommand,
|
||||
getPrevBlockCommand,
|
||||
} from '@blocksuite/affine-shared/commands';
|
||||
import { ImageSelection } from '@blocksuite/affine-shared/selection';
|
||||
import type { UIEventStateContext } from '@blocksuite/block-std';
|
||||
import type {
|
||||
BlockComponent,
|
||||
UIEventStateContext,
|
||||
} from '@blocksuite/block-std';
|
||||
import {
|
||||
BlockSelection,
|
||||
ShadowlessElement,
|
||||
@@ -136,15 +144,14 @@ export class ImageBlockPageComponent extends WithDisposable(ShadowlessElement) {
|
||||
|
||||
std.command
|
||||
.chain()
|
||||
.getNextBlock({ path: this.block.blockId })
|
||||
.inline((ctx, next) => {
|
||||
.pipe(getNextBlockCommand, { path: this.block.blockId })
|
||||
.pipe<{ focusBlock: BlockComponent }>((ctx, next) => {
|
||||
const { nextBlock } = ctx;
|
||||
if (!nextBlock) return;
|
||||
|
||||
return next({ focusBlock: nextBlock });
|
||||
})
|
||||
// @ts-expect-error FIXME(command): BS-2216
|
||||
.focusBlockStart()
|
||||
.pipe(focusBlockStart)
|
||||
.run();
|
||||
return true;
|
||||
},
|
||||
@@ -162,15 +169,14 @@ export class ImageBlockPageComponent extends WithDisposable(ShadowlessElement) {
|
||||
|
||||
std.command
|
||||
.chain()
|
||||
.getPrevBlock({ path: this.block.blockId })
|
||||
.inline((ctx, next) => {
|
||||
.pipe(getPrevBlockCommand, { path: this.block.blockId })
|
||||
.pipe<{ focusBlock: BlockComponent }>((ctx, next) => {
|
||||
const { prevBlock } = ctx;
|
||||
if (!prevBlock) return;
|
||||
|
||||
return next({ focusBlock: prevBlock });
|
||||
})
|
||||
// @ts-expect-error FIXME(command): BS-2216
|
||||
.focusBlockEnd()
|
||||
.pipe(focusBlockEnd)
|
||||
.run();
|
||||
return true;
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user