Browse Source

Update command module in editor

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

5
src/editor/index.ts

@ -103,9 +103,8 @@ export default class EditorModule implements IBaseModule<EditorConfig> {
get Utils() { get Utils() {
return this.em.Utils; return this.em.Utils;
} }
//@ts-ignore get Commands() {
get Commands(): CommandsModule { return this.em.Commands;
return this.em.get('Commands');
} }
get Keymaps() { get Keymaps() {
return this.em.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 CodeManagerModule from '../../code_manager';
import UndoManagerModule from '../../undo_manager'; import UndoManagerModule from '../../undo_manager';
import RichTextEditorModule from '../../rich_text_editor'; import RichTextEditorModule from '../../rich_text_editor';
import CommandsModule from '../../commands';
//@ts-ignore //@ts-ignore
Backbone.$ = $; Backbone.$ = $;
@ -130,6 +131,10 @@ export default class EditorModel extends Model {
return this.get('Utils'); return this.get('Utils');
} }
get Commands(): CommandsModule {
return this.get('Commands');
}
get Keymaps(): KeymapsModule { get Keymaps(): KeymapsModule {
return this.get('Keymaps'); return this.get('Keymaps');
} }

Loading…
Cancel
Save