@automattic/newspack-blocks 1.37.0 → 1.48.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.cache/babel/00255e6096be9e31ec354db849dfefaa.json.gz +0 -0
- package/.cache/babel/0265bee20d709ac92f56456637727f4b.json.gz +0 -0
- package/.cache/babel/02986ba19dc461a152ea1c45f3f36a27.json.gz +0 -0
- package/.cache/babel/06a1700c1a4a989fc7886c86bf6223f7.json.gz +0 -0
- package/.cache/babel/07169c73863508b392f15022920bd0b6.json.gz +0 -0
- package/.cache/babel/0a5083e561829e3884cb5c71388adc3f.json.gz +0 -0
- package/.cache/babel/0a713997b6e4f45849ed6a4bff79cca5.json.gz +0 -0
- package/.cache/babel/0a9506bf649ffbe854e75459cf6b8972.json.gz +0 -0
- package/.cache/babel/0c12c4398bbbf2d771b13dd1d0e64097.json.gz +0 -0
- package/.cache/babel/0f8c18da204f4cc2777ca3191f10c309.json.gz +0 -0
- package/.cache/babel/0fced15ed787cc4239bb53c1d12892e6.json.gz +0 -0
- package/.cache/babel/10faf7c74a89e9aa4d8b9528a654913e.json.gz +0 -0
- package/.cache/babel/1353b411b65a123b5dc35012db11aa1d.json.gz +0 -0
- package/.cache/babel/1729336f326db1cf54b9c1671dc5e36c.json.gz +0 -0
- package/.cache/babel/17a433ab631a32d0712f3f75cf85ea99.json.gz +0 -0
- package/.cache/babel/1948e72d907f681ff771881ad6800ee1.json.gz +0 -0
- package/.cache/babel/1ab4bf44aa14d2eb7e6911900a3b2c12.json.gz +0 -0
- package/.cache/babel/1decfd137cac87a75bd83ffbd39c9106.json.gz +0 -0
- package/.cache/babel/2143ceff6d186bc13bc902e0f1f33dbf.json.gz +0 -0
- package/.cache/babel/23c63332718e167968a7c2a8a5f730eb.json.gz +0 -0
- package/.cache/babel/24bf53676e12293cbf88d01e649fd167.json.gz +0 -0
- package/.cache/babel/26ba0bb46844575022e54a8819fbf405.json.gz +0 -0
- package/.cache/babel/281ca171ce8947f87f574df11059e00b.json.gz +0 -0
- package/.cache/babel/28700b83434e4dbfb9a20d7ec0a7e7a4.json.gz +0 -0
- package/.cache/babel/29cf8eeea8630ade027e34459f2e49ee.json.gz +0 -0
- package/.cache/babel/2b0dd254a46223a93e6259d2b797a7e7.json.gz +0 -0
- package/.cache/babel/2da6786ede3ddda4c86eeac524a6a796.json.gz +0 -0
- package/.cache/babel/2e7ce10fdee94274b48d528f94c32b34.json.gz +0 -0
- package/.cache/babel/2f93fed1706a40d82122281cc3677074.json.gz +0 -0
- package/.cache/babel/3a59b710e9745ef93148d6d74ee7d16f.json.gz +0 -0
- package/.cache/babel/3b2c440027c793c8f7978d7622cbfca0.json.gz +0 -0
- package/.cache/babel/3ca939ace4af88e266942d93837ab37a.json.gz +0 -0
- package/.cache/babel/3e671670c4d395cd1804ef4be31955e4.json.gz +0 -0
- package/.cache/babel/3e69fe002d9973c0030152a51da9477a.json.gz +0 -0
- package/.cache/babel/3f5f8ea603fd57850c6683c750fe53d8.json.gz +0 -0
- package/.cache/babel/41abaaadb68b0657a95fa0c356873def.json.gz +0 -0
- package/.cache/babel/421ac952d6b472ba18e1cb95ef65f42a.json.gz +0 -0
- package/.cache/babel/424185dd50e91d8dee5fdae43086010e.json.gz +0 -0
- package/.cache/babel/427a6423ebde76bcb488747127e47351.json.gz +0 -0
- package/.cache/babel/43e800659f23430a181fb4fc328eb6ef.json.gz +0 -0
- package/.cache/babel/469651017a2b6f3b9f63fda034974b3a.json.gz +0 -0
- package/.cache/babel/480d26447b7ee019a37e4e18422403e9.json.gz +0 -0
- package/.cache/babel/4b58fad313d90a4c1577a2766e6c924c.json.gz +0 -0
- package/.cache/babel/4d2d42fea63650192d1a3a5648b621c5.json.gz +0 -0
- package/.cache/babel/4d8c26a76e77fa64d01f30a5f2d62f85.json.gz +0 -0
- package/.cache/babel/4f606ce6656565507a74aaac8dc21eea.json.gz +0 -0
- package/.cache/babel/505f37592f4c601ccdc1581ca89d9009.json.gz +0 -0
- package/.cache/babel/50aaf34aa54b2cd3058518e42850bb62.json.gz +0 -0
- package/.cache/babel/51fbf389462feb111228ba7ec64c631d.json.gz +0 -0
- package/.cache/babel/51fc90ae5fe129a095172032f304dc2c.json.gz +0 -0
- package/.cache/babel/53dbf5484c5601528c2fd8d7fe728b78.json.gz +0 -0
- package/.cache/babel/58e4535574062eb2d8fa56d002e7190d.json.gz +0 -0
- package/.cache/babel/5aa5e8d1492938c62999de022c4b220e.json.gz +0 -0
- package/.cache/babel/5d64e475284e52c104df17e26066b17b.json.gz +0 -0
- package/.cache/babel/6333c664d69f13036f42bcf575c8e65d.json.gz +0 -0
- package/.cache/babel/635c439786b8522888342779b28ee9ee.json.gz +0 -0
- package/.cache/babel/648cffdd5ec4a2446f8935a17b98080b.json.gz +0 -0
- package/.cache/babel/64b0dd478e6f2dd51de5ee20e311aee7.json.gz +0 -0
- package/.cache/babel/6531721abbc0b3906b28b268ed7914af.json.gz +0 -0
- package/.cache/babel/66bf5585c7901a76c7d4014fa9ffed40.json.gz +0 -0
- package/.cache/babel/6ef313cb6d3a59f73a6b78e1a729fb13.json.gz +0 -0
- package/.cache/babel/6f14eed506421f15710d3dfafe3dcd93.json.gz +0 -0
- package/.cache/babel/70f6c01d8c6bc3efc41c97eaf49f7617.json.gz +0 -0
- package/.cache/babel/72321dde68f0bb9c334d90d6f4584be8.json.gz +0 -0
- package/.cache/babel/76c815fab58595f57e01af6591791d57.json.gz +0 -0
- package/.cache/babel/7c10f4d554daa8efe1e0a4457fb6d27b.json.gz +0 -0
- package/.cache/babel/7dffccddd9780ab37fb79f809947c2cd.json.gz +0 -0
- package/.cache/babel/7e5162e3319cd5d6fca6c0db0516aaeb.json.gz +0 -0
- package/.cache/babel/803192c922f7d419648bab7e1201b22e.json.gz +0 -0
- package/.cache/babel/81f3f0f896d29cdf88f8543dedb77787.json.gz +0 -0
- package/.cache/babel/84c019d3d643195fb37d08110f15f8c9.json.gz +0 -0
- package/.cache/babel/853c31db7c4351f2f36d1021c667224d.json.gz +0 -0
- package/.cache/babel/88ec99735ea4f314937736f04360ff8c.json.gz +0 -0
- package/.cache/babel/8959ab8fcfa783cb56e9418b99c0951c.json.gz +0 -0
- package/.cache/babel/8b9624d721f8706682e33fe1853c8287.json.gz +0 -0
- package/.cache/babel/8de5c373bbc4b6fbeec373d582935887.json.gz +0 -0
- package/.cache/babel/8f24517cff634d2e91c19e51be8816cc.json.gz +0 -0
- package/.cache/babel/901e1bb823eca196b594baa35a35a81c.json.gz +0 -0
- package/.cache/babel/90dbc666ff9fa3b88f305fe90a9917bf.json.gz +0 -0
- package/.cache/babel/91b62dfd9475df7a39dc08fbd43847f9.json.gz +0 -0
- package/.cache/babel/956daf27323e3b87bf8bf9bbf58881ed.json.gz +0 -0
- package/.cache/babel/959e9b81103c539a9d85ac60955451b9.json.gz +0 -0
- package/.cache/babel/963b1e44be998c4dcc6845745c377369.json.gz +0 -0
- package/.cache/babel/966b41ac1317b3e03ca1e59f7eb57e8c.json.gz +0 -0
- package/.cache/babel/969d5992cc682e3b43761ef02c10b851.json.gz +0 -0
- package/.cache/babel/99df128bb528d0f95a56b311801d14c1.json.gz +0 -0
- package/.cache/babel/9b33e7d21f3fc4955a536a033cced71b.json.gz +0 -0
- package/.cache/babel/9c5ec84f77314a621c01ad77da7ccb58.json.gz +0 -0
- package/.cache/babel/9d325af12a88623602a5f8c2fce04847.json.gz +0 -0
- package/.cache/babel/a413e4d325543836d0800684bb26ed04.json.gz +0 -0
- package/.cache/babel/a5405f86b8d1485e62a125275507e60f.json.gz +0 -0
- package/.cache/babel/a7f7461321ca6fd4360df04bb894c106.json.gz +0 -0
- package/.cache/babel/a8a6812e1c7b65cc6d0bdebe2a35c8ca.json.gz +0 -0
- package/.cache/babel/aa89cfc4c88fcc465b8d74af824e7f6b.json.gz +0 -0
- package/.cache/babel/adbaeb5ddf5612b3dcd233a3f6f17bf2.json.gz +0 -0
- package/.cache/babel/ae18cd6ec42a3366c73435b62a9f5f70.json.gz +0 -0
- package/.cache/babel/aea149ee1ec6fa3ca7839c63f5edd78d.json.gz +0 -0
- package/.cache/babel/af1b34067a69854e109c0b0e45d90e43.json.gz +0 -0
- package/.cache/babel/b3a335ab950f502914013810b43b0ad5.json.gz +0 -0
- package/.cache/babel/b6cfba15cda3404d4b1041df448ed2b2.json.gz +0 -0
- package/.cache/babel/ba711530bd319618a0510d8361bebb45.json.gz +0 -0
- package/.cache/babel/ba77e682225df6126b636458055601d9.json.gz +0 -0
- package/.cache/babel/bab8189a74eee8d72702d1510b52b3b3.json.gz +0 -0
- package/.cache/babel/bd8741020db56bb5d999252812d1d717.json.gz +0 -0
- package/.cache/babel/beaa874c5e01203d9dbe23cb89405276.json.gz +0 -0
- package/.cache/babel/c196c9b8c21953c474acdaa9029b3cbf.json.gz +0 -0
- package/.cache/babel/c1e31e6c217023eb3d3fd5d3de486ac3.json.gz +0 -0
- package/.cache/babel/c3aa996443e7f377aa423bcc03ffc617.json.gz +0 -0
- package/.cache/babel/c481eae84d69b65405a44af442dbfea7.json.gz +0 -0
- package/.cache/babel/c4a817d6c4bf6eb3687ffccc5c2df801.json.gz +0 -0
- package/.cache/babel/c8b10cf6f706fb669d6dd7564385768d.json.gz +0 -0
- package/.cache/babel/caa2f98ba4af6eba0605543f690693c6.json.gz +0 -0
- package/.cache/babel/cada4b2cecb2c1fcc48b7a7ecda54907.json.gz +0 -0
- package/.cache/babel/d1bed5404789c427c32965ac6ecad0d9.json.gz +0 -0
- package/.cache/babel/d395e8c0a9c63680f2dcf90ca0e91d4a.json.gz +0 -0
- package/.cache/babel/d4672090e0dd9a73bfb00bd770b23643.json.gz +0 -0
- package/.cache/babel/d4c81f65fe6d78cdbdcf1ef901b7ba1b.json.gz +0 -0
- package/.cache/babel/d515ddc0797ea256ff7271507737e9ce.json.gz +0 -0
- package/.cache/babel/d742848d263503f79168f1a6b8a52097.json.gz +0 -0
- package/.cache/babel/d834b41d7028519ecd0cbc8c65d33dde.json.gz +0 -0
- package/.cache/babel/d9060b9162e7caf974db0b90b6134727.json.gz +0 -0
- package/.cache/babel/d946975b9beac51a39f600461e84b1b6.json.gz +0 -0
- package/.cache/babel/daf0af780cff2270b1ae0e4b97a5a4ab.json.gz +0 -0
- package/.cache/babel/db5215643b0737dc5245972a5c25f736.json.gz +0 -0
- package/.cache/babel/dd57b8d31664b147b9f1e3f5cd18cc2a.json.gz +0 -0
- package/.cache/babel/e0c78bdaae19f15e2dd4a773e842422b.json.gz +0 -0
- package/.cache/babel/e1a2c7e4fc3afe9cc6e03d60f4e4a23d.json.gz +0 -0
- package/.cache/babel/e210ff9aa99df972b8d81c4bda70f642.json.gz +0 -0
- package/.cache/babel/e259a73f84d5b92b94e6d094719264c3.json.gz +0 -0
- package/.cache/babel/e6ce03a9908c9c4dc2c723531f1073f6.json.gz +0 -0
- package/.cache/babel/e8a1501dd8e4b3389ecdc8f722622359.json.gz +0 -0
- package/.cache/babel/eb3bb371036da362c42db50248d0b180.json.gz +0 -0
- package/.cache/babel/eb854e03c810bdb969497b2a36119bfa.json.gz +0 -0
- package/.cache/babel/ec25bb53826070b7f301e64f02355b8c.json.gz +0 -0
- package/.cache/babel/edbaca20e4a65f850c3d8321c1945718.json.gz +0 -0
- package/.cache/babel/f059f1ca9e49d5c3e655d20339860dce.json.gz +0 -0
- package/.cache/babel/f24c559fb42ef906405966598baf5f80.json.gz +0 -0
- package/.cache/babel/f2f333c3c546ad711d722d782decd450.json.gz +0 -0
- package/.cache/babel/f42c854ce8f1dc1a6e6fe7c510b033a5.json.gz +0 -0
- package/.cache/babel/f5211608f22c2e12594eafdbc4e66aa5.json.gz +0 -0
- package/.cache/babel/f645b8c88a49718cd778e3595212d4eb.json.gz +0 -0
- package/.cache/babel/f66dda5c4e4e9d04eb6b7411fcb12a65.json.gz +0 -0
- package/.cache/babel/f9d5b6f3f5438342dba75c2ce6143eef.json.gz +0 -0
- package/.cache/babel/fc9c60ee1d2e8783ba4c08db5cf97d40.json.gz +0 -0
- package/.cache/babel/fd558798cea72d04fb826468a89d72aa.json.gz +0 -0
- package/.cache/babel/fe735cbd0f6e131e28d8b6eb1f39141b.json.gz +0 -0
- package/.eslintrc.js +3 -26
- package/.nvmrc +1 -0
- package/CHANGELOG.md +422 -0
- package/babel.config.js +6 -0
- package/block-list.json +1 -1
- package/composer.json +2 -2
- package/composer.lock +446 -161
- package/dist/author-list/view.asset.php +1 -0
- package/dist/author-list/view.css +1 -0
- package/dist/author-list/view.js +1 -0
- package/dist/author-list/view.rtl.css +1 -0
- package/dist/author-profile/view.asset.php +1 -0
- package/dist/author-profile/view.css +1 -0
- package/dist/author-profile/view.js +1 -0
- package/dist/author-profile/view.rtl.css +1 -0
- package/dist/block_styles.asset.php +1 -0
- package/dist/block_styles.css +1 -0
- package/dist/block_styles.js +1 -0
- package/dist/block_styles.rtl.css +1 -0
- package/dist/carousel/view.asset.php +1 -0
- package/dist/carousel/view.css +1 -0
- package/dist/carousel/view.js +1 -0
- package/dist/carousel/view.rtl.css +1 -0
- package/dist/donate/view.asset.php +1 -0
- package/dist/donate/view.css +1 -0
- package/dist/donate/view.js +1 -0
- package/dist/donate/view.rtl.css +1 -0
- package/dist/donateStreamlined.asset.php +1 -0
- package/dist/donateStreamlined.css +1 -0
- package/dist/donateStreamlined.js +1 -0
- package/dist/donateStreamlined.rtl.css +1 -0
- package/dist/editor.asset.php +1 -0
- package/dist/editor.css +1 -0
- package/dist/editor.js +41 -0
- package/dist/editor.rtl.css +1 -0
- package/dist/homepage-articles/view.asset.php +1 -0
- package/dist/homepage-articles/view.css +1 -0
- package/dist/homepage-articles/view.js +1 -0
- package/dist/homepage-articles/view.rtl.css +1 -0
- package/dist/iframe/view.asset.php +1 -0
- package/dist/iframe/view.css +1 -0
- package/dist/iframe/view.js +1 -0
- package/dist/iframe/view.rtl.css +1 -0
- package/includes/class-newspack-blocks-api.php +14 -69
- package/includes/class-newspack-blocks-patterns.php +4 -1
- package/includes/class-newspack-blocks.php +421 -95
- package/newspack-blocks.php +26 -2
- package/package.json +31 -129
- package/postcss.config.js +11 -0
- package/src/block-patterns/subscribe-2.php +1 -1
- package/src/block-patterns/subscribe-3.php +1 -1
- package/src/block-patterns/subscribe-7.php +12 -0
- package/src/block-patterns/subscribe-8.php +12 -0
- package/src/block-patterns/subscribe-9.php +12 -0
- package/src/block-styles/core/columns/editor.scss +5 -8
- package/src/block-styles/core/columns/view.scss +83 -42
- package/src/blocks/author-list/block.json +82 -0
- package/src/blocks/author-list/class-wp-rest-newspack-author-list-controller.php +387 -0
- package/src/blocks/author-list/edit.js +527 -0
- package/src/blocks/author-list/editor.js +7 -0
- package/src/blocks/author-list/editor.scss +1 -0
- package/src/blocks/author-list/index.js +45 -0
- package/src/blocks/author-list/view.js +5 -0
- package/src/blocks/author-list/view.php +175 -0
- package/src/blocks/author-list/view.scss +46 -0
- package/src/blocks/author-profile/block.json +8 -0
- package/src/blocks/author-profile/class-wp-rest-newspack-authors-controller.php +69 -14
- package/src/blocks/author-profile/edit.js +212 -189
- package/src/blocks/author-profile/editor.scss +1 -1
- package/src/blocks/author-profile/single-author.js +100 -0
- package/src/blocks/author-profile/view.php +38 -92
- package/src/blocks/author-profile/view.scss +120 -1
- package/src/blocks/carousel/create-swiper.js +14 -5
- package/src/blocks/carousel/edit.js +4 -2
- package/src/blocks/carousel/editor.scss +3 -12
- package/src/blocks/carousel/view.js +1 -1
- package/src/blocks/carousel/view.php +9 -5
- package/src/blocks/carousel/view.scss +29 -3
- package/src/blocks/donate/class-wp-rest-newspack-donate-controller.php +22 -24
- package/src/blocks/donate/edit.js +49 -42
- package/src/blocks/donate/editor.scss +27 -3
- package/src/blocks/donate/index.js +31 -4
- package/src/blocks/donate/streamlined/index.js +248 -0
- package/src/blocks/donate/streamlined/index.test.js +125 -0
- package/src/blocks/donate/streamlined/style.scss +324 -0
- package/src/blocks/donate/streamlined/utils.js +174 -0
- package/src/blocks/donate/streamlined/utils.test.js +18 -0
- package/src/blocks/donate/view.php +77 -36
- package/src/blocks/donate/view.scss +291 -0
- package/src/blocks/homepage-articles/block.json +8 -0
- package/src/blocks/homepage-articles/class-wp-rest-newspack-articles-controller.php +24 -78
- package/src/blocks/homepage-articles/edit.js +26 -0
- package/src/blocks/homepage-articles/store.js +11 -1
- package/src/blocks/homepage-articles/templates/article.php +31 -3
- package/src/blocks/homepage-articles/templates/articles-loop.php +6 -5
- package/src/blocks/homepage-articles/utils.js +11 -10
- package/src/blocks/homepage-articles/view.php +4 -1
- package/src/blocks/homepage-articles/view.scss +69 -24
- package/src/blocks/iframe/block.json +34 -0
- package/src/blocks/iframe/class-wp-rest-newspack-iframe-controller.php +345 -0
- package/src/blocks/iframe/edit.js +252 -0
- package/src/blocks/iframe/editor.js +7 -0
- package/src/blocks/iframe/editor.scss +84 -0
- package/src/blocks/iframe/icons.js +10 -0
- package/src/blocks/iframe/iframe-placeholder.js +180 -0
- package/src/blocks/iframe/index.js +48 -0
- package/src/blocks/iframe/view.js +5 -0
- package/src/blocks/iframe/view.php +130 -0
- package/src/blocks/iframe/view.scss +9 -0
- package/src/blocks/video-playlist/view.php +4 -3
- package/src/components/query-controls.js +5 -4
- package/src/setup/editor.js +0 -1
- package/src/shared/js/utils.js +1 -1
- package/src/templates/author-profile-card.php +99 -0
- package/vendor/autoload.php +7 -0
- package/vendor/composer/ClassLoader.php +572 -0
- package/vendor/composer/InstalledVersions.php +350 -0
- package/vendor/composer/LICENSE +21 -0
- package/vendor/composer/autoload_classmap.php +10 -0
- package/vendor/composer/autoload_namespaces.php +9 -0
- package/vendor/composer/autoload_psr4.php +9 -0
- package/vendor/composer/autoload_real.php +55 -0
- package/vendor/composer/autoload_static.php +20 -0
- package/vendor/composer/installed.json +5 -0
- package/vendor/composer/installed.php +23 -0
- package/webpack.config.js +2 -3
- package/.circleci/config.yml +0 -96
- package/.distignore +0 -36
- package/.editorconfig +0 -22
- package/.github/ISSUE_TEMPLATE/Bug_report.md +0 -21
- package/.github/ISSUE_TEMPLATE/Enhancement.md +0 -17
- package/.github/ISSUE_TEMPLATE/Feature_request.md +0 -17
- package/.github/PULL_REQUEST_TEMPLATE.md +0 -29
- package/.github/workflows/main.yml +0 -15
- package/.phpcs.xml.dist +0 -55
- package/.prettierrc +0 -10
- package/.stylelintrc +0 -21
- package/.travis.yml +0 -67
- package/phpunit.xml.dist +0 -16
- package/src/blocks/author-profile/shared.scss +0 -95
- package/src/blocks/donate/streamlined.js +0 -180
- package/src/blocks/donate/streamlined.scss +0 -124
- package/src/setup/public-path.js +0 -13
- package/src/setup/view.js +0 -4
- package/tests/bootstrap.php +0 -31
- package/tests/test-sample.php +0 -20
|
@@ -0,0 +1,252 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { Fragment, useState } from '@wordpress/element';
|
|
5
|
+
import { InspectorControls, BlockControls } from '@wordpress/block-editor';
|
|
6
|
+
import {
|
|
7
|
+
PanelBody,
|
|
8
|
+
Path,
|
|
9
|
+
ToggleControl,
|
|
10
|
+
Toolbar,
|
|
11
|
+
FocusableIframe,
|
|
12
|
+
Notice,
|
|
13
|
+
SVG,
|
|
14
|
+
// eslint-disable-next-line @wordpress/no-unsafe-wp-apis
|
|
15
|
+
__experimentalUnitControl as UnitControl,
|
|
16
|
+
} from '@wordpress/components';
|
|
17
|
+
import { __ } from '@wordpress/i18n';
|
|
18
|
+
import { Icon } from '@wordpress/icons';
|
|
19
|
+
import apiFetch from '@wordpress/api-fetch';
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Internal dependencies
|
|
23
|
+
*/
|
|
24
|
+
import IframePlaceholder from './iframe-placeholder';
|
|
25
|
+
import { iframeIcon } from './icons';
|
|
26
|
+
|
|
27
|
+
const iconPreview = (
|
|
28
|
+
<SVG xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 0 24 24" width="24">
|
|
29
|
+
<Path d="M12 18.8c-4.8 0-8.5-6.1-8.6-6.4l-.3-.4.2-.4c.2-.3 3.9-6.4 8.6-6.4 4.7 0 8.5 6.1 8.6 6.4l.2.4-.2.4c0 .2-3.7 6.4-8.5 6.4zM4.9 12c.9 1.3 3.8 5.2 7.1 5.2s6.3-4 7.1-5.2c-.9-1.3-3.8-5.3-7.1-5.3-3.3.1-6.3 4-7.1 5.3z" />
|
|
30
|
+
<Path d="M15 11.2c-.3.5-.8.8-1.4.8-.9 0-1.6-.7-1.6-1.6 0-.5.3-1 .7-1.3-.2 0-.5-.1-.7-.1-1.7 0-3.2 1.4-3.2 3.2s1.4 3.2 3.2 3.2c1.7 0 3.2-1.4 3.2-3.2 0-.3-.1-.7-.2-1z" />
|
|
31
|
+
</SVG>
|
|
32
|
+
);
|
|
33
|
+
|
|
34
|
+
const IframeEdit = ( { attributes, setAttributes } ) => {
|
|
35
|
+
const label = __( 'Iframe', 'block title' );
|
|
36
|
+
const { mode, src, archiveFolder, isFullScreen, height, width } = attributes;
|
|
37
|
+
const [ showPreview, setShowPreview ] = useState( true );
|
|
38
|
+
const [ isUploadingArchive, setIsUploadingArchive ] = useState();
|
|
39
|
+
const [ error, setError ] = useState();
|
|
40
|
+
|
|
41
|
+
const sizeUnits = [
|
|
42
|
+
{ value: 'px', label: 'px' },
|
|
43
|
+
{ value: '%', label: '%' },
|
|
44
|
+
{ value: 'em', label: 'em' },
|
|
45
|
+
];
|
|
46
|
+
|
|
47
|
+
const embedURL = async url => {
|
|
48
|
+
setError( null );
|
|
49
|
+
setIsUploadingArchive( true );
|
|
50
|
+
|
|
51
|
+
try {
|
|
52
|
+
const formData = new FormData();
|
|
53
|
+
formData.append( 'iframe_url', url );
|
|
54
|
+
|
|
55
|
+
const { mode: iframeMode } = await apiFetch( {
|
|
56
|
+
path: '/newspack-blocks/v1/newspack-blocks-iframe-mode-from-url',
|
|
57
|
+
method: 'POST',
|
|
58
|
+
body: formData,
|
|
59
|
+
} );
|
|
60
|
+
|
|
61
|
+
setAttributes( {
|
|
62
|
+
mode: iframeMode,
|
|
63
|
+
src: url,
|
|
64
|
+
} );
|
|
65
|
+
setShowPreview( true );
|
|
66
|
+
|
|
67
|
+
// remove current archive folder if exists.
|
|
68
|
+
if ( archiveFolder ) {
|
|
69
|
+
deleteIframeArchive();
|
|
70
|
+
}
|
|
71
|
+
} catch ( e ) {
|
|
72
|
+
setError(
|
|
73
|
+
e.message || __( 'An error occured when uploading the iframe archive.', 'newspack-blocks' )
|
|
74
|
+
);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
setIsUploadingArchive( false );
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
const uploadIframeArchive = async archiveFile => {
|
|
81
|
+
setError( null );
|
|
82
|
+
setIsUploadingArchive( true );
|
|
83
|
+
|
|
84
|
+
try {
|
|
85
|
+
const formData = new FormData();
|
|
86
|
+
formData.append( 'archive_folder', archiveFolder );
|
|
87
|
+
formData.append( 'iframe_file', archiveFile );
|
|
88
|
+
|
|
89
|
+
const { src: iframeArchiveSrc, dir: iframeArchiveFolder, mode: iframeMode } = await apiFetch(
|
|
90
|
+
{
|
|
91
|
+
path: '/newspack-blocks/v1/newspack-blocks-iframe-archive',
|
|
92
|
+
method: 'POST',
|
|
93
|
+
body: formData,
|
|
94
|
+
}
|
|
95
|
+
);
|
|
96
|
+
|
|
97
|
+
setAttributes( {
|
|
98
|
+
mode: iframeMode,
|
|
99
|
+
src: iframeArchiveSrc,
|
|
100
|
+
archiveFolder: iframeArchiveFolder,
|
|
101
|
+
} );
|
|
102
|
+
setShowPreview( true );
|
|
103
|
+
} catch ( e ) {
|
|
104
|
+
setError(
|
|
105
|
+
e.message || __( 'An error occured when uploading the iframe archive.', 'newspack-blocks' )
|
|
106
|
+
);
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
setIsUploadingArchive( false );
|
|
110
|
+
};
|
|
111
|
+
|
|
112
|
+
const setIframeArchiveFromMedia = async mediaId => {
|
|
113
|
+
setError( null );
|
|
114
|
+
setIsUploadingArchive( true );
|
|
115
|
+
|
|
116
|
+
try {
|
|
117
|
+
const formData = new FormData();
|
|
118
|
+
formData.append( 'media_id', mediaId );
|
|
119
|
+
|
|
120
|
+
const { src: iframeArchiveSrc, dir: iframeArchiveFolder, mode: iframeMode } = await apiFetch(
|
|
121
|
+
{
|
|
122
|
+
path: '/newspack-blocks/v1/newspack-blocks-iframe-archive-from-media',
|
|
123
|
+
method: 'POST',
|
|
124
|
+
body: formData,
|
|
125
|
+
}
|
|
126
|
+
);
|
|
127
|
+
|
|
128
|
+
setAttributes( {
|
|
129
|
+
mode: iframeMode,
|
|
130
|
+
src: iframeArchiveSrc,
|
|
131
|
+
archiveFolder: iframeArchiveFolder,
|
|
132
|
+
} );
|
|
133
|
+
setShowPreview( true );
|
|
134
|
+
} catch ( e ) {
|
|
135
|
+
setError(
|
|
136
|
+
e.message ||
|
|
137
|
+
__(
|
|
138
|
+
'An error occured when setting the iframe from the archive media.',
|
|
139
|
+
'newspack-blocks'
|
|
140
|
+
)
|
|
141
|
+
);
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
setIsUploadingArchive( false );
|
|
145
|
+
};
|
|
146
|
+
|
|
147
|
+
const deleteIframeArchive = () => {
|
|
148
|
+
// Do not remove archive if it's used (if a user clicks on embed after uploading the archive.)
|
|
149
|
+
if ( src && archiveFolder && ! src.includes( archiveFolder ) ) {
|
|
150
|
+
apiFetch( {
|
|
151
|
+
path: '/newspack-blocks/v1/newspack-blocks-remove-iframe-archive',
|
|
152
|
+
method: 'DELETE',
|
|
153
|
+
body: JSON.stringify( { archive_folder: archiveFolder } ),
|
|
154
|
+
} );
|
|
155
|
+
}
|
|
156
|
+
};
|
|
157
|
+
|
|
158
|
+
const iframeControls = [
|
|
159
|
+
{
|
|
160
|
+
icon: <Icon icon={ iconPreview } />,
|
|
161
|
+
title: showPreview
|
|
162
|
+
? __( 'Hide iframe preview', 'newspack-blocks' )
|
|
163
|
+
: __( 'Show iframe preview', 'newspack-blocks' ),
|
|
164
|
+
onClick: () => setShowPreview( ! showPreview ),
|
|
165
|
+
isActive: showPreview,
|
|
166
|
+
},
|
|
167
|
+
];
|
|
168
|
+
|
|
169
|
+
return (
|
|
170
|
+
<Fragment>
|
|
171
|
+
{ isFullScreen && (
|
|
172
|
+
<Notice
|
|
173
|
+
status="warning"
|
|
174
|
+
className="wp-block-newspack-blocks-iframe-notice"
|
|
175
|
+
isDismissible={ false }
|
|
176
|
+
>
|
|
177
|
+
{ __( 'This block will take over the page content.', 'newspack-blocks' ) }
|
|
178
|
+
</Notice>
|
|
179
|
+
) }
|
|
180
|
+
{ src && showPreview ? (
|
|
181
|
+
<div className="iframe-container">
|
|
182
|
+
<FocusableIframe
|
|
183
|
+
title={ __( 'Newspack embedded iframe', 'newspack-blocks' ) }
|
|
184
|
+
src={
|
|
185
|
+
'document' === mode
|
|
186
|
+
? `https://docs.google.com/gview?embedded=true&url=${ encodeURIComponent( src ) }`
|
|
187
|
+
: src
|
|
188
|
+
}
|
|
189
|
+
style={ {
|
|
190
|
+
width: isFullScreen ? '100vw' : width,
|
|
191
|
+
height: isFullScreen ? '100vh' : height,
|
|
192
|
+
'max-width': '100%',
|
|
193
|
+
'max-height': '100%',
|
|
194
|
+
} }
|
|
195
|
+
></FocusableIframe>
|
|
196
|
+
</div>
|
|
197
|
+
) : (
|
|
198
|
+
<IframePlaceholder
|
|
199
|
+
icon={ iframeIcon }
|
|
200
|
+
label={ label }
|
|
201
|
+
src={ src }
|
|
202
|
+
onSelectURL={ embedURL }
|
|
203
|
+
onSelectMedia={ setIframeArchiveFromMedia }
|
|
204
|
+
isUploadingArchive={ isUploadingArchive }
|
|
205
|
+
archiveFolder={ archiveFolder }
|
|
206
|
+
uploadIframeArchive={ uploadIframeArchive }
|
|
207
|
+
error={ error }
|
|
208
|
+
/>
|
|
209
|
+
) }
|
|
210
|
+
|
|
211
|
+
<BlockControls>
|
|
212
|
+
<Toolbar controls={ src && iframeControls } />
|
|
213
|
+
</BlockControls>
|
|
214
|
+
|
|
215
|
+
<InspectorControls>
|
|
216
|
+
<PanelBody title={ __( 'Iframe Settings', 'newspack-blocks' ) } initialOpen={ true }>
|
|
217
|
+
<Fragment>
|
|
218
|
+
<ToggleControl
|
|
219
|
+
label={ __( 'Fullscreen', 'newspack-blocks' ) }
|
|
220
|
+
help={ __(
|
|
221
|
+
'If enabled, the iframe will be full screen and hide all the post content.',
|
|
222
|
+
'newspack-blocks'
|
|
223
|
+
) }
|
|
224
|
+
checked={ isFullScreen }
|
|
225
|
+
onChange={ _isFullScreen => setAttributes( { isFullScreen: _isFullScreen } ) }
|
|
226
|
+
required
|
|
227
|
+
/>
|
|
228
|
+
|
|
229
|
+
{ ! isFullScreen && (
|
|
230
|
+
<div className="wp-block-newspack-blocks-iframe__unit-control">
|
|
231
|
+
<UnitControl
|
|
232
|
+
label={ __( 'Width', 'newspack-blocks' ) }
|
|
233
|
+
onChange={ _width => setAttributes( { width: _width } ) }
|
|
234
|
+
value={ width }
|
|
235
|
+
units={ sizeUnits }
|
|
236
|
+
/>
|
|
237
|
+
<UnitControl
|
|
238
|
+
label={ __( 'Height', 'newspack-blocks' ) }
|
|
239
|
+
onChange={ _height => setAttributes( { height: _height } ) }
|
|
240
|
+
value={ height }
|
|
241
|
+
units={ sizeUnits }
|
|
242
|
+
/>
|
|
243
|
+
</div>
|
|
244
|
+
) }
|
|
245
|
+
</Fragment>
|
|
246
|
+
</PanelBody>
|
|
247
|
+
</InspectorControls>
|
|
248
|
+
</Fragment>
|
|
249
|
+
);
|
|
250
|
+
};
|
|
251
|
+
|
|
252
|
+
export default IframeEdit;
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
@import '../../shared/sass/variables';
|
|
2
|
+
@import '../../shared/sass/mixins';
|
|
3
|
+
|
|
4
|
+
.editor-styles-wrapper {
|
|
5
|
+
.components-form-file-upload {
|
|
6
|
+
display: flex;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.wp-block-newspack-blocks-iframe-notice {
|
|
10
|
+
margin: 0;
|
|
11
|
+
width: 100%;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.wp-block-newspack-blocks-iframe {
|
|
15
|
+
.wp-block-newspack-blocks-iframe__input {
|
|
16
|
+
border-radius: 2px;
|
|
17
|
+
margin: 0 8px 0 0;
|
|
18
|
+
flex: 1 1 auto;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.components-placeholder__fieldset {
|
|
22
|
+
> * {
|
|
23
|
+
width: 100%;
|
|
24
|
+
margin-bottom: 1.5rem;
|
|
25
|
+
|
|
26
|
+
&:last-child {
|
|
27
|
+
margin-bottom: 0;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.wp-block-newspack-blocks-iframe__url-input-container {
|
|
35
|
+
.wp-block-newspack-blocks-iframe__button {
|
|
36
|
+
margin-bottom: 0;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.wp-block-newspack-blocks-iframe__url-input-form {
|
|
41
|
+
display: flex;
|
|
42
|
+
|
|
43
|
+
input[type='url'].wp-block-newspack-blocks-iframe__url-input-form__url-input-field {
|
|
44
|
+
width: 100%;
|
|
45
|
+
min-width: 200px;
|
|
46
|
+
|
|
47
|
+
@include media( tablet ) {
|
|
48
|
+
width: 300px;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
flex-grow: 1;
|
|
52
|
+
border: none;
|
|
53
|
+
border-radius: 0;
|
|
54
|
+
margin: 2px;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
.wp-block-newspack-blocks-iframe__url-input-form__url-input-submit-button {
|
|
59
|
+
flex-shrink: 1;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
.wp-block-newspack-blocks-iframe__button {
|
|
63
|
+
margin-bottom: 0.5rem;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
.wp-block-newspack-blocks-iframe__cancel-button.is-link {
|
|
67
|
+
margin: 1em;
|
|
68
|
+
display: block;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
.wp-block-newspack-blocks-iframe.is-appender {
|
|
72
|
+
min-height: 0;
|
|
73
|
+
|
|
74
|
+
&:hover {
|
|
75
|
+
cursor: pointer;
|
|
76
|
+
box-shadow: 0 0 0 1px var( --wp-admin-theme-color );
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
.wp-block-newspack-blocks-iframe__unit-control {
|
|
81
|
+
display: grid;
|
|
82
|
+
grid-template-columns: repeat( 2, 1fr );
|
|
83
|
+
grid-gap: 1em;
|
|
84
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { Path, SVG } from '@wordpress/components';
|
|
5
|
+
|
|
6
|
+
export const iframeIcon = (
|
|
7
|
+
<SVG viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
|
|
8
|
+
<Path d="M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm.5 16c0 .3-.2.5-.5.5H5c-.3 0-.5-.2-.5-.5V9.8l4.7-5.3H19c.3 0 .5.2.5.5v14zm-6-9.5L16 12l-2.5 2.8 1.1 1L18 12l-3.5-3.5-1 1zm-3 0l-1-1L6 12l3.5 3.8 1.1-1L8 12l2.5-2.5z" />
|
|
9
|
+
</SVG>
|
|
10
|
+
);
|
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { useState } from '@wordpress/element';
|
|
5
|
+
import { __ } from '@wordpress/i18n';
|
|
6
|
+
import { Button, Placeholder, FormFileUpload, Spinner, Notice } from '@wordpress/components';
|
|
7
|
+
import { BlockIcon, URLPopover, MediaUpload } from '@wordpress/block-editor';
|
|
8
|
+
import { keyboardReturn } from '@wordpress/icons';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* External dependencies
|
|
12
|
+
*/
|
|
13
|
+
import classnames from 'classnames';
|
|
14
|
+
|
|
15
|
+
const allowedTypes = window.newspack_blocks_data?.iframe_accepted_file_mimes || [];
|
|
16
|
+
|
|
17
|
+
const InsertFromURLPopover = ( { src, onChange, onSubmit, onClose } ) => (
|
|
18
|
+
<URLPopover onClose={ onClose }>
|
|
19
|
+
<form className="wp-block-newspack-blocks-iframe__url-input-form" onSubmit={ onSubmit }>
|
|
20
|
+
<input
|
|
21
|
+
className="wp-block-newspack-blocks-iframe__url-input-form__url-input-field"
|
|
22
|
+
type="url"
|
|
23
|
+
aria-label={ __( 'URL' ) }
|
|
24
|
+
placeholder={ __( 'Paste or type URL' ) }
|
|
25
|
+
onChange={ onChange }
|
|
26
|
+
value={ src }
|
|
27
|
+
/>
|
|
28
|
+
<Button
|
|
29
|
+
className="wp-block-newspack-blocks-iframe__url-input-form__url-input-submit-button"
|
|
30
|
+
icon={ keyboardReturn }
|
|
31
|
+
label={ __( 'Apply' ) }
|
|
32
|
+
type="submit"
|
|
33
|
+
/>
|
|
34
|
+
</form>
|
|
35
|
+
</URLPopover>
|
|
36
|
+
);
|
|
37
|
+
|
|
38
|
+
const IframePlaceholder = ( {
|
|
39
|
+
icon,
|
|
40
|
+
label,
|
|
41
|
+
src,
|
|
42
|
+
onSelectURL,
|
|
43
|
+
onSelectMedia,
|
|
44
|
+
isUploadingArchive,
|
|
45
|
+
archiveFolder,
|
|
46
|
+
uploadIframeArchive,
|
|
47
|
+
error,
|
|
48
|
+
} ) => {
|
|
49
|
+
const [ isURLInputVisible, setIsURLInputVisible ] = useState( false );
|
|
50
|
+
const [ urlFieldValue, setUrlFieldValue ] = useState( src );
|
|
51
|
+
|
|
52
|
+
// URL text field
|
|
53
|
+
const onChangeUrlField = event => {
|
|
54
|
+
setUrlFieldValue( event.target.value );
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
const openURLInput = () => {
|
|
58
|
+
setIsURLInputVisible( true );
|
|
59
|
+
};
|
|
60
|
+
const closeURLInput = () => {
|
|
61
|
+
setIsURLInputVisible( false );
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
const onSubmitSrc = event => {
|
|
65
|
+
event.preventDefault();
|
|
66
|
+
if ( urlFieldValue && onSelectURL ) {
|
|
67
|
+
onSelectURL( urlFieldValue );
|
|
68
|
+
closeURLInput();
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
const onSelectImage = media => {
|
|
73
|
+
onSelectMedia( media.id );
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
// Uploader
|
|
77
|
+
const onUpload = event => {
|
|
78
|
+
const files = event.target.files;
|
|
79
|
+
if ( 0 < files.length ) {
|
|
80
|
+
uploadIframeArchive( files.item( 0 ) );
|
|
81
|
+
}
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
const renderMediaLibraryButton = onSelect => {
|
|
85
|
+
return (
|
|
86
|
+
<MediaUpload
|
|
87
|
+
onSelect={ onSelect }
|
|
88
|
+
allowedTypes={ allowedTypes }
|
|
89
|
+
render={ ( { open } ) => {
|
|
90
|
+
return (
|
|
91
|
+
<Button variant="tertiary" onClick={ open }>
|
|
92
|
+
{ __( 'Media Library', 'newspack-blocks' ) }
|
|
93
|
+
</Button>
|
|
94
|
+
);
|
|
95
|
+
} }
|
|
96
|
+
/>
|
|
97
|
+
);
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
const renderUrlSelectionUI = isUpdate => {
|
|
101
|
+
return (
|
|
102
|
+
onSelectURL && (
|
|
103
|
+
<div className="wp-block-newspack-blocks-iframe__url-input-container">
|
|
104
|
+
<Button
|
|
105
|
+
isTertiary
|
|
106
|
+
onClick={ openURLInput }
|
|
107
|
+
isPressed={ isURLInputVisible }
|
|
108
|
+
variant="tertiary"
|
|
109
|
+
>
|
|
110
|
+
{ isUpdate
|
|
111
|
+
? __( 'Update from URL', 'newspack-blocks' )
|
|
112
|
+
: __( 'Embed from URL', 'newspack-blocks' ) }
|
|
113
|
+
</Button>
|
|
114
|
+
{ isURLInputVisible && (
|
|
115
|
+
<InsertFromURLPopover
|
|
116
|
+
src={ urlFieldValue }
|
|
117
|
+
onChange={ onChangeUrlField }
|
|
118
|
+
onSubmit={ onSubmitSrc }
|
|
119
|
+
onClose={ closeURLInput }
|
|
120
|
+
/>
|
|
121
|
+
) }
|
|
122
|
+
</div>
|
|
123
|
+
)
|
|
124
|
+
);
|
|
125
|
+
};
|
|
126
|
+
|
|
127
|
+
return (
|
|
128
|
+
<Placeholder
|
|
129
|
+
icon={ <BlockIcon icon={ icon } showColors /> }
|
|
130
|
+
label={ label }
|
|
131
|
+
className="wp-block-newspack-blocks-iframe"
|
|
132
|
+
instructions={ __(
|
|
133
|
+
'Upload an asset folder (.zip), a document (PDF, Word, Excel sheet, or a PPT), pick one from your media library, or add one with a URL.',
|
|
134
|
+
'newspack-blocks'
|
|
135
|
+
) }
|
|
136
|
+
>
|
|
137
|
+
{ error && (
|
|
138
|
+
<Notice
|
|
139
|
+
status="error"
|
|
140
|
+
className="wp-block-newspack-blocks-iframe-notice"
|
|
141
|
+
isDismissible={ false }
|
|
142
|
+
>
|
|
143
|
+
{ error }
|
|
144
|
+
</Notice>
|
|
145
|
+
) }
|
|
146
|
+
|
|
147
|
+
<div>
|
|
148
|
+
{ isUploadingArchive ? (
|
|
149
|
+
<Spinner />
|
|
150
|
+
) : (
|
|
151
|
+
<FormFileUpload
|
|
152
|
+
accept={ allowedTypes.join( ',' ) }
|
|
153
|
+
onChange={ onUpload }
|
|
154
|
+
multiple={ false }
|
|
155
|
+
render={ ( { openFileDialog } ) => (
|
|
156
|
+
<>
|
|
157
|
+
<Button
|
|
158
|
+
isPrimary
|
|
159
|
+
className={ classnames(
|
|
160
|
+
'wp-block-newspack-blocks-iframe__button',
|
|
161
|
+
'wp-block-newspack-blocks-iframe__upload-button'
|
|
162
|
+
) }
|
|
163
|
+
onClick={ openFileDialog }
|
|
164
|
+
>
|
|
165
|
+
{ archiveFolder
|
|
166
|
+
? __( 'Update', 'newspack-blocks' )
|
|
167
|
+
: __( 'Upload', 'newspack-blocks' ) }
|
|
168
|
+
</Button>
|
|
169
|
+
{ renderMediaLibraryButton( onSelectImage ) }
|
|
170
|
+
{ renderUrlSelectionUI( '' !== archiveFolder ) }
|
|
171
|
+
</>
|
|
172
|
+
) }
|
|
173
|
+
/>
|
|
174
|
+
) }
|
|
175
|
+
</div>
|
|
176
|
+
</Placeholder>
|
|
177
|
+
);
|
|
178
|
+
};
|
|
179
|
+
|
|
180
|
+
export default IframePlaceholder;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { ExternalLink } from '@wordpress/components';
|
|
5
|
+
import { __ } from '@wordpress/i18n';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Internal dependencies
|
|
9
|
+
*/
|
|
10
|
+
import edit from './edit';
|
|
11
|
+
import metadata from './block.json';
|
|
12
|
+
const { name, attributes, category } = metadata;
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Style dependencies - will load in editor
|
|
16
|
+
*/
|
|
17
|
+
import './editor.scss';
|
|
18
|
+
import { iframeIcon } from './icons';
|
|
19
|
+
|
|
20
|
+
export const title = __( 'Iframe', 'newspack-blocks' );
|
|
21
|
+
|
|
22
|
+
// Name must be exported separately.
|
|
23
|
+
export { name };
|
|
24
|
+
|
|
25
|
+
export const settings = {
|
|
26
|
+
title,
|
|
27
|
+
icon: {
|
|
28
|
+
src: iframeIcon,
|
|
29
|
+
foreground: '#36f',
|
|
30
|
+
},
|
|
31
|
+
category,
|
|
32
|
+
keywords: [ __( 'iframe', 'newspack-blocks' ), __( 'project iframe', 'newspack-blocks' ) ],
|
|
33
|
+
description: (
|
|
34
|
+
<>
|
|
35
|
+
<p>{ __( 'Embed an iframe.', 'newspack-blocks' ) }</p>
|
|
36
|
+
<ExternalLink href={ __( 'https://newspack.pub/support/blocks/iframe-block/' ) }>
|
|
37
|
+
{ __( 'Support reference', 'newspack-blocks' ) }
|
|
38
|
+
</ExternalLink>
|
|
39
|
+
</>
|
|
40
|
+
),
|
|
41
|
+
attributes,
|
|
42
|
+
supports: {
|
|
43
|
+
html: false,
|
|
44
|
+
align: [ 'wide', 'full' ],
|
|
45
|
+
},
|
|
46
|
+
edit,
|
|
47
|
+
save: () => null, // to use view.php
|
|
48
|
+
};
|