@wordpress/block-editor 14.3.2 → 14.3.4
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/README.md +42 -0
- package/build/components/block-heading-level-dropdown/index.js +3 -1
- package/build/components/block-heading-level-dropdown/index.js.map +1 -1
- package/build/components/block-list/block.js +27 -4
- package/build/components/block-list/block.js.map +1 -1
- package/build/components/block-list/use-block-props/use-focus-first-element.js +0 -1
- package/build/components/block-list/use-block-props/use-focus-first-element.js.map +1 -1
- package/build/components/block-list/zoom-out-separator.js +18 -1
- package/build/components/block-list/zoom-out-separator.js.map +1 -1
- package/build/components/block-switcher/utils.js +1 -1
- package/build/components/block-switcher/utils.js.map +1 -1
- package/build/components/block-variation-transforms/index.js +6 -3
- package/build/components/block-variation-transforms/index.js.map +1 -1
- package/build/components/media-placeholder/index.js +17 -19
- package/build/components/media-placeholder/index.js.map +1 -1
- package/build/components/rich-text/event-listeners/paste-handler.js +2 -13
- package/build/components/rich-text/event-listeners/paste-handler.js.map +1 -1
- package/build/components/rich-text/index.js +35 -25
- package/build/components/rich-text/index.js.map +1 -1
- package/build/components/writing-flow/index.js +1 -2
- package/build/components/writing-flow/index.js.map +1 -1
- package/build/components/writing-flow/use-arrow-nav.js +1 -4
- package/build/components/writing-flow/use-arrow-nav.js.map +1 -1
- package/build/components/writing-flow/use-input.js +1 -31
- package/build/components/writing-flow/use-input.js.map +1 -1
- package/build/components/writing-flow/use-select-all.js +1 -14
- package/build/components/writing-flow/use-select-all.js.map +1 -1
- package/build/components/writing-flow/use-selection-observer.js +2 -6
- package/build/components/writing-flow/use-selection-observer.js.map +1 -1
- package/build/components/writing-flow/utils.js +0 -27
- package/build/components/writing-flow/utils.js.map +1 -1
- package/build/hooks/block-bindings.js +6 -13
- package/build/hooks/block-bindings.js.map +1 -1
- package/build/hooks/layout.js +12 -8
- package/build/hooks/layout.js.map +1 -1
- package/build/hooks/use-bindings-attributes.js +24 -29
- package/build/hooks/use-bindings-attributes.js.map +1 -1
- package/build/private-apis.js +0 -2
- package/build/private-apis.js.map +1 -1
- package/build/store/selectors.js +6 -3
- package/build/store/selectors.js.map +1 -1
- package/build/utils/block-bindings.js +48 -0
- package/build/utils/block-bindings.js.map +1 -1
- package/build/utils/index.js +7 -0
- package/build/utils/index.js.map +1 -1
- package/build-module/components/block-heading-level-dropdown/index.js +3 -1
- package/build-module/components/block-heading-level-dropdown/index.js.map +1 -1
- package/build-module/components/block-list/block.js +28 -7
- package/build-module/components/block-list/block.js.map +1 -1
- package/build-module/components/block-list/use-block-props/use-focus-first-element.js +0 -1
- package/build-module/components/block-list/use-block-props/use-focus-first-element.js.map +1 -1
- package/build-module/components/block-list/zoom-out-separator.js +18 -1
- package/build-module/components/block-list/zoom-out-separator.js.map +1 -1
- package/build-module/components/block-switcher/utils.js +1 -1
- package/build-module/components/block-switcher/utils.js.map +1 -1
- package/build-module/components/block-variation-transforms/index.js +6 -3
- package/build-module/components/block-variation-transforms/index.js.map +1 -1
- package/build-module/components/media-placeholder/index.js +18 -20
- package/build-module/components/media-placeholder/index.js.map +1 -1
- package/build-module/components/rich-text/event-listeners/paste-handler.js +2 -13
- package/build-module/components/rich-text/event-listeners/paste-handler.js.map +1 -1
- package/build-module/components/rich-text/index.js +35 -25
- package/build-module/components/rich-text/index.js.map +1 -1
- package/build-module/components/writing-flow/index.js +1 -2
- package/build-module/components/writing-flow/index.js.map +1 -1
- package/build-module/components/writing-flow/use-arrow-nav.js +1 -4
- package/build-module/components/writing-flow/use-arrow-nav.js.map +1 -1
- package/build-module/components/writing-flow/use-input.js +1 -31
- package/build-module/components/writing-flow/use-input.js.map +1 -1
- package/build-module/components/writing-flow/use-select-all.js +1 -14
- package/build-module/components/writing-flow/use-select-all.js.map +1 -1
- package/build-module/components/writing-flow/use-selection-observer.js +2 -6
- package/build-module/components/writing-flow/use-selection-observer.js.map +1 -1
- package/build-module/components/writing-flow/utils.js +0 -26
- package/build-module/components/writing-flow/utils.js.map +1 -1
- package/build-module/hooks/block-bindings.js +6 -13
- package/build-module/hooks/block-bindings.js.map +1 -1
- package/build-module/hooks/layout.js +13 -9
- package/build-module/hooks/layout.js.map +1 -1
- package/build-module/hooks/use-bindings-attributes.js +24 -29
- package/build-module/hooks/use-bindings-attributes.js.map +1 -1
- package/build-module/private-apis.js +0 -2
- package/build-module/private-apis.js.map +1 -1
- package/build-module/store/selectors.js +6 -3
- package/build-module/store/selectors.js.map +1 -1
- package/build-module/utils/block-bindings.js +48 -0
- package/build-module/utils/block-bindings.js.map +1 -1
- package/build-module/utils/index.js +1 -0
- package/build-module/utils/index.js.map +1 -1
- package/build-style/content-rtl.css +12 -14
- package/build-style/content.css +12 -14
- package/build-style/style-rtl.css +4 -0
- package/build-style/style.css +4 -0
- package/package.json +20 -20
- package/src/components/block-heading-level-dropdown/index.js +7 -1
- package/src/components/block-list/block.js +47 -11
- package/src/components/block-list/content.scss +12 -0
- package/src/components/block-list/use-block-props/use-focus-first-element.js +0 -1
- package/src/components/block-list/zoom-out-separator.js +14 -1
- package/src/components/block-switcher/test/use-transformed.patterns.js +3 -3
- package/src/components/block-switcher/test/utils.js +3 -3
- package/src/components/block-switcher/utils.js +1 -1
- package/src/components/block-toolbar/style.scss +7 -0
- package/src/components/block-variation-transforms/index.js +6 -7
- package/src/components/media-placeholder/content.scss +3 -19
- package/src/components/media-placeholder/index.js +17 -17
- package/src/components/rich-text/event-listeners/paste-handler.js +2 -7
- package/src/components/rich-text/index.js +37 -33
- package/src/components/writing-flow/index.js +0 -2
- package/src/components/writing-flow/use-arrow-nav.js +2 -9
- package/src/components/writing-flow/use-input.js +1 -36
- package/src/components/writing-flow/use-select-all.js +1 -18
- package/src/components/writing-flow/use-selection-observer.js +3 -14
- package/src/components/writing-flow/utils.js +0 -30
- package/src/hooks/block-bindings.js +9 -10
- package/src/hooks/layout.js +17 -12
- package/src/hooks/use-bindings-attributes.js +74 -76
- package/src/private-apis.js +0 -2
- package/src/store/selectors.js +6 -6
- package/src/store/test/private-selectors.js +2 -2
- package/src/store/test/selectors.js +10 -6
- package/src/utils/block-bindings.js +47 -0
- package/src/utils/index.js +1 -0
- package/build/components/writing-flow/use-event-redirect.js +0 -66
- package/build/components/writing-flow/use-event-redirect.js.map +0 -1
- package/build-module/components/writing-flow/use-event-redirect.js +0 -60
- package/build-module/components/writing-flow/use-event-redirect.js.map +0 -1
- package/src/components/writing-flow/use-event-redirect.js +0 -72
|
@@ -11,6 +11,54 @@ import { useBlockEditContext } from '../components/block-edit';
|
|
|
11
11
|
function isObjectEmpty(object) {
|
|
12
12
|
return !object || Object.keys(object).length === 0;
|
|
13
13
|
}
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Contains utils to update the block `bindings` metadata.
|
|
17
|
+
*
|
|
18
|
+
* @typedef {Object} WPBlockBindingsUtils
|
|
19
|
+
*
|
|
20
|
+
* @property {Function} updateBlockBindings Updates the value of the bindings connected to block attributes.
|
|
21
|
+
* @property {Function} removeAllBlockBindings Removes the bindings property of the `metadata` attribute.
|
|
22
|
+
*/
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Retrieves the existing utils needed to update the block `bindings` metadata.
|
|
26
|
+
* They can be used to create, modify, or remove connections from the existing block attributes.
|
|
27
|
+
*
|
|
28
|
+
* It contains the following utils:
|
|
29
|
+
* - `updateBlockBindings`: Updates the value of the bindings connected to block attributes. It can be used to remove a specific binding by setting the value to `undefined`.
|
|
30
|
+
* - `removeAllBlockBindings`: Removes the bindings property of the `metadata` attribute.
|
|
31
|
+
*
|
|
32
|
+
* @return {?WPBlockBindingsUtils} Object containing the block bindings utils.
|
|
33
|
+
*
|
|
34
|
+
* @example
|
|
35
|
+
* ```js
|
|
36
|
+
* import { useBlockBindingsUtils } from '@wordpress/block-editor'
|
|
37
|
+
* const { updateBlockBindings, removeAllBlockBindings } = useBlockBindingsUtils();
|
|
38
|
+
*
|
|
39
|
+
* // Update url and alt attributes.
|
|
40
|
+
* updateBlockBindings( {
|
|
41
|
+
* url: {
|
|
42
|
+
* source: 'core/post-meta',
|
|
43
|
+
* args: {
|
|
44
|
+
* key: 'url_custom_field',
|
|
45
|
+
* },
|
|
46
|
+
* },
|
|
47
|
+
* alt: {
|
|
48
|
+
* source: 'core/post-meta',
|
|
49
|
+
* args: {
|
|
50
|
+
* key: 'text_custom_field',
|
|
51
|
+
* },
|
|
52
|
+
* },
|
|
53
|
+
* } );
|
|
54
|
+
*
|
|
55
|
+
* // Remove binding from url attribute.
|
|
56
|
+
* updateBlockBindings( { url: undefined } );
|
|
57
|
+
*
|
|
58
|
+
* // Remove bindings from all attributes.
|
|
59
|
+
* removeAllBlockBindings();
|
|
60
|
+
* ```
|
|
61
|
+
*/
|
|
14
62
|
export function useBlockBindingsUtils() {
|
|
15
63
|
const {
|
|
16
64
|
clientId
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useDispatch","useRegistry","store","blockEditorStore","useBlockEditContext","isObjectEmpty","object","Object","keys","length","useBlockBindingsUtils","clientId","updateBlockAttributes","getBlockAttributes","select","updateBlockBindings","bindings","metadata","currentBindings","newBindings","entries","forEach","attribute","binding","newMetadata","undefined","removeAllBlockBindings"],"sources":["@wordpress/block-editor/src/utils/block-bindings.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useDispatch, useRegistry } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../store';\nimport { useBlockEditContext } from '../components/block-edit';\n\nfunction isObjectEmpty( object ) {\n\treturn ! object || Object.keys( object ).length === 0;\n}\n\nexport function useBlockBindingsUtils() {\n\tconst { clientId } = useBlockEditContext();\n\tconst { updateBlockAttributes } = useDispatch( blockEditorStore );\n\tconst { getBlockAttributes } = useRegistry().select( blockEditorStore );\n\n\t/**\n\t * Updates the value of the bindings connected to block attributes.\n\t * It removes the binding when the new value is `undefined`.\n\t *\n\t * @param {Object} bindings Bindings including the attributes to update and the new object.\n\t * @param {string} bindings.source The source name to connect to.\n\t * @param {Object} [bindings.args] Object containing the arguments needed by the source.\n\t *\n\t * @example\n\t * ```js\n\t * import { useBlockBindingsUtils } from '@wordpress/block-editor'\n\t *\n\t * const { updateBlockBindings } = useBlockBindingsUtils();\n\t * updateBlockBindings( {\n\t * url: {\n\t * source: 'core/post-meta',\n\t * args: {\n\t * key: 'url_custom_field',\n\t * },\n\t * \t },\n\t * alt: {\n\t * source: 'core/post-meta',\n\t * args: {\n\t * key: 'text_custom_field',\n\t * },\n\t * \t }\n\t * } );\n\t * ```\n\t */\n\tconst updateBlockBindings = ( bindings ) => {\n\t\tconst { metadata: { bindings: currentBindings, ...metadata } = {} } =\n\t\t\tgetBlockAttributes( clientId );\n\t\tconst newBindings = { ...currentBindings };\n\n\t\tObject.entries( bindings ).forEach( ( [ attribute, binding ] ) => {\n\t\t\tif ( ! binding && newBindings[ attribute ] ) {\n\t\t\t\tdelete newBindings[ attribute ];\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tnewBindings[ attribute ] = binding;\n\t\t} );\n\n\t\tconst newMetadata = {\n\t\t\t...metadata,\n\t\t\tbindings: newBindings,\n\t\t};\n\n\t\tif ( isObjectEmpty( newMetadata.bindings ) ) {\n\t\t\tdelete newMetadata.bindings;\n\t\t}\n\n\t\tupdateBlockAttributes( clientId, {\n\t\t\tmetadata: isObjectEmpty( newMetadata ) ? undefined : newMetadata,\n\t\t} );\n\t};\n\n\t/**\n\t * Removes the bindings property of the `metadata` attribute.\n\t *\n\t * @example\n\t * ```js\n\t * import { useBlockBindingsUtils } from '@wordpress/block-editor'\n\t *\n\t * const { removeAllBlockBindings } = useBlockBindingsUtils();\n\t * removeAllBlockBindings();\n\t * ```\n\t */\n\tconst removeAllBlockBindings = () => {\n\t\tconst { metadata: { bindings, ...metadata } = {} } =\n\t\t\tgetBlockAttributes( clientId );\n\t\tupdateBlockAttributes( clientId, {\n\t\t\tmetadata: isObjectEmpty( metadata ) ? undefined : metadata,\n\t\t} );\n\t};\n\n\treturn { updateBlockBindings, removeAllBlockBindings };\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,WAAW,EAAEC,WAAW,QAAQ,iBAAiB;;AAE1D;AACA;AACA;AACA,SAASC,KAAK,IAAIC,gBAAgB,QAAQ,UAAU;AACpD,SAASC,mBAAmB,QAAQ,0BAA0B;AAE9D,SAASC,aAAaA,CAAEC,MAAM,EAAG;EAChC,OAAO,CAAEA,MAAM,IAAIC,MAAM,CAACC,IAAI,CAAEF,MAAO,CAAC,CAACG,MAAM,KAAK,CAAC;AACtD;AAEA,OAAO,SAASC,qBAAqBA,CAAA,EAAG;EACvC,MAAM;IAAEC;EAAS,CAAC,GAAGP,mBAAmB,CAAC,CAAC;EAC1C,MAAM;IAAEQ;EAAsB,CAAC,GAAGZ,WAAW,CAAEG,gBAAiB,CAAC;EACjE,MAAM;IAAEU;EAAmB,CAAC,GAAGZ,WAAW,CAAC,CAAC,CAACa,MAAM,CAAEX,gBAAiB,CAAC;;EAEvE;AACD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EACC,MAAMY,mBAAmB,GAAKC,QAAQ,IAAM;IAC3C,MAAM;MAAEC,QAAQ,EAAE;QAAED,QAAQ,EAAEE,eAAe;QAAE,GAAGD;MAAS,CAAC,GAAG,CAAC;IAAE,CAAC,GAClEJ,kBAAkB,CAAEF,QAAS,CAAC;IAC/B,MAAMQ,WAAW,GAAG;MAAE,GAAGD;IAAgB,CAAC;IAE1CX,MAAM,CAACa,OAAO,CAAEJ,QAAS,CAAC,CAACK,OAAO,CAAE,CAAE,CAAEC,SAAS,EAAEC,OAAO,CAAE,KAAM;MACjE,IAAK,CAAEA,OAAO,IAAIJ,WAAW,CAAEG,SAAS,CAAE,EAAG;QAC5C,OAAOH,WAAW,CAAEG,SAAS,CAAE;QAC/B;MACD;MACAH,WAAW,CAAEG,SAAS,CAAE,GAAGC,OAAO;IACnC,CAAE,CAAC;IAEH,MAAMC,WAAW,GAAG;MACnB,GAAGP,QAAQ;MACXD,QAAQ,EAAEG;IACX,CAAC;IAED,IAAKd,aAAa,CAAEmB,WAAW,CAACR,QAAS,CAAC,EAAG;MAC5C,OAAOQ,WAAW,CAACR,QAAQ;IAC5B;IAEAJ,qBAAqB,CAAED,QAAQ,EAAE;MAChCM,QAAQ,EAAEZ,aAAa,CAAEmB,WAAY,CAAC,GAAGC,SAAS,GAAGD;IACtD,CAAE,CAAC;EACJ,CAAC;;EAED;AACD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EACC,MAAME,sBAAsB,GAAGA,CAAA,KAAM;IACpC,MAAM;MAAET,QAAQ,EAAE;QAAED,QAAQ;QAAE,GAAGC;MAAS,CAAC,GAAG,CAAC;IAAE,CAAC,GACjDJ,kBAAkB,CAAEF,QAAS,CAAC;IAC/BC,qBAAqB,CAAED,QAAQ,EAAE;MAChCM,QAAQ,EAAEZ,aAAa,CAAEY,QAAS,CAAC,GAAGQ,SAAS,GAAGR;IACnD,CAAE,CAAC;EACJ,CAAC;EAED,OAAO;IAAEF,mBAAmB;IAAEW;EAAuB,CAAC;AACvD","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["useDispatch","useRegistry","store","blockEditorStore","useBlockEditContext","isObjectEmpty","object","Object","keys","length","useBlockBindingsUtils","clientId","updateBlockAttributes","getBlockAttributes","select","updateBlockBindings","bindings","metadata","currentBindings","newBindings","entries","forEach","attribute","binding","newMetadata","undefined","removeAllBlockBindings"],"sources":["@wordpress/block-editor/src/utils/block-bindings.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useDispatch, useRegistry } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../store';\nimport { useBlockEditContext } from '../components/block-edit';\n\nfunction isObjectEmpty( object ) {\n\treturn ! object || Object.keys( object ).length === 0;\n}\n\n/**\n * Contains utils to update the block `bindings` metadata.\n *\n * @typedef {Object} WPBlockBindingsUtils\n *\n * @property {Function} updateBlockBindings Updates the value of the bindings connected to block attributes.\n * @property {Function} removeAllBlockBindings Removes the bindings property of the `metadata` attribute.\n */\n\n/**\n * Retrieves the existing utils needed to update the block `bindings` metadata.\n * They can be used to create, modify, or remove connections from the existing block attributes.\n *\n * It contains the following utils:\n * - `updateBlockBindings`: Updates the value of the bindings connected to block attributes. It can be used to remove a specific binding by setting the value to `undefined`.\n * - `removeAllBlockBindings`: Removes the bindings property of the `metadata` attribute.\n *\n * @return {?WPBlockBindingsUtils} Object containing the block bindings utils.\n *\n * @example\n * ```js\n * import { useBlockBindingsUtils } from '@wordpress/block-editor'\n * const { updateBlockBindings, removeAllBlockBindings } = useBlockBindingsUtils();\n *\n * // Update url and alt attributes.\n * updateBlockBindings( {\n * url: {\n * source: 'core/post-meta',\n * args: {\n * key: 'url_custom_field',\n * },\n * },\n * alt: {\n * source: 'core/post-meta',\n * args: {\n * key: 'text_custom_field',\n * },\n * },\n * } );\n *\n * // Remove binding from url attribute.\n * updateBlockBindings( { url: undefined } );\n *\n * // Remove bindings from all attributes.\n * removeAllBlockBindings();\n * ```\n */\nexport function useBlockBindingsUtils() {\n\tconst { clientId } = useBlockEditContext();\n\tconst { updateBlockAttributes } = useDispatch( blockEditorStore );\n\tconst { getBlockAttributes } = useRegistry().select( blockEditorStore );\n\n\t/**\n\t * Updates the value of the bindings connected to block attributes.\n\t * It removes the binding when the new value is `undefined`.\n\t *\n\t * @param {Object} bindings Bindings including the attributes to update and the new object.\n\t * @param {string} bindings.source The source name to connect to.\n\t * @param {Object} [bindings.args] Object containing the arguments needed by the source.\n\t *\n\t * @example\n\t * ```js\n\t * import { useBlockBindingsUtils } from '@wordpress/block-editor'\n\t *\n\t * const { updateBlockBindings } = useBlockBindingsUtils();\n\t * updateBlockBindings( {\n\t * url: {\n\t * source: 'core/post-meta',\n\t * args: {\n\t * key: 'url_custom_field',\n\t * },\n\t * \t },\n\t * alt: {\n\t * source: 'core/post-meta',\n\t * args: {\n\t * key: 'text_custom_field',\n\t * },\n\t * \t }\n\t * } );\n\t * ```\n\t */\n\tconst updateBlockBindings = ( bindings ) => {\n\t\tconst { metadata: { bindings: currentBindings, ...metadata } = {} } =\n\t\t\tgetBlockAttributes( clientId );\n\t\tconst newBindings = { ...currentBindings };\n\n\t\tObject.entries( bindings ).forEach( ( [ attribute, binding ] ) => {\n\t\t\tif ( ! binding && newBindings[ attribute ] ) {\n\t\t\t\tdelete newBindings[ attribute ];\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tnewBindings[ attribute ] = binding;\n\t\t} );\n\n\t\tconst newMetadata = {\n\t\t\t...metadata,\n\t\t\tbindings: newBindings,\n\t\t};\n\n\t\tif ( isObjectEmpty( newMetadata.bindings ) ) {\n\t\t\tdelete newMetadata.bindings;\n\t\t}\n\n\t\tupdateBlockAttributes( clientId, {\n\t\t\tmetadata: isObjectEmpty( newMetadata ) ? undefined : newMetadata,\n\t\t} );\n\t};\n\n\t/**\n\t * Removes the bindings property of the `metadata` attribute.\n\t *\n\t * @example\n\t * ```js\n\t * import { useBlockBindingsUtils } from '@wordpress/block-editor'\n\t *\n\t * const { removeAllBlockBindings } = useBlockBindingsUtils();\n\t * removeAllBlockBindings();\n\t * ```\n\t */\n\tconst removeAllBlockBindings = () => {\n\t\tconst { metadata: { bindings, ...metadata } = {} } =\n\t\t\tgetBlockAttributes( clientId );\n\t\tupdateBlockAttributes( clientId, {\n\t\t\tmetadata: isObjectEmpty( metadata ) ? undefined : metadata,\n\t\t} );\n\t};\n\n\treturn { updateBlockBindings, removeAllBlockBindings };\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,WAAW,EAAEC,WAAW,QAAQ,iBAAiB;;AAE1D;AACA;AACA;AACA,SAASC,KAAK,IAAIC,gBAAgB,QAAQ,UAAU;AACpD,SAASC,mBAAmB,QAAQ,0BAA0B;AAE9D,SAASC,aAAaA,CAAEC,MAAM,EAAG;EAChC,OAAO,CAAEA,MAAM,IAAIC,MAAM,CAACC,IAAI,CAAEF,MAAO,CAAC,CAACG,MAAM,KAAK,CAAC;AACtD;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,qBAAqBA,CAAA,EAAG;EACvC,MAAM;IAAEC;EAAS,CAAC,GAAGP,mBAAmB,CAAC,CAAC;EAC1C,MAAM;IAAEQ;EAAsB,CAAC,GAAGZ,WAAW,CAAEG,gBAAiB,CAAC;EACjE,MAAM;IAAEU;EAAmB,CAAC,GAAGZ,WAAW,CAAC,CAAC,CAACa,MAAM,CAAEX,gBAAiB,CAAC;;EAEvE;AACD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EACC,MAAMY,mBAAmB,GAAKC,QAAQ,IAAM;IAC3C,MAAM;MAAEC,QAAQ,EAAE;QAAED,QAAQ,EAAEE,eAAe;QAAE,GAAGD;MAAS,CAAC,GAAG,CAAC;IAAE,CAAC,GAClEJ,kBAAkB,CAAEF,QAAS,CAAC;IAC/B,MAAMQ,WAAW,GAAG;MAAE,GAAGD;IAAgB,CAAC;IAE1CX,MAAM,CAACa,OAAO,CAAEJ,QAAS,CAAC,CAACK,OAAO,CAAE,CAAE,CAAEC,SAAS,EAAEC,OAAO,CAAE,KAAM;MACjE,IAAK,CAAEA,OAAO,IAAIJ,WAAW,CAAEG,SAAS,CAAE,EAAG;QAC5C,OAAOH,WAAW,CAAEG,SAAS,CAAE;QAC/B;MACD;MACAH,WAAW,CAAEG,SAAS,CAAE,GAAGC,OAAO;IACnC,CAAE,CAAC;IAEH,MAAMC,WAAW,GAAG;MACnB,GAAGP,QAAQ;MACXD,QAAQ,EAAEG;IACX,CAAC;IAED,IAAKd,aAAa,CAAEmB,WAAW,CAACR,QAAS,CAAC,EAAG;MAC5C,OAAOQ,WAAW,CAACR,QAAQ;IAC5B;IAEAJ,qBAAqB,CAAED,QAAQ,EAAE;MAChCM,QAAQ,EAAEZ,aAAa,CAAEmB,WAAY,CAAC,GAAGC,SAAS,GAAGD;IACtD,CAAE,CAAC;EACJ,CAAC;;EAED;AACD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EACC,MAAME,sBAAsB,GAAGA,CAAA,KAAM;IACpC,MAAM;MAAET,QAAQ,EAAE;QAAED,QAAQ;QAAE,GAAGC;MAAS,CAAC,GAAG,CAAC;IAAE,CAAC,GACjDJ,kBAAkB,CAAEF,QAAS,CAAC;IAC/BC,qBAAqB,CAAED,QAAQ,EAAE;MAChCM,QAAQ,EAAEZ,aAAa,CAAEY,QAAS,CAAC,GAAGQ,SAAS,GAAGR;IACnD,CAAE,CAAC;EACJ,CAAC;EAED,OAAO;IAAEF,mBAAmB;IAAEW;EAAuB,CAAC;AACvD","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["default","transformStyles","getPxFromCssUnit"],"sources":["@wordpress/block-editor/src/utils/index.js"],"sourcesContent":["export { default as transformStyles } from './transform-styles';\nexport { default as getPxFromCssUnit } from './get-px-from-css-unit';\n"],"mappings":"AAAA,SAASA,OAAO,IAAIC,eAAe,QAAQ,oBAAoB;AAC/D,SAASD,OAAO,IAAIE,gBAAgB,QAAQ,wBAAwB","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["default","transformStyles","getPxFromCssUnit","useBlockBindingsUtils"],"sources":["@wordpress/block-editor/src/utils/index.js"],"sourcesContent":["export { default as transformStyles } from './transform-styles';\nexport { default as getPxFromCssUnit } from './get-px-from-css-unit';\nexport { useBlockBindingsUtils } from './block-bindings';\n"],"mappings":"AAAA,SAASA,OAAO,IAAIC,eAAe,QAAQ,oBAAoB;AAC/D,SAASD,OAAO,IAAIE,gBAAgB,QAAQ,wBAAwB;AACpE,SAASC,qBAAqB,QAAQ,kBAAkB","ignoreList":[]}
|
|
@@ -497,6 +497,16 @@ _::-webkit-full-page-media, _:future, :root .has-multi-selection .block-editor-b
|
|
|
497
497
|
margin-right: -1px;
|
|
498
498
|
margin-left: -1px;
|
|
499
499
|
transition: background-color 0.3s ease;
|
|
500
|
+
display: flex;
|
|
501
|
+
align-items: center;
|
|
502
|
+
justify-content: center;
|
|
503
|
+
font-size: 13px;
|
|
504
|
+
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
|
|
505
|
+
color: #000;
|
|
506
|
+
font-weight: normal;
|
|
507
|
+
}
|
|
508
|
+
.is-zoomed-out .block-editor-block-list__zoom-out-separator {
|
|
509
|
+
font-size: calc(13px * ( 2 - var(--wp-block-editor-iframe-zoom-out-scale) ));
|
|
500
510
|
}
|
|
501
511
|
.block-editor-block-list__zoom-out-separator.is-dragged-over {
|
|
502
512
|
background: #ccc;
|
|
@@ -856,26 +866,14 @@ _::-webkit-full-page-media, _:future, :root .has-multi-selection .block-editor-b
|
|
|
856
866
|
}
|
|
857
867
|
|
|
858
868
|
.block-editor-media-placeholder__url-input-form {
|
|
859
|
-
|
|
860
|
-
}
|
|
861
|
-
.block-editor-media-placeholder__url-input-form input[type=url].block-editor-media-placeholder__url-input-field {
|
|
862
|
-
width: 100%;
|
|
863
|
-
min-width: 200px;
|
|
864
|
-
flex-grow: 1;
|
|
865
|
-
border: none;
|
|
866
|
-
border-radius: 0;
|
|
867
|
-
margin: 2px;
|
|
869
|
+
min-width: 260px;
|
|
868
870
|
}
|
|
869
871
|
@media (min-width: 600px) {
|
|
870
|
-
.block-editor-media-placeholder__url-input-form
|
|
872
|
+
.block-editor-media-placeholder__url-input-form {
|
|
871
873
|
width: 300px;
|
|
872
874
|
}
|
|
873
875
|
}
|
|
874
876
|
|
|
875
|
-
.block-editor-media-placeholder__url-input-submit-button {
|
|
876
|
-
flex-shrink: 1;
|
|
877
|
-
}
|
|
878
|
-
|
|
879
877
|
.block-editor-media-placeholder__cancel-button.is-link {
|
|
880
878
|
margin: 1em;
|
|
881
879
|
display: block;
|
package/build-style/content.css
CHANGED
|
@@ -497,6 +497,16 @@ _::-webkit-full-page-media, _:future, :root .has-multi-selection .block-editor-b
|
|
|
497
497
|
margin-left: -1px;
|
|
498
498
|
margin-right: -1px;
|
|
499
499
|
transition: background-color 0.3s ease;
|
|
500
|
+
display: flex;
|
|
501
|
+
align-items: center;
|
|
502
|
+
justify-content: center;
|
|
503
|
+
font-size: 13px;
|
|
504
|
+
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
|
|
505
|
+
color: #000;
|
|
506
|
+
font-weight: normal;
|
|
507
|
+
}
|
|
508
|
+
.is-zoomed-out .block-editor-block-list__zoom-out-separator {
|
|
509
|
+
font-size: calc(13px * ( 2 - var(--wp-block-editor-iframe-zoom-out-scale) ));
|
|
500
510
|
}
|
|
501
511
|
.block-editor-block-list__zoom-out-separator.is-dragged-over {
|
|
502
512
|
background: #ccc;
|
|
@@ -856,26 +866,14 @@ _::-webkit-full-page-media, _:future, :root .has-multi-selection .block-editor-b
|
|
|
856
866
|
}
|
|
857
867
|
|
|
858
868
|
.block-editor-media-placeholder__url-input-form {
|
|
859
|
-
|
|
860
|
-
}
|
|
861
|
-
.block-editor-media-placeholder__url-input-form input[type=url].block-editor-media-placeholder__url-input-field {
|
|
862
|
-
width: 100%;
|
|
863
|
-
min-width: 200px;
|
|
864
|
-
flex-grow: 1;
|
|
865
|
-
border: none;
|
|
866
|
-
border-radius: 0;
|
|
867
|
-
margin: 2px;
|
|
869
|
+
min-width: 260px;
|
|
868
870
|
}
|
|
869
871
|
@media (min-width: 600px) {
|
|
870
|
-
.block-editor-media-placeholder__url-input-form
|
|
872
|
+
.block-editor-media-placeholder__url-input-form {
|
|
871
873
|
width: 300px;
|
|
872
874
|
}
|
|
873
875
|
}
|
|
874
876
|
|
|
875
|
-
.block-editor-media-placeholder__url-input-submit-button {
|
|
876
|
-
flex-shrink: 1;
|
|
877
|
-
}
|
|
878
|
-
|
|
879
877
|
.block-editor-media-placeholder__cancel-button.is-link {
|
|
880
878
|
margin: 1em;
|
|
881
879
|
display: block;
|
|
@@ -3465,6 +3465,10 @@ div.block-editor-bindings__panel button:hover .block-editor-bindings__item span
|
|
|
3465
3465
|
border: 0;
|
|
3466
3466
|
border-left: 1px solid #ddd;
|
|
3467
3467
|
}
|
|
3468
|
+
.block-editor-block-toolbar.is-connected .block-editor-block-switcher .components-button::before {
|
|
3469
|
+
background: color-mix(in srgb, var(--wp-block-synced-color) 10%, transparent);
|
|
3470
|
+
border-radius: 2px;
|
|
3471
|
+
}
|
|
3468
3472
|
.block-editor-block-toolbar.is-synced .block-editor-block-switcher .components-button .block-editor-block-icon, .block-editor-block-toolbar.is-connected .block-editor-block-switcher .components-button .block-editor-block-icon {
|
|
3469
3473
|
color: var(--wp-block-synced-color);
|
|
3470
3474
|
}
|
package/build-style/style.css
CHANGED
|
@@ -3466,6 +3466,10 @@ div.block-editor-bindings__panel button:hover .block-editor-bindings__item span
|
|
|
3466
3466
|
border: 0;
|
|
3467
3467
|
border-right: 1px solid #ddd;
|
|
3468
3468
|
}
|
|
3469
|
+
.block-editor-block-toolbar.is-connected .block-editor-block-switcher .components-button::before {
|
|
3470
|
+
background: color-mix(in srgb, var(--wp-block-synced-color) 10%, transparent);
|
|
3471
|
+
border-radius: 2px;
|
|
3472
|
+
}
|
|
3469
3473
|
.block-editor-block-toolbar.is-synced .block-editor-block-switcher .components-button .block-editor-block-icon, .block-editor-block-toolbar.is-connected .block-editor-block-switcher .components-button .block-editor-block-icon {
|
|
3470
3474
|
color: var(--wp-block-synced-color);
|
|
3471
3475
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wordpress/block-editor",
|
|
3
|
-
"version": "14.3.
|
|
3
|
+
"version": "14.3.4",
|
|
4
4
|
"description": "Generic block editor.",
|
|
5
5
|
"author": "The WordPress Contributors",
|
|
6
6
|
"license": "GPL-2.0-or-later",
|
|
@@ -36,31 +36,31 @@
|
|
|
36
36
|
"@emotion/react": "^11.7.1",
|
|
37
37
|
"@emotion/styled": "^11.6.0",
|
|
38
38
|
"@react-spring/web": "^9.4.5",
|
|
39
|
-
"@wordpress/a11y": "^4.8.
|
|
40
|
-
"@wordpress/api-fetch": "^7.8.
|
|
39
|
+
"@wordpress/a11y": "^4.8.2",
|
|
40
|
+
"@wordpress/api-fetch": "^7.8.2",
|
|
41
41
|
"@wordpress/blob": "^4.8.1",
|
|
42
42
|
"@wordpress/block-serialization-default-parser": "^5.8.1",
|
|
43
|
-
"@wordpress/blocks": "^13.8.
|
|
44
|
-
"@wordpress/commands": "^1.8.
|
|
45
|
-
"@wordpress/components": "^28.8.
|
|
46
|
-
"@wordpress/compose": "^7.8.
|
|
47
|
-
"@wordpress/data": "^10.8.
|
|
48
|
-
"@wordpress/date": "^5.8.
|
|
49
|
-
"@wordpress/deprecated": "^4.8.
|
|
50
|
-
"@wordpress/dom": "^4.8.
|
|
43
|
+
"@wordpress/blocks": "^13.8.4",
|
|
44
|
+
"@wordpress/commands": "^1.8.4",
|
|
45
|
+
"@wordpress/components": "^28.8.4",
|
|
46
|
+
"@wordpress/compose": "^7.8.3",
|
|
47
|
+
"@wordpress/data": "^10.8.3",
|
|
48
|
+
"@wordpress/date": "^5.8.2",
|
|
49
|
+
"@wordpress/deprecated": "^4.8.2",
|
|
50
|
+
"@wordpress/dom": "^4.8.2",
|
|
51
51
|
"@wordpress/element": "^6.8.1",
|
|
52
52
|
"@wordpress/escape-html": "^3.8.1",
|
|
53
|
-
"@wordpress/hooks": "^4.8.
|
|
53
|
+
"@wordpress/hooks": "^4.8.2",
|
|
54
54
|
"@wordpress/html-entities": "^4.8.1",
|
|
55
|
-
"@wordpress/i18n": "^5.8.
|
|
56
|
-
"@wordpress/icons": "^10.8.
|
|
55
|
+
"@wordpress/i18n": "^5.8.2",
|
|
56
|
+
"@wordpress/icons": "^10.8.2",
|
|
57
57
|
"@wordpress/is-shallow-equal": "^5.8.1",
|
|
58
|
-
"@wordpress/keyboard-shortcuts": "^5.8.
|
|
59
|
-
"@wordpress/keycodes": "^4.8.
|
|
60
|
-
"@wordpress/notices": "^5.8.
|
|
61
|
-
"@wordpress/preferences": "^4.8.
|
|
58
|
+
"@wordpress/keyboard-shortcuts": "^5.8.3",
|
|
59
|
+
"@wordpress/keycodes": "^4.8.2",
|
|
60
|
+
"@wordpress/notices": "^5.8.3",
|
|
61
|
+
"@wordpress/preferences": "^4.8.4",
|
|
62
62
|
"@wordpress/private-apis": "^1.8.1",
|
|
63
|
-
"@wordpress/rich-text": "^7.8.
|
|
63
|
+
"@wordpress/rich-text": "^7.8.3",
|
|
64
64
|
"@wordpress/style-engine": "^2.8.1",
|
|
65
65
|
"@wordpress/token-list": "^3.8.1",
|
|
66
66
|
"@wordpress/url": "^4.8.1",
|
|
@@ -88,5 +88,5 @@
|
|
|
88
88
|
"publishConfig": {
|
|
89
89
|
"access": "public"
|
|
90
90
|
},
|
|
91
|
-
"gitHead": "
|
|
91
|
+
"gitHead": "07c75154341d1e5a1b8aaa1c226029b6666a52a9"
|
|
92
92
|
}
|
|
@@ -40,12 +40,18 @@ export default function HeadingLevelDropdown( {
|
|
|
40
40
|
value,
|
|
41
41
|
onChange,
|
|
42
42
|
} ) {
|
|
43
|
+
const validOptions = options
|
|
44
|
+
.filter(
|
|
45
|
+
( option ) => option === 0 || HEADING_LEVELS.includes( option )
|
|
46
|
+
)
|
|
47
|
+
.sort( ( a, b ) => a - b ); // Sorts numerically in ascending order;
|
|
48
|
+
|
|
43
49
|
return (
|
|
44
50
|
<ToolbarDropdownMenu
|
|
45
51
|
popoverProps={ POPOVER_PROPS }
|
|
46
52
|
icon={ <HeadingLevelIcon level={ value } /> }
|
|
47
53
|
label={ __( 'Change level' ) }
|
|
48
|
-
controls={
|
|
54
|
+
controls={ validOptions.map( ( targetLevel ) => {
|
|
49
55
|
const isActive = targetLevel === value;
|
|
50
56
|
return {
|
|
51
57
|
icon: <HeadingLevelIcon level={ targetLevel } />,
|
|
@@ -25,6 +25,7 @@ import {
|
|
|
25
25
|
getBlockDefaultClassName,
|
|
26
26
|
hasBlockSupport,
|
|
27
27
|
store as blocksStore,
|
|
28
|
+
privateApis as blocksPrivateApis,
|
|
28
29
|
} from '@wordpress/blocks';
|
|
29
30
|
import { withFilters } from '@wordpress/components';
|
|
30
31
|
import { withDispatch, useDispatch, useSelect } from '@wordpress/data';
|
|
@@ -46,6 +47,8 @@ import { PrivateBlockContext } from './private-block-context';
|
|
|
46
47
|
|
|
47
48
|
import { unlock } from '../../lock-unlock';
|
|
48
49
|
|
|
50
|
+
const { isUnmodifiedBlockContent } = unlock( blocksPrivateApis );
|
|
51
|
+
|
|
49
52
|
/**
|
|
50
53
|
* Merges wrapper props with special handling for classNames and styles.
|
|
51
54
|
*
|
|
@@ -350,12 +353,48 @@ const applyWithDispatch = withDispatch( ( dispatch, ownProps, registry ) => {
|
|
|
350
353
|
removeBlock( _clientId );
|
|
351
354
|
} else {
|
|
352
355
|
registry.batch( () => {
|
|
356
|
+
const firstBlock = getBlock( firstClientId );
|
|
357
|
+
const isFirstBlockContentUnmodified =
|
|
358
|
+
isUnmodifiedBlockContent( firstBlock );
|
|
359
|
+
const defaultBlockName = getDefaultBlockName();
|
|
360
|
+
const replacement = switchToBlockType(
|
|
361
|
+
firstBlock,
|
|
362
|
+
defaultBlockName
|
|
363
|
+
);
|
|
364
|
+
const canTransformToDefaultBlock =
|
|
365
|
+
!! replacement?.length &&
|
|
366
|
+
replacement.every( ( block ) =>
|
|
367
|
+
canInsertBlockType( block.name, _clientId )
|
|
368
|
+
);
|
|
369
|
+
|
|
353
370
|
if (
|
|
371
|
+
isFirstBlockContentUnmodified &&
|
|
372
|
+
canTransformToDefaultBlock
|
|
373
|
+
) {
|
|
374
|
+
// Step 1: If the block is empty and can be transformed to the default block type.
|
|
375
|
+
replaceBlocks(
|
|
376
|
+
firstClientId,
|
|
377
|
+
replacement,
|
|
378
|
+
changeSelection
|
|
379
|
+
);
|
|
380
|
+
} else if (
|
|
381
|
+
isFirstBlockContentUnmodified &&
|
|
382
|
+
firstBlock.name === defaultBlockName
|
|
383
|
+
) {
|
|
384
|
+
// Step 2: If the block is empty and is already the default block type.
|
|
385
|
+
removeBlock( firstClientId );
|
|
386
|
+
const nextBlockClientId =
|
|
387
|
+
getNextBlockClientId( clientId );
|
|
388
|
+
if ( nextBlockClientId ) {
|
|
389
|
+
selectBlock( nextBlockClientId );
|
|
390
|
+
}
|
|
391
|
+
} else if (
|
|
354
392
|
canInsertBlockType(
|
|
355
|
-
|
|
393
|
+
firstBlock.name,
|
|
356
394
|
targetRootClientId
|
|
357
395
|
)
|
|
358
396
|
) {
|
|
397
|
+
// Step 3: If the block can be moved up.
|
|
359
398
|
moveBlocksToPosition(
|
|
360
399
|
[ firstClientId ],
|
|
361
400
|
_clientId,
|
|
@@ -363,21 +402,17 @@ const applyWithDispatch = withDispatch( ( dispatch, ownProps, registry ) => {
|
|
|
363
402
|
getBlockIndex( _clientId )
|
|
364
403
|
);
|
|
365
404
|
} else {
|
|
366
|
-
const
|
|
367
|
-
|
|
368
|
-
getDefaultBlockName()
|
|
369
|
-
);
|
|
370
|
-
|
|
371
|
-
if (
|
|
372
|
-
replacement &&
|
|
373
|
-
replacement.length &&
|
|
405
|
+
const canLiftAndTransformToDefaultBlock =
|
|
406
|
+
!! replacement?.length &&
|
|
374
407
|
replacement.every( ( block ) =>
|
|
375
408
|
canInsertBlockType(
|
|
376
409
|
block.name,
|
|
377
410
|
targetRootClientId
|
|
378
411
|
)
|
|
379
|
-
)
|
|
380
|
-
|
|
412
|
+
);
|
|
413
|
+
|
|
414
|
+
if ( canLiftAndTransformToDefaultBlock ) {
|
|
415
|
+
// Step 4: If the block can be transformed to the default block type and moved up.
|
|
381
416
|
insertBlocks(
|
|
382
417
|
replacement,
|
|
383
418
|
getBlockIndex( _clientId ),
|
|
@@ -386,6 +421,7 @@ const applyWithDispatch = withDispatch( ( dispatch, ownProps, registry ) => {
|
|
|
386
421
|
);
|
|
387
422
|
removeBlock( firstClientId, false );
|
|
388
423
|
} else {
|
|
424
|
+
// Step 5: Continue the default behavior.
|
|
389
425
|
switchToDefaultOrRemove();
|
|
390
426
|
}
|
|
391
427
|
}
|
|
@@ -461,6 +461,18 @@ _::-webkit-full-page-media, _:future, :root .has-multi-selection .block-editor-b
|
|
|
461
461
|
margin-left: -1px;
|
|
462
462
|
margin-right: -1px;
|
|
463
463
|
transition: background-color 0.3s ease;
|
|
464
|
+
display: flex;
|
|
465
|
+
align-items: center;
|
|
466
|
+
justify-content: center;
|
|
467
|
+
font-size: $default-font-size;
|
|
468
|
+
font-family: $default-font;
|
|
469
|
+
color: $black;
|
|
470
|
+
font-weight: normal;
|
|
471
|
+
|
|
472
|
+
.is-zoomed-out & {
|
|
473
|
+
// Scale the font size based on the zoom level.
|
|
474
|
+
font-size: calc(#{$default-font-size} * ( 2 - var(--wp-block-editor-iframe-zoom-out-scale) ));
|
|
475
|
+
}
|
|
464
476
|
|
|
465
477
|
&.is-dragged-over {
|
|
466
478
|
background: $gray-400;
|
|
@@ -68,7 +68,6 @@ export function useFocusFirstElement( { clientId, initialPosition } ) {
|
|
|
68
68
|
textInputs[ isReverse ? textInputs.length - 1 : 0 ] || ref.current;
|
|
69
69
|
|
|
70
70
|
if ( ! isInsideRootBlock( ref.current, target ) ) {
|
|
71
|
-
ownerDocument.defaultView.getSelection().removeAllRanges();
|
|
72
71
|
ref.current.focus();
|
|
73
72
|
return;
|
|
74
73
|
}
|
|
@@ -13,6 +13,7 @@ import {
|
|
|
13
13
|
import { useReducedMotion } from '@wordpress/compose';
|
|
14
14
|
import { useSelect } from '@wordpress/data';
|
|
15
15
|
import { useState } from '@wordpress/element';
|
|
16
|
+
import { __ } from '@wordpress/i18n';
|
|
16
17
|
|
|
17
18
|
/**
|
|
18
19
|
* Internal dependencies
|
|
@@ -103,7 +104,19 @@ export function ZoomOutSeparator( {
|
|
|
103
104
|
data-is-insertion-point="true"
|
|
104
105
|
onDragOver={ () => setIsDraggedOver( true ) }
|
|
105
106
|
onDragLeave={ () => setIsDraggedOver( false ) }
|
|
106
|
-
|
|
107
|
+
>
|
|
108
|
+
<motion.div
|
|
109
|
+
initial={ { opacity: 0 } }
|
|
110
|
+
animate={ { opacity: 1 } }
|
|
111
|
+
exit={ { opacity: 0 } }
|
|
112
|
+
transition={ {
|
|
113
|
+
type: 'tween',
|
|
114
|
+
duration: 0.1,
|
|
115
|
+
} }
|
|
116
|
+
>
|
|
117
|
+
{ __( 'Drop pattern.' ) }
|
|
118
|
+
</motion.div>
|
|
119
|
+
</motion.div>
|
|
107
120
|
) }
|
|
108
121
|
</AnimatePresence>
|
|
109
122
|
);
|
|
@@ -20,15 +20,15 @@ describe( 'use-transformed-patterns', () => {
|
|
|
20
20
|
},
|
|
21
21
|
content: {
|
|
22
22
|
type: 'boolean',
|
|
23
|
-
|
|
23
|
+
role: 'content',
|
|
24
24
|
},
|
|
25
25
|
level: {
|
|
26
26
|
type: 'number',
|
|
27
|
-
|
|
27
|
+
role: 'content',
|
|
28
28
|
},
|
|
29
29
|
color: {
|
|
30
30
|
type: 'string',
|
|
31
|
-
|
|
31
|
+
role: 'other',
|
|
32
32
|
},
|
|
33
33
|
},
|
|
34
34
|
save() {},
|
|
@@ -18,15 +18,15 @@ describe( 'BlockSwitcher - utils', () => {
|
|
|
18
18
|
},
|
|
19
19
|
content: {
|
|
20
20
|
type: 'boolean',
|
|
21
|
-
|
|
21
|
+
role: 'content',
|
|
22
22
|
},
|
|
23
23
|
level: {
|
|
24
24
|
type: 'number',
|
|
25
|
-
|
|
25
|
+
role: 'content',
|
|
26
26
|
},
|
|
27
27
|
color: {
|
|
28
28
|
type: 'string',
|
|
29
|
-
|
|
29
|
+
role: 'other',
|
|
30
30
|
},
|
|
31
31
|
},
|
|
32
32
|
save() {},
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
|
-
import {
|
|
4
|
+
import { getBlockAttributesNamesByRole } from '@wordpress/blocks';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Try to find a matching block by a block's name in a provided
|
|
@@ -37,6 +37,13 @@
|
|
|
37
37
|
border-right: $border-width solid $gray-300;
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
+
&.is-connected {
|
|
41
|
+
.block-editor-block-switcher .components-button::before {
|
|
42
|
+
background: color-mix(in srgb, var(--wp-block-synced-color) 10%, transparent);
|
|
43
|
+
border-radius: $radius-small;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
40
47
|
&.is-synced,
|
|
41
48
|
&.is-connected {
|
|
42
49
|
.block-editor-block-switcher .components-button .block-editor-block-icon {
|
|
@@ -21,6 +21,7 @@ import { chevronDown } from '@wordpress/icons';
|
|
|
21
21
|
*/
|
|
22
22
|
import BlockIcon from '../block-icon';
|
|
23
23
|
import { store as blockEditorStore } from '../../store';
|
|
24
|
+
import { unlock } from '../../lock-unlock';
|
|
24
25
|
|
|
25
26
|
function VariationsButtons( {
|
|
26
27
|
className,
|
|
@@ -142,18 +143,16 @@ function __experimentalBlockVariationTransforms( { blockClientId } ) {
|
|
|
142
143
|
const { updateBlockAttributes } = useDispatch( blockEditorStore );
|
|
143
144
|
const { activeBlockVariation, variations, isContentOnly } = useSelect(
|
|
144
145
|
( select ) => {
|
|
145
|
-
const {
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
__experimentalHasContentRoleAttribute,
|
|
149
|
-
} = select( blocksStore );
|
|
146
|
+
const { getActiveBlockVariation, getBlockVariations } =
|
|
147
|
+
select( blocksStore );
|
|
148
|
+
|
|
150
149
|
const { getBlockName, getBlockAttributes, getBlockEditingMode } =
|
|
151
150
|
select( blockEditorStore );
|
|
152
151
|
|
|
153
152
|
const name = blockClientId && getBlockName( blockClientId );
|
|
154
153
|
|
|
155
|
-
const
|
|
156
|
-
|
|
154
|
+
const { hasContentRoleAttribute } = unlock( select( blocksStore ) );
|
|
155
|
+
const isContentBlock = hasContentRoleAttribute( name );
|
|
157
156
|
|
|
158
157
|
return {
|
|
159
158
|
activeBlockVariation: getActiveBlockVariation(
|
|
@@ -1,27 +1,11 @@
|
|
|
1
1
|
.block-editor-media-placeholder__url-input-form {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
// Selector requires a lot of specificity to override base styles.
|
|
5
|
-
input[type="url"].block-editor-media-placeholder__url-input-field {
|
|
6
|
-
width: 100%;
|
|
7
|
-
min-width: 200px;
|
|
8
|
-
|
|
9
|
-
@include break-small() {
|
|
10
|
-
width: 300px;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
flex-grow: 1;
|
|
14
|
-
border: none;
|
|
15
|
-
border-radius: 0;
|
|
16
|
-
margin: 2px;
|
|
2
|
+
min-width: 260px;
|
|
17
3
|
|
|
4
|
+
@include break-small() {
|
|
5
|
+
width: 300px;
|
|
18
6
|
}
|
|
19
7
|
}
|
|
20
8
|
|
|
21
|
-
.block-editor-media-placeholder__url-input-submit-button {
|
|
22
|
-
flex-shrink: 1;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
9
|
.block-editor-media-placeholder__cancel-button.is-link {
|
|
26
10
|
margin: 1em;
|
|
27
11
|
display: block;
|
|
@@ -11,6 +11,8 @@ import {
|
|
|
11
11
|
FormFileUpload,
|
|
12
12
|
Placeholder,
|
|
13
13
|
DropZone,
|
|
14
|
+
__experimentalInputControl as InputControl,
|
|
15
|
+
__experimentalInputControlSuffixWrapper as InputControlSuffixWrapper,
|
|
14
16
|
withFilters,
|
|
15
17
|
} from '@wordpress/components';
|
|
16
18
|
import { __ } from '@wordpress/i18n';
|
|
@@ -42,21 +44,23 @@ const InsertFromURLPopover = ( {
|
|
|
42
44
|
className="block-editor-media-placeholder__url-input-form"
|
|
43
45
|
onSubmit={ onSubmit }
|
|
44
46
|
>
|
|
45
|
-
<
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
47
|
+
<InputControl
|
|
48
|
+
__next40pxDefaultSize
|
|
49
|
+
label={ __( 'URL' ) }
|
|
50
|
+
hideLabelFromVision
|
|
49
51
|
placeholder={ __( 'Paste or type URL' ) }
|
|
50
52
|
onChange={ onChange }
|
|
51
53
|
value={ src }
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
54
|
+
suffix={
|
|
55
|
+
<InputControlSuffixWrapper variant="control">
|
|
56
|
+
<Button
|
|
57
|
+
size="small"
|
|
58
|
+
icon={ keyboardReturn }
|
|
59
|
+
label={ __( 'Apply' ) }
|
|
60
|
+
type="submit"
|
|
61
|
+
/>
|
|
62
|
+
</InputControlSuffixWrapper>
|
|
63
|
+
}
|
|
60
64
|
/>
|
|
61
65
|
</form>
|
|
62
66
|
</URLPopover>
|
|
@@ -167,10 +171,6 @@ export function MediaPlaceholder( {
|
|
|
167
171
|
);
|
|
168
172
|
};
|
|
169
173
|
|
|
170
|
-
const onChangeSrc = ( event ) => {
|
|
171
|
-
setSrc( event.target.value );
|
|
172
|
-
};
|
|
173
|
-
|
|
174
174
|
const onFilesUpload = ( files ) => {
|
|
175
175
|
if (
|
|
176
176
|
! handleUpload ||
|
|
@@ -407,7 +407,7 @@ export function MediaPlaceholder( {
|
|
|
407
407
|
onSelectURL && (
|
|
408
408
|
<URLSelectionUI
|
|
409
409
|
src={ src }
|
|
410
|
-
onChangeSrc={
|
|
410
|
+
onChangeSrc={ setSrc }
|
|
411
411
|
onSelectURL={ onSelectURL }
|
|
412
412
|
/>
|
|
413
413
|
)
|