diff --git a/docs/api/components.md b/docs/api/components.md index 4cd128019e..023001c4d1 100644 --- a/docs/api/components.md +++ b/docs/api/components.md @@ -43,6 +43,7 @@ cmp.addType(...); * `component:drag:start` - Component drag started. Passed an object, to the callback, containing the `target` (component to drag), `parent` (parent of the component) and `index` (component index in the parent) * `component:drag` - During component drag. Passed the same object as in `component:drag:start` event, but in this case, `parent` and `index` are updated by the current pointer * `component:drag:end` - Component drag ended. Passed the same object as in `component:drag:start` event, but in this case, `parent` and `index` are updated by the final pointer +* `component:resize` - During component resize. ## Methods diff --git a/src/dom_components/index.ts b/src/dom_components/index.ts index e3ee3fe762..325811b77d 100644 --- a/src/dom_components/index.ts +++ b/src/dom_components/index.ts @@ -115,7 +115,8 @@ export type ComponentEvent = | 'component:type:update' | 'component:drag:start' | 'component:drag' - | 'component:drag:end'; + | 'component:drag:end' + | 'component:resize'; export interface ComponentModelDefinition extends IComponent { defaults?: ComponentDefinitionDefined; diff --git a/src/editor/index.ts b/src/editor/index.ts index bc37d4eee2..4df854a08b 100644 --- a/src/editor/index.ts +++ b/src/editor/index.ts @@ -69,7 +69,7 @@ import ComponentManager, { ComponentEvent } from '../dom_components'; import Component from '../dom_components/model/Component'; import Components from '../dom_components/model/Components'; import ComponentWrapper from '../dom_components/model/ComponentWrapper'; -import { DragMode } from '../dom_components/model/types'; +import { ComponentDefinition, DragMode } from '../dom_components/model/types'; import I18nModule from '../i18n'; import KeymapsModule, { KeymapEvent } from '../keymaps'; import ModalModule, { ModalEvent } from '../modal_dialog'; @@ -320,7 +320,7 @@ export default class Editor implements IBaseModule { * content: 'New component' * }); */ - setComponents(components: any, opt: any = {}) { + setComponents(components: string | ComponentDefinition, opt: any = {}) { this.em.setComponents(components, opt); return this; } @@ -342,7 +342,7 @@ export default class Editor implements IBaseModule { * content: 'New component' * }); */ - addComponents(components: any, opts?: any): Component[] { + addComponents(components: string | ComponentDefinition, opts?: any): Component[] { return this.getWrapper()!.append(components, opts); } diff --git a/src/storage_manager/config/config.ts b/src/storage_manager/config/config.ts index 3e59a700a9..12c0522cc1 100644 --- a/src/storage_manager/config/config.ts +++ b/src/storage_manager/config/config.ts @@ -16,7 +16,7 @@ export interface StorageManagerConfig { * Available by default: 'local' | 'remote' * @default 'local' */ - type?: string; + type?: 'local' | 'remote'; /** * Enable/disable autosaving. diff --git a/src/storage_manager/index.ts b/src/storage_manager/index.ts index f52289cd29..bb429bc1cb 100644 --- a/src/storage_manager/index.ts +++ b/src/storage_manager/index.ts @@ -88,7 +88,7 @@ export default class StorageManager extends Module< constructor(em: EditorModel) { super(em, 'StorageManager', defaults); const { config } = this; - if (config._disable) config.type = ''; + if (config._disable) config.type = undefined; this.storages = {}; this.add(STORAGE_LOCAL, new LocalStorage()); this.add(STORAGE_REMOTE, new RemoteStorage());