@wordpress/block-library
Version:
Block library for the WordPress editor.
176 lines (175 loc) • 3.8 kB
JavaScript
/**
* WordPress dependencies
*/
import { __ } from '@wordpress/i18n';
import { mediaAndText as icon } from '@wordpress/icons';
/**
* Internal dependencies
*/
import initBlock from '../utils/init-block';
import deprecated from './deprecated';
import edit from './edit';
const metadata = {
$schema: "https://schemas.wp.org/trunk/block.json",
apiVersion: 2,
name: "core/media-text",
title: "Media & Text",
category: "media",
description: "Set media and words side-by-side for a richer layout.",
keywords: ["image", "video"],
textdomain: "default",
attributes: {
align: {
type: "string",
"default": "wide"
},
mediaAlt: {
type: "string",
source: "attribute",
selector: "figure img",
attribute: "alt",
"default": "",
__experimentalRole: "content"
},
mediaPosition: {
type: "string",
"default": "left"
},
mediaId: {
type: "number",
__experimentalRole: "content"
},
mediaUrl: {
type: "string",
source: "attribute",
selector: "figure video,figure img",
attribute: "src",
__experimentalRole: "content"
},
mediaLink: {
type: "string"
},
linkDestination: {
type: "string"
},
linkTarget: {
type: "string",
source: "attribute",
selector: "figure a",
attribute: "target"
},
href: {
type: "string",
source: "attribute",
selector: "figure a",
attribute: "href",
__experimentalRole: "content"
},
rel: {
type: "string",
source: "attribute",
selector: "figure a",
attribute: "rel"
},
linkClass: {
type: "string",
source: "attribute",
selector: "figure a",
attribute: "class"
},
mediaType: {
type: "string",
__experimentalRole: "content"
},
mediaWidth: {
type: "number",
"default": 50
},
mediaSizeSlug: {
type: "string"
},
isStackedOnMobile: {
type: "boolean",
"default": true
},
verticalAlignment: {
type: "string"
},
imageFill: {
type: "boolean"
},
focalPoint: {
type: "object"
}
},
supports: {
anchor: true,
align: ["wide", "full"],
html: false,
color: {
gradients: true,
link: true,
__experimentalDefaultControls: {
background: true,
text: true
}
},
spacing: {
margin: true,
padding: true
},
typography: {
fontSize: true,
lineHeight: true,
__experimentalFontFamily: true,
__experimentalFontWeight: true,
__experimentalFontStyle: true,
__experimentalTextTransform: true,
__experimentalTextDecoration: true,
__experimentalLetterSpacing: true,
__experimentalDefaultControls: {
fontSize: true
}
}
},
editorStyle: "wp-block-media-text-editor",
style: "wp-block-media-text"
};
import save from './save';
import transforms from './transforms';
const {
name
} = metadata;
export { metadata, name };
export const settings = {
icon,
example: {
viewportWidth: 601,
// Columns collapse "@media (max-width: 600px)".
attributes: {
mediaType: 'image',
mediaUrl: 'https://s.w.org/images/core/5.3/Biologia_Centrali-Americana_-_Cantorchilus_semibadius_1902.jpg'
},
innerBlocks: [{
name: 'core/paragraph',
attributes: {
content: __('The wren<br>Earns his living<br>Noiselessly.')
}
}, {
name: 'core/paragraph',
attributes: {
content: __('— Kobayashi Issa (一茶)')
}
}]
},
transforms,
edit,
save,
deprecated
};
export const init = () => initBlock({
name,
metadata,
settings
});
//# sourceMappingURL=index.js.map