...', { at: 0 })
-```
-or in the middle
-```js
-const { length } = component.components();
-component.append('
...', { at: parseInt(length / 2, 10) })
-```
-:::
-
-### Component Definition
+## Built-in components
+* default (Basic)
+* wrapper
+* text
+* textnode
+* svg
+* script
+* image
+* video
+* label
+* link
+* map
+* table
+* row (for the table)
+* cell (for the table)
-In the first step the HTML string is parsed and trasformed to what is called **Component Definition**, so the result of the input would be:
-```js
-{
- tagName: 'div',
- components: [
- {
- type: 'image',
- attributes: { src: 'https://path/image' },
- }, {
- tagName: 'span',
- type: 'text',
- attributes: { title: 'foo' },
- components: [{
- type: 'textnode',
- content: 'Hello wdsforld!!!'
- }]
- }
- ]
-}
-```
-The real **Component Definition** would be a little bit bigger so we reduced the JSON for the sake of simplicity.
-
-You can notice the result is similar to what is generally called a **Virtual DOM**, a lightweight rappresentation of the DOM element. This actually helps the editor to keep track of the state of our elements and make performance-friendly changes/updates.
-The meaning of properties like `tagName`, `attributes` and `components` are quite obvious, but what about `type`?! This particular property specifies the actual **Component** of our **Component Definition** (you check the list of default components [below](#built-in-components)) and if it's omitted, the default one will be used `type: 'default'`.
-At this point, a good question would be, how the editor assignes those types by starting from a simple HTML string? This step is identified as **Component Recognition** and it's explained in detail in the next paragraph.
-
-### Component Recognition and Component Type Stack
-
-As we said before, when you pass an HTML string as a component to the editor, that string is parsed and compiled to the [Component Definition](#component-definition) with a new `type` property. To understand what `type` should be assigned, for each parsed HTML Element, the editor iterates over all the defined components, called **Component Type Stack**, and checks via `isComponent` method (we will see it later) if that component type is appropriate for that element. The Component Type Stack is just a simple array of components but the important part is the order of those components. Any new added Custom Component (we'll see later how to create them) goes on top of the Component Type Stack and each element returned from the parser iterates the stack from top to bottom (the last element of the stack is the `default` one), the iteration stops once one of the component returns a truthy value from the `isComponent` method.
-
-SVG - ComponentTypeStack
-
-::: tip
-If you're importing big chunks of HTML code you might want to improve the performances by skipping the parsing and the component recognition steps by passing directly Component Definiton objects or using the JSX syntax. Read more about it here...TODO
-:::
-
-
-### Component Creation
+## How Components work?
-Once the **Component Definition** is ready and the type is assigned, the [Component](api/component.html) instance can be created (known also as the **Model**). Let's step back to our previous example with the HTML string, the result of the `append` method is an array of added components.
+When we pass an HTML string to the editor like this:
-```js
-const component = editor.addComponents(`
+```html
+

-
Hello world!!!
-
`)[0];
-```
-
-The Component instance contains properties and methods which allows you to obtain its data and change them.
-You can read properties with the `get` method, like, for example, the `type`
-```js
-const componentType = component.get('type'); // eg. 'image'
-```
-and to update properties you'd use `set`, which might change the way a component behavies in the canvas.
-```js
-// Make the component not draggable
-component.set('draggable', false);
-```
-You can also use methods like `getAttributes`, `setAttributes`, `components`, etc.
-
-```js
-const innerComponents = component.components();
-// Update component content
-component.components(`
Component 1
Component 2
`);
-```
-
-Each component can define its own properties and methods but all of them will always extend, at least, the `default` one (then you will see how to create new custom components and how to extend the already defined) so it's good to check the [Component API](api/component.html) to see all available properties and methods.
-
-The **main purpose of the Component** is to keep track of its data and to return them when necessary. One common thing you might need to ask from the component is to show its current HTML
-
-```js
-const componentHTML = component.toHTML();
-```
-
-This will return a string containing the HTML of the component and all of its children.
-The component implements also `toJSON` methods so you can get its JSON structure in this way
-
-```js
-JSON.stringify(component)
-```
-
-::: tip
-For storing/loading all the components you should rely on the [Storage Manager](modules/Storage.html)
-:::
-
-The Component instance is responable for the **final data** (eg. HTML, JSON) of your templates, so if you need, for example, to update/add some attribute in the HTML you need to update its component (eg. `component.addAttributes({ title: 'Title added' })`), so the Component/Model is your **Source of Truth**.
-
-
-
-### Component Rendering
-
-Another important thing of components is how they are rendered in the **canvas**, this aspect is handled by the **View** of the component. It has nothing to do with the **final data**, you can return a big `
...
` string as HTML of your component but render it as a simple image in the canvas (think about placeholders for complex/dynamic data).
-
-So, by default, the view of components is automatically synced with the data of its models (you can't have a View without a Model). If you update the attribute of the component or append a new one as a child, the view will render it in the canvas.
-Unfotunatelly, sometimes, you might need some additional logic to handle better the component result. Think about allowing a user build its `
` element, for this specific case you might want to add custom buttons in the canvas, so it'd be easier adding/removing columns/rows. To handle those cases you can rely on the View, where you can add additional DOM component, attach events, etc. All of this will be completely unrelated with the final HTML of the `` (the result the user would expect) as it handled by the Model.
-Once the component is rendered (when you actually see it in the canvas) you can always access its View and the DOM element.
-
-```js
-const component = editor.getSelected();
-// Get the View
-const view = component.getView();
-// Get the DOM element
-const el = component.getEl();
+ bar
+
```
-So generally, the View is something you wouldn't need to change as the default one handles already the sync with the Model but in case you'd need more control over elements (eg. custom UI in canvas) you'll probably need to create a custom component and extend the default View with your logic. We'll see later how to create custom components.
-
-
-So far we have seen the core concept behind Components and how they work. The **Model/Component** is the **source of truth** for the final code of templates (eg. the HTML export relies on it) and the *View/ComponentView* is what is used by the editor to **preview our components** to users in the canvas.
-
-
-TODO
-A more advanced use case of custom components is an implementation of a custom renderer inside of them
-
-
-
-
-
-## Built-in Components
-
-Here below you can see the list of built-in components, ordered by their position in the Component Type Stack
-
-* [`cell`](https://github.com/artf/grapesjs/blob/dev/src/dom_components/model/ComponentTableCell.js) - Component for handle `| ` and ` | ` elements
-* [`row`](https://github.com/artf/grapesjs/blob/dev/src/dom_components/model/ComponentTableRow.js) - Component for handle ` | ` elements
-* [`table`](https://github.com/artf/grapesjs/blob/dev/src/dom_components/model/ComponentTable.js) - Component for handle `