@wordpress/editor
Version:
Enhanced block editor for WordPress posts.
8 lines (7 loc) • 1.22 kB
Source Map (JSON)
{
"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": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAA0B;AAC1B,iBAA4D;AAK5D,mBAAqC;AAOtB,SAAR,eAAgC;AACtC,SAAO,gBAAgB;AACxB;AAOO,SAAS,kBAAkB;AACjC,QAAM,eAAW;AAAA,IAChB,CAAE,WAAY,OAAQ,aAAAA,KAAY,EAAE,aAAa;AAAA,IACjD,CAAC;AAAA,EACF;AACA,aAAO,oCAAqB,mCAAwB,QAAS,CAAE;AAChE;",
"names": ["editorStore"]
}