@gechiui/block-editor
Version:
32 lines (31 loc) • 871 B
JavaScript
/**
* GeChiUI dependencies
*/
import { rawHandler, getBlockContent } from '@gechiui/blocks';
import { compose } from '@gechiui/compose';
import { withSelect, withDispatch } from '@gechiui/data';
/**
* Internal dependencies
*/
import BlockConvertButton from './block-convert-button';
import { store as blockEditorStore } from '../../store';
export default compose(withSelect((select, _ref) => {
let {
clientId
} = _ref;
const block = select(blockEditorStore).getBlock(clientId);
return {
block,
shouldRender: block && block.name === 'core/html'
};
}), withDispatch((dispatch, _ref2) => {
let {
block
} = _ref2;
return {
onClick: () => dispatch(blockEditorStore).replaceBlocks(block.clientId, rawHandler({
HTML: getBlockContent(block)
}))
};
}))(BlockConvertButton);
//# sourceMappingURL=block-html-convert-button.js.map