diff --git a/docs/api/component.md b/docs/api/component.md index 9a2e14d4a..e3bc370c0 100644 --- a/docs/api/component.md +++ b/docs/api/component.md @@ -394,11 +394,18 @@ Returns **this** ## getEl -Get the DOM element of the component. This works only of the -component is already rendered +Get the DOM element of the component. +This works only if the component is already rendered Returns **[HTMLElement][10]** +## getView + +Get the View of the component. +This works only if the component is already rendered + +Returns **ComponentView** + ## onAll Execute callback function on itself and all inner components diff --git a/docs/api/editor.md b/docs/api/editor.md index b09b09611..f5e58b14b 100644 --- a/docs/api/editor.md +++ b/docs/api/editor.md @@ -23,6 +23,8 @@ editor.on('EVENT-NAME', (some, argument) => { ### Components +- `component:create` - Component is created (only the model, is not yet mounted in the canvas) +- `component:mount` - Component is monted 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:clone` - Triggered when a new component is added by a clone command, the model is passed as an argument to the callback diff --git a/docs/api/keymaps.md b/docs/api/keymaps.md index d19e6bdac..1c670c596 100644 --- a/docs/api/keymaps.md +++ b/docs/api/keymaps.md @@ -30,12 +30,13 @@ const keymaps = editor.Keymaps; - [get][3] - [getAll][4] - [remove][5] +- [removeAll][6] ## getConfig Get module configurations -Returns **[Object][6]** Configuration object +Returns **[Object][7]** Configuration object ## add @@ -43,9 +44,9 @@ Add new keymap ### Parameters -- `id` **[string][7]** Keymap id -- `keys` **[string][7]** Keymap keys, eg. `ctrl+a`, `⌘+z, ctrl+z` -- `handler` **([Function][8] \| [string][7])** Keymap handler, might be a function +- `id` **[string][8]** Keymap id +- `keys` **[string][8]** Keymap keys, eg. `ctrl+a`, `⌘+z, ctrl+z` +- `handler` **([Function][9] \| [string][8])** Keymap handler, might be a function ### Examples @@ -63,7 +64,7 @@ editor.on('keymap:emit', (id, shortcut, e) => { }) ``` -Returns **[Object][6]** Added keymap +Returns **[Object][7]** Added keymap or just a command id as a string ## get @@ -72,7 +73,7 @@ Get the keymap by id ### Parameters -- `id` **[string][7]** Keymap id +- `id` **[string][8]** Keymap id ### Examples @@ -81,7 +82,7 @@ keymaps.get('ns:my-keymap'); // -> {keys, handler}; ``` -Returns **[Object][6]** Keymap object +Returns **[Object][7]** Keymap object ## getAll @@ -94,7 +95,7 @@ keymaps.getAll(); // -> {id1: {}, id2: {}}; ``` -Returns **[Object][6]** +Returns **[Object][7]** ## remove @@ -102,7 +103,7 @@ Remove the keymap by id ### Parameters -- `id` **[string][7]** Keymap id +- `id` **[string][8]** Keymap id ### Examples @@ -111,7 +112,13 @@ keymaps.remove('ns:my-keymap'); // -> {keys, handler}; ``` -Returns **[Object][6]** Removed keymap +Returns **[Object][7]** Removed keymap + +## removeAll + +Remove all binded keymaps + +Returns **this** [1]: #getconfig @@ -123,8 +130,10 @@ Returns **[Object][6]** Removed keymap [5]: #remove -[6]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object +[6]: #removeall + +[7]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object -[7]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String +[8]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String -[8]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function +[9]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function diff --git a/docs/api/panels.md b/docs/api/panels.md index 5e8a69618..e19da0874 100644 --- a/docs/api/panels.md +++ b/docs/api/panels.md @@ -20,13 +20,12 @@ const panelManager = editor.Panels; - [addPanel][2] - [addButton][3] -- [removeButton][4] -- [getButton][5] -- [getPanel][6] -- [getPanels][7] -- [getPanelsEl][8] -- [removePanel][9] -- [removeButton][10] +- [getButton][4] +- [getPanel][5] +- [getPanels][6] +- [getPanelsEl][7] +- [removePanel][8] +- [removeButton][9] ## getPanels @@ -38,7 +37,7 @@ Returns **Collection** Collection of panel Returns panels element -Returns **[HTMLElement][11]** +Returns **[HTMLElement][10]** ## addPanel @@ -46,7 +45,7 @@ Add new panel to the collection ### Parameters -- `panel` **([Object][12] | Panel)** Object with right properties or an instance of Panel +- `panel` **([Object][11] | Panel)** Object with right properties or an instance of Panel ### Examples @@ -66,7 +65,7 @@ Remove a panel from the collection ### Parameters -- `panel` **([Object][12] | Panel | [String][13])** Object with right properties or an instance of Panel or Painel id +- `panel` **([Object][11] | Panel | [String][12])** Object with right properties or an instance of Panel or Painel id ### Examples @@ -88,7 +87,7 @@ Get panel by ID ### Parameters -- `id` **[string][13]** Id string +- `id` **[string][12]** Id string ### Examples @@ -104,8 +103,8 @@ Add button to the panel ### Parameters -- `panelId` **[string][13]** Panel's ID -- `button` **([Object][12] | Button)** Button object or instance of Button +- `panelId` **[string][12]** Panel's ID +- `button` **([Object][11] | Button)** Button object or instance of Button ### Examples @@ -143,13 +142,14 @@ Remove button from the panel ### Parameters -- `panelId` **[string][13]** Panel's ID -- `button` **([Object][12] | Button | [String][13])** Button object or instance of Button or button id +- `panelId` **[String][12]** Panel's ID +- `button` +- `buttonId` **[String][12]** Button's ID ### Examples ```javascript -const removedButton = panelManager.removeButton('myNewPanel',{ +const removedButton = panelManager.addButton('myNewPanel',{ id: 'myNewButton', className: 'someClass', command: 'someCommand', @@ -157,8 +157,7 @@ const removedButton = panelManager.removeButton('myNewPanel',{ active: false, }); -// It's also possible to use the button id -const removedButton = panelManager.removeButton('myNewPanel','myNewButton'); +const removedButton = panelManager.removeButton('myNewPanel', 'myNewButton'); ``` Returns **(Button | null)** Removed button. @@ -169,8 +168,8 @@ Get button from the panel ### Parameters -- `panelId` **[string][13]** Panel's ID -- `id` **[string][13]** Button's ID +- `panelId` **[string][12]** Panel's ID +- `id` **[string][12]** Button's ID ### Examples @@ -186,22 +185,20 @@ Returns **(Button | null)** [3]: #addbutton -[4]: #removebutton +[4]: #getbutton -[5]: #getbutton +[5]: #getpanel -[6]: #getpanel +[6]: #getpanels -[7]: #getpanels +[7]: #getpanelsel -[8]: #getpanelsel +[8]: #removepanel -[9]: #removepanel +[9]: #removebutton -[10]: #removeButton +[10]: https://developer.mozilla.org/docs/Web/HTML/Element -[11]: https://developer.mozilla.org/docs/Web/HTML/Element +[11]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object -[12]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object - -[13]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String +[12]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String