UNPKG

@wordpress/edit-post

Version:
8 lines (7 loc) 1.88 kB
{ "version": 3, "sources": ["../../../src/components/preferences-modal/enable-panel.js"], "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { store as editorStore } from '@wordpress/editor';\nimport { privateApis as preferencesPrivateApis } from '@wordpress/preferences';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\n\nconst { PreferenceBaseOption } = unlock( preferencesPrivateApis );\n\nexport default function EnablePanelOption( props ) {\n\tconst { toggleEditorPanelEnabled } = useDispatch( editorStore );\n\tconst { isChecked, isRemoved } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { isEditorPanelEnabled, isEditorPanelRemoved } =\n\t\t\t\tselect( editorStore );\n\t\t\treturn {\n\t\t\t\tisChecked: isEditorPanelEnabled( props.panelName ),\n\t\t\t\tisRemoved: isEditorPanelRemoved( props.panelName ),\n\t\t\t};\n\t\t},\n\t\t[ props.panelName ]\n\t);\n\n\tif ( isRemoved ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<PreferenceBaseOption\n\t\t\tisChecked={ isChecked }\n\t\t\tonChange={ () => toggleEditorPanelEnabled( props.panelName ) }\n\t\t\t{ ...props }\n\t\t/>\n\t);\n}\n"], "mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAAuC;AACvC,oBAAqC;AACrC,yBAAsD;AAKtD,yBAAuB;AAuBrB;AArBF,IAAM,EAAE,qBAAqB,QAAI,2BAAQ,mBAAAA,WAAuB;AAEjD,SAAR,kBAAoC,OAAQ;AAClD,QAAM,EAAE,yBAAyB,QAAI,yBAAa,cAAAC,KAAY;AAC9D,QAAM,EAAE,WAAW,UAAU,QAAI;AAAA,IAChC,CAAE,WAAY;AACb,YAAM,EAAE,sBAAsB,qBAAqB,IAClD,OAAQ,cAAAA,KAAY;AACrB,aAAO;AAAA,QACN,WAAW,qBAAsB,MAAM,SAAU;AAAA,QACjD,WAAW,qBAAsB,MAAM,SAAU;AAAA,MAClD;AAAA,IACD;AAAA,IACA,CAAE,MAAM,SAAU;AAAA,EACnB;AAEA,MAAK,WAAY;AAChB,WAAO;AAAA,EACR;AAEA,SACC;AAAA,IAAC;AAAA;AAAA,MACA;AAAA,MACA,UAAW,MAAM,yBAA0B,MAAM,SAAU;AAAA,MACzD,GAAG;AAAA;AAAA,EACN;AAEF;", "names": ["preferencesPrivateApis", "editorStore"] }