UNPKG

@wordpress/block-library

Version:
1 lines • 17.1 kB
{"version":3,"file":"transforms.mjs","names":["coreStore"],"sources":["../../src/image/transforms.js"],"sourcesContent":["import { createBlobURL, isBlobURL } from '@wordpress/blob';\nimport { createBlock, getBlockAttributes } from '@wordpress/blocks';\nimport { select } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Returns the subset of block attributes that should be carried over when\n * converting an animated-GIF Image block into its converted Video block.\n *\n * The conversion swaps one block for another via `createBlock`, which would\n * otherwise drop everything the author set on the original block. This carries\n * the attributes both blocks support: block alignment, the HTML anchor, custom\n * class names, and margin spacing.\n *\n * Image-only attributes such as links (`href`/`linkDestination`), sizing\n * (`sizeSlug`/`scale`), and `border`/`shadow` styles are intentionally not\n * carried: the Video block has no equivalent, so copying them would leave\n * attributes the target block cannot represent.\n *\n * @param {Object} attributes Source block attributes.\n * @return {Object} Attributes to spread into the converted block.\n */\nfunction getCarriedGifConversionAttributes( attributes ) {\n\tconst { align, anchor, className, style } = attributes;\n\tconst margin = style?.spacing?.margin;\n\n\treturn {\n\t\t...( align && { align } ),\n\t\t...( anchor && { anchor } ),\n\t\t...( className && { className } ),\n\t\t...( margin && { style: { spacing: { margin } } } ),\n\t};\n}\n\n/**\n * Returns the sideloaded video companion of an animated GIF image attachment,\n * or `null` when the media is not a converted animated GIF.\n *\n * An animated GIF uploaded through the editor gets a muted, looping video\n * transcode sideloaded next to it and recorded (as basenames) in the\n * attachment's `media_details.animated_video` / `animated_video_poster`.\n *\n * Block transforms match and run synchronously, so this reads the attachment\n * record straight from the core-data store: it only returns the companion once\n * the record is resolved. The Image block resolves the record while the block\n * is selected, which is also when the block switcher can offer the transform.\n *\n * @param {number} id Image attachment ID.\n * @param {string} url Image block URL, used to cheaply skip non-GIF media.\n * @return {Object|null} Companion details (absolute `src`/`poster` URLs and\n * the GIF's intrinsic `width`/`height`), or `null`.\n */\nfunction getAnimatedGifVideoCompanion( id, url ) {\n\tif ( ! id ) {\n\t\treturn null;\n\t}\n\t/*\n\t * Only animated GIFs have a video companion. Gate on the `.gif` extension\n\t * so an ordinary image never reaches into the attachment record just to\n\t * discover it has no companion. Strip any query string or fragment first\n\t * so a URL like `cat.gif?ver=2` still matches.\n\t */\n\tconst urlPath = url?.split( /[?#]/ )[ 0 ];\n\tif ( ! urlPath?.toLowerCase().endsWith( '.gif' ) ) {\n\t\treturn null;\n\t}\n\tconst record = select( coreStore ).getEntityRecord(\n\t\t'postType',\n\t\t'attachment',\n\t\tid,\n\t\t{ context: 'view' }\n\t);\n\tconst details = record?.media_details;\n\tif ( ! details?.animated_video || ! record?.source_url ) {\n\t\treturn null;\n\t}\n\t// Companion files are sideloaded next to the GIF, so they share its\n\t// directory; build their URLs from the GIF's own source URL.\n\tconst dir = record.source_url.slice(\n\t\t0,\n\t\trecord.source_url.lastIndexOf( '/' ) + 1\n\t);\n\treturn {\n\t\tsrc: dir + details.animated_video,\n\t\tposter: details.animated_video_poster\n\t\t\t? dir + details.animated_video_poster\n\t\t\t: undefined,\n\t\twidth: details.width,\n\t\theight: details.height,\n\t};\n}\n\nexport function stripFirstImage( attributes, { shortcode } ) {\n\tconst { body } = document.implementation.createHTMLDocument( '' );\n\n\tbody.innerHTML = shortcode.content;\n\n\tlet nodeToRemove = body.querySelector( 'img' );\n\n\t// If an image has parents, find the topmost node to remove.\n\twhile (\n\t\tnodeToRemove &&\n\t\tnodeToRemove.parentNode &&\n\t\tnodeToRemove.parentNode !== body\n\t) {\n\t\tnodeToRemove = nodeToRemove.parentNode;\n\t}\n\n\tif ( nodeToRemove ) {\n\t\tnodeToRemove.parentNode.removeChild( nodeToRemove );\n\t}\n\n\treturn body.innerHTML.trim();\n}\n\nfunction getFirstAnchorAttributeFormHTML( html, attributeName ) {\n\tconst { body } = document.implementation.createHTMLDocument( '' );\n\n\tbody.innerHTML = html;\n\n\tconst { firstElementChild } = body;\n\n\tif ( firstElementChild && firstElementChild.nodeName === 'A' ) {\n\t\treturn firstElementChild.getAttribute( attributeName ) || undefined;\n\t}\n}\n\nconst imageSchema = {\n\timg: {\n\t\tattributes: [ 'src', 'alt', 'title', 'width', 'height' ],\n\t\tclasses: [\n\t\t\t'alignleft',\n\t\t\t'aligncenter',\n\t\t\t'alignright',\n\t\t\t'alignnone',\n\t\t\t/^wp-image-\\d+$/,\n\t\t],\n\t},\n};\n\n// Normalise an `<img>` pixel dimension attribute to the `<value>px` form the\n// Image block stores in its `width`/`height` attributes. Non-integer values\n// (e.g. `50%`) are dropped because the attribute round-trips through inline\n// styles that expect pixel units.\nfunction parsePixelDimension( value ) {\n\treturn value && /^\\d+$/.test( value ) ? `${ value }px` : undefined;\n}\n\nconst schema = ( { phrasingContentSchema } ) => ( {\n\tfigure: {\n\t\trequire: [ 'img' ],\n\t\tchildren: {\n\t\t\t...imageSchema,\n\t\t\ta: {\n\t\t\t\tattributes: [ 'href', 'rel', 'target' ],\n\t\t\t\tclasses: [ '*' ],\n\t\t\t\tchildren: imageSchema,\n\t\t\t},\n\t\t\tfigcaption: {\n\t\t\t\tchildren: phrasingContentSchema,\n\t\t\t},\n\t\t},\n\t},\n} );\n\nconst transforms = {\n\tfrom: [\n\t\t{\n\t\t\ttype: 'raw',\n\t\t\tisMatch: ( node ) =>\n\t\t\t\tnode.nodeName === 'FIGURE' && !! node.querySelector( 'img' ),\n\t\t\tschema,\n\t\t\ttransform: ( node ) => {\n\t\t\t\tconst img = node.querySelector( 'img' );\n\t\t\t\t// Search both figure and image classes. Alignment could be\n\t\t\t\t// set on either. ID is set on the image.\n\t\t\t\tconst className = node.className + ' ' + img.className;\n\t\t\t\tconst alignMatches =\n\t\t\t\t\t/(?:^|\\s)align(left|center|right)(?:$|\\s)/.exec(\n\t\t\t\t\t\tclassName\n\t\t\t\t\t);\n\t\t\t\tconst anchor = node.id === '' ? undefined : node.id;\n\t\t\t\tconst align = alignMatches ? alignMatches[ 1 ] : undefined;\n\t\t\t\tconst idMatches = /(?:^|\\s)wp-image-(\\d+)(?:$|\\s)/.exec(\n\t\t\t\t\tclassName\n\t\t\t\t);\n\t\t\t\tconst id = idMatches ? Number( idMatches[ 1 ] ) : undefined;\n\t\t\t\tconst anchorElement = node.querySelector( 'a' );\n\t\t\t\tconst linkDestination =\n\t\t\t\t\tanchorElement && anchorElement.href ? 'custom' : undefined;\n\t\t\t\tconst href =\n\t\t\t\t\tanchorElement && anchorElement.href\n\t\t\t\t\t\t? anchorElement.href\n\t\t\t\t\t\t: undefined;\n\t\t\t\tconst rel =\n\t\t\t\t\tanchorElement && anchorElement.rel\n\t\t\t\t\t\t? anchorElement.rel\n\t\t\t\t\t\t: undefined;\n\t\t\t\tconst linkClass =\n\t\t\t\t\tanchorElement && anchorElement.className\n\t\t\t\t\t\t? anchorElement.className\n\t\t\t\t\t\t: undefined;\n\t\t\t\t// Pin only one dimension and let the other follow the aspect\n\t\t\t\t// ratio via `auto`. Pinning both as fixed pixels stretches the\n\t\t\t\t// image when a theme caps the width while the height stays\n\t\t\t\t// fixed. So width sources use `height: 'auto'`; height-only\n\t\t\t\t// sources use `width: 'auto'`.\n\t\t\t\tconst widthValue = parsePixelDimension(\n\t\t\t\t\timg.getAttribute( 'width' )\n\t\t\t\t);\n\t\t\t\tconst heightValue = parsePixelDimension(\n\t\t\t\t\timg.getAttribute( 'height' )\n\t\t\t\t);\n\t\t\t\t// When both dimensions are declared, preserve the source's\n\t\t\t\t// shape via `aspectRatio` (mirroring the resize handle). CSS\n\t\t\t\t// `aspect-ratio` needs no fixed dimensions, so the image keeps\n\t\t\t\t// its proportions even when the `src` can't resolve to natural\n\t\t\t\t// dimensions (e.g. an empty or blob `src`) — without it the\n\t\t\t\t// `height: 'auto'` would collapse to `0`.\n\t\t\t\t// `parseInt` is `NaN` for an absent dimension and `0` for a\n\t\t\t\t// zero one (both falsy), so a bogus ratio is never stored.\n\t\t\t\tconst widthNumber = parseInt( widthValue, 10 );\n\t\t\t\tconst heightNumber = parseInt( heightValue, 10 );\n\t\t\t\tconst aspectRatio =\n\t\t\t\t\twidthNumber && heightNumber\n\t\t\t\t\t\t? String( widthNumber / heightNumber )\n\t\t\t\t\t\t: undefined;\n\t\t\t\t// A height-only source declares a single dimension, so it can't\n\t\t\t\t// carry an aspect ratio: `width: 'auto'` is capped by\n\t\t\t\t// `max-width: 100%` while the fixed height can still stretch a\n\t\t\t\t// wide source. This is a known edge case (a panoramic image\n\t\t\t\t// pinned by height only) left unsolved here.\n\t\t\t\tconst width =\n\t\t\t\t\twidthValue || ( heightValue ? 'auto' : undefined );\n\t\t\t\tconst height = widthValue ? 'auto' : heightValue;\n\t\t\t\tconst attributes = getBlockAttributes(\n\t\t\t\t\t'core/image',\n\t\t\t\t\tnode.outerHTML,\n\t\t\t\t\t{\n\t\t\t\t\t\talign,\n\t\t\t\t\t\tid,\n\t\t\t\t\t\tlinkDestination,\n\t\t\t\t\t\thref,\n\t\t\t\t\t\trel,\n\t\t\t\t\t\tlinkClass,\n\t\t\t\t\t\tanchor,\n\t\t\t\t\t\twidth,\n\t\t\t\t\t\theight,\n\t\t\t\t\t\taspectRatio,\n\t\t\t\t\t}\n\t\t\t\t);\n\n\t\t\t\tif ( isBlobURL( attributes.url ) ) {\n\t\t\t\t\tattributes.blob = attributes.url;\n\t\t\t\t\tdelete attributes.url;\n\t\t\t\t}\n\n\t\t\t\treturn createBlock( 'core/image', attributes );\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\t// Note: when dragging and dropping multiple files onto a gallery this overrides the\n\t\t\t// gallery transform in order to add new images to the gallery instead of\n\t\t\t// creating a new gallery.\n\t\t\ttype: 'files',\n\t\t\tisMatch( files ) {\n\t\t\t\treturn files.every(\n\t\t\t\t\t( file ) => file.type.indexOf( 'image/' ) === 0\n\t\t\t\t);\n\t\t\t},\n\t\t\ttransform( files ) {\n\t\t\t\tconst blocks = files.map( ( file ) => {\n\t\t\t\t\treturn createBlock( 'core/image', {\n\t\t\t\t\t\tblob: createBlobURL( file ),\n\t\t\t\t\t} );\n\t\t\t\t} );\n\t\t\t\treturn blocks;\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\ttype: 'shortcode',\n\t\t\ttag: 'caption',\n\t\t\tattributes: {\n\t\t\t\turl: {\n\t\t\t\t\ttype: 'string',\n\t\t\t\t\tsource: 'attribute',\n\t\t\t\t\tattribute: 'src',\n\t\t\t\t\tselector: 'img',\n\t\t\t\t},\n\t\t\t\talt: {\n\t\t\t\t\ttype: 'string',\n\t\t\t\t\tsource: 'attribute',\n\t\t\t\t\tattribute: 'alt',\n\t\t\t\t\tselector: 'img',\n\t\t\t\t},\n\t\t\t\tcaption: {\n\t\t\t\t\tshortcode: stripFirstImage,\n\t\t\t\t},\n\t\t\t\thref: {\n\t\t\t\t\tshortcode: ( attributes, { shortcode } ) => {\n\t\t\t\t\t\treturn getFirstAnchorAttributeFormHTML(\n\t\t\t\t\t\t\tshortcode.content,\n\t\t\t\t\t\t\t'href'\n\t\t\t\t\t\t);\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\trel: {\n\t\t\t\t\tshortcode: ( attributes, { shortcode } ) => {\n\t\t\t\t\t\treturn getFirstAnchorAttributeFormHTML(\n\t\t\t\t\t\t\tshortcode.content,\n\t\t\t\t\t\t\t'rel'\n\t\t\t\t\t\t);\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\tlinkClass: {\n\t\t\t\t\tshortcode: ( attributes, { shortcode } ) => {\n\t\t\t\t\t\treturn getFirstAnchorAttributeFormHTML(\n\t\t\t\t\t\t\tshortcode.content,\n\t\t\t\t\t\t\t'class'\n\t\t\t\t\t\t);\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\tid: {\n\t\t\t\t\ttype: 'number',\n\t\t\t\t\tshortcode: ( { named: { id } } ) => {\n\t\t\t\t\t\tif ( ! id ) {\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\treturn parseInt( id.replace( 'attachment_', '' ), 10 );\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\talign: {\n\t\t\t\t\ttype: 'string',\n\t\t\t\t\tshortcode: ( { named: { align = 'alignnone' } } ) => {\n\t\t\t\t\t\treturn align.replace( 'align', '' );\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t],\n\tto: [\n\t\t{\n\t\t\t// Offer converting an animated GIF into the Video block's \"GIF\"\n\t\t\t// variation: a muted, looping, autoplaying video transcoded from\n\t\t\t// the GIF and sideloaded next to it when it was uploaded. Only\n\t\t\t// matches when that companion video exists, so ordinary images\n\t\t\t// never see this transform.\n\t\t\ttype: 'block',\n\t\t\tblocks: [ 'core/video' ],\n\t\t\tisMatch: ( { id, url } ) =>\n\t\t\t\t!! getAnimatedGifVideoCompanion( id, url ),\n\t\t\ttransform( attributes ) {\n\t\t\t\tconst { id, url, caption } = attributes;\n\t\t\t\tconst companion = getAnimatedGifVideoCompanion( id, url );\n\n\t\t\t\treturn createBlock( 'core/video', {\n\t\t\t\t\t...getCarriedGifConversionAttributes( attributes ),\n\t\t\t\t\tid,\n\t\t\t\t\tsrc: companion.src,\n\t\t\t\t\tposter: companion.poster,\n\t\t\t\t\tcaption,\n\t\t\t\t\tcontrols: false,\n\t\t\t\t\tloop: true,\n\t\t\t\t\tautoplay: true,\n\t\t\t\t\tmuted: true,\n\t\t\t\t\tplaysInline: true,\n\t\t\t\t\t/*\n\t\t\t\t\t * Carry the GIF's intrinsic dimensions so the <video>\n\t\t\t\t\t * keeps its aspect ratio from the first paint. Without\n\t\t\t\t\t * them the element collapses to the browser-default size\n\t\t\t\t\t * and then jumps once the poster/metadata load, which\n\t\t\t\t\t * shows up as a brief duplicated image during the swap.\n\t\t\t\t\t */\n\t\t\t\t\twidth: companion.width,\n\t\t\t\t\theight: companion.height,\n\t\t\t\t} );\n\t\t\t},\n\t\t},\n\t],\n};\n\nexport default transforms;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAsBA,SAAS,kCAAmC,YAAa;CACxD,MAAM,EAAE,OAAO,QAAQ,WAAW,U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