@wordpress/block-library 9.19.0 → 9.20.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 +6 -0
- package/build/archives/edit.js +2 -2
- package/build/archives/edit.js.map +1 -1
- package/build/audio/edit.js +66 -33
- package/build/audio/edit.js.map +1 -1
- package/build/avatar/index.js +8 -3
- package/build/avatar/index.js.map +1 -1
- package/build/button/edit.js +43 -16
- package/build/button/edit.js.map +1 -1
- package/build/comment-template/hooks.js +6 -0
- package/build/comment-template/hooks.js.map +1 -1
- package/build/cover/index.js +8 -1
- package/build/cover/index.js.map +1 -1
- package/build/image/constants.js +2 -1
- package/build/image/constants.js.map +1 -1
- package/build/image/image.js +85 -72
- package/build/image/image.js.map +1 -1
- package/build/latest-posts/edit.js +2 -1
- package/build/latest-posts/edit.js.map +1 -1
- package/build/navigation/use-template-part-area-label.js +7 -6
- package/build/navigation/use-template-part-area-label.js.map +1 -1
- package/build/post-author/edit.js +1 -1
- package/build/post-author/edit.js.map +1 -1
- package/build/post-author/index.js +8 -1
- package/build/post-author/index.js.map +1 -1
- package/build/post-author-name/edit.js +2 -2
- package/build/post-author-name/edit.js.map +1 -1
- package/build/query/edit/inspector-controls/index.js +2 -0
- package/build/query/edit/inspector-controls/index.js.map +1 -1
- package/build/query/edit/inspector-controls/order-control.js +3 -2
- package/build/query/edit/inspector-controls/order-control.js.map +1 -1
- package/build/query/utils.js +45 -0
- package/build/query/utils.js.map +1 -1
- package/build/query-total/index.js +2 -2
- package/build/query-total/index.js.map +1 -1
- package/build/site-logo/index.js +8 -1
- package/build/site-logo/index.js.map +1 -1
- package/build/social-links/index.js +1 -0
- package/build/social-links/index.js.map +1 -1
- package/build/table-of-contents/hooks.js +6 -3
- package/build/table-of-contents/hooks.js.map +1 -1
- package/build/template-part/edit/advanced-controls.js +1 -1
- package/build/template-part/edit/advanced-controls.js.map +1 -1
- package/build/template-part/edit/utils/hooks.js +1 -1
- package/build/template-part/edit/utils/hooks.js.map +1 -1
- package/build-module/archives/edit.js +2 -2
- package/build-module/archives/edit.js.map +1 -1
- package/build-module/audio/edit.js +68 -35
- package/build-module/audio/edit.js.map +1 -1
- package/build-module/avatar/index.js +8 -3
- package/build-module/avatar/index.js.map +1 -1
- package/build-module/button/edit.js +44 -17
- package/build-module/button/edit.js.map +1 -1
- package/build-module/comment-template/hooks.js +6 -0
- package/build-module/comment-template/hooks.js.map +1 -1
- package/build-module/cover/index.js +8 -1
- package/build-module/cover/index.js.map +1 -1
- package/build-module/image/constants.js +1 -0
- package/build-module/image/constants.js.map +1 -1
- package/build-module/image/image.js +88 -75
- package/build-module/image/image.js.map +1 -1
- package/build-module/latest-posts/edit.js +2 -1
- package/build-module/latest-posts/edit.js.map +1 -1
- package/build-module/navigation/use-template-part-area-label.js +7 -6
- package/build-module/navigation/use-template-part-area-label.js.map +1 -1
- package/build-module/post-author/edit.js +1 -1
- package/build-module/post-author/edit.js.map +1 -1
- package/build-module/post-author/index.js +8 -1
- package/build-module/post-author/index.js.map +1 -1
- package/build-module/post-author-name/edit.js +2 -2
- package/build-module/post-author-name/edit.js.map +1 -1
- package/build-module/query/edit/inspector-controls/index.js +3 -1
- package/build-module/query/edit/inspector-controls/index.js.map +1 -1
- package/build-module/query/edit/inspector-controls/order-control.js +3 -2
- package/build-module/query/edit/inspector-controls/order-control.js.map +1 -1
- package/build-module/query/utils.js +44 -0
- package/build-module/query/utils.js.map +1 -1
- package/build-module/query-total/index.js +2 -2
- package/build-module/query-total/index.js.map +1 -1
- package/build-module/site-logo/index.js +8 -1
- package/build-module/site-logo/index.js.map +1 -1
- package/build-module/social-links/index.js +1 -0
- package/build-module/social-links/index.js.map +1 -1
- package/build-module/table-of-contents/hooks.js +6 -3
- package/build-module/table-of-contents/hooks.js.map +1 -1
- package/build-module/template-part/edit/advanced-controls.js +1 -1
- package/build-module/template-part/edit/advanced-controls.js.map +1 -1
- package/build-module/template-part/edit/utils/hooks.js +1 -1
- package/build-module/template-part/edit/utils/hooks.js.map +1 -1
- package/build-style/editor-rtl.css +0 -9
- package/build-style/editor.css +0 -9
- package/build-style/image/editor-rtl.css +0 -9
- package/build-style/image/editor.css +0 -9
- package/package.json +35 -35
- package/src/archives/edit.js +2 -2
- package/src/audio/edit.js +84 -33
- package/src/avatar/block.json +8 -3
- package/src/button/edit.js +69 -24
- package/src/comment-template/hooks.js +14 -6
- package/src/cover/block.json +8 -1
- package/src/image/constants.js +1 -0
- package/src/image/editor.scss +0 -13
- package/src/image/image.js +115 -122
- package/src/latest-posts/edit.js +1 -0
- package/src/navigation/use-template-part-area-label.js +6 -6
- package/src/post-author/block.json +8 -1
- package/src/post-author/edit.js +1 -1
- package/src/post-author-name/edit.js +4 -4
- package/src/query/edit/inspector-controls/index.js +3 -1
- package/src/query/edit/inspector-controls/order-control.js +9 -3
- package/src/query/utils.js +58 -0
- package/src/query-total/block.json +2 -2
- package/src/query-total/index.php +2 -2
- package/src/site-logo/block.json +8 -1
- package/src/site-title/index.php +1 -1
- package/src/social-links/block.json +1 -0
- package/src/table-of-contents/hooks.js +5 -2
- package/src/template-part/edit/advanced-controls.js +1 -1
- package/src/template-part/edit/utils/hooks.js +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useEntityProp","store","coreStore","SelectControl","TextControl","sprintf","__","useSelect","TemplatePartImportControls","htmlElementMessages","jsx","_jsx","Fragment","_Fragment","jsxs","_jsxs","TemplatePartAdvancedControls","tagName","setAttributes","isEntityAvailable","templatePartId","defaultWrapper","hasInnerBlocks","area","setArea","title","setTitle","defaultTemplatePartAreas","select","
|
|
1
|
+
{"version":3,"names":["useEntityProp","store","coreStore","SelectControl","TextControl","sprintf","__","useSelect","TemplatePartImportControls","htmlElementMessages","jsx","_jsx","Fragment","_Fragment","jsxs","_jsxs","TemplatePartAdvancedControls","tagName","setAttributes","isEntityAvailable","templatePartId","defaultWrapper","hasInnerBlocks","area","setArea","title","setTitle","defaultTemplatePartAreas","select","getCurrentTheme","default_template_part_areas","areaOptions","map","label","_area","value","children","__next40pxDefaultSize","__nextHasNoMarginBottom","onChange","onFocus","event","target","labelPosition","options","help"],"sources":["@wordpress/block-library/src/template-part/edit/advanced-controls.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useEntityProp, store as coreStore } from '@wordpress/core-data';\nimport { SelectControl, TextControl } from '@wordpress/components';\nimport { sprintf, __ } from '@wordpress/i18n';\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { TemplatePartImportControls } from './import-controls';\nimport { htmlElementMessages } from '../../utils/messages';\n\nexport function TemplatePartAdvancedControls( {\n\ttagName,\n\tsetAttributes,\n\tisEntityAvailable,\n\ttemplatePartId,\n\tdefaultWrapper,\n\thasInnerBlocks,\n} ) {\n\tconst [ area, setArea ] = useEntityProp(\n\t\t'postType',\n\t\t'wp_template_part',\n\t\t'area',\n\t\ttemplatePartId\n\t);\n\n\tconst [ title, setTitle ] = useEntityProp(\n\t\t'postType',\n\t\t'wp_template_part',\n\t\t'title',\n\t\ttemplatePartId\n\t);\n\n\tconst defaultTemplatePartAreas = useSelect(\n\t\t( select ) =>\n\t\t\tselect( coreStore ).getCurrentTheme()\n\t\t\t\t?.default_template_part_areas || [],\n\t\t[]\n\t);\n\n\tconst areaOptions = defaultTemplatePartAreas.map(\n\t\t( { label, area: _area } ) => ( {\n\t\t\tlabel,\n\t\t\tvalue: _area,\n\t\t} )\n\t);\n\n\treturn (\n\t\t<>\n\t\t\t{ isEntityAvailable && (\n\t\t\t\t<>\n\t\t\t\t\t<TextControl\n\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\tlabel={ __( 'Title' ) }\n\t\t\t\t\t\tvalue={ title }\n\t\t\t\t\t\tonChange={ ( value ) => {\n\t\t\t\t\t\t\tsetTitle( value );\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tonFocus={ ( event ) => event.target.select() }\n\t\t\t\t\t/>\n\t\t\t\t\t<SelectControl\n\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\tlabel={ __( 'Area' ) }\n\t\t\t\t\t\tlabelPosition=\"top\"\n\t\t\t\t\t\toptions={ areaOptions }\n\t\t\t\t\t\tvalue={ area }\n\t\t\t\t\t\tonChange={ setArea }\n\t\t\t\t\t/>\n\t\t\t\t</>\n\t\t\t) }\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{\n\t\t\t\t\t\tlabel: sprintf(\n\t\t\t\t\t\t\t/* translators: %s: HTML tag based on area. */\n\t\t\t\t\t\t\t__( 'Default based on area (%s)' ),\n\t\t\t\t\t\t\t`<${ defaultWrapper }>`\n\t\t\t\t\t\t),\n\t\t\t\t\t\tvalue: '',\n\t\t\t\t\t},\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\t{ label: '<div>', value: 'div' },\n\t\t\t\t] }\n\t\t\t\tvalue={ tagName || '' }\n\t\t\t\tonChange={ ( value ) => setAttributes( { tagName: value } ) }\n\t\t\t\thelp={ htmlElementMessages[ tagName ] }\n\t\t\t/>\n\t\t\t{ ! hasInnerBlocks && (\n\t\t\t\t<TemplatePartImportControls\n\t\t\t\t\tarea={ area }\n\t\t\t\t\tsetAttributes={ setAttributes }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</>\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,aAAa,EAAEC,KAAK,IAAIC,SAAS,QAAQ,s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I,EAAGpC,mBAAmB,CAAEQ,OAAO;IAAI,CACvC,CAAC,EACA,CAAEK,cAAc,iBACjBX,IAAA,CAACH,0BAA0B;MAC1Be,IAAI,EAAGA,IAAM;MACbL,aAAa,EAAGA;IAAe,CAC/B,CACD;EAAA,CACA,CAAC;AAEL","ignoreList":[]}
|
|
@@ -114,7 +114,7 @@ export function useCreateTemplatePartFromBlocks(area, setAttributes) {
|
|
|
114
114
|
export function useTemplatePartArea(area) {
|
|
115
115
|
return useSelect(select => {
|
|
116
116
|
var _selectedArea$area_ta;
|
|
117
|
-
const definedAreas = select(coreStore).
|
|
117
|
+
const definedAreas = select(coreStore).getCurrentTheme()?.default_template_part_areas || [];
|
|
118
118
|
const selectedArea = definedAreas.find(definedArea => definedArea.area === area);
|
|
119
119
|
const defaultArea = definedAreas.find(definedArea => definedArea.area === 'uncategorized');
|
|
120
120
|
return {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["paramCase","kebabCase","useDispatch","useSelect","store","coreStore","blockEditorStore","useMemo","serialize","__","createTemplatePartId","useAlternativeTemplateParts","area","excludedId","templateParts","isResolving","select","getEntityRecords","_isResolving","query","per_page","filteredTemplateParts","filter","templatePart","theme","slug","useAlternativeBlockPatterns","clientId","blockNameWithArea","getBlockRootClientId","getPatternsByBlockTypes","rootClientId","useCreateTemplatePartFromBlocks","setAttributes","saveEntityRecord","blocks","title","cleanSlug","replace","record","content","undefined","useTemplatePartArea","_selectedArea$area_ta","definedAreas","
|
|
1
|
+
{"version":3,"names":["paramCase","kebabCase","useDispatch","useSelect","store","coreStore","blockEditorStore","useMemo","serialize","__","createTemplatePartId","useAlternativeTemplateParts","area","excludedId","templateParts","isResolving","select","getEntityRecords","_isResolving","query","per_page","filteredTemplateParts","filter","templatePart","theme","slug","useAlternativeBlockPatterns","clientId","blockNameWithArea","getBlockRootClientId","getPatternsByBlockTypes","rootClientId","useCreateTemplatePartFromBlocks","setAttributes","saveEntityRecord","blocks","title","cleanSlug","replace","record","content","undefined","useTemplatePartArea","_selectedArea$area_ta","definedAreas","getCurrentTheme","default_template_part_areas","selectedArea","find","definedArea","defaultArea","icon","label","tagName","area_tag"],"sources":["@wordpress/block-library/src/template-part/edit/utils/hooks.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport { paramCase as kebabCase } from 'change-case';\n\n/**\n * WordPress dependencies\n */\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { useMemo } from '@wordpress/element';\nimport { serialize } from '@wordpress/blocks';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { createTemplatePartId } from './create-template-part-id';\n\n/**\n * Retrieves the available template parts for the given area.\n *\n * @param {string} area Template part area.\n * @param {string} excludedId Template part ID to exclude.\n *\n * @return {{ templateParts: Array, isResolving: boolean }} array of template parts.\n */\nexport function useAlternativeTemplateParts( area, excludedId ) {\n\tconst { templateParts, isResolving } = useSelect( ( select ) => {\n\t\tconst { getEntityRecords, isResolving: _isResolving } =\n\t\t\tselect( coreStore );\n\t\tconst query = { per_page: -1 };\n\t\treturn {\n\t\t\ttemplateParts: getEntityRecords(\n\t\t\t\t'postType',\n\t\t\t\t'wp_template_part',\n\t\t\t\tquery\n\t\t\t),\n\t\t\tisResolving: _isResolving( 'getEntityRecords', [\n\t\t\t\t'postType',\n\t\t\t\t'wp_template_part',\n\t\t\t\tquery,\n\t\t\t] ),\n\t\t};\n\t}, [] );\n\n\tconst filteredTemplateParts = useMemo( () => {\n\t\tif ( ! templateParts ) {\n\t\t\treturn [];\n\t\t}\n\t\treturn (\n\t\t\ttemplateParts.filter(\n\t\t\t\t( templatePart ) =>\n\t\t\t\t\tcreateTemplatePartId(\n\t\t\t\t\t\ttemplatePart.theme,\n\t\t\t\t\t\ttemplatePart.slug\n\t\t\t\t\t) !== excludedId &&\n\t\t\t\t\t( ! area ||\n\t\t\t\t\t\t'uncategorized' === area ||\n\t\t\t\t\t\ttemplatePart.area === area )\n\t\t\t) || []\n\t\t);\n\t}, [ templateParts, area, excludedId ] );\n\n\treturn {\n\t\ttemplateParts: filteredTemplateParts,\n\t\tisResolving,\n\t};\n}\n\n/**\n * Retrieves the available block patterns for the given area.\n *\n * @param {string} area Template part area.\n * @param {string} clientId Block Client ID. (The container of the block can impact allowed blocks).\n *\n * @return {Array} array of block patterns.\n */\nexport function useAlternativeBlockPatterns( area, clientId ) {\n\treturn useSelect(\n\t\t( select ) => {\n\t\t\tconst blockNameWithArea = area\n\t\t\t\t? `core/template-part/${ area }`\n\t\t\t\t: 'core/template-part';\n\t\t\tconst { getBlockRootClientId, getPatternsByBlockTypes } =\n\t\t\t\tselect( blockEditorStore );\n\t\t\tconst rootClientId = getBlockRootClientId( clientId );\n\t\t\treturn getPatternsByBlockTypes( blockNameWithArea, rootClientId );\n\t\t},\n\t\t[ area, clientId ]\n\t);\n}\n\nexport function useCreateTemplatePartFromBlocks( area, setAttributes ) {\n\tconst { saveEntityRecord } = useDispatch( coreStore );\n\n\treturn async ( blocks = [], title = __( 'Untitled Template Part' ) ) => {\n\t\t// Currently template parts only allow latin chars.\n\t\t// Fallback slug will receive suffix by default.\n\t\tconst cleanSlug =\n\t\t\tkebabCase( title ).replace( /[^\\w-]+/g, '' ) || 'wp-custom-part';\n\n\t\t// If we have `area` set from block attributes, means an exposed\n\t\t// block variation was inserted. So add this prop to the template\n\t\t// part entity on creation. Afterwards remove `area` value from\n\t\t// block attributes.\n\t\tconst record = {\n\t\t\ttitle,\n\t\t\tslug: cleanSlug,\n\t\t\tcontent: serialize( blocks ),\n\t\t\t// `area` is filterable on the server and defaults to `UNCATEGORIZED`\n\t\t\t// if provided value is not allowed.\n\t\t\tarea,\n\t\t};\n\t\tconst templatePart = await saveEntityRecord(\n\t\t\t'postType',\n\t\t\t'wp_template_part',\n\t\t\trecord\n\t\t);\n\t\tsetAttributes( {\n\t\t\tslug: templatePart.slug,\n\t\t\ttheme: templatePart.theme,\n\t\t\tarea: undefined,\n\t\t} );\n\t};\n}\n\n/**\n * Retrieves the template part area object.\n *\n * @param {string} area Template part area identifier.\n *\n * @return {{icon: Object, label: string, tagName: string}} Template Part area.\n */\nexport function useTemplatePartArea( area ) {\n\treturn useSelect(\n\t\t( select ) => {\n\t\t\tconst definedAreas =\n\t\t\t\tselect( coreStore ).getCurrentTheme()\n\t\t\t\t\t?.default_template_part_areas || [];\n\n\t\t\tconst selectedArea = definedAreas.find(\n\t\t\t\t( definedArea ) => definedArea.area === area\n\t\t\t);\n\t\t\tconst defaultArea = definedAreas.find(\n\t\t\t\t( definedArea ) => definedArea.area === 'uncategorized'\n\t\t\t);\n\n\t\t\treturn {\n\t\t\t\ticon: selectedArea?.icon || defaultArea?.icon,\n\t\t\t\tlabel: selectedArea?.label || __( 'Template Part' ),\n\t\t\t\ttagName: selectedArea?.area_tag ?? 'div',\n\t\t\t};\n\t\t},\n\t\t[ area ]\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,SAAS,IAAIC,SAAS,QAAQ,aAAa;;AAEpD;AACA;AACA;AACA,SAASC,WAAW,EAAEC,SAAS,QAAQ,iBAAiB;AACxD,SAASC,KAAK,IAAIC,SAAS,QAAQ,sBAAsB;AACzD,SAASD,KAAK,IAAIE,gBAAgB,QAAQ,yBAAyB;AACnE,SAASC,OAAO,QAAQ,oBAAoB;AAC5C,SAASC,SAAS,QAAQ,mBAAmB;AAC7C,SAASC,EAAE,QAAQ,iBAAiB;;AAEpC;AACA;AACA;AACA,SAASC,oBAAoB,QAAQ,2BAA2B;;AAEhE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,2BAA2BA,CAAEC,IAAI,EAAEC,UAAU,EAAG;EAC/D,MAAM;IAAEC,aAAa;IAAEC;EAAY,CAAC,GAAGZ,SAAS,CAAIa,MAAM,IAAM;IAC/D,MAAM;MAAEC,gBAAgB;MAAEF,WAAW,EAAEG;IAAa,CAAC,GACpDF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,EAAEJ,YAAY,EAAEI,IAAI,IAAID,WAAW,EAAEC,IAAI;MAC7CC,KAAK,EAAEL,YAAY,EAAEK,KAAK,IAAI3C,EAAE,CAAE,eAAgB,CAAC;MACnD4C,OAAO,GAAAV,qBAAA,GAAEI,YAAY,EAAEO,QAAQ,cAAAX,qBAAA,cAAAA,qBAAA,GAAI;IACpC,CAAC;EACF,CAAC,EACD,CAAE/B,IAAI,CACP,CAAC;AACF","ignoreList":[]}
|
|
@@ -1206,15 +1206,6 @@ figure.wp-block-image:not(.wp-block) {
|
|
|
1206
1206
|
opacity: 0.1;
|
|
1207
1207
|
}
|
|
1208
1208
|
|
|
1209
|
-
.wp-block-image .components-resizable-box__container {
|
|
1210
|
-
display: table;
|
|
1211
|
-
}
|
|
1212
|
-
.wp-block-image .components-resizable-box__container img {
|
|
1213
|
-
display: block;
|
|
1214
|
-
width: inherit;
|
|
1215
|
-
height: inherit;
|
|
1216
|
-
}
|
|
1217
|
-
|
|
1218
1209
|
.block-editor-block-list__block[data-type="core/image"] .block-editor-block-toolbar .block-editor-url-input__button-modal {
|
|
1219
1210
|
position: absolute;
|
|
1220
1211
|
right: 0;
|
package/build-style/editor.css
CHANGED
|
@@ -1215,15 +1215,6 @@ figure.wp-block-image:not(.wp-block) {
|
|
|
1215
1215
|
opacity: 0.1;
|
|
1216
1216
|
}
|
|
1217
1217
|
|
|
1218
|
-
.wp-block-image .components-resizable-box__container {
|
|
1219
|
-
display: table;
|
|
1220
|
-
}
|
|
1221
|
-
.wp-block-image .components-resizable-box__container img {
|
|
1222
|
-
display: block;
|
|
1223
|
-
width: inherit;
|
|
1224
|
-
height: inherit;
|
|
1225
|
-
}
|
|
1226
|
-
|
|
1227
1218
|
.block-editor-block-list__block[data-type="core/image"] .block-editor-block-toolbar .block-editor-url-input__button-modal {
|
|
1228
1219
|
position: absolute;
|
|
1229
1220
|
left: 0;
|
|
@@ -134,15 +134,6 @@ figure.wp-block-image:not(.wp-block) {
|
|
|
134
134
|
opacity: 0.1;
|
|
135
135
|
}
|
|
136
136
|
|
|
137
|
-
.wp-block-image .components-resizable-box__container {
|
|
138
|
-
display: table;
|
|
139
|
-
}
|
|
140
|
-
.wp-block-image .components-resizable-box__container img {
|
|
141
|
-
display: block;
|
|
142
|
-
width: inherit;
|
|
143
|
-
height: inherit;
|
|
144
|
-
}
|
|
145
|
-
|
|
146
137
|
.block-editor-block-list__block[data-type="core/image"] .block-editor-block-toolbar .block-editor-url-input__button-modal {
|
|
147
138
|
position: absolute;
|
|
148
139
|
right: 0;
|
|
@@ -134,15 +134,6 @@ figure.wp-block-image:not(.wp-block) {
|
|
|
134
134
|
opacity: 0.1;
|
|
135
135
|
}
|
|
136
136
|
|
|
137
|
-
.wp-block-image .components-resizable-box__container {
|
|
138
|
-
display: table;
|
|
139
|
-
}
|
|
140
|
-
.wp-block-image .components-resizable-box__container img {
|
|
141
|
-
display: block;
|
|
142
|
-
width: inherit;
|
|
143
|
-
height: inherit;
|
|
144
|
-
}
|
|
145
|
-
|
|
146
137
|
.block-editor-block-list__block[data-type="core/image"] .block-editor-block-toolbar .block-editor-url-input__button-modal {
|
|
147
138
|
position: absolute;
|
|
148
139
|
left: 0;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wordpress/block-library",
|
|
3
|
-
"version": "9.
|
|
3
|
+
"version": "9.20.0",
|
|
4
4
|
"description": "Block library for the WordPress editor.",
|
|
5
5
|
"author": "The WordPress Contributors",
|
|
6
6
|
"license": "GPL-2.0-or-later",
|
|
@@ -41,39 +41,39 @@
|
|
|
41
41
|
],
|
|
42
42
|
"dependencies": {
|
|
43
43
|
"@babel/runtime": "7.25.7",
|
|
44
|
-
"@wordpress/a11y": "^4.
|
|
45
|
-
"@wordpress/api-fetch": "^7.
|
|
46
|
-
"@wordpress/autop": "^4.
|
|
47
|
-
"@wordpress/blob": "^4.
|
|
48
|
-
"@wordpress/block-editor": "^14.
|
|
49
|
-
"@wordpress/blocks": "^14.
|
|
50
|
-
"@wordpress/components": "^29.
|
|
51
|
-
"@wordpress/compose": "^7.
|
|
52
|
-
"@wordpress/core-data": "^7.
|
|
53
|
-
"@wordpress/data": "^10.
|
|
54
|
-
"@wordpress/date": "^5.
|
|
55
|
-
"@wordpress/deprecated": "^4.
|
|
56
|
-
"@wordpress/dom": "^4.
|
|
57
|
-
"@wordpress/element": "^6.
|
|
58
|
-
"@wordpress/escape-html": "^3.
|
|
59
|
-
"@wordpress/hooks": "^4.
|
|
60
|
-
"@wordpress/html-entities": "^4.
|
|
61
|
-
"@wordpress/i18n": "^5.
|
|
62
|
-
"@wordpress/icons": "^10.
|
|
63
|
-
"@wordpress/interactivity": "^6.
|
|
64
|
-
"@wordpress/interactivity-router": "^2.
|
|
65
|
-
"@wordpress/keyboard-shortcuts": "^5.
|
|
66
|
-
"@wordpress/keycodes": "^4.
|
|
67
|
-
"@wordpress/notices": "^5.
|
|
68
|
-
"@wordpress/patterns": "^2.
|
|
69
|
-
"@wordpress/primitives": "^4.
|
|
70
|
-
"@wordpress/private-apis": "^1.
|
|
71
|
-
"@wordpress/reusable-blocks": "^5.
|
|
72
|
-
"@wordpress/rich-text": "^7.
|
|
73
|
-
"@wordpress/server-side-render": "^5.
|
|
74
|
-
"@wordpress/url": "^4.
|
|
75
|
-
"@wordpress/viewport": "^6.
|
|
76
|
-
"@wordpress/wordcount": "^4.
|
|
44
|
+
"@wordpress/a11y": "^4.20.0",
|
|
45
|
+
"@wordpress/api-fetch": "^7.20.0",
|
|
46
|
+
"@wordpress/autop": "^4.20.0",
|
|
47
|
+
"@wordpress/blob": "^4.20.0",
|
|
48
|
+
"@wordpress/block-editor": "^14.15.0",
|
|
49
|
+
"@wordpress/blocks": "^14.9.0",
|
|
50
|
+
"@wordpress/components": "^29.6.0",
|
|
51
|
+
"@wordpress/compose": "^7.20.0",
|
|
52
|
+
"@wordpress/core-data": "^7.20.0",
|
|
53
|
+
"@wordpress/data": "^10.20.0",
|
|
54
|
+
"@wordpress/date": "^5.20.0",
|
|
55
|
+
"@wordpress/deprecated": "^4.20.0",
|
|
56
|
+
"@wordpress/dom": "^4.20.0",
|
|
57
|
+
"@wordpress/element": "^6.20.0",
|
|
58
|
+
"@wordpress/escape-html": "^3.20.0",
|
|
59
|
+
"@wordpress/hooks": "^4.20.0",
|
|
60
|
+
"@wordpress/html-entities": "^4.20.0",
|
|
61
|
+
"@wordpress/i18n": "^5.20.0",
|
|
62
|
+
"@wordpress/icons": "^10.20.0",
|
|
63
|
+
"@wordpress/interactivity": "^6.20.0",
|
|
64
|
+
"@wordpress/interactivity-router": "^2.20.0",
|
|
65
|
+
"@wordpress/keyboard-shortcuts": "^5.20.0",
|
|
66
|
+
"@wordpress/keycodes": "^4.20.0",
|
|
67
|
+
"@wordpress/notices": "^5.20.0",
|
|
68
|
+
"@wordpress/patterns": "^2.20.0",
|
|
69
|
+
"@wordpress/primitives": "^4.20.0",
|
|
70
|
+
"@wordpress/private-apis": "^1.20.0",
|
|
71
|
+
"@wordpress/reusable-blocks": "^5.20.0",
|
|
72
|
+
"@wordpress/rich-text": "^7.20.0",
|
|
73
|
+
"@wordpress/server-side-render": "^5.20.0",
|
|
74
|
+
"@wordpress/url": "^4.20.0",
|
|
75
|
+
"@wordpress/viewport": "^6.20.0",
|
|
76
|
+
"@wordpress/wordcount": "^4.20.0",
|
|
77
77
|
"change-case": "^4.1.2",
|
|
78
78
|
"clsx": "^2.1.1",
|
|
79
79
|
"colord": "^2.7.0",
|
|
@@ -91,5 +91,5 @@
|
|
|
91
91
|
"publishConfig": {
|
|
92
92
|
"access": "public"
|
|
93
93
|
},
|
|
94
|
-
"gitHead": "
|
|
94
|
+
"gitHead": "72476970386146d450c375e5c71a96dda7c9aaa8"
|
|
95
95
|
}
|
package/src/archives/edit.js
CHANGED
|
@@ -30,7 +30,7 @@ export default function ArchivesEdit( { attributes, setAttributes } ) {
|
|
|
30
30
|
resetAll={ () => {
|
|
31
31
|
setAttributes( {
|
|
32
32
|
displayAsDropdown: false,
|
|
33
|
-
showLabel:
|
|
33
|
+
showLabel: true,
|
|
34
34
|
showPostCounts: false,
|
|
35
35
|
type: 'monthly',
|
|
36
36
|
} );
|
|
@@ -63,7 +63,7 @@ export default function ArchivesEdit( { attributes, setAttributes } ) {
|
|
|
63
63
|
isShownByDefault
|
|
64
64
|
hasValue={ () => ! showLabel }
|
|
65
65
|
onDeselect={ () =>
|
|
66
|
-
setAttributes( { showLabel:
|
|
66
|
+
setAttributes( { showLabel: true } )
|
|
67
67
|
}
|
|
68
68
|
>
|
|
69
69
|
<ToggleControl
|
package/src/audio/edit.js
CHANGED
|
@@ -9,10 +9,11 @@ import clsx from 'clsx';
|
|
|
9
9
|
import { isBlobURL } from '@wordpress/blob';
|
|
10
10
|
import {
|
|
11
11
|
Disabled,
|
|
12
|
-
PanelBody,
|
|
13
12
|
SelectControl,
|
|
14
13
|
Spinner,
|
|
15
14
|
ToggleControl,
|
|
15
|
+
__experimentalToolsPanel as ToolsPanel,
|
|
16
|
+
__experimentalToolsPanelItem as ToolsPanelItem,
|
|
16
17
|
} from '@wordpress/components';
|
|
17
18
|
import {
|
|
18
19
|
BlockControls,
|
|
@@ -32,7 +33,10 @@ import { useState } from '@wordpress/element';
|
|
|
32
33
|
* Internal dependencies
|
|
33
34
|
*/
|
|
34
35
|
import { createUpgradedEmbedBlock } from '../embed/util';
|
|
35
|
-
import {
|
|
36
|
+
import {
|
|
37
|
+
useUploadMediaFromBlobURL,
|
|
38
|
+
useToolsPanelDropdownMenuProps,
|
|
39
|
+
} from '../utils/hooks';
|
|
36
40
|
import { Caption } from '../utils/caption';
|
|
37
41
|
|
|
38
42
|
const ALLOWED_MEDIA_TYPES = [ 'audio' ];
|
|
@@ -126,6 +130,7 @@ function AudioEdit( {
|
|
|
126
130
|
const blockProps = useBlockProps( {
|
|
127
131
|
className: classes,
|
|
128
132
|
} );
|
|
133
|
+
const dropdownMenuProps = useToolsPanelDropdownMenuProps();
|
|
129
134
|
|
|
130
135
|
if ( ! src && ! temporaryURL ) {
|
|
131
136
|
return (
|
|
@@ -160,42 +165,88 @@ function AudioEdit( {
|
|
|
160
165
|
</BlockControls>
|
|
161
166
|
) }
|
|
162
167
|
<InspectorControls>
|
|
163
|
-
<
|
|
164
|
-
|
|
165
|
-
|
|
168
|
+
<ToolsPanel
|
|
169
|
+
label={ __( 'Settings' ) }
|
|
170
|
+
resetAll={ () => {
|
|
171
|
+
setAttributes( {
|
|
172
|
+
autoplay: false,
|
|
173
|
+
loop: false,
|
|
174
|
+
preload: undefined,
|
|
175
|
+
} );
|
|
176
|
+
} }
|
|
177
|
+
dropdownMenuProps={ dropdownMenuProps }
|
|
178
|
+
>
|
|
179
|
+
<ToolsPanelItem
|
|
166
180
|
label={ __( 'Autoplay' ) }
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
181
|
+
isShownByDefault
|
|
182
|
+
hasValue={ () => !! autoplay }
|
|
183
|
+
onDeselect={ () =>
|
|
184
|
+
setAttributes( {
|
|
185
|
+
autoplay: false,
|
|
186
|
+
} )
|
|
187
|
+
}
|
|
188
|
+
>
|
|
189
|
+
<ToggleControl
|
|
190
|
+
__nextHasNoMarginBottom
|
|
191
|
+
label={ __( 'Autoplay' ) }
|
|
192
|
+
onChange={ toggleAttribute( 'autoplay' ) }
|
|
193
|
+
checked={ !! autoplay }
|
|
194
|
+
help={ getAutoplayHelp }
|
|
195
|
+
/>
|
|
196
|
+
</ToolsPanelItem>
|
|
197
|
+
<ToolsPanelItem
|
|
173
198
|
label={ __( 'Loop' ) }
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
<SelectControl
|
|
178
|
-
__next40pxDefaultSize
|
|
179
|
-
__nextHasNoMarginBottom
|
|
180
|
-
label={ _x( 'Preload', 'noun; Audio block parameter' ) }
|
|
181
|
-
value={ preload || '' }
|
|
182
|
-
// `undefined` is required for the preload attribute to be unset.
|
|
183
|
-
onChange={ ( value ) =>
|
|
199
|
+
isShownByDefault
|
|
200
|
+
hasValue={ () => !! loop }
|
|
201
|
+
onDeselect={ () =>
|
|
184
202
|
setAttributes( {
|
|
185
|
-
|
|
203
|
+
loop: false,
|
|
186
204
|
} )
|
|
187
205
|
}
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
{
|
|
192
|
-
{
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
206
|
+
>
|
|
207
|
+
<ToggleControl
|
|
208
|
+
__nextHasNoMarginBottom
|
|
209
|
+
label={ __( 'Loop' ) }
|
|
210
|
+
onChange={ toggleAttribute( 'loop' ) }
|
|
211
|
+
checked={ !! loop }
|
|
212
|
+
/>
|
|
213
|
+
</ToolsPanelItem>
|
|
214
|
+
<ToolsPanelItem
|
|
215
|
+
label={ __( 'Preload' ) }
|
|
216
|
+
isShownByDefault
|
|
217
|
+
hasValue={ () => !! preload }
|
|
218
|
+
onDeselect={ () =>
|
|
219
|
+
setAttributes( {
|
|
220
|
+
preload: undefined,
|
|
221
|
+
} )
|
|
222
|
+
}
|
|
223
|
+
>
|
|
224
|
+
<SelectControl
|
|
225
|
+
__next40pxDefaultSize
|
|
226
|
+
__nextHasNoMarginBottom
|
|
227
|
+
label={ _x(
|
|
228
|
+
'Preload',
|
|
229
|
+
'noun; Audio block parameter'
|
|
230
|
+
) }
|
|
231
|
+
value={ preload || '' }
|
|
232
|
+
// `undefined` is required for the preload attribute to be unset.
|
|
233
|
+
onChange={ ( value ) =>
|
|
234
|
+
setAttributes( {
|
|
235
|
+
preload: value || undefined,
|
|
236
|
+
} )
|
|
237
|
+
}
|
|
238
|
+
options={ [
|
|
239
|
+
{ value: '', label: __( 'Browser default' ) },
|
|
240
|
+
{ value: 'auto', label: __( 'Auto' ) },
|
|
241
|
+
{ value: 'metadata', label: __( 'Metadata' ) },
|
|
242
|
+
{
|
|
243
|
+
value: 'none',
|
|
244
|
+
label: _x( 'None', 'Preload value' ),
|
|
245
|
+
},
|
|
246
|
+
] }
|
|
247
|
+
/>
|
|
248
|
+
</ToolsPanelItem>
|
|
249
|
+
</ToolsPanel>
|
|
199
250
|
</InspectorControls>
|
|
200
251
|
<figure { ...blockProps }>
|
|
201
252
|
{ /*
|
package/src/avatar/block.json
CHANGED
|
@@ -48,15 +48,20 @@
|
|
|
48
48
|
},
|
|
49
49
|
"color": {
|
|
50
50
|
"text": false,
|
|
51
|
-
"background": false
|
|
52
|
-
|
|
51
|
+
"background": false
|
|
52
|
+
},
|
|
53
|
+
"filter": {
|
|
54
|
+
"duotone": true
|
|
53
55
|
},
|
|
54
56
|
"interactivity": {
|
|
55
57
|
"clientNavigation": true
|
|
56
58
|
}
|
|
57
59
|
},
|
|
58
60
|
"selectors": {
|
|
59
|
-
"border": ".wp-block-avatar img"
|
|
61
|
+
"border": ".wp-block-avatar img",
|
|
62
|
+
"filter": {
|
|
63
|
+
"duotone": ".wp-block-avatar img"
|
|
64
|
+
}
|
|
60
65
|
},
|
|
61
66
|
"editorStyle": "wp-block-avatar-editor",
|
|
62
67
|
"style": "wp-block-avatar"
|
package/src/button/edit.js
CHANGED
|
@@ -15,7 +15,13 @@ import { useToolsPanelDropdownMenuProps } from '../utils/hooks';
|
|
|
15
15
|
* WordPress dependencies
|
|
16
16
|
*/
|
|
17
17
|
import { __, sprintf } from '@wordpress/i18n';
|
|
18
|
-
import {
|
|
18
|
+
import {
|
|
19
|
+
useEffect,
|
|
20
|
+
useState,
|
|
21
|
+
useRef,
|
|
22
|
+
useMemo,
|
|
23
|
+
createInterpolateElement,
|
|
24
|
+
} from '@wordpress/element';
|
|
19
25
|
import {
|
|
20
26
|
TextControl,
|
|
21
27
|
ToolbarButton,
|
|
@@ -219,6 +225,63 @@ function ButtonEdit( props ) {
|
|
|
219
225
|
const nofollow = !! rel?.includes( NOFOLLOW_REL );
|
|
220
226
|
const isLinkTag = 'a' === TagName;
|
|
221
227
|
|
|
228
|
+
const {
|
|
229
|
+
createPageEntity,
|
|
230
|
+
userCanCreatePages,
|
|
231
|
+
lockUrlControls = false,
|
|
232
|
+
} = useSelect(
|
|
233
|
+
( select ) => {
|
|
234
|
+
if ( ! isSelected ) {
|
|
235
|
+
return {};
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
const _settings = select( blockEditorStore ).getSettings();
|
|
239
|
+
|
|
240
|
+
const blockBindingsSource = getBlockBindingsSource(
|
|
241
|
+
metadata?.bindings?.url?.source
|
|
242
|
+
);
|
|
243
|
+
|
|
244
|
+
return {
|
|
245
|
+
createPageEntity: _settings.__experimentalCreatePageEntity,
|
|
246
|
+
userCanCreatePages: _settings.__experimentalUserCanCreatePages,
|
|
247
|
+
lockUrlControls:
|
|
248
|
+
!! metadata?.bindings?.url &&
|
|
249
|
+
! blockBindingsSource?.canUserEditValue?.( {
|
|
250
|
+
select,
|
|
251
|
+
context,
|
|
252
|
+
args: metadata?.bindings?.url?.args,
|
|
253
|
+
} ),
|
|
254
|
+
};
|
|
255
|
+
},
|
|
256
|
+
[ context, isSelected, metadata?.bindings?.url ]
|
|
257
|
+
);
|
|
258
|
+
|
|
259
|
+
async function handleCreate( pageTitle ) {
|
|
260
|
+
const page = await createPageEntity( {
|
|
261
|
+
title: pageTitle,
|
|
262
|
+
status: 'draft',
|
|
263
|
+
} );
|
|
264
|
+
|
|
265
|
+
return {
|
|
266
|
+
id: page.id,
|
|
267
|
+
type: page.type,
|
|
268
|
+
title: page.title.rendered,
|
|
269
|
+
url: page.link,
|
|
270
|
+
kind: 'post-type',
|
|
271
|
+
};
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
function createButtonText( searchTerm ) {
|
|
275
|
+
return createInterpolateElement(
|
|
276
|
+
sprintf(
|
|
277
|
+
/* translators: %s: search term. */
|
|
278
|
+
__( 'Create page: <mark>%s</mark>' ),
|
|
279
|
+
searchTerm
|
|
280
|
+
),
|
|
281
|
+
{ mark: <mark /> }
|
|
282
|
+
);
|
|
283
|
+
}
|
|
284
|
+
|
|
222
285
|
function startEditing( event ) {
|
|
223
286
|
event.preventDefault();
|
|
224
287
|
setIsEditingURL( true );
|
|
@@ -249,29 +312,6 @@ function ButtonEdit( props ) {
|
|
|
249
312
|
const useEnterRef = useEnter( { content: text, clientId } );
|
|
250
313
|
const mergedRef = useMergeRefs( [ useEnterRef, richTextRef ] );
|
|
251
314
|
|
|
252
|
-
const { lockUrlControls = false } = useSelect(
|
|
253
|
-
( select ) => {
|
|
254
|
-
if ( ! isSelected ) {
|
|
255
|
-
return {};
|
|
256
|
-
}
|
|
257
|
-
|
|
258
|
-
const blockBindingsSource = getBlockBindingsSource(
|
|
259
|
-
metadata?.bindings?.url?.source
|
|
260
|
-
);
|
|
261
|
-
|
|
262
|
-
return {
|
|
263
|
-
lockUrlControls:
|
|
264
|
-
!! metadata?.bindings?.url &&
|
|
265
|
-
! blockBindingsSource?.canUserEditValue?.( {
|
|
266
|
-
select,
|
|
267
|
-
context,
|
|
268
|
-
args: metadata?.bindings?.url?.args,
|
|
269
|
-
} ),
|
|
270
|
-
};
|
|
271
|
-
},
|
|
272
|
-
[ context, isSelected, metadata?.bindings?.url ]
|
|
273
|
-
);
|
|
274
|
-
|
|
275
315
|
const [ fluidTypographySettings, layout ] = useSettings(
|
|
276
316
|
'typography.fluid',
|
|
277
317
|
'layout'
|
|
@@ -400,6 +440,11 @@ function ButtonEdit( props ) {
|
|
|
400
440
|
} }
|
|
401
441
|
forceIsEditingLink={ isEditingURL }
|
|
402
442
|
settings={ LINK_SETTINGS }
|
|
443
|
+
createSuggestion={
|
|
444
|
+
createPageEntity && handleCreate
|
|
445
|
+
}
|
|
446
|
+
withCreateSuggestion={ userCanCreatePages }
|
|
447
|
+
createSuggestionButtonText={ createButtonText }
|
|
403
448
|
/>
|
|
404
449
|
</Popover>
|
|
405
450
|
) }
|
|
@@ -107,13 +107,21 @@ const useDefaultPageIndex = ( { defaultPage, postId, perPage, queryArgs } ) => {
|
|
|
107
107
|
} ),
|
|
108
108
|
method: 'HEAD',
|
|
109
109
|
parse: false,
|
|
110
|
-
} )
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
110
|
+
} )
|
|
111
|
+
.then( ( res ) => {
|
|
112
|
+
const pages = parseInt( res.headers.get( 'X-WP-TotalPages' ) );
|
|
113
|
+
setDefaultPages( {
|
|
114
|
+
...defaultPages,
|
|
115
|
+
[ key ]: pages <= 1 ? 1 : pages, // If there are 0 pages, it means that there are no comments, but there is no 0th page.
|
|
116
|
+
} );
|
|
117
|
+
} )
|
|
118
|
+
.catch( () => {
|
|
119
|
+
// There's no 0th page, but we can't know the number of pages, fallback to 1.
|
|
120
|
+
setDefaultPages( {
|
|
121
|
+
...defaultPages,
|
|
122
|
+
[ key ]: 1,
|
|
123
|
+
} );
|
|
115
124
|
} );
|
|
116
|
-
} );
|
|
117
125
|
}, [ defaultPage, postId, perPage, setDefaultPages ] );
|
|
118
126
|
|
|
119
127
|
// The oldest one is always the first one.
|
package/src/cover/block.json
CHANGED
|
@@ -111,7 +111,6 @@
|
|
|
111
111
|
}
|
|
112
112
|
},
|
|
113
113
|
"color": {
|
|
114
|
-
"__experimentalDuotone": "> .wp-block-cover__image-background, > .wp-block-cover__video-background",
|
|
115
114
|
"heading": true,
|
|
116
115
|
"text": true,
|
|
117
116
|
"background": false,
|
|
@@ -139,6 +138,14 @@
|
|
|
139
138
|
},
|
|
140
139
|
"interactivity": {
|
|
141
140
|
"clientNavigation": true
|
|
141
|
+
},
|
|
142
|
+
"filter": {
|
|
143
|
+
"duotone": true
|
|
144
|
+
}
|
|
145
|
+
},
|
|
146
|
+
"selectors": {
|
|
147
|
+
"filter": {
|
|
148
|
+
"duotone": ".wp-block-cover > .wp-block-cover__image-background, .wp-block-cover > .wp-block-cover__video-background"
|
|
142
149
|
}
|
|
143
150
|
},
|
|
144
151
|
"editorStyle": "wp-block-cover-editor",
|
package/src/image/constants.js
CHANGED
package/src/image/editor.scss
CHANGED
|
@@ -48,19 +48,6 @@ figure.wp-block-image:not(.wp-block) {
|
|
|
48
48
|
}
|
|
49
49
|
}
|
|
50
50
|
|
|
51
|
-
// This is necessary for the editor resize handles to accurately work on a non-floated, non-resized, small image.
|
|
52
|
-
.wp-block-image .components-resizable-box__container {
|
|
53
|
-
// Using "display: table" because:
|
|
54
|
-
// - it visually hides empty white space in between elements
|
|
55
|
-
// - it allows the element to be as wide as its contents (instead of 100% width, as it would be with `display: block`)
|
|
56
|
-
display: table;
|
|
57
|
-
img {
|
|
58
|
-
display: block;
|
|
59
|
-
width: inherit;
|
|
60
|
-
height: inherit;
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
|
|
64
51
|
.block-editor-block-list__block[data-type="core/image"] .block-editor-block-toolbar .block-editor-url-input__button-modal {
|
|
65
52
|
position: absolute;
|
|
66
53
|
left: 0;
|