UNPKG

@wordpress/editor

Version:
30 lines (27 loc) 763 B
/** * WordPress dependencies */ import { useSelect } from '@wordpress/data'; import { filterURLForDisplay, safeDecodeURIComponent } from '@wordpress/url'; /** * Internal dependencies */ import { store as editorStore } from '../../store'; /** * Represents a label component for a post URL. * * @return {Component} The PostURLLabel component. */ export default function PostURLLabel() { return usePostURLLabel(); } /** * Custom hook to get the label for the post URL. * * @return {string} The filtered and decoded post URL label. */ export function usePostURLLabel() { const postLink = useSelect(select => select(editorStore).getPermalink(), []); return filterURLForDisplay(safeDecodeURIComponent(postLink)); } //# sourceMappingURL=label.js.map