UNPKG

@gechiui/block-editor

Version:
38 lines (32 loc) 990 B
import { createElement } from "@gechiui/element"; /** * GeChiUI dependencies */ import { withSelect } from '@gechiui/data'; import { __ } from '@gechiui/i18n'; import { Button } from '@gechiui/components'; /** * Internal dependencies */ import { store as blockEditorStore } from '../../store'; import { __unstableUseBlockRef as useBlockRef } from '../block-list/use-block-props/use-block-refs'; const SkipToSelectedBlock = _ref => { let { selectedBlockClientId } = _ref; const ref = useBlockRef(selectedBlockClientId); const onClick = () => { ref.current.focus(); }; return selectedBlockClientId ? createElement(Button, { variant: "secondary", className: "block-editor-skip-to-selected-block", onClick: onClick }, __('跳转至选定的区块')) : null; }; export default withSelect(select => { return { selectedBlockClientId: select(blockEditorStore).getBlockSelectionStart() }; })(SkipToSelectedBlock); //# sourceMappingURL=index.js.map