Browse Source

Update command module in editor

ts-style-manager
Artur Arseniev 3 years ago
parent
commit
ab55fc64d0
  1. 5
      src/commands/index.ts
  2. 5
      src/editor/index.ts
  3. 5
      src/editor/model/Editor.ts

5
src/commands/index.ts

@ -76,7 +76,7 @@ const commandsDef = [
['component-drag', 'ComponentDrag'],
];
export default class Commands extends Module<CommandsConfig & { pStylePrefix?: string }> {
export default class CommandsModule extends Module<CommandsConfig & { pStylePrefix?: string }> {
CommandAbstract = CommandAbstract;
defaultCommands: Record<string, Command> = {};
commands: Record<string, CustomCommand> = {};
@ -174,10 +174,11 @@ export default class Commands extends Module<CommandsConfig & { pStylePrefix?: s
//sel.set('status', 'freezed');
}
const cmdMove = ed.Commands.get('move-comp');
const cmdMove = ed.Commands.get('move-comp')!;
cmdMove.onStart = onStart;
cmdMove.onDrag = onDrag;
cmdMove.onEndMoveFromModel = onEnd;
// @ts-ignore
cmdMove.initSorterFromModels(selAll);
}

5
src/editor/index.ts

@ -103,9 +103,8 @@ export default class EditorModule implements IBaseModule<EditorConfig> {
get Utils() {
return this.em.Utils;
}
//@ts-ignore
get Commands(): CommandsModule {
return this.em.get('Commands');
get Commands() {
return this.em.Commands;
}
get Keymaps() {
return this.em.Keymaps;

5
src/editor/model/Editor.ts

@ -31,6 +31,7 @@ import PanelManager from '../../panels';
import CodeManagerModule from '../../code_manager';
import UndoManagerModule from '../../undo_manager';
import RichTextEditorModule from '../../rich_text_editor';
import CommandsModule from '../../commands';
//@ts-ignore
Backbone.$ = $;
@ -130,6 +131,10 @@ export default class EditorModel extends Model {
return this.get('Utils');
}
get Commands(): CommandsModule {
return this.get('Commands');
}
get Keymaps(): KeymapsModule {
return this.get('Keymaps');
}

Loading…
Cancel
Save