1 | import _objectSpread from "@babel/runtime/helpers/esm/objectSpread";
|
2 |
|
3 |
|
4 |
|
5 |
|
6 | import { common as commonEmbeds, others as otherEmbeds } from './core-embeds';
|
7 | import { embedContentIcon } from './icons';
|
8 | import { getEmbedBlockSettings } from './settings';
|
9 |
|
10 |
|
11 |
|
12 |
|
13 | import { __, _x } from '@wordpress/i18n';
|
14 | import { createBlock } from '@wordpress/blocks';
|
15 | export var name = 'core/embed';
|
16 | export var settings = getEmbedBlockSettings({
|
17 | title: _x('Embed', 'block title'),
|
18 | description: __('Embed videos, images, tweets, audio, and other content from external sources.'),
|
19 | icon: embedContentIcon,
|
20 |
|
21 | responsive: false,
|
22 | transforms: {
|
23 | from: [{
|
24 | type: 'raw',
|
25 | isMatch: function isMatch(node) {
|
26 | return node.nodeName === 'P' && /^\s*(https?:\/\/\S+)\s*$/i.test(node.textContent);
|
27 | },
|
28 | transform: function transform(node) {
|
29 | return createBlock('core/embed', {
|
30 | url: node.textContent.trim()
|
31 | });
|
32 | }
|
33 | }]
|
34 | }
|
35 | });
|
36 | export var common = commonEmbeds.map(function (embedDefinition) {
|
37 | return _objectSpread({}, embedDefinition, {
|
38 | settings: getEmbedBlockSettings(embedDefinition.settings)
|
39 | });
|
40 | });
|
41 | export var others = otherEmbeds.map(function (embedDefinition) {
|
42 | return _objectSpread({}, embedDefinition, {
|
43 | settings: getEmbedBlockSettings(embedDefinition.settings)
|
44 | });
|
45 | });
|
46 |
|
\ | No newline at end of file |