Browse Source

Merge branch 'dev' of https://github.com/artf/grapesjs into dev

pull/5196/head
Artur Arseniev 3 years ago
parent
commit
1365ca1c9c
  1. 1
      docs/api/components.md
  2. 3
      src/dom_components/index.ts
  3. 6
      src/editor/index.ts
  4. 2
      src/storage_manager/config/config.ts
  5. 2
      src/storage_manager/index.ts

1
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: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` - 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: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 ## Methods

3
src/dom_components/index.ts

@ -115,7 +115,8 @@ export type ComponentEvent =
| 'component:type:update' | 'component:type:update'
| 'component:drag:start' | 'component:drag:start'
| 'component:drag' | 'component:drag'
| 'component:drag:end'; | 'component:drag:end'
| 'component:resize';
export interface ComponentModelDefinition extends IComponent { export interface ComponentModelDefinition extends IComponent {
defaults?: ComponentDefinitionDefined; defaults?: ComponentDefinitionDefined;

6
src/editor/index.ts

@ -69,7 +69,7 @@ import ComponentManager, { ComponentEvent } from '../dom_components';
import Component from '../dom_components/model/Component'; import Component from '../dom_components/model/Component';
import Components from '../dom_components/model/Components'; import Components from '../dom_components/model/Components';
import ComponentWrapper from '../dom_components/model/ComponentWrapper'; 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 I18nModule from '../i18n';
import KeymapsModule, { KeymapEvent } from '../keymaps'; import KeymapsModule, { KeymapEvent } from '../keymaps';
import ModalModule, { ModalEvent } from '../modal_dialog'; import ModalModule, { ModalEvent } from '../modal_dialog';
@ -322,7 +322,7 @@ export default class Editor implements IBaseModule<EditorConfig> {
* content: 'New component' * content: 'New component'
* }); * });
*/ */
setComponents(components: any, opt: any = {}) { setComponents(components: string | ComponentDefinition, opt: any = {}) {
this.em.setComponents(components, opt); this.em.setComponents(components, opt);
return this; return this;
} }
@ -344,7 +344,7 @@ export default class Editor implements IBaseModule<EditorConfig> {
* content: 'New component' * content: 'New component'
* }); * });
*/ */
addComponents(components: any, opts?: any): Component[] { addComponents(components: string | ComponentDefinition, opts?: any): Component[] {
return this.getWrapper()!.append(components, opts); return this.getWrapper()!.append(components, opts);
} }

2
src/storage_manager/config/config.ts

@ -16,7 +16,7 @@ export interface StorageManagerConfig {
* Available by default: 'local' | 'remote' * Available by default: 'local' | 'remote'
* @default 'local' * @default 'local'
*/ */
type?: string; type?: 'local' | 'remote';
/** /**
* Enable/disable autosaving. * Enable/disable autosaving.

2
src/storage_manager/index.ts

@ -88,7 +88,7 @@ export default class StorageManager extends Module<
constructor(em: EditorModel) { constructor(em: EditorModel) {
super(em, 'StorageManager', defaults); super(em, 'StorageManager', defaults);
const { config } = this; const { config } = this;
if (config._disable) config.type = ''; if (config._disable) config.type = undefined;
this.storages = {}; this.storages = {};
this.add(STORAGE_LOCAL, new LocalStorage()); this.add(STORAGE_LOCAL, new LocalStorage());
this.add(STORAGE_REMOTE, new RemoteStorage()); this.add(STORAGE_REMOTE, new RemoteStorage());

Loading…
Cancel
Save