UNPKG

@wordpress/editor

Version:
8 lines (7 loc) 1.18 kB
{ "version": 3, "sources": ["../../../src/components/post-url/label.js"], "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { filterURLForDisplay, safeDecodeURIComponent } from '@wordpress/url';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\n\n/**\n * Represents a label component for a post URL.\n *\n * @return {React.ReactNode} The PostURLLabel component.\n */\nexport default function PostURLLabel() {\n\treturn usePostURLLabel();\n}\n\n/**\n * Custom hook to get the label for the post URL.\n *\n * @return {string} The filtered and decoded post URL label.\n */\nexport function usePostURLLabel() {\n\tconst postLink = useSelect(\n\t\t( select ) => select( editorStore ).getPermalink(),\n\t\t[]\n\t);\n\treturn filterURLForDisplay( safeDecodeURIComponent( postLink ) );\n}\n"], "mappings": ";AAGA,SAAS,iBAAiB;AAC1B,SAAS,qBAAqB,8BAA8B;AAK5D,SAAS,SAAS,mBAAmB;AAOtB,SAAR,eAAgC;AACtC,SAAO,gBAAgB;AACxB;AAOO,SAAS,kBAAkB;AACjC,QAAM,WAAW;AAAA,IAChB,CAAE,WAAY,OAAQ,WAAY,EAAE,aAAa;AAAA,IACjD,CAAC;AAAA,EACF;AACA,SAAO,oBAAqB,uBAAwB,QAAS,CAAE;AAChE;", "names": [] }