@wordpress/block-library 7.1.1 → 7.2.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/CHANGELOG.md +11 -0
- package/build/avatar/edit.js +205 -0
- package/build/avatar/edit.js.map +1 -0
- package/build/avatar/hooks.js +111 -0
- package/build/avatar/hooks.js.map +1 -0
- package/build/avatar/index.js +83 -0
- package/build/avatar/index.js.map +1 -0
- package/build/avatar/user-control.js +63 -0
- package/build/avatar/user-control.js.map +1 -0
- package/build/column/index.js +2 -1
- package/build/column/index.js.map +1 -1
- package/build/comment-author-avatar/index.js +1 -0
- package/build/comment-author-avatar/index.js.map +1 -1
- package/build/comment-date/edit.js +10 -25
- package/build/comment-date/edit.js.map +1 -1
- package/build/comment-template/edit.js +79 -52
- package/build/comment-template/edit.js.map +1 -1
- package/build/cover/edit.js +23 -33
- package/build/cover/edit.js.map +1 -1
- package/build/embed/variations.js +2 -2
- package/build/embed/variations.js.map +1 -1
- package/build/gallery/edit.js +18 -5
- package/build/gallery/edit.js.map +1 -1
- package/build/gallery/gallery.js +1 -1
- package/build/gallery/gallery.js.map +1 -1
- package/build/gallery/gap-styles.js +29 -0
- package/build/gallery/gap-styles.js.map +1 -0
- package/build/gallery/index.js +17 -1
- package/build/gallery/index.js.map +1 -1
- package/build/group/index.js +3 -1
- package/build/group/index.js.map +1 -1
- package/build/group/variations.js +1 -2
- package/build/group/variations.js.map +1 -1
- package/build/image/image.js +3 -1
- package/build/image/image.js.map +1 -1
- package/build/index.js +8 -2
- package/build/index.js.map +1 -1
- package/build/list/index.js +5 -7
- package/build/list/index.js.map +1 -1
- package/build/list/v2/edit.js +85 -0
- package/build/list/v2/edit.js.map +1 -0
- package/build/list/v2/index.js +33 -0
- package/build/list/v2/index.js.map +1 -0
- package/build/list/v2/save.js +34 -0
- package/build/list/v2/save.js.map +1 -0
- package/build/list/v2/transforms.js +121 -0
- package/build/list/v2/transforms.js.map +1 -0
- package/build/list-item/edit.js +47 -0
- package/build/list-item/edit.js.map +1 -0
- package/build/list-item/index.js +67 -0
- package/build/list-item/index.js.map +1 -0
- package/build/list-item/save.js +23 -0
- package/build/list-item/save.js.map +1 -0
- package/build/media-text/edit.js +3 -1
- package/build/media-text/edit.js.map +1 -1
- package/build/navigation/use-navigation-entities.js +26 -54
- package/build/navigation/use-navigation-entities.js.map +1 -1
- package/build/navigation-link/edit.js +88 -34
- package/build/navigation-link/edit.js.map +1 -1
- package/build/post-date/edit.js +31 -37
- package/build/post-date/edit.js.map +1 -1
- package/build/post-featured-image/edit.js +2 -1
- package/build/post-featured-image/edit.js.map +1 -1
- package/build/pullquote/edit.js +5 -3
- package/build/pullquote/edit.js.map +1 -1
- package/build/query/variations.js +4 -4
- package/build/query/variations.js.map +1 -1
- package/build/query-no-results/edit.js +28 -0
- package/build/query-no-results/edit.js.map +1 -0
- package/build/query-no-results/index.js +54 -0
- package/build/query-no-results/index.js.map +1 -0
- package/build/query-no-results/save.js +18 -0
- package/build/query-no-results/save.js.map +1 -0
- package/build/search/edit.js +2 -3
- package/build/search/edit.js.map +1 -1
- package/build/separator/deprecated.js +83 -0
- package/build/separator/deprecated.js.map +1 -0
- package/build/separator/edit.js +31 -23
- package/build/separator/edit.js.map +1 -1
- package/build/separator/index.js +17 -7
- package/build/separator/index.js.map +1 -1
- package/build/separator/save.js +18 -13
- package/build/separator/save.js.map +1 -1
- package/build/separator/use-deprecated-opacity.js +39 -0
- package/build/separator/use-deprecated-opacity.js.map +1 -0
- package/build/social-links/edit.js +14 -3
- package/build/social-links/edit.js.map +1 -1
- package/build/social-links/index.js +1 -1
- package/build/spacer/controls.js +6 -16
- package/build/spacer/controls.js.map +1 -1
- package/build/spacer/controls.native.js +3 -1
- package/build/spacer/controls.native.js.map +1 -1
- package/build/spacer/edit.js +4 -5
- package/build/spacer/edit.js.map +1 -1
- package/build/table/deprecated.js +1 -1
- package/build/table/deprecated.js.map +1 -1
- package/build/tag-cloud/edit.js +58 -2
- package/build/tag-cloud/edit.js.map +1 -1
- package/build/tag-cloud/index.js +8 -0
- package/build/tag-cloud/index.js.map +1 -1
- package/build-module/avatar/edit.js +190 -0
- package/build-module/avatar/edit.js.map +1 -0
- package/build-module/avatar/hooks.js +99 -0
- package/build-module/avatar/hooks.js.map +1 -0
- package/build-module/avatar/index.js +70 -0
- package/build-module/avatar/index.js.map +1 -0
- package/build-module/avatar/user-control.js +52 -0
- package/build-module/avatar/user-control.js.map +1 -0
- package/build-module/column/index.js +2 -1
- package/build-module/column/index.js.map +1 -1
- package/build-module/comment-author-avatar/index.js +1 -0
- package/build-module/comment-author-avatar/index.js.map +1 -1
- package/build-module/comment-date/edit.js +13 -30
- package/build-module/comment-date/edit.js.map +1 -1
- package/build-module/comment-template/edit.js +79 -52
- package/build-module/comment-template/edit.js.map +1 -1
- package/build-module/cover/edit.js +23 -34
- package/build-module/cover/edit.js.map +1 -1
- package/build-module/embed/variations.js +2 -2
- package/build-module/embed/variations.js.map +1 -1
- package/build-module/gallery/edit.js +17 -5
- package/build-module/gallery/edit.js.map +1 -1
- package/build-module/gallery/gallery.js +1 -1
- package/build-module/gallery/gallery.js.map +1 -1
- package/build-module/gallery/gap-styles.js +22 -0
- package/build-module/gallery/gap-styles.js.map +1 -0
- package/build-module/gallery/index.js +17 -1
- package/build-module/gallery/index.js.map +1 -1
- package/build-module/group/index.js +3 -1
- package/build-module/group/index.js.map +1 -1
- package/build-module/group/variations.js +1 -2
- package/build-module/group/variations.js.map +1 -1
- package/build-module/image/image.js +3 -1
- package/build-module/image/image.js.map +1 -1
- package/build-module/index.js +5 -2
- package/build-module/index.js.map +1 -1
- package/build-module/list/index.js +5 -1
- package/build-module/list/index.js.map +1 -1
- package/build-module/list/v2/edit.js +69 -0
- package/build-module/list/v2/edit.js.map +1 -0
- package/build-module/list/v2/index.js +19 -0
- package/build-module/list/v2/index.js.map +1 -0
- package/build-module/list/v2/save.js +23 -0
- package/build-module/list/v2/save.js.map +1 -0
- package/build-module/list/v2/transforms.js +111 -0
- package/build-module/list/v2/transforms.js.map +1 -0
- package/build-module/list-item/edit.js +37 -0
- package/build-module/list-item/edit.js.map +1 -0
- package/build-module/list-item/index.js +53 -0
- package/build-module/list-item/index.js.map +1 -0
- package/build-module/list-item/save.js +15 -0
- package/build-module/list-item/save.js.map +1 -0
- package/build-module/media-text/edit.js +3 -1
- package/build-module/media-text/edit.js.map +1 -1
- package/build-module/navigation/use-navigation-entities.js +27 -54
- package/build-module/navigation/use-navigation-entities.js.map +1 -1
- package/build-module/navigation-link/edit.js +88 -33
- package/build-module/navigation-link/edit.js.map +1 -1
- package/build-module/post-date/edit.js +32 -43
- package/build-module/post-date/edit.js.map +1 -1
- package/build-module/post-featured-image/edit.js +2 -1
- package/build-module/post-featured-image/edit.js.map +1 -1
- package/build-module/pullquote/edit.js +6 -3
- package/build-module/pullquote/edit.js.map +1 -1
- package/build-module/query/variations.js +4 -4
- package/build-module/query/variations.js.map +1 -1
- package/build-module/query-no-results/edit.js +18 -0
- package/build-module/query-no-results/edit.js.map +1 -0
- package/build-module/query-no-results/index.js +40 -0
- package/build-module/query-no-results/index.js.map +1 -0
- package/build-module/query-no-results/save.js +10 -0
- package/build-module/query-no-results/save.js.map +1 -0
- package/build-module/search/edit.js +2 -3
- package/build-module/search/edit.js.map +1 -1
- package/build-module/separator/deprecated.js +70 -0
- package/build-module/separator/deprecated.js.map +1 -0
- package/build-module/separator/edit.js +31 -22
- package/build-module/separator/edit.js.map +1 -1
- package/build-module/separator/index.js +16 -7
- package/build-module/separator/index.js.map +1 -1
- package/build-module/separator/save.js +19 -14
- package/build-module/separator/save.js.map +1 -1
- package/build-module/separator/use-deprecated-opacity.js +30 -0
- package/build-module/separator/use-deprecated-opacity.js.map +1 -0
- package/build-module/social-links/edit.js +15 -4
- package/build-module/social-links/edit.js.map +1 -1
- package/build-module/social-links/index.js +1 -1
- package/build-module/spacer/controls.js +8 -19
- package/build-module/spacer/controls.js.map +1 -1
- package/build-module/spacer/controls.native.js +2 -1
- package/build-module/spacer/controls.native.js.map +1 -1
- package/build-module/spacer/edit.js +3 -3
- package/build-module/spacer/edit.js.map +1 -1
- package/build-module/table/deprecated.js +1 -1
- package/build-module/table/deprecated.js.map +1 -1
- package/build-module/tag-cloud/edit.js +60 -4
- package/build-module/tag-cloud/edit.js.map +1 -1
- package/build-module/tag-cloud/index.js +8 -0
- package/build-module/tag-cloud/index.js.map +1 -1
- package/build-style/avatar/editor-rtl.css +79 -0
- package/build-style/avatar/editor.css +79 -0
- package/build-style/editor-rtl.css +23 -2
- package/build-style/editor.css +23 -2
- package/build-style/gallery/editor-rtl.css +0 -1
- package/build-style/gallery/editor.css +0 -1
- package/build-style/gallery/style-rtl.css +102 -169
- package/build-style/gallery/style.css +102 -169
- package/build-style/image/style-rtl.css +2 -0
- package/build-style/image/style.css +2 -0
- package/build-style/navigation-link/editor-rtl.css +13 -0
- package/build-style/navigation-link/editor.css +13 -0
- package/build-style/pullquote/style-rtl.css +0 -4
- package/build-style/pullquote/style.css +0 -4
- package/build-style/separator/editor-rtl.css +3 -0
- package/build-style/separator/editor.css +3 -0
- package/build-style/separator/theme-rtl.css +7 -1
- package/build-style/separator/theme.css +7 -1
- package/build-style/site-logo/editor-rtl.css +3 -1
- package/build-style/site-logo/editor.css +3 -1
- package/build-style/style-rtl.css +104 -173
- package/build-style/style.css +104 -173
- package/build-style/theme-rtl.css +7 -1
- package/build-style/theme.css +7 -1
- package/package.json +28 -28
- package/src/avatar/block.json +53 -0
- package/src/avatar/edit.js +222 -0
- package/src/avatar/editor.scss +3 -0
- package/src/avatar/hooks.js +96 -0
- package/src/avatar/index.js +18 -0
- package/src/avatar/index.php +146 -0
- package/src/avatar/user-control.js +56 -0
- package/src/column/block.json +2 -1
- package/src/comment-author-avatar/block.json +1 -0
- package/src/comment-date/edit.js +20 -30
- package/src/comment-template/edit.js +65 -44
- package/src/cover/edit.js +26 -31
- package/src/editor.scss +1 -0
- package/src/embed/variations.js +2 -2
- package/src/gallery/block.json +17 -1
- package/src/gallery/deprecated.scss +2 -2
- package/src/gallery/edit.js +15 -8
- package/src/gallery/editor.scss +0 -1
- package/src/gallery/gallery.js +8 -7
- package/src/gallery/gap-styles.js +21 -0
- package/src/gallery/index.php +42 -1
- package/src/gallery/style.scss +11 -44
- package/src/group/block.json +3 -1
- package/src/group/variations.js +1 -1
- package/src/image/image.js +4 -1
- package/src/image/style.scss +3 -0
- package/src/index.js +6 -1
- package/src/list/index.js +6 -1
- package/src/list/v2/edit.js +77 -0
- package/src/list/v2/index.js +20 -0
- package/src/list/v2/save.js +18 -0
- package/src/list/v2/transforms.js +116 -0
- package/src/list-item/block.json +26 -0
- package/src/list-item/edit.js +47 -0
- package/src/list-item/index.js +27 -0
- package/src/list-item/save.js +13 -0
- package/src/media-text/edit.js +1 -1
- package/src/navigation/index.php +22 -2
- package/src/navigation/use-navigation-entities.js +37 -73
- package/src/navigation-link/edit.js +145 -61
- package/src/navigation-link/editor.scss +11 -0
- package/src/post-date/edit.js +63 -52
- package/src/post-date/index.php +1 -1
- package/src/post-date/test/edit.js +17 -0
- package/src/post-featured-image/edit.js +9 -1
- package/src/post-featured-image/index.php +2 -1
- package/src/pullquote/edit.js +4 -3
- package/src/pullquote/style.scss +0 -5
- package/src/query/variations.js +4 -0
- package/src/query-no-results/block.json +20 -0
- package/src/query-no-results/edit.js +28 -0
- package/src/query-no-results/index.js +20 -0
- package/src/query-no-results/index.php +59 -0
- package/src/query-no-results/save.js +8 -0
- package/src/search/edit.js +1 -2
- package/src/separator/block.json +13 -6
- package/src/separator/deprecated.js +57 -0
- package/src/separator/deprecated.scss +6 -0
- package/src/separator/edit.js +36 -14
- package/src/separator/editor.scss +6 -0
- package/src/separator/index.js +2 -0
- package/src/separator/save.js +22 -14
- package/src/separator/test/edit.js +113 -0
- package/src/separator/theme.scss +7 -1
- package/src/separator/use-deprecated-opacity.js +41 -0
- package/src/site-logo/editor.scss +3 -1
- package/src/social-links/block.json +1 -1
- package/src/social-links/edit.js +15 -5
- package/src/spacer/controls.js +12 -18
- package/src/spacer/controls.native.js +2 -1
- package/src/spacer/edit.js +3 -6
- package/src/table/deprecated.js +5 -1
- package/src/tag-cloud/block.json +8 -0
- package/src/tag-cloud/edit.js +82 -2
- package/src/tag-cloud/index.php +6 -0
- package/build/separator/separator-settings.js +0 -36
- package/build/separator/separator-settings.js.map +0 -1
- package/build-module/separator/separator-settings.js +0 -27
- package/build-module/separator/separator-settings.js.map +0 -1
- package/src/separator/separator-settings.js +0 -24
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-library/src/gallery/gallery.js"],"names":["allowedBlocks","Gallery","props","attributes","isSelected","setAttributes","mediaPlaceholder","insertBlocksAfter","blockProps","align","columns","caption","imageCrop","children","innerBlocksProps","orientation","renderAppender","__experimentalLayout","type","alignments","captionFocused","setCaptionFocused","onFocusCaption","removeCaptionFocus","className","undefined","RichText","isEmpty","value","RichTextVisibilityHelper","isHidden","placeholder","tagName","captionRef","richTextProps"],"mappings":";;;;;;;;;AAUA;;;;AAPA;;AAKA;;AACA;;AAEA;;AACA;;AACA;;AAbA;AACA;AACA;;AAGA;AACA;AACA;AAQA,MAAMA,aAAa,GAAG,CAAE,YAAF,CAAtB;;AAEO,MAAMC,OAAO,GAAKC,KAAF,IAAa;AACnC,QAAM;AACLC,IAAAA,UADK;AAELC,IAAAA,UAFK;AAGLC,IAAAA,aAHK;AAILC,IAAAA,gBAJK;AAKLC,IAAAA,iBALK;AAMLC,IAAAA;AANK,MAOFN,KAPJ;AASA,QAAM;AAAEO,IAAAA,KAAF;AAASC,IAAAA,OAAT;AAAkBC,IAAAA,OAAlB;AAA2BC,IAAAA;AAA3B,MAAyCT,UAA/C;AAEA,QAAM;AAAEU,IAAAA,QAAF;AAAY,OAAGC;AAAf,MAAoC,sCAAqBN,UAArB,EAAiC;AAC1ER,IAAAA,aAD0E;AAE1Ee,IAAAA,WAAW,EAAE,YAF6D;AAG1EC,IAAAA,cAAc,EAAE,KAH0D;AAI1EC,IAAAA,oBAAoB,EAAE;AAAEC,MAAAA,IAAI,EAAE,SAAR;AAAmBC,MAAAA,UAAU,EAAE;AAA/B;AAJoD,GAAjC,CAA1C;AAOA,QAAM,CAAEC,cAAF,EAAkBC,iBAAlB,IAAwC,uBAAU,KAAV,CAA9C;;AAEA,WAASC,cAAT,GAA0B;AACzB,QAAK,CAAEF,cAAP,EAAwB;AACvBC,MAAAA,iBAAiB,CAAE,IAAF,CAAjB;AACA;AACD;;AAED,WAASE,kBAAT,GAA8B;AAC7B,QAAKH,cAAL,EAAsB;AACrBC,MAAAA,iBAAiB,CAAE,KAAF,CAAjB;AACA;AACD;;AAED,0BAAW,MAAM;AAChB,QAAK,CAAEjB,UAAP,EAAoB;AACnBiB,MAAAA,iBAAiB,CAAE,KAAF,CAAjB;AACA;AACD,GAJD,EAIG,CAAEjB,UAAF,CAJH;AAMA,SACC,iEACMU,gBADN;AAEC,IAAA,SAAS,EAAG,yBACXN,UAAU,CAACgB,SADA,EAEX,qBAFW,EAGX;AACC,OAAG,QAAQf,KAAO,EAAlB,GAAuBA,KADxB;AAEC,OAAG,WAAWC,OAAS,EAAvB,GAA4BA,OAAO,KAAKe,SAFzC;AAGC,OAAG,iBAAH,GAAuBf,OAAO,KAAKe,SAHpC;AAIC,oBAAcb;AAJf,KAHW;AAFb,MAaGC,QAbH,
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-library/src/gallery/gallery.js"],"names":["allowedBlocks","Gallery","props","attributes","isSelected","setAttributes","mediaPlaceholder","insertBlocksAfter","blockProps","align","columns","caption","imageCrop","children","innerBlocksProps","orientation","renderAppender","__experimentalLayout","type","alignments","captionFocused","setCaptionFocused","onFocusCaption","removeCaptionFocus","className","undefined","RichText","isEmpty","value","RichTextVisibilityHelper","isHidden","placeholder","tagName","captionRef","richTextProps"],"mappings":";;;;;;;;;AAUA;;;;AAPA;;AAKA;;AACA;;AAEA;;AACA;;AACA;;AAbA;AACA;AACA;;AAGA;AACA;A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UADP;AAEC,IAAA,KAAK,EAAGL,KAFT;AAGC,IAAA,WAAW,EAAGG,WAHf;AAIC,IAAA,SAAS,EAAGP,SAJb;AAKC,IAAA,OAAO,EAAGQ,OALX;AAMC,IAAA,UAAU,EAAGZ,cANd;AAOC,IAAA,OAAO,EAAGE;AAPX,KAQMY,aARN,EADD;AAYA;;eAEcjC,O","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { RichText, useInnerBlocksProps } from '@wordpress/block-editor';\nimport { VisuallyHidden } from '@wordpress/components';\nimport { useState, useEffect } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport { createBlock } from '@wordpress/blocks';\nimport { View } from '@wordpress/primitives';\n\nconst allowedBlocks = [ 'core/image' ];\n\nexport const Gallery = ( props ) => {\n\tconst {\n\t\tattributes,\n\t\tisSelected,\n\t\tsetAttributes,\n\t\tmediaPlaceholder,\n\t\tinsertBlocksAfter,\n\t\tblockProps,\n\t} = props;\n\n\tconst { align, columns, caption, imageCrop } = attributes;\n\n\tconst { children, ...innerBlocksProps } = useInnerBlocksProps( blockProps, {\n\t\tallowedBlocks,\n\t\torientation: 'horizontal',\n\t\trenderAppender: false,\n\t\t__experimentalLayout: { type: 'default', alignments: [] },\n\t} );\n\n\tconst [ captionFocused, setCaptionFocused ] = useState( false );\n\n\tfunction onFocusCaption() {\n\t\tif ( ! captionFocused ) {\n\t\t\tsetCaptionFocused( true );\n\t\t}\n\t}\n\n\tfunction removeCaptionFocus() {\n\t\tif ( captionFocused ) {\n\t\t\tsetCaptionFocused( false );\n\t\t}\n\t}\n\n\tuseEffect( () => {\n\t\tif ( ! isSelected ) {\n\t\t\tsetCaptionFocused( false );\n\t\t}\n\t}, [ isSelected ] );\n\n\treturn (\n\t\t<figure\n\t\t\t{ ...innerBlocksProps }\n\t\t\tclassName={ classnames(\n\t\t\t\tblockProps.className,\n\t\t\t\t'blocks-gallery-grid',\n\t\t\t\t{\n\t\t\t\t\t[ `align${ align }` ]: align,\n\t\t\t\t\t[ `columns-${ columns }` ]: columns !== undefined,\n\t\t\t\t\t[ `columns-default` ]: columns === undefined,\n\t\t\t\t\t'is-cropped': imageCrop,\n\t\t\t\t}\n\t\t\t) }\n\t\t>\n\t\t\t{ children }\n\t\t\t{ isSelected && ! children && (\n\t\t\t\t<View\n\t\t\t\t\tclassName=\"blocks-gallery-media-placeholder-wrapper\"\n\t\t\t\t\tonClick={ removeCaptionFocus }\n\t\t\t\t>\n\t\t\t\t\t{ mediaPlaceholder }\n\t\t\t\t</View>\n\t\t\t) }\n\t\t\t<RichTextVisibilityHelper\n\t\t\t\tisHidden={ ! isSelected && RichText.isEmpty( caption ) }\n\t\t\t\tcaptionFocused={ captionFocused }\n\t\t\t\tonFocusCaption={ onFocusCaption }\n\t\t\t\ttagName=\"figcaption\"\n\t\t\t\tclassName=\"blocks-gallery-caption\"\n\t\t\t\taria-label={ __( 'Gallery caption text' ) }\n\t\t\t\tplaceholder={ __( 'Write gallery caption…' ) }\n\t\t\t\tvalue={ caption }\n\t\t\t\tonChange={ ( value ) => setAttributes( { caption: value } ) }\n\t\t\t\tinlineToolbar\n\t\t\t\t__unstableOnSplitAtEnd={ () =>\n\t\t\t\t\tinsertBlocksAfter( createBlock( 'core/paragraph' ) )\n\t\t\t\t}\n\t\t\t/>\n\t\t</figure>\n\t);\n};\n\nfunction RichTextVisibilityHelper( {\n\tisHidden,\n\tcaptionFocused,\n\tonFocusCaption,\n\tclassName,\n\tvalue,\n\tplaceholder,\n\ttagName,\n\tcaptionRef,\n\t...richTextProps\n} ) {\n\tif ( isHidden ) {\n\t\treturn <VisuallyHidden as={ RichText } { ...richTextProps } />;\n\t}\n\n\treturn (\n\t\t<RichText\n\t\t\tref={ captionRef }\n\t\t\tvalue={ value }\n\t\t\tplaceholder={ placeholder }\n\t\t\tclassName={ className }\n\t\t\ttagName={ tagName }\n\t\t\tisSelected={ captionFocused }\n\t\t\tonClick={ onFocusCaption }\n\t\t\t{ ...richTextProps }\n\t\t/>\n\t);\n}\n\nexport default Gallery;\n"]}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = GapStyles;
|
|
7
|
+
|
|
8
|
+
var _element = require("@wordpress/element");
|
|
9
|
+
|
|
10
|
+
var _blockEditor = require("@wordpress/block-editor");
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* WordPress dependencies
|
|
14
|
+
*/
|
|
15
|
+
function GapStyles(_ref) {
|
|
16
|
+
let {
|
|
17
|
+
blockGap,
|
|
18
|
+
clientId
|
|
19
|
+
} = _ref;
|
|
20
|
+
const styleElement = (0, _element.useContext)(_blockEditor.BlockList.__unstableElementContext);
|
|
21
|
+
const gap = blockGap ? `#block-${clientId} { --wp--style--unstable-gallery-gap: ${blockGap} }` : `#block-${clientId} { --wp--style--unstable-gallery-gap: var( --wp--style--block-gap, 0.5em ) }`;
|
|
22
|
+
|
|
23
|
+
const GapStyle = () => {
|
|
24
|
+
return (0, _element.createElement)("style", null, gap);
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
return gap && styleElement ? (0, _element.createPortal)((0, _element.createElement)(GapStyle, null), styleElement) : null;
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=gap-styles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-library/src/gallery/gap-styles.js"],"names":["GapStyles","blockGap","clientId","styleElement","BlockList","__unstableElementContext","gap","GapStyle"],"mappings":";;;;;;;AAIA;;AADA;;AAHA;AACA;AACA;AAIe,SAASA,SAAT,OAA6C;AAAA,MAAzB;AAAEC,IAAAA,QAAF;AAAYC,IAAAA;AAAZ,GAAyB;AAC3D,QAAMC,YAAY,GAAG,yBAAYC,uBAAUC,wBAAtB,CAArB;AAEA,QAAMC,GAAG,GAAGL,QAAQ,GAChB,UAAUC,QAAU,yCAAyCD,QAAU,IADvD,GAEhB,UAAUC,QAAU,8EAFxB;;AAIA,QAAMK,QAAQ,GAAG,MAAM;AACtB,WAAO,2CAASD,GAAT,CAAP;AACA,GAFD;;AAIA,SAAOA,GAAG,IAAIH,YAAP,GACJ,2BAAc,4BAAC,QAAD,OAAd,EAA4BA,YAA5B,CADI,GAEJ,IAFH;AAGA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { BlockList } from '@wordpress/block-editor';\nimport { useContext, createPortal } from '@wordpress/element';\n\nexport default function GapStyles( { blockGap, clientId } ) {\n\tconst styleElement = useContext( BlockList.__unstableElementContext );\n\n\tconst gap = blockGap\n\t\t? `#block-${ clientId } { --wp--style--unstable-gallery-gap: ${ blockGap } }`\n\t\t: `#block-${ clientId } { --wp--style--unstable-gallery-gap: var( --wp--style--block-gap, 0.5em ) }`;\n\n\tconst GapStyle = () => {\n\t\treturn <style>{ gap }</style>;\n\t};\n\n\treturn gap && styleElement\n\t\t? createPortal( <GapStyle />, styleElement )\n\t\t: null;\n}\n"]}
|
package/build/gallery/index.js
CHANGED
|
@@ -132,7 +132,23 @@ const metadata = {
|
|
|
132
132
|
},
|
|
133
133
|
supports: {
|
|
134
134
|
anchor: true,
|
|
135
|
-
align: true
|
|
135
|
+
align: true,
|
|
136
|
+
html: false,
|
|
137
|
+
units: ["px", "em", "rem", "vh", "vw"],
|
|
138
|
+
spacing: {
|
|
139
|
+
blockGap: true,
|
|
140
|
+
__experimentalDefaultControls: {
|
|
141
|
+
blockGap: true
|
|
142
|
+
}
|
|
143
|
+
},
|
|
144
|
+
__experimentalLayout: {
|
|
145
|
+
allowSwitching: false,
|
|
146
|
+
allowInheriting: false,
|
|
147
|
+
allowEditing: false,
|
|
148
|
+
"default": {
|
|
149
|
+
type: "flex"
|
|
150
|
+
}
|
|
151
|
+
}
|
|
136
152
|
},
|
|
137
153
|
editorStyle: "wp-block-gallery-editor",
|
|
138
154
|
style: "wp-block-gallery"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-library/src/gallery/index.js"],"names":["name","metadata","settings","icon","example","attributes","columns","innerBlocks","url","transforms","edit","save","deprecated"],"mappings":";;;;;;;;;AAGA;;AAKA;;AACA;;AAEA;;AACA;;AAZA;AACA;AACA;;AAGA;AACA;AACA
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-library/src/gallery/index.js"],"names":["name","metadata","settings","icon","example","attributes","columns","innerBlocks","url","transforms","edit","save","deprecated"],"mappings":";;;;;;;;;AAGA;;AAKA;;AACA;;AAEA;;AACA;;AAZA;AACA;AACA;;AAGA;AACA;AACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAOA,MAAM;AAAEA,EAAAA;AAAF,IAAWC,QAAjB;;AAIO,MAAMC,QAAQ,GAAG;AACvBC,EAAAA,IAAI,EAAJA,cADuB;AAEvBC,EAAAA,OAAO,EAAE;AACRC,IAAAA,UAAU,EAAE;AACXC,MAAAA,OAAO,EAAE;AADE,KADJ;AAIRC,IAAAA,WAAW,EAAE,CACZ;AACCP,MAAAA,IAAI,EAAE,YADP;AAECK,MAAAA,UAAU,EAAE;AACXG,QAAAA,GAAG,EACF;AAFU;AAFb,KADY,EAQZ;AACCR,MAAAA,IAAI,EAAE,YADP;AAECK,MAAAA,UAAU,EAAE;AACXG,QAAAA,GAAG,EACF;AAFU;AAFb,KARY;AAJL,GAFc;AAuBvBC,EAAAA,UAAU,EAAVA,mBAvBuB;AAwBvBC,EAAAA,IAAI,EAAJA,oBAxBuB;AAyBvBC,EAAAA,IAAI,EAAJA,aAzBuB;AA0BvBC,EAAAA,UAAU,EAAVA;AA1BuB,CAAjB","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { gallery as icon } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport deprecated from './deprecated';\nimport edit from './edit-wrapper';\nimport metadata from './block.json';\nimport save from './save';\nimport transforms from './transforms';\n\nconst { name } = metadata;\n\nexport { metadata, name };\n\nexport const settings = {\n\ticon,\n\texample: {\n\t\tattributes: {\n\t\t\tcolumns: 2,\n\t\t},\n\t\tinnerBlocks: [\n\t\t\t{\n\t\t\t\tname: 'core/image',\n\t\t\t\tattributes: {\n\t\t\t\t\turl:\n\t\t\t\t\t\t'https://s.w.org/images/core/5.3/Glacial_lakes%2C_Bhutan.jpg',\n\t\t\t\t},\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: 'core/image',\n\t\t\t\tattributes: {\n\t\t\t\t\turl:\n\t\t\t\t\t\t'https://s.w.org/images/core/5.3/Sediment_off_the_Yucatan_Peninsula.jpg',\n\t\t\t\t},\n\t\t\t},\n\t\t],\n\t},\n\ttransforms,\n\tedit,\n\tsave,\n\tdeprecated,\n};\n"]}
|
package/build/group/index.js
CHANGED
package/build/group/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-library/src/group/index.js"],"names":["name","metadata","settings","icon","example","attributes","style","color","text","background","innerBlocks","customTextColor","fontSize","content","transforms","edit","save","deprecated","variations"],"mappings":";;;;;;;;;AAGA;;AACA;;AAKA;;AACA;;AAEA;;AACA;;AACA;;AAdA;AACA;AACA;;AAIA;AACA;AACA
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-library/src/group/index.js"],"names":["name","metadata","settings","icon","example","attributes","style","color","text","background","innerBlocks","customTextColor","fontSize","content","transforms","edit","save","deprecated","variations"],"mappings":";;;;;;;;;AAGA;;AACA;;AAKA;;AACA;;AAEA;;AACA;;AACA;;AAdA;AACA;AACA;;AAIA;AACA;AACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAQA,MAAM;AAAEA,EAAAA;AAA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A,IAAI,EAAE,gBADP;AAECK,MAAAA,UAAU,EAAE;AACXM,QAAAA,eAAe,EAAE,SADN;AAEXC,QAAAA,QAAQ,EAAE,OAFC;AAGXC,QAAAA,OAAO,EAAE,cAAI,MAAJ;AAHE;AAFb,KAzCY;AATL,GAFc;AA8DvBC,EAAAA,UAAU,EAAVA,mBA9DuB;AA+DvBC,EAAAA,IAAI,EAAJA,aA/DuB;AAgEvBC,EAAAA,IAAI,EAAJA,aAhEuB;AAiEvBC,EAAAA,UAAU,EAAVA,mBAjEuB;AAkEvBC,EAAAA,UAAU,EAAVA;AAlEuB,CAAjB","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { group as icon } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport deprecated from './deprecated';\nimport edit from './edit';\nimport metadata from './block.json';\nimport save from './save';\nimport transforms from './transforms';\nimport variations from './variations';\n\nconst { name } = metadata;\n\nexport { metadata, name };\n\nexport const settings = {\n\ticon,\n\texample: {\n\t\tattributes: {\n\t\t\tstyle: {\n\t\t\t\tcolor: {\n\t\t\t\t\ttext: '#000000',\n\t\t\t\t\tbackground: '#ffffff',\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t\tinnerBlocks: [\n\t\t\t{\n\t\t\t\tname: 'core/paragraph',\n\t\t\t\tattributes: {\n\t\t\t\t\tcustomTextColor: '#cf2e2e',\n\t\t\t\t\tfontSize: 'large',\n\t\t\t\t\tcontent: __( 'One.' ),\n\t\t\t\t},\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: 'core/paragraph',\n\t\t\t\tattributes: {\n\t\t\t\t\tcustomTextColor: '#ff6900',\n\t\t\t\t\tfontSize: 'large',\n\t\t\t\t\tcontent: __( 'Two.' ),\n\t\t\t\t},\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: 'core/paragraph',\n\t\t\t\tattributes: {\n\t\t\t\t\tcustomTextColor: '#fcb900',\n\t\t\t\t\tfontSize: 'large',\n\t\t\t\t\tcontent: __( 'Three.' ),\n\t\t\t\t},\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: 'core/paragraph',\n\t\t\t\tattributes: {\n\t\t\t\t\tcustomTextColor: '#00d084',\n\t\t\t\t\tfontSize: 'large',\n\t\t\t\t\tcontent: __( 'Four.' ),\n\t\t\t\t},\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: 'core/paragraph',\n\t\t\t\tattributes: {\n\t\t\t\t\tcustomTextColor: '#0693e3',\n\t\t\t\t\tfontSize: 'large',\n\t\t\t\t\tcontent: __( 'Five.' ),\n\t\t\t\t},\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: 'core/paragraph',\n\t\t\t\tattributes: {\n\t\t\t\t\tcustomTextColor: '#9b51e0',\n\t\t\t\t\tfontSize: 'large',\n\t\t\t\t\tcontent: __( 'Six.' ),\n\t\t\t\t},\n\t\t\t},\n\t\t],\n\t},\n\ttransforms,\n\tedit,\n\tsave,\n\tdeprecated,\n\tvariations,\n};\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-library/src/group/variations.js"],"names":["variations","name","title","description","attributes","layout","type","scope","isActive","blockAttributes"
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-library/src/group/variations.js"],"names":["variations","name","title","description","attributes","layout","type","scope","isActive","blockAttributes"],"mappings":";;;;;;;AAGA;;AAHA;AACA;AACA;AAGA,MAAMA,UAAU,GAAG,CAClB;AACCC,EAAAA,IAAI,EAAE,OADP;AAECC,EAAAA,KAAK,EAAE,cAAI,OAAJ,CAFR;AAGCC,EAAAA,WAAW,EAAE,cAAI,2BAAJ,CAHd;AAICC,EAAAA,UAAU,EAAE;AAAEC,IAAAA,MAAM,EAAE;AAAEC,MAAAA,IAAI,EAAE;AAAR;AAAV,GAJb;AAKCC,EAAAA,KAAK,EAAE,CAAE,WAAF,CALR;AAMCC,EAAAA,QAAQ,EAAIC,eAAF;AAAA;;AAAA,WACT,CAAEA,eAAe,CAACJ,MAAlB,IACA,0BAAAI,eAAe,CAACJ,MAAhB,gFAAwBC,IAAxB,MAAiC,SAFxB;AAAA;AANX,CADkB,EAWlB;AACCL,EAAAA,IAAI,EAAE,WADP;AAECC,EAAAA,KAAK,EAAE,cAAI,KAAJ,CAFR;AAGCC,EAAAA,WAAW,EAAE,cAAI,wBAAJ,CAHd;AAICC,EAAAA,UAAU,EAAE;AAAEC,IAAAA,MAAM,EAAE;AAAEC,MAAAA,IAAI,EAAE;AAAR;AAAV,GAJb;AAKCC,EAAAA,KAAK,EAAE,CAAE,UAAF,EAAc,WAAd,CALR;AAMCC,EAAAA,QAAQ,EAAIC,eAAF;AAAA;;AAAA,WACT,2BAAAA,eAAe,CAACJ,MAAhB,kFAAwBC,IAAxB,MAAiC,MADxB;AAAA;AANX,CAXkB,CAAnB;eAsBeN,U","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\n\nconst variations = [\n\t{\n\t\tname: 'group',\n\t\ttitle: __( 'Group' ),\n\t\tdescription: __( 'Blocks shown in a column.' ),\n\t\tattributes: { layout: { type: 'default' } },\n\t\tscope: [ 'transform' ],\n\t\tisActive: ( blockAttributes ) =>\n\t\t\t! blockAttributes.layout ||\n\t\t\tblockAttributes.layout?.type === 'default',\n\t},\n\t{\n\t\tname: 'group-row',\n\t\ttitle: __( 'Row' ),\n\t\tdescription: __( 'Blocks shown in a row.' ),\n\t\tattributes: { layout: { type: 'flex' } },\n\t\tscope: [ 'inserter', 'transform' ],\n\t\tisActive: ( blockAttributes ) =>\n\t\t\tblockAttributes.layout?.type === 'flex',\n\t},\n];\n\nexport default variations;\n"]}
|
package/build/image/image.js
CHANGED
|
@@ -112,7 +112,9 @@ function Image(_ref) {
|
|
|
112
112
|
} = select(_blockEditor.store);
|
|
113
113
|
const multiSelectedClientIds = getMultiSelectedBlockClientIds();
|
|
114
114
|
return {
|
|
115
|
-
image: id && isSelected ? getMedia(id
|
|
115
|
+
image: id && isSelected ? getMedia(id, {
|
|
116
|
+
context: 'view'
|
|
117
|
+
}) : null,
|
|
116
118
|
multiImageSelection: multiSelectedClientIds.length && multiSelectedClientIds.every(_clientId => getBlockName(_clientId) === 'core/image')
|
|
117
119
|
};
|
|
118
120
|
}, [id, isSelected]);
|
package/build/image/image.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-library/src/image/image.js"],"names":["Image","temporaryURL","attributes","url","alt","caption","align","id","href","rel","linkClass","linkDestination","title","width","height","linkTarget","sizeSlug","setAttributes","isSelected","insertBlocksAfter","onReplace","onCloseModal","onSelectImage","onSelectURL","onUploadError","containerRef","context","clientId","onImageLoadError","imageRef","captionRef","prevUrl","allowResize","getBlock","blockEditorStore","image","multiImageSelection","select","getMedia","coreStore","getMultiSelectedBlockClientIds","getBlockName","multiSelectedClientIds","length","every","_clientId","canInsertCover","imageEditing","imageSizes","maxWidth","mediaUpload","getBlockRootClientId","getSettings","canInsertBlockType","rootClientId","settings","replaceBlocks","toggleSelection","createErrorNotice","createSuccessNotice","noticesStore","isLargeViewport","isWideAligned","loadedNaturalWidth","loadedNaturalHeight","setLoadedNaturalSize","isEditingImage","setIsEditingImage","externalBlob","setExternalBlob","clientWidth","isResizable","imageSizeOptions","slug","name","value","label","window","fetch","then","response","blob","catch","current","focus","naturalWidth","naturalHeight","undefined","complete","onResizeStart","onResizeStop","onImageError","embedBlock","shouldReplace","onSetHref","props","onSetTitle","updateAlt","newAlt","updateImage","newSizeSlug","newUrl","uploadExternal","filesList","onFileChange","img","type","allowedTypes","ALLOWED_MEDIA_TYPES","onError","message","updateAlignment","nextAlign","extraUpdatedAttributes","includes","canEditImage","allowCrop","switchToCover","controls","source_url","link","crop","upload","overlayText","filename","defaultedAlt","event","target","imageWidthWithinContainer","imageHeightWithinContainer","exceedMaxWidth","ratio","currentWidth","currentHeight","minWidth","MIN_SIZE","minHeight","maxWidthBuffer","showRightHandle","showLeftHandle","top","right","bottom","left","direction","elt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,eAAF,IACbnI,aAAa,CAAEmI,eAAF,CAPf;AASC,IAAA,SAAS,EAAGlF,cATb;AAUC,IAAA,eAAe,EAAG,MAAMC,iBAAiB,CAAE,KAAF;AAV1C,KAcG,CAAElE,YAAF,IAAkBqH,QAdrB,EAeGb,GAfH,EAgBG,CAAE,CAAE4C,sBAASC,OAAT,CAAkBjJ,OAAlB,CAAF,IAAiCa,UAAnC,KACD,4BAAC,qBAAD;AACC,IAAA,GAAG,EAAGY,UADP;AAEC,IAAA,OAAO,EAAC,YAFT;AAGC,kBAAa,cAAI,oBAAJ,CAHd;AAIC,IAAA,WAAW,EAAG,cAAI,aAAJ,CAJf;AAKC,IAAA,KAAK,EAAGzB,OALT;AAMC,IAAA,QAAQ,EAAKsE,KAAF,IACV1D,aAAa,CAAE;AAAEZ,MAAAA,OAAO,EAAEsE;AAAX,KAAF,CAPf;AASC,IAAA,aAAa,MATd;AAUC,IAAA,sBAAsB,EAAG,MACxBxD,iBAAiB,CAAE,yBAAa,gBAAb,CAAF;AAXnB,IAjBF,CADD;AAmCA","sourcesContent":["/**\n * External dependencies\n */\nimport { get, filter, map, pick, includes } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { isBlobURL } from '@wordpress/blob';\nimport {\n\tExternalLink,\n\tPanelBody,\n\tResizableBox,\n\tSpinner,\n\tTextareaControl,\n\tTextControl,\n\tToolbarButton,\n} from '@wordpress/components';\nimport { useViewportMatch, usePrevious } from '@wordpress/compose';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport {\n\tBlockControls,\n\tInspectorControls,\n\tRichText,\n\t__experimentalImageSizeControl as ImageSizeControl,\n\t__experimentalImageURLInputUI as ImageURLInputUI,\n\tMediaReplaceFlow,\n\tstore as blockEditorStore,\n\tBlockAlignmentControl,\n\t__experimentalImageEditor as ImageEditor,\n\t__experimentalImageEditingProvider as ImageEditingProvider,\n} from '@wordpress/block-editor';\nimport { useEffect, useMemo, useState, useRef } from '@wordpress/element';\nimport { __, sprintf, isRTL } from '@wordpress/i18n';\nimport { getFilename } from '@wordpress/url';\nimport { createBlock, switchToBlockType } from '@wordpress/blocks';\nimport { crop, overlayText, upload } from '@wordpress/icons';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { createUpgradedEmbedBlock } from '../embed/util';\nimport useClientWidth from './use-client-width';\nimport { isExternalImage, isMediaDestroyed } from './edit';\n\n/**\n * Module constants\n */\nimport { MIN_SIZE, ALLOWED_MEDIA_TYPES } from './constants';\n\nexport default function Image( {\n\ttemporaryURL,\n\tattributes: {\n\t\turl = '',\n\t\talt,\n\t\tcaption,\n\t\talign,\n\t\tid,\n\t\thref,\n\t\trel,\n\t\tlinkClass,\n\t\tlinkDestination,\n\t\ttitle,\n\t\twidth,\n\t\theight,\n\t\tlinkTarget,\n\t\tsizeSlug,\n\t},\n\tsetAttributes,\n\tisSelected,\n\tinsertBlocksAfter,\n\tonReplace,\n\tonCloseModal,\n\tonSelectImage,\n\tonSelectURL,\n\tonUploadError,\n\tcontainerRef,\n\tcontext,\n\tclientId,\n\tonImageLoadError,\n} ) {\n\tconst imageRef = useRef();\n\tconst captionRef = useRef();\n\tconst prevUrl = usePrevious( url );\n\tconst { allowResize = true } = context;\n\tconst { getBlock } = useSelect( blockEditorStore );\n\n\tconst { image, multiImageSelection } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getMedia } = select( coreStore );\n\t\t\tconst { getMultiSelectedBlockClientIds, getBlockName } = select(\n\t\t\t\tblockEditorStore\n\t\t\t);\n\t\t\tconst multiSelectedClientIds = getMultiSelectedBlockClientIds();\n\t\t\treturn {\n\t\t\t\timage: id && isSelected ? getMedia( id ) : null,\n\t\t\t\tmultiImageSelection:\n\t\t\t\t\tmultiSelectedClientIds.length &&\n\t\t\t\t\tmultiSelectedClientIds.every(\n\t\t\t\t\t\t( _clientId ) =>\n\t\t\t\t\t\t\tgetBlockName( _clientId ) === 'core/image'\n\t\t\t\t\t),\n\t\t\t};\n\t\t},\n\t\t[ id, isSelected ]\n\t);\n\tconst {\n\t\tcanInsertCover,\n\t\timageEditing,\n\t\timageSizes,\n\t\tmaxWidth,\n\t\tmediaUpload,\n\t} = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tgetBlockRootClientId,\n\t\t\t\tgetSettings,\n\t\t\t\tcanInsertBlockType,\n\t\t\t} = select( blockEditorStore );\n\n\t\t\tconst rootClientId = getBlockRootClientId( clientId );\n\t\t\tconst settings = pick( getSettings(), [\n\t\t\t\t'imageEditing',\n\t\t\t\t'imageSizes',\n\t\t\t\t'maxWidth',\n\t\t\t\t'mediaUpload',\n\t\t\t] );\n\n\t\t\treturn {\n\t\t\t\t...settings,\n\t\t\t\tcanInsertCover: canInsertBlockType(\n\t\t\t\t\t'core/cover',\n\t\t\t\t\trootClientId\n\t\t\t\t),\n\t\t\t};\n\t\t},\n\t\t[ clientId ]\n\t);\n\tconst { replaceBlocks, toggleSelection } = useDispatch( blockEditorStore );\n\tconst { createErrorNotice, createSuccessNotice } = useDispatch(\n\t\tnoticesStore\n\t);\n\tconst isLargeViewport = useViewportMatch( 'medium' );\n\tconst isWideAligned = includes( [ 'wide', 'full' ], align );\n\tconst [\n\t\t{ loadedNaturalWidth, loadedNaturalHeight },\n\t\tsetLoadedNaturalSize,\n\t] = useState( {} );\n\tconst [ isEditingImage, setIsEditingImage ] = useState( false );\n\tconst [ externalBlob, setExternalBlob ] = useState();\n\tconst clientWidth = useClientWidth( containerRef, [ align ] );\n\tconst isResizable = allowResize && ! ( isWideAligned && isLargeViewport );\n\tconst imageSizeOptions = map(\n\t\tfilter( imageSizes, ( { slug } ) =>\n\t\t\tget( image, [ 'media_details', 'sizes', slug, 'source_url' ] )\n\t\t),\n\t\t( { name, slug } ) => ( { value: slug, label: name } )\n\t);\n\n\t// If an image is externally hosted, try to fetch the image data. This may\n\t// fail if the image host doesn't allow CORS with the domain. If it works,\n\t// we can enable a button in the toolbar to upload the image.\n\tuseEffect( () => {\n\t\tif ( ! isExternalImage( id, url ) || ! isSelected || externalBlob ) {\n\t\t\treturn;\n\t\t}\n\n\t\twindow\n\t\t\t.fetch( url )\n\t\t\t.then( ( response ) => response.blob() )\n\t\t\t.then( ( blob ) => setExternalBlob( blob ) )\n\t\t\t// Do nothing, cannot upload.\n\t\t\t.catch( () => {} );\n\t}, [ id, url, isSelected, externalBlob ] );\n\n\t// Focus the caption after inserting an image from the placeholder. This is\n\t// done to preserve the behaviour of focussing the first tabbable element\n\t// when a block is mounted. Previously, the image block would remount when\n\t// the placeholder is removed. Maybe this behaviour could be removed.\n\tuseEffect( () => {\n\t\tif ( url && ! prevUrl && isSelected ) {\n\t\t\tcaptionRef.current.focus();\n\t\t}\n\t}, [ url, prevUrl ] );\n\n\t// Get naturalWidth and naturalHeight from image ref, and fall back to loaded natural\n\t// width and height. This resolves an issue in Safari where the loaded natural\n\t// witdth and height is otherwise lost when switching between alignments.\n\t// See: https://github.com/WordPress/gutenberg/pull/37210.\n\tconst { naturalWidth, naturalHeight } = useMemo( () => {\n\t\treturn {\n\t\t\tnaturalWidth:\n\t\t\t\timageRef.current?.naturalWidth ||\n\t\t\t\tloadedNaturalWidth ||\n\t\t\t\tundefined,\n\t\t\tnaturalHeight:\n\t\t\t\timageRef.current?.naturalHeight ||\n\t\t\t\tloadedNaturalHeight ||\n\t\t\t\tundefined,\n\t\t};\n\t}, [\n\t\tloadedNaturalWidth,\n\t\tloadedNaturalHeight,\n\t\timageRef.current?.complete,\n\t] );\n\n\tfunction onResizeStart() {\n\t\ttoggleSelection( false );\n\t}\n\n\tfunction onResizeStop() {\n\t\ttoggleSelection( true );\n\t}\n\n\tfunction onImageError() {\n\t\t// Check if there's an embed block that handles this URL, e.g., instagram URL.\n\t\t// See: https://github.com/WordPress/gutenberg/pull/11472\n\t\tconst embedBlock = createUpgradedEmbedBlock( { attributes: { url } } );\n\t\tconst shouldReplace = undefined !== embedBlock;\n\n\t\tif ( shouldReplace ) {\n\t\t\tonReplace( embedBlock );\n\t\t}\n\n\t\tonImageLoadError( shouldReplace );\n\t}\n\n\tfunction onSetHref( props ) {\n\t\tsetAttributes( props );\n\t}\n\n\tfunction onSetTitle( value ) {\n\t\t// This is the HTML title attribute, separate from the media object\n\t\t// title.\n\t\tsetAttributes( { title: value } );\n\t}\n\n\tfunction updateAlt( newAlt ) {\n\t\tsetAttributes( { alt: newAlt } );\n\t}\n\n\tfunction updateImage( newSizeSlug ) {\n\t\tconst newUrl = get( image, [\n\t\t\t'media_details',\n\t\t\t'sizes',\n\t\t\tnewSizeSlug,\n\t\t\t'source_url',\n\t\t] );\n\t\tif ( ! newUrl ) {\n\t\t\treturn null;\n\t\t}\n\n\t\tsetAttributes( {\n\t\t\turl: newUrl,\n\t\t\twidth: undefined,\n\t\t\theight: undefined,\n\t\t\tsizeSlug: newSizeSlug,\n\t\t} );\n\t}\n\n\tfunction uploadExternal() {\n\t\tmediaUpload( {\n\t\t\tfilesList: [ externalBlob ],\n\t\t\tonFileChange( [ img ] ) {\n\t\t\t\tonSelectImage( img );\n\n\t\t\t\tif ( isBlobURL( img.url ) ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tsetExternalBlob();\n\t\t\t\tcreateSuccessNotice( __( 'Image uploaded.' ), {\n\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t} );\n\t\t\t},\n\t\t\tallowedTypes: ALLOWED_MEDIA_TYPES,\n\t\t\tonError( message ) {\n\t\t\t\tcreateErrorNotice( message, { type: 'snackbar' } );\n\t\t\t},\n\t\t} );\n\t}\n\n\tfunction updateAlignment( nextAlign ) {\n\t\tconst extraUpdatedAttributes = [ 'wide', 'full' ].includes( nextAlign )\n\t\t\t? { width: undefined, height: undefined }\n\t\t\t: {};\n\t\tsetAttributes( {\n\t\t\t...extraUpdatedAttributes,\n\t\t\talign: nextAlign,\n\t\t} );\n\t}\n\n\tuseEffect( () => {\n\t\tif ( ! isSelected ) {\n\t\t\tsetIsEditingImage( false );\n\t\t}\n\t\tif ( isSelected && isMediaDestroyed( id ) ) {\n\t\t\tonImageLoadError();\n\t\t}\n\t}, [ isSelected ] );\n\n\tconst canEditImage = id && naturalWidth && naturalHeight && imageEditing;\n\tconst allowCrop = ! multiImageSelection && canEditImage && ! isEditingImage;\n\n\tfunction switchToCover() {\n\t\treplaceBlocks(\n\t\t\tclientId,\n\t\t\tswitchToBlockType( getBlock( clientId ), 'core/cover' )\n\t\t);\n\t}\n\n\tconst controls = (\n\t\t<>\n\t\t\t<BlockControls group=\"block\">\n\t\t\t\t<BlockAlignmentControl\n\t\t\t\t\tvalue={ align }\n\t\t\t\t\tonChange={ updateAlignment }\n\t\t\t\t/>\n\t\t\t\t{ ! multiImageSelection && ! isEditingImage && (\n\t\t\t\t\t<ImageURLInputUI\n\t\t\t\t\t\turl={ href || '' }\n\t\t\t\t\t\tonChangeUrl={ onSetHref }\n\t\t\t\t\t\tlinkDestination={ linkDestination }\n\t\t\t\t\t\tmediaUrl={ ( image && image.source_url ) || url }\n\t\t\t\t\t\tmediaLink={ image && image.link }\n\t\t\t\t\t\tlinkTarget={ linkTarget }\n\t\t\t\t\t\tlinkClass={ linkClass }\n\t\t\t\t\t\trel={ rel }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t\t{ allowCrop && (\n\t\t\t\t\t<ToolbarButton\n\t\t\t\t\t\tonClick={ () => setIsEditingImage( true ) }\n\t\t\t\t\t\ticon={ crop }\n\t\t\t\t\t\tlabel={ __( 'Crop' ) }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t\t{ externalBlob && (\n\t\t\t\t\t<ToolbarButton\n\t\t\t\t\t\tonClick={ uploadExternal }\n\t\t\t\t\t\ticon={ upload }\n\t\t\t\t\t\tlabel={ __( 'Upload external image' ) }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t\t{ ! multiImageSelection && canInsertCover && (\n\t\t\t\t\t<ToolbarButton\n\t\t\t\t\t\ticon={ overlayText }\n\t\t\t\t\t\tlabel={ __( 'Add text over image' ) }\n\t\t\t\t\t\tonClick={ switchToCover }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t</BlockControls>\n\t\t\t{ ! multiImageSelection && ! isEditingImage && (\n\t\t\t\t<BlockControls group=\"other\">\n\t\t\t\t\t<MediaReplaceFlow\n\t\t\t\t\t\tmediaId={ id }\n\t\t\t\t\t\tmediaURL={ url }\n\t\t\t\t\t\tallowedTypes={ ALLOWED_MEDIA_TYPES }\n\t\t\t\t\t\taccept=\"image/*\"\n\t\t\t\t\t\tonSelect={ onSelectImage }\n\t\t\t\t\t\tonSelectURL={ onSelectURL }\n\t\t\t\t\t\tonError={ onUploadError }\n\t\t\t\t\t\tonCloseModal={ onCloseModal }\n\t\t\t\t\t/>\n\t\t\t\t</BlockControls>\n\t\t\t) }\n\t\t\t<InspectorControls>\n\t\t\t\t<PanelBody title={ __( 'Image settings' ) }>\n\t\t\t\t\t{ ! multiImageSelection && (\n\t\t\t\t\t\t<TextareaControl\n\t\t\t\t\t\t\tlabel={ __( 'Alt text (alternative text)' ) }\n\t\t\t\t\t\t\tvalue={ alt }\n\t\t\t\t\t\t\tonChange={ updateAlt }\n\t\t\t\t\t\t\thelp={\n\t\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t\t<ExternalLink href=\"https://www.w3.org/WAI/tutorials/images/decision-tree\">\n\t\t\t\t\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t\t\t\t\t'Describe the purpose of the image'\n\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t</ExternalLink>\n\t\t\t\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t\t\t\t'Leave empty if the image is purely decorative.'\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t\t<ImageSizeControl\n\t\t\t\t\t\tonChangeImage={ updateImage }\n\t\t\t\t\t\tonChange={ ( value ) => setAttributes( value ) }\n\t\t\t\t\t\tslug={ sizeSlug }\n\t\t\t\t\t\twidth={ width }\n\t\t\t\t\t\theight={ height }\n\t\t\t\t\t\timageSizeOptions={ imageSizeOptions }\n\t\t\t\t\t\tisResizable={ isResizable }\n\t\t\t\t\t\timageWidth={ naturalWidth }\n\t\t\t\t\t\timageHeight={ naturalHeight }\n\t\t\t\t\t/>\n\t\t\t\t</PanelBody>\n\t\t\t</InspectorControls>\n\t\t\t<InspectorControls __experimentalGroup=\"advanced\">\n\t\t\t\t<TextControl\n\t\t\t\t\tlabel={ __( 'Title attribute' ) }\n\t\t\t\t\tvalue={ title || '' }\n\t\t\t\t\tonChange={ onSetTitle }\n\t\t\t\t\thelp={\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t\t'Describe the role of this image on the page.'\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t<ExternalLink href=\"https://www.w3.org/TR/html52/dom.html#the-title-attribute\">\n\t\t\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t\t\t'(Note: many devices and browsers do not display this text.)'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t</ExternalLink>\n\t\t\t\t\t\t</>\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t</InspectorControls>\n\t\t</>\n\t);\n\n\tconst filename = getFilename( url );\n\tlet defaultedAlt;\n\n\tif ( alt ) {\n\t\tdefaultedAlt = alt;\n\t} else if ( filename ) {\n\t\tdefaultedAlt = sprintf(\n\t\t\t/* translators: %s: file name */\n\t\t\t__( 'This image has an empty alt attribute; its file name is %s' ),\n\t\t\tfilename\n\t\t);\n\t} else {\n\t\tdefaultedAlt = __( 'This image has an empty alt attribute' );\n\t}\n\n\tlet img = (\n\t\t// Disable reason: Image itself is not meant to be interactive, but\n\t\t// should direct focus to block.\n\t\t/* eslint-disable jsx-a11y/no-noninteractive-element-interactions, jsx-a11y/click-events-have-key-events */\n\t\t<>\n\t\t\t<img\n\t\t\t\tsrc={ temporaryURL || url }\n\t\t\t\talt={ defaultedAlt }\n\t\t\t\tonError={ () => onImageError() }\n\t\t\t\tonLoad={ ( event ) => {\n\t\t\t\t\tsetLoadedNaturalSize( {\n\t\t\t\t\t\tloadedNaturalWidth: event.target?.naturalWidth,\n\t\t\t\t\t\tloadedNaturalHeight: event.target?.naturalHeight,\n\t\t\t\t\t} );\n\t\t\t\t} }\n\t\t\t\tref={ imageRef }\n\t\t\t/>\n\t\t\t{ temporaryURL && <Spinner /> }\n\t\t</>\n\t\t/* eslint-enable jsx-a11y/no-noninteractive-element-interactions, jsx-a11y/click-events-have-key-events */\n\t);\n\n\tlet imageWidthWithinContainer;\n\tlet imageHeightWithinContainer;\n\n\tif ( clientWidth && naturalWidth && naturalHeight ) {\n\t\tconst exceedMaxWidth = naturalWidth > clientWidth;\n\t\tconst ratio = naturalHeight / naturalWidth;\n\t\timageWidthWithinContainer = exceedMaxWidth ? clientWidth : naturalWidth;\n\t\timageHeightWithinContainer = exceedMaxWidth\n\t\t\t? clientWidth * ratio\n\t\t\t: naturalHeight;\n\t}\n\n\tif ( canEditImage && isEditingImage ) {\n\t\timg = (\n\t\t\t<ImageEditor\n\t\t\t\turl={ url }\n\t\t\t\twidth={ width }\n\t\t\t\theight={ height }\n\t\t\t\tclientWidth={ clientWidth }\n\t\t\t\tnaturalHeight={ naturalHeight }\n\t\t\t\tnaturalWidth={ naturalWidth }\n\t\t\t/>\n\t\t);\n\t} else if ( ! isResizable || ! imageWidthWithinContainer ) {\n\t\timg = <div style={ { width, height } }>{ img }</div>;\n\t} else {\n\t\tconst currentWidth = width || imageWidthWithinContainer;\n\t\tconst currentHeight = height || imageHeightWithinContainer;\n\n\t\tconst ratio = naturalWidth / naturalHeight;\n\t\tconst minWidth =\n\t\t\tnaturalWidth < naturalHeight ? MIN_SIZE : MIN_SIZE * ratio;\n\t\tconst minHeight =\n\t\t\tnaturalHeight < naturalWidth ? MIN_SIZE : MIN_SIZE / ratio;\n\n\t\t// With the current implementation of ResizableBox, an image needs an\n\t\t// explicit pixel value for the max-width. In absence of being able to\n\t\t// set the content-width, this max-width is currently dictated by the\n\t\t// vanilla editor style. The following variable adds a buffer to this\n\t\t// vanilla style, so 3rd party themes have some wiggleroom. This does,\n\t\t// in most cases, allow you to scale the image beyond the width of the\n\t\t// main column, though not infinitely.\n\t\t// @todo It would be good to revisit this once a content-width variable\n\t\t// becomes available.\n\t\tconst maxWidthBuffer = maxWidth * 2.5;\n\n\t\tlet showRightHandle = false;\n\t\tlet showLeftHandle = false;\n\n\t\t/* eslint-disable no-lonely-if */\n\t\t// See https://github.com/WordPress/gutenberg/issues/7584.\n\t\tif ( align === 'center' ) {\n\t\t\t// When the image is centered, show both handles.\n\t\t\tshowRightHandle = true;\n\t\t\tshowLeftHandle = true;\n\t\t} else if ( isRTL() ) {\n\t\t\t// In RTL mode the image is on the right by default.\n\t\t\t// Show the right handle and hide the left handle only when it is\n\t\t\t// aligned left. Otherwise always show the left handle.\n\t\t\tif ( align === 'left' ) {\n\t\t\t\tshowRightHandle = true;\n\t\t\t} else {\n\t\t\t\tshowLeftHandle = true;\n\t\t\t}\n\t\t} else {\n\t\t\t// Show the left handle and hide the right handle only when the\n\t\t\t// image is aligned right. Otherwise always show the right handle.\n\t\t\tif ( align === 'right' ) {\n\t\t\t\tshowLeftHandle = true;\n\t\t\t} else {\n\t\t\t\tshowRightHandle = true;\n\t\t\t}\n\t\t}\n\t\t/* eslint-enable no-lonely-if */\n\n\t\timg = (\n\t\t\t<ResizableBox\n\t\t\t\tsize={ {\n\t\t\t\t\twidth: width ?? 'auto',\n\t\t\t\t\theight: height ?? 'auto',\n\t\t\t\t} }\n\t\t\t\tshowHandle={ isSelected }\n\t\t\t\tminWidth={ minWidth }\n\t\t\t\tmaxWidth={ maxWidthBuffer }\n\t\t\t\tminHeight={ minHeight }\n\t\t\t\tmaxHeight={ maxWidthBuffer / ratio }\n\t\t\t\tlockAspectRatio\n\t\t\t\tenable={ {\n\t\t\t\t\ttop: false,\n\t\t\t\t\tright: showRightHandle,\n\t\t\t\t\tbottom: true,\n\t\t\t\t\tleft: showLeftHandle,\n\t\t\t\t} }\n\t\t\t\tonResizeStart={ onResizeStart }\n\t\t\t\tonResizeStop={ ( event, direction, elt, delta ) => {\n\t\t\t\t\tonResizeStop();\n\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\twidth: parseInt( currentWidth + delta.width, 10 ),\n\t\t\t\t\t\theight: parseInt( currentHeight + delta.height, 10 ),\n\t\t\t\t\t} );\n\t\t\t\t} }\n\t\t\t>\n\t\t\t\t{ img }\n\t\t\t</ResizableBox>\n\t\t);\n\t}\n\n\treturn (\n\t\t<ImageEditingProvider\n\t\t\tid={ id }\n\t\t\turl={ url }\n\t\t\tnaturalWidth={ naturalWidth }\n\t\t\tnaturalHeight={ naturalHeight }\n\t\t\tclientWidth={ clientWidth }\n\t\t\tonSaveImage={ ( imageAttributes ) =>\n\t\t\t\tsetAttributes( imageAttributes )\n\t\t\t}\n\t\t\tisEditing={ isEditingImage }\n\t\t\tonFinishEditing={ () => setIsEditingImage( false ) }\n\t\t>\n\t\t\t{ /* Hide controls during upload to avoid component remount,\n\t\t\t\twhich causes duplicated image upload. */ }\n\t\t\t{ ! temporaryURL && controls }\n\t\t\t{ img }\n\t\t\t{ ( ! RichText.isEmpty( caption ) || isSelected ) && (\n\t\t\t\t<RichText\n\t\t\t\t\tref={ captionRef }\n\t\t\t\t\ttagName=\"figcaption\"\n\t\t\t\t\taria-label={ __( 'Image caption text' ) }\n\t\t\t\t\tplaceholder={ __( 'Add caption' ) }\n\t\t\t\t\tvalue={ caption }\n\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\tsetAttributes( { caption: value } )\n\t\t\t\t\t}\n\t\t\t\t\tinlineToolbar\n\t\t\t\t\t__unstableOnSplitAtEnd={ () =>\n\t\t\t\t\t\tinsertBlocksAfter( createBlock( 'core/paragraph' ) )\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t) }\n\t\t</ImageEditingProvider>\n\t);\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-library/src/image/image.js"],"names":["Image","temporaryURL","attributes","url","alt","caption","align","id","href","rel","linkClass","linkDestination","title","width","height","linkTarget","sizeSlug","setAttributes","isSelected","insertBlocksAfter","onReplace","onCloseModal","onSelectImage","onSelectURL","onUploadError","containerRef","context","clientId","onImageLoadError","imageRef","captionRef","prevUrl","allowResize","getBlock","blockEditorStore","image","multiImageSelection","select","getMedia","coreStore","getMultiSelectedBlockClientIds","getBlockName","multiSelectedClientIds","length","every","_clientId","canInsertCover","imageEditing","imageSizes","maxWidth","mediaUpload","getBlockRootClientId","getSettings","canInsertBlockType","rootClientId","settings","replaceBlocks","toggleSelection","createErrorNotice","createSuccessNotice","noticesStore","isLargeViewport","isWideAligned","loadedNaturalWidth","loadedNaturalHeight","setLoadedNaturalSize","isEditingImage","setIsEditingImage","externalBlob","setExternalBlob","clientWidth","isResizable","imageSizeOptions","slug","name","value","label","window","fetch","then","response","blob","catch","current","focus","naturalWidth","naturalHeight","undefined","complete","onResizeStart","onResizeStop","onImageError","embedBlock","shouldReplace","onSetHref","props","onSetTitle","updateAlt","newAlt","updateImage","newSizeSlug","newUrl","uploadExternal","filesList","onFileChange","img","type","allowedTypes","ALLOWED_MEDIA_TYPES","onError","message","updateAlignment","nextAlign","extraUpdatedAttributes","includes","canEditImage","allowCrop","switchToCover","controls","source_url","link","crop","upload","overlayText","filename","defaultedAlt","event","target","imageWidthWithinContainer","imageHeightWithinContainer","exceedMaxWidth","ratio","currentWidth","currentHeight","minWidth","MIN_SIZE","minHeight","maxWidthBuffer","showRightHandle","showLeftHandle","top","right","bottom","left","direction","elt","delta","parseInt","imageAttributes","RichText","isEmpty"],"mappings":";;;;;;;;;AAgCA;;AA7BA;;AAKA;;AACA;;AASA;;AACA;;AACA;;AAaA;;AACA;;AACA;;AACA;;A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e,EAAG,MAAMC,iBAAiB,CAAE,KAAF;AAV1C,KAcG,CAAElE,YAAF,IAAkBqH,QAdrB,EAeGb,GAfH,EAgBG,CAAE,CAAE4C,sBAASC,OAAT,CAAkBjJ,OAAlB,CAAF,IAAiCa,UAAnC,KACD,4BAAC,qBAAD;AACC,IAAA,GAAG,EAAGY,UADP;AAEC,IAAA,OAAO,EAAC,YAFT;AAGC,kBAAa,cAAI,oBAAJ,CAHd;AAIC,IAAA,WAAW,EAAG,cAAI,aAAJ,CAJf;AAKC,IAAA,KAAK,EAAGzB,OALT;AAMC,IAAA,QAAQ,EAAKsE,KAAF,IACV1D,aAAa,CAAE;AAAEZ,MAAAA,OAAO,EAAEsE;AAAX,KAAF,CAPf;AASC,IAAA,aAAa,MATd;AAUC,IAAA,sBAAsB,EAAG,MACxBxD,iBAAiB,CAAE,yBAAa,gBAAb,CAAF;AAXnB,IAjBF,CADD;AAmCA","sourcesContent":["/**\n * External dependencies\n */\nimport { get, filter, map, pick, includes } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { isBlobURL } from '@wordpress/blob';\nimport {\n\tExternalLink,\n\tPanelBody,\n\tResizableBox,\n\tSpinner,\n\tTextareaControl,\n\tTextControl,\n\tToolbarButton,\n} from '@wordpress/components';\nimport { useViewportMatch, usePrevious } from '@wordpress/compose';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport {\n\tBlockControls,\n\tInspectorControls,\n\tRichText,\n\t__experimentalImageSizeControl as ImageSizeControl,\n\t__experimentalImageURLInputUI as ImageURLInputUI,\n\tMediaReplaceFlow,\n\tstore as blockEditorStore,\n\tBlockAlignmentControl,\n\t__experimentalImageEditor as ImageEditor,\n\t__experimentalImageEditingProvider as ImageEditingProvider,\n} from '@wordpress/block-editor';\nimport { useEffect, useMemo, useState, useRef } from '@wordpress/element';\nimport { __, sprintf, isRTL } from '@wordpress/i18n';\nimport { getFilename } from '@wordpress/url';\nimport { createBlock, switchToBlockType } from '@wordpress/blocks';\nimport { crop, overlayText, upload } from '@wordpress/icons';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { createUpgradedEmbedBlock } from '../embed/util';\nimport useClientWidth from './use-client-width';\nimport { isExternalImage, isMediaDestroyed } from './edit';\n\n/**\n * Module constants\n */\nimport { MIN_SIZE, ALLOWED_MEDIA_TYPES } from './constants';\n\nexport default function Image( {\n\ttemporaryURL,\n\tattributes: {\n\t\turl = '',\n\t\talt,\n\t\tcaption,\n\t\talign,\n\t\tid,\n\t\thref,\n\t\trel,\n\t\tlinkClass,\n\t\tlinkDestination,\n\t\ttitle,\n\t\twidth,\n\t\theight,\n\t\tlinkTarget,\n\t\tsizeSlug,\n\t},\n\tsetAttributes,\n\tisSelected,\n\tinsertBlocksAfter,\n\tonReplace,\n\tonCloseModal,\n\tonSelectImage,\n\tonSelectURL,\n\tonUploadError,\n\tcontainerRef,\n\tcontext,\n\tclientId,\n\tonImageLoadError,\n} ) {\n\tconst imageRef = useRef();\n\tconst captionRef = useRef();\n\tconst prevUrl = usePrevious( url );\n\tconst { allowResize = true } = context;\n\tconst { getBlock } = useSelect( blockEditorStore );\n\n\tconst { image, multiImageSelection } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getMedia } = select( coreStore );\n\t\t\tconst { getMultiSelectedBlockClientIds, getBlockName } = select(\n\t\t\t\tblockEditorStore\n\t\t\t);\n\t\t\tconst multiSelectedClientIds = getMultiSelectedBlockClientIds();\n\t\t\treturn {\n\t\t\t\timage:\n\t\t\t\t\tid && isSelected\n\t\t\t\t\t\t? getMedia( id, { context: 'view' } )\n\t\t\t\t\t\t: null,\n\t\t\t\tmultiImageSelection:\n\t\t\t\t\tmultiSelectedClientIds.length &&\n\t\t\t\t\tmultiSelectedClientIds.every(\n\t\t\t\t\t\t( _clientId ) =>\n\t\t\t\t\t\t\tgetBlockName( _clientId ) === 'core/image'\n\t\t\t\t\t),\n\t\t\t};\n\t\t},\n\t\t[ id, isSelected ]\n\t);\n\tconst {\n\t\tcanInsertCover,\n\t\timageEditing,\n\t\timageSizes,\n\t\tmaxWidth,\n\t\tmediaUpload,\n\t} = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tgetBlockRootClientId,\n\t\t\t\tgetSettings,\n\t\t\t\tcanInsertBlockType,\n\t\t\t} = select( blockEditorStore );\n\n\t\t\tconst rootClientId = getBlockRootClientId( clientId );\n\t\t\tconst settings = pick( getSettings(), [\n\t\t\t\t'imageEditing',\n\t\t\t\t'imageSizes',\n\t\t\t\t'maxWidth',\n\t\t\t\t'mediaUpload',\n\t\t\t] );\n\n\t\t\treturn {\n\t\t\t\t...settings,\n\t\t\t\tcanInsertCover: canInsertBlockType(\n\t\t\t\t\t'core/cover',\n\t\t\t\t\trootClientId\n\t\t\t\t),\n\t\t\t};\n\t\t},\n\t\t[ clientId ]\n\t);\n\tconst { replaceBlocks, toggleSelection } = useDispatch( blockEditorStore );\n\tconst { createErrorNotice, createSuccessNotice } = useDispatch(\n\t\tnoticesStore\n\t);\n\tconst isLargeViewport = useViewportMatch( 'medium' );\n\tconst isWideAligned = includes( [ 'wide', 'full' ], align );\n\tconst [\n\t\t{ loadedNaturalWidth, loadedNaturalHeight },\n\t\tsetLoadedNaturalSize,\n\t] = useState( {} );\n\tconst [ isEditingImage, setIsEditingImage ] = useState( false );\n\tconst [ externalBlob, setExternalBlob ] = useState();\n\tconst clientWidth = useClientWidth( containerRef, [ align ] );\n\tconst isResizable = allowResize && ! ( isWideAligned && isLargeViewport );\n\tconst imageSizeOptions = map(\n\t\tfilter( imageSizes, ( { slug } ) =>\n\t\t\tget( image, [ 'media_details', 'sizes', slug, 'source_url' ] )\n\t\t),\n\t\t( { name, slug } ) => ( { value: slug, label: name } )\n\t);\n\n\t// If an image is externally hosted, try to fetch the image data. This may\n\t// fail if the image host doesn't allow CORS with the domain. If it works,\n\t// we can enable a button in the toolbar to upload the image.\n\tuseEffect( () => {\n\t\tif ( ! isExternalImage( id, url ) || ! isSelected || externalBlob ) {\n\t\t\treturn;\n\t\t}\n\n\t\twindow\n\t\t\t.fetch( url )\n\t\t\t.then( ( response ) => response.blob() )\n\t\t\t.then( ( blob ) => setExternalBlob( blob ) )\n\t\t\t// Do nothing, cannot upload.\n\t\t\t.catch( () => {} );\n\t}, [ id, url, isSelected, externalBlob ] );\n\n\t// Focus the caption after inserting an image from the placeholder. This is\n\t// done to preserve the behaviour of focussing the first tabbable element\n\t// when a block is mounted. Previously, the image block would remount when\n\t// the placeholder is removed. Maybe this behaviour could be removed.\n\tuseEffect( () => {\n\t\tif ( url && ! prevUrl && isSelected ) {\n\t\t\tcaptionRef.current.focus();\n\t\t}\n\t}, [ url, prevUrl ] );\n\n\t// Get naturalWidth and naturalHeight from image ref, and fall back to loaded natural\n\t// width and height. This resolves an issue in Safari where the loaded natural\n\t// witdth and height is otherwise lost when switching between alignments.\n\t// See: https://github.com/WordPress/gutenberg/pull/37210.\n\tconst { naturalWidth, naturalHeight } = useMemo( () => {\n\t\treturn {\n\t\t\tnaturalWidth:\n\t\t\t\timageRef.current?.naturalWidth ||\n\t\t\t\tloadedNaturalWidth ||\n\t\t\t\tundefined,\n\t\t\tnaturalHeight:\n\t\t\t\timageRef.current?.naturalHeight ||\n\t\t\t\tloadedNaturalHeight ||\n\t\t\t\tundefined,\n\t\t};\n\t}, [\n\t\tloadedNaturalWidth,\n\t\tloadedNaturalHeight,\n\t\timageRef.current?.complete,\n\t] );\n\n\tfunction onResizeStart() {\n\t\ttoggleSelection( false );\n\t}\n\n\tfunction onResizeStop() {\n\t\ttoggleSelection( true );\n\t}\n\n\tfunction onImageError() {\n\t\t// Check if there's an embed block that handles this URL, e.g., instagram URL.\n\t\t// See: https://github.com/WordPress/gutenberg/pull/11472\n\t\tconst embedBlock = createUpgradedEmbedBlock( { attributes: { url } } );\n\t\tconst shouldReplace = undefined !== embedBlock;\n\n\t\tif ( shouldReplace ) {\n\t\t\tonReplace( embedBlock );\n\t\t}\n\n\t\tonImageLoadError( shouldReplace );\n\t}\n\n\tfunction onSetHref( props ) {\n\t\tsetAttributes( props );\n\t}\n\n\tfunction onSetTitle( value ) {\n\t\t// This is the HTML title attribute, separate from the media object\n\t\t// title.\n\t\tsetAttributes( { title: value } );\n\t}\n\n\tfunction updateAlt( newAlt ) {\n\t\tsetAttributes( { alt: newAlt } );\n\t}\n\n\tfunction updateImage( newSizeSlug ) {\n\t\tconst newUrl = get( image, [\n\t\t\t'media_details',\n\t\t\t'sizes',\n\t\t\tnewSizeSlug,\n\t\t\t'source_url',\n\t\t] );\n\t\tif ( ! newUrl ) {\n\t\t\treturn null;\n\t\t}\n\n\t\tsetAttributes( {\n\t\t\turl: newUrl,\n\t\t\twidth: undefined,\n\t\t\theight: undefined,\n\t\t\tsizeSlug: newSizeSlug,\n\t\t} );\n\t}\n\n\tfunction uploadExternal() {\n\t\tmediaUpload( {\n\t\t\tfilesList: [ externalBlob ],\n\t\t\tonFileChange( [ img ] ) {\n\t\t\t\tonSelectImage( img );\n\n\t\t\t\tif ( isBlobURL( img.url ) ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tsetExternalBlob();\n\t\t\t\tcreateSuccessNotice( __( 'Image uploaded.' ), {\n\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t} );\n\t\t\t},\n\t\t\tallowedTypes: ALLOWED_MEDIA_TYPES,\n\t\t\tonError( message ) {\n\t\t\t\tcreateErrorNotice( message, { type: 'snackbar' } );\n\t\t\t},\n\t\t} );\n\t}\n\n\tfunction updateAlignment( nextAlign ) {\n\t\tconst extraUpdatedAttributes = [ 'wide', 'full' ].includes( nextAlign )\n\t\t\t? { width: undefined, height: undefined }\n\t\t\t: {};\n\t\tsetAttributes( {\n\t\t\t...extraUpdatedAttributes,\n\t\t\talign: nextAlign,\n\t\t} );\n\t}\n\n\tuseEffect( () => {\n\t\tif ( ! isSelected ) {\n\t\t\tsetIsEditingImage( false );\n\t\t}\n\t\tif ( isSelected && isMediaDestroyed( id ) ) {\n\t\t\tonImageLoadError();\n\t\t}\n\t}, [ isSelected ] );\n\n\tconst canEditImage = id && naturalWidth && naturalHeight && imageEditing;\n\tconst allowCrop = ! multiImageSelection && canEditImage && ! isEditingImage;\n\n\tfunction switchToCover() {\n\t\treplaceBlocks(\n\t\t\tclientId,\n\t\t\tswitchToBlockType( getBlock( clientId ), 'core/cover' )\n\t\t);\n\t}\n\n\tconst controls = (\n\t\t<>\n\t\t\t<BlockControls group=\"block\">\n\t\t\t\t<BlockAlignmentControl\n\t\t\t\t\tvalue={ align }\n\t\t\t\t\tonChange={ updateAlignment }\n\t\t\t\t/>\n\t\t\t\t{ ! multiImageSelection && ! isEditingImage && (\n\t\t\t\t\t<ImageURLInputUI\n\t\t\t\t\t\turl={ href || '' }\n\t\t\t\t\t\tonChangeUrl={ onSetHref }\n\t\t\t\t\t\tlinkDestination={ linkDestination }\n\t\t\t\t\t\tmediaUrl={ ( image && image.source_url ) || url }\n\t\t\t\t\t\tmediaLink={ image && image.link }\n\t\t\t\t\t\tlinkTarget={ linkTarget }\n\t\t\t\t\t\tlinkClass={ linkClass }\n\t\t\t\t\t\trel={ rel }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t\t{ allowCrop && (\n\t\t\t\t\t<ToolbarButton\n\t\t\t\t\t\tonClick={ () => setIsEditingImage( true ) }\n\t\t\t\t\t\ticon={ crop }\n\t\t\t\t\t\tlabel={ __( 'Crop' ) }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t\t{ externalBlob && (\n\t\t\t\t\t<ToolbarButton\n\t\t\t\t\t\tonClick={ uploadExternal }\n\t\t\t\t\t\ticon={ upload }\n\t\t\t\t\t\tlabel={ __( 'Upload external image' ) }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t\t{ ! multiImageSelection && canInsertCover && (\n\t\t\t\t\t<ToolbarButton\n\t\t\t\t\t\ticon={ overlayText }\n\t\t\t\t\t\tlabel={ __( 'Add text over image' ) }\n\t\t\t\t\t\tonClick={ switchToCover }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t</BlockControls>\n\t\t\t{ ! multiImageSelection && ! isEditingImage && (\n\t\t\t\t<BlockControls group=\"other\">\n\t\t\t\t\t<MediaReplaceFlow\n\t\t\t\t\t\tmediaId={ id }\n\t\t\t\t\t\tmediaURL={ url }\n\t\t\t\t\t\tallowedTypes={ ALLOWED_MEDIA_TYPES }\n\t\t\t\t\t\taccept=\"image/*\"\n\t\t\t\t\t\tonSelect={ onSelectImage }\n\t\t\t\t\t\tonSelectURL={ onSelectURL }\n\t\t\t\t\t\tonError={ onUploadError }\n\t\t\t\t\t\tonCloseModal={ onCloseModal }\n\t\t\t\t\t/>\n\t\t\t\t</BlockControls>\n\t\t\t) }\n\t\t\t<InspectorControls>\n\t\t\t\t<PanelBody title={ __( 'Image settings' ) }>\n\t\t\t\t\t{ ! multiImageSelection && (\n\t\t\t\t\t\t<TextareaControl\n\t\t\t\t\t\t\tlabel={ __( 'Alt text (alternative text)' ) }\n\t\t\t\t\t\t\tvalue={ alt }\n\t\t\t\t\t\t\tonChange={ updateAlt }\n\t\t\t\t\t\t\thelp={\n\t\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t\t<ExternalLink href=\"https://www.w3.org/WAI/tutorials/images/decision-tree\">\n\t\t\t\t\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t\t\t\t\t'Describe the purpose of the image'\n\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t</ExternalLink>\n\t\t\t\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t\t\t\t'Leave empty if the image is purely decorative.'\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t\t<ImageSizeControl\n\t\t\t\t\t\tonChangeImage={ updateImage }\n\t\t\t\t\t\tonChange={ ( value ) => setAttributes( value ) }\n\t\t\t\t\t\tslug={ sizeSlug }\n\t\t\t\t\t\twidth={ width }\n\t\t\t\t\t\theight={ height }\n\t\t\t\t\t\timageSizeOptions={ imageSizeOptions }\n\t\t\t\t\t\tisResizable={ isResizable }\n\t\t\t\t\t\timageWidth={ naturalWidth }\n\t\t\t\t\t\timageHeight={ naturalHeight }\n\t\t\t\t\t/>\n\t\t\t\t</PanelBody>\n\t\t\t</InspectorControls>\n\t\t\t<InspectorControls __experimentalGroup=\"advanced\">\n\t\t\t\t<TextControl\n\t\t\t\t\tlabel={ __( 'Title attribute' ) }\n\t\t\t\t\tvalue={ title || '' }\n\t\t\t\t\tonChange={ onSetTitle }\n\t\t\t\t\thelp={\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t\t'Describe the role of this image on the page.'\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t<ExternalLink href=\"https://www.w3.org/TR/html52/dom.html#the-title-attribute\">\n\t\t\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t\t\t'(Note: many devices and browsers do not display this text.)'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t</ExternalLink>\n\t\t\t\t\t\t</>\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t</InspectorControls>\n\t\t</>\n\t);\n\n\tconst filename = getFilename( url );\n\tlet defaultedAlt;\n\n\tif ( alt ) {\n\t\tdefaultedAlt = alt;\n\t} else if ( filename ) {\n\t\tdefaultedAlt = sprintf(\n\t\t\t/* translators: %s: file name */\n\t\t\t__( 'This image has an empty alt attribute; its file name is %s' ),\n\t\t\tfilename\n\t\t);\n\t} else {\n\t\tdefaultedAlt = __( 'This image has an empty alt attribute' );\n\t}\n\n\tlet img = (\n\t\t// Disable reason: Image itself is not meant to be interactive, but\n\t\t// should direct focus to block.\n\t\t/* eslint-disable jsx-a11y/no-noninteractive-element-interactions, jsx-a11y/click-events-have-key-events */\n\t\t<>\n\t\t\t<img\n\t\t\t\tsrc={ temporaryURL || url }\n\t\t\t\talt={ defaultedAlt }\n\t\t\t\tonError={ () => onImageError() }\n\t\t\t\tonLoad={ ( event ) => {\n\t\t\t\t\tsetLoadedNaturalSize( {\n\t\t\t\t\t\tloadedNaturalWidth: event.target?.naturalWidth,\n\t\t\t\t\t\tloadedNaturalHeight: event.target?.naturalHeight,\n\t\t\t\t\t} );\n\t\t\t\t} }\n\t\t\t\tref={ imageRef }\n\t\t\t/>\n\t\t\t{ temporaryURL && <Spinner /> }\n\t\t</>\n\t\t/* eslint-enable jsx-a11y/no-noninteractive-element-interactions, jsx-a11y/click-events-have-key-events */\n\t);\n\n\tlet imageWidthWithinContainer;\n\tlet imageHeightWithinContainer;\n\n\tif ( clientWidth && naturalWidth && naturalHeight ) {\n\t\tconst exceedMaxWidth = naturalWidth > clientWidth;\n\t\tconst ratio = naturalHeight / naturalWidth;\n\t\timageWidthWithinContainer = exceedMaxWidth ? clientWidth : naturalWidth;\n\t\timageHeightWithinContainer = exceedMaxWidth\n\t\t\t? clientWidth * ratio\n\t\t\t: naturalHeight;\n\t}\n\n\tif ( canEditImage && isEditingImage ) {\n\t\timg = (\n\t\t\t<ImageEditor\n\t\t\t\turl={ url }\n\t\t\t\twidth={ width }\n\t\t\t\theight={ height }\n\t\t\t\tclientWidth={ clientWidth }\n\t\t\t\tnaturalHeight={ naturalHeight }\n\t\t\t\tnaturalWidth={ naturalWidth }\n\t\t\t/>\n\t\t);\n\t} else if ( ! isResizable || ! imageWidthWithinContainer ) {\n\t\timg = <div style={ { width, height } }>{ img }</div>;\n\t} else {\n\t\tconst currentWidth = width || imageWidthWithinContainer;\n\t\tconst currentHeight = height || imageHeightWithinContainer;\n\n\t\tconst ratio = naturalWidth / naturalHeight;\n\t\tconst minWidth =\n\t\t\tnaturalWidth < naturalHeight ? MIN_SIZE : MIN_SIZE * ratio;\n\t\tconst minHeight =\n\t\t\tnaturalHeight < naturalWidth ? MIN_SIZE : MIN_SIZE / ratio;\n\n\t\t// With the current implementation of ResizableBox, an image needs an\n\t\t// explicit pixel value for the max-width. In absence of being able to\n\t\t// set the content-width, this max-width is currently dictated by the\n\t\t// vanilla editor style. The following variable adds a buffer to this\n\t\t// vanilla style, so 3rd party themes have some wiggleroom. This does,\n\t\t// in most cases, allow you to scale the image beyond the width of the\n\t\t// main column, though not infinitely.\n\t\t// @todo It would be good to revisit this once a content-width variable\n\t\t// becomes available.\n\t\tconst maxWidthBuffer = maxWidth * 2.5;\n\n\t\tlet showRightHandle = false;\n\t\tlet showLeftHandle = false;\n\n\t\t/* eslint-disable no-lonely-if */\n\t\t// See https://github.com/WordPress/gutenberg/issues/7584.\n\t\tif ( align === 'center' ) {\n\t\t\t// When the image is centered, show both handles.\n\t\t\tshowRightHandle = true;\n\t\t\tshowLeftHandle = true;\n\t\t} else if ( isRTL() ) {\n\t\t\t// In RTL mode the image is on the right by default.\n\t\t\t// Show the right handle and hide the left handle only when it is\n\t\t\t// aligned left. Otherwise always show the left handle.\n\t\t\tif ( align === 'left' ) {\n\t\t\t\tshowRightHandle = true;\n\t\t\t} else {\n\t\t\t\tshowLeftHandle = true;\n\t\t\t}\n\t\t} else {\n\t\t\t// Show the left handle and hide the right handle only when the\n\t\t\t// image is aligned right. Otherwise always show the right handle.\n\t\t\tif ( align === 'right' ) {\n\t\t\t\tshowLeftHandle = true;\n\t\t\t} else {\n\t\t\t\tshowRightHandle = true;\n\t\t\t}\n\t\t}\n\t\t/* eslint-enable no-lonely-if */\n\n\t\timg = (\n\t\t\t<ResizableBox\n\t\t\t\tsize={ {\n\t\t\t\t\twidth: width ?? 'auto',\n\t\t\t\t\theight: height ?? 'auto',\n\t\t\t\t} }\n\t\t\t\tshowHandle={ isSelected }\n\t\t\t\tminWidth={ minWidth }\n\t\t\t\tmaxWidth={ maxWidthBuffer }\n\t\t\t\tminHeight={ minHeight }\n\t\t\t\tmaxHeight={ maxWidthBuffer / ratio }\n\t\t\t\tlockAspectRatio\n\t\t\t\tenable={ {\n\t\t\t\t\ttop: false,\n\t\t\t\t\tright: showRightHandle,\n\t\t\t\t\tbottom: true,\n\t\t\t\t\tleft: showLeftHandle,\n\t\t\t\t} }\n\t\t\t\tonResizeStart={ onResizeStart }\n\t\t\t\tonResizeStop={ ( event, direction, elt, delta ) => {\n\t\t\t\t\tonResizeStop();\n\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\twidth: parseInt( currentWidth + delta.width, 10 ),\n\t\t\t\t\t\theight: parseInt( currentHeight + delta.height, 10 ),\n\t\t\t\t\t} );\n\t\t\t\t} }\n\t\t\t>\n\t\t\t\t{ img }\n\t\t\t</ResizableBox>\n\t\t);\n\t}\n\n\treturn (\n\t\t<ImageEditingProvider\n\t\t\tid={ id }\n\t\t\turl={ url }\n\t\t\tnaturalWidth={ naturalWidth }\n\t\t\tnaturalHeight={ naturalHeight }\n\t\t\tclientWidth={ clientWidth }\n\t\t\tonSaveImage={ ( imageAttributes ) =>\n\t\t\t\tsetAttributes( imageAttributes )\n\t\t\t}\n\t\t\tisEditing={ isEditingImage }\n\t\t\tonFinishEditing={ () => setIsEditingImage( false ) }\n\t\t>\n\t\t\t{ /* Hide controls during upload to avoid component remount,\n\t\t\t\twhich causes duplicated image upload. */ }\n\t\t\t{ ! temporaryURL && controls }\n\t\t\t{ img }\n\t\t\t{ ( ! RichText.isEmpty( caption ) || isSelected ) && (\n\t\t\t\t<RichText\n\t\t\t\t\tref={ captionRef }\n\t\t\t\t\ttagName=\"figcaption\"\n\t\t\t\t\taria-label={ __( 'Image caption text' ) }\n\t\t\t\t\tplaceholder={ __( 'Add caption' ) }\n\t\t\t\t\tvalue={ caption }\n\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\tsetAttributes( { caption: value } )\n\t\t\t\t\t}\n\t\t\t\t\tinlineToolbar\n\t\t\t\t\t__unstableOnSplitAtEnd={ () =>\n\t\t\t\t\t\tinsertBlocksAfter( createBlock( 'core/paragraph' ) )\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t) }\n\t\t</ImageEditingProvider>\n\t);\n}\n"]}
|
package/build/index.js
CHANGED
|
@@ -9,6 +9,8 @@ var _blocks = require("@wordpress/blocks");
|
|
|
9
9
|
|
|
10
10
|
var archives = _interopRequireWildcard(require("./archives"));
|
|
11
11
|
|
|
12
|
+
var avatar = _interopRequireWildcard(require("./avatar"));
|
|
13
|
+
|
|
12
14
|
var audio = _interopRequireWildcard(require("./audio"));
|
|
13
15
|
|
|
14
16
|
var button = _interopRequireWildcard(require("./button"));
|
|
@@ -75,6 +77,8 @@ var latestPosts = _interopRequireWildcard(require("./latest-posts"));
|
|
|
75
77
|
|
|
76
78
|
var list = _interopRequireWildcard(require("./list"));
|
|
77
79
|
|
|
80
|
+
var listItem = _interopRequireWildcard(require("./list-item"));
|
|
81
|
+
|
|
78
82
|
var logInOut = _interopRequireWildcard(require("./loginout"));
|
|
79
83
|
|
|
80
84
|
var mediaText = _interopRequireWildcard(require("./media-text"));
|
|
@@ -137,6 +141,8 @@ var pullquote = _interopRequireWildcard(require("./pullquote"));
|
|
|
137
141
|
|
|
138
142
|
var query = _interopRequireWildcard(require("./query"));
|
|
139
143
|
|
|
144
|
+
var queryNoResults = _interopRequireWildcard(require("./query-no-results"));
|
|
145
|
+
|
|
140
146
|
var queryPagination = _interopRequireWildcard(require("./query-pagination"));
|
|
141
147
|
|
|
142
148
|
var queryPaginationNext = _interopRequireWildcard(require("./query-pagination-next"));
|
|
@@ -234,7 +240,7 @@ const registerBlock = block => {
|
|
|
234
240
|
|
|
235
241
|
const __experimentalGetCoreBlocks = () => [// Common blocks are grouped at the top to prioritize their display
|
|
236
242
|
// in various contexts — like the inserter and auto-complete components.
|
|
237
|
-
paragraph, image, heading, gallery, list, quote, // Register all remaining core blocks.
|
|
243
|
+
paragraph, image, heading, gallery, list, listItem, quote, // Register all remaining core blocks.
|
|
238
244
|
archives, audio, button, buttons, calendar, categories, window.wp && window.wp.oldEditor ? classic : null, // Only add the classic block in WP Context.
|
|
239
245
|
code, column, columns, cover, embed, file, group, html, latestComments, latestPosts, mediaText, missing, more, nextpage, pageList, pattern, preformatted, pullquote, reusableBlock, rss, search, separator, shortcode, socialLink, socialLinks, spacer, table, // tableOfContents,
|
|
240
246
|
tagCloud, textColumns, verse, video, // theme blocks
|
|
@@ -287,7 +293,7 @@ const __experimentalRegisterExperimentalCoreBlocks = process.env.IS_GUTENBERG_PL
|
|
|
287
293
|
enableFSEBlocks
|
|
288
294
|
} = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
289
295
|
[// Experimental blocks.
|
|
290
|
-
homeLink, postAuthorName, // Full Site Editing blocks.
|
|
296
|
+
avatar, homeLink, postAuthorName, queryNoResults, // Full Site Editing blocks.
|
|
291
297
|
...(enableFSEBlocks ? [commentAuthorAvatar, commentAuthorName, commentContent, commentDate, commentEditLink, commentReplyLink, commentTemplate, commentsQueryLoop, commentsPagination, commentsPaginationNext, commentsPaginationNumbers, commentsPaginationPrevious, navigationArea, postComment, postCommentsCount, postCommentsForm, postCommentsLink, readMore] : [])].forEach(registerBlock);
|
|
292
298
|
} : undefined;
|
|
293
299
|
|
package/build/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-library/src/index.js"],"names":["registerBlock","block","metadata","settings","name","__experimentalGetCoreBlocks","paragraph","image","heading","gallery","list","quote","archives","audio","button","buttons","calendar","categories","window","wp","oldEditor","classic","code","column","columns","cover","embed","file","group","html","latestComments","latestPosts","mediaText","missing","more","nextpage","pageList","pattern","preformatted","pullquote","reusableBlock","rss","search","separator","shortcode","socialLink","socialLinks","spacer","table","tagCloud","textColumns","verse","video","navigation","navigationLink","navigationSubmenu","siteLogo","siteTitle","siteTagline","query","templatePart","postTitle","postExcerpt","postFeaturedImage","postContent","postAuthor","postDate","postTerms","postNavigationLink","postTemplate","queryPagination","queryPaginationNext","queryPaginationNumbers","queryPaginationPrevious","postComments","logInOut","termDescription","queryTitle","postAuthorBiography","registerCoreBlocks","blocks","forEach","__experimentalRegisterExperimentalCoreBlocks","process","env","IS_GUTENBERG_PLUGIN","enableFSEBlocks","homeLink","postAuthorName","commentAuthorAvatar","commentAuthorName","commentContent","commentDate","commentEditLink","commentReplyLink","commentTemplate","commentsQueryLoop","commentsPagination","commentsPaginationNext","commentsPaginationNumbers","commentsPaginationPrevious","navigationArea","postComment","postCommentsCount","postCommentsForm","postCommentsLink","readMore","undefined"],"mappings":";;;;;;;AAGA;;AAWA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;AAvGA;AACA;AACA;;AASA;AACA;AACA;;AA4FA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMA,aAAa,GAAKC,KAAF,IAAa;AAClC,MAAK,CAAEA,KAAP,EAAe;AACd;AACA;;AACD,QAAM;AAAEC,IAAAA,QAAF;AAAYC,IAAAA,QAAZ;AAAsBC,IAAAA;AAAtB,MAA+BH,KAArC;AACA,iCAAmB;AAAEG,IAAAA,IAAF;AAAQ,OAAGF;AAAX,GAAnB,EAA0CC,QAA1C;AACA,CAND;AAQA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACO,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AvEgD,EAwEhDC,uBAxEgD,EAyEhDC,YAzEgD,EA0EhDC,QA1EgD,EA2EhDC,eA3EgD,EA4EhDC,UA5EgD,EA6EhDC,mBA7EgD,CAA1C;AAgFP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;AACO,MAAMC,kBAAkB,GAAG,YAE7B;AAAA,MADJC,MACI,uEADK3E,2BAA2B,EAChC;AACJ2E,EAAAA,MAAM,CAACC,OAAP,CAAgBjF,aAAhB;AAEA,mCAAqBM,SAAS,CAACF,IAA/B;;AACA,MAAKc,MAAM,CAACC,EAAP,IAAaD,MAAM,CAACC,EAAP,CAAUC,SAA5B,EAAwC;AACvC,+CAA+BC,OAAO,CAACjB,IAAvC;AACA;;AACD,8CAAgC6B,OAAO,CAAC7B,IAAxC;AACA,oCAAsBwB,KAAK,CAACxB,IAA5B;AACA,CAXM;AAaP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;AACO,MAAM8E,4CAA4C,GAAGC,OAAO,CAACC,GAAR,CAC1DC,mBAD0D,GAEzD,YAAgC;AAAA,MAA9B;AAAEC,IAAAA;AAAF,GAA8B,uEAAR,EAAQ;AAChC,GACC;AACAC,EAAAA,QAFD,EAGCC,cAHD,EAKC;AACA,MAAKF,eAAe,GACjB,CACAG,mBADA,EAEAC,iBAFA,EAGAC,cAHA,EAIAC,WAJA,EAKAC,eALA,EAMAC,gBANA,EAOAC,eAPA,EAQAC,iBARA,EASAC,kBATA,EAUAC,sBAVA,EAWAC,yBAXA,EAYAC,0BAZA,EAaAC,cAbA,EAcAC,WAdA,EAeAC,iBAfA,EAgBAC,gBAhBA,EAiBAC,gBAjBA,EAkBAC,QAlBA,CADiB,GAqBjB,EArBH,CAND,EA4BEzB,OA5BF,CA4BWjF,aA5BX;AA6BC,CAhCwD,GAiCzD2G,SAjCI","sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tregisterBlockType,\n\tsetDefaultBlockName,\n\tsetFreeformContentHandlerName,\n\tsetUnregisteredTypeHandlerName,\n\tsetGroupingBlockName,\n} from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport * as archives from './archives';\nimport * as audio from './audio';\nimport * as button from './button';\nimport * as buttons from './buttons';\nimport * as calendar from './calendar';\nimport * as categories from './categories';\nimport * as classic from './freeform';\nimport * as code from './code';\nimport * as column from './column';\nimport * as columns from './columns';\nimport * as commentAuthorAvatar from './comment-author-avatar';\nimport * as commentAuthorName from './comment-author-name';\nimport * as commentContent from './comment-content';\nimport * as commentDate from './comment-date';\nimport * as commentEditLink from './comment-edit-link';\nimport * as commentReplyLink from './comment-reply-link';\nimport * as commentTemplate from './comment-template';\nimport * as commentsPaginationPrevious from './comments-pagination-previous';\nimport * as commentsQueryLoop from './comments-query-loop';\nimport * as commentsPagination from './comments-pagination';\nimport * as commentsPaginationNext from './comments-pagination-next';\nimport * as commentsPaginationNumbers from './comments-pagination-numbers';\nimport * as cover from './cover';\nimport * as embed from './embed';\nimport * as file from './file';\nimport * as gallery from './gallery';\nimport * as group from './group';\nimport * as heading from './heading';\nimport * as homeLink from './home-link';\nimport * as html from './html';\nimport * as image from './image';\nimport * as latestComments from './latest-comments';\nimport * as latestPosts from './latest-posts';\nimport * as list from './list';\nimport * as logInOut from './loginout';\nimport * as mediaText from './media-text';\nimport * as missing from './missing';\nimport * as more from './more';\nimport * as navigation from './navigation';\nimport * as navigationArea from './navigation-area';\nimport * as navigationLink from './navigation-link';\nimport * as navigationSubmenu from './navigation-submenu';\nimport * as nextpage from './nextpage';\nimport * as pattern from './pattern';\nimport * as pageList from './page-list';\nimport * as paragraph from './paragraph';\nimport * as postAuthor from './post-author';\nimport * as postAuthorName from './post-author-name';\nimport * as postAuthorBiography from './post-author-biography';\nimport * as postComment from './post-comment';\nimport * as postComments from './post-comments';\nimport * as postCommentsCount from './post-comments-count';\nimport * as postCommentsForm from './post-comments-form';\nimport * as postCommentsLink from './post-comments-link';\nimport * as postContent from './post-content';\nimport * as postDate from './post-date';\nimport * as postExcerpt from './post-excerpt';\nimport * as postFeaturedImage from './post-featured-image';\nimport * as postNavigationLink from './post-navigation-link';\nimport * as postTemplate from './post-template';\nimport * as postTerms from './post-terms';\nimport * as postTitle from './post-title';\nimport * as preformatted from './preformatted';\nimport * as pullquote from './pullquote';\nimport * as query from './query';\nimport * as queryPagination from './query-pagination';\nimport * as queryPaginationNext from './query-pagination-next';\nimport * as queryPaginationNumbers from './query-pagination-numbers';\nimport * as queryPaginationPrevious from './query-pagination-previous';\nimport * as queryTitle from './query-title';\nimport * as quote from './quote';\nimport * as reusableBlock from './block';\nimport * as readMore from './read-more';\nimport * as rss from './rss';\nimport * as search from './search';\nimport * as separator from './separator';\nimport * as shortcode from './shortcode';\nimport * as siteLogo from './site-logo';\nimport * as siteTagline from './site-tagline';\nimport * as siteTitle from './site-title';\nimport * as socialLink from './social-link';\nimport * as socialLinks from './social-links';\nimport * as spacer from './spacer';\nimport * as table from './table';\nimport * as tagCloud from './tag-cloud';\nimport * as templatePart from './template-part';\nimport * as termDescription from './term-description';\nimport * as textColumns from './text-columns';\nimport * as verse from './verse';\nimport * as video from './video';\n\n/**\n * Function to register an individual block.\n *\n * @param {Object} block The block to be registered.\n *\n */\nconst registerBlock = ( block ) => {\n\tif ( ! block ) {\n\t\treturn;\n\t}\n\tconst { metadata, settings, name } = block;\n\tregisterBlockType( { name, ...metadata }, settings );\n};\n\n/**\n * Function to get all the core blocks in an array.\n *\n * @example\n * ```js\n * import { __experimentalGetCoreBlocks } from '@wordpress/block-library';\n *\n * const coreBlocks = __experimentalGetCoreBlocks();\n * ```\n */\nexport const __experimentalGetCoreBlocks = () => [\n\t// Common blocks are grouped at the top to prioritize their display\n\t// in various contexts — like the inserter and auto-complete components.\n\tparagraph,\n\timage,\n\theading,\n\tgallery,\n\tlist,\n\tquote,\n\n\t// Register all remaining core blocks.\n\tarchives,\n\taudio,\n\tbutton,\n\tbuttons,\n\tcalendar,\n\tcategories,\n\twindow.wp && window.wp.oldEditor ? classic : null, // Only add the classic block in WP Context.\n\tcode,\n\tcolumn,\n\tcolumns,\n\tcover,\n\tembed,\n\tfile,\n\tgroup,\n\thtml,\n\tlatestComments,\n\tlatestPosts,\n\tmediaText,\n\tmissing,\n\tmore,\n\tnextpage,\n\tpageList,\n\tpattern,\n\tpreformatted,\n\tpullquote,\n\treusableBlock,\n\trss,\n\tsearch,\n\tseparator,\n\tshortcode,\n\tsocialLink,\n\tsocialLinks,\n\tspacer,\n\ttable,\n\t// tableOfContents,\n\ttagCloud,\n\ttextColumns,\n\tverse,\n\tvideo,\n\n\t// theme blocks\n\tnavigation,\n\tnavigationLink,\n\tnavigationSubmenu,\n\tsiteLogo,\n\tsiteTitle,\n\tsiteTagline,\n\tquery,\n\ttemplatePart,\n\tpostTitle,\n\tpostExcerpt,\n\tpostFeaturedImage,\n\tpostContent,\n\tpostAuthor,\n\tpostDate,\n\tpostTerms,\n\tpostNavigationLink,\n\tpostTemplate,\n\tqueryPagination,\n\tqueryPaginationNext,\n\tqueryPaginationNumbers,\n\tqueryPaginationPrevious,\n\tpostComments,\n\tlogInOut,\n\ttermDescription,\n\tqueryTitle,\n\tpostAuthorBiography,\n];\n\n/**\n * Function to register core blocks provided by the block editor.\n *\n * @param {Array} blocks An optional array of the core blocks being registered.\n *\n * @example\n * ```js\n * import { registerCoreBlocks } from '@wordpress/block-library';\n *\n * registerCoreBlocks();\n * ```\n */\nexport const registerCoreBlocks = (\n\tblocks = __experimentalGetCoreBlocks()\n) => {\n\tblocks.forEach( registerBlock );\n\n\tsetDefaultBlockName( paragraph.name );\n\tif ( window.wp && window.wp.oldEditor ) {\n\t\tsetFreeformContentHandlerName( classic.name );\n\t}\n\tsetUnregisteredTypeHandlerName( missing.name );\n\tsetGroupingBlockName( group.name );\n};\n\n/**\n * Function to register experimental core blocks depending on editor settings.\n *\n * @param {boolean} enableFSEBlocks Whether to enable the full site editing blocks.\n * @example\n * ```js\n * import { __experimentalRegisterExperimentalCoreBlocks } from '@wordpress/block-library';\n *\n * __experimentalRegisterExperimentalCoreBlocks( settings );\n * ```\n */\nexport const __experimentalRegisterExperimentalCoreBlocks = process.env\n\t.IS_GUTENBERG_PLUGIN\n\t? ( { enableFSEBlocks } = {} ) => {\n\t\t\t[\n\t\t\t\t// Experimental blocks.\n\t\t\t\thomeLink,\n\t\t\t\tpostAuthorName,\n\n\t\t\t\t// Full Site Editing blocks.\n\t\t\t\t...( enableFSEBlocks\n\t\t\t\t\t? [\n\t\t\t\t\t\t\tcommentAuthorAvatar,\n\t\t\t\t\t\t\tcommentAuthorName,\n\t\t\t\t\t\t\tcommentContent,\n\t\t\t\t\t\t\tcommentDate,\n\t\t\t\t\t\t\tcommentEditLink,\n\t\t\t\t\t\t\tcommentReplyLink,\n\t\t\t\t\t\t\tcommentTemplate,\n\t\t\t\t\t\t\tcommentsQueryLoop,\n\t\t\t\t\t\t\tcommentsPagination,\n\t\t\t\t\t\t\tcommentsPaginationNext,\n\t\t\t\t\t\t\tcommentsPaginationNumbers,\n\t\t\t\t\t\t\tcommentsPaginationPrevious,\n\t\t\t\t\t\t\tnavigationArea,\n\t\t\t\t\t\t\tpostComment,\n\t\t\t\t\t\t\tpostCommentsCount,\n\t\t\t\t\t\t\tpostCommentsForm,\n\t\t\t\t\t\t\tpostCommentsLink,\n\t\t\t\t\t\t\treadMore,\n\t\t\t\t\t ]\n\t\t\t\t\t: [] ),\n\t\t\t].forEach( registerBlock );\n\t }\n\t: undefined;\n"]}
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-library/src/index.js"],"names":["registerBlock","block","metadata","settings","name","__experimentalGetCoreBlocks","paragraph","image","heading","gallery","list","listItem","quote","archives","audio","button","buttons","calendar","categories","window","wp","oldEditor","classic","code","column","columns","cover","embed","file","group","html","latestComments","latestPosts","mediaText","missing","more","nextpage","pageList","pattern","preformatted","pullquote","reusableBlock","rss","search","separator","shortcode","socialLink","socialLinks","spacer","table","tagCloud","textColumns","verse","video","navigation","navigationLink","navigationSubmenu","siteLogo","siteTitle","siteTagline","query","templatePart","postTitle","postExcerpt","postFeaturedImage","postContent","postAuthor","postDate","postTerms","postNavigationLink","postTemplate","queryPagination","queryPaginationNext","queryPaginationNumbers","queryPaginationPrevious","postComments","logInOut","termDescription","queryTitle","postAuthorBiography","registerCoreBlocks","blocks","forEach","__experimentalRegisterExperimentalCoreBlocks","process","env","IS_GUTENBERG_PLUGIN","enableFSEBlocks","avatar","homeLink","postAuthorName","queryNoResults","commentAuthorAvatar","commentAuthorName","commentContent","commentDate","commentEditLink","commentReplyLink","commentTemplate","commentsQueryLoop","commentsPagination","commentsPaginationNext","commentsPaginationNumbers","commentsPaginationPrevious","navigationArea","postComment","postCommentsCount","postCommentsForm","postCommentsLink","readMore","undefined"],"mappings":";;;;;;;AAGA;;AAWA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;AA1GA;AACA;AACA;;AASA;AACA;AACA;;AA+FA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMA,aAAa,GAAKC,KAAF,IAAa;AAClC,MAAK,CAAEA,KAAP,EAAe;AACd;AACA;;AACD,QAAM;AAAEC,IAAAA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aAC,cAbA,EAcAC,WAdA,EAeAC,iBAfA,EAgBAC,gBAhBA,EAiBAC,gBAjBA,EAkBAC,QAlBA,CADiB,GAqBjB,EArBH,CAPD,EA6BE3B,OA7BF,CA6BWlF,aA7BX;AA8BC,CAjCwD,GAkCzD8G,SAlCI","sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tregisterBlockType,\n\tsetDefaultBlockName,\n\tsetFreeformContentHandlerName,\n\tsetUnregisteredTypeHandlerName,\n\tsetGroupingBlockName,\n} from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport * as archives from './archives';\nimport * as avatar from './avatar';\nimport * as audio from './audio';\nimport * as button from './button';\nimport * as buttons from './buttons';\nimport * as calendar from './calendar';\nimport * as categories from './categories';\nimport * as classic from './freeform';\nimport * as code from './code';\nimport * as column from './column';\nimport * as columns from './columns';\nimport * as commentAuthorAvatar from './comment-author-avatar';\nimport * as commentAuthorName from './comment-author-name';\nimport * as commentContent from './comment-content';\nimport * as commentDate from './comment-date';\nimport * as commentEditLink from './comment-edit-link';\nimport * as commentReplyLink from './comment-reply-link';\nimport * as commentTemplate from './comment-template';\nimport * as commentsPaginationPrevious from './comments-pagination-previous';\nimport * as commentsQueryLoop from './comments-query-loop';\nimport * as commentsPagination from './comments-pagination';\nimport * as commentsPaginationNext from './comments-pagination-next';\nimport * as commentsPaginationNumbers from './comments-pagination-numbers';\nimport * as cover from './cover';\nimport * as embed from './embed';\nimport * as file from './file';\nimport * as gallery from './gallery';\nimport * as group from './group';\nimport * as heading from './heading';\nimport * as homeLink from './home-link';\nimport * as html from './html';\nimport * as image from './image';\nimport * as latestComments from './latest-comments';\nimport * as latestPosts from './latest-posts';\nimport * as list from './list';\nimport * as listItem from './list-item';\nimport * as logInOut from './loginout';\nimport * as mediaText from './media-text';\nimport * as missing from './missing';\nimport * as more from './more';\nimport * as navigation from './navigation';\nimport * as navigationArea from './navigation-area';\nimport * as navigationLink from './navigation-link';\nimport * as navigationSubmenu from './navigation-submenu';\nimport * as nextpage from './nextpage';\nimport * as pattern from './pattern';\nimport * as pageList from './page-list';\nimport * as paragraph from './paragraph';\nimport * as postAuthor from './post-author';\nimport * as postAuthorName from './post-author-name';\nimport * as postAuthorBiography from './post-author-biography';\nimport * as postComment from './post-comment';\nimport * as postComments from './post-comments';\nimport * as postCommentsCount from './post-comments-count';\nimport * as postCommentsForm from './post-comments-form';\nimport * as postCommentsLink from './post-comments-link';\nimport * as postContent from './post-content';\nimport * as postDate from './post-date';\nimport * as postExcerpt from './post-excerpt';\nimport * as postFeaturedImage from './post-featured-image';\nimport * as postNavigationLink from './post-navigation-link';\nimport * as postTemplate from './post-template';\nimport * as postTerms from './post-terms';\nimport * as postTitle from './post-title';\nimport * as preformatted from './preformatted';\nimport * as pullquote from './pullquote';\nimport * as query from './query';\nimport * as queryNoResults from './query-no-results';\nimport * as queryPagination from './query-pagination';\nimport * as queryPaginationNext from './query-pagination-next';\nimport * as queryPaginationNumbers from './query-pagination-numbers';\nimport * as queryPaginationPrevious from './query-pagination-previous';\nimport * as queryTitle from './query-title';\nimport * as quote from './quote';\nimport * as reusableBlock from './block';\nimport * as readMore from './read-more';\nimport * as rss from './rss';\nimport * as search from './search';\nimport * as separator from './separator';\nimport * as shortcode from './shortcode';\nimport * as siteLogo from './site-logo';\nimport * as siteTagline from './site-tagline';\nimport * as siteTitle from './site-title';\nimport * as socialLink from './social-link';\nimport * as socialLinks from './social-links';\nimport * as spacer from './spacer';\nimport * as table from './table';\nimport * as tagCloud from './tag-cloud';\nimport * as templatePart from './template-part';\nimport * as termDescription from './term-description';\nimport * as textColumns from './text-columns';\nimport * as verse from './verse';\nimport * as video from './video';\n\n/**\n * Function to register an individual block.\n *\n * @param {Object} block The block to be registered.\n *\n */\nconst registerBlock = ( block ) => {\n\tif ( ! block ) {\n\t\treturn;\n\t}\n\tconst { metadata, settings, name } = block;\n\tregisterBlockType( { name, ...metadata }, settings );\n};\n\n/**\n * Function to get all the core blocks in an array.\n *\n * @example\n * ```js\n * import { __experimentalGetCoreBlocks } from '@wordpress/block-library';\n *\n * const coreBlocks = __experimentalGetCoreBlocks();\n * ```\n */\nexport const __experimentalGetCoreBlocks = () => [\n\t// Common blocks are grouped at the top to prioritize their display\n\t// in various contexts — like the inserter and auto-complete components.\n\tparagraph,\n\timage,\n\theading,\n\tgallery,\n\tlist,\n\tlistItem,\n\tquote,\n\n\t// Register all remaining core blocks.\n\tarchives,\n\taudio,\n\tbutton,\n\tbuttons,\n\tcalendar,\n\tcategories,\n\twindow.wp && window.wp.oldEditor ? classic : null, // Only add the classic block in WP Context.\n\tcode,\n\tcolumn,\n\tcolumns,\n\tcover,\n\tembed,\n\tfile,\n\tgroup,\n\thtml,\n\tlatestComments,\n\tlatestPosts,\n\tmediaText,\n\tmissing,\n\tmore,\n\tnextpage,\n\tpageList,\n\tpattern,\n\tpreformatted,\n\tpullquote,\n\treusableBlock,\n\trss,\n\tsearch,\n\tseparator,\n\tshortcode,\n\tsocialLink,\n\tsocialLinks,\n\tspacer,\n\ttable,\n\t// tableOfContents,\n\ttagCloud,\n\ttextColumns,\n\tverse,\n\tvideo,\n\n\t// theme blocks\n\tnavigation,\n\tnavigationLink,\n\tnavigationSubmenu,\n\tsiteLogo,\n\tsiteTitle,\n\tsiteTagline,\n\tquery,\n\ttemplatePart,\n\tpostTitle,\n\tpostExcerpt,\n\tpostFeaturedImage,\n\tpostContent,\n\tpostAuthor,\n\tpostDate,\n\tpostTerms,\n\tpostNavigationLink,\n\tpostTemplate,\n\tqueryPagination,\n\tqueryPaginationNext,\n\tqueryPaginationNumbers,\n\tqueryPaginationPrevious,\n\tpostComments,\n\tlogInOut,\n\ttermDescription,\n\tqueryTitle,\n\tpostAuthorBiography,\n];\n\n/**\n * Function to register core blocks provided by the block editor.\n *\n * @param {Array} blocks An optional array of the core blocks being registered.\n *\n * @example\n * ```js\n * import { registerCoreBlocks } from '@wordpress/block-library';\n *\n * registerCoreBlocks();\n * ```\n */\nexport const registerCoreBlocks = (\n\tblocks = __experimentalGetCoreBlocks()\n) => {\n\tblocks.forEach( registerBlock );\n\n\tsetDefaultBlockName( paragraph.name );\n\tif ( window.wp && window.wp.oldEditor ) {\n\t\tsetFreeformContentHandlerName( classic.name );\n\t}\n\tsetUnregisteredTypeHandlerName( missing.name );\n\tsetGroupingBlockName( group.name );\n};\n\n/**\n * Function to register experimental core blocks depending on editor settings.\n *\n * @param {boolean} enableFSEBlocks Whether to enable the full site editing blocks.\n * @example\n * ```js\n * import { __experimentalRegisterExperimentalCoreBlocks } from '@wordpress/block-library';\n *\n * __experimentalRegisterExperimentalCoreBlocks( settings );\n * ```\n */\nexport const __experimentalRegisterExperimentalCoreBlocks = process.env\n\t.IS_GUTENBERG_PLUGIN\n\t? ( { enableFSEBlocks } = {} ) => {\n\t\t\t[\n\t\t\t\t// Experimental blocks.\n\t\t\t\tavatar,\n\t\t\t\thomeLink,\n\t\t\t\tpostAuthorName,\n\t\t\t\tqueryNoResults,\n\t\t\t\t// Full Site Editing blocks.\n\t\t\t\t...( enableFSEBlocks\n\t\t\t\t\t? [\n\t\t\t\t\t\t\tcommentAuthorAvatar,\n\t\t\t\t\t\t\tcommentAuthorName,\n\t\t\t\t\t\t\tcommentContent,\n\t\t\t\t\t\t\tcommentDate,\n\t\t\t\t\t\t\tcommentEditLink,\n\t\t\t\t\t\t\tcommentReplyLink,\n\t\t\t\t\t\t\tcommentTemplate,\n\t\t\t\t\t\t\tcommentsQueryLoop,\n\t\t\t\t\t\t\tcommentsPagination,\n\t\t\t\t\t\t\tcommentsPaginationNext,\n\t\t\t\t\t\t\tcommentsPaginationNumbers,\n\t\t\t\t\t\t\tcommentsPaginationPrevious,\n\t\t\t\t\t\t\tnavigationArea,\n\t\t\t\t\t\t\tpostComment,\n\t\t\t\t\t\t\tpostCommentsCount,\n\t\t\t\t\t\t\tpostCommentsForm,\n\t\t\t\t\t\t\tpostCommentsLink,\n\t\t\t\t\t\t\treadMore,\n\t\t\t\t\t ]\n\t\t\t\t\t: [] ),\n\t\t\t].forEach( registerBlock );\n\t }\n\t: undefined;\n"]}
|
package/build/list/index.js
CHANGED
|
@@ -17,13 +17,10 @@ var _save = _interopRequireDefault(require("./save"));
|
|
|
17
17
|
|
|
18
18
|
var _transforms = _interopRequireDefault(require("./transforms"));
|
|
19
19
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
20
|
+
var _v = _interopRequireDefault(require("./v2"));
|
|
21
|
+
|
|
22
|
+
var _window;
|
|
23
23
|
|
|
24
|
-
/**
|
|
25
|
-
* Internal dependencies
|
|
26
|
-
*/
|
|
27
24
|
const metadata = {
|
|
28
25
|
$schema: "https://schemas.wp.org/trunk/block.json",
|
|
29
26
|
apiVersion: 2,
|
|
@@ -96,7 +93,7 @@ const {
|
|
|
96
93
|
name
|
|
97
94
|
} = metadata;
|
|
98
95
|
exports.name = name;
|
|
99
|
-
const
|
|
96
|
+
const settingsV1 = {
|
|
100
97
|
icon: _icons.list,
|
|
101
98
|
example: {
|
|
102
99
|
attributes: {
|
|
@@ -123,5 +120,6 @@ const settings = {
|
|
|
123
120
|
save: _save.default,
|
|
124
121
|
deprecated: _deprecated.default
|
|
125
122
|
};
|
|
123
|
+
const settings = (_window = window) !== null && _window !== void 0 && _window.__experimentalEnableListBlockV2 ? _v.default : settingsV1;
|
|
126
124
|
exports.settings = settings;
|
|
127
125
|
//# sourceMappingURL=index.js.map
|
package/build/list/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-library/src/list/index.js"],"names":["name","metadata","
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-library/src/list/index.js"],"names":["name","metadata","settingsV1","icon","example","attributes","values","transforms","merge","attributesToMerge","edit","save","deprecated","settings","window","__experimentalEnableListBlockV2","settingsV2"],"mappings":";;;;;;;;;AAGA;;AAKA;;AACA;;AAEA;;AACA;;AACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,MAAM;AAAEA,EAAAA;AAAF,IAAWC,QAAjB;;AAIA,MAAMC,UAAU,GAAG;AAClBC,EAAAA,IAAI,EAAJA,WADkB;AAElBC,EAAAA,OAAO,EAAE;AACRC,IAAAA,UAAU,EAAE;AACXC,MAAAA,MAAM,EACL;AAFU;AADJ,GAFS;AAQlBC,EAAAA,UAAU,EAAVA,mBARkB;;AASlBC,EAAAA,KAAK,CAAEH,UAAF,EAAcI,iBAAd,EAAkC;AACtC,UAAM;AAAEH,MAAAA;AAAF,QAAaG,iBAAnB;;AAEA,QAAK,CAAEH,MAAF,IAAYA,MAAM,KAAK,WAA5B,EAA0C;AACzC,aAAOD,UAAP;AACA;;AAED,WAAO,EACN,GAAGA,UADG;AAENC,MAAAA,MAAM,EAAED,UAAU,CAACC,MAAX,GAAoBA;AAFtB,KAAP;AAIA,GApBiB;;AAqBlBI,EAAAA,IAAI,EAAJA,aArBkB;AAsBlBC,EAAAA,IAAI,EAAJA,aAtBkB;AAuBlBC,EAAAA,UAAU,EAAVA;AAvBkB,CAAnB;AA0BO,MAAMC,QAAQ,GAAG,WAAAC,MAAM,UAAN,kCAAQC,+BAAR,GACrBC,UADqB,GAErBd,UAFI","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { list as icon } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport deprecated from './deprecated';\nimport edit from './edit';\nimport metadata from './block.json';\nimport save from './save';\nimport transforms from './transforms';\nimport settingsV2 from './v2';\n\nconst { name } = metadata;\n\nexport { metadata, name };\n\nconst settingsV1 = {\n\ticon,\n\texample: {\n\t\tattributes: {\n\t\t\tvalues:\n\t\t\t\t'<li>Alice.</li><li>The White Rabbit.</li><li>The Cheshire Cat.</li><li>The Mad Hatter.</li><li>The Queen of Hearts.</li>',\n\t\t},\n\t},\n\ttransforms,\n\tmerge( attributes, attributesToMerge ) {\n\t\tconst { values } = attributesToMerge;\n\n\t\tif ( ! values || values === '<li></li>' ) {\n\t\t\treturn attributes;\n\t\t}\n\n\t\treturn {\n\t\t\t...attributes,\n\t\t\tvalues: attributes.values + values,\n\t\t};\n\t},\n\tedit,\n\tsave,\n\tdeprecated,\n};\n\nexport const settings = window?.__experimentalEnableListBlockV2\n\t? settingsV2\n\t: settingsV1;\n"]}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.default = void 0;
|
|
9
|
+
|
|
10
|
+
var _element = require("@wordpress/element");
|
|
11
|
+
|
|
12
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
13
|
+
|
|
14
|
+
var _blockEditor = require("@wordpress/block-editor");
|
|
15
|
+
|
|
16
|
+
var _components = require("@wordpress/components");
|
|
17
|
+
|
|
18
|
+
var _i18n = require("@wordpress/i18n");
|
|
19
|
+
|
|
20
|
+
var _icons = require("@wordpress/icons");
|
|
21
|
+
|
|
22
|
+
var _orderedListSettings = _interopRequireDefault(require("../ordered-list-settings"));
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* WordPress dependencies
|
|
26
|
+
*/
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Internal dependencies
|
|
30
|
+
*/
|
|
31
|
+
const TEMPLATE = [['core/list-item']];
|
|
32
|
+
|
|
33
|
+
function Edit(_ref) {
|
|
34
|
+
let {
|
|
35
|
+
attributes,
|
|
36
|
+
setAttributes
|
|
37
|
+
} = _ref;
|
|
38
|
+
const blockProps = (0, _blockEditor.useBlockProps)();
|
|
39
|
+
const innerBlocksProps = (0, _blockEditor.useInnerBlocksProps)(blockProps, {
|
|
40
|
+
allowedBlocks: ['core/list-item'],
|
|
41
|
+
template: TEMPLATE
|
|
42
|
+
});
|
|
43
|
+
const {
|
|
44
|
+
ordered,
|
|
45
|
+
reversed,
|
|
46
|
+
start
|
|
47
|
+
} = attributes;
|
|
48
|
+
const TagName = ordered ? 'ol' : 'ul';
|
|
49
|
+
const controls = (0, _element.createElement)(_blockEditor.BlockControls, {
|
|
50
|
+
group: "block"
|
|
51
|
+
}, (0, _element.createElement)(_components.ToolbarButton, {
|
|
52
|
+
icon: (0, _i18n.isRTL)() ? _icons.formatListBulletsRTL : _icons.formatListBullets,
|
|
53
|
+
title: (0, _i18n.__)('Unordered'),
|
|
54
|
+
describedBy: (0, _i18n.__)('Convert to unordered list'),
|
|
55
|
+
isActive: ordered === false,
|
|
56
|
+
onClick: () => {
|
|
57
|
+
setAttributes({
|
|
58
|
+
ordered: false
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
}), (0, _element.createElement)(_components.ToolbarButton, {
|
|
62
|
+
icon: (0, _i18n.isRTL)() ? _icons.formatListNumberedRTL : _icons.formatListNumbered,
|
|
63
|
+
title: (0, _i18n.__)('Ordered'),
|
|
64
|
+
describedBy: (0, _i18n.__)('Convert to ordered list'),
|
|
65
|
+
isActive: ordered === true,
|
|
66
|
+
onClick: () => {
|
|
67
|
+
setAttributes({
|
|
68
|
+
ordered: true
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
}));
|
|
72
|
+
return (0, _element.createElement)(_element.Fragment, null, (0, _element.createElement)(TagName, (0, _extends2.default)({
|
|
73
|
+
reversed: reversed,
|
|
74
|
+
start: start
|
|
75
|
+
}, innerBlocksProps)), controls, ordered && (0, _element.createElement)(_orderedListSettings.default, {
|
|
76
|
+
setAttributes: setAttributes,
|
|
77
|
+
ordered: ordered,
|
|
78
|
+
reversed: reversed,
|
|
79
|
+
start: start
|
|
80
|
+
}));
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
var _default = Edit;
|
|
84
|
+
exports.default = _default;
|
|
85
|
+
//# sourceMappingURL=edit.js.map
|