PluginProbe
Block Animations, Motion & Scroll Effects – Ghost Kit / 3.3.2
Block Animations, Motion & Scroll Effects – Ghost Kit v3.3.2
3.7.2 3.7.1 3.7.0 3.6.1 trunk 1.6.3 2.25.0 3.3.0 3.3.1 3.3.2 3.3.3 3.4.0 3.4.1 3.4.2 3.4.3 3.4.4 3.4.5 3.4.6 3.5.0 3.5.1 3.6.0
ghostkit / gutenberg / style-variants / core-list / frontend.js

frontend.js in Block Animations, Motion & Scroll Effects – Ghost Kit 3.3.2, at gutenberg/style-variants/core-list/frontend.js

27 lines 700 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 /**
2 * Prepare Numbered Lists with `start` attribute.
3 */
4 const {
5 GHOSTKIT: { events },
6 } = window;
7
8 events.on(document, 'init.blocks.gkt', () => {
9 document
10 .querySelectorAll('.is-style-styled:not(.is-style-styled-ready)')
11 .forEach(($list) => {
12 const start = parseInt($list.getAttribute('start'), 10);
13 const isReversed = $list.getAttribute('reversed') !== null;
14 const itemsCount = $list.children.length;
15
16 $list.classList.add('is-style-styled-ready');
17
18 if (isReversed) {
19 $list.style.counterReset = `li ${(start || itemsCount) + 1}`;
20 } else if (start) {
21 $list.style.counterReset = `li ${start - 1}`;
22 }
23
24 events.trigger($list, 'prepare.numberedList.gkt');
25 });
26 });
27