Browse Source

Format

typed-command-runs
Artur Arseniev 5 months ago
parent
commit
2fa81c2bf7
  1. 16
      packages/core/src/commands/registry.ts
  2. 5
      packages/core/src/commands/registryHelpers.ts
  3. 5
      packages/core/src/commands/view/MoveComponent.ts
  4. 5
      packages/core/src/commands/view/SelectComponent.ts

16
packages/core/src/commands/registry.ts

@ -1,11 +1,7 @@
import type { ObjectAny } from '../common'; import type { ObjectAny } from '../common';
import type { CommandPublicOptions } from './registryHelpers'; import type { CommandPublicOptions } from './registryHelpers';
import type CommandAbstract from './view/CommandAbstract'; import type CommandAbstract from './view/CommandAbstract';
import type { import type { CommandConstructor, CommandFunction, CommandObject } from './view/CommandAbstract';
CommandConstructor,
CommandFunction,
CommandObject,
} from './view/CommandAbstract';
import type { FullscreenCommandRegistryRun, FullscreenCommandRegistryStop } from './view/Fullscreen'; import type { FullscreenCommandRegistryRun, FullscreenCommandRegistryStop } from './view/Fullscreen';
import type { PreviewCommandRegistryRun, PreviewCommandRegistryStop } from './view/Preview'; import type { PreviewCommandRegistryRun, PreviewCommandRegistryStop } from './view/Preview';
import type { ResizeCommandRegistryRun, ResizeCommandRegistryStop } from './view/Resize'; import type { ResizeCommandRegistryRun, ResizeCommandRegistryStop } from './view/Resize';
@ -28,14 +24,8 @@ import type { MoveComponentCommandRegistryRun, MoveComponentCommandRegistryStop
import type { SelectComponentCommandRegistryRun, SelectComponentCommandRegistryStop } from './view/SelectComponent'; import type { SelectComponentCommandRegistryRun, SelectComponentCommandRegistryStop } from './view/SelectComponent';
import type { ShowOffsetCommandRegistryRun, ShowOffsetCommandRegistryStop } from './view/ShowOffset'; import type { ShowOffsetCommandRegistryRun, ShowOffsetCommandRegistryStop } from './view/ShowOffset';
import type { SwitchVisibilityCommandRegistryRun, SwitchVisibilityCommandRegistryStop } from './view/SwitchVisibility'; import type { SwitchVisibilityCommandRegistryRun, SwitchVisibilityCommandRegistryStop } from './view/SwitchVisibility';
import type { import type { OpenStyleManagerCommandRegistryRun, OpenStyleManagerCommandRegistryStop } from './view/OpenStyleManager';
OpenStyleManagerCommandRegistryRun, import type { OpenTraitManagerCommandRegistryRun, OpenTraitManagerCommandRegistryStop } from './view/OpenTraitManager';
OpenStyleManagerCommandRegistryStop,
} from './view/OpenStyleManager';
import type {
OpenTraitManagerCommandRegistryRun,
OpenTraitManagerCommandRegistryStop,
} from './view/OpenTraitManager';
type CommandRegistryHandler = (...args: any[]) => any; type CommandRegistryHandler = (...args: any[]) => any;
type CommandRegistryEntry<TRegistry, TId extends string> = TId extends keyof TRegistry type CommandRegistryEntry<TRegistry, TId extends string> = TId extends keyof TRegistry

5
packages/core/src/commands/registryHelpers.ts

@ -4,6 +4,5 @@ export type CommandPublicFnFromHandler<T> = T extends (editor: any, sender: any,
? (...args: P) => R ? (...args: P) => R
: never; : never;
export type CommandPublicOptions<T extends CommandPublicHandler> = Parameters<T> extends [] export type CommandPublicOptions<T extends CommandPublicHandler> =
? undefined Parameters<T> extends [] ? undefined : Parameters<T>[0];
: Parameters<T>[0];

5
packages/core/src/commands/view/MoveComponent.ts

@ -178,10 +178,7 @@ export default class CommandMoveComponent extends CommandAbstract {
} }
} }
[ [SelectPositionProto as Record<string, unknown>, SelectComponentProto as Record<string, unknown>].forEach((source) => {
SelectPositionProto as Record<string, unknown>,
SelectComponentProto as Record<string, unknown>,
].forEach((source) => {
Object.getOwnPropertyNames(source).forEach((key) => { Object.getOwnPropertyNames(source).forEach((key) => {
if (key === 'constructor') return; if (key === 'constructor') return;
if (!(key in CommandMoveComponent.prototype)) { if (!(key in CommandMoveComponent.prototype)) {

5
packages/core/src/commands/view/SelectComponent.ts

@ -303,10 +303,7 @@ export default class CommandSelectComponent extends CommandAbstract {
} }
if (cmp) { if (cmp) {
if ( if (em.isEditing() && ((!cmp.get('textable') && cmp.isChildOf('text')) || em.getEditing() !== cmp)) {
em.isEditing() &&
((!cmp.get('textable') && cmp.isChildOf('text')) || em.getEditing() !== cmp)
) {
return; return;
} }

Loading…
Cancel
Save