Browse Source

Move storage manager events

up-style-manager
Artur Arseniev 5 years ago
parent
commit
c2502f8236
  1. 14
      src/editor/index.js
  2. 23
      src/storage_manager/index.js

14
src/editor/index.js

@ -45,18 +45,8 @@
* * `styleManager:update:target` - The target (Component or CSSRule) is changed * * `styleManager:update:target` - The target (Component or CSSRule) is changed
* * `styleManager:change` - Triggered on style property change from new selected component, the view of the property is passed as an argument to the callback * * `styleManager:change` - Triggered on style property change from new selected component, the view of the property is passed as an argument to the callback
* * `styleManager:change:{propertyName}` - As above but for a specific style property * * `styleManager:change:{propertyName}` - As above but for a specific style property
* ### Storages * ### Storage
* * `storage:start` - Before the storage request is started * Check the [Storage](/api/storage_manager.html) module.
* * `storage:start:store` - Before the store request. The object to store is passed as an argumnet (which you can edit)
* * `storage:start:load` - Before the load request. Items to load are passed as an argumnet (which you can edit)
* * `storage:load` - Triggered when something was loaded from the storage, loaded object passed as an argumnet
* * `storage:store` - Triggered when something is stored to the storage, stored object passed as an argumnet
* * `storage:end` - After the storage request is ended
* * `storage:end:store` - After the store request
* * `storage:end:load` - After the load request
* * `storage:error` - On any error on storage request, passes the error as an argument
* * `storage:error:store` - Error on store request, passes the error as an argument
* * `storage:error:load` - Error on load request, passes the error as an argument
* ### Canvas * ### Canvas
* Check the [Canvas](/api/canvas.html) module. * Check the [Canvas](/api/canvas.html) module.
* ### RTE * ### RTE

23
src/storage_manager/index.js

@ -8,12 +8,31 @@
* }) * })
* ``` * ```
* *
* Once the editor is instantiated you can use its API. Before using these methods you should get the module from the instance * Once the editor is instantiated you can use its API and listen to its events. Before using these methods, you should get the module from the instance.
* *
* ```js * ```js
* // Listen to events
* editor.on('storage:start', () => { ... });
*
* // Use the API
* const storageManager = editor.StorageManager; * const storageManager = editor.StorageManager;
* storageManager.add(...);
* ``` * ```
* *
* ## Available Events
* * `storage:start` - Before the storage request is started
* * `storage:start:store` - Before the store request. The object to store is passed as an argumnet (which you can edit)
* * `storage:start:load` - Before the load request. Items to load are passed as an argumnet (which you can edit)
* * `storage:load` - Triggered when something was loaded from the storage, loaded object passed as an argumnet
* * `storage:store` - Triggered when something is stored to the storage, stored object passed as an argumnet
* * `storage:end` - After the storage request is ended
* * `storage:end:store` - After the store request
* * `storage:end:load` - After the load request
* * `storage:error` - On any error on storage request, passes the error as an argument
* * `storage:error:store` - Error on store request, passes the error as an argument
* * `storage:error:load` - Error on load request, passes the error as an argument
*
* ## Methods
* * [getConfig](#getconfig) * * [getConfig](#getconfig)
* * [isAutosave](#isautosave) * * [isAutosave](#isautosave)
* * [setAutosave](#setautosave) * * [setAutosave](#setautosave)
@ -362,6 +381,6 @@ export default () => {
destroy() { destroy() {
[c, em, storages, defaultStorages].forEach(i => (i = {})); [c, em, storages, defaultStorages].forEach(i => (i = {}));
} },
}; };
}; };

Loading…
Cancel
Save