Revert "chore: Linting for markdown and js"
This reverts commit 1c92e0f655
.
This commit is contained in:
parent
994874fa72
commit
cba1ab19c8
6627 changed files with 25791 additions and 24211 deletions
|
@ -1,17 +1,16 @@
|
|||
***
|
||||
|
||||
---
|
||||
title: Hooks API
|
||||
for: developers
|
||||
about: Documents the available lifecycle hooks in Core and how to use them
|
||||
--------------------------------------------------------------------------
|
||||
---
|
||||
|
||||
A **hook** is a lifecycle event.
|
||||
|
||||
You can register a method for a hook. When the hook is triggered, your method will be
|
||||
called. It will receive two parameters:
|
||||
|
||||
* An object relevant to the hook (see the specific hook for details)
|
||||
* Data passed when the hook was registered (optional)
|
||||
- An object relevant to the hook (see the specific hook for details)
|
||||
- Data passed when the hook was registered (optional)
|
||||
|
||||
Below is a list of all available hooks:
|
||||
|
||||
|
|
|
@ -1,16 +1,16 @@
|
|||
***
|
||||
|
||||
## title: insertText
|
||||
---
|
||||
title: insertText
|
||||
---
|
||||
|
||||
The `insertText` hook is called when text is about to be inserted during rendering.
|
||||
|
||||
Methods attached to the `insertText` hook will receive 2 parameters:
|
||||
|
||||
* `locale` : The language code of the language requested by the user (defaults to `en`)
|
||||
* `text`: The text to be inserted
|
||||
- `locale` : The language code of the language requested by the user (defaults to `en`)
|
||||
- `text`: The text to be inserted
|
||||
|
||||
Unlike most hooks that receive an object that you can make changes to,
|
||||
for this hook you need to return a string.
|
||||
Unlike most hooks that receive an object that you can make changes to,
|
||||
for this hook you need to return a string.
|
||||
|
||||
This hook is typically used for translation, as is the case
|
||||
in [our i18n plugin](/reference/plugins/i18n/).
|
||||
|
@ -20,8 +20,8 @@ in [our i18n plugin](/reference/plugins/i18n/).
|
|||
When we say that *this hook is called when text is about to be inserted*, that is a simplified view.
|
||||
In reality, this hook is called:
|
||||
|
||||
* For every value set on data-text
|
||||
* For the combined result of these values, joined together with spaces
|
||||
- For every value set on data-text
|
||||
- For the combined result of these values, joined together with spaces
|
||||
|
||||
Let's use an example to clarify things:
|
||||
|
||||
|
@ -33,14 +33,15 @@ points.example
|
|||
|
||||
For the example point above, the `insertText` hook will end up being called 3 times:
|
||||
|
||||
* First it will pass `seamAllowance` to the plugin
|
||||
* Then it will pass `: 1cm` to the plugin
|
||||
* Finally it will pass `seamAllowance : 1cm` to the plugin
|
||||
- First it will pass `seamAllowance` to the plugin
|
||||
- Then it will pass `: 1cm` to the plugin
|
||||
- Finally it will pass `seamAllowance : 1cm` to the plugin
|
||||
|
||||
Having the `insertText` hook only run once with `Seam allowance: 1cm` would be problematic because
|
||||
the seam allowance may differ, or perhaps we're using imperial units, and so on.
|
||||
|
||||
Instead, you can (and should) divide your text into chunks that need translating, and chunks that do not.
|
||||
|
||||
This is also why we're not inserting **Seam allowance** but rather **seamAllowance**;
|
||||
This is also why we're not inserting **Seam allowance** but rather **seamAllowance**;
|
||||
It is merely a key to indicate what translation we want to replace this text with.
|
||||
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
***
|
||||
|
||||
## title: postDraft
|
||||
---
|
||||
title: postDraft
|
||||
---
|
||||
|
||||
The `postDraft` hook runs just after your pattern is drafted.
|
||||
|
||||
Your plugin will receive the Pattern object.
|
||||
Your plugin will receive the Pattern object.
|
||||
|
||||
<Note>
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
***
|
||||
|
||||
## title: postRender
|
||||
---
|
||||
title: postRender
|
||||
---
|
||||
|
||||
The `postRender` hook is triggered after the SVG is rendered.
|
||||
|
||||
|
@ -11,3 +11,4 @@ Like the `preRender` hook, it receives [the SVG object](/api/svg) as its first p
|
|||
The `postRender` hooks is rarely used.
|
||||
|
||||
</Note>
|
||||
|
||||
|
|
|
@ -1,18 +1,19 @@
|
|||
***
|
||||
|
||||
## title: postSample
|
||||
---
|
||||
title: postSample
|
||||
---
|
||||
|
||||
The `postSample` hook runs just after your pattern is sampled.
|
||||
Your plugin will receive the Pattern object.
|
||||
Your plugin will receive the Pattern object.
|
||||
|
||||
It is triggered just before the end of either:
|
||||
|
||||
* the [Pattern.sampleOption()](/reference/api/pattern/#sampleoption) method
|
||||
* the [Pattern.sampleMeasurement()](/reference/api/pattern/#samplemeasurement) method
|
||||
* the [Pattern.sampleModels()](/reference/api/pattern/#samplemodels) method
|
||||
- the [Pattern.sampleOption()](/reference/api/pattern/#sampleoption) method
|
||||
- the [Pattern.sampleMeasurement()](/reference/api/pattern/#samplemeasurement) method
|
||||
- the [Pattern.sampleModels()](/reference/api/pattern/#samplemodels) method
|
||||
|
||||
<Note>
|
||||
|
||||
The `postSample` hook is rarely used.
|
||||
|
||||
</Note>
|
||||
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
***
|
||||
|
||||
## title: preDraft
|
||||
---
|
||||
title: preDraft
|
||||
---
|
||||
|
||||
The `preDraft` hook runs just before your pattern is drafted.
|
||||
|
||||
Your plugin will receive the Pattern object.
|
||||
Your plugin will receive the Pattern object.
|
||||
|
||||
<Note>
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
***
|
||||
|
||||
## title: preRender
|
||||
---
|
||||
title: preRender
|
||||
---
|
||||
|
||||
The `preRender` hook is triggered just before your pattern is rendered to SVG.
|
||||
|
||||
|
|
|
@ -1,16 +1,16 @@
|
|||
***
|
||||
|
||||
## title: preSample
|
||||
---
|
||||
title: preSample
|
||||
---
|
||||
|
||||
The `preSample` hook runs just before your pattern is sampled.
|
||||
|
||||
It is triggered at the very start of either:
|
||||
|
||||
* the [Pattern.sampleOption()](/reference/api/pattern/#sampleoption) method
|
||||
* the [Pattern.sampleMeasurement()](/reference/api/pattern/#samplemeasurement) method
|
||||
* the [Pattern.sampleModels()](/reference/api/pattern/#samplemodels) method
|
||||
- the [Pattern.sampleOption()](/reference/api/pattern/#sampleoption) method
|
||||
- the [Pattern.sampleMeasurement()](/reference/api/pattern/#samplemeasurement) method
|
||||
- the [Pattern.sampleModels()](/reference/api/pattern/#samplemodels) method
|
||||
|
||||
Your plugin will receive the Pattern object.
|
||||
Your plugin will receive the Pattern object.
|
||||
|
||||
<Note>
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue