You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/API.md
+31Lines changed: 31 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,6 +5,37 @@ This block uses the **WordPress Interactivity API** to manage state and logic. Y
5
5
## Store Namespace
6
6
`rt-carousel/carousel`
7
7
8
+
## Embla Initialization Filters
9
+
10
+
rtCarousel exposes JavaScript filters immediately before calling `EmblaCarousel( viewport, options, plugins )`, allowing runtime customization without changing saved block markup.
11
+
12
+
```js
13
+
import { addFilter } from'@wordpress/hooks';
14
+
importAutoHeightfrom'embla-carousel-auto-height';
15
+
16
+
addFilter(
17
+
'rtcamp.carouselKit.emblaOptions',
18
+
'my-plugin/custom-options',
19
+
( options ) => ( { ...options, duration:40 } )
20
+
);
21
+
22
+
addFilter(
23
+
'rtcamp.carouselKit.emblaPlugins',
24
+
'my-plugin/auto-height',
25
+
( plugins ) => [ ...plugins, AutoHeight() ]
26
+
);
27
+
```
28
+
29
+
Both filters receive the carousel context object as the third argument. `rtcamp.carouselKit.emblaPlugins` also receives the filtered options on `options`.
30
+
31
+
| Property | Type | Description |
32
+
| :--- | :--- | :--- |
33
+
|`context`|`CarouselContext`| Interactivity API context for the carousel. |
0 commit comments