diff --git a/src/SliderEdit.js b/src/SliderEdit.js index 036c51c..88d04ce 100644 --- a/src/SliderEdit.js +++ b/src/SliderEdit.js @@ -2,7 +2,7 @@ const { createElement, Fragment } = wp.element const { compose } = wp.compose const { createBlock } = wp.blocks const { InspectorControls, InnerBlocks } = wp.editor -const { PanelBody, PanelRow, Button, ToggleControl } = wp.components +const { PanelBody, PanelRow, Button, ToggleControl, TextControl } = wp.components const { withDispatch, withSelect } = wp.data const SliderEdit = props => { @@ -22,7 +22,7 @@ const SliderEdit = props => { const dataSlick = JSON.parse(attributes.dataSlick) const updateDataSlick = dataSlickElem => { - const updatedDataSlick = { ...dataSlick, ...dataSlickElem, autoplay: true } + const updatedDataSlick = { ...dataSlick, ...dataSlickElem } setAttributes({ dataSlick: JSON.stringify(updatedDataSlick) }) } @@ -51,14 +51,43 @@ const SliderEdit = props => { onChange={() => updateDataSlick({ arrows: !dataSlick.arrows })} /> + + + updateDataSlick({ + autoplay: !dataSlick.autoplay, + autoplaySpeed: 3000 + }) + } + /> + + {dataSlick.autoplay && ( + + updateDataSlick({ autoplaySpeed: v })} + /> + + )}
{typeof props.insertBlocksAfter !== 'undefined' ? ( ) : ( -
- )} +
+ )}
)