@wordpress/editor
Version:
Enhanced block editor for WordPress posts.
8 lines (7 loc) • 951 B
Source Map (JSON)
{
"version": 3,
"sources": ["../../../src/utils/media-finalize/index.js"],
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport apiFetch from '@wordpress/api-fetch';\nimport { transformAttachment } from '@wordpress/media-utils';\n\nexport default async function mediaFinalize( id, subSizes = [] ) {\n\tconst response = await apiFetch( {\n\t\tpath: `/wp/v2/media/${ id }/finalize`,\n\t\tmethod: 'POST',\n\t\tdata: { sub_sizes: subSizes },\n\t} );\n\n\t// Returning the post-finalize attachment lets callers refresh the block\n\t// URL (via onChange) so it points at the scaled file and srcset matches.\n\treturn response ? transformAttachment( response ) : undefined;\n}\n"],
"mappings": ";AAGA,OAAO,cAAc;AACrB,SAAS,2BAA2B;AAEpC,eAAO,cAAsC,IAAI,WAAW,CAAC,GAAI;AAChE,QAAM,WAAW,MAAM,SAAU;AAAA,IAChC,MAAM,gBAAiB,EAAG;AAAA,IAC1B,QAAQ;AAAA,IACR,MAAM,EAAE,WAAW,SAAS;AAAA,EAC7B,CAAE;AAIF,SAAO,WAAW,oBAAqB,QAAS,IAAI;AACrD;",
"names": []
}