@wordpress/editor
Version:
Enhanced block editor for WordPress posts.
8 lines (7 loc) • 1.77 kB
Source Map (JSON)
{
"version": 3,
"sources": ["../../../src/components/post-sticky/index.js"],
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { CheckboxControl } from '@wordpress/components';\nimport { useDispatch, useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport PostStickyCheck from './check';\nimport { store as editorStore } from '../../store';\n\n/**\n * Renders the PostSticky component. It provides a checkbox control for the sticky post feature.\n *\n * @return {React.ReactNode} The rendered component.\n */\nexport default function PostSticky() {\n\tconst postSticky = useSelect( ( select ) => {\n\t\treturn (\n\t\t\tselect( editorStore ).getEditedPostAttribute( 'sticky' ) ?? false\n\t\t);\n\t}, [] );\n\tconst { editPost } = useDispatch( editorStore );\n\n\treturn (\n\t\t<PostStickyCheck>\n\t\t\t<CheckboxControl\n\t\t\t\tclassName=\"editor-post-sticky__checkbox-control\"\n\t\t\t\tlabel={ __( 'Sticky' ) }\n\t\t\t\thelp={ __( 'Pin this post to the top of the blog.' ) }\n\t\t\t\tchecked={ postSticky }\n\t\t\t\tonChange={ () => editPost( { sticky: ! postSticky } ) }\n\t\t\t/>\n\t\t</PostStickyCheck>\n\t);\n}\n"],
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAAmB;AACnB,wBAAgC;AAChC,kBAAuC;AAKvC,mBAA4B;AAC5B,mBAAqC;AAiBlC;AAVY,SAAR,aAA8B;AACpC,QAAM,iBAAa,uBAAW,CAAE,WAAY;AAC3C,WACC,OAAQ,aAAAA,KAAY,EAAE,uBAAwB,QAAS,KAAK;AAAA,EAE9D,GAAG,CAAC,CAAE;AACN,QAAM,EAAE,SAAS,QAAI,yBAAa,aAAAA,KAAY;AAE9C,SACC,4CAAC,aAAAC,SAAA,EACA;AAAA,IAAC;AAAA;AAAA,MACA,WAAU;AAAA,MACV,WAAQ,gBAAI,QAAS;AAAA,MACrB,UAAO,gBAAI,uCAAwC;AAAA,MACnD,SAAU;AAAA,MACV,UAAW,MAAM,SAAU,EAAE,QAAQ,CAAE,WAAW,CAAE;AAAA;AAAA,EACrD,GACD;AAEF;",
"names": ["editorStore", "PostStickyCheck"]
}