@wordpress/block-editor 9.6.0 → 9.7.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 +2 -0
- package/build/components/block-list/block.js +12 -2
- package/build/components/block-list/block.js.map +1 -1
- package/build/components/block-list/index.native.js +1 -1
- package/build/components/block-list/index.native.js.map +1 -1
- package/build/components/block-popover/inbetween.js +1 -1
- package/build/components/block-popover/inbetween.js.map +1 -1
- package/build/components/block-styles/index.js +3 -6
- package/build/components/block-styles/index.js.map +1 -1
- package/build/components/block-types-list/index.js +1 -1
- package/build/components/block-types-list/index.js.map +1 -1
- package/build/components/border-radius-control/index.js +3 -1
- package/build/components/border-radius-control/index.js.map +1 -1
- package/build/components/colors/utils.js +6 -2
- package/build/components/colors/utils.js.map +1 -1
- package/build/components/colors-gradients/control.js +7 -4
- package/build/components/colors-gradients/control.js.map +1 -1
- package/build/components/colors-gradients/dropdown.js +5 -2
- package/build/components/colors-gradients/dropdown.js.map +1 -1
- package/build/components/font-appearance-control/index.js +10 -4
- package/build/components/font-appearance-control/index.js.map +1 -1
- package/build/components/image-size-control/index.js +3 -1
- package/build/components/image-size-control/index.js.map +1 -1
- package/build/components/index.js +13 -6
- package/build/components/index.js.map +1 -1
- package/build/components/index.native.js +11 -4
- package/build/components/index.native.js.map +1 -1
- package/build/components/inserter/index.native.js +8 -3
- package/build/components/inserter/index.native.js.map +1 -1
- package/build/components/inserter-list-item/index.js +2 -19
- package/build/components/inserter-list-item/index.js.map +1 -1
- package/build/components/letter-spacing-control/index.js +6 -3
- package/build/components/letter-spacing-control/index.js.map +1 -1
- package/build/components/line-height-control/index.js +6 -3
- package/build/components/line-height-control/index.js.map +1 -1
- package/build/components/link-control/is-url-like.js +1 -7
- package/build/components/link-control/is-url-like.js.map +1 -1
- package/build/components/link-control/use-search-handler.js +1 -7
- package/build/components/link-control/use-search-handler.js.map +1 -1
- package/build/components/list-view/expander.js +3 -1
- package/build/components/list-view/expander.js.map +1 -1
- package/build/components/media-upload/index.native.js +8 -3
- package/build/components/media-upload/index.native.js.map +1 -1
- package/build/components/preview-options/index.js +2 -2
- package/build/components/preview-options/index.js.map +1 -1
- package/build/components/{use-no-recursive-renders → recursion-provider}/index.js +40 -18
- package/build/components/recursion-provider/index.js.map +1 -0
- package/build/components/rich-text/index.js +6 -1
- package/build/components/rich-text/index.js.map +1 -1
- package/build/components/rich-text/index.native.js +3 -1
- package/build/components/rich-text/index.native.js.map +1 -1
- package/build/components/rich-text/use-before-input-rules.js +110 -0
- package/build/components/rich-text/use-before-input-rules.js.map +1 -0
- package/build/components/text-decoration-control/index.js +3 -1
- package/build/components/text-decoration-control/index.js.map +1 -1
- package/build/components/text-transform-control/index.js +3 -1
- package/build/components/text-transform-control/index.js.map +1 -1
- package/build/components/url-popover/image-url-input-ui.js +4 -1
- package/build/components/url-popover/image-url-input-ui.js.map +1 -1
- package/build/components/writing-flow/use-arrow-nav.js +4 -25
- package/build/components/writing-flow/use-arrow-nav.js.map +1 -1
- package/build/components/writing-flow/use-drag-selection.js +9 -2
- package/build/components/writing-flow/use-drag-selection.js.map +1 -1
- package/build/components/writing-flow/use-select-all.js +3 -1
- package/build/components/writing-flow/use-select-all.js.map +1 -1
- package/build/hooks/layout.js +9 -2
- package/build/hooks/layout.js.map +1 -1
- package/build/utils/block-variation-transforms.js +15 -9
- package/build/utils/block-variation-transforms.js.map +1 -1
- package/build/utils/pasting.js +9 -1
- package/build/utils/pasting.js.map +1 -1
- package/build-module/components/block-list/block.js +13 -3
- package/build-module/components/block-list/block.js.map +1 -1
- package/build-module/components/block-list/index.native.js +1 -1
- package/build-module/components/block-list/index.native.js.map +1 -1
- package/build-module/components/block-popover/inbetween.js +1 -1
- package/build-module/components/block-popover/inbetween.js.map +1 -1
- package/build-module/components/block-styles/index.js +4 -7
- package/build-module/components/block-styles/index.js.map +1 -1
- package/build-module/components/block-types-list/index.js +1 -1
- package/build-module/components/block-types-list/index.js.map +1 -1
- package/build-module/components/border-radius-control/index.js +4 -2
- package/build-module/components/border-radius-control/index.js.map +1 -1
- package/build-module/components/colors/utils.js +7 -3
- package/build-module/components/colors/utils.js.map +1 -1
- package/build-module/components/colors-gradients/control.js +7 -4
- package/build-module/components/colors-gradients/control.js.map +1 -1
- package/build-module/components/colors-gradients/dropdown.js +5 -2
- package/build-module/components/colors-gradients/dropdown.js.map +1 -1
- package/build-module/components/font-appearance-control/index.js +7 -4
- package/build-module/components/font-appearance-control/index.js.map +1 -1
- package/build-module/components/image-size-control/index.js +3 -1
- package/build-module/components/image-size-control/index.js.map +1 -1
- package/build-module/components/index.js +1 -1
- package/build-module/components/index.js.map +1 -1
- package/build-module/components/index.native.js +1 -1
- package/build-module/components/index.native.js.map +1 -1
- package/build-module/components/inserter/index.native.js +9 -2
- package/build-module/components/inserter/index.native.js.map +1 -1
- package/build-module/components/inserter-list-item/index.js +1 -17
- package/build-module/components/inserter-list-item/index.js.map +1 -1
- package/build-module/components/letter-spacing-control/index.js +5 -3
- package/build-module/components/letter-spacing-control/index.js.map +1 -1
- package/build-module/components/line-height-control/index.js +5 -3
- package/build-module/components/line-height-control/index.js.map +1 -1
- package/build-module/components/link-control/is-url-like.js +1 -6
- package/build-module/components/link-control/is-url-like.js.map +1 -1
- package/build-module/components/link-control/use-search-handler.js +1 -6
- package/build-module/components/link-control/use-search-handler.js.map +1 -1
- package/build-module/components/list-view/expander.js +3 -2
- package/build-module/components/list-view/expander.js.map +1 -1
- package/build-module/components/media-upload/index.native.js +9 -2
- package/build-module/components/media-upload/index.native.js.map +1 -1
- package/build-module/components/preview-options/index.js +2 -2
- package/build-module/components/preview-options/index.js.map +1 -1
- package/build-module/components/{use-no-recursive-renders → recursion-provider}/index.js +39 -19
- package/build-module/components/recursion-provider/index.js.map +1 -0
- package/build-module/components/rich-text/index.js +5 -1
- package/build-module/components/rich-text/index.js.map +1 -1
- package/build-module/components/rich-text/index.native.js +3 -1
- package/build-module/components/rich-text/index.native.js.map +1 -1
- package/build-module/components/rich-text/use-before-input-rules.js +96 -0
- package/build-module/components/rich-text/use-before-input-rules.js.map +1 -0
- package/build-module/components/text-decoration-control/index.js +4 -2
- package/build-module/components/text-decoration-control/index.js.map +1 -1
- package/build-module/components/text-transform-control/index.js +4 -2
- package/build-module/components/text-transform-control/index.js.map +1 -1
- package/build-module/components/url-popover/image-url-input-ui.js +4 -1
- package/build-module/components/url-popover/image-url-input-ui.js.map +1 -1
- package/build-module/components/writing-flow/use-arrow-nav.js +5 -26
- package/build-module/components/writing-flow/use-arrow-nav.js.map +1 -1
- package/build-module/components/writing-flow/use-drag-selection.js +9 -2
- package/build-module/components/writing-flow/use-drag-selection.js.map +1 -1
- package/build-module/components/writing-flow/use-select-all.js +3 -1
- package/build-module/components/writing-flow/use-select-all.js.map +1 -1
- package/build-module/hooks/layout.js +9 -2
- package/build-module/hooks/layout.js.map +1 -1
- package/build-module/utils/block-variation-transforms.js +14 -7
- package/build-module/utils/block-variation-transforms.js.map +1 -1
- package/build-module/utils/pasting.js +9 -1
- package/build-module/utils/pasting.js.map +1 -1
- package/build-style/style-rtl.css +39 -7
- package/build-style/style.css +39 -7
- package/package.json +28 -28
- package/src/components/block-list/block.js +13 -2
- package/src/components/block-list/index.native.js +1 -1
- package/src/components/block-popover/inbetween.js +1 -0
- package/src/components/block-popover/style.scss +25 -2
- package/src/components/block-styles/index.js +4 -7
- package/src/components/block-styles/style.scss +10 -0
- package/src/components/block-types-list/index.js +1 -1
- package/src/components/border-radius-control/index.js +4 -1
- package/src/components/color-palette/test/__snapshots__/control.js.snap +93 -77
- package/src/components/colors/utils.js +5 -2
- package/src/components/colors-gradients/control.js +12 -8
- package/src/components/colors-gradients/dropdown.js +7 -2
- package/src/components/colors-gradients/style.scss +27 -5
- package/src/components/colors-gradients/test/control.js +3 -3
- package/src/components/font-appearance-control/index.js +3 -0
- package/src/components/image-size-control/README.md +7 -0
- package/src/components/image-size-control/index.js +2 -0
- package/src/components/index.js +4 -1
- package/src/components/index.native.js +4 -1
- package/src/components/inserter/index.native.js +7 -2
- package/src/components/inserter-list-item/index.js +1 -17
- package/src/components/letter-spacing-control/index.js +2 -0
- package/src/components/line-height-control/index.js +2 -0
- package/src/components/link-control/is-url-like.js +1 -6
- package/src/components/link-control/use-search-handler.js +1 -6
- package/src/components/list-view/expander.js +4 -2
- package/src/components/media-upload/index.native.js +7 -3
- package/src/components/preview-options/index.js +2 -2
- package/src/components/{use-no-recursive-renders → recursion-provider}/index.js +39 -28
- package/src/components/{use-no-recursive-renders/test/use-no-recursive-renders.js → recursion-provider/test/index.js} +5 -6
- package/src/components/rich-text/README.md +13 -1
- package/src/components/rich-text/index.js +2 -0
- package/src/components/rich-text/index.native.js +2 -0
- package/src/components/rich-text/use-before-input-rules.js +91 -0
- package/src/components/text-decoration-control/index.js +4 -2
- package/src/components/text-transform-control/index.js +4 -2
- package/src/components/url-popover/image-url-input-ui.js +3 -0
- package/src/components/writing-flow/use-arrow-nav.js +4 -33
- package/src/components/writing-flow/use-drag-selection.js +7 -1
- package/src/components/writing-flow/use-select-all.js +2 -1
- package/src/hooks/layout.js +8 -2
- package/src/utils/block-variation-transforms.js +13 -6
- package/src/utils/pasting.js +10 -1
- package/src/utils/test/block-variation-transforms.js +24 -0
- package/src/utils/test/pasting.js +10 -0
- package/build/components/use-no-recursive-renders/index.js.map +0 -1
- package/build-module/components/use-no-recursive-renders/index.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-editor/src/hooks/layout.js"],"names":["classnames","has","kebabCase","createHigherOrderComponent","useInstanceId","addFilter","getBlockDefaultClassName","getBlockSupport","hasBlockSupport","useSelect","Button","ButtonGroup","ToggleControl","PanelBody","__","useContext","createPortal","store","blockEditorStore","InspectorControls","useSetting","LayoutStyle","BlockList","getLayoutType","getLayoutTypes","layoutBlockSupportKey","useLayoutClasses","layout","layoutDefinitions","rootPaddingAlignment","select","getSettings","__experimentalFeatures","useRootPaddingAwareAlignments","layoutClassnames","type","className","push","inherit","contentSize","orientation","justifyContent","flexWrap","LayoutPanel","setAttributes","attributes","name","blockName","defaultThemeLayout","themeSupportsLayout","supportsLayout","layoutBlockSupport","allowSwitching","allowEditing","allowInheriting","default","defaultBlockLayout","showInheritToggle","usedLayout","layoutType","onChangeType","newType","onChangeLayout","newLayout","LayoutTypeSwitcher","onChange","map","label","addAttribute","settings","withInspectorControls","BlockEdit","props","supportLayout","withLayoutStyles","BlockListBlock","shouldRenderLayoutStyles","id","element","__unstableElementContext","layoutClasses","definitions","selector","blockGapSupport","hasBlockGapSupport","css","fullLayoutType","getLayoutStyle","style"],"mappings":";;;AAAA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,YAAvB;AACA,SAASC,GAAT,EAAcC,SAAd,QAA+B,QAA/B;AAEA;AACA;AACA;;AACA,SAASC,0BAAT,EAAqCC,aAArC,QAA0D,oBAA1D;AACA,SAASC,SAAT,QAA0B,kBAA1B;AACA,SACCC,wBADD,EAECC,eAFD,EAGCC,eAHD,QAIO,mBAJP;AAKA,SAASC,SAAT,QAA0B,iBAA1B;AACA,SACCC,MADD,EAECC,WAFD,EAGCC,aAHD,EAICC,SAJD,QAKO,uBALP;AAMA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SAASC,UAAT,EAAqBC,YAArB,QAAyC,oBAAzC;AAEA;AACA;AACA;;AACA,SAASC,KAAK,IAAIC,gBAAlB,QAA0C,UAA1C;AACA,SAASC,iBAAT,QAAkC,eAAlC;AACA,OAAOC,UAAP,MAAuB,2BAAvB;AACA,SAASC,WAAT,QAA4B,iCAA5B;AACA,OAAOC,SAAP,MAAsB,0BAAtB;AACA,SAASC,aAAT,EAAwBC,cAAxB,QAA8C,YAA9C;AAEA,MAAMC,qBAAqB,GAAG,sBAA9B;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,SAASC,gBAAT,CAA2BC,MAA3B,EAAmCC,iBAAnC,EAAuD;AAAA;;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,EAAGoC,QAFZ;AAGC,IAAA,GAAG,EAAGG,GAHP;AAIC,IAAA,MAAM,EAAG3B,UAJV;AAKC,IAAA,KAAK,EAAGb,UAAH,aAAGA,UAAH,uBAAGA,UAAU,CAAE2C;AALrB,IADW,EAQXV,OARW,CAJd,EAcC,cAAC,cAAD,eAAqBN,KAArB;AAA6B,IAAA,SAAS,EAAGpC;AAAzC,KAdD,CADD;AAkBA,CArEwD,CAAnD;AAwEP/B,SAAS,CACR,0BADQ,EAER,0BAFQ,EAGR+D,YAHQ,CAAT;AAKA/D,SAAS,CACR,uBADQ,EAER,uCAFQ,EAGRqE,gBAHQ,CAAT;AAKArE,SAAS,CACR,kBADQ,EAER,4CAFQ,EAGRiE,qBAHQ,CAAT","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\nimport { has, kebabCase } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { createHigherOrderComponent, useInstanceId } from '@wordpress/compose';\nimport { addFilter } from '@wordpress/hooks';\nimport {\n\tgetBlockDefaultClassName,\n\tgetBlockSupport,\n\thasBlockSupport,\n} from '@wordpress/blocks';\nimport { useSelect } from '@wordpress/data';\nimport {\n\tButton,\n\tButtonGroup,\n\tToggleControl,\n\tPanelBody,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { useContext, createPortal } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../store';\nimport { InspectorControls } from '../components';\nimport useSetting from '../components/use-setting';\nimport { LayoutStyle } from '../components/block-list/layout';\nimport BlockList from '../components/block-list';\nimport { getLayoutType, getLayoutTypes } from '../layouts';\n\nconst layoutBlockSupportKey = '__experimentalLayout';\n\n/**\n * Generates the utility classnames for the given blocks layout attributes.\n * This method was primarily added to reintroduce classnames that were removed\n * in the 5.9 release (https://github.com/WordPress/gutenberg/issues/38719), rather\n * than providing an extensive list of all possible layout classes. The plan is to\n * have the style engine generate a more extensive list of utility classnames which\n * will then replace this method.\n *\n * @param { Object } layout Layout object.\n * @param { Object } layoutDefinitions An object containing layout definitions, stored in theme.json.\n *\n * @return { Array } Array of CSS classname strings.\n */\nfunction useLayoutClasses( layout, layoutDefinitions ) {\n\tconst rootPaddingAlignment = useSelect( ( select ) => {\n\t\tconst { getSettings } = select( blockEditorStore );\n\t\treturn getSettings().__experimentalFeatures\n\t\t\t?.useRootPaddingAwareAlignments;\n\t}, [] );\n\tconst layoutClassnames = [];\n\n\tif ( layoutDefinitions?.[ layout?.type || 'default' ]?.className ) {\n\t\tlayoutClassnames.push(\n\t\t\tlayoutDefinitions?.[ layout?.type || 'default' ]?.className\n\t\t);\n\t}\n\n\tif ( ( layout?.inherit || layout?.contentSize ) && rootPaddingAlignment ) {\n\t\tlayoutClassnames.push( 'has-global-padding' );\n\t}\n\n\tif ( layout?.orientation ) {\n\t\tlayoutClassnames.push( `is-${ kebabCase( layout.orientation ) }` );\n\t}\n\n\tif ( layout?.justifyContent ) {\n\t\tlayoutClassnames.push(\n\t\t\t`is-content-justification-${ kebabCase( layout.justifyContent ) }`\n\t\t);\n\t}\n\n\tif ( layout?.flexWrap && layout.flexWrap === 'nowrap' ) {\n\t\tlayoutClassnames.push( 'is-nowrap' );\n\t}\n\n\treturn layoutClassnames;\n}\n\nfunction LayoutPanel( { setAttributes, attributes, name: blockName } ) {\n\tconst { layout } = attributes;\n\tconst defaultThemeLayout = useSetting( 'layout' );\n\tconst themeSupportsLayout = useSelect( ( select ) => {\n\t\tconst { getSettings } = select( blockEditorStore );\n\t\treturn getSettings().supportsLayout;\n\t}, [] );\n\n\tconst layoutBlockSupport = getBlockSupport(\n\t\tblockName,\n\t\tlayoutBlockSupportKey,\n\t\t{}\n\t);\n\tconst {\n\t\tallowSwitching,\n\t\tallowEditing = true,\n\t\tallowInheriting = true,\n\t\tdefault: defaultBlockLayout,\n\t} = layoutBlockSupport;\n\n\tif ( ! allowEditing ) {\n\t\treturn null;\n\t}\n\n\t// Only show the inherit toggle if it's supported,\n\t// a default theme layout is set (e.g. one that provides `contentSize` and/or `wideSize` values),\n\t// and that the default / flow layout type is in use, as this is the only one that supports inheritance.\n\tconst showInheritToggle = !! (\n\t\tallowInheriting &&\n\t\t!! defaultThemeLayout &&\n\t\t( ! layout?.type || layout?.type === 'default' || layout?.inherit )\n\t);\n\n\tconst usedLayout = layout || defaultBlockLayout || {};\n\tconst { inherit = false, type = 'default' } = usedLayout;\n\t/**\n\t * `themeSupportsLayout` is only relevant to the `default/flow`\n\t * layout and it should not be taken into account when other\n\t * `layout` types are used.\n\t */\n\tif ( type === 'default' && ! themeSupportsLayout ) {\n\t\treturn null;\n\t}\n\tconst layoutType = getLayoutType( type );\n\n\tconst onChangeType = ( newType ) =>\n\t\tsetAttributes( { layout: { type: newType } } );\n\tconst onChangeLayout = ( newLayout ) =>\n\t\tsetAttributes( { layout: newLayout } );\n\n\treturn (\n\t\t<>\n\t\t\t<InspectorControls>\n\t\t\t\t<PanelBody title={ __( 'Layout' ) }>\n\t\t\t\t\t{ showInheritToggle && (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t\t\tlabel={ __( 'Inner blocks use full width' ) }\n\t\t\t\t\t\t\t\tchecked={ ! inherit }\n\t\t\t\t\t\t\t\tonChange={ () =>\n\t\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\t\tlayout: {\n\t\t\t\t\t\t\t\t\t\t\tinherit: ! inherit,\n\t\t\t\t\t\t\t\t\t\t},\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\t<p className=\"block-editor-hooks__layout-controls-helptext\">\n\t\t\t\t\t\t\t\t{ !! inherit\n\t\t\t\t\t\t\t\t\t? __(\n\t\t\t\t\t\t\t\t\t\t\t'Nested blocks use theme content width with options for full and wide widths.'\n\t\t\t\t\t\t\t\t\t )\n\t\t\t\t\t\t\t\t\t: __(\n\t\t\t\t\t\t\t\t\t\t\t'Nested blocks will fill the width of this container.'\n\t\t\t\t\t\t\t\t\t ) }\n\t\t\t\t\t\t\t</p>\n\t\t\t\t\t\t</>\n\t\t\t\t\t) }\n\n\t\t\t\t\t{ ! inherit && allowSwitching && (\n\t\t\t\t\t\t<LayoutTypeSwitcher\n\t\t\t\t\t\t\ttype={ type }\n\t\t\t\t\t\t\tonChange={ onChangeType }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\n\t\t\t\t\t{ ! inherit && layoutType && (\n\t\t\t\t\t\t<layoutType.inspectorControls\n\t\t\t\t\t\t\tlayout={ usedLayout }\n\t\t\t\t\t\t\tonChange={ onChangeLayout }\n\t\t\t\t\t\t\tlayoutBlockSupport={ layoutBlockSupport }\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{ ! inherit && layoutType && (\n\t\t\t\t<layoutType.toolBarControls\n\t\t\t\t\tlayout={ usedLayout }\n\t\t\t\t\tonChange={ onChangeLayout }\n\t\t\t\t\tlayoutBlockSupport={ layoutBlockSupport }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</>\n\t);\n}\n\nfunction LayoutTypeSwitcher( { type, onChange } ) {\n\treturn (\n\t\t<ButtonGroup>\n\t\t\t{ getLayoutTypes().map( ( { name, label } ) => {\n\t\t\t\treturn (\n\t\t\t\t\t<Button\n\t\t\t\t\t\tkey={ name }\n\t\t\t\t\t\tisPressed={ type === name }\n\t\t\t\t\t\tonClick={ () => onChange( name ) }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ label }\n\t\t\t\t\t</Button>\n\t\t\t\t);\n\t\t\t} ) }\n\t\t</ButtonGroup>\n\t);\n}\n\n/**\n * Filters registered block settings, extending attributes to include `layout`.\n *\n * @param {Object} settings Original block settings.\n *\n * @return {Object} Filtered block settings.\n */\nexport function addAttribute( settings ) {\n\tif ( has( settings.attributes, [ 'layout', 'type' ] ) ) {\n\t\treturn settings;\n\t}\n\tif ( hasBlockSupport( settings, layoutBlockSupportKey ) ) {\n\t\tsettings.attributes = {\n\t\t\t...settings.attributes,\n\t\t\tlayout: {\n\t\t\t\ttype: 'object',\n\t\t\t},\n\t\t};\n\t}\n\n\treturn settings;\n}\n\n/**\n * Override the default edit UI to include layout controls\n *\n * @param {Function} BlockEdit Original component.\n *\n * @return {Function} Wrapped component.\n */\nexport const withInspectorControls = createHigherOrderComponent(\n\t( BlockEdit ) => ( props ) => {\n\t\tconst { name: blockName } = props;\n\t\tconst supportLayout = hasBlockSupport(\n\t\t\tblockName,\n\t\t\tlayoutBlockSupportKey\n\t\t);\n\n\t\treturn [\n\t\t\tsupportLayout && <LayoutPanel key=\"layout\" { ...props } />,\n\t\t\t<BlockEdit key=\"edit\" { ...props } />,\n\t\t];\n\t},\n\t'withInspectorControls'\n);\n\n/**\n * Override the default block element to add the layout styles.\n *\n * @param {Function} BlockListBlock Original component.\n *\n * @return {Function} Wrapped component.\n */\nexport const withLayoutStyles = createHigherOrderComponent(\n\t( BlockListBlock ) => ( props ) => {\n\t\tconst { name, attributes } = props;\n\t\tconst shouldRenderLayoutStyles = hasBlockSupport(\n\t\t\tname,\n\t\t\tlayoutBlockSupportKey\n\t\t);\n\t\tconst id = useInstanceId( BlockListBlock );\n\t\tconst defaultThemeLayout = useSetting( 'layout' ) || {};\n\t\tconst element = useContext( BlockList.__unstableElementContext );\n\t\tconst { layout } = attributes;\n\t\tconst { default: defaultBlockLayout } =\n\t\t\tgetBlockSupport( name, layoutBlockSupportKey ) || {};\n\t\tconst usedLayout = layout?.inherit\n\t\t\t? defaultThemeLayout\n\t\t\t: layout || defaultBlockLayout || {};\n\t\tconst layoutClasses = shouldRenderLayoutStyles\n\t\t\t? useLayoutClasses( usedLayout, defaultThemeLayout?.definitions )\n\t\t\t: null;\n\t\tconst selector = `.${ getBlockDefaultClassName(\n\t\t\tname\n\t\t) }.wp-container-${ id }`;\n\t\tconst blockGapSupport = useSetting( 'spacing.blockGap' );\n\t\tconst hasBlockGapSupport = blockGapSupport !== null;\n\n\t\t// Get CSS string for the current layout type.\n\t\t// The CSS and `style` element is only output if it is not empty.\n\t\tlet css;\n\t\tif ( shouldRenderLayoutStyles ) {\n\t\t\tconst fullLayoutType = getLayoutType(\n\t\t\t\tusedLayout?.type || 'default'\n\t\t\t);\n\t\t\tcss = fullLayoutType?.getLayoutStyle?.( {\n\t\t\t\tblockName: name,\n\t\t\t\tselector,\n\t\t\t\tlayout: usedLayout,\n\t\t\t\tlayoutDefinitions: defaultThemeLayout?.definitions,\n\t\t\t\tstyle: attributes?.style,\n\t\t\t\thasBlockGapSupport,\n\t\t\t} );\n\t\t}\n\n\t\t// Attach a `wp-container-` id-based class name as well as a layout class name such as `is-layout-flex`.\n\t\tconst className = classnames(\n\t\t\tprops?.className,\n\t\t\t{\n\t\t\t\t[ `wp-container-${ id }` ]: shouldRenderLayoutStyles && !! css, // Only attach a container class if there is generated CSS to be attached.\n\t\t\t},\n\t\t\tlayoutClasses\n\t\t);\n\n\t\treturn (\n\t\t\t<>\n\t\t\t\t{ shouldRenderLayoutStyles &&\n\t\t\t\t\telement &&\n\t\t\t\t\t!! css &&\n\t\t\t\t\tcreatePortal(\n\t\t\t\t\t\t<LayoutStyle\n\t\t\t\t\t\t\tblockName={ name }\n\t\t\t\t\t\t\tselector={ selector }\n\t\t\t\t\t\t\tcss={ css }\n\t\t\t\t\t\t\tlayout={ usedLayout }\n\t\t\t\t\t\t\tstyle={ attributes?.style }\n\t\t\t\t\t\t/>,\n\t\t\t\t\t\telement\n\t\t\t\t\t) }\n\t\t\t\t<BlockListBlock { ...props } className={ className } />\n\t\t\t</>\n\t\t);\n\t}\n);\n\naddFilter(\n\t'blocks.registerBlockType',\n\t'core/layout/addAttribute',\n\taddAttribute\n);\naddFilter(\n\t'editor.BlockListBlock',\n\t'core/editor/layout/with-layout-styles',\n\twithLayoutStyles\n);\naddFilter(\n\t'editor.BlockEdit',\n\t'core/editor/layout/with-inspector-controls',\n\twithInspectorControls\n);\n"]}
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-editor/src/hooks/layout.js"],"names":["classnames","has","kebabCase","createHigherOrderComponent","useInstanceId","addFilter","getBlockDefaultClassName","getBlockSupport","hasBlockSupport","useSelect","Button","ButtonGroup","ToggleControl","PanelBody","__","useContext","createPortal","store","blockEditorStore","InspectorControls","useSetting","LayoutStyle","BlockList","getLayoutType","getLayoutTypes","layoutBlockSupportKey","useLayoutClasses","layout","layoutDefinitions","rootPaddingAlignment","select","getSettings","__experimentalFeatures","useRootPaddingAwareAlignments","layoutClassnames","type","className","push","inherit","contentSize","orientation","justifyContent","flexWrap","LayoutPanel","setAttributes","attributes","name","blockName","defaultThemeLayout","themeSupportsLayout","supportsLayout","layoutBlockSupport","allowSwitching","allowEditing","allowInheriting","default","defaultBlockLayout","showInheritToggle","usedLayout","layoutType","onChangeType","newType","onChangeLayout","newLayout","LayoutTypeSwitcher","onChange","map","label","addAttribute","settings","withInspectorControls","BlockEdit","props","supportLayout","withLayoutStyles","BlockListBlock","hasLayoutBlockSupport","disableLayoutStyles","shouldRenderLayoutStyles","id","element","__unstableElementContext","layoutClasses","definitions","selector","blockGapSupport","hasBlockGapSupport","css","fullLayoutType","getLayoutStyle","style"],"mappings":";;;AAAA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,YAAvB;AACA,SAASC,GAAT,EAAcC,SAAd,QAA+B,QAA/B;AAEA;AACA;AACA;;AACA,SAASC,0BAAT,EAAqCC,aAArC,QAA0D,oBAA1D;AACA,SAASC,SAAT,QAA0B,kBAA1B;AACA,SACCC,wBADD,EAECC,eAFD,EAGCC,eAHD,QAIO,mBAJP;AAKA,SAASC,SAAT,QAA0B,iBAA1B;AACA,SACCC,MADD,EAECC,WAFD,EAGCC,aAHD,EAICC,SAJD,QAKO,uBALP;AAMA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SAASC,UAAT,EAAqBC,YAArB,QAAyC,oBAAzC;AAEA;AACA;AACA;;AACA,S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FuC;AAGvCzD,MAAAA,MAAM,EAAE+B,UAH+B;AAIvC9B,MAAAA,iBAAiB,EAAEoB,kBAAF,aAAEA,kBAAF,uBAAEA,kBAAkB,CAAEmC,WAJA;AAKvCO,MAAAA,KAAK,EAAE7C,UAAF,aAAEA,UAAF,uBAAEA,UAAU,CAAE6C,KALoB;AAMvCJ,MAAAA;AANuC,KAApB,CAApB;AAQA,GA7CiC,CA+ClC;;;AACA,QAAMlD,SAAS,GAAGpC,UAAU,CAC3BwE,KAD2B,aAC3BA,KAD2B,uBAC3BA,KAAK,CAAEpC,SADoB,EAE3B;AACC,KAAG,gBAAgB2C,EAAI,EAAvB,GAA4BD,wBAAwB,IAAI,CAAC,CAAES,GAD5D,CACiE;;AADjE,GAF2B,EAK3BL,aAL2B,CAA5B;AAQA,SACC,8BACGJ,wBAAwB,IACzBE,OADC,IAED,CAAC,CAAEO,GAFF,IAGDvE,YAAY,CACX,cAAC,WAAD;AACC,IAAA,SAAS,EAAG8B,IADb;AAEC,IAAA,QAAQ,EAAGsC,QAFZ;AAGC,IAAA,GAAG,EAAGG,GAHP;AAIC,IAAA,MAAM,EAAG7B,UAJV;AAKC,IAAA,KAAK,EAAGb,UAAH,aAAGA,UAAH,uBAAGA,UAAU,CAAE6C;AALrB,IADW,EAQXV,OARW,CAJd,EAcC,cAAC,cAAD,eAAqBR,KAArB;AAA6B,IAAA,SAAS,EAAGpC;AAAzC,KAdD,CADD;AAkBA,CA3EwD,CAAnD;AA8EP/B,SAAS,CACR,0BADQ,EAER,0BAFQ,EAGR+D,YAHQ,CAAT;AAKA/D,SAAS,CACR,uBADQ,EAER,uCAFQ,EAGRqE,gBAHQ,CAAT;AAKArE,SAAS,CACR,kBADQ,EAER,4CAFQ,EAGRiE,qBAHQ,CAAT","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\nimport { has, kebabCase } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { createHigherOrderComponent, useInstanceId } from '@wordpress/compose';\nimport { addFilter } from '@wordpress/hooks';\nimport {\n\tgetBlockDefaultClassName,\n\tgetBlockSupport,\n\thasBlockSupport,\n} from '@wordpress/blocks';\nimport { useSelect } from '@wordpress/data';\nimport {\n\tButton,\n\tButtonGroup,\n\tToggleControl,\n\tPanelBody,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { useContext, createPortal } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../store';\nimport { InspectorControls } from '../components';\nimport useSetting from '../components/use-setting';\nimport { LayoutStyle } from '../components/block-list/layout';\nimport BlockList from '../components/block-list';\nimport { getLayoutType, getLayoutTypes } from '../layouts';\n\nconst layoutBlockSupportKey = '__experimentalLayout';\n\n/**\n * Generates the utility classnames for the given blocks layout attributes.\n * This method was primarily added to reintroduce classnames that were removed\n * in the 5.9 release (https://github.com/WordPress/gutenberg/issues/38719), rather\n * than providing an extensive list of all possible layout classes. The plan is to\n * have the style engine generate a more extensive list of utility classnames which\n * will then replace this method.\n *\n * @param { Object } layout Layout object.\n * @param { Object } layoutDefinitions An object containing layout definitions, stored in theme.json.\n *\n * @return { Array } Array of CSS classname strings.\n */\nfunction useLayoutClasses( layout, layoutDefinitions ) {\n\tconst rootPaddingAlignment = useSelect( ( select ) => {\n\t\tconst { getSettings } = select( blockEditorStore );\n\t\treturn getSettings().__experimentalFeatures\n\t\t\t?.useRootPaddingAwareAlignments;\n\t}, [] );\n\tconst layoutClassnames = [];\n\n\tif ( layoutDefinitions?.[ layout?.type || 'default' ]?.className ) {\n\t\tlayoutClassnames.push(\n\t\t\tlayoutDefinitions?.[ layout?.type || 'default' ]?.className\n\t\t);\n\t}\n\n\tif ( ( layout?.inherit || layout?.contentSize ) && rootPaddingAlignment ) {\n\t\tlayoutClassnames.push( 'has-global-padding' );\n\t}\n\n\tif ( layout?.orientation ) {\n\t\tlayoutClassnames.push( `is-${ kebabCase( layout.orientation ) }` );\n\t}\n\n\tif ( layout?.justifyContent ) {\n\t\tlayoutClassnames.push(\n\t\t\t`is-content-justification-${ kebabCase( layout.justifyContent ) }`\n\t\t);\n\t}\n\n\tif ( layout?.flexWrap && layout.flexWrap === 'nowrap' ) {\n\t\tlayoutClassnames.push( 'is-nowrap' );\n\t}\n\n\treturn layoutClassnames;\n}\n\nfunction LayoutPanel( { setAttributes, attributes, name: blockName } ) {\n\tconst { layout } = attributes;\n\tconst defaultThemeLayout = useSetting( 'layout' );\n\tconst themeSupportsLayout = useSelect( ( select ) => {\n\t\tconst { getSettings } = select( blockEditorStore );\n\t\treturn getSettings().supportsLayout;\n\t}, [] );\n\n\tconst layoutBlockSupport = getBlockSupport(\n\t\tblockName,\n\t\tlayoutBlockSupportKey,\n\t\t{}\n\t);\n\tconst {\n\t\tallowSwitching,\n\t\tallowEditing = true,\n\t\tallowInheriting = true,\n\t\tdefault: defaultBlockLayout,\n\t} = layoutBlockSupport;\n\n\tif ( ! allowEditing ) {\n\t\treturn null;\n\t}\n\n\t// Only show the inherit toggle if it's supported,\n\t// a default theme layout is set (e.g. one that provides `contentSize` and/or `wideSize` values),\n\t// and that the default / flow layout type is in use, as this is the only one that supports inheritance.\n\tconst showInheritToggle = !! (\n\t\tallowInheriting &&\n\t\t!! defaultThemeLayout &&\n\t\t( ! layout?.type || layout?.type === 'default' || layout?.inherit )\n\t);\n\n\tconst usedLayout = layout || defaultBlockLayout || {};\n\tconst { inherit = false, type = 'default' } = usedLayout;\n\t/**\n\t * `themeSupportsLayout` is only relevant to the `default/flow`\n\t * layout and it should not be taken into account when other\n\t * `layout` types are used.\n\t */\n\tif ( type === 'default' && ! themeSupportsLayout ) {\n\t\treturn null;\n\t}\n\tconst layoutType = getLayoutType( type );\n\n\tconst onChangeType = ( newType ) =>\n\t\tsetAttributes( { layout: { type: newType } } );\n\tconst onChangeLayout = ( newLayout ) =>\n\t\tsetAttributes( { layout: newLayout } );\n\n\treturn (\n\t\t<>\n\t\t\t<InspectorControls>\n\t\t\t\t<PanelBody title={ __( 'Layout' ) }>\n\t\t\t\t\t{ showInheritToggle && (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t\t\tlabel={ __( 'Inner blocks use full width' ) }\n\t\t\t\t\t\t\t\tchecked={ ! inherit }\n\t\t\t\t\t\t\t\tonChange={ () =>\n\t\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\t\tlayout: {\n\t\t\t\t\t\t\t\t\t\t\tinherit: ! inherit,\n\t\t\t\t\t\t\t\t\t\t},\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\t<p className=\"block-editor-hooks__layout-controls-helptext\">\n\t\t\t\t\t\t\t\t{ !! inherit\n\t\t\t\t\t\t\t\t\t? __(\n\t\t\t\t\t\t\t\t\t\t\t'Nested blocks use theme content width with options for full and wide widths.'\n\t\t\t\t\t\t\t\t\t )\n\t\t\t\t\t\t\t\t\t: __(\n\t\t\t\t\t\t\t\t\t\t\t'Nested blocks will fill the width of this container.'\n\t\t\t\t\t\t\t\t\t ) }\n\t\t\t\t\t\t\t</p>\n\t\t\t\t\t\t</>\n\t\t\t\t\t) }\n\n\t\t\t\t\t{ ! inherit && allowSwitching && (\n\t\t\t\t\t\t<LayoutTypeSwitcher\n\t\t\t\t\t\t\ttype={ type }\n\t\t\t\t\t\t\tonChange={ onChangeType }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\n\t\t\t\t\t{ ! inherit && layoutType && (\n\t\t\t\t\t\t<layoutType.inspectorControls\n\t\t\t\t\t\t\tlayout={ usedLayout }\n\t\t\t\t\t\t\tonChange={ onChangeLayout }\n\t\t\t\t\t\t\tlayoutBlockSupport={ layoutBlockSupport }\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{ ! inherit && layoutType && (\n\t\t\t\t<layoutType.toolBarControls\n\t\t\t\t\tlayout={ usedLayout }\n\t\t\t\t\tonChange={ onChangeLayout }\n\t\t\t\t\tlayoutBlockSupport={ layoutBlockSupport }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</>\n\t);\n}\n\nfunction LayoutTypeSwitcher( { type, onChange } ) {\n\treturn (\n\t\t<ButtonGroup>\n\t\t\t{ getLayoutTypes().map( ( { name, label } ) => {\n\t\t\t\treturn (\n\t\t\t\t\t<Button\n\t\t\t\t\t\tkey={ name }\n\t\t\t\t\t\tisPressed={ type === name }\n\t\t\t\t\t\tonClick={ () => onChange( name ) }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ label }\n\t\t\t\t\t</Button>\n\t\t\t\t);\n\t\t\t} ) }\n\t\t</ButtonGroup>\n\t);\n}\n\n/**\n * Filters registered block settings, extending attributes to include `layout`.\n *\n * @param {Object} settings Original block settings.\n *\n * @return {Object} Filtered block settings.\n */\nexport function addAttribute( settings ) {\n\tif ( has( settings.attributes, [ 'layout', 'type' ] ) ) {\n\t\treturn settings;\n\t}\n\tif ( hasBlockSupport( settings, layoutBlockSupportKey ) ) {\n\t\tsettings.attributes = {\n\t\t\t...settings.attributes,\n\t\t\tlayout: {\n\t\t\t\ttype: 'object',\n\t\t\t},\n\t\t};\n\t}\n\n\treturn settings;\n}\n\n/**\n * Override the default edit UI to include layout controls\n *\n * @param {Function} BlockEdit Original component.\n *\n * @return {Function} Wrapped component.\n */\nexport const withInspectorControls = createHigherOrderComponent(\n\t( BlockEdit ) => ( props ) => {\n\t\tconst { name: blockName } = props;\n\t\tconst supportLayout = hasBlockSupport(\n\t\t\tblockName,\n\t\t\tlayoutBlockSupportKey\n\t\t);\n\n\t\treturn [\n\t\t\tsupportLayout && <LayoutPanel key=\"layout\" { ...props } />,\n\t\t\t<BlockEdit key=\"edit\" { ...props } />,\n\t\t];\n\t},\n\t'withInspectorControls'\n);\n\n/**\n * Override the default block element to add the layout styles.\n *\n * @param {Function} BlockListBlock Original component.\n *\n * @return {Function} Wrapped component.\n */\nexport const withLayoutStyles = createHigherOrderComponent(\n\t( BlockListBlock ) => ( props ) => {\n\t\tconst { name, attributes } = props;\n\t\tconst hasLayoutBlockSupport = hasBlockSupport(\n\t\t\tname,\n\t\t\tlayoutBlockSupportKey\n\t\t);\n\t\tconst disableLayoutStyles = useSelect( ( select ) => {\n\t\t\tconst { getSettings } = select( blockEditorStore );\n\t\t\treturn !! getSettings().disableLayoutStyles;\n\t\t} );\n\t\tconst shouldRenderLayoutStyles =\n\t\t\thasLayoutBlockSupport && ! disableLayoutStyles;\n\t\tconst id = useInstanceId( BlockListBlock );\n\t\tconst defaultThemeLayout = useSetting( 'layout' ) || {};\n\t\tconst element = useContext( BlockList.__unstableElementContext );\n\t\tconst { layout } = attributes;\n\t\tconst { default: defaultBlockLayout } =\n\t\t\tgetBlockSupport( name, layoutBlockSupportKey ) || {};\n\t\tconst usedLayout = layout?.inherit\n\t\t\t? defaultThemeLayout\n\t\t\t: layout || defaultBlockLayout || {};\n\t\tconst layoutClasses = hasLayoutBlockSupport\n\t\t\t? useLayoutClasses( usedLayout, defaultThemeLayout?.definitions )\n\t\t\t: null;\n\t\tconst selector = `.${ getBlockDefaultClassName(\n\t\t\tname\n\t\t) }.wp-container-${ id }`;\n\t\tconst blockGapSupport = useSetting( 'spacing.blockGap' );\n\t\tconst hasBlockGapSupport = blockGapSupport !== null;\n\n\t\t// Get CSS string for the current layout type.\n\t\t// The CSS and `style` element is only output if it is not empty.\n\t\tlet css;\n\t\tif ( shouldRenderLayoutStyles ) {\n\t\t\tconst fullLayoutType = getLayoutType(\n\t\t\t\tusedLayout?.type || 'default'\n\t\t\t);\n\t\t\tcss = fullLayoutType?.getLayoutStyle?.( {\n\t\t\t\tblockName: name,\n\t\t\t\tselector,\n\t\t\t\tlayout: usedLayout,\n\t\t\t\tlayoutDefinitions: defaultThemeLayout?.definitions,\n\t\t\t\tstyle: attributes?.style,\n\t\t\t\thasBlockGapSupport,\n\t\t\t} );\n\t\t}\n\n\t\t// Attach a `wp-container-` id-based class name as well as a layout class name such as `is-layout-flex`.\n\t\tconst className = classnames(\n\t\t\tprops?.className,\n\t\t\t{\n\t\t\t\t[ `wp-container-${ id }` ]: shouldRenderLayoutStyles && !! css, // Only attach a container class if there is generated CSS to be attached.\n\t\t\t},\n\t\t\tlayoutClasses\n\t\t);\n\n\t\treturn (\n\t\t\t<>\n\t\t\t\t{ shouldRenderLayoutStyles &&\n\t\t\t\t\telement &&\n\t\t\t\t\t!! css &&\n\t\t\t\t\tcreatePortal(\n\t\t\t\t\t\t<LayoutStyle\n\t\t\t\t\t\t\tblockName={ name }\n\t\t\t\t\t\t\tselector={ selector }\n\t\t\t\t\t\t\tcss={ css }\n\t\t\t\t\t\t\tlayout={ usedLayout }\n\t\t\t\t\t\t\tstyle={ attributes?.style }\n\t\t\t\t\t\t/>,\n\t\t\t\t\t\telement\n\t\t\t\t\t) }\n\t\t\t\t<BlockListBlock { ...props } className={ className } />\n\t\t\t</>\n\t\t);\n\t}\n);\n\naddFilter(\n\t'blocks.registerBlockType',\n\t'core/layout/addAttribute',\n\taddAttribute\n);\naddFilter(\n\t'editor.BlockListBlock',\n\t'core/editor/layout/with-layout-styles',\n\twithLayoutStyles\n);\naddFilter(\n\t'editor.BlockEdit',\n\t'core/editor/layout/with-inspector-controls',\n\twithInspectorControls\n);\n"]}
|
|
@@ -1,9 +1,15 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* External dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { isMatch } from 'lodash';
|
|
5
1
|
/** @typedef {import('@wordpress/blocks').WPBlockVariation} WPBlockVariation */
|
|
2
|
+
function matchesAttributes(blockAttributes, variation) {
|
|
3
|
+
return Object.entries(variation).every(_ref => {
|
|
4
|
+
let [key, value] = _ref;
|
|
5
|
+
|
|
6
|
+
if (typeof value === 'object' && typeof blockAttributes[key] === 'object') {
|
|
7
|
+
return matchesAttributes(blockAttributes[key], value);
|
|
8
|
+
}
|
|
6
9
|
|
|
10
|
+
return blockAttributes[key] === value;
|
|
11
|
+
});
|
|
12
|
+
}
|
|
7
13
|
/**
|
|
8
14
|
* Matches the provided block variations with a block's attributes. If no match
|
|
9
15
|
* or more than one matches are found it returns `undefined`. If a single match is
|
|
@@ -17,14 +23,15 @@ import { isMatch } from 'lodash';
|
|
|
17
23
|
* @return {?WPBlockVariation} - If a match is found returns it. If not or more than one matches are found returns `undefined`.
|
|
18
24
|
*/
|
|
19
25
|
|
|
26
|
+
|
|
20
27
|
export const __experimentalGetMatchingVariation = (blockAttributes, variations) => {
|
|
21
28
|
if (!variations || !blockAttributes) return;
|
|
22
|
-
const matches = variations.filter(
|
|
29
|
+
const matches = variations.filter(_ref2 => {
|
|
23
30
|
let {
|
|
24
31
|
attributes
|
|
25
|
-
} =
|
|
32
|
+
} = _ref2;
|
|
26
33
|
if (!attributes || !Object.keys(attributes).length) return false;
|
|
27
|
-
return
|
|
34
|
+
return matchesAttributes(blockAttributes, attributes);
|
|
28
35
|
});
|
|
29
36
|
if (matches.length !== 1) return;
|
|
30
37
|
return matches[0];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-editor/src/utils/block-variation-transforms.js"],"names":["
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-editor/src/utils/block-variation-transforms.js"],"names":["matchesAttributes","blockAttributes","variation","Object","entries","every","key","value","__experimentalGetMatchingVariation","variations","matches","filter","attributes","keys","length"],"mappings":"AAAA;AAEA,SAASA,iBAAT,CAA4BC,eAA5B,EAA6CC,SAA7C,EAAyD;AACxD,SAAOC,MAAM,CAACC,OAAP,CAAgBF,SAAhB,EAA4BG,KAA5B,CAAmC,QAAsB;AAAA,QAApB,CAAEC,GAAF,EAAOC,KAAP,CAAoB;;AAC/D,QACC,OAAOA,KAAP,KAAiB,QAAjB,IACA,OAAON,eAAe,CAAEK,GAAF,CAAtB,KAAkC,QAFnC,EAGE;AACD,aAAON,iBAAiB,CAAEC,eAAe,CAAEK,GAAF,CAAjB,EAA0BC,KAA1B,CAAxB;AACA;;AACD,WAAON,eAAe,CAAEK,GAAF,CAAf,KAA2BC,KAAlC;AACA,GARM,CAAP;AASA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA,OAAO,MAAMC,kCAAkC,GAAG,CACjDP,eADiD,EAEjDQ,UAFiD,KAG7C;AACJ,MAAK,CAAEA,UAAF,IAAgB,CAAER,eAAvB,EAAyC;AACzC,QAAMS,OAAO,GAAGD,UAAU,CAACE,MAAX,CAAmB,SAAsB;AAAA,QAApB;AAAEC,MAAAA;AAAF,KAAoB;AACxD,QAAK,CAAEA,UAAF,IAAgB,CAAET,MAAM,CAACU,IAAP,CAAaD,UAAb,EAA0BE,MAAjD,EAA0D,OAAO,KAAP;AAC1D,WAAOd,iBAAiB,CAAEC,eAAF,EAAmBW,UAAnB,CAAxB;AACA,GAHe,CAAhB;AAIA,MAAKF,OAAO,CAACI,MAAR,KAAmB,CAAxB,EAA4B;AAC5B,SAAOJ,OAAO,CAAE,CAAF,CAAd;AACA,CAXM","sourcesContent":["/** @typedef {import('@wordpress/blocks').WPBlockVariation} WPBlockVariation */\n\nfunction matchesAttributes( blockAttributes, variation ) {\n\treturn Object.entries( variation ).every( ( [ key, value ] ) => {\n\t\tif (\n\t\t\ttypeof value === 'object' &&\n\t\t\ttypeof blockAttributes[ key ] === 'object'\n\t\t) {\n\t\t\treturn matchesAttributes( blockAttributes[ key ], value );\n\t\t}\n\t\treturn blockAttributes[ key ] === value;\n\t} );\n}\n\n/**\n * Matches the provided block variations with a block's attributes. If no match\n * or more than one matches are found it returns `undefined`. If a single match is\n * found it returns it.\n *\n * This is a simple implementation for now as it takes into account only the attributes\n * of a block variation and not `InnerBlocks`.\n *\n * @param {Object} blockAttributes - The block attributes to try to find a match.\n * @param {WPBlockVariation[]} variations - A list of block variations to test for a match.\n * @return {?WPBlockVariation} - If a match is found returns it. If not or more than one matches are found returns `undefined`.\n */\nexport const __experimentalGetMatchingVariation = (\n\tblockAttributes,\n\tvariations\n) => {\n\tif ( ! variations || ! blockAttributes ) return;\n\tconst matches = variations.filter( ( { attributes } ) => {\n\t\tif ( ! attributes || ! Object.keys( attributes ).length ) return false;\n\t\treturn matchesAttributes( blockAttributes, attributes );\n\t} );\n\tif ( matches.length !== 1 ) return;\n\treturn matches[ 0 ];\n};\n"]}
|
|
@@ -72,7 +72,15 @@ export function shouldDismissPastedFiles(files, html
|
|
|
72
72
|
// other elements found, like <figure>, but we assume that the user's
|
|
73
73
|
// intention is to paste the actual image file.
|
|
74
74
|
const IMAGE_TAG = /<\s*img\b/gi;
|
|
75
|
-
|
|
75
|
+
if (((_html$match = html.match(IMAGE_TAG)) === null || _html$match === void 0 ? void 0 : _html$match.length) !== 1) return true; // Even when there is exactly one <img> tag in the HTML payload, we
|
|
76
|
+
// choose to weed out local images, i.e. those whose source starts with
|
|
77
|
+
// "file://". These payloads occur in specific configurations, such as
|
|
78
|
+
// when copying an entire document from Microsoft Word, that contains
|
|
79
|
+
// text and exactly one image, and pasting that content using Google
|
|
80
|
+
// Chrome.
|
|
81
|
+
|
|
82
|
+
const IMG_WITH_LOCAL_SRC = /<\s*img\b[^>]*\bsrc="file:\/\//i;
|
|
83
|
+
if (html.match(IMG_WITH_LOCAL_SRC)) return true;
|
|
76
84
|
}
|
|
77
85
|
|
|
78
86
|
return false;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-editor/src/utils/pasting.js"],"names":["createBlobURL","getFilesFromDataTransfer","getPasteEventData","clipboardData","plainText","html","getData","error1","error2","files","filter","type","test","length","shouldDismissPastedFiles","map","file","join","indexOf","IMAGE_TAG","match"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,aAAT,QAA8B,iBAA9B;AACA,SAASC,wBAAT,QAAyC,gBAAzC;AAEA,OAAO,SAASC,iBAAT,OAAgD;AAAA,MAApB;AAAEC,IAAAA;AAAF,GAAoB;AACtD,MAAIC,SAAS,GAAG,EAAhB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MAAwC,CAHzC,EAIE;AAAA;;AACD;AACA;AACA;AACA;AACA,UAAMC,SAAS,GAAG,aAAlB;AACA,
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-editor/src/utils/pasting.js"],"names":["createBlobURL","getFilesFromDataTransfer","getPasteEventData","clipboardData","plainText","html","getData","error1","error2","files","filter","type","test","length","shouldDismissPastedFiles","map","file","join","indexOf","IMAGE_TAG","match","IMG_WITH_LOCAL_SRC"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,aAAT,QAA8B,iBAA9B;AACA,SAASC,wBAAT,QAAyC,gBAAzC;AAEA,OAAO,SAASC,iBAAT,OAAgD;AAAA,MAApB;AAAEC,IAAAA;AAAF,GAAoB;AACtD,MAAIC,SAAS,GAAG,EAAhB;AACA,MAAIC,IAAI,GAAG,EAAX,CAFsD,CAItD;AACA;AACA;;AACA,MAAI;AACHD,IAAAA,SAAS,GAAGD,aAAa,CAACG,OAAd,CAAuB,YAAvB,CAAZ;AACAD,IAAAA,IAAI,GAAGF,aAAa,CAACG,OAAd,CAAuB,WAAvB,CAAP;AACA,GAHD,CAGE,OAAQC,MAAR,EAAiB;AAClB,QAAI;AACHF,MAAAA,IAAI,GAAGF,aAAa,CAACG,OAAd,CAAuB,MAAvB,CAAP;AACA,KAFD,CAEE,OAAQE,MAAR,EAAiB;AAClB;AACA;AACA;AACA;AACA;AACD;;AAED,QAAMC,KAAK,GAAGR,wBAAwB,CAAEE,aAAF,CAAxB,CAA0CO,MAA1C,CACb;AAAA,QAAE;AAAEC,MAAAA;AAAF,KAAF;AAAA,WAAgB,kCAAkCC,IAAlC,CAAwCD,IAAxC,CAAhB;AAAA,GADa,CAAd;;AAIA,MACCF,KAAK,CAACI,MAAN,IACA,CAAEC,wBAAwB,CAAEL,KAAF,EAASJ,IAAT,EAAeD,SAAf,CAF3B,EAGE;AACDC,IAAAA,IAAI,GAAGI,KAAK,CACVM,GADK,CACEC,IAAF,IAAa,aAAahB,aAAa,CAAEgB,IAAF,CAAU,IADjD,EAELC,IAFK,CAEC,EAFD,CAAP;AAGAb,IAAAA,SAAS,GAAG,EAAZ;AACA;;AAED,SAAO;AAAEC,IAAAA,IAAF;AAAQD,IAAAA;AAAR,GAAP;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASU,wBAAT,CAAmCL,KAAnC,EAA0CJ;AAAK;AAA/C,EAAkE;AACxE;AACA;AACA,MACCA,IAAI,IACJ,CAAAI,KAAK,SAAL,IAAAA,KAAK,WAAL,YAAAA,KAAK,CAAEI,MAAP,MAAkB,CADlB,IAEAJ,KAAK,CAAE,CAAF,CAAL,CAAWE,IAAX,CAAgBO,OAAhB,CAAyB,QAAzB,MAAwC,CAHzC,EAIE;AAAA;;AACD;AACA;AACA;AACA;AACA,UAAMC,SAAS,GAAG,aAAlB;AACA,QAAK,gBAAAd,IAAI,CAACe,KAAL,CAAYD,SAAZ,6DAAyBN,MAAzB,MAAoC,CAAzC,EAA6C,OAAO,IAAP,CAN5C,CAQD;AACA;AACA;AACA;AACA;AACA;;AACA,UAAMQ,kBAAkB,GAAG,iCAA3B;AACA,QAAKhB,IAAI,CAACe,KAAL,CAAYC,kBAAZ,CAAL,EAAwC,OAAO,IAAP;AACxC;;AAED,SAAO,KAAP;AACA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { createBlobURL } from '@wordpress/blob';\nimport { getFilesFromDataTransfer } from '@wordpress/dom';\n\nexport function getPasteEventData( { clipboardData } ) {\n\tlet plainText = '';\n\tlet html = '';\n\n\t// IE11 only supports `Text` as an argument for `getData` and will\n\t// otherwise throw an invalid argument error, so we try the standard\n\t// arguments first, then fallback to `Text` if they fail.\n\ttry {\n\t\tplainText = clipboardData.getData( 'text/plain' );\n\t\thtml = clipboardData.getData( 'text/html' );\n\t} catch ( error1 ) {\n\t\ttry {\n\t\t\thtml = clipboardData.getData( 'Text' );\n\t\t} catch ( error2 ) {\n\t\t\t// Some browsers like UC Browser paste plain text by default and\n\t\t\t// don't support clipboardData at all, so allow default\n\t\t\t// behaviour.\n\t\t\treturn;\n\t\t}\n\t}\n\n\tconst files = getFilesFromDataTransfer( clipboardData ).filter(\n\t\t( { type } ) => /^image\\/(?:jpe?g|png|gif|webp)$/.test( type )\n\t);\n\n\tif (\n\t\tfiles.length &&\n\t\t! shouldDismissPastedFiles( files, html, plainText )\n\t) {\n\t\thtml = files\n\t\t\t.map( ( file ) => `<img src=\"${ createBlobURL( file ) }\">` )\n\t\t\t.join( '' );\n\t\tplainText = '';\n\t}\n\n\treturn { html, plainText };\n}\n\n/**\n * Given a collection of DataTransfer files and HTML and plain text strings,\n * determine whether the files are to be dismissed in favor of the HTML.\n *\n * Certain office-type programs, like Microsoft Word or Apple Numbers,\n * will, upon copy, generate a screenshot of the content being copied and\n * attach it to the clipboard alongside the actual rich text that the user\n * sought to copy. In those cases, we should let Gutenberg handle the rich text\n * content and not the screenshot, since this allows Gutenberg to insert\n * meaningful blocks, like paragraphs, lists or even tables.\n *\n * @param {File[]} files File objects obtained from a paste event\n * @param {string} html HTML content obtained from a paste event\n * @return {boolean} True if the files should be dismissed\n */\nexport function shouldDismissPastedFiles( files, html /*, plainText */ ) {\n\t// The question is only relevant when there is actual HTML content and when\n\t// there is exactly one image file.\n\tif (\n\t\thtml &&\n\t\tfiles?.length === 1 &&\n\t\tfiles[ 0 ].type.indexOf( 'image/' ) === 0\n\t) {\n\t\t// A single <img> tag found in the HTML source suggests that the\n\t\t// content being pasted revolves around an image. Sometimes there are\n\t\t// other elements found, like <figure>, but we assume that the user's\n\t\t// intention is to paste the actual image file.\n\t\tconst IMAGE_TAG = /<\\s*img\\b/gi;\n\t\tif ( html.match( IMAGE_TAG )?.length !== 1 ) return true;\n\n\t\t// Even when there is exactly one <img> tag in the HTML payload, we\n\t\t// choose to weed out local images, i.e. those whose source starts with\n\t\t// \"file://\". These payloads occur in specific configurations, such as\n\t\t// when copying an entire document from Microsoft Word, that contains\n\t\t// text and exactly one image, and pasting that content using Google\n\t\t// Chrome.\n\t\tconst IMG_WITH_LOCAL_SRC = /<\\s*img\\b[^>]*\\bsrc=\"file:\\/\\//i;\n\t\tif ( html.match( IMG_WITH_LOCAL_SRC ) ) return true;\n\t}\n\n\treturn false;\n}\n"]}
|
|
@@ -1083,7 +1083,20 @@
|
|
|
1083
1083
|
overflow-y: visible;
|
|
1084
1084
|
pointer-events: none;
|
|
1085
1085
|
}
|
|
1086
|
-
.components-popover.block-editor-block-popover .components-popover__content
|
|
1086
|
+
.components-popover.block-editor-block-popover:not(.block-editor-block-popover__inbetween) .components-popover__content * {
|
|
1087
|
+
pointer-events: all;
|
|
1088
|
+
}
|
|
1089
|
+
|
|
1090
|
+
.components-popover.block-editor-block-popover__inbetween {
|
|
1091
|
+
pointer-events: none;
|
|
1092
|
+
}
|
|
1093
|
+
.components-popover.block-editor-block-popover__inbetween * {
|
|
1094
|
+
pointer-events: none;
|
|
1095
|
+
}
|
|
1096
|
+
.components-popover.block-editor-block-popover__inbetween .is-with-inserter {
|
|
1097
|
+
pointer-events: all;
|
|
1098
|
+
}
|
|
1099
|
+
.components-popover.block-editor-block-popover__inbetween .is-with-inserter * {
|
|
1087
1100
|
pointer-events: all;
|
|
1088
1101
|
}
|
|
1089
1102
|
|
|
@@ -1185,6 +1198,12 @@
|
|
|
1185
1198
|
.block-editor-block-styles__variants .block-editor-block-styles__item.is-active:focus {
|
|
1186
1199
|
box-shadow: inset 0 0 0 1px #fff, 0 0 0 2px var(--wp-admin-theme-color);
|
|
1187
1200
|
}
|
|
1201
|
+
.block-editor-block-styles__variants .block-editor-block-styles__item-text {
|
|
1202
|
+
word-break: break-all;
|
|
1203
|
+
white-space: normal;
|
|
1204
|
+
text-align: start;
|
|
1205
|
+
text-align-last: center;
|
|
1206
|
+
}
|
|
1188
1207
|
|
|
1189
1208
|
.block-editor-block-styles__block-preview-container,
|
|
1190
1209
|
.block-editor-block-styles__block-preview-container * {
|
|
@@ -1665,6 +1684,10 @@
|
|
|
1665
1684
|
min-width: 0;
|
|
1666
1685
|
}
|
|
1667
1686
|
|
|
1687
|
+
.block-editor-color-gradient-control__tabs .block-editor-color-gradient-control__panel {
|
|
1688
|
+
padding: 16px;
|
|
1689
|
+
}
|
|
1690
|
+
|
|
1668
1691
|
.block-editor-panel-color-gradient-settings.block-editor-panel-color-gradient-settings, .block-editor-panel-color-gradient-settings.block-editor-panel-color-gradient-settings > div:not(:first-of-type) {
|
|
1669
1692
|
display: block;
|
|
1670
1693
|
}
|
|
@@ -1680,8 +1703,9 @@
|
|
|
1680
1703
|
margin-bottom: inherit;
|
|
1681
1704
|
}
|
|
1682
1705
|
|
|
1683
|
-
.block-editor-panel-color-gradient-settings__dropdown-content {
|
|
1684
|
-
width:
|
|
1706
|
+
.block-editor-panel-color-gradient-settings__dropdown-content .block-editor-color-gradient-control__panel {
|
|
1707
|
+
width: 260px;
|
|
1708
|
+
padding: 16px;
|
|
1685
1709
|
}
|
|
1686
1710
|
|
|
1687
1711
|
.block-editor-panel-color-gradient-settings__color-indicator {
|
|
@@ -1697,6 +1721,7 @@
|
|
|
1697
1721
|
*/
|
|
1698
1722
|
.block-editor-tools-panel-color-gradient-settings__item {
|
|
1699
1723
|
padding: 0;
|
|
1724
|
+
max-width: 100%;
|
|
1700
1725
|
border-right: 1px solid rgba(0, 0, 0, 0.1);
|
|
1701
1726
|
border-left: 1px solid rgba(0, 0, 0, 0.1);
|
|
1702
1727
|
border-bottom: 1px solid rgba(0, 0, 0, 0.1);
|
|
@@ -1721,19 +1746,26 @@
|
|
|
1721
1746
|
padding: 0;
|
|
1722
1747
|
}
|
|
1723
1748
|
.block-editor-tools-panel-color-gradient-settings__dropdown > button {
|
|
1724
|
-
height:
|
|
1749
|
+
height: auto;
|
|
1750
|
+
padding-top: 10px;
|
|
1751
|
+
padding-bottom: 10px;
|
|
1752
|
+
text-align: right;
|
|
1725
1753
|
}
|
|
1726
1754
|
.block-editor-tools-panel-color-gradient-settings__dropdown > button.is-open {
|
|
1727
1755
|
background: #f0f0f0;
|
|
1728
1756
|
color: var(--wp-admin-theme-color);
|
|
1729
1757
|
}
|
|
1758
|
+
.block-editor-tools-panel-color-gradient-settings__dropdown .block-editor-panel-color-gradient-settings__color-name {
|
|
1759
|
+
white-space: nowrap;
|
|
1760
|
+
overflow: hidden;
|
|
1761
|
+
text-overflow: ellipsis;
|
|
1762
|
+
}
|
|
1730
1763
|
|
|
1731
1764
|
.block-editor-panel-color-gradient-settings__dropdown {
|
|
1732
1765
|
width: 100%;
|
|
1733
1766
|
}
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
padding-top: 8px;
|
|
1767
|
+
.block-editor-panel-color-gradient-settings__dropdown .component-color-indicator {
|
|
1768
|
+
flex-shrink: 0;
|
|
1737
1769
|
}
|
|
1738
1770
|
|
|
1739
1771
|
.block-editor-contrast-checker > .components-notice {
|
package/build-style/style.css
CHANGED
|
@@ -1083,7 +1083,20 @@
|
|
|
1083
1083
|
overflow-y: visible;
|
|
1084
1084
|
pointer-events: none;
|
|
1085
1085
|
}
|
|
1086
|
-
.components-popover.block-editor-block-popover .components-popover__content
|
|
1086
|
+
.components-popover.block-editor-block-popover:not(.block-editor-block-popover__inbetween) .components-popover__content * {
|
|
1087
|
+
pointer-events: all;
|
|
1088
|
+
}
|
|
1089
|
+
|
|
1090
|
+
.components-popover.block-editor-block-popover__inbetween {
|
|
1091
|
+
pointer-events: none;
|
|
1092
|
+
}
|
|
1093
|
+
.components-popover.block-editor-block-popover__inbetween * {
|
|
1094
|
+
pointer-events: none;
|
|
1095
|
+
}
|
|
1096
|
+
.components-popover.block-editor-block-popover__inbetween .is-with-inserter {
|
|
1097
|
+
pointer-events: all;
|
|
1098
|
+
}
|
|
1099
|
+
.components-popover.block-editor-block-popover__inbetween .is-with-inserter * {
|
|
1087
1100
|
pointer-events: all;
|
|
1088
1101
|
}
|
|
1089
1102
|
|
|
@@ -1185,6 +1198,12 @@
|
|
|
1185
1198
|
.block-editor-block-styles__variants .block-editor-block-styles__item.is-active:focus {
|
|
1186
1199
|
box-shadow: inset 0 0 0 1px #fff, 0 0 0 2px var(--wp-admin-theme-color);
|
|
1187
1200
|
}
|
|
1201
|
+
.block-editor-block-styles__variants .block-editor-block-styles__item-text {
|
|
1202
|
+
word-break: break-all;
|
|
1203
|
+
white-space: normal;
|
|
1204
|
+
text-align: start;
|
|
1205
|
+
text-align-last: center;
|
|
1206
|
+
}
|
|
1188
1207
|
|
|
1189
1208
|
.block-editor-block-styles__block-preview-container,
|
|
1190
1209
|
.block-editor-block-styles__block-preview-container * {
|
|
@@ -1665,6 +1684,10 @@
|
|
|
1665
1684
|
min-width: 0;
|
|
1666
1685
|
}
|
|
1667
1686
|
|
|
1687
|
+
.block-editor-color-gradient-control__tabs .block-editor-color-gradient-control__panel {
|
|
1688
|
+
padding: 16px;
|
|
1689
|
+
}
|
|
1690
|
+
|
|
1668
1691
|
.block-editor-panel-color-gradient-settings.block-editor-panel-color-gradient-settings, .block-editor-panel-color-gradient-settings.block-editor-panel-color-gradient-settings > div:not(:first-of-type) {
|
|
1669
1692
|
display: block;
|
|
1670
1693
|
}
|
|
@@ -1680,8 +1703,9 @@
|
|
|
1680
1703
|
margin-bottom: inherit;
|
|
1681
1704
|
}
|
|
1682
1705
|
|
|
1683
|
-
.block-editor-panel-color-gradient-settings__dropdown-content {
|
|
1684
|
-
width:
|
|
1706
|
+
.block-editor-panel-color-gradient-settings__dropdown-content .block-editor-color-gradient-control__panel {
|
|
1707
|
+
width: 260px;
|
|
1708
|
+
padding: 16px;
|
|
1685
1709
|
}
|
|
1686
1710
|
|
|
1687
1711
|
.block-editor-panel-color-gradient-settings__color-indicator {
|
|
@@ -1697,6 +1721,7 @@
|
|
|
1697
1721
|
*/
|
|
1698
1722
|
.block-editor-tools-panel-color-gradient-settings__item {
|
|
1699
1723
|
padding: 0;
|
|
1724
|
+
max-width: 100%;
|
|
1700
1725
|
border-left: 1px solid rgba(0, 0, 0, 0.1);
|
|
1701
1726
|
border-right: 1px solid rgba(0, 0, 0, 0.1);
|
|
1702
1727
|
border-bottom: 1px solid rgba(0, 0, 0, 0.1);
|
|
@@ -1721,19 +1746,26 @@
|
|
|
1721
1746
|
padding: 0;
|
|
1722
1747
|
}
|
|
1723
1748
|
.block-editor-tools-panel-color-gradient-settings__dropdown > button {
|
|
1724
|
-
height:
|
|
1749
|
+
height: auto;
|
|
1750
|
+
padding-top: 10px;
|
|
1751
|
+
padding-bottom: 10px;
|
|
1752
|
+
text-align: left;
|
|
1725
1753
|
}
|
|
1726
1754
|
.block-editor-tools-panel-color-gradient-settings__dropdown > button.is-open {
|
|
1727
1755
|
background: #f0f0f0;
|
|
1728
1756
|
color: var(--wp-admin-theme-color);
|
|
1729
1757
|
}
|
|
1758
|
+
.block-editor-tools-panel-color-gradient-settings__dropdown .block-editor-panel-color-gradient-settings__color-name {
|
|
1759
|
+
white-space: nowrap;
|
|
1760
|
+
overflow: hidden;
|
|
1761
|
+
text-overflow: ellipsis;
|
|
1762
|
+
}
|
|
1730
1763
|
|
|
1731
1764
|
.block-editor-panel-color-gradient-settings__dropdown {
|
|
1732
1765
|
width: 100%;
|
|
1733
1766
|
}
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
padding-top: 8px;
|
|
1767
|
+
.block-editor-panel-color-gradient-settings__dropdown .component-color-indicator {
|
|
1768
|
+
flex-shrink: 0;
|
|
1737
1769
|
}
|
|
1738
1770
|
|
|
1739
1771
|
.block-editor-contrast-checker > .components-notice {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wordpress/block-editor",
|
|
3
|
-
"version": "9.
|
|
3
|
+
"version": "9.7.0",
|
|
4
4
|
"description": "Generic block editor.",
|
|
5
5
|
"author": "The WordPress Contributors",
|
|
6
6
|
"license": "GPL-2.0-or-later",
|
|
@@ -33,32 +33,32 @@
|
|
|
33
33
|
"dependencies": {
|
|
34
34
|
"@babel/runtime": "^7.16.0",
|
|
35
35
|
"@react-spring/web": "^9.4.5",
|
|
36
|
-
"@wordpress/a11y": "^3.
|
|
37
|
-
"@wordpress/api-fetch": "^6.
|
|
38
|
-
"@wordpress/blob": "^3.
|
|
39
|
-
"@wordpress/blocks": "^11.
|
|
40
|
-
"@wordpress/components": "^19.
|
|
41
|
-
"@wordpress/compose": "^5.
|
|
42
|
-
"@wordpress/data": "^6.
|
|
43
|
-
"@wordpress/date": "^4.
|
|
44
|
-
"@wordpress/deprecated": "^3.
|
|
45
|
-
"@wordpress/dom": "^3.
|
|
46
|
-
"@wordpress/element": "^4.
|
|
47
|
-
"@wordpress/hooks": "^3.
|
|
48
|
-
"@wordpress/html-entities": "^3.
|
|
49
|
-
"@wordpress/i18n": "^4.
|
|
50
|
-
"@wordpress/icons": "^9.
|
|
51
|
-
"@wordpress/is-shallow-equal": "^4.
|
|
52
|
-
"@wordpress/keyboard-shortcuts": "^3.
|
|
53
|
-
"@wordpress/keycodes": "^3.
|
|
54
|
-
"@wordpress/notices": "^3.
|
|
55
|
-
"@wordpress/rich-text": "^5.
|
|
56
|
-
"@wordpress/shortcode": "^3.
|
|
57
|
-
"@wordpress/style-engine": "^0.
|
|
58
|
-
"@wordpress/token-list": "^2.
|
|
59
|
-
"@wordpress/url": "^3.
|
|
60
|
-
"@wordpress/warning": "^2.
|
|
61
|
-
"@wordpress/wordcount": "^3.
|
|
36
|
+
"@wordpress/a11y": "^3.15.0",
|
|
37
|
+
"@wordpress/api-fetch": "^6.12.0",
|
|
38
|
+
"@wordpress/blob": "^3.15.0",
|
|
39
|
+
"@wordpress/blocks": "^11.14.0",
|
|
40
|
+
"@wordpress/components": "^19.17.0",
|
|
41
|
+
"@wordpress/compose": "^5.13.0",
|
|
42
|
+
"@wordpress/data": "^6.15.0",
|
|
43
|
+
"@wordpress/date": "^4.15.0",
|
|
44
|
+
"@wordpress/deprecated": "^3.15.0",
|
|
45
|
+
"@wordpress/dom": "^3.15.0",
|
|
46
|
+
"@wordpress/element": "^4.13.0",
|
|
47
|
+
"@wordpress/hooks": "^3.15.0",
|
|
48
|
+
"@wordpress/html-entities": "^3.15.0",
|
|
49
|
+
"@wordpress/i18n": "^4.15.0",
|
|
50
|
+
"@wordpress/icons": "^9.6.0",
|
|
51
|
+
"@wordpress/is-shallow-equal": "^4.15.0",
|
|
52
|
+
"@wordpress/keyboard-shortcuts": "^3.13.0",
|
|
53
|
+
"@wordpress/keycodes": "^3.15.0",
|
|
54
|
+
"@wordpress/notices": "^3.15.0",
|
|
55
|
+
"@wordpress/rich-text": "^5.13.0",
|
|
56
|
+
"@wordpress/shortcode": "^3.15.0",
|
|
57
|
+
"@wordpress/style-engine": "^0.14.0",
|
|
58
|
+
"@wordpress/token-list": "^2.15.0",
|
|
59
|
+
"@wordpress/url": "^3.16.0",
|
|
60
|
+
"@wordpress/warning": "^2.15.0",
|
|
61
|
+
"@wordpress/wordcount": "^3.15.0",
|
|
62
62
|
"classnames": "^2.3.1",
|
|
63
63
|
"colord": "^2.7.0",
|
|
64
64
|
"diff": "^4.0.2",
|
|
@@ -77,5 +77,5 @@
|
|
|
77
77
|
"publishConfig": {
|
|
78
78
|
"access": "public"
|
|
79
79
|
},
|
|
80
|
-
"gitHead": "
|
|
80
|
+
"gitHead": "08358f53b627a15148c3a3e433cdf58cf8714aa4"
|
|
81
81
|
}
|
|
@@ -18,6 +18,7 @@ import {
|
|
|
18
18
|
getSaveContent,
|
|
19
19
|
isUnmodifiedDefaultBlock,
|
|
20
20
|
serializeRawBlock,
|
|
21
|
+
switchToBlockType,
|
|
21
22
|
} from '@wordpress/blocks';
|
|
22
23
|
import { withFilters } from '@wordpress/components';
|
|
23
24
|
import {
|
|
@@ -291,8 +292,8 @@ const applyWithDispatch = withDispatch( ( dispatch, ownProps, { select } ) => {
|
|
|
291
292
|
insertBlocks( blocks, index + 1, rootClientId );
|
|
292
293
|
},
|
|
293
294
|
onMerge( forward ) {
|
|
294
|
-
const { clientId } = ownProps;
|
|
295
|
-
const { getPreviousBlockClientId, getNextBlockClientId } =
|
|
295
|
+
const { clientId, rootClientId } = ownProps;
|
|
296
|
+
const { getPreviousBlockClientId, getNextBlockClientId, getBlock } =
|
|
296
297
|
select( blockEditorStore );
|
|
297
298
|
|
|
298
299
|
if ( forward ) {
|
|
@@ -305,6 +306,16 @@ const applyWithDispatch = withDispatch( ( dispatch, ownProps, { select } ) => {
|
|
|
305
306
|
getPreviousBlockClientId( clientId );
|
|
306
307
|
if ( previousBlockClientId ) {
|
|
307
308
|
mergeBlocks( previousBlockClientId, clientId );
|
|
309
|
+
} else if ( rootClientId ) {
|
|
310
|
+
// Attempt to "unwrap" the block contents when there's no
|
|
311
|
+
// preceding block to merge with.
|
|
312
|
+
const replacement = switchToBlockType(
|
|
313
|
+
getBlock( rootClientId ),
|
|
314
|
+
'*'
|
|
315
|
+
);
|
|
316
|
+
if ( replacement && replacement.length ) {
|
|
317
|
+
replaceBlocks( rootClientId, replacement, 0 );
|
|
318
|
+
}
|
|
308
319
|
}
|
|
309
320
|
}
|
|
310
321
|
},
|
|
@@ -18,11 +18,34 @@
|
|
|
18
18
|
|
|
19
19
|
// Allow clicking through the toolbar holder.
|
|
20
20
|
pointer-events: none;
|
|
21
|
+
}
|
|
21
22
|
|
|
22
|
-
|
|
23
|
-
|
|
23
|
+
// Enable pointer events for the toolbar's content.
|
|
24
|
+
&:not(.block-editor-block-popover__inbetween) .components-popover__content {
|
|
25
|
+
* {
|
|
24
26
|
pointer-events: all;
|
|
25
27
|
}
|
|
26
28
|
}
|
|
27
29
|
}
|
|
28
30
|
|
|
31
|
+
.components-popover.block-editor-block-popover__inbetween {
|
|
32
|
+
// Disable pointer events for dragging and dropping.
|
|
33
|
+
// Without this the insertion point interferes with the
|
|
34
|
+
// drop zone.
|
|
35
|
+
pointer-events: none;
|
|
36
|
+
|
|
37
|
+
* {
|
|
38
|
+
pointer-events: none;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
// Re-enable pointer events when the inbetween inserter has a '+' button.
|
|
42
|
+
//
|
|
43
|
+
// Needs specificity, do not simplify.
|
|
44
|
+
.is-with-inserter {
|
|
45
|
+
pointer-events: all;
|
|
46
|
+
|
|
47
|
+
* {
|
|
48
|
+
pointer-events: all;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
@@ -11,7 +11,7 @@ import { useState, useLayoutEffect } from '@wordpress/element';
|
|
|
11
11
|
import { useViewportMatch } from '@wordpress/compose';
|
|
12
12
|
import {
|
|
13
13
|
Button,
|
|
14
|
-
|
|
14
|
+
__experimentalTruncate as Truncate,
|
|
15
15
|
Slot,
|
|
16
16
|
Fill,
|
|
17
17
|
} from '@wordpress/components';
|
|
@@ -117,15 +117,12 @@ function BlockStyles( {
|
|
|
117
117
|
onClick={ () => onSelectStylePreview( style ) }
|
|
118
118
|
aria-current={ activeStyle.name === style.name }
|
|
119
119
|
>
|
|
120
|
-
<
|
|
121
|
-
|
|
122
|
-
limit={ 12 }
|
|
123
|
-
ellipsizeMode="tail"
|
|
120
|
+
<Truncate
|
|
121
|
+
numberOfLines={ 1 }
|
|
124
122
|
className="block-editor-block-styles__item-text"
|
|
125
|
-
truncate
|
|
126
123
|
>
|
|
127
124
|
{ buttonText }
|
|
128
|
-
</
|
|
125
|
+
</Truncate>
|
|
129
126
|
</Button>
|
|
130
127
|
);
|
|
131
128
|
} ) }
|
|
@@ -64,6 +64,16 @@
|
|
|
64
64
|
box-shadow: inset 0 0 0 1px $white, 0 0 0 2px var(--wp-admin-theme-color);
|
|
65
65
|
}
|
|
66
66
|
}
|
|
67
|
+
|
|
68
|
+
.block-editor-block-styles__item-text {
|
|
69
|
+
word-break: break-all;
|
|
70
|
+
// The Button component is white-space: nowrap, and that won't work with line-clamp.
|
|
71
|
+
white-space: normal;
|
|
72
|
+
|
|
73
|
+
// Without this, the ellipsis can sometimes be partially hidden by the Button padding.
|
|
74
|
+
text-align: start;
|
|
75
|
+
text-align-last: center;
|
|
76
|
+
}
|
|
67
77
|
}
|
|
68
78
|
|
|
69
79
|
// To prevent overflow in the preview container,
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
4
|
import {
|
|
5
|
+
BaseControl,
|
|
5
6
|
RangeControl,
|
|
6
7
|
__experimentalParseQuantityAndUnitFromRawValue as parseQuantityAndUnitFromRawValue,
|
|
7
8
|
__experimentalUseCustomUnits as useCustomUnits,
|
|
@@ -70,7 +71,9 @@ export default function BorderRadiusControl( { onChange, values } ) {
|
|
|
70
71
|
|
|
71
72
|
return (
|
|
72
73
|
<fieldset className="components-border-radius-control">
|
|
73
|
-
<
|
|
74
|
+
<BaseControl.VisualLabel as="legend">
|
|
75
|
+
{ __( 'Radius' ) }
|
|
76
|
+
</BaseControl.VisualLabel>
|
|
74
77
|
<div className="components-border-radius-control__wrapper">
|
|
75
78
|
{ isLinked ? (
|
|
76
79
|
<>
|