mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-07-25 06:18:45 +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,4 +1,6 @@
|
||||
import {
|
||||
autoArrangeElementsCommand,
|
||||
autoResizeElementsCommand,
|
||||
EdgelessCRUDIdentifier,
|
||||
updateXYWH,
|
||||
} from '@blocksuite/affine-block-surface';
|
||||
@@ -134,10 +136,10 @@ export class EdgelessAlignButton extends WithDisposable(LitElement) {
|
||||
this._alignDistributeVertically();
|
||||
break;
|
||||
case Alignment.AutoArrange:
|
||||
this.edgeless.std.command.exec('autoArrangeElements');
|
||||
this.edgeless.std.command.exec(autoArrangeElementsCommand);
|
||||
break;
|
||||
case Alignment.AutoResize:
|
||||
this.edgeless.std.command.exec('autoResizeElements');
|
||||
this.edgeless.std.command.exec(autoResizeElementsCommand);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
+6
-3
@@ -10,7 +10,10 @@ import {
|
||||
getDocContentWithMaxLength,
|
||||
getEmbedCardIcons,
|
||||
} from '@blocksuite/affine-block-embed';
|
||||
import { EdgelessCRUDIdentifier } from '@blocksuite/affine-block-surface';
|
||||
import {
|
||||
EdgelessCRUDIdentifier,
|
||||
reassociateConnectorsCommand,
|
||||
} from '@blocksuite/affine-block-surface';
|
||||
import {
|
||||
CaptionIcon,
|
||||
CopyIcon,
|
||||
@@ -164,7 +167,7 @@ export class EdgelessChangeEmbedCardButton extends WithDisposable(LitElement) {
|
||||
this.edgeless.surface.model
|
||||
);
|
||||
|
||||
this.std.command.exec('reassociateConnectors', {
|
||||
this.std.command.exec(reassociateConnectorsCommand, {
|
||||
oldId: id,
|
||||
newId,
|
||||
});
|
||||
@@ -220,7 +223,7 @@ export class EdgelessChangeEmbedCardButton extends WithDisposable(LitElement) {
|
||||
);
|
||||
if (!newId) return;
|
||||
|
||||
this.std.command.exec('reassociateConnectors', {
|
||||
this.std.command.exec(reassociateConnectorsCommand, {
|
||||
oldId: id,
|
||||
newId,
|
||||
});
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { changeNoteDisplayMode } from '@blocksuite/affine-block-note';
|
||||
import { EdgelessCRUDIdentifier } from '@blocksuite/affine-block-surface';
|
||||
import type {
|
||||
EdgelessColorPickerButton,
|
||||
@@ -195,7 +196,7 @@ export class EdgelessChangeNoteButton extends WithDisposable(LitElement) {
|
||||
}
|
||||
|
||||
private _setDisplayMode(note: NoteBlockModel, newMode: NoteDisplayMode) {
|
||||
this.edgeless.std.command.exec('changeNoteDisplayMode', {
|
||||
this.edgeless.std.command.exec(changeNoteDisplayMode, {
|
||||
noteId: note.id,
|
||||
mode: newMode,
|
||||
stopCapture: true,
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import type { SurfaceBlockComponent } from '@blocksuite/affine-block-surface';
|
||||
import { MenuContext } from '@blocksuite/affine-components/toolbar';
|
||||
import { getSelectedModelsCommand } from '@blocksuite/affine-shared/commands';
|
||||
import {
|
||||
GfxPrimitiveElementModel,
|
||||
type GfxSelectionManager,
|
||||
@@ -47,10 +48,9 @@ export class ElementToolbarMoreMenuContext extends MenuContext {
|
||||
}
|
||||
|
||||
get selectedBlockModels() {
|
||||
const [result, { selectedModels }] = this.std.command
|
||||
.chain()
|
||||
.getSelectedModels()
|
||||
.run();
|
||||
const [result, { selectedModels }] = this.std.command.exec(
|
||||
getSelectedModelsCommand
|
||||
);
|
||||
|
||||
if (!result) return [];
|
||||
|
||||
|
||||
Reference in New Issue
Block a user