Skip to content

Commit

Permalink
Update Components.md (#4952)
Browse files Browse the repository at this point in the history
Grammer correction for Component Recognition and Component Type Stack section
  • Loading branch information
jacobisknight committed Mar 3, 2023
1 parent 45f23ac commit b90661b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion docs/modules/Components.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ At this point, a good question would be, how the editor assigns those types by s

### Component Recognition and Component Type Stack

As we mentioned before, when you pass an HTML string as a component to the editor, that string is parsed and compiled to the [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 component types but what is matter is the order of those types. Any new added custom **Component Type** (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.
As we mentioned before, when you pass an HTML string as a component to the editor, that string is parsed and compiled to the [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 component types but what matters is the order of those types. Any new added custom **Component Type** (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.

<img :src="$withBase('/component-type-stack.svg')" class="img-ctr">

Expand Down

0 comments on commit b90661b

Please sign in to comment.