-`type`**[String][1]?** Component type, eg. `text`, `image`, `video`, etc.
-`tagName`**[String][1]?** HTML tag of the component, eg. `span`. Default: `div`
-`attributes`**[Object][2]?** Key-value object of the component's attributes, eg. `{ title: 'Hello' }` Default: `{}`
-`name`**[String][1]?** Name of the component. Will be used, for example, in Layers and badges
-`removable`**[Boolean][3]?** When `true` the component is removable from the canvas, default: `true`
-`draggable`**([Boolean][3] \| [String][1])?** Indicates if it's possible to drag the component inside others.
You can also specify a query string to indentify elements,
eg. `'.some-class[title=Hello], [data-gjs-type=column]'` means you can drag the component only inside elements
containing `some-class` class and `Hello` title, and `column` components. Default: `true`
-`droppable`**([Boolean][3] \| [String][1])?** Indicates if it's possible to drop other components inside. You can use
a query string as with `draggable`. Default: `true`
-`badgable`**[Boolean][3]?** Set to false if you don't want to see the badge (with the name) over the component. Default: `true`
- `stylable`**([Boolean][3] \| [Array][4]<[String][1]>)?** True if it's possible to style the component.
*`type`**[String][1]?** Component type, eg. `text`, `image`, `video`, etc.
*`tagName`**[String][1]?** HTML tag of the component, eg. `span`. Default: `div`
*`attributes`**[Object][2]?** Key-value object of the component's attributes, eg. `{ title: 'Hello' }` Default: `{}`
*`name`**[String][1]?** Name of the component. Will be used, for example, in Layers and badges
*`removable`**[Boolean][3]?** When `true` the component is removable from the canvas, default: `true`
*`draggable`**([Boolean][3] | [String][1])?** Indicates if it's possible to drag the component inside others.
You can also specify a query string to indentify elements,
eg. `'.some-class[title=Hello], [data-gjs-type=column]'` means you can drag the component only inside elements
containing `some-class` class and `Hello` title, and `column` components. Default: `true`
*`droppable`**([Boolean][3] | [String][1] | [Function][4])?** Indicates if it's possible to drop other components inside. You can use
a query string as with `draggable`. In the case of a function, target and destination components are passed as arguments, return a Boolean to indicate if the drop is possible. Default: `true`
*`badgable`**[Boolean][3]?** Set to false if you don't want to see the badge (with the name) over the component. Default: `true`
* `stylable`**([Boolean][3] | [Array][5]<[String][1]>)?** True if it's possible to style the component.
You can also indicate an array of CSS properties which is possible to style, eg. `['color', 'width']`, all other properties
will be hidden from the style manager. Default: `true`
- `stylable-require`**[Array][4]<[String][1]>?** Indicate an array of style properties to show up which has been marked as `toRequire`. Default: `[]`
- `unstylable`**[Array][4]<[String][1]>?** Indicate an array of style properties which should be hidden from the style manager. Default: `[]`
- `style-signature`**[Array][4]<[String][1]>?** This option comes handy when you need to remove or export strictly component-specific rules. Be default, if this option is not empty, the editor will remove rules when there are no components, of that type, in the canvas. Eg. '\['.navbar', '[navbar-']'. Default: `''`
- `highlightable`**[Boolean][3]?** It can be highlighted with 'dotted' borders if true. Default: `true`
- `copyable`**[Boolean][3]?** True if it's possible to clone the component. Default: `true`
- `resizable`**[Boolean][3]?** Indicates if it's possible to resize the component. It's also possible to pass an object as [options for the Resizer][5]. Default: `false`
- `editable`**[Boolean][3]?** Allow to edit the content of the component (used on Text components). Default: `false`
- `layerable`**[Boolean][3]?** Set to `false` if you need to hide the component inside Layers. Default: `true`
- `selectable`**[Boolean][3]?** Allow component to be selected when clicked. Default: `true`
- `hoverable`**[Boolean][3]?** Shows a highlight outline when hovering on the element if `true`. Default: `true`
- `void`**[Boolean][3]?** This property is used by the HTML exporter as void elements don't have closing tags, eg. `<br/>`, `<hr/>`, etc. Default: `false`
- `content`**[String][1]?** Content of the component (not escaped) which will be appended before children rendering. Default: `''`
- `icon`**[String][1]?** Component's icon, this string will be inserted before the name (in Layers and badge), eg. it can be an HTML string '<iclass="fa fa-square-o"></i>'. Default: `''`
- `script`**([String][1] \| [Function][6])?** Component's javascript. More about it [here][7]. Default: `''`
- `script-export`**([String][1] \| [Function][6])?** You can specify javascript available only in export functions (eg. when you get the HTML).
* `stylable-require`**[Array][5]<[String][1]>?** Indicate an array of style properties to show up which has been marked as `toRequire`. Default: `[]`
* `unstylable`**[Array][5]<[String][1]>?** Indicate an array of style properties which should be hidden from the style manager. Default: `[]`
* `highlightable`**[Boolean][3]?** It can be highlighted with 'dotted' borders if true. Default: `true`
* `copyable`**[Boolean][3]?** True if it's possible to clone the component. Default: `true`
* `resizable`**[Boolean][3]?** Indicates if it's possible to resize the component. It's also possible to pass an object as [options for the Resizer][6]. Default: `false`
* `editable`**[Boolean][3]?** Allow to edit the content of the component (used on Text components). Default: `false`
* `layerable`**[Boolean][3]?** Set to `false` if you need to hide the component inside Layers. Default: `true`
* `selectable`**[Boolean][3]?** Allow component to be selected when clicked. Default: `true`
* `hoverable`**[Boolean][3]?** Shows a highlight outline when hovering on the element if `true`. Default: `true`
* `void`**[Boolean][3]?** This property is used by the HTML exporter as void elements don't have closing tags, eg. `<br/>`, `<hr/>`, etc. Default: `false`
* `content`**[String][1]?** Content of the component (not escaped) which will be appended before children rendering. Default: `''`
* `icon`**[String][1]?** Component's icon, this string will be inserted before the name (in Layers and badge), eg. it can be an HTML string '<iclass="fa fa-square-o"></i>'. Default: `''`
* `script`**([String][1] | [Function][4])?** Component's javascript. More about it [here][7]. Default: `''`
* `script-export`**([String][1] | [Function][4])?** You can specify javascript available only in export functions (eg. when you get the HTML).
If this property is defined it will overwrite the `script` one (in export functions). Default: `''`
- `traits`**[Array][4]<([Object][2] \| [String][1])>?** Component's traits. More about it [here][8]. Default: `['id', 'title']`
- `propagate`**[Array][4]<[String][1]>?** Indicates an array of properties which will be inhereted by all NEW appended children.
For example if you create a component likes this: `{ removable: false, draggable: false, propagate: ['removable', 'draggable'] }`
and append some new component inside, the new added component will get the exact same properties indicated in the `propagate` array (and the `propagate` property itself). Default: `[]`
- `toolbar`**[Array][4]<[Object][2]>?** Set an array of items to show up inside the toolbar when the component is selected (move, clone, delete).
* `traits`**[Array][5]<([Object][2] | [String][1])>?** Component's traits. More about it [here][8]. Default: `['id', 'title']`
* `propagate`**[Array][5]<[String][1]>?** Indicates an array of properties which will be inhereted by all NEW appended children.
For example if you create a component likes this: `{ removable: false, draggable: false, propagate: ['removable', 'draggable'] }`
and append some new component inside, the new added component will get the exact same properties indicated in the `propagate` array (and the `propagate` property itself). Default: `[]`
* `toolbar`**[Array][5]<[Object][2]>?** Set an array of items to show up inside the toolbar when the component is selected (move, clone, delete).
-`component:create` - Component is created (only the model, is not yet mounted in the canvas), called after the init() method
-`component:mount` - Component is mounted to an element and rendered in canvas
-`component:add` - Triggered when a new component is added to the editor, the model is passed as an argument to the callback
-`component:remove` - Triggered when a component is removed, the model is passed as an argument to the callback
-`component:remove:before` - Triggered before the remove of the component, the model, remove function (if aborted via options, with this function you can complete the remove) and options (use options.abort = true to prevent remove), are passed as arguments to the callback
-`component:clone` - Triggered when a component is cloned, the new model is passed as an argument to the callback
-`component:update` - Triggered when a component is updated (moved, styled, etc.), the model is passed as an argument to the callback
-`component:update:{propertyName}` - Listen any property change, the model is passed as an argument to the callback
-`component:styleUpdate` - Triggered when the style of the component is updated, the model is passed as an argument to the callback
-`component:styleUpdate:{propertyName}` - Listen for a specific style property change, the model is passed as an argument to the callback
-`component:selected` - New component selected, the selected model is passed as an argument to the callback
-`component:deselected` - Component deselected, the deselected model is passed as an argument to the callback
-`component:toggled` - Component selection changed, toggled model is passed as an argument to the callback
-`component:type:add` - New component type added, the new type is passed as an argument to the callback
-`component:type:update` - Component type updated, the updated type is passed as an argument to the callback
-`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:create` - Component is created (only the model, is not yet mounted in the canvas), called after the init() method
*`component:mount` - Component is mounted to an element and rendered in canvas
*`component:add` - Triggered when a new component is added to the editor, the model is passed as an argument to the callback
*`component:remove` - Triggered when a component is removed, the model is passed as an argument to the callback
*`component:remove:before` - Triggered before the remove of the component, the model, remove function (if aborted via options, with this function you can complete the remove) and options (use options.abort = true to prevent remove), are passed as arguments to the callback
*`component:clone` - Triggered when a component is cloned, the new model is passed as an argument to the callback
*`component:update` - Triggered when a component is updated (moved, styled, etc.), the model is passed as an argument to the callback
*`component:update:{propertyName}` - Listen any property change, the model is passed as an argument to the callback
*`component:styleUpdate` - Triggered when the style of the component is updated, the model is passed as an argument to the callback
*`component:styleUpdate:{propertyName}` - Listen for a specific style property change, the model is passed as an argument to the callback
*`component:selected` - New component selected, the selected model is passed as an argument to the callback
*`component:deselected` - Component deselected, the deselected model is passed as an argument to the callback
*`component:toggled` - Component selection changed, toggled model is passed as an argument to the callback
*`component:type:add` - New component type added, the new type is passed as an argument to the callback
*`component:type:update` - Component type updated, the updated type is passed as an argument to the callback
*`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
### Blocks
-`block:add` - New block added
-`block:remove` - Block removed
-`block:drag:start` - Started dragging block, model of the block is passed as an argument
-`block:drag` - Dragging block, the block's model and the drag event are passed as arguments
-`block:drag:stop` - Dragging of the block is stopped. As agruments for the callback you get, the dropped component model (if dropped successfully) and the model of the block
*`block:add` - New block added
*`block:remove` - Block removed
*`block:drag:start` - Started dragging block, model of the block is passed as an argument
*`block:drag` - Dragging block, the block's model and the drag event are passed as arguments
*`block:drag:stop` - Dragging of the block is stopped. As agruments for the callback you get, the dropped component model (if dropped successfully) and the model of the block
### Assets
-`asset:add` - New asset added
-`asset:remove` - Asset removed
-`asset:upload:start` - Before the upload is started
-`asset:upload:end` - After the upload is ended
-`asset:upload:error` - On any error in upload, passes the error as an argument
-`asset:upload:response` - On upload response, passes the result as an argument
*`asset:add` - New asset added
*`asset:remove` - Asset removed
*`asset:upload:start` - Before the upload is started
*`asset:upload:end` - After the upload is ended
*`asset:upload:error` - On any error in upload, passes the error as an argument
*`asset:upload:response` - On upload response, passes the result as an argument
### Keymaps
-`keymap:add` - New keymap added. The new keyamp object is passed as an argument
-`keymap:remove` - Keymap removed. The removed keyamp object is passed as an argument
-`keymap:emit` - Some keymap emitted, in arguments you get keymapId, shortcutUsed, Event
-`keymap:emit:{keymapId}` - `keymapId` emitted, in arguments you get keymapId, shortcutUsed, Event
*`keymap:add` - New keymap added. The new keyamp object is passed as an argument
*`keymap:remove` - Keymap removed. The removed keyamp object is passed as an argument
*`keymap:emit` - Some keymap emitted, in arguments you get keymapId, shortcutUsed, Event
*`keymap:emit:{keymapId}` - `keymapId` emitted, in arguments you get keymapId, shortcutUsed, Event
### Style Manager
-`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:{propertyName}` - As above but for a specific style property
*`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:{propertyName}` - As above but for a specific style property
### Storages
-`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
*`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
### Canvas
- `canvas:dragenter` - When something is dragged inside the canvas, `DataTransfer` instance passed as an argument
- `canvas:dragover` - When something is dragging on canvas, `DataTransfer` instance passed as an argument
- `canvas:drop` - Something is dropped in canvas, `DataTransfer` instance and the dropped model are passed as arguments
- `canvas:dragend` - When a drag operation is ended, `DataTransfer` instance passed as an argument
- `canvas:dragdata` - On any dataTransfer parse, `DataTransfer` instance and the `result` are passed as arguments.
By changing `result.content` you're able to customize what is dropped
* `canvas:dragenter` - When something is dragged inside the canvas, `DataTransfer` instance passed as an argument
* `canvas:dragover` - When something is dragging on canvas, `DataTransfer` instance passed as an argument
* `canvas:drop` - Something is dropped in canvas, `DataTransfer` instance and the dropped model are passed as arguments
* `canvas:dragend` - When a drag operation is ended, `DataTransfer` instance passed as an argument
* `canvas:dragdata` - On any dataTransfer parse, `DataTransfer` instance and the `result` are passed as arguments.
By changing `result.content` you're able to customize what is dropped
### Selectors
-`selector:add` - New selector is add. Passes the new selector as an argument
-`selector:remove` - Selector removed. Passes the removed selector as an argument
-`selector:update` - Selector updated. Passes the updated selector as an argument
-`selector:state` - State changed. Passes the new state value as an argument
*`selector:add` - New selector is add. Passes the new selector as an argument
*`selector:remove` - Selector removed. Passes the removed selector as an argument
*`selector:update` - Selector updated. Passes the updated selector as an argument
*`selector:state` - State changed. Passes the new state value as an argument
### RTE
-`rte:enable` - RTE enabled. The view, on which RTE is enabled, is passed as an argument
-`rte:disable` - RTE disabled. The view, on which RTE is disabled, is passed as an argument
*`rte:enable` - RTE enabled. The view, on which RTE is enabled, is passed as an argument
*`rte:disable` - RTE disabled. The view, on which RTE is disabled, is passed as an argument
### Modal
-`modal:open` - Modal is opened
-`modal:close` - Modal is closed
*`modal:open` - Modal is opened
*`modal:close` - Modal is closed
### Parser
-`parse:html` - On HTML parse, an object containing the input and the output of the parser is passed as an argument
-`parse:css` - On CSS parse, an object containing the input and the output of the parser is passed as an argument
*`parse:html` - On HTML parse, an object containing the input and the output of the parser is passed as an argument
*`parse:css` - On CSS parse, an object containing the input and the output of the parser is passed as an argument
### Commands
-`run:{commandName}` - Triggered when some command is called to run (eg. editor.runCommand('preview'))
-`stop:{commandName}` - Triggered when some command is called to stop (eg. editor.stopCommand('preview'))
-`run:{commandName}:before` - Triggered before the command is called
-`stop:{commandName}:before` - Triggered before the command is called to stop
-`abort:{commandName}` - Triggered when the command execution is aborted (`editor.on(`run:preview:before`, opts => opts.abort = 1);`)
-`run` - Triggered on run of any command. The id and the result are passed as arguments to the callback
-`stop` - Triggered on stop of any command. The id and the result are passed as arguments to the callback
*`run:{commandName}` - Triggered when some command is called to run (eg. editor.runCommand('preview'))
*`stop:{commandName}` - Triggered when some command is called to stop (eg. editor.stopCommand('preview'))
*`run:{commandName}:before` - Triggered before the command is called
*`stop:{commandName}:before` - Triggered before the command is called to stop
*`abort:{commandName}` - Triggered when the command execution is aborted (`editor.on(`run:preview:before`, opts => opts.abort = 1);`)
*`run` - Triggered on run of any command. The id and the result are passed as arguments to the callback
*`stop` - Triggered on stop of any command. The id and the result are passed as arguments to the callback
### Pages
@ -133,11 +134,11 @@ Check the [Pages][2] module.
### General
-`canvasScroll` - Canvas is scrolled
-`update` - The structure of the template is updated (its HTML/CSS)
-`undo` - Undo executed
-`redo` - Redo executed
-`load` - Editor is loaded
*`canvasScroll` - Canvas is scrolled
*`update` - The structure of the template is updated (its HTML/CSS)
*`undo` - Undo executed
*`redo` - Redo executed
*`load` - Editor is loaded
## getConfig
@ -145,10 +146,10 @@ Returns configuration object
### Parameters
-`prop`**[string][3]?** Property name
*`prop`**[string][3]?** Property name
Returns **any** Returns the configuration object or
the value of the specified property
the value of the specified property
## getHtml
@ -156,8 +157,9 @@ Returns HTML built inside canvas
-`page:add` - Added new page. The page is passed as an argument to the callback
-`page:remove` - Page removed. The page is passed as an argument to the callback
-`page:select` - New page selected. The newly selected page and the previous one, are passed as arguments to the callback
-`page:update` - Page updated. The updated page and the object containing changes are passed as arguments to the callback
-`page` - Catch-all event for all the events mentioned above. An object containing all the available data about the triggered event is passed as an argument to the callback
*`page:add` - Added new page. The page is passed as an argument to the callback
*`page:remove` - Page removed. The page is passed as an argument to the callback
*`page:select` - New page selected. The newly selected page and the previous one, are passed as arguments to the callback
*`page:update` - Page updated. The updated page and the object containing changes are passed as arguments to the callback
*`page` - Catch-all event for all the events mentioned above. An object containing all the available data about the triggered event is passed as an argument to the callback
- `property.type`**[string][17]** Type of the property: integer | radio | select | color | file | composite | stack (optional, default `''`)
- `property.units`**[Array][19]<[string][17]>** Unit of measure available, eg. ['px','%','em']. Only for integer type (optional, default `[]`)
- `property.unit`**[string][17]** Default selected unit from `units`. Only for integer type (optional, default `''`)
- `property.min`**[number][20]** Min possible value. Only for integer type (optional, default `null`)
- `property.max`**[number][20]** Max possible value. Only for integer type (optional, default `null`)
- `property.defaults`**[string][17]** Default value (optional, default `''`)
- `property.info`**[string][17]** Some description (optional, default `''`)
- `property.icon`**[string][17]** Class name. If exists no text will be displayed (optional, default `''`)
- `property.preview`**[Boolean][18]** Show layers preview. Only for stack type (optional, default `false`)
- `property.functionName`**[string][17]** Indicates if value need to be wrapped in some function, for istance `transform: rotate(90deg)` (optional, default `''`)
- `property.properties`**[Array][19]<[Object][16]>** Nested properties for composite and stack type (optional, default `[]`)
- `property.layers`**[Array][19]<[Object][16]>** Layers for stack properties (optional, default `[]`)
- `property.list`**[Array][19]<[Object][16]>** List of possible options for radio and select types (optional, default `[]`)
* `property.type` **[string][17]** Type of the property: integer | radio | select | color | file | composite | stack (optional, default `''`)
* `property.units` **[Array][19]<[string][17]>** Unit of measure available, eg. \['px','%','em']. Only for integer type (optional, default `[]`)
* `property.unit` **[string][17]** Default selected unit from `units`. Only for integer type (optional, default `''`)
* `property.min` **[number][20]** Min possible value. Only for integer type (optional, default `null`)
* `property.max` **[number][20]** Max possible value. Only for integer type (optional, default `null`)
* `property.defaults` **[string][17]** Default value (optional, default `''`)
* `property.info` **[string][17]** Some description (optional, default `''`)
* `property.icon` **[string][17]** Class name. If exists no text will be displayed (optional, default `''`)
* `property.preview` **[Boolean][18]** Show layers preview. Only for stack type (optional, default `false`)
* `property.functionName` **[string][17]** Indicates if value need to be wrapped in some function, for istance `transform: rotate(90deg)` (optional, default `''`)
* `property.properties` **[Array][19]<[Object][16]>** Nested properties for composite and stack type (optional, default `[]`)
* `property.layers` **[Array][19]<[Object][16]>** Layers for stack properties (optional, default `[]`)
* `property.list` **[Array][19]<[Object][16]>** List of possible options for radio and select types (optional, default `[]`)