diff --git a/src/editor/index.js b/src/editor/index.js index a15fb04a9..5443e01d1 100644 --- a/src/editor/index.js +++ b/src/editor/index.js @@ -311,6 +311,22 @@ module.exports = config => { return em.getSelected(); }, + /** + * Get stylable entity from the selected component. + * If you select the component without classes the entity is the Component + * itself and all changes will go inside its 'style' property. Otherwise, + * if the selected component has one or more classes, the function will + * return the corresponding CSS Rule + * @return {Model} + */ + getSelectedToStyle() { + let selected = em.getSelected(); + + if (selected) { + return this.StyleManager.getModelToStyle(selected); + } + }, + /** * Set device to the editor. If the device exists it will * change the canvas to the proper width