@wordpress/block-library 8.21.1-next.f8d8eceb.0 → 8.23.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 +4 -0
- package/build/block/edit.js +6 -5
- package/build/block/edit.js.map +1 -1
- package/build/button/edit.js +57 -2
- package/build/button/edit.js.map +1 -1
- package/build/code/transforms.js +20 -7
- package/build/code/transforms.js.map +1 -1
- package/build/comments/edit/comments-inspector-controls.js +1 -0
- package/build/comments/edit/comments-inspector-controls.js.map +1 -1
- package/build/cover/edit/inspector-controls.js +1 -0
- package/build/cover/edit/inspector-controls.js.map +1 -1
- package/build/details/edit.js +1 -2
- package/build/details/edit.js.map +1 -1
- package/build/form/edit.js +1 -1
- package/build/form/edit.js.map +1 -1
- package/build/form/index.js +25 -5
- package/build/form/index.js.map +1 -1
- package/build/form-input/index.js +1 -1
- package/build/form-input/index.js.map +1 -1
- package/build/form-submission-notification/index.js +1 -1
- package/build/form-submission-notification/index.js.map +1 -1
- package/build/form-submit-button/edit.js +2 -1
- package/build/form-submit-button/edit.js.map +1 -1
- package/build/form-submit-button/index.js +1 -1
- package/build/form-submit-button/index.js.map +1 -1
- package/build/gallery/gap-styles.js +12 -7
- package/build/gallery/gap-styles.js.map +1 -1
- package/build/group/edit.js +1 -0
- package/build/group/edit.js.map +1 -1
- package/build/html/transforms.js +7 -2
- package/build/html/transforms.js.map +1 -1
- package/build/image/deprecated.js +8 -0
- package/build/image/deprecated.js.map +1 -1
- package/build/image/view.js +10 -7
- package/build/image/view.js.map +1 -1
- package/build/missing/index.js +1 -1
- package/build/navigation/edit/overlay-menu-preview.js +1 -1
- package/build/navigation/edit/overlay-menu-preview.js.map +1 -1
- package/build/navigation/use-template-part-area-label.js +2 -1
- package/build/navigation/use-template-part-area-label.js.map +1 -1
- package/build/navigation-link/edit.js +1 -1
- package/build/navigation-link/edit.js.map +1 -1
- package/build/pattern/edit.js +1 -1
- package/build/pattern/edit.js.map +1 -1
- package/build/post-author/edit.js +0 -1
- package/build/post-author/edit.js.map +1 -1
- package/build/post-featured-image/edit.js +21 -6
- package/build/post-featured-image/edit.js.map +1 -1
- package/build/post-template/edit.js +2 -8
- package/build/post-template/edit.js.map +1 -1
- package/build/post-template/index.js +1 -1
- package/build/post-terms/edit.js +2 -4
- package/build/post-terms/edit.js.map +1 -1
- package/build/preformatted/transforms.js +1 -4
- package/build/preformatted/transforms.js.map +1 -1
- package/build/query/edit/query-content.js +1 -0
- package/build/query/edit/query-content.js.map +1 -1
- package/build/quote/index.js +6 -0
- package/build/quote/index.js.map +1 -1
- package/build/template-part/edit/advanced-controls.js +1 -0
- package/build/template-part/edit/advanced-controls.js.map +1 -1
- package/build/template-part/edit/index.js +3 -7
- package/build/template-part/edit/index.js.map +1 -1
- package/build/template-part/index.js +6 -2
- package/build/template-part/index.js.map +1 -1
- package/build/template-part/variations.js +5 -1
- package/build/template-part/variations.js.map +1 -1
- package/build-module/block/edit.js +6 -5
- package/build-module/block/edit.js.map +1 -1
- package/build-module/button/edit.js +61 -6
- package/build-module/button/edit.js.map +1 -1
- package/build-module/code/transforms.js +20 -7
- package/build-module/code/transforms.js.map +1 -1
- package/build-module/comments/edit/comments-inspector-controls.js +1 -0
- package/build-module/comments/edit/comments-inspector-controls.js.map +1 -1
- package/build-module/cover/edit/inspector-controls.js +1 -0
- package/build-module/cover/edit/inspector-controls.js.map +1 -1
- package/build-module/details/edit.js +1 -2
- package/build-module/details/edit.js.map +1 -1
- package/build-module/form/edit.js +1 -1
- package/build-module/form/edit.js.map +1 -1
- package/build-module/form/index.js +29 -5
- package/build-module/form/index.js.map +1 -1
- package/build-module/form-input/index.js +1 -1
- package/build-module/form-input/index.js.map +1 -1
- package/build-module/form-submission-notification/index.js +1 -1
- package/build-module/form-submission-notification/index.js.map +1 -1
- package/build-module/form-submit-button/edit.js +2 -1
- package/build-module/form-submit-button/edit.js.map +1 -1
- package/build-module/form-submit-button/index.js +1 -1
- package/build-module/form-submit-button/index.js.map +1 -1
- package/build-module/gallery/gap-styles.js +13 -8
- package/build-module/gallery/gap-styles.js.map +1 -1
- package/build-module/group/edit.js +1 -0
- package/build-module/group/edit.js.map +1 -1
- package/build-module/html/transforms.js +7 -2
- package/build-module/html/transforms.js.map +1 -1
- package/build-module/image/deprecated.js +8 -0
- package/build-module/image/deprecated.js.map +1 -1
- package/build-module/image/view.js +10 -7
- package/build-module/image/view.js.map +1 -1
- package/build-module/missing/index.js +1 -1
- package/build-module/navigation/edit/overlay-menu-preview.js +1 -1
- package/build-module/navigation/edit/overlay-menu-preview.js.map +1 -1
- package/build-module/navigation/use-template-part-area-label.js +2 -1
- package/build-module/navigation/use-template-part-area-label.js.map +1 -1
- package/build-module/navigation-link/edit.js +2 -2
- package/build-module/navigation-link/edit.js.map +1 -1
- package/build-module/pattern/edit.js +1 -1
- package/build-module/pattern/edit.js.map +1 -1
- package/build-module/post-author/edit.js +0 -1
- package/build-module/post-author/edit.js.map +1 -1
- package/build-module/post-featured-image/edit.js +21 -6
- package/build-module/post-featured-image/edit.js.map +1 -1
- package/build-module/post-template/edit.js +2 -8
- package/build-module/post-template/edit.js.map +1 -1
- package/build-module/post-template/index.js +1 -1
- package/build-module/post-terms/edit.js +2 -4
- package/build-module/post-terms/edit.js.map +1 -1
- package/build-module/preformatted/transforms.js +1 -4
- package/build-module/preformatted/transforms.js.map +1 -1
- package/build-module/query/edit/query-content.js +1 -0
- package/build-module/query/edit/query-content.js.map +1 -1
- package/build-module/quote/index.js +6 -0
- package/build-module/quote/index.js.map +1 -1
- package/build-module/template-part/edit/advanced-controls.js +1 -0
- package/build-module/template-part/edit/advanced-controls.js.map +1 -1
- package/build-module/template-part/edit/index.js +5 -9
- package/build-module/template-part/edit/index.js.map +1 -1
- package/build-module/template-part/index.js +6 -2
- package/build-module/template-part/index.js.map +1 -1
- package/build-module/template-part/variations.js +5 -1
- package/build-module/template-part/variations.js.map +1 -1
- package/build-style/editor-rtl.css +12 -0
- package/build-style/editor.css +12 -0
- package/build-style/image/editor-rtl.css +3 -0
- package/build-style/image/editor.css +3 -0
- package/build-style/image/style-rtl.css +19 -13
- package/build-style/image/style.css +19 -13
- package/build-style/post-featured-image/editor-rtl.css +9 -0
- package/build-style/post-featured-image/editor.css +9 -0
- package/build-style/quote/style-rtl.css +3 -0
- package/build-style/quote/style.css +3 -0
- package/build-style/read-more/style-rtl.css +2 -2
- package/build-style/read-more/style.css +2 -2
- package/build-style/style-rtl.css +24 -15
- package/build-style/style.css +24 -15
- package/package.json +32 -32
- package/src/block/edit.js +3 -2
- package/src/button/edit.js +70 -4
- package/src/code/transforms.js +14 -8
- package/src/comments/edit/comments-inspector-controls.js +1 -0
- package/src/cover/edit/inspector-controls.js +1 -0
- package/src/details/edit.js +0 -1
- package/src/form/edit.js +2 -0
- package/src/form/index.js +38 -1
- package/src/form-input/block.json +1 -1
- package/src/form-submission-notification/block.json +1 -1
- package/src/form-submit-button/block.json +1 -1
- package/src/form-submit-button/edit.js +1 -0
- package/src/gallery/gap-styles.js +10 -9
- package/src/group/edit.js +1 -0
- package/src/html/transforms.js +5 -2
- package/src/image/deprecated.js +8 -0
- package/src/image/editor.scss +7 -0
- package/src/image/index.php +3 -4
- package/src/image/style.scss +18 -13
- package/src/image/view.js +24 -11
- package/src/missing/block.json +1 -1
- package/src/navigation/edit/overlay-menu-preview.js +1 -1
- package/src/navigation/index.php +37 -402
- package/src/navigation/use-template-part-area-label.js +4 -2
- package/src/navigation-link/edit.js +2 -2
- package/src/navigation-link/index.php +57 -0
- package/src/paragraph/test/__snapshots__/transforms.native.js.snap +6 -0
- package/src/paragraph/test/transforms.native.js +1 -0
- package/src/pattern/edit.js +2 -1
- package/src/pattern/index.php +6 -1
- package/src/post-author/edit.js +0 -1
- package/src/post-featured-image/edit.js +38 -5
- package/src/post-featured-image/editor.scss +19 -0
- package/src/post-template/block.json +0 -1
- package/src/post-template/edit.js +1 -5
- package/src/post-terms/edit.js +2 -4
- package/src/preformatted/transforms.js +1 -4
- package/src/query/edit/query-content.js +1 -0
- package/src/query/index.php +6 -2
- package/src/quote/block.json +6 -0
- package/src/quote/style.scss +4 -0
- package/src/read-more/style.scss +1 -1
- package/src/template-part/edit/advanced-controls.js +1 -0
- package/src/template-part/edit/index.js +7 -14
- package/src/template-part/index.js +4 -3
- package/src/template-part/index.php +4 -4
- package/src/template-part/variations.js +4 -2
|
@@ -224,6 +224,7 @@ export default function CoverInspectorControls({
|
|
|
224
224
|
group: "advanced"
|
|
225
225
|
}, createElement(SelectControl, {
|
|
226
226
|
__nextHasNoMarginBottom: true,
|
|
227
|
+
__next40pxDefaultSize: true,
|
|
227
228
|
label: __('HTML element'),
|
|
228
229
|
options: [{
|
|
229
230
|
label: __('Default (<div>)'),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useMemo","Button","ExternalLink","FocalPointPicker","PanelBody","PanelRow","RangeControl","TextareaControl","ToggleControl","SelectControl","__experimentalUseCustomUnits","useCustomUnits","__experimentalToolsPanelItem","ToolsPanelItem","__experimentalUnitControl","UnitControl","__experimentalParseQuantityAndUnitFromRawValue","parseQuantityAndUnitFromRawValue","useInstanceId","InspectorControls","useSettings","__experimentalColorGradientSettingsDropdown","ColorGradientSettingsDropdown","__experimentalUseGradient","__experimentalUseMultipleOriginColorsAndGradients","useMultipleOriginColorsAndGradients","__","COVER_MIN_HEIGHT","mediaPosition","CoverHeightInput","onChange","onUnitChange","unit","value","instanceId","inputId","isPx","availableUnits","units","defaultValues","px","em","rem","vw","vh","handleOnChange","unprocessedValue","inputValue","parseFloat","undefined","isNaN","computedValue","parsedQuantity","join","min","createElement","label","id","isResetValueOnUnitChange","__unstableInputWidth","CoverInspectorControls","attributes","setAttributes","clientId","setOverlayColor","coverRef","currentSettings","updateDimRatio","onClearMedia","useFeaturedImage","dimRatio","focalPoint","hasParallax","isRepeated","minHeight","minHeightUnit","alt","tagName","isVideoBackground","isImageBackground","mediaElement","url","overlayColor","gradientValue","setGradient","toggleParallax","toggleIsRepeated","showFocalPointPicker","imperativeFocalPointPreview","styleOfRef","property","current","style","colorGradientSettings","htmlElementMessages","header","main","section","article","aside","footer","Fragment","title","__nextHasNoMarginBottom","checked","onDragStart","onDrag","newFocalPoint","newAlt","help","href","variant","isSmall","className","onClick","hasColorsOrGradients","group","__experimentalIsRenderedInSidebar","settings","colorValue","color","onColorChange","onGradientChange","isShownByDefault","resetAllFilter","customOverlayColor","gradient","customGradient","panelId","hasValue","onDeselect","newDimRatio","max","step","required","__next40pxDefaultSize","newMinHeight","nextUnit","options"],"sources":["@wordpress/block-library/src/cover/edit/inspector-controls.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useMemo } from '@wordpress/element';\nimport {\n\tButton,\n\tExternalLink,\n\tFocalPointPicker,\n\tPanelBody,\n\tPanelRow,\n\tRangeControl,\n\tTextareaControl,\n\tToggleControl,\n\tSelectControl,\n\t__experimentalUseCustomUnits as useCustomUnits,\n\t__experimentalToolsPanelItem as ToolsPanelItem,\n\t__experimentalUnitControl as UnitControl,\n\t__experimentalParseQuantityAndUnitFromRawValue as parseQuantityAndUnitFromRawValue,\n} from '@wordpress/components';\nimport { useInstanceId } from '@wordpress/compose';\nimport {\n\tInspectorControls,\n\tuseSettings,\n\t__experimentalColorGradientSettingsDropdown as ColorGradientSettingsDropdown,\n\t__experimentalUseGradient,\n\t__experimentalUseMultipleOriginColorsAndGradients as useMultipleOriginColorsAndGradients,\n} from '@wordpress/block-editor';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { COVER_MIN_HEIGHT, mediaPosition } from '../shared';\n\nfunction CoverHeightInput( {\n\tonChange,\n\tonUnitChange,\n\tunit = 'px',\n\tvalue = '',\n} ) {\n\tconst instanceId = useInstanceId( UnitControl );\n\tconst inputId = `block-cover-height-input-${ instanceId }`;\n\tconst isPx = unit === 'px';\n\n\tconst [ availableUnits ] = useSettings( 'spacing.units' );\n\tconst units = useCustomUnits( {\n\t\tavailableUnits: availableUnits || [ 'px', 'em', 'rem', 'vw', 'vh' ],\n\t\tdefaultValues: { px: 430, '%': 20, em: 20, rem: 20, vw: 20, vh: 50 },\n\t} );\n\n\tconst handleOnChange = ( unprocessedValue ) => {\n\t\tconst inputValue =\n\t\t\tunprocessedValue !== ''\n\t\t\t\t? parseFloat( unprocessedValue )\n\t\t\t\t: undefined;\n\n\t\tif ( isNaN( inputValue ) && inputValue !== undefined ) {\n\t\t\treturn;\n\t\t}\n\t\tonChange( inputValue );\n\t};\n\n\tconst computedValue = useMemo( () => {\n\t\tconst [ parsedQuantity ] = parseQuantityAndUnitFromRawValue( value );\n\t\treturn [ parsedQuantity, unit ].join( '' );\n\t}, [ unit, value ] );\n\n\tconst min = isPx ? COVER_MIN_HEIGHT : 0;\n\n\treturn (\n\t\t<UnitControl\n\t\t\tlabel={ __( 'Minimum height of cover' ) }\n\t\t\tid={ inputId }\n\t\t\tisResetValueOnUnitChange\n\t\t\tmin={ min }\n\t\t\tonChange={ handleOnChange }\n\t\t\tonUnitChange={ onUnitChange }\n\t\t\t__unstableInputWidth={ '80px' }\n\t\t\tunits={ units }\n\t\t\tvalue={ computedValue }\n\t\t/>\n\t);\n}\nexport default function CoverInspectorControls( {\n\tattributes,\n\tsetAttributes,\n\tclientId,\n\tsetOverlayColor,\n\tcoverRef,\n\tcurrentSettings,\n\tupdateDimRatio,\n\tonClearMedia,\n} ) {\n\tconst {\n\t\tuseFeaturedImage,\n\t\tdimRatio,\n\t\tfocalPoint,\n\t\thasParallax,\n\t\tisRepeated,\n\t\tminHeight,\n\t\tminHeightUnit,\n\t\talt,\n\t\ttagName,\n\t} = attributes;\n\tconst {\n\t\tisVideoBackground,\n\t\tisImageBackground,\n\t\tmediaElement,\n\t\turl,\n\t\toverlayColor,\n\t} = currentSettings;\n\n\tconst { gradientValue, setGradient } = __experimentalUseGradient();\n\n\tconst toggleParallax = () => {\n\t\tsetAttributes( {\n\t\t\thasParallax: ! hasParallax,\n\t\t\t...( ! hasParallax ? { focalPoint: undefined } : {} ),\n\t\t} );\n\t};\n\n\tconst toggleIsRepeated = () => {\n\t\tsetAttributes( {\n\t\t\tisRepeated: ! isRepeated,\n\t\t} );\n\t};\n\n\tconst showFocalPointPicker =\n\t\tisVideoBackground ||\n\t\t( isImageBackground && ( ! hasParallax || isRepeated ) );\n\n\tconst imperativeFocalPointPreview = ( value ) => {\n\t\tconst [ styleOfRef, property ] = mediaElement.current\n\t\t\t? [ mediaElement.current.style, 'objectPosition' ]\n\t\t\t: [ coverRef.current.style, 'backgroundPosition' ];\n\t\tstyleOfRef[ property ] = mediaPosition( value );\n\t};\n\n\tconst colorGradientSettings = useMultipleOriginColorsAndGradients();\n\n\tconst htmlElementMessages = {\n\t\theader: __(\n\t\t\t'The <header> element should represent introductory content, typically a group of introductory or navigational aids.'\n\t\t),\n\t\tmain: __(\n\t\t\t'The <main> element should be used for the primary content of your document only.'\n\t\t),\n\t\tsection: __(\n\t\t\t\"The <section> element should represent a standalone portion of the document that can't be better represented by another element.\"\n\t\t),\n\t\tarticle: __(\n\t\t\t'The <article> element should represent a self-contained, syndicatable portion of the document.'\n\t\t),\n\t\taside: __(\n\t\t\t\"The <aside> element should represent a portion of a document whose content is only indirectly related to the document's main content.\"\n\t\t),\n\t\tfooter: __(\n\t\t\t'The <footer> element should represent a footer for its nearest sectioning element (e.g.: <section>, <article>, <main> etc.).'\n\t\t),\n\t};\n\n\treturn (\n\t\t<>\n\t\t\t<InspectorControls>\n\t\t\t\t{ !! url && (\n\t\t\t\t\t<PanelBody title={ __( 'Media settings' ) }>\n\t\t\t\t\t\t{ isImageBackground && (\n\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\t\t\tlabel={ __( 'Fixed background' ) }\n\t\t\t\t\t\t\t\t\tchecked={ hasParallax }\n\t\t\t\t\t\t\t\t\tonChange={ toggleParallax }\n\t\t\t\t\t\t\t\t/>\n\n\t\t\t\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\t\t\tlabel={ __( 'Repeated background' ) }\n\t\t\t\t\t\t\t\t\tchecked={ isRepeated }\n\t\t\t\t\t\t\t\t\tonChange={ toggleIsRepeated }\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\t{ showFocalPointPicker && (\n\t\t\t\t\t\t\t<FocalPointPicker\n\t\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\t\tlabel={ __( 'Focal point picker' ) }\n\t\t\t\t\t\t\t\turl={ url }\n\t\t\t\t\t\t\t\tvalue={ focalPoint }\n\t\t\t\t\t\t\t\tonDragStart={ imperativeFocalPointPreview }\n\t\t\t\t\t\t\t\tonDrag={ imperativeFocalPointPreview }\n\t\t\t\t\t\t\t\tonChange={ ( newFocalPoint ) =>\n\t\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\t\tfocalPoint: newFocalPoint,\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\t{ ! useFeaturedImage && url && ! isVideoBackground && (\n\t\t\t\t\t\t\t<TextareaControl\n\t\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\t\tlabel={ __( 'Alternative text' ) }\n\t\t\t\t\t\t\t\tvalue={ alt }\n\t\t\t\t\t\t\t\tonChange={ ( newAlt ) =>\n\t\t\t\t\t\t\t\t\tsetAttributes( { alt: newAlt } )\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\thelp={\n\t\t\t\t\t\t\t\t\t<>\n\t\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\t{ __(\n\t\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\t) }\n\t\t\t\t\t\t\t\t\t\t</ExternalLink>\n\t\t\t\t\t\t\t\t\t\t<br />\n\t\t\t\t\t\t\t\t\t\t{ __( 'Leave empty if 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\t<PanelRow>\n\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\tvariant=\"secondary\"\n\t\t\t\t\t\t\t\tisSmall\n\t\t\t\t\t\t\t\tclassName=\"block-library-cover__reset-button\"\n\t\t\t\t\t\t\t\tonClick={ onClearMedia }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ __( 'Clear Media' ) }\n\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t</PanelRow>\n\t\t\t\t\t</PanelBody>\n\t\t\t\t) }\n\t\t\t</InspectorControls>\n\t\t\t{ colorGradientSettings.hasColorsOrGradients && (\n\t\t\t\t<InspectorControls group=\"color\">\n\t\t\t\t\t<ColorGradientSettingsDropdown\n\t\t\t\t\t\t__experimentalIsRenderedInSidebar\n\t\t\t\t\t\tsettings={ [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tcolorValue: overlayColor.color,\n\t\t\t\t\t\t\t\tgradientValue,\n\t\t\t\t\t\t\t\tlabel: __( 'Overlay' ),\n\t\t\t\t\t\t\t\tonColorChange: setOverlayColor,\n\t\t\t\t\t\t\t\tonGradientChange: setGradient,\n\t\t\t\t\t\t\t\tisShownByDefault: true,\n\t\t\t\t\t\t\t\tresetAllFilter: () => ( {\n\t\t\t\t\t\t\t\t\toverlayColor: undefined,\n\t\t\t\t\t\t\t\t\tcustomOverlayColor: undefined,\n\t\t\t\t\t\t\t\t\tgradient: undefined,\n\t\t\t\t\t\t\t\t\tcustomGradient: undefined,\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\tpanelId={ clientId }\n\t\t\t\t\t\t{ ...colorGradientSettings }\n\t\t\t\t\t/>\n\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\thasValue={ () => {\n\t\t\t\t\t\t\t// If there's a media background the dimRatio will be\n\t\t\t\t\t\t\t// defaulted to 50 whereas it will be 100 for colors.\n\t\t\t\t\t\t\treturn dimRatio === undefined\n\t\t\t\t\t\t\t\t? false\n\t\t\t\t\t\t\t\t: dimRatio !== ( url ? 50 : 100 );\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tlabel={ __( 'Overlay opacity' ) }\n\t\t\t\t\t\tonDeselect={ () => updateDimRatio( url ? 50 : 100 ) }\n\t\t\t\t\t\tresetAllFilter={ () => ( {\n\t\t\t\t\t\t\tdimRatio: url ? 50 : 100,\n\t\t\t\t\t\t} ) }\n\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t\tpanelId={ clientId }\n\t\t\t\t\t>\n\t\t\t\t\t\t<RangeControl\n\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\tlabel={ __( 'Overlay opacity' ) }\n\t\t\t\t\t\t\tvalue={ dimRatio }\n\t\t\t\t\t\t\tonChange={ ( newDimRatio ) =>\n\t\t\t\t\t\t\t\tupdateDimRatio( newDimRatio )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tmin={ 0 }\n\t\t\t\t\t\t\tmax={ 100 }\n\t\t\t\t\t\t\tstep={ 10 }\n\t\t\t\t\t\t\trequired\n\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t/>\n\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t</InspectorControls>\n\t\t\t) }\n\t\t\t<InspectorControls group=\"dimensions\">\n\t\t\t\t<ToolsPanelItem\n\t\t\t\t\thasValue={ () => !! minHeight }\n\t\t\t\t\tlabel={ __( 'Minimum height' ) }\n\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\tminHeight: undefined,\n\t\t\t\t\t\t\tminHeightUnit: undefined,\n\t\t\t\t\t\t} )\n\t\t\t\t\t}\n\t\t\t\t\tresetAllFilter={ () => ( {\n\t\t\t\t\t\tminHeight: undefined,\n\t\t\t\t\t\tminHeightUnit: undefined,\n\t\t\t\t\t} ) }\n\t\t\t\t\tisShownByDefault={ true }\n\t\t\t\t\tpanelId={ clientId }\n\t\t\t\t>\n\t\t\t\t\t<CoverHeightInput\n\t\t\t\t\t\tvalue={ minHeight }\n\t\t\t\t\t\tunit={ minHeightUnit }\n\t\t\t\t\t\tonChange={ ( newMinHeight ) =>\n\t\t\t\t\t\t\tsetAttributes( { minHeight: newMinHeight } )\n\t\t\t\t\t\t}\n\t\t\t\t\t\tonUnitChange={ ( nextUnit ) =>\n\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\tminHeightUnit: nextUnit,\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</ToolsPanelItem>\n\t\t\t</InspectorControls>\n\t\t\t<InspectorControls group=\"advanced\">\n\t\t\t\t<SelectControl\n\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\tlabel={ __( 'HTML element' ) }\n\t\t\t\t\toptions={ [\n\t\t\t\t\t\t{ label: __( 'Default (<div>)' ), value: 'div' },\n\t\t\t\t\t\t{ label: '<header>', value: 'header' },\n\t\t\t\t\t\t{ label: '<main>', value: 'main' },\n\t\t\t\t\t\t{ label: '<section>', value: 'section' },\n\t\t\t\t\t\t{ label: '<article>', value: 'article' },\n\t\t\t\t\t\t{ label: '<aside>', value: 'aside' },\n\t\t\t\t\t\t{ label: '<footer>', value: 'footer' },\n\t\t\t\t\t] }\n\t\t\t\t\tvalue={ tagName }\n\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\tsetAttributes( { tagName: value } )\n\t\t\t\t\t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AAE8D;IAChB,CAAE;EACF,CACD,CACc,CACE,CAAC,EACpBlF,aAAA,CAACpC,iBAAiB;IAACiG,KAAK,EAAC;EAAU,GAClC7D,aAAA,CAAC9C,aAAa;IACb8F,uBAAuB;IACvB/C,KAAK,EAAG9B,EAAE,CAAE,cAAe,CAAG;IAC9BgH,OAAO,EAAG,CACT;MAAElF,KAAK,EAAE9B,EAAE,CAAE,iBAAkB,CAAC;MAAEO,KAAK,EAAE;IAAM,CAAC,EAChD;MAAEuB,KAAK,EAAE,UAAU;MAAEvB,KAAK,EAAE;IAAS,CAAC,EACtC;MAAEuB,KAAK,EAAE,QAAQ;MAAEvB,KAAK,EAAE;IAAO,CAAC,EAClC;MAAEuB,KAAK,EAAE,WAAW;MAAEvB,KAAK,EAAE;IAAU,CAAC,EACxC;MAAEuB,KAAK,EAAE,WAAW;MAAEvB,KAAK,EAAE;IAAU,CAAC,EACxC;MAAEuB,KAAK,EAAE,SAAS;MAAEvB,KAAK,EAAE;IAAQ,CAAC,EACpC;MAAEuB,KAAK,EAAE,UAAU;MAAEvB,KAAK,EAAE;IAAS,CAAC,CACpC;IACHA,KAAK,EAAG4C,OAAS;IACjB/C,QAAQ,EAAKG,KAAK,IACjB6B,aAAa,CAAE;MAAEe,OAAO,EAAE5C;IAAM,CAAE,CAClC;IACD4E,IAAI,EAAGf,mBAAmB,CAAEjB,OAAO;EAAI,CACvC,CACiB,CAClB,CAAC;AAEL"}
|
|
1
|
+
{"version":3,"names":["useMemo","Button","ExternalLink","FocalPointPicker","PanelBody","PanelRow","RangeControl","TextareaControl","ToggleControl","SelectControl","__experimentalUseCustomUnits","useCustomUnits","__experimentalToolsPanelItem","ToolsPanelItem","__experimentalUnitControl","UnitControl","__experimentalParseQuantityAndUnitFromRawValue","parseQuantityAndUnitFromRawValue","useInstanceId","InspectorControls","useSettings","__experimentalColorGradientSettingsDropdown","ColorGradientSettingsDropdown","__experimentalUseGradient","__experimentalUseMultipleOriginColorsAndGradients","useMultipleOriginColorsAndGradients","__","COVER_MIN_HEIGHT","mediaPosition","CoverHeightInput","onChange","onUnitChange","unit","value","instanceId","inputId","isPx","availableUnits","units","defaultValues","px","em","rem","vw","vh","handleOnChange","unprocessedValue","inputValue","parseFloat","undefined","isNaN","computedValue","parsedQuantity","join","min","createElement","label","id","isResetValueOnUnitChange","__unstableInputWidth","CoverInspectorControls","attributes","setAttributes","clientId","setOverlayColor","coverRef","currentSettings","updateDimRatio","onClearMedia","useFeaturedImage","dimRatio","focalPoint","hasParallax","isRepeated","minHeight","minHeightUnit","alt","tagName","isVideoBackground","isImageBackground","mediaElement","url","overlayColor","gradientValue","setGradient","toggleParallax","toggleIsRepeated","showFocalPointPicker","imperativeFocalPointPreview","styleOfRef","property","current","style","colorGradientSettings","htmlElementMessages","header","main","section","article","aside","footer","Fragment","title","__nextHasNoMarginBottom","checked","onDragStart","onDrag","newFocalPoint","newAlt","help","href","variant","isSmall","className","onClick","hasColorsOrGradients","group","__experimentalIsRenderedInSidebar","settings","colorValue","color","onColorChange","onGradientChange","isShownByDefault","resetAllFilter","customOverlayColor","gradient","customGradient","panelId","hasValue","onDeselect","newDimRatio","max","step","required","__next40pxDefaultSize","newMinHeight","nextUnit","options"],"sources":["@wordpress/block-library/src/cover/edit/inspector-controls.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useMemo } from '@wordpress/element';\nimport {\n\tButton,\n\tExternalLink,\n\tFocalPointPicker,\n\tPanelBody,\n\tPanelRow,\n\tRangeControl,\n\tTextareaControl,\n\tToggleControl,\n\tSelectControl,\n\t__experimentalUseCustomUnits as useCustomUnits,\n\t__experimentalToolsPanelItem as ToolsPanelItem,\n\t__experimentalUnitControl as UnitControl,\n\t__experimentalParseQuantityAndUnitFromRawValue as parseQuantityAndUnitFromRawValue,\n} from '@wordpress/components';\nimport { useInstanceId } from '@wordpress/compose';\nimport {\n\tInspectorControls,\n\tuseSettings,\n\t__experimentalColorGradientSettingsDropdown as ColorGradientSettingsDropdown,\n\t__experimentalUseGradient,\n\t__experimentalUseMultipleOriginColorsAndGradients as useMultipleOriginColorsAndGradients,\n} from '@wordpress/block-editor';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { COVER_MIN_HEIGHT, mediaPosition } from '../shared';\n\nfunction CoverHeightInput( {\n\tonChange,\n\tonUnitChange,\n\tunit = 'px',\n\tvalue = '',\n} ) {\n\tconst instanceId = useInstanceId( UnitControl );\n\tconst inputId = `block-cover-height-input-${ instanceId }`;\n\tconst isPx = unit === 'px';\n\n\tconst [ availableUnits ] = useSettings( 'spacing.units' );\n\tconst units = useCustomUnits( {\n\t\tavailableUnits: availableUnits || [ 'px', 'em', 'rem', 'vw', 'vh' ],\n\t\tdefaultValues: { px: 430, '%': 20, em: 20, rem: 20, vw: 20, vh: 50 },\n\t} );\n\n\tconst handleOnChange = ( unprocessedValue ) => {\n\t\tconst inputValue =\n\t\t\tunprocessedValue !== ''\n\t\t\t\t? parseFloat( unprocessedValue )\n\t\t\t\t: undefined;\n\n\t\tif ( isNaN( inputValue ) && inputValue !== undefined ) {\n\t\t\treturn;\n\t\t}\n\t\tonChange( inputValue );\n\t};\n\n\tconst computedValue = useMemo( () => {\n\t\tconst [ parsedQuantity ] = parseQuantityAndUnitFromRawValue( value );\n\t\treturn [ parsedQuantity, unit ].join( '' );\n\t}, [ unit, value ] );\n\n\tconst min = isPx ? COVER_MIN_HEIGHT : 0;\n\n\treturn (\n\t\t<UnitControl\n\t\t\tlabel={ __( 'Minimum height of cover' ) }\n\t\t\tid={ inputId }\n\t\t\tisResetValueOnUnitChange\n\t\t\tmin={ min }\n\t\t\tonChange={ handleOnChange }\n\t\t\tonUnitChange={ onUnitChange }\n\t\t\t__unstableInputWidth={ '80px' }\n\t\t\tunits={ units }\n\t\t\tvalue={ computedValue }\n\t\t/>\n\t);\n}\nexport default function CoverInspectorControls( {\n\tattributes,\n\tsetAttributes,\n\tclientId,\n\tsetOverlayColor,\n\tcoverRef,\n\tcurrentSettings,\n\tupdateDimRatio,\n\tonClearMedia,\n} ) {\n\tconst {\n\t\tuseFeaturedImage,\n\t\tdimRatio,\n\t\tfocalPoint,\n\t\thasParallax,\n\t\tisRepeated,\n\t\tminHeight,\n\t\tminHeightUnit,\n\t\talt,\n\t\ttagName,\n\t} = attributes;\n\tconst {\n\t\tisVideoBackground,\n\t\tisImageBackground,\n\t\tmediaElement,\n\t\turl,\n\t\toverlayColor,\n\t} = currentSettings;\n\n\tconst { gradientValue, setGradient } = __experimentalUseGradient();\n\n\tconst toggleParallax = () => {\n\t\tsetAttributes( {\n\t\t\thasParallax: ! hasParallax,\n\t\t\t...( ! hasParallax ? { focalPoint: undefined } : {} ),\n\t\t} );\n\t};\n\n\tconst toggleIsRepeated = () => {\n\t\tsetAttributes( {\n\t\t\tisRepeated: ! isRepeated,\n\t\t} );\n\t};\n\n\tconst showFocalPointPicker =\n\t\tisVideoBackground ||\n\t\t( isImageBackground && ( ! hasParallax || isRepeated ) );\n\n\tconst imperativeFocalPointPreview = ( value ) => {\n\t\tconst [ styleOfRef, property ] = mediaElement.current\n\t\t\t? [ mediaElement.current.style, 'objectPosition' ]\n\t\t\t: [ coverRef.current.style, 'backgroundPosition' ];\n\t\tstyleOfRef[ property ] = mediaPosition( value );\n\t};\n\n\tconst colorGradientSettings = useMultipleOriginColorsAndGradients();\n\n\tconst htmlElementMessages = {\n\t\theader: __(\n\t\t\t'The <header> element should represent introductory content, typically a group of introductory or navigational aids.'\n\t\t),\n\t\tmain: __(\n\t\t\t'The <main> element should be used for the primary content of your document only.'\n\t\t),\n\t\tsection: __(\n\t\t\t\"The <section> element should represent a standalone portion of the document that can't be better represented by another element.\"\n\t\t),\n\t\tarticle: __(\n\t\t\t'The <article> element should represent a self-contained, syndicatable portion of the document.'\n\t\t),\n\t\taside: __(\n\t\t\t\"The <aside> element should represent a portion of a document whose content is only indirectly related to the document's main content.\"\n\t\t),\n\t\tfooter: __(\n\t\t\t'The <footer> element should represent a footer for its nearest sectioning element (e.g.: <section>, <article>, <main> etc.).'\n\t\t),\n\t};\n\n\treturn (\n\t\t<>\n\t\t\t<InspectorControls>\n\t\t\t\t{ !! url && (\n\t\t\t\t\t<PanelBody title={ __( 'Media settings' ) }>\n\t\t\t\t\t\t{ isImageBackground && (\n\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\t\t\tlabel={ __( 'Fixed background' ) }\n\t\t\t\t\t\t\t\t\tchecked={ hasParallax }\n\t\t\t\t\t\t\t\t\tonChange={ toggleParallax }\n\t\t\t\t\t\t\t\t/>\n\n\t\t\t\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\t\t\tlabel={ __( 'Repeated background' ) }\n\t\t\t\t\t\t\t\t\tchecked={ isRepeated }\n\t\t\t\t\t\t\t\t\tonChange={ toggleIsRepeated }\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\t{ showFocalPointPicker && (\n\t\t\t\t\t\t\t<FocalPointPicker\n\t\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\t\tlabel={ __( 'Focal point picker' ) }\n\t\t\t\t\t\t\t\turl={ url }\n\t\t\t\t\t\t\t\tvalue={ focalPoint }\n\t\t\t\t\t\t\t\tonDragStart={ imperativeFocalPointPreview }\n\t\t\t\t\t\t\t\tonDrag={ imperativeFocalPointPreview }\n\t\t\t\t\t\t\t\tonChange={ ( newFocalPoint ) =>\n\t\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\t\tfocalPoint: newFocalPoint,\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\t{ ! useFeaturedImage && url && ! isVideoBackground && (\n\t\t\t\t\t\t\t<TextareaControl\n\t\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\t\tlabel={ __( 'Alternative text' ) }\n\t\t\t\t\t\t\t\tvalue={ alt }\n\t\t\t\t\t\t\t\tonChange={ ( newAlt ) =>\n\t\t\t\t\t\t\t\t\tsetAttributes( { alt: newAlt } )\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\thelp={\n\t\t\t\t\t\t\t\t\t<>\n\t\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\t{ __(\n\t\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\t) }\n\t\t\t\t\t\t\t\t\t\t</ExternalLink>\n\t\t\t\t\t\t\t\t\t\t<br />\n\t\t\t\t\t\t\t\t\t\t{ __( 'Leave empty if 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\t<PanelRow>\n\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\tvariant=\"secondary\"\n\t\t\t\t\t\t\t\tisSmall\n\t\t\t\t\t\t\t\tclassName=\"block-library-cover__reset-button\"\n\t\t\t\t\t\t\t\tonClick={ onClearMedia }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ __( 'Clear Media' ) }\n\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t</PanelRow>\n\t\t\t\t\t</PanelBody>\n\t\t\t\t) }\n\t\t\t</InspectorControls>\n\t\t\t{ colorGradientSettings.hasColorsOrGradients && (\n\t\t\t\t<InspectorControls group=\"color\">\n\t\t\t\t\t<ColorGradientSettingsDropdown\n\t\t\t\t\t\t__experimentalIsRenderedInSidebar\n\t\t\t\t\t\tsettings={ [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tcolorValue: overlayColor.color,\n\t\t\t\t\t\t\t\tgradientValue,\n\t\t\t\t\t\t\t\tlabel: __( 'Overlay' ),\n\t\t\t\t\t\t\t\tonColorChange: setOverlayColor,\n\t\t\t\t\t\t\t\tonGradientChange: setGradient,\n\t\t\t\t\t\t\t\tisShownByDefault: true,\n\t\t\t\t\t\t\t\tresetAllFilter: () => ( {\n\t\t\t\t\t\t\t\t\toverlayColor: undefined,\n\t\t\t\t\t\t\t\t\tcustomOverlayColor: undefined,\n\t\t\t\t\t\t\t\t\tgradient: undefined,\n\t\t\t\t\t\t\t\t\tcustomGradient: undefined,\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\tpanelId={ clientId }\n\t\t\t\t\t\t{ ...colorGradientSettings }\n\t\t\t\t\t/>\n\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\thasValue={ () => {\n\t\t\t\t\t\t\t// If there's a media background the dimRatio will be\n\t\t\t\t\t\t\t// defaulted to 50 whereas it will be 100 for colors.\n\t\t\t\t\t\t\treturn dimRatio === undefined\n\t\t\t\t\t\t\t\t? false\n\t\t\t\t\t\t\t\t: dimRatio !== ( url ? 50 : 100 );\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tlabel={ __( 'Overlay opacity' ) }\n\t\t\t\t\t\tonDeselect={ () => updateDimRatio( url ? 50 : 100 ) }\n\t\t\t\t\t\tresetAllFilter={ () => ( {\n\t\t\t\t\t\t\tdimRatio: url ? 50 : 100,\n\t\t\t\t\t\t} ) }\n\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t\tpanelId={ clientId }\n\t\t\t\t\t>\n\t\t\t\t\t\t<RangeControl\n\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\tlabel={ __( 'Overlay opacity' ) }\n\t\t\t\t\t\t\tvalue={ dimRatio }\n\t\t\t\t\t\t\tonChange={ ( newDimRatio ) =>\n\t\t\t\t\t\t\t\tupdateDimRatio( newDimRatio )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tmin={ 0 }\n\t\t\t\t\t\t\tmax={ 100 }\n\t\t\t\t\t\t\tstep={ 10 }\n\t\t\t\t\t\t\trequired\n\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t/>\n\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t</InspectorControls>\n\t\t\t) }\n\t\t\t<InspectorControls group=\"dimensions\">\n\t\t\t\t<ToolsPanelItem\n\t\t\t\t\thasValue={ () => !! minHeight }\n\t\t\t\t\tlabel={ __( 'Minimum height' ) }\n\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\tminHeight: undefined,\n\t\t\t\t\t\t\tminHeightUnit: undefined,\n\t\t\t\t\t\t} )\n\t\t\t\t\t}\n\t\t\t\t\tresetAllFilter={ () => ( {\n\t\t\t\t\t\tminHeight: undefined,\n\t\t\t\t\t\tminHeightUnit: undefined,\n\t\t\t\t\t} ) }\n\t\t\t\t\tisShownByDefault={ true }\n\t\t\t\t\tpanelId={ clientId }\n\t\t\t\t>\n\t\t\t\t\t<CoverHeightInput\n\t\t\t\t\t\tvalue={ minHeight }\n\t\t\t\t\t\tunit={ minHeightUnit }\n\t\t\t\t\t\tonChange={ ( newMinHeight ) =>\n\t\t\t\t\t\t\tsetAttributes( { minHeight: newMinHeight } )\n\t\t\t\t\t\t}\n\t\t\t\t\t\tonUnitChange={ ( nextUnit ) =>\n\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\tminHeightUnit: nextUnit,\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</ToolsPanelItem>\n\t\t\t</InspectorControls>\n\t\t\t<InspectorControls group=\"advanced\">\n\t\t\t\t<SelectControl\n\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\tlabel={ __( 'HTML element' ) }\n\t\t\t\t\toptions={ [\n\t\t\t\t\t\t{ label: __( 'Default (<div>)' ), value: 'div' },\n\t\t\t\t\t\t{ label: '<header>', value: 'header' },\n\t\t\t\t\t\t{ label: '<main>', value: 'main' },\n\t\t\t\t\t\t{ label: '<section>', value: 'section' },\n\t\t\t\t\t\t{ label: '<article>', value: 'article' },\n\t\t\t\t\t\t{ label: '<aside>', value: 'aside' },\n\t\t\t\t\t\t{ label: '<footer>', value: 'footer' },\n\t\t\t\t\t] }\n\t\t\t\t\tvalue={ tagName }\n\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\tsetAttributes( { tagName: value } )\n\t\t\t\t\t}\n\t\t\t\t\thelp={ htmlElementMessages[ tagName ] }\n\t\t\t\t/>\n\t\t\t</InspectorControls>\n\t\t</>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,OAAO,QAAQ,oBAAoB;AAC5C,SACCC,MAAM,EACNC,YAAY,EACZC,gBAAgB,EAChBC,SAAS,EACTC,QAAQ,EACRC,YAAY,EACZC,eAAe,EACfC,aAAa,EACbC,aAAa,EACbC,4BAA4B,IAAIC,cAAc,EAC9CC,4BAA4B,IAAIC,cAAc,EAC9CC,yBAAyB,IAAIC,WAAW,EACxCC,8CAA8C,IAAIC,gCAAgC,QAC5E,uBAAuB;AAC9B,SAASC,aAAa,QAAQ,oBAAoB;AAClD,SACCC,iBAAiB,EACjBC,WAAW,EACXC,2CAA2C,IAAIC,6BAA6B,EAC5EC,yBAAyB,EACzBC,iDAAiD,IAAIC,mCAAmC,QAClF,yBAAyB;AAChC,SAASC,EAAE,QAAQ,iBAAiB;;AAEpC;AACA;AACA;AACA,SAASC,gBAAgB,EAAEC,aAAa,QAAQ,WAAW;AAE3D,SAASC,gBAAgBA,CAAE;EAC1BC,QAAQ;EACRC,YAAY;EACZC,IAAI,GAAG,IAAI;EACXC,KAAK,GAAG;AACT,CAAC,EAAG;EACH,MAAMC,UAAU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O,EAAE5C;IAAM,CAAE,CAClC;IACD4E,IAAI,EAAGf,mBAAmB,CAAEjB,OAAO;EAAI,CACvC,CACiB,CAClB,CAAC;AAEL"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["RichText","useBlockProps","useInnerBlocksProps","store","blockEditorStore","InspectorControls","useSelect","PanelBody","ToggleControl","__","TEMPLATE","placeholder","DetailsEdit","attributes","setAttributes","clientId","showContent","summary","blockProps","innerBlocksProps","template","__experimentalCaptureToolbars","hasSelection","select","isBlockSelected","hasSelectedInnerBlock","createElement","Fragment","title","label","checked","onChange","open","onClick","event","preventDefault","allowedFormats","withoutInteractiveFormatting","value","newSummary","
|
|
1
|
+
{"version":3,"names":["RichText","useBlockProps","useInnerBlocksProps","store","blockEditorStore","InspectorControls","useSelect","PanelBody","ToggleControl","__","TEMPLATE","placeholder","DetailsEdit","attributes","setAttributes","clientId","showContent","summary","blockProps","innerBlocksProps","template","__experimentalCaptureToolbars","hasSelection","select","isBlockSelected","hasSelectedInnerBlock","createElement","Fragment","title","label","checked","onChange","open","onClick","event","preventDefault","allowedFormats","withoutInteractiveFormatting","value","newSummary","children"],"sources":["@wordpress/block-library/src/details/edit.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tRichText,\n\tuseBlockProps,\n\tuseInnerBlocksProps,\n\tstore as blockEditorStore,\n\tInspectorControls,\n} from '@wordpress/block-editor';\nimport { useSelect } from '@wordpress/data';\nimport { PanelBody, ToggleControl } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\n\nconst TEMPLATE = [\n\t[\n\t\t'core/paragraph',\n\t\t{\n\t\t\tplaceholder: __( 'Type / to add a hidden block' ),\n\t\t},\n\t],\n];\n\nfunction DetailsEdit( { attributes, setAttributes, clientId } ) {\n\tconst { showContent, summary } = attributes;\n\tconst blockProps = useBlockProps();\n\tconst innerBlocksProps = useInnerBlocksProps( blockProps, {\n\t\ttemplate: TEMPLATE,\n\t\t__experimentalCaptureToolbars: true,\n\t} );\n\n\t// Check if either the block or the inner blocks are selected.\n\tconst hasSelection = useSelect(\n\t\t( select ) => {\n\t\t\tconst { isBlockSelected, hasSelectedInnerBlock } =\n\t\t\t\tselect( blockEditorStore );\n\t\t\t/* Sets deep to true to also find blocks inside the details content block. */\n\t\t\treturn (\n\t\t\t\thasSelectedInnerBlock( clientId, true ) ||\n\t\t\t\tisBlockSelected( clientId )\n\t\t\t);\n\t\t},\n\t\t[ clientId ]\n\t);\n\n\treturn (\n\t\t<>\n\t\t\t<InspectorControls>\n\t\t\t\t<PanelBody title={ __( 'Settings' ) }>\n\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\tlabel={ __( 'Open by default' ) }\n\t\t\t\t\t\tchecked={ showContent }\n\t\t\t\t\t\tonChange={ () =>\n\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\tshowContent: ! showContent,\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</PanelBody>\n\t\t\t</InspectorControls>\n\t\t\t<details\n\t\t\t\t{ ...innerBlocksProps }\n\t\t\t\topen={ hasSelection || showContent }\n\t\t\t>\n\t\t\t\t<summary onClick={ ( event ) => event.preventDefault() }>\n\t\t\t\t\t<RichText\n\t\t\t\t\t\taria-label={ __( 'Write summary' ) }\n\t\t\t\t\t\tplaceholder={ __( 'Write summary…' ) }\n\t\t\t\t\t\tallowedFormats={ [] }\n\t\t\t\t\t\twithoutInteractiveFormatting\n\t\t\t\t\t\tvalue={ summary }\n\t\t\t\t\t\tonChange={ ( newSummary ) =>\n\t\t\t\t\t\t\tsetAttributes( { summary: newSummary } )\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t</summary>\n\t\t\t\t{ innerBlocksProps.children }\n\t\t\t</details>\n\t\t</>\n\t);\n}\n\nexport default DetailsEdit;\n"],"mappings":";AAAA;AACA;AACA;AACA,SACCA,QAAQ,EACRC,aAAa,EACbC,mBAAmB,EACnB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AAA,GACMP,gBAAgB;IACrBa,IAAI,EAAGV,YAAY,IAAIN;EAAa,GAEpCU,aAAA;IAASO,OAAO,EAAKC,KAAK,IAAMA,KAAK,CAACC,cAAc,CAAC;EAAG,GACvDT,aAAA,CAAC1B,QAAQ;IACR,cAAaS,EAAE,CAAE,eAAgB,CAAG;IACpCE,WAAW,EAAGF,EAAE,CAAE,gBAAiB,CAAG;IACtC2B,cAAc,EAAG,EAAI;IACrBC,4BAA4B;IAC5BC,KAAK,EAAGrB,OAAS;IACjBc,QAAQ,EAAKQ,UAAU,IACtBzB,aAAa,CAAE;MAAEG,OAAO,EAAEsB;IAAW,CAAE;EACvC,CACD,CACO,CAAC,EACRpB,gBAAgB,CAACqB,QACX,CACR,CAAC;AAEL;AAEA,eAAe5B,WAAW"}
|
|
@@ -11,7 +11,7 @@ import { useSelect } from '@wordpress/data';
|
|
|
11
11
|
* Internal dependencies
|
|
12
12
|
*/
|
|
13
13
|
import { formSubmissionNotificationSuccess, formSubmissionNotificationError } from './utils.js';
|
|
14
|
-
const ALLOWED_BLOCKS = ['core/paragraph', 'core/heading', 'core/form-input', 'core/form-submit-button', 'core/form-submission-notification'];
|
|
14
|
+
const ALLOWED_BLOCKS = ['core/paragraph', 'core/heading', 'core/form-input', 'core/form-submit-button', 'core/form-submission-notification', 'core/group', 'core/columns'];
|
|
15
15
|
const TEMPLATE = [formSubmissionNotificationSuccess, formSubmissionNotificationError, ['core/form-input', {
|
|
16
16
|
type: 'text',
|
|
17
17
|
label: __('Name'),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["__","InnerBlocks","useBlockProps","useInnerBlocksProps","InspectorControls","store","blockEditorStore","TextControl","SelectControl","PanelBody","useSelect","formSubmissionNotificationSuccess","formSubmissionNotificationError","ALLOWED_BLOCKS","TEMPLATE","type","label","required","Edit","attributes","setAttributes","clientId","action","method","email","submissionMethod","blockProps","hasInnerBlocks","select","getBlock","block","innerBlocks","length","innerBlocksProps","allowedBlocks","template","renderAppender","undefined","ButtonBlockAppender","createElement","Fragment","title","options","value","onChange","help","__nextHasNoMarginBottom","autoComplete","group","newVal","className","encType"],"sources":["@wordpress/block-library/src/form/edit.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport {\n\tInnerBlocks,\n\tuseBlockProps,\n\tuseInnerBlocksProps,\n\tInspectorControls,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport { TextControl, SelectControl, PanelBody } from '@wordpress/components';\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport {\n\tformSubmissionNotificationSuccess,\n\tformSubmissionNotificationError,\n} from './utils.js';\n\nconst ALLOWED_BLOCKS = [\n\t'core/paragraph',\n\t'core/heading',\n\t'core/form-input',\n\t'core/form-submit-button',\n\t'core/form-submission-notification',\n];\n\nconst TEMPLATE = [\n\tformSubmissionNotificationSuccess,\n\tformSubmissionNotificationError,\n\t[\n\t\t'core/form-input',\n\t\t{\n\t\t\ttype: 'text',\n\t\t\tlabel: __( 'Name' ),\n\t\t\trequired: true,\n\t\t},\n\t],\n\t[\n\t\t'core/form-input',\n\t\t{\n\t\t\ttype: 'email',\n\t\t\tlabel: __( 'Email' ),\n\t\t\trequired: true,\n\t\t},\n\t],\n\t[\n\t\t'core/form-input',\n\t\t{\n\t\t\ttype: 'textarea',\n\t\t\tlabel: __( 'Comment' ),\n\t\t\trequired: true,\n\t\t},\n\t],\n\t[ 'core/form-submit-button', {} ],\n];\n\nconst Edit = ( { attributes, setAttributes, clientId } ) => {\n\tconst { action, method, email, submissionMethod } = attributes;\n\tconst blockProps = useBlockProps();\n\n\tconst { hasInnerBlocks } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getBlock } = select( blockEditorStore );\n\t\t\tconst block = getBlock( clientId );\n\t\t\treturn {\n\t\t\t\thasInnerBlocks: !! ( block && block.innerBlocks.length ),\n\t\t\t};\n\t\t},\n\t\t[ clientId ]\n\t);\n\n\tconst innerBlocksProps = useInnerBlocksProps( blockProps, {\n\t\tallowedBlocks: ALLOWED_BLOCKS,\n\t\ttemplate: TEMPLATE,\n\t\trenderAppender: hasInnerBlocks\n\t\t\t? undefined\n\t\t\t: InnerBlocks.ButtonBlockAppender,\n\t} );\n\n\treturn (\n\t\t<>\n\t\t\t<InspectorControls>\n\t\t\t\t<PanelBody title={ __( 'Settings' ) }>\n\t\t\t\t\t<SelectControl\n\t\t\t\t\t\t// __nextHasNoMarginBottom\n\t\t\t\t\t\t// size={ '__unstable-large' }\n\t\t\t\t\t\tlabel={ __( 'Submissions method' ) }\n\t\t\t\t\t\toptions={ [\n\t\t\t\t\t\t\t// TODO: Allow plugins to add their own submission methods.\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tlabel: __( 'Send email' ),\n\t\t\t\t\t\t\t\tvalue: 'email',\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tlabel: __( '- Custom -' ),\n\t\t\t\t\t\t\t\tvalue: 'custom',\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t] }\n\t\t\t\t\t\tvalue={ submissionMethod }\n\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\tsetAttributes( { submissionMethod: value } )\n\t\t\t\t\t\t}\n\t\t\t\t\t\thelp={\n\t\t\t\t\t\t\tsubmissionMethod === 'custom'\n\t\t\t\t\t\t\t\t? __(\n\t\t\t\t\t\t\t\t\t\t'Select the method to use for form submissions. Additional options for the \"custom\" mode can be found in the \"Advanced\" section.'\n\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\t\t\t'Select the method to use for form submissions.'\n\t\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{ submissionMethod === 'email' && (\n\t\t\t\t\t\t<TextControl\n\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\tautoComplete=\"off\"\n\t\t\t\t\t\t\tlabel={ __( 'Email for form submissions' ) }\n\t\t\t\t\t\t\tvalue={ email }\n\t\t\t\t\t\t\trequired\n\t\t\t\t\t\t\tonChange={ ( value ) => {\n\t\t\t\t\t\t\t\tsetAttributes( { email: value } );\n\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\taction: `mailto:${ value }`,\n\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t\tsetAttributes( { method: 'post' } );\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\thelp={ __(\n\t\t\t\t\t\t\t\t'The email address where form submissions will be sent. Separate multiple email addresses with a comma.'\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</PanelBody>\n\t\t\t</InspectorControls>\n\t\t\t{ submissionMethod !== 'email' && (\n\t\t\t\t<InspectorControls group=\"advanced\">\n\t\t\t\t\t<SelectControl\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\tlabel={ __( 'Method' ) }\n\t\t\t\t\t\toptions={ [\n\t\t\t\t\t\t\t{ label: 'Get', value: 'get' },\n\t\t\t\t\t\t\t{ label: 'Post', value: 'post' },\n\t\t\t\t\t\t] }\n\t\t\t\t\t\tvalue={ method }\n\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\tsetAttributes( { method: value } )\n\t\t\t\t\t\t}\n\t\t\t\t\t\thelp={ __(\n\t\t\t\t\t\t\t'Select the method to use for form submissions.'\n\t\t\t\t\t\t) }\n\t\t\t\t\t/>\n\t\t\t\t\t<TextControl\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\tautoComplete=\"off\"\n\t\t\t\t\t\tlabel={ __( 'Form action' ) }\n\t\t\t\t\t\tvalue={ action }\n\t\t\t\t\t\tonChange={ ( newVal ) => {\n\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\taction: newVal,\n\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t} }\n\t\t\t\t\t\thelp={ __(\n\t\t\t\t\t\t\t'The URL where the form should be submitted.'\n\t\t\t\t\t\t) }\n\t\t\t\t\t/>\n\t\t\t\t</InspectorControls>\n\t\t\t) }\n\t\t\t<form\n\t\t\t\t{ ...innerBlocksProps }\n\t\t\t\tclassName=\"wp-block-form\"\n\t\t\t\tencType={ submissionMethod === 'email' ? 'text/plain' : null }\n\t\t\t/>\n\t\t</>\n\t);\n};\nexport default Edit;\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,EAAE,QAAQ,iBAAiB;AACpC,SACCC,WAAW,EACXC,aAAa,EACbC,mBAAmB,EACnBC,iBAAiB,EACjBC,KAAK,IAAIC,gBAAgB,QACnB,yBAAyB;AAChC,SAASC,WAAW,EAAEC,aAAa,EAAEC,SAAS,QAAQ,uBAAuB;AAC7E,SAASC,SAAS,QAAQ,iBAAiB;;AAE3C;AACA;AACA;AACA,SACCC,iCAAiC,EACjCC,+BAA+B,QACzB,YAAY;AAEnB,MAAMC,cAAc,GAAG,CACtB,gBAAgB,EAChB,cAAc,EACd,iBAAiB,EACjB,yBAAyB,EACzB,mCAAmC,
|
|
1
|
+
{"version":3,"names":["__","InnerBlocks","useBlockProps","useInnerBlocksProps","InspectorControls","store","blockEditorStore","TextControl","SelectControl","PanelBody","useSelect","formSubmissionNotificationSuccess","formSubmissionNotificationError","ALLOWED_BLOCKS","TEMPLATE","type","label","required","Edit","attributes","setAttributes","clientId","action","method","email","submissionMethod","blockProps","hasInnerBlocks","select","getBlock","block","innerBlocks","length","innerBlocksProps","allowedBlocks","template","renderAppender","undefined","ButtonBlockAppender","createElement","Fragment","title","options","value","onChange","help","__nextHasNoMarginBottom","autoComplete","group","newVal","className","encType"],"sources":["@wordpress/block-library/src/form/edit.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport {\n\tInnerBlocks,\n\tuseBlockProps,\n\tuseInnerBlocksProps,\n\tInspectorControls,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport { TextControl, SelectControl, PanelBody } from '@wordpress/components';\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport {\n\tformSubmissionNotificationSuccess,\n\tformSubmissionNotificationError,\n} from './utils.js';\n\nconst ALLOWED_BLOCKS = [\n\t'core/paragraph',\n\t'core/heading',\n\t'core/form-input',\n\t'core/form-submit-button',\n\t'core/form-submission-notification',\n\t'core/group',\n\t'core/columns',\n];\n\nconst TEMPLATE = [\n\tformSubmissionNotificationSuccess,\n\tformSubmissionNotificationError,\n\t[\n\t\t'core/form-input',\n\t\t{\n\t\t\ttype: 'text',\n\t\t\tlabel: __( 'Name' ),\n\t\t\trequired: true,\n\t\t},\n\t],\n\t[\n\t\t'core/form-input',\n\t\t{\n\t\t\ttype: 'email',\n\t\t\tlabel: __( 'Email' ),\n\t\t\trequired: true,\n\t\t},\n\t],\n\t[\n\t\t'core/form-input',\n\t\t{\n\t\t\ttype: 'textarea',\n\t\t\tlabel: __( 'Comment' ),\n\t\t\trequired: true,\n\t\t},\n\t],\n\t[ 'core/form-submit-button', {} ],\n];\n\nconst Edit = ( { attributes, setAttributes, clientId } ) => {\n\tconst { action, method, email, submissionMethod } = attributes;\n\tconst blockProps = useBlockProps();\n\n\tconst { hasInnerBlocks } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getBlock } = select( blockEditorStore );\n\t\t\tconst block = getBlock( clientId );\n\t\t\treturn {\n\t\t\t\thasInnerBlocks: !! ( block && block.innerBlocks.length ),\n\t\t\t};\n\t\t},\n\t\t[ clientId ]\n\t);\n\n\tconst innerBlocksProps = useInnerBlocksProps( blockProps, {\n\t\tallowedBlocks: ALLOWED_BLOCKS,\n\t\ttemplate: TEMPLATE,\n\t\trenderAppender: hasInnerBlocks\n\t\t\t? undefined\n\t\t\t: InnerBlocks.ButtonBlockAppender,\n\t} );\n\n\treturn (\n\t\t<>\n\t\t\t<InspectorControls>\n\t\t\t\t<PanelBody title={ __( 'Settings' ) }>\n\t\t\t\t\t<SelectControl\n\t\t\t\t\t\t// __nextHasNoMarginBottom\n\t\t\t\t\t\t// size={ '__unstable-large' }\n\t\t\t\t\t\tlabel={ __( 'Submissions method' ) }\n\t\t\t\t\t\toptions={ [\n\t\t\t\t\t\t\t// TODO: Allow plugins to add their own submission methods.\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tlabel: __( 'Send email' ),\n\t\t\t\t\t\t\t\tvalue: 'email',\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tlabel: __( '- Custom -' ),\n\t\t\t\t\t\t\t\tvalue: 'custom',\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t] }\n\t\t\t\t\t\tvalue={ submissionMethod }\n\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\tsetAttributes( { submissionMethod: value } )\n\t\t\t\t\t\t}\n\t\t\t\t\t\thelp={\n\t\t\t\t\t\t\tsubmissionMethod === 'custom'\n\t\t\t\t\t\t\t\t? __(\n\t\t\t\t\t\t\t\t\t\t'Select the method to use for form submissions. Additional options for the \"custom\" mode can be found in the \"Advanced\" section.'\n\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\t\t\t'Select the method to use for form submissions.'\n\t\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{ submissionMethod === 'email' && (\n\t\t\t\t\t\t<TextControl\n\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\tautoComplete=\"off\"\n\t\t\t\t\t\t\tlabel={ __( 'Email for form submissions' ) }\n\t\t\t\t\t\t\tvalue={ email }\n\t\t\t\t\t\t\trequired\n\t\t\t\t\t\t\tonChange={ ( value ) => {\n\t\t\t\t\t\t\t\tsetAttributes( { email: value } );\n\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\taction: `mailto:${ value }`,\n\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t\tsetAttributes( { method: 'post' } );\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\thelp={ __(\n\t\t\t\t\t\t\t\t'The email address where form submissions will be sent. Separate multiple email addresses with a comma.'\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</PanelBody>\n\t\t\t</InspectorControls>\n\t\t\t{ submissionMethod !== 'email' && (\n\t\t\t\t<InspectorControls group=\"advanced\">\n\t\t\t\t\t<SelectControl\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\tlabel={ __( 'Method' ) }\n\t\t\t\t\t\toptions={ [\n\t\t\t\t\t\t\t{ label: 'Get', value: 'get' },\n\t\t\t\t\t\t\t{ label: 'Post', value: 'post' },\n\t\t\t\t\t\t] }\n\t\t\t\t\t\tvalue={ method }\n\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\tsetAttributes( { method: value } )\n\t\t\t\t\t\t}\n\t\t\t\t\t\thelp={ __(\n\t\t\t\t\t\t\t'Select the method to use for form submissions.'\n\t\t\t\t\t\t) }\n\t\t\t\t\t/>\n\t\t\t\t\t<TextControl\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\tautoComplete=\"off\"\n\t\t\t\t\t\tlabel={ __( 'Form action' ) }\n\t\t\t\t\t\tvalue={ action }\n\t\t\t\t\t\tonChange={ ( newVal ) => {\n\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\taction: newVal,\n\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t} }\n\t\t\t\t\t\thelp={ __(\n\t\t\t\t\t\t\t'The URL where the form should be submitted.'\n\t\t\t\t\t\t) }\n\t\t\t\t\t/>\n\t\t\t\t</InspectorControls>\n\t\t\t) }\n\t\t\t<form\n\t\t\t\t{ ...innerBlocksProps }\n\t\t\t\tclassName=\"wp-block-form\"\n\t\t\t\tencType={ submissionMethod === 'email' ? 'text/plain' : null }\n\t\t\t/>\n\t\t</>\n\t);\n};\nexport default Edit;\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,EAAE,QAAQ,iBAAiB;AACpC,SACCC,WAAW,EACXC,aAAa,EACbC,mBAAmB,EACnBC,iBAAiB,EACjBC,KAAK,IAAIC,gBAAgB,QACnB,yBAAyB;AAChC,SAASC,WAAW,EAAEC,aAAa,EAAEC,SAAS,QAAQ,uBAAuB;AAC7E,SAASC,SAAS,QAAQ,iBAAiB;;AAE3C;AACA;AACA;AACA,SACCC,iCAAiC,EACjCC,+BAA+B,QACzB,YAAY;AAEnB,MAAMC,cAAc,GAAG,CACtB,gBAAgB,EAChB,cAAc,EACd,iBAAiB,EACjB,yBAAyB,EACzB,mCAAmC,EACnC,YAAY,EACZ,cAAc,CACd;AAED,MAAMC,QAAQ,GAAG,CAChBH,iCAAiC,EACjCC,+BAA+B,EAC/B,CACC,iBAAiB,EACjB;EACCG,IAAI,EAAE,MAAM;EACZC,KAAK,EAAEhB,EAAE,CAAE,MAAO,CAAC;EACnBiB,QAAQ,EAAE;AACX,CAAC,CACD,EACD,CACC,iBAAiB,EACjB;EACCF,IAAI,EAAE,OAAO;EACbC,KAAK,EAAEhB,EAAE,CAAE,OAAQ,CAAC;EACpBiB,QAAQ,EAAE;AACX,CAAC,CACD,EACD,CACC,iBAAiB,EACjB;EACCF,IAAI,EAAE,UAAU;EAChBC,KAAK,EAAEhB,EAAE,CAAE,SAAU,CAAC;EACtBiB,QAAQ,EAAE;AACX,CAAC,CACD,EACD,CAAE,yBAAyB,EAAE,CAAC,CAAC,CAAE,CACjC;AAED,MAAMC,IAAI,GAAGA,CAAE;EAAEC,UAAU;EAAEC,aAAa;EAAEC;AAAS,CAAC,KAAM;EAC3D,MAAM;IAAEC,MAAM;IAAEC,MAAM;IAAEC,KAAK;IAAEC;EAAiB,CAAC,GAAGN,UAAU;EAC9D,MAAMO,UAA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G7C,EAAE,CACR,6CACD;EAAG,CACH,CACiB,CACnB,EACDuC,aAAA;IAAA,GACMN,gBAAgB;IACrBiB,SAAS,EAAC,eAAe;IACzBC,OAAO,EAAG1B,gBAAgB,KAAK,OAAO,GAAG,YAAY,GAAG;EAAM,CAC9D,CACA,CAAC;AAEL,CAAC;AACD,eAAeP,IAAI"}
|
|
@@ -65,6 +65,11 @@ const metadata = {
|
|
|
65
65
|
};
|
|
66
66
|
import save from './save';
|
|
67
67
|
import variations from './variations';
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* WordPress dependencies
|
|
71
|
+
*/
|
|
72
|
+
import { addFilter } from '@wordpress/hooks';
|
|
68
73
|
const {
|
|
69
74
|
name
|
|
70
75
|
} = metadata;
|
|
@@ -74,9 +79,28 @@ export const settings = {
|
|
|
74
79
|
save,
|
|
75
80
|
variations
|
|
76
81
|
};
|
|
77
|
-
export const init = () =>
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
+
export const init = () => {
|
|
83
|
+
// Prevent adding forms inside forms.
|
|
84
|
+
const DISALLOWED_PARENTS = ['core/form'];
|
|
85
|
+
addFilter('blockEditor.__unstableCanInsertBlockType', 'core/block-library/preventInsertingFormIntoAnotherForm', (canInsert, blockType, rootClientId, {
|
|
86
|
+
getBlock,
|
|
87
|
+
getBlockParentsByBlockName
|
|
88
|
+
}) => {
|
|
89
|
+
if (blockType.name !== 'core/form') {
|
|
90
|
+
return canInsert;
|
|
91
|
+
}
|
|
92
|
+
for (const disallowedParentType of DISALLOWED_PARENTS) {
|
|
93
|
+
const hasDisallowedParent = getBlock(rootClientId)?.name === disallowedParentType || getBlockParentsByBlockName(rootClientId, disallowedParentType).length;
|
|
94
|
+
if (hasDisallowedParent) {
|
|
95
|
+
return false;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
return true;
|
|
99
|
+
});
|
|
100
|
+
return initBlock({
|
|
101
|
+
name,
|
|
102
|
+
metadata,
|
|
103
|
+
settings
|
|
104
|
+
});
|
|
105
|
+
};
|
|
82
106
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["initBlock","edit","metadata","$schema","apiVersion","__experimental","name","title","category","description","keywords","textdomain","icon","attributes","submissionMethod","type","method","action","email","supports","anchor","className","color","gradients","link","__experimentalDefaultControls","background","text","spacing","margin","padding","typography","fontSize","lineHeight","__experimentalFontFamily","__experimentalTextDecoration","__experimentalFontStyle","__experimentalFontWeight","__experimentalLetterSpacing","__experimentalTextTransform","__experimentalSelector","viewScript","save","variations","settings","init"],"sources":["@wordpress/block-library/src/form/index.js"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport initBlock from '../utils/init-block';\nimport edit from './edit';\nimport metadata from './block.json';\nimport save from './save';\nimport variations from './variations';\n\nconst { name } = metadata;\n\nexport { metadata, name };\n\nexport const settings = {\n\tedit,\n\tsave,\n\tvariations,\n};\n\nexport const init = () => initBlock( { name, metadata, settings } );\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,SAAS,MAAM,qBAAqB;AAC3C,OAAOC,IAAI,MAAM,QAAQ;AAAC,MAAAC,QAAA;EAAAC,OAAA;EAAAC,UAAA;EAAAC,cAAA;EAAAC,IAAA;EAAAC,KAAA;EAAAC,QAAA;EAAAC,WAAA;EAAAC,QAAA;EAAAC,UAAA;EAAAC,IAAA;EAAAC,UAAA;IAAAC,gBAAA;MAAAC,IAAA;MAAA;IAAA;IAAAC,MAAA;MAAAD,IAAA;MAAA;IAAA;IAAAE,MAAA;MAAAF,IAAA;IAAA;IAAAG,KAAA;MAAAH,IAAA;IAAA;EAAA;EAAAI,QAAA;IAAAC,MAAA;IAAAC,SAAA;IAAAC,KAAA;MAAAC,SAAA;MAAAC,IAAA;MAAAC,6BAAA;QAAAC,UAAA;QAAAC,IAAA;QAAAH,IAAA;MAAA;IAAA;IAAAI,OAAA;MAAAC,MAAA;MAAAC,OAAA;IAAA;IAAAC,UAAA;MAAAC,QAAA;MAAAC,UAAA;MAAAC,wBAAA;MAAAC,4BAAA;MAAAC,uBAAA;MAAAC,wBAAA;MAAAC,2BAAA;MAAAC,2BAAA;MAAAd,6BAAA;QAAAO,QAAA;MAAA;IAAA;IAAAQ,sBAAA;EAAA;EAAAC,UAAA;AAAA;AAE1B,OAAOC,IAAI,MAAM,QAAQ;AACzB,OAAOC,UAAU,MAAM,cAAc;
|
|
1
|
+
{"version":3,"names":["initBlock","edit","metadata","$schema","apiVersion","__experimental","name","title","category","description","keywords","textdomain","icon","attributes","submissionMethod","type","method","action","email","supports","anchor","className","color","gradients","link","__experimentalDefaultControls","background","text","spacing","margin","padding","typography","fontSize","lineHeight","__experimentalFontFamily","__experimentalTextDecoration","__experimentalFontStyle","__experimentalFontWeight","__experimentalLetterSpacing","__experimentalTextTransform","__experimentalSelector","viewScript","save","variations","addFilter","settings","init","DISALLOWED_PARENTS","canInsert","blockType","rootClientId","getBlock","getBlockParentsByBlockName","disallowedParentType","hasDisallowedParent","length"],"sources":["@wordpress/block-library/src/form/index.js"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport initBlock from '../utils/init-block';\nimport edit from './edit';\nimport metadata from './block.json';\nimport save from './save';\nimport variations from './variations';\n\n/**\n * WordPress dependencies\n */\nimport { addFilter } from '@wordpress/hooks';\n\nconst { name } = metadata;\n\nexport { metadata, name };\n\nexport const settings = {\n\tedit,\n\tsave,\n\tvariations,\n};\n\nexport const init = () => {\n\t// Prevent adding forms inside forms.\n\tconst DISALLOWED_PARENTS = [ 'core/form' ];\n\taddFilter(\n\t\t'blockEditor.__unstableCanInsertBlockType',\n\t\t'core/block-library/preventInsertingFormIntoAnotherForm',\n\t\t(\n\t\t\tcanInsert,\n\t\t\tblockType,\n\t\t\trootClientId,\n\t\t\t{ getBlock, getBlockParentsByBlockName }\n\t\t) => {\n\t\t\tif ( blockType.name !== 'core/form' ) {\n\t\t\t\treturn canInsert;\n\t\t\t}\n\n\t\t\tfor ( const disallowedParentType of DISALLOWED_PARENTS ) {\n\t\t\t\tconst hasDisallowedParent =\n\t\t\t\t\tgetBlock( rootClientId )?.name === disallowedParentType ||\n\t\t\t\t\tgetBlockParentsByBlockName(\n\t\t\t\t\t\trootClientId,\n\t\t\t\t\t\tdisallowedParentType\n\t\t\t\t\t).length;\n\t\t\t\tif ( hasDisallowedParent ) {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn true;\n\t\t}\n\t);\n\n\treturn initBlock( { name, metadata, settings } );\n};\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,SAAS,MAAM,qBAAqB;AAC3C,OAAOC,IAAI,MAAM,QAAQ;AAAC,MAAAC,QAAA;EAAAC,OAAA;EAAAC,UAAA;EAAAC,cAAA;EAAAC,IAAA;EAAAC,KAAA;EAAAC,QAAA;EAAAC,WAAA;EAAAC,QAAA;EAAAC,UAAA;EAAAC,IAAA;EAAAC,UAAA;IAAAC,gBAAA;MAAAC,IAAA;MAAA;IAAA;IAAAC,MAAA;MAAAD,IAAA;MAAA;IAAA;IAAAE,MAAA;MAAAF,IAAA;IAAA;IAAAG,KAAA;MAAAH,IAAA;IAAA;EAAA;EAAAI,QAAA;IAAAC,MAAA;IAAAC,SAAA;IAAAC,KAAA;MAAAC,SAAA;MAAAC,IAAA;MAAAC,6BAAA;QAAAC,UAAA;QAAAC,IAAA;QAAAH,IAAA;MAAA;IAAA;IAAAI,OAAA;MAAAC,MAAA;MAAAC,OAAA;IAAA;IAAAC,UAAA;MAAAC,QAAA;MAAAC,UAAA;MAAAC,wBAAA;MAAAC,4BAAA;MAAAC,uBAAA;MAAAC,wBAAA;MAAAC,2BAAA;MAAAC,2BAAA;MAAAd,6BAAA;QAAAO,QAAA;MAAA;IAAA;IAAAQ,sBAAA;EAAA;EAAAC,UAAA;AAAA;AAE1B,OAAOC,IAAI,MAAM,QAAQ;AACzB,OAAOC,UAAU,MAAM,cAAc;;AAErC;AACA;AACA;AACA,SAASC,SAAS,QAAQ,kBAAkB;AAE5C,MAAM;EAAEtC;AAAK,CAAC,GAAGJ,QAAQ;AAEzB,SAASA,QAAQ,EAAEI,IAAI;AAEvB,OAAO,MAAMuC,QAAQ,GAAG;EACvB5C,IAAI;EACJyC,IAAI;EACJC;AACD,CAAC;AAED,OAAO,MAAMG,IAAI,GAAGA,CAAA,KAAM;EACzB;EACA,MAAMC,kBAAkB,GAAG,CAAE,WAAW,CAAE;EAC1CH,SAAS,CACR,0CAA0C,EAC1C,wDAAwD,EACxD,CACCI,SAAS,EACTC,SAAS,EACTC,YAAY,EACZ;IAAEC,QAAQ;IAAEC;EAA2B,CAAC,KACpC;IACJ,IAAKH,SAAS,CAAC3C,IAAI,KAAK,WAAW,EAAG;MACrC,OAAO0C,SAAS;IACjB;IAEA,KAAM,MAAMK,oBAAoB,IAAIN,kBAAkB,EAAG;MACxD,MAAMO,mBAAmB,GACxBH,QAAQ,CAAED,YAAa,CAAC,EAAE5C,IAAI,KAAK+C,oBAAoB,IACvDD,0BAA0B,CACzBF,YAAY,EACZG,oBACD,CAAC,CAACE,MAAM;MACT,IAAKD,mBAAmB,EAAG;QAC1B,OAAO,KAAK;MACb;IACD;IACA,OAAO,IAAI;EACZ,CACD,CAAC;EAED,OAAOtD,SAAS,CAAE;IAAEM,IAAI;IAAEJ,QAAQ;IAAE2C;EAAS,CAAE,CAAC;AACjD,CAAC"}
|
|
@@ -10,7 +10,7 @@ const metadata = {
|
|
|
10
10
|
name: "core/form-input",
|
|
11
11
|
title: "Input Field",
|
|
12
12
|
category: "common",
|
|
13
|
-
|
|
13
|
+
ancestor: ["core/form"],
|
|
14
14
|
description: "The basic building block for forms.",
|
|
15
15
|
keywords: ["input", "form"],
|
|
16
16
|
textdomain: "default",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["initBlock","edit","metadata","$schema","apiVersion","__experimental","name","title","category","
|
|
1
|
+
{"version":3,"names":["initBlock","edit","metadata","$schema","apiVersion","__experimental","name","title","category","ancestor","description","keywords","textdomain","icon","attributes","type","label","selector","source","__experimentalRole","inlineLabel","required","attribute","placeholder","value","visibilityPermissions","supports","anchor","reusable","spacing","margin","__experimentalBorder","radius","__experimentalSkipSerialization","__experimentalDefaultControls","style","save","variations","settings","init"],"sources":["@wordpress/block-library/src/form-input/index.js"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport initBlock from '../utils/init-block';\nimport edit from './edit';\nimport metadata from './block.json';\nimport save from './save';\nimport variations from './variations';\n\nconst { name } = metadata;\n\nexport { metadata, name };\n\nexport const settings = {\n\tedit,\n\tsave,\n\tvariations,\n};\n\nexport const init = () => initBlock( { name, metadata, settings } );\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,SAAS,MAAM,qBAAqB;AAC3C,OAAOC,IAAI,MAAM,QAAQ;AAAC,MAAAC,QAAA;EAAAC,OAAA;EAAAC,UAAA;EAAAC,cAAA;EAAAC,IAAA;EAAAC,KAAA;EAAAC,QAAA;EAAAC,QAAA;EAAAC,WAAA;EAAAC,QAAA;EAAAC,UAAA;EAAAC,IAAA;EAAAC,UAAA;IAAAC,IAAA;MAAAA,IAAA;MAAA;IAAA;IAAAT,IAAA;MAAAS,IAAA;IAAA;IAAAC,KAAA;MAAAD,IAAA;MAAA;MAAAE,QAAA;MAAAC,MAAA;MAAAC,kBAAA;IAAA;IAAAC,WAAA;MAAAL,IAAA;MAAA;IAAA;IAAAM,QAAA;MAAAN,IAAA;MAAA;MAAAE,QAAA;MAAAC,MAAA;MAAAI,SAAA;IAAA;IAAAC,WAAA;MAAAR,IAAA;MAAAE,QAAA;MAAAC,MAAA;MAAAI,SAAA;MAAAH,kBAAA;IAAA;IAAAK,KAAA;MAAAT,IAAA;MAAA;MAAAE,QAAA;MAAAC,MAAA;MAAAI,SAAA;IAAA;IAAAG,qBAAA;MAAAV,IAAA;MAAA;IAAA;EAAA;EAAAW,QAAA;IAAAC,MAAA;IAAAC,QAAA;IAAAC,OAAA;MAAAC,MAAA;IAAA;IAAAC,oBAAA;MAAAC,MAAA;MAAAC,+BAAA;MAAAC,6BAAA;QAAAF,MAAA;MAAA;IAAA;EAAA;EAAAG,KAAA;AAAA;AAE1B,OAAOC,IAAI,MAAM,QAAQ;AACzB,OAAOC,UAAU,MAAM,cAAc;AAErC,MAAM;EAAE/B;AAAK,CAAC,GAAGJ,QAAQ;AAEzB,SAASA,QAAQ,EAAEI,IAAI;AAEvB,OAAO,MAAMgC,QAAQ,GAAG;EACvBrC,IAAI;EACJmC,IAAI;EACJC;AACD,CAAC;AAED,OAAO,MAAME,IAAI,GAAGA,CAAA,KAAMvC,SAAS,CAAE;EAAEM,IAAI;EAAEJ,QAAQ;EAAEoC;AAAS,CAAE,CAAC"}
|
|
@@ -15,7 +15,7 @@ const metadata = {
|
|
|
15
15
|
name: "core/form-submission-notification",
|
|
16
16
|
title: "Form Submission Notification",
|
|
17
17
|
category: "common",
|
|
18
|
-
|
|
18
|
+
ancestor: ["core/form"],
|
|
19
19
|
description: "Provide a notification message after the form has been submitted.",
|
|
20
20
|
keywords: ["form", "feedback", "notification", "message"],
|
|
21
21
|
textdomain: "default",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["group","icon","initBlock","edit","metadata","$schema","apiVersion","__experimental","name","title","category","
|
|
1
|
+
{"version":3,"names":["group","icon","initBlock","edit","metadata","$schema","apiVersion","__experimental","name","title","category","ancestor","description","keywords","textdomain","attributes","type","save","variations","settings","init"],"sources":["@wordpress/block-library/src/form-submission-notification/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { group as icon } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport initBlock from '../utils/init-block';\nimport edit from './edit';\nimport metadata from './block.json';\nimport save from './save';\nimport variations from './variations';\n\nconst { name } = metadata;\n\nexport { metadata, name };\n\nexport const settings = {\n\ticon,\n\tedit,\n\tsave,\n\tvariations,\n};\n\nexport const init = () => initBlock( { name, metadata, settings } );\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,KAAK,IAAIC,IAAI,QAAQ,kBAAkB;;AAEhD;AACA;AACA;AACA,OAAOC,SAAS,MAAM,qBAAqB;AAC3C,OAAOC,IAAI,MAAM,QAAQ;AAAC,MAAAC,QAAA;EAAAC,OAAA;EAAAC,UAAA;EAAAC,cAAA;EAAAC,IAAA;EAAAC,KAAA;EAAAC,QAAA;EAAAC,QAAA;EAAAC,WAAA;EAAAC,QAAA;EAAAC,UAAA;EAAAb,IAAA;EAAAc,UAAA;IAAAC,IAAA;MAAAA,IAAA;MAAA;IAAA;EAAA;AAAA;AAE1B,OAAOC,IAAI,MAAM,QAAQ;AACzB,OAAOC,UAAU,MAAM,cAAc;AAErC,MAAM;EAAEV;AAAK,CAAC,GAAGJ,QAAQ;AAEzB,SAASA,QAAQ,EAAEI,IAAI;AAEvB,OAAO,MAAMW,QAAQ,GAAG;EACvBlB,IAAI;EACJE,IAAI;EACJc,IAAI;EACJC;AACD,CAAC;AAED,OAAO,MAAME,IAAI,GAAGA,CAAA,KAAMlB,SAAS,CAAE;EAAEM,IAAI;EAAEJ,QAAQ;EAAEe;AAAS,CAAE,CAAC"}
|
|
@@ -6,7 +6,8 @@ import { __ } from '@wordpress/i18n';
|
|
|
6
6
|
import { useBlockProps, useInnerBlocksProps } from '@wordpress/block-editor';
|
|
7
7
|
const TEMPLATE = [['core/buttons', {}, [['core/button', {
|
|
8
8
|
text: __('Submit'),
|
|
9
|
-
tagName: 'button'
|
|
9
|
+
tagName: 'button',
|
|
10
|
+
type: 'submit'
|
|
10
11
|
}]]]];
|
|
11
12
|
const Edit = () => {
|
|
12
13
|
const blockProps = useBlockProps();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["__","useBlockProps","useInnerBlocksProps","TEMPLATE","text","tagName","Edit","blockProps","innerBlocksProps","allowedBlocks","template","templateLock","createElement","className"],"sources":["@wordpress/block-library/src/form-submit-button/edit.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useBlockProps, useInnerBlocksProps } from '@wordpress/block-editor';\n\nconst TEMPLATE = [\n\t[\n\t\t'core/buttons',\n\t\t{},\n\t\t[\n\t\t\t[\n\t\t\t\t'core/button',\n\t\t\t\t{\n\t\t\t\t\ttext: __( 'Submit' ),\n\t\t\t\t\ttagName: 'button',\n\t\t\t\t},\n\t\t\t],\n\t\t],\n\t],\n];\nconst Edit = () => {\n\tconst blockProps = useBlockProps();\n\tconst innerBlocksProps = useInnerBlocksProps( blockProps, {\n\t\tallowedBlocks: TEMPLATE,\n\t\ttemplate: TEMPLATE,\n\t\ttemplateLock: 'all',\n\t} );\n\treturn (\n\t\t<div className=\"wp-block-form-submit-wrapper\" { ...innerBlocksProps } />\n\t);\n};\nexport default Edit;\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,EAAE,QAAQ,iBAAiB;AACpC,SAASC,aAAa,EAAEC,mBAAmB,QAAQ,yBAAyB;AAE5E,MAAMC,QAAQ,GAAG,CAChB,CACC,cAAc,EACd,CAAC,CAAC,EACF,CACC,CACC,aAAa,EACb;EACCC,IAAI,EAAEJ,EAAE,CAAE,QAAS,CAAC;EACpBK,OAAO,EAAE;
|
|
1
|
+
{"version":3,"names":["__","useBlockProps","useInnerBlocksProps","TEMPLATE","text","tagName","type","Edit","blockProps","innerBlocksProps","allowedBlocks","template","templateLock","createElement","className"],"sources":["@wordpress/block-library/src/form-submit-button/edit.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useBlockProps, useInnerBlocksProps } from '@wordpress/block-editor';\n\nconst TEMPLATE = [\n\t[\n\t\t'core/buttons',\n\t\t{},\n\t\t[\n\t\t\t[\n\t\t\t\t'core/button',\n\t\t\t\t{\n\t\t\t\t\ttext: __( 'Submit' ),\n\t\t\t\t\ttagName: 'button',\n\t\t\t\t\ttype: 'submit',\n\t\t\t\t},\n\t\t\t],\n\t\t],\n\t],\n];\nconst Edit = () => {\n\tconst blockProps = useBlockProps();\n\tconst innerBlocksProps = useInnerBlocksProps( blockProps, {\n\t\tallowedBlocks: TEMPLATE,\n\t\ttemplate: TEMPLATE,\n\t\ttemplateLock: 'all',\n\t} );\n\treturn (\n\t\t<div className=\"wp-block-form-submit-wrapper\" { ...innerBlocksProps } />\n\t);\n};\nexport default Edit;\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,EAAE,QAAQ,iBAAiB;AACpC,SAASC,aAAa,EAAEC,mBAAmB,QAAQ,yBAAyB;AAE5E,MAAMC,QAAQ,GAAG,CAChB,CACC,cAAc,EACd,CAAC,CAAC,EACF,CACC,CACC,aAAa,EACb;EACCC,IAAI,EAAEJ,EAAE,CAAE,QAAS,CAAC;EACpBK,OAAO,EAAE,QAAQ;EACjBC,IAAI,EAAE;AACP,CAAC,CACD,CACD,CACD,CACD;AACD,MAAMC,IAAI,GAAGA,CAAA,KAAM;EAClB,MAAMC,UAAU,GAAGP,aAAa,CAAC,CAAC;EAClC,MAAMQ,gBAAgB,GAAGP,mBAAmB,CAAEM,UAAU,EAAE;IACzDE,aAAa,EAAEP,QAAQ;IACvBQ,QAAQ,EAAER,QAAQ;IAClBS,YAAY,EAAE;EACf,CAAE,CAAC;EACH,OACCC,aAAA;IAAKC,SAAS,EAAC,8BAA8B;IAAA,GAAML;EAAgB,CAAI,CAAC;AAE1E,CAAC;AACD,eAAeF,IAAI"}
|
|
@@ -11,7 +11,7 @@ const metadata = {
|
|
|
11
11
|
title: "Form Submit Button",
|
|
12
12
|
category: "common",
|
|
13
13
|
icon: "button",
|
|
14
|
-
|
|
14
|
+
ancestor: ["core/form"],
|
|
15
15
|
description: "A submission button for forms.",
|
|
16
16
|
keywords: ["submit", "button", "form"],
|
|
17
17
|
textdomain: "default",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["initBlock","edit","metadata","$schema","apiVersion","__experimental","name","title","category","icon","
|
|
1
|
+
{"version":3,"names":["initBlock","edit","metadata","$schema","apiVersion","__experimental","name","title","category","icon","ancestor","description","keywords","textdomain","style","save","settings","init"],"sources":["@wordpress/block-library/src/form-submit-button/index.js"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport initBlock from '../utils/init-block';\nimport edit from './edit';\nimport metadata from './block.json';\nimport save from './save';\n\nconst { name } = metadata;\n\nexport { metadata, name };\n\nexport const settings = {\n\tedit,\n\tsave,\n};\n\nexport const init = () => initBlock( { name, metadata, settings } );\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,SAAS,MAAM,qBAAqB;AAC3C,OAAOC,IAAI,MAAM,QAAQ;AAAC,MAAAC,QAAA;EAAAC,OAAA;EAAAC,UAAA;EAAAC,cAAA;EAAAC,IAAA;EAAAC,KAAA;EAAAC,QAAA;EAAAC,IAAA;EAAAC,QAAA;EAAAC,WAAA;EAAAC,QAAA;EAAAC,UAAA;EAAAC,KAAA;AAAA;AAE1B,OAAOC,IAAI,MAAM,QAAQ;AAEzB,MAAM;EAAET;AAAK,CAAC,GAAGJ,QAAQ;AAEzB,SAASA,QAAQ,EAAEI,IAAI;AAEvB,OAAO,MAAMU,QAAQ,GAAG;EACvBf,IAAI;EACJc;AACD,CAAC;AAED,OAAO,MAAME,IAAI,GAAGA,CAAA,KAAMjB,SAAS,CAAE;EAAEM,IAAI;EAAEJ,QAAQ;EAAEc;AAAS,CAAE,CAAC"}
|
|
@@ -1,14 +1,19 @@
|
|
|
1
|
-
import { createElement } from "react";
|
|
2
1
|
/**
|
|
3
2
|
* WordPress dependencies
|
|
4
3
|
*/
|
|
5
|
-
import {
|
|
6
|
-
|
|
4
|
+
import { __experimentalGetGapCSSValue as getGapCSSValue, privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Internal dependencies
|
|
8
|
+
*/
|
|
9
|
+
import { unlock } from '../lock-unlock';
|
|
10
|
+
const {
|
|
11
|
+
useStyleOverride
|
|
12
|
+
} = unlock(blockEditorPrivateApis);
|
|
7
13
|
export default function GapStyles({
|
|
8
14
|
blockGap,
|
|
9
15
|
clientId
|
|
10
16
|
}) {
|
|
11
|
-
const styleElement = useContext(BlockList.__unstableElementContext);
|
|
12
17
|
// --gallery-block--gutter-size is deprecated. --wp--style--gallery-gap-default should be used by themes that want to set a default
|
|
13
18
|
// gap on the gallery.
|
|
14
19
|
const fallbackValue = `var( --wp--style--gallery-gap-default, var( --gallery-block--gutter-size, var( --wp--style--block-gap, 0.5em ) ) )`;
|
|
@@ -28,9 +33,9 @@ export default function GapStyles({
|
|
|
28
33
|
--wp--style--unstable-gallery-gap: ${column === '0' ? '0px' : column};
|
|
29
34
|
gap: ${gapValue}
|
|
30
35
|
}`;
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
};
|
|
34
|
-
return
|
|
36
|
+
useStyleOverride({
|
|
37
|
+
css: gap
|
|
38
|
+
});
|
|
39
|
+
return null;
|
|
35
40
|
}
|
|
36
41
|
//# sourceMappingURL=gap-styles.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["__experimentalGetGapCSSValue","getGapCSSValue","privateApis","blockEditorPrivateApis","unlock","useStyleOverride","GapStyles","blockGap","clientId","fallbackValue","gapValue","column","row","top","left","gap","css"],"sources":["@wordpress/block-library/src/gallery/gap-styles.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalGetGapCSSValue as getGapCSSValue,\n\tprivateApis as blockEditorPrivateApis,\n} from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../lock-unlock';\n\nconst { useStyleOverride } = unlock( blockEditorPrivateApis );\n\nexport default function GapStyles( { blockGap, clientId } ) {\n\t// --gallery-block--gutter-size is deprecated. --wp--style--gallery-gap-default should be used by themes that want to set a default\n\t// gap on the gallery.\n\tconst fallbackValue = `var( --wp--style--gallery-gap-default, var( --gallery-block--gutter-size, var( --wp--style--block-gap, 0.5em ) ) )`;\n\tlet gapValue = fallbackValue;\n\tlet column = fallbackValue;\n\tlet row;\n\n\t// Check for the possibility of split block gap values. See: https://github.com/WordPress/gutenberg/pull/37736\n\tif ( !! blockGap ) {\n\t\trow =\n\t\t\ttypeof blockGap === 'string'\n\t\t\t\t? getGapCSSValue( blockGap )\n\t\t\t\t: getGapCSSValue( blockGap?.top ) || fallbackValue;\n\t\tcolumn =\n\t\t\ttypeof blockGap === 'string'\n\t\t\t\t? getGapCSSValue( blockGap )\n\t\t\t\t: getGapCSSValue( blockGap?.left ) || fallbackValue;\n\t\tgapValue = row === column ? row : `${ row } ${ column }`;\n\t}\n\n\t// The unstable gallery gap calculation requires a real value (such as `0px`) and not `0`.\n\tconst gap = `#block-${ clientId } {\n\t\t--wp--style--unstable-gallery-gap: ${ column === '0' ? '0px' : column };\n\t\tgap: ${ gapValue }\n\t}`;\n\n\tuseStyleOverride( { css: gap } );\n\n\treturn null;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SACCA,4BAA4B,IAAIC,cAAc,EAC9CC,WAAW,IAAIC,sBAAsB,QAC/B,yBAAyB;;AAEhC;AACA;AACA;AACA,SAASC,MAAM,QAAQ,gBAAgB;AAEvC,MAAM;EAAEC;AAAiB,CAAC,GAAGD,MAAM,CAAED,sBAAuB,CAAC;AAE7D,eAAe,SAASG,SAASA,CAAE;EAAEC,QAAQ;EAAEC;AAAS,CAAC,EAAG;EAC3D;EACA;EACA,MAAMC,aAAa,GAAI,oHAAmH;EAC1I,IAAIC,QAAQ,GAAGD,aAAa;EAC5B,IAAIE,MAAM,GAAGF,aAAa;EAC1B,IAAIG,GAAG;;EAEP;EACA,IAAK,CAAC,CAAEL,QAAQ,EAAG;IAClBK,GAAG,GACF,OAAOL,QAAQ,KAAK,QAAQ,GACzBN,cAAc,CAAEM,QAAS,CAAC,GAC1BN,cAAc,CAAEM,QAAQ,EAAEM,GAAI,CAAC,IAAIJ,aAAa;IACpDE,MAAM,GACL,OAAOJ,QAAQ,KAAK,QAAQ,GACzBN,cAAc,CAAEM,QAAS,CAAC,GAC1BN,cAAc,CAAEM,QAAQ,EAAEO,IAAK,CAAC,IAAIL,aAAa;IACrDC,QAAQ,GAAGE,GAAG,KAAKD,MAAM,GAAGC,GAAG,GAAI,GAAGA,GAAK,IAAID,MAAQ,EAAC;EACzD;;EAEA;EACA,MAAMI,GAAG,GAAI,UAAUP,QAAU;AAClC,uCAAwCG,MAAM,KAAK,GAAG,GAAG,KAAK,GAAGA,MAAQ;AACzE,SAAUD,QAAU;AACpB,GAAG;EAEFL,gBAAgB,CAAE;IAAEW,GAAG,EAAED;EAAI,CAAE,CAAC;EAEhC,OAAO,IAAI;AACZ"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useDispatch","useSelect","InnerBlocks","useBlockProps","InspectorControls","useInnerBlocksProps","store","blockEditorStore","SelectControl","__","View","GroupPlaceHolder","useShouldShowPlaceHolder","GroupEditControls","tagName","onSelectTagName","htmlElementMessages","header","main","section","article","aside","footer","createElement","group","__nextHasNoMarginBottom","label","options","value","onChange","help","GroupEdit","attributes","name","setAttributes","clientId","__unstableLayoutClassNames","layoutClassNames","hasInnerBlocks","themeSupportsLayout","select","getBlock","getSettings","block","innerBlocks","length","supportsLayout","TagName","templateLock","allowedBlocks","layout","type","layoutSupportEnabled","blockProps","className","showPlaceholder","setShowPlaceholder","usedLayoutType","renderAppender","ButtonBlockAppender","innerBlocksProps","__unstableDisableLayoutClassNames","selectBlock","selectVariation","nextVariation","Fragment","children","onSelect"],"sources":["@wordpress/block-library/src/group/edit.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport {\n\tInnerBlocks,\n\tuseBlockProps,\n\tInspectorControls,\n\tuseInnerBlocksProps,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport { SelectControl } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { View } from '@wordpress/primitives';\n\n/**\n * Internal dependencies\n */\nimport GroupPlaceHolder, { useShouldShowPlaceHolder } from './placeholder';\n\n/**\n * Render inspector controls for the Group block.\n *\n * @param {Object} props Component props.\n * @param {string} props.tagName The HTML tag name.\n * @param {Function} props.onSelectTagName onChange function for the SelectControl.\n *\n * @return {JSX.Element} The control group.\n */\nfunction GroupEditControls( { tagName, onSelectTagName } ) {\n\tconst htmlElementMessages = {\n\t\theader: __(\n\t\t\t'The <header> element should represent introductory content, typically a group of introductory or navigational aids.'\n\t\t),\n\t\tmain: __(\n\t\t\t'The <main> element should be used for the primary content of your document only. '\n\t\t),\n\t\tsection: __(\n\t\t\t\"The <section> element should represent a standalone portion of the document that can't be better represented by another element.\"\n\t\t),\n\t\tarticle: __(\n\t\t\t'The <article> element should represent a self-contained, syndicatable portion of the document.'\n\t\t),\n\t\taside: __(\n\t\t\t\"The <aside> element should represent a portion of a document whose content is only indirectly related to the document's main content.\"\n\t\t),\n\t\tfooter: __(\n\t\t\t'The <footer> element should represent a footer for its nearest sectioning element (e.g.: <section>, <article>, <main> etc.).'\n\t\t),\n\t};\n\treturn (\n\t\t<InspectorControls group=\"advanced\">\n\t\t\t<SelectControl\n\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\tlabel={ __( 'HTML element' ) }\n\t\t\t\toptions={ [\n\t\t\t\t\t{ label: __( 'Default (<div>)' ), value: 'div' },\n\t\t\t\t\t{ label: '<header>', value: 'header' },\n\t\t\t\t\t{ label: '<main>', value: 'main' },\n\t\t\t\t\t{ label: '<section>', value: 'section' },\n\t\t\t\t\t{ label: '<article>', value: 'article' },\n\t\t\t\t\t{ label: '<aside>', value: 'aside' },\n\t\t\t\t\t{ label: '<footer>', value: 'footer' },\n\t\t\t\t] }\n\t\t\t\tvalue={ tagName }\n\t\t\t\tonChange={ onSelectTagName }\n\t\t\t\thelp={ htmlElementMessages[ tagName ] }\n\t\t\t/>\n\t\t</InspectorControls>\n\t);\n}\n\nfunction GroupEdit( {\n\tattributes,\n\tname,\n\tsetAttributes,\n\tclientId,\n\t__unstableLayoutClassNames: layoutClassNames,\n} ) {\n\tconst { hasInnerBlocks, themeSupportsLayout } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getBlock, getSettings } = select( blockEditorStore );\n\t\t\tconst block = getBlock( clientId );\n\t\t\treturn {\n\t\t\t\thasInnerBlocks: !! ( block && block.innerBlocks.length ),\n\t\t\t\tthemeSupportsLayout: getSettings()?.supportsLayout,\n\t\t\t};\n\t\t},\n\t\t[ clientId ]\n\t);\n\n\tconst {\n\t\ttagName: TagName = 'div',\n\t\ttemplateLock,\n\t\tallowedBlocks,\n\t\tlayout = {},\n\t} = attributes;\n\n\t// Layout settings.\n\tconst { type = 'default' } = layout;\n\tconst layoutSupportEnabled =\n\t\tthemeSupportsLayout || type === 'flex' || type === 'grid';\n\n\t// Hooks.\n\tconst blockProps = useBlockProps( {\n\t\tclassName: ! layoutSupportEnabled ? layoutClassNames : null,\n\t} );\n\tconst [ showPlaceholder, setShowPlaceholder ] = useShouldShowPlaceHolder( {\n\t\tattributes,\n\t\tusedLayoutType: type,\n\t\thasInnerBlocks,\n\t} );\n\n\t// Default to the regular appender being rendered.\n\tlet renderAppender;\n\tif ( showPlaceholder ) {\n\t\t// In the placeholder state, ensure the appender is not rendered.\n\t\t// This is needed because `...innerBlocksProps` is used in the placeholder\n\t\t// state so that blocks can dragged onto the placeholder area\n\t\t// from both the list view and in the editor canvas.\n\t\trenderAppender = false;\n\t} else if ( ! hasInnerBlocks ) {\n\t\t// When there is no placeholder, but the block is also empty,\n\t\t// use the larger button appender.\n\t\trenderAppender = InnerBlocks.ButtonBlockAppender;\n\t}\n\n\tconst innerBlocksProps = useInnerBlocksProps(\n\t\tlayoutSupportEnabled\n\t\t\t? blockProps\n\t\t\t: { className: 'wp-block-group__inner-container' },\n\t\t{\n\t\t\ttemplateLock,\n\t\t\tallowedBlocks,\n\t\t\trenderAppender,\n\t\t\t__unstableDisableLayoutClassNames: ! layoutSupportEnabled,\n\t\t}\n\t);\n\n\tconst { selectBlock } = useDispatch( blockEditorStore );\n\n\tconst selectVariation = ( nextVariation ) => {\n\t\tsetAttributes( nextVariation.attributes );\n\t\tselectBlock( clientId, -1 );\n\t\tsetShowPlaceholder( false );\n\t};\n\n\treturn (\n\t\t<>\n\t\t\t<GroupEditControls\n\t\t\t\ttagName={ TagName }\n\t\t\t\tonSelectTagName={ ( value ) =>\n\t\t\t\t\tsetAttributes( { tagName: value } )\n\t\t\t\t}\n\t\t\t/>\n\t\t\t{ showPlaceholder && (\n\t\t\t\t<View>\n\t\t\t\t\t{ innerBlocksProps.children }\n\t\t\t\t\t<GroupPlaceHolder\n\t\t\t\t\t\tname={ name }\n\t\t\t\t\t\tonSelect={ selectVariation }\n\t\t\t\t\t/>\n\t\t\t\t</View>\n\t\t\t) }\n\t\t\t{ layoutSupportEnabled && ! showPlaceholder && (\n\t\t\t\t<TagName { ...innerBlocksProps } />\n\t\t\t) }\n\t\t\t{ /* Ideally this is not needed but it's there for backward compatibility reason\n\t\t\t\tto keep this div for themes that might rely on its presence */ }\n\t\t\t{ ! layoutSupportEnabled && ! showPlaceholder && (\n\t\t\t\t<TagName { ...blockProps }>\n\t\t\t\t\t<div { ...innerBlocksProps } />\n\t\t\t\t</TagName>\n\t\t\t) }\n\t\t</>\n\t);\n}\n\nexport default GroupEdit;\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,WAAW,EAAEC,SAAS,QAAQ,iBAAiB;AACxD,SACCC,WAAW,EACXC,aAAa,EACbC,iBAAiB,EACjBC,mBAAmB,EACnBC,KAAK,IAAIC,gBAAgB,QACnB,yBAAyB;AAChC,SAASC,aAAa,QAAQ,uBAAuB;AACrD,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SAASC,IAAI,QAAQ,uBAAuB;;AAE5C;AACA;AACA;AACA,OAAOC,gBAAgB,IAAIC,wBAAwB,QAAQ,eAAe;;AAE1E;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASC,iBAAiBA,CAAE;EAAEC,OAAO;EAAE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AAa;IACbS,cAAc;IACdG,iCAAiC,EAAE,CAAET;EACtC,CACD,CAAC;EAED,MAAM;IAAEU;EAAY,CAAC,GAAG9D,WAAW,CAAEO,gBAAiB,CAAC;EAEvD,MAAMwD,eAAe,GAAKC,aAAa,IAAM;IAC5C9B,aAAa,CAAE8B,aAAa,CAAChC,UAAW,CAAC;IACzC8B,WAAW,CAAE3B,QAAQ,EAAE,CAAC,CAAE,CAAC;IAC3BqB,kBAAkB,CAAE,KAAM,CAAC;EAC5B,CAAC;EAED,OACCjC,aAAA,CAAA0C,QAAA,QACC1C,aAAA,CAACV,iBAAiB;IACjBC,OAAO,EAAGiC,OAAS;IACnBhC,eAAe,EAAKa,KAAK,IACxBM,aAAa,CAAE;MAAEpB,OAAO,EAAEc;IAAM,CAAE;EAClC,CACD,CAAC,EACA2B,eAAe,IAChBhC,aAAA,CAACb,IAAI,QACFkD,gBAAgB,CAACM,QAAQ,EAC3B3C,aAAA,CAACZ,gBAAgB;IAChBsB,IAAI,EAAGA,IAAM;IACbkC,QAAQ,EAAGJ;EAAiB,CAC5B,CACI,CACN,EACCX,oBAAoB,IAAI,CAAEG,eAAe,IAC1ChC,aAAA,CAACwB,OAAO;IAAA,GAAMa;EAAgB,CAAI,CAClC,EAGC,CAAER,oBAAoB,IAAI,CAAEG,eAAe,IAC5ChC,aAAA,CAACwB,OAAO;IAAA,GAAMM;EAAU,GACvB9B,aAAA;IAAA,GAAUqC;EAAgB,CAAI,CACtB,CAET,CAAC;AAEL;AAEA,eAAe7B,SAAS"}
|
|
1
|
+
{"version":3,"names":["useDispatch","useSelect","InnerBlocks","useBlockProps","InspectorControls","useInnerBlocksProps","store","blockEditorStore","SelectControl","__","View","GroupPlaceHolder","useShouldShowPlaceHolder","GroupEditControls","tagName","onSelectTagName","htmlElementMessages","header","main","section","article","aside","footer","createElement","group","__nextHasNoMarginBottom","__next40pxDefaultSize","label","options","value","onChange","help","GroupEdit","attributes","name","setAttributes","clientId","__unstableLayoutClassNames","layoutClassNames","hasInnerBlocks","themeSupportsLayout","select","getBlock","getSettings","block","innerBlocks","length","supportsLayout","TagName","templateLock","allowedBlocks","layout","type","layoutSupportEnabled","blockProps","className","showPlaceholder","setShowPlaceholder","usedLayoutType","renderAppender","ButtonBlockAppender","innerBlocksProps","__unstableDisableLayoutClassNames","selectBlock","selectVariation","nextVariation","Fragment","children","onSelect"],"sources":["@wordpress/block-library/src/group/edit.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport {\n\tInnerBlocks,\n\tuseBlockProps,\n\tInspectorControls,\n\tuseInnerBlocksProps,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport { SelectControl } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { View } from '@wordpress/primitives';\n\n/**\n * Internal dependencies\n */\nimport GroupPlaceHolder, { useShouldShowPlaceHolder } from './placeholder';\n\n/**\n * Render inspector controls for the Group block.\n *\n * @param {Object} props Component props.\n * @param {string} props.tagName The HTML tag name.\n * @param {Function} props.onSelectTagName onChange function for the SelectControl.\n *\n * @return {JSX.Element} The control group.\n */\nfunction GroupEditControls( { tagName, onSelectTagName } ) {\n\tconst htmlElementMessages = {\n\t\theader: __(\n\t\t\t'The <header> element should represent introductory content, typically a group of introductory or navigational aids.'\n\t\t),\n\t\tmain: __(\n\t\t\t'The <main> element should be used for the primary content of your document only. '\n\t\t),\n\t\tsection: __(\n\t\t\t\"The <section> element should represent a standalone portion of the document that can't be better represented by another element.\"\n\t\t),\n\t\tarticle: __(\n\t\t\t'The <article> element should represent a self-contained, syndicatable portion of the document.'\n\t\t),\n\t\taside: __(\n\t\t\t\"The <aside> element should represent a portion of a document whose content is only indirectly related to the document's main content.\"\n\t\t),\n\t\tfooter: __(\n\t\t\t'The <footer> element should represent a footer for its nearest sectioning element (e.g.: <section>, <article>, <main> etc.).'\n\t\t),\n\t};\n\treturn (\n\t\t<InspectorControls group=\"advanced\">\n\t\t\t<SelectControl\n\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t__next40pxDefaultSize\n\t\t\t\tlabel={ __( 'HTML element' ) }\n\t\t\t\toptions={ [\n\t\t\t\t\t{ label: __( 'Default (<div>)' ), value: 'div' },\n\t\t\t\t\t{ label: '<header>', value: 'header' },\n\t\t\t\t\t{ label: '<main>', value: 'main' },\n\t\t\t\t\t{ label: '<section>', value: 'section' },\n\t\t\t\t\t{ label: '<article>', value: 'article' },\n\t\t\t\t\t{ label: '<aside>', value: 'aside' },\n\t\t\t\t\t{ label: '<footer>', value: 'footer' },\n\t\t\t\t] }\n\t\t\t\tvalue={ tagName }\n\t\t\t\tonChange={ onSelectTagName }\n\t\t\t\thelp={ htmlElementMessages[ tagName ] }\n\t\t\t/>\n\t\t</InspectorControls>\n\t);\n}\n\nfunction GroupEdit( {\n\tattributes,\n\tname,\n\tsetAttributes,\n\tclientId,\n\t__unstableLayoutClassNames: layoutClassNames,\n} ) {\n\tconst { hasInnerBlocks, themeSupportsLayout } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getBlock, getSettings } = select( blockEditorStore );\n\t\t\tconst block = getBlock( clientId );\n\t\t\treturn {\n\t\t\t\thasInnerBlocks: !! ( block && block.innerBlocks.length ),\n\t\t\t\tthemeSupportsLayout: getSettings()?.supportsLayout,\n\t\t\t};\n\t\t},\n\t\t[ clientId ]\n\t);\n\n\tconst {\n\t\ttagName: TagName = 'div',\n\t\ttemplateLock,\n\t\tallowedBlocks,\n\t\tlayout = {},\n\t} = attributes;\n\n\t// Layout settings.\n\tconst { type = 'default' } = layout;\n\tconst layoutSupportEnabled =\n\t\tthemeSupportsLayout || type === 'flex' || type === 'grid';\n\n\t// Hooks.\n\tconst blockProps = useBlockProps( {\n\t\tclassName: ! layoutSupportEnabled ? layoutClassNames : null,\n\t} );\n\tconst [ showPlaceholder, setShowPlaceholder ] = useShouldShowPlaceHolder( {\n\t\tattributes,\n\t\tusedLayoutType: type,\n\t\thasInnerBlocks,\n\t} );\n\n\t// Default to the regular appender being rendered.\n\tlet renderAppender;\n\tif ( showPlaceholder ) {\n\t\t// In the placeholder state, ensure the appender is not rendered.\n\t\t// This is needed because `...innerBlocksProps` is used in the placeholder\n\t\t// state so that blocks can dragged onto the placeholder area\n\t\t// from both the list view and in the editor canvas.\n\t\trenderAppender = false;\n\t} else if ( ! hasInnerBlocks ) {\n\t\t// When there is no placeholder, but the block is also empty,\n\t\t// use the larger button appender.\n\t\trenderAppender = InnerBlocks.ButtonBlockAppender;\n\t}\n\n\tconst innerBlocksProps = useInnerBlocksProps(\n\t\tlayoutSupportEnabled\n\t\t\t? blockProps\n\t\t\t: { className: 'wp-block-group__inner-container' },\n\t\t{\n\t\t\ttemplateLock,\n\t\t\tallowedBlocks,\n\t\t\trenderAppender,\n\t\t\t__unstableDisableLayoutClassNames: ! layoutSupportEnabled,\n\t\t}\n\t);\n\n\tconst { selectBlock } = useDispatch( blockEditorStore );\n\n\tconst selectVariation = ( nextVariation ) => {\n\t\tsetAttributes( nextVariation.attributes );\n\t\tselectBlock( clientId, -1 );\n\t\tsetShowPlaceholder( false );\n\t};\n\n\treturn (\n\t\t<>\n\t\t\t<GroupEditControls\n\t\t\t\ttagName={ TagName }\n\t\t\t\tonSelectTagName={ ( value ) =>\n\t\t\t\t\tsetAttributes( { tagName: value } )\n\t\t\t\t}\n\t\t\t/>\n\t\t\t{ showPlaceholder && (\n\t\t\t\t<View>\n\t\t\t\t\t{ innerBlocksProps.children }\n\t\t\t\t\t<GroupPlaceHolder\n\t\t\t\t\t\tname={ name }\n\t\t\t\t\t\tonSelect={ selectVariation }\n\t\t\t\t\t/>\n\t\t\t\t</View>\n\t\t\t) }\n\t\t\t{ layoutSupportEnabled && ! showPlaceholder && (\n\t\t\t\t<TagName { ...innerBlocksProps } />\n\t\t\t) }\n\t\t\t{ /* Ideally this is not needed but it's there for backward compatibility reason\n\t\t\t\tto keep this div for themes that might rely on its presence */ }\n\t\t\t{ ! layoutSupportEnabled && ! showPlaceholder && (\n\t\t\t\t<TagName { ...blockProps }>\n\t\t\t\t\t<div { ...innerBlocksProps } />\n\t\t\t\t</TagName>\n\t\t\t) }\n\t\t</>\n\t);\n}\n\nexport default GroupEdit;\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,WAAW,EAAEC,SAAS,QAAQ,iBAAiB;AACxD,SACCC,WAAW,EACXC,aAAa,EACbC,iBAAiB,EACjBC,mBAAmB,EACnBC,KAAK,IAAIC,gBAAgB,QACnB,yBAAyB;AAChC,SAASC,aAAa,QAAQ,uBAAuB;AACrD,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SAASC,IAAI,QAAQ,uBAAuB;;AAE5C;AACA;AACA;AACA,OAAOC,gBAAgB,IAAIC,wBAAwB,QAAQ,eAAe;;AAE1E;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASC,iBAAiBA,CAAE;EAAEC,OAAO;EAAEC;AAAgB,CAAC,EAAG;EAC1D,MAAMC,mBAAmB,GAAG;IAC3BC,MAAM,EAAER,EAAE,CACT,qHACD,CAAC;IACDS,IAAI,EAAET,EAAE,CACP,mFACD,CAAC;IACDU,OAAO,EAAEV,EAAE,CACV,kIACD,CAAC;IACDW,OAAO,EAAEX,EAAE,CACV,gGACD,CAAC;IACDY,KAAK,EAAEZ,EAAE,CACR,uIACD,CAAC;IACDa,MAAM,EAAEb,EAAE,CACT,8HACD;EACD,CAAC;EACD,OACCc,aAAA,CAACnB,iBAAiB;IAACoB,KAAK,EAAC;EAAU,GAClCD,aAAA,CAACf,aAAa;IACbiB,uBAAuB;IACvBC,qBAAqB;IACrBC,KAAK,EAAGlB,EAAE,CAAE,cAAe,CAAG;IAC9BmB,OAAO,EAAG,CACT;MAAED,KAAK,EAAElB,EAAE,CAAE,iBAAkB,CAAC;MAAEoB,KAAK,EAAE;IAAM,CAAC,EAChD;MAAEF,KAAK,EAAE,UAAU;MAAEE,KAAK,EAAE;IAAS,CAAC,EACtC;MAAEF,KAAK,EAAE,QAA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GJ;EAAiB,CAC5B,CACI,CACN,EACCX,oBAAoB,IAAI,CAAEG,eAAe,IAC1CjC,aAAA,CAACyB,OAAO;IAAA,GAAMa;EAAgB,CAAI,CAClC,EAGC,CAAER,oBAAoB,IAAI,CAAEG,eAAe,IAC5CjC,aAAA,CAACyB,OAAO;IAAA,GAAMM;EAAU,GACvB/B,aAAA;IAAA,GAAUsC;EAAgB,CAAI,CACtB,CAET,CAAC;AAEL;AAEA,eAAe7B,SAAS"}
|
|
@@ -2,15 +2,20 @@
|
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
4
|
import { createBlock } from '@wordpress/blocks';
|
|
5
|
+
import { create } from '@wordpress/rich-text';
|
|
5
6
|
const transforms = {
|
|
6
7
|
from: [{
|
|
7
8
|
type: 'block',
|
|
8
9
|
blocks: ['core/code'],
|
|
9
10
|
transform: ({
|
|
10
|
-
content
|
|
11
|
+
content: html
|
|
11
12
|
}) => {
|
|
12
13
|
return createBlock('core/html', {
|
|
13
|
-
|
|
14
|
+
// The code block may output HTML formatting, so convert it
|
|
15
|
+
// to plain text.
|
|
16
|
+
content: create({
|
|
17
|
+
html
|
|
18
|
+
}).text
|
|
14
19
|
});
|
|
15
20
|
}
|
|
16
21
|
}]
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["createBlock","transforms","from","type","blocks","transform","content"],"sources":["@wordpress/block-library/src/html/transforms.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { createBlock } from '@wordpress/blocks';\n\nconst transforms = {\n\tfrom: [\n\t\t{\n\t\t\ttype: 'block',\n\t\t\tblocks: [ 'core/code' ],\n\t\t\ttransform: ( { content } ) => {\n\t\t\t\treturn createBlock( 'core/html', {\n\t\t\t\t\tcontent,\n\t\t\t\t} );\n\t\t\t},\n\t\t},\n\t],\n};\n\nexport default transforms;\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,WAAW,QAAQ,mBAAmB;
|
|
1
|
+
{"version":3,"names":["createBlock","create","transforms","from","type","blocks","transform","content","html","text"],"sources":["@wordpress/block-library/src/html/transforms.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { createBlock } from '@wordpress/blocks';\nimport { create } from '@wordpress/rich-text';\n\nconst transforms = {\n\tfrom: [\n\t\t{\n\t\t\ttype: 'block',\n\t\t\tblocks: [ 'core/code' ],\n\t\t\ttransform: ( { content: html } ) => {\n\t\t\t\treturn createBlock( 'core/html', {\n\t\t\t\t\t// The code block may output HTML formatting, so convert it\n\t\t\t\t\t// to plain text.\n\t\t\t\t\tcontent: create( { html } ).text,\n\t\t\t\t} );\n\t\t\t},\n\t\t},\n\t],\n};\n\nexport default transforms;\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,WAAW,QAAQ,mBAAmB;AAC/C,SAASC,MAAM,QAAQ,sBAAsB;AAE7C,MAAMC,UAAU,GAAG;EAClBC,IAAI,EAAE,CACL;IACCC,IAAI,EAAE,OAAO;IACbC,MAAM,EAAE,CAAE,WAAW,CAAE;IACvBC,SAAS,EAAEA,CAAE;MAAEC,OAAO,EAAEC;IAAK,CAAC,KAAM;MACnC,OAAOR,WAAW,CAAE,WAAW,EAAE;QAChC;QACA;QACAO,OAAO,EAAEN,MAAM,CAAE;UAAEO;QAAK,CAAE,CAAC,CAACC;MAC7B,CAAE,CAAC;IACJ;EACD,CAAC;AAEH,CAAC;AAED,eAAeP,UAAU"}
|
|
@@ -998,6 +998,14 @@ const v8 = {
|
|
|
998
998
|
height,
|
|
999
999
|
...attributes
|
|
1000
1000
|
}) {
|
|
1001
|
+
// We need to perform a check here because in cases
|
|
1002
|
+
// where attributes are added dynamically to blocks,
|
|
1003
|
+
// block invalidation overrides the isEligible() method
|
|
1004
|
+
// and forces the migration to run, so it's not guaranteed
|
|
1005
|
+
// that `behaviors` or `behaviors.lightbox` will be defined.
|
|
1006
|
+
if (!attributes.behaviors?.lightbox) {
|
|
1007
|
+
return attributes;
|
|
1008
|
+
}
|
|
1001
1009
|
const {
|
|
1002
1010
|
behaviors: {
|
|
1003
1011
|
lightbox: {
|