Browse Source

Update docs

pull/3229/head
Artur Arseniev 5 years ago
parent
commit
7cb66c6da5
  1. 38
      docs/api/component.md
  2. 4
      docs/api/components.md
  3. 23
      docs/api/css_composer.md

38
docs/api/component.md

@ -191,6 +191,17 @@ console.log(Section);
Returns **[Component][9]** Found component, otherwise `undefined`
## contains
The method returns a Boolean value indicating whether the passed
component is a descendant of a given component
### Parameters
- `component` **[Component][9]** Component to check
Returns **[Boolean][3]**
## replaceWith
Replace a component with another one
@ -395,6 +406,10 @@ Remove all inner components
Get the parent component, if exists
### Parameters
- `opts` (optional, default `{}`)
### Examples
```javascript
@ -617,6 +632,29 @@ Returns **this**
Remove the component
### Parameters
- `opts` (optional, default `{}`)
Returns **this**
## move
Move the component to another destination component
### Parameters
- `component` **[Component][9]** Destination component (so the current one will be appended as a child)
- `opts` **[Object][2]** Options for the append action (optional, default `{}`)
### Examples
```javascript
// Move the selected component on top of the wrapper
const dest = editor.getWrapper();
editor.getSelected().move(dest, { at: 0 });
```
Returns **this**
## getList

4
docs/api/components.md

@ -151,6 +151,10 @@ Returns **[HTMLElement][16]**
Remove all components
### Parameters
- `opts` (optional, default `{}`)
Returns **this**
## addType

23
docs/api/css_composer.md

@ -59,7 +59,9 @@ Add new rule to the collection, if not yet exists with the same selectors
- `selectors` **[Array][12]<Selector>** Array of selectors
- `state` **[String][13]** Css rule state
- `width` **[String][13]** For which device this style is oriented
- `opts` **[Object][10]** Other options for the rule (optional, default `{}`)
- `opts` **[Object][10]** Options for the add of new rule (optional, default `{}`)
- `addOpts` (optional, default `{}`)
- `props` **[Object][10]** Other props for the rule
### Examples
@ -168,6 +170,25 @@ const rule3 = cc.getRule('.myclass1', {
Returns **CssRule**
## getRules
Find rules, in different states (eg. like `:hover`) and media queries, matching the selector.
### Parameters
- `selector` **[string][13]** Selector, eg. '.myclass'
### Examples
```javascript
// Common scenario, take all the component specific rules
const id = someComponent.getId();
const rules = cc.getRules(`#${id}`);
console.log(rules.map(rule => rule.toCSS()))
```
Returns **[Array][12]<CssRule>**
[1]: https://github.com/artf/grapesjs/blob/master/src/css_composer/config/config.js
[2]: #load

Loading…
Cancel
Save