@wordpress/block-editor 12.8.0 → 12.8.1
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 +25 -0
- package/build/components/block-controls/slot.js +1 -1
- package/build/components/block-controls/slot.js.map +1 -1
- package/build/components/block-controls/slot.native.js +1 -1
- package/build/components/block-controls/slot.native.js.map +1 -1
- package/build/components/block-controls/use-has-block-controls.js +1 -1
- package/build/components/block-controls/use-has-block-controls.js.map +1 -1
- package/build/components/block-list/use-block-props/index.js +27 -1
- package/build/components/block-list/use-block-props/index.js.map +1 -1
- package/build/components/block-list/use-block-props/use-nav-mode-exit.js +1 -1
- package/build/components/block-list/use-block-props/use-nav-mode-exit.js.map +1 -1
- package/build/components/block-lock/menu-item.js +3 -1
- package/build/components/block-lock/menu-item.js.map +1 -1
- package/build/components/block-lock/toolbar.js +3 -1
- package/build/components/block-lock/toolbar.js.map +1 -1
- package/build/components/iframe/index.js +1 -0
- package/build/components/iframe/index.js.map +1 -1
- package/build/components/inspector-controls/fill.js +1 -1
- package/build/components/inspector-controls/fill.js.map +1 -1
- package/build/components/inspector-controls/fill.native.js +1 -1
- package/build/components/inspector-controls/fill.native.js.map +1 -1
- package/build/components/inspector-controls/slot.js +1 -1
- package/build/components/inspector-controls/slot.js.map +1 -1
- package/build/components/inspector-controls/slot.native.js +1 -1
- package/build/components/inspector-controls/slot.native.js.map +1 -1
- package/build/components/rich-text/use-remove-browser-shortcuts.js +1 -1
- package/build/components/rich-text/use-remove-browser-shortcuts.js.map +1 -1
- package/build/store/selectors.js +1 -1
- package/build/store/selectors.js.map +1 -1
- package/build-module/components/block-controls/slot.js +1 -1
- package/build-module/components/block-controls/slot.js.map +1 -1
- package/build-module/components/block-controls/slot.native.js +1 -1
- package/build-module/components/block-controls/slot.native.js.map +1 -1
- package/build-module/components/block-controls/use-has-block-controls.js +1 -1
- package/build-module/components/block-controls/use-has-block-controls.js.map +1 -1
- package/build-module/components/block-list/use-block-props/index.js +27 -1
- package/build-module/components/block-list/use-block-props/index.js.map +1 -1
- package/build-module/components/block-list/use-block-props/use-nav-mode-exit.js +1 -1
- package/build-module/components/block-list/use-block-props/use-nav-mode-exit.js.map +1 -1
- package/build-module/components/block-lock/menu-item.js +3 -1
- package/build-module/components/block-lock/menu-item.js.map +1 -1
- package/build-module/components/block-lock/toolbar.js +3 -1
- package/build-module/components/block-lock/toolbar.js.map +1 -1
- package/build-module/components/iframe/index.js +1 -0
- package/build-module/components/iframe/index.js.map +1 -1
- package/build-module/components/inspector-controls/fill.js +1 -1
- package/build-module/components/inspector-controls/fill.js.map +1 -1
- package/build-module/components/inspector-controls/fill.native.js +1 -1
- package/build-module/components/inspector-controls/fill.native.js.map +1 -1
- package/build-module/components/inspector-controls/slot.js +1 -1
- package/build-module/components/inspector-controls/slot.js.map +1 -1
- package/build-module/components/inspector-controls/slot.native.js +1 -1
- package/build-module/components/inspector-controls/slot.native.js.map +1 -1
- package/build-module/components/rich-text/use-remove-browser-shortcuts.js +1 -1
- package/build-module/components/rich-text/use-remove-browser-shortcuts.js.map +1 -1
- package/build-module/store/selectors.js +1 -1
- package/build-module/store/selectors.js.map +1 -1
- package/build-style/style-rtl.css +0 -3
- package/build-style/style.css +0 -3
- package/package.json +32 -32
- package/src/components/block-icon/test/index.js +2 -2
- package/src/components/block-list/use-block-props/index.js +26 -0
- package/src/components/block-list/use-block-props/use-nav-mode-exit.js +1 -1
- package/src/components/block-lock/menu-item.js +2 -0
- package/src/components/block-lock/toolbar.js +3 -1
- package/src/components/block-styles/style.scss +0 -3
- package/src/components/iframe/index.js +1 -0
- package/src/components/rich-text/use-remove-browser-shortcuts.js +1 -1
- package/src/store/selectors.js +1 -1
package/README.md
CHANGED
|
@@ -857,6 +857,31 @@ _Returns_
|
|
|
857
857
|
|
|
858
858
|
This hook is used to lightly mark an element as a block element. The element should be the outermost element of a block. Call this hook and pass the returned props to the element to mark as a block. If you define a ref for the element, it is important to pass the ref to this hook, which the hook in turn will pass to the component through the props it returns. Optionally, you can also pass any other props through this hook, and they will be merged and returned.
|
|
859
859
|
|
|
860
|
+
Use of this hook on the outermost element of a block is required if using API >= v2.
|
|
861
|
+
|
|
862
|
+
_Usage_
|
|
863
|
+
|
|
864
|
+
```js
|
|
865
|
+
import { useBlockProps } from '@wordpress/block-editor';
|
|
866
|
+
|
|
867
|
+
export default function Edit() {
|
|
868
|
+
|
|
869
|
+
const blockProps = useBlockProps(
|
|
870
|
+
className: 'my-custom-class',
|
|
871
|
+
style: {
|
|
872
|
+
color: '#222222',
|
|
873
|
+
backgroundColor: '#eeeeee'
|
|
874
|
+
}
|
|
875
|
+
)
|
|
876
|
+
|
|
877
|
+
return (
|
|
878
|
+
<div { ...blockProps }>
|
|
879
|
+
|
|
880
|
+
</div>
|
|
881
|
+
)
|
|
882
|
+
}
|
|
883
|
+
```
|
|
884
|
+
|
|
860
885
|
_Parameters_
|
|
861
886
|
|
|
862
887
|
- _props_ `Object`: Optional. Props to pass to the element. Must contain the ref if one is defined.
|
|
@@ -37,7 +37,7 @@ function BlockControlsSlot({
|
|
|
37
37
|
const Slot = _groups.default[group]?.Slot;
|
|
38
38
|
const fills = (0, _components.__experimentalUseSlotFills)(Slot?.__unstableName);
|
|
39
39
|
if (!Slot) {
|
|
40
|
-
typeof
|
|
40
|
+
typeof SCRIPT_DEBUG !== "undefined" && SCRIPT_DEBUG === true ? (0, _warning.default)(`Unknown BlockControls group "${group}" provided.`) : void 0;
|
|
41
41
|
return null;
|
|
42
42
|
}
|
|
43
43
|
if (!fills?.length) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_element","require","_components","_warning","_interopRequireDefault","_groups","_lockUnlock","ComponentsContext","unlock","privateApis","BlockControlsSlot","group","props","toolbarState","useContext","ToolbarContext","contextState","fillProps","useMemo","forwardedContext","Provider","value","Slot","groups","fills","useSlotFills","__unstableName","
|
|
1
|
+
{"version":3,"names":["_element","require","_components","_warning","_interopRequireDefault","_groups","_lockUnlock","ComponentsContext","unlock","privateApis","BlockControlsSlot","group","props","toolbarState","useContext","ToolbarContext","contextState","fillProps","useMemo","forwardedContext","Provider","value","Slot","groups","fills","useSlotFills","__unstableName","SCRIPT_DEBUG","warning","length","slot","createElement","bubblesVirtually","ToolbarGroup"],"sources":["@wordpress/block-editor/src/components/block-controls/slot.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useContext, useMemo } from '@wordpress/element';\nimport {\n\tprivateApis,\n\t__experimentalToolbarContext as ToolbarContext,\n\tToolbarGroup,\n\t__experimentalUseSlotFills as useSlotFills,\n} from '@wordpress/components';\nimport warning from '@wordpress/warning';\n\n/**\n * Internal dependencies\n */\nimport groups from './groups';\nimport { unlock } from '../../lock-unlock';\n\nconst { ComponentsContext } = unlock( privateApis );\n\nexport default function BlockControlsSlot( { group = 'default', ...props } ) {\n\tconst toolbarState = useContext( ToolbarContext );\n\tconst contextState = useContext( ComponentsContext );\n\tconst fillProps = useMemo(\n\t\t() => ( {\n\t\t\tforwardedContext: [\n\t\t\t\t[ ToolbarContext.Provider, { value: toolbarState } ],\n\t\t\t\t[ ComponentsContext.Provider, { value: contextState } ],\n\t\t\t],\n\t\t} ),\n\t\t[ toolbarState, contextState ]\n\t);\n\n\tconst Slot = groups[ group ]?.Slot;\n\tconst fills = useSlotFills( Slot?.__unstableName );\n\tif ( ! Slot ) {\n\t\twarning( `Unknown BlockControls group \"${ group }\" provided.` );\n\t\treturn null;\n\t}\n\n\tif ( ! fills?.length ) {\n\t\treturn null;\n\t}\n\n\tconst slot = <Slot { ...props } bubblesVirtually fillProps={ fillProps } />;\n\n\tif ( group === 'default' ) {\n\t\treturn slot;\n\t}\n\n\treturn <ToolbarGroup>{ slot }</ToolbarGroup>;\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AAMA,IAAAE,QAAA,GAAAC,sBAAA,CAAAH,OAAA;AAKA,IAAAI,OAAA,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,IAAA9B,QAAA,CAAA+B,aAAA,EAAC7B,WAAA,CAAA+B,YAAY,QAAGH,IAAoB,CAAC;AAC7C"}
|
|
@@ -23,7 +23,7 @@ function BlockControlsSlot({
|
|
|
23
23
|
}) {
|
|
24
24
|
const Slot = _groups.default[group]?.Slot;
|
|
25
25
|
if (!Slot) {
|
|
26
|
-
typeof
|
|
26
|
+
typeof SCRIPT_DEBUG !== "undefined" && SCRIPT_DEBUG === true ? (0, _warning.default)(`Unknown BlockControls group "${group}" provided.`) : void 0;
|
|
27
27
|
return null;
|
|
28
28
|
}
|
|
29
29
|
if (group === 'default') {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_components","require","_warning","_interopRequireDefault","_groups","BlockControlsSlot","group","props","Slot","groups","
|
|
1
|
+
{"version":3,"names":["_components","require","_warning","_interopRequireDefault","_groups","BlockControlsSlot","group","props","Slot","groups","SCRIPT_DEBUG","warning","_element","createElement","fills","length","ToolbarGroup"],"sources":["@wordpress/block-editor/src/components/block-controls/slot.native.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { ToolbarGroup } from '@wordpress/components';\nimport warning from '@wordpress/warning';\n\n/**\n * Internal dependencies\n */\nimport groups from './groups';\n\nexport default function BlockControlsSlot( { group = 'default', ...props } ) {\n\tconst Slot = groups[ group ]?.Slot;\n\tif ( ! Slot ) {\n\t\twarning( `Unknown BlockControls group \"${ group }\" provided.` );\n\t\treturn null;\n\t}\n\n\tif ( group === 'default' ) {\n\t\treturn <Slot { ...props } />;\n\t}\n\n\treturn (\n\t\t<Slot { ...props }>\n\t\t\t{ ( fills ) => {\n\t\t\t\tif ( ! fills.length ) {\n\t\t\t\t\treturn null;\n\t\t\t\t}\n\t\t\t\treturn <ToolbarGroup>{ fills }</ToolbarGroup>;\n\t\t\t} }\n\t\t</Slot>\n\t);\n}\n"],"mappings":";;;;;;;;AAGA,IAAAA,WAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAC,sBAAA,CAAAF,OAAA;AAKA,IAAAG,OAAA,GAAAD,sBAAA,CAAAF,OAAA;AATA;AACA;AACA;;AAIA;AACA;AACA;;AAGe,SAASI,iBAAiBA,CAAE;EAAEC,KAAK,GAAG,SAAS;EAAE,GAAGC;AAAM,CAAC,EAAG;EAC5E,MAAMC,IAAI,GAAGC,eAAM,CAAEH,KAAK,CAAE,EAAEE,IAAI;EAClC,IAAK,CAAEA,IAAI,EAAG;IACb,OAAAE,YAAA,oBAAAA,YAAA,gBAAAC,gBAAO,EAAG,gCAAgCL,KAAO,aAAa,CAAC;IAC/D,OAAO,IAAI;EACZ;EAEA,IAAKA,KAAK,KAAK,SAAS,EAAG;IAC1B,OAAO,IAAAM,QAAA,CAAAC,aAAA,EAACL,IAAI;MAAA,GAAMD;IAAK,CAAI,CAAC;EAC7B;EAEA,OACC,IAAAK,QAAA,CAAAC,aAAA,EAACL,IAAI;IAAA,GAAMD;EAAK,GACXO,KAAK,IAAM;IACd,IAAK,CAAEA,KAAK,CAACC,MAAM,EAAG;MACrB,OAAO,IAAI;IACZ;IACA,OAAO,IAAAH,QAAA,CAAAC,aAAA,EAACb,WAAA,CAAAgB,YAAY,QAAGF,KAAqB,CAAC;EAC9C,CACK,CAAC;AAET"}
|
|
@@ -35,7 +35,7 @@ function useHasBlockControls(group = 'default') {
|
|
|
35
35
|
const Slot = _groups.default[group]?.Slot;
|
|
36
36
|
const fills = (0, _components.__experimentalUseSlotFills)(Slot?.__unstableName);
|
|
37
37
|
if (!Slot) {
|
|
38
|
-
typeof
|
|
38
|
+
typeof SCRIPT_DEBUG !== "undefined" && SCRIPT_DEBUG === true ? (0, _warning.default)(`Unknown BlockControls group "${group}" provided.`) : void 0;
|
|
39
39
|
return null;
|
|
40
40
|
}
|
|
41
41
|
return !!fills?.length;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_components","require","_warning","_interopRequireDefault","_groups","useHasAnyBlockControls","hasAnyBlockControls","group","groups","useHasBlockControls","Slot","fills","useSlotFills","__unstableName","
|
|
1
|
+
{"version":3,"names":["_components","require","_warning","_interopRequireDefault","_groups","useHasAnyBlockControls","hasAnyBlockControls","group","groups","useHasBlockControls","Slot","fills","useSlotFills","__unstableName","SCRIPT_DEBUG","warning","length"],"sources":["@wordpress/block-editor/src/components/block-controls/use-has-block-controls.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __experimentalUseSlotFills as useSlotFills } from '@wordpress/components';\nimport warning from '@wordpress/warning';\n\n/**\n * Internal dependencies\n */\nimport groups from './groups';\n\nexport function useHasAnyBlockControls() {\n\tlet hasAnyBlockControls = false;\n\tfor ( const group in groups ) {\n\t\t// It is safe to violate the rules of hooks here as the `groups` object\n\t\t// is static and will not change length between renders. Do not return\n\t\t// early as that will cause the hook to be called a different number of\n\t\t// times between renders.\n\t\t// eslint-disable-next-line react-hooks/rules-of-hooks\n\t\tif ( useHasBlockControls( group ) ) {\n\t\t\thasAnyBlockControls = true;\n\t\t}\n\t}\n\treturn hasAnyBlockControls;\n}\n\nexport function useHasBlockControls( group = 'default' ) {\n\tconst Slot = groups[ group ]?.Slot;\n\tconst fills = useSlotFills( Slot?.__unstableName );\n\tif ( ! Slot ) {\n\t\twarning( `Unknown BlockControls group \"${ group }\" provided.` );\n\t\treturn null;\n\t}\n\treturn !! fills?.length;\n}\n"],"mappings":";;;;;;;;AAGA,IAAAA,WAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAC,sBAAA,CAAAF,OAAA;AAKA,IAAAG,OAAA,GAAAD,sBAAA,CAAAF,OAAA;AATA;AACA;AACA;;AAIA;AACA;AACA;;AAGO,SAASI,sBAAsBA,CAAA,EAAG;EACxC,IAAIC,mBAAmB,GAAG,KAAK;EAC/B,KAAM,MAAMC,KAAK,IAAIC,eAAM,EAAG;IAC7B;IACA;IACA;IACA;IACA;IACA,IAAKC,mBAAmB,CAAEF,KAAM,CAAC,EAAG;MACnCD,mBAAmB,GAAG,IAAI;IAC3B;EACD;EACA,OAAOA,mBAAmB;AAC3B;AAEO,SAASG,mBAAmBA,CAAEF,KAAK,GAAG,SAAS,EAAG;EACxD,MAAMG,IAAI,GAAGF,eAAM,CAAED,KAAK,CAAE,EAAEG,IAAI;EAClC,MAAMC,KAAK,GAAG,IAAAC,sCAAY,EAAEF,IAAI,EAAEG,cAAe,CAAC;EAClD,IAAK,CAAEH,IAAI,EAAG;IACb,OAAAI,YAAA,oBAAAA,YAAA,gBAAAC,gBAAO,EAAG,gCAAgCR,KAAO,aAAa,CAAC;IAC/D,OAAO,IAAI;EACZ;EACA,OAAO,CAAC,CAAEI,KAAK,EAAEK,MAAM;AACxB"}
|
|
@@ -56,6 +56,32 @@ const BLOCK_ANIMATION_THRESHOLD = 200;
|
|
|
56
56
|
* also pass any other props through this hook, and they will be merged and
|
|
57
57
|
* returned.
|
|
58
58
|
*
|
|
59
|
+
* Use of this hook on the outermost element of a block is required if using API >= v2.
|
|
60
|
+
*
|
|
61
|
+
* @example
|
|
62
|
+
* ```js
|
|
63
|
+
* import { useBlockProps } from '@wordpress/block-editor';
|
|
64
|
+
*
|
|
65
|
+
* export default function Edit() {
|
|
66
|
+
*
|
|
67
|
+
* const blockProps = useBlockProps(
|
|
68
|
+
* className: 'my-custom-class',
|
|
69
|
+
* style: {
|
|
70
|
+
* color: '#222222',
|
|
71
|
+
* backgroundColor: '#eeeeee'
|
|
72
|
+
* }
|
|
73
|
+
* )
|
|
74
|
+
*
|
|
75
|
+
* return (
|
|
76
|
+
* <div { ...blockProps }>
|
|
77
|
+
*
|
|
78
|
+
* </div>
|
|
79
|
+
* )
|
|
80
|
+
* }
|
|
81
|
+
*
|
|
82
|
+
* ```
|
|
83
|
+
*
|
|
84
|
+
*
|
|
59
85
|
* @param {Object} props Optional. Props to pass to the element. Must contain
|
|
60
86
|
* the ref if one is defined.
|
|
61
87
|
* @param {Object} options Options for internal use only.
|
|
@@ -133,7 +159,7 @@ function useBlockProps(props = {}, {
|
|
|
133
159
|
const blockEditContext = (0, _context.useBlockEditContext)();
|
|
134
160
|
// Ensures it warns only inside the `edit` implementation for the block.
|
|
135
161
|
if (blockApiVersion < 2 && clientId === blockEditContext.clientId) {
|
|
136
|
-
typeof
|
|
162
|
+
typeof SCRIPT_DEBUG !== "undefined" && SCRIPT_DEBUG === true ? (0, _warning.default)(`Block type "${name}" must support API version 2 or higher to work correctly with "useBlockProps" method.`) : void 0;
|
|
137
163
|
}
|
|
138
164
|
return {
|
|
139
165
|
tabIndex: 0,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_classnames","_interopRequireDefault","require","_element","_i18n","_blocks","_compose","_data","_warning","_useMovingAnimation","_blockListBlockContext","_useFocusFirstElement","_useIsHovered","_context","_useBlockClassNames","_useBlockDefaultClassName","_useBlockCustomClassName","_useBlockMovingModeClassNames","_useFocusHandler","_useSelectedBlockEventHandlers","_useNavModeExit","_useBlockRefs","_useIntersectionObserver","_store","_blockContentOverlay","_lockUnlock","BLOCK_ANIMATION_THRESHOLD","useBlockProps","props","__unstableIsHtml","clientId","className","wrapperProps","isAligned","useContext","BlockListBlockContext","index","mode","name","blockApiVersion","blockTitle","isPartOfSelection","adjustScrolling","enableAnimation","isSubtreeDisabled","useSelect","select","getBlockAttributes","getBlockIndex","getBlockMode","getBlockName","isTyping","getGlobalBlockCount","isBlockSelected","isBlockMultiSelected","isAncestorMultiSelected","isFirstMultiSelectedBlock","isBlockSubtreeDisabled","unlock","blockEditorStore","getActiveBlockVariation","blocksStore","isSelected","isPartOfMultiSelection","blockName","blockType","getBlockType","attributes","match","apiVersion","title","hasOverlay","useBlockOverlayActive","blockLabel","sprintf","__","htmlSuffix","mergedRefs","useMergeRefs","ref","useFocusFirstElement","useBlockRefProvider","useFocusHandler","useEventHandlers","useNavModeExit","useIsHovered","useIntersectionObserver","useMovingAnimation","triggerAnimationOnChange","useDisabled","isDisabled","blockEditContext","useBlockEditContext","process","env","NODE_ENV","warning","tabIndex","id","role","inert","undefined","classnames","useBlockClassNames","useBlockDefaultClassName","useBlockCustomClassName","useBlockMovingModeClassNames","style","save","getBlockProps"],"sources":["@wordpress/block-editor/src/components/block-list/use-block-props/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { useContext } from '@wordpress/element';\nimport { __, sprintf } from '@wordpress/i18n';\nimport {\n\t__unstableGetBlockProps as getBlockProps,\n\tgetBlockType,\n\tstore as blocksStore,\n} from '@wordpress/blocks';\nimport { useMergeRefs, useDisabled } from '@wordpress/compose';\nimport { useSelect } from '@wordpress/data';\nimport warning from '@wordpress/warning';\n\n/**\n * Internal dependencies\n */\nimport useMovingAnimation from '../../use-moving-animation';\nimport { BlockListBlockContext } from '../block-list-block-context';\nimport { useFocusFirstElement } from './use-focus-first-element';\nimport { useIsHovered } from './use-is-hovered';\nimport { useBlockEditContext } from '../../block-edit/context';\nimport { useBlockClassNames } from './use-block-class-names';\nimport { useBlockDefaultClassName } from './use-block-default-class-name';\nimport { useBlockCustomClassName } from './use-block-custom-class-name';\nimport { useBlockMovingModeClassNames } from './use-block-moving-mode-class-names';\nimport { useFocusHandler } from './use-focus-handler';\nimport { useEventHandlers } from './use-selected-block-event-handlers';\nimport { useNavModeExit } from './use-nav-mode-exit';\nimport { useBlockRefProvider } from './use-block-refs';\nimport { useIntersectionObserver } from './use-intersection-observer';\nimport { store as blockEditorStore } from '../../../store';\nimport useBlockOverlayActive from '../../block-content-overlay';\nimport { unlock } from '../../../lock-unlock';\n\n/**\n * If the block count exceeds the threshold, we disable the reordering animation\n * to avoid laginess.\n */\nconst BLOCK_ANIMATION_THRESHOLD = 200;\n\n/**\n * This hook is used to lightly mark an element as a block element. The element\n * should be the outermost element of a block. Call this hook and pass the\n * returned props to the element to mark as a block. If you define a ref for the\n * element, it is important to pass the ref to this hook, which the hook in turn\n * will pass to the component through the props it returns. Optionally, you can\n * also pass any other props through this hook, and they will be merged and\n * returned.\n *\n * @param {Object} props Optional. Props to pass to the element. Must contain\n * the ref if one is defined.\n * @param {Object} options Options for internal use only.\n * @param {boolean} options.__unstableIsHtml\n *\n * @return {Object} Props to pass to the element to mark as a block.\n */\nexport function useBlockProps( props = {}, { __unstableIsHtml } = {} ) {\n\tconst {\n\t\tclientId,\n\t\tclassName,\n\t\twrapperProps = {},\n\t\tisAligned,\n\t} = useContext( BlockListBlockContext );\n\tconst {\n\t\tindex,\n\t\tmode,\n\t\tname,\n\t\tblockApiVersion,\n\t\tblockTitle,\n\t\tisPartOfSelection,\n\t\tadjustScrolling,\n\t\tenableAnimation,\n\t\tisSubtreeDisabled,\n\t} = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tgetBlockAttributes,\n\t\t\t\tgetBlockIndex,\n\t\t\t\tgetBlockMode,\n\t\t\t\tgetBlockName,\n\t\t\t\tisTyping,\n\t\t\t\tgetGlobalBlockCount,\n\t\t\t\tisBlockSelected,\n\t\t\t\tisBlockMultiSelected,\n\t\t\t\tisAncestorMultiSelected,\n\t\t\t\tisFirstMultiSelectedBlock,\n\t\t\t\tisBlockSubtreeDisabled,\n\t\t\t} = unlock( select( blockEditorStore ) );\n\t\t\tconst { getActiveBlockVariation } = select( blocksStore );\n\t\t\tconst isSelected = isBlockSelected( clientId );\n\t\t\tconst isPartOfMultiSelection =\n\t\t\t\tisBlockMultiSelected( clientId ) ||\n\t\t\t\tisAncestorMultiSelected( clientId );\n\t\t\tconst blockName = getBlockName( clientId );\n\t\t\tconst blockType = getBlockType( blockName );\n\t\t\tconst attributes = getBlockAttributes( clientId );\n\t\t\tconst match = getActiveBlockVariation( blockName, attributes );\n\n\t\t\treturn {\n\t\t\t\tindex: getBlockIndex( clientId ),\n\t\t\t\tmode: getBlockMode( clientId ),\n\t\t\t\tname: blockName,\n\t\t\t\tblockApiVersion: blockType?.apiVersion || 1,\n\t\t\t\tblockTitle: match?.title || blockType?.title,\n\t\t\t\tisPartOfSelection: isSelected || isPartOfMultiSelection,\n\t\t\t\tadjustScrolling:\n\t\t\t\t\tisSelected || isFirstMultiSelectedBlock( clientId ),\n\t\t\t\tenableAnimation:\n\t\t\t\t\t! isTyping() &&\n\t\t\t\t\tgetGlobalBlockCount() <= BLOCK_ANIMATION_THRESHOLD,\n\t\t\t\tisSubtreeDisabled: isBlockSubtreeDisabled( clientId ),\n\t\t\t};\n\t\t},\n\t\t[ clientId ]\n\t);\n\n\tconst hasOverlay = useBlockOverlayActive( clientId );\n\n\t// translators: %s: Type of block (i.e. Text, Image etc)\n\tconst blockLabel = sprintf( __( 'Block: %s' ), blockTitle );\n\tconst htmlSuffix = mode === 'html' && ! __unstableIsHtml ? '-visual' : '';\n\tconst mergedRefs = useMergeRefs( [\n\t\tprops.ref,\n\t\tuseFocusFirstElement( clientId ),\n\t\tuseBlockRefProvider( clientId ),\n\t\tuseFocusHandler( clientId ),\n\t\tuseEventHandlers( clientId ),\n\t\tuseNavModeExit( clientId ),\n\t\tuseIsHovered(),\n\t\tuseIntersectionObserver(),\n\t\tuseMovingAnimation( {\n\t\t\tisSelected: isPartOfSelection,\n\t\t\tadjustScrolling,\n\t\t\tenableAnimation,\n\t\t\ttriggerAnimationOnChange: index,\n\t\t} ),\n\t\tuseDisabled( { isDisabled: ! hasOverlay } ),\n\t] );\n\n\tconst blockEditContext = useBlockEditContext();\n\t// Ensures it warns only inside the `edit` implementation for the block.\n\tif ( blockApiVersion < 2 && clientId === blockEditContext.clientId ) {\n\t\twarning(\n\t\t\t`Block type \"${ name }\" must support API version 2 or higher to work correctly with \"useBlockProps\" method.`\n\t\t);\n\t}\n\n\treturn {\n\t\ttabIndex: 0,\n\t\t...wrapperProps,\n\t\t...props,\n\t\tref: mergedRefs,\n\t\tid: `block-${ clientId }${ htmlSuffix }`,\n\t\trole: 'document',\n\t\t'aria-label': blockLabel,\n\t\t'data-block': clientId,\n\t\t'data-type': name,\n\t\t'data-title': blockTitle,\n\t\tinert: isSubtreeDisabled ? 'true' : undefined,\n\t\tclassName: classnames(\n\t\t\t// The wp-block className is important for editor styles.\n\t\t\tclassnames( 'block-editor-block-list__block', {\n\t\t\t\t'wp-block': ! isAligned,\n\t\t\t\t'has-block-overlay': hasOverlay,\n\t\t\t} ),\n\t\t\tclassName,\n\t\t\tprops.className,\n\t\t\twrapperProps.className,\n\t\t\tuseBlockClassNames( clientId ),\n\t\t\tuseBlockDefaultClassName( clientId ),\n\t\t\tuseBlockCustomClassName( clientId ),\n\t\t\tuseBlockMovingModeClassNames( clientId )\n\t\t),\n\t\tstyle: { ...wrapperProps.style, ...props.style },\n\t};\n}\n\n/**\n * Call within a save function to get the props for the block wrapper.\n *\n * @param {Object} props Optional. Props to pass to the element.\n */\nuseBlockProps.save = getBlockProps;\n"],"mappings":";;;;;;;AAGA,IAAAA,WAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,OAAA,GAAAH,OAAA;AAKA,IAAAI,QAAA,GAAAJ,OAAA;AACA,IAAAK,KAAA,GAAAL,OAAA;AACA,IAAAM,QAAA,GAAAP,sBAAA,CAAAC,OAAA;AAKA,IAAAO,mBAAA,GAAAR,sBAAA,CAAAC,OAAA;AACA,IAAAQ,sBAAA,GAAAR,OAAA;AACA,IAAAS,qBAAA,GAAAT,OAAA;AACA,IAAAU,aAAA,GAAAV,OAAA;AACA,IAAAW,QAAA,GAAAX,OAAA;AACA,IAAAY,mBAAA,GAAAZ,OAAA;AACA,IAAAa,yBAAA,GAAAb,OAAA;AACA,IAAAc,wBAAA,GAAAd,OAAA;AACA,IAAAe,6BAAA,GAAAf,OAAA;AACA,IAAAgB,gBAAA,GAAAhB,OAAA;AACA,IAAAiB,8BAAA,GAAAjB,OAAA;AACA,IAAAkB,eAAA,GAAAlB,OAAA;AACA,IAAAmB,aAAA,GAAAnB,OAAA;AACA,IAAAoB,wBAAA,GAAApB,OAAA;AACA,IAAAqB,MAAA,GAAArB,OAAA;AACA,IAAAsB,oBAAA,GAAAvB,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AA4E,0DAA4B,EAAE5E,QAAS,CACxC,CAAC;IACD6E,KAAK,EAAE;MAAE,GAAG3E,YAAY,CAAC2E,KAAK;MAAE,GAAG/E,KAAK,CAAC+E;IAAM;EAChD,CAAC;AACF;;AAEA;AACA;AACA;AACA;AACA;AACAhF,aAAa,CAACiF,IAAI,GAAGC,+BAAa"}
|
|
1
|
+
{"version":3,"names":["_classnames","_interopRequireDefault","require","_element","_i18n","_blocks","_compose","_data","_warning","_useMovingAnimation","_blockListBlockContext","_useFocusFirstElement","_useIsHovered","_context","_useBlockClassNames","_useBlockDefaultClassName","_useBlockCustomClassName","_useBlockMovingModeClassNames","_useFocusHandler","_useSelectedBlockEventHandlers","_useNavModeExit","_useBlockRefs","_useIntersectionObserver","_store","_blockContentOverlay","_lockUnlock","BLOCK_ANIMATION_THRESHOLD","useBlockProps","props","__unstableIsHtml","clientId","className","wrapperProps","isAligned","useContext","BlockListBlockContext","index","mode","name","blockApiVersion","blockTitle","isPartOfSelection","adjustScrolling","enableAnimation","isSubtreeDisabled","useSelect","select","getBlockAttributes","getBlockIndex","getBlockMode","getBlockName","isTyping","getGlobalBlockCount","isBlockSelected","isBlockMultiSelected","isAncestorMultiSelected","isFirstMultiSelectedBlock","isBlockSubtreeDisabled","unlock","blockEditorStore","getActiveBlockVariation","blocksStore","isSelected","isPartOfMultiSelection","blockName","blockType","getBlockType","attributes","match","apiVersion","title","hasOverlay","useBlockOverlayActive","blockLabel","sprintf","__","htmlSuffix","mergedRefs","useMergeRefs","ref","useFocusFirstElement","useBlockRefProvider","useFocusHandler","useEventHandlers","useNavModeExit","useIsHovered","useIntersectionObserver","useMovingAnimation","triggerAnimationOnChange","useDisabled","isDisabled","blockEditContext","useBlockEditContext","SCRIPT_DEBUG","warning","tabIndex","id","role","inert","undefined","classnames","useBlockClassNames","useBlockDefaultClassName","useBlockCustomClassName","useBlockMovingModeClassNames","style","save","getBlockProps"],"sources":["@wordpress/block-editor/src/components/block-list/use-block-props/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { useContext } from '@wordpress/element';\nimport { __, sprintf } from '@wordpress/i18n';\nimport {\n\t__unstableGetBlockProps as getBlockProps,\n\tgetBlockType,\n\tstore as blocksStore,\n} from '@wordpress/blocks';\nimport { useMergeRefs, useDisabled } from '@wordpress/compose';\nimport { useSelect } from '@wordpress/data';\nimport warning from '@wordpress/warning';\n\n/**\n * Internal dependencies\n */\nimport useMovingAnimation from '../../use-moving-animation';\nimport { BlockListBlockContext } from '../block-list-block-context';\nimport { useFocusFirstElement } from './use-focus-first-element';\nimport { useIsHovered } from './use-is-hovered';\nimport { useBlockEditContext } from '../../block-edit/context';\nimport { useBlockClassNames } from './use-block-class-names';\nimport { useBlockDefaultClassName } from './use-block-default-class-name';\nimport { useBlockCustomClassName } from './use-block-custom-class-name';\nimport { useBlockMovingModeClassNames } from './use-block-moving-mode-class-names';\nimport { useFocusHandler } from './use-focus-handler';\nimport { useEventHandlers } from './use-selected-block-event-handlers';\nimport { useNavModeExit } from './use-nav-mode-exit';\nimport { useBlockRefProvider } from './use-block-refs';\nimport { useIntersectionObserver } from './use-intersection-observer';\nimport { store as blockEditorStore } from '../../../store';\nimport useBlockOverlayActive from '../../block-content-overlay';\nimport { unlock } from '../../../lock-unlock';\n\n/**\n * If the block count exceeds the threshold, we disable the reordering animation\n * to avoid laginess.\n */\nconst BLOCK_ANIMATION_THRESHOLD = 200;\n\n/**\n * This hook is used to lightly mark an element as a block element. The element\n * should be the outermost element of a block. Call this hook and pass the\n * returned props to the element to mark as a block. If you define a ref for the\n * element, it is important to pass the ref to this hook, which the hook in turn\n * will pass to the component through the props it returns. Optionally, you can\n * also pass any other props through this hook, and they will be merged and\n * returned.\n *\n * Use of this hook on the outermost element of a block is required if using API >= v2.\n *\n * @example\n * ```js\n * import { useBlockProps } from '@wordpress/block-editor';\n *\n * export default function Edit() {\n *\n * const blockProps = useBlockProps(\n * className: 'my-custom-class',\n * style: {\n * color: '#222222',\n * backgroundColor: '#eeeeee'\n * }\n * )\n *\n * return (\n *\t <div { ...blockProps }>\n *\n * </div>\n * )\n * }\n *\n * ```\n *\n *\n * @param {Object} props Optional. Props to pass to the element. Must contain\n * the ref if one is defined.\n * @param {Object} options Options for internal use only.\n * @param {boolean} options.__unstableIsHtml\n *\n * @return {Object} Props to pass to the element to mark as a block.\n */\nexport function useBlockProps( props = {}, { __unstableIsHtml } = {} ) {\n\tconst {\n\t\tclientId,\n\t\tclassName,\n\t\twrapperProps = {},\n\t\tisAligned,\n\t} = useContext( BlockListBlockContext );\n\tconst {\n\t\tindex,\n\t\tmode,\n\t\tname,\n\t\tblockApiVersion,\n\t\tblockTitle,\n\t\tisPartOfSelection,\n\t\tadjustScrolling,\n\t\tenableAnimation,\n\t\tisSubtreeDisabled,\n\t} = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tgetBlockAttributes,\n\t\t\t\tgetBlockIndex,\n\t\t\t\tgetBlockMode,\n\t\t\t\tgetBlockName,\n\t\t\t\tisTyping,\n\t\t\t\tgetGlobalBlockCount,\n\t\t\t\tisBlockSelected,\n\t\t\t\tisBlockMultiSelected,\n\t\t\t\tisAncestorMultiSelected,\n\t\t\t\tisFirstMultiSelectedBlock,\n\t\t\t\tisBlockSubtreeDisabled,\n\t\t\t} = unlock( select( blockEditorStore ) );\n\t\t\tconst { getActiveBlockVariation } = select( blocksStore );\n\t\t\tconst isSelected = isBlockSelected( clientId );\n\t\t\tconst isPartOfMultiSelection =\n\t\t\t\tisBlockMultiSelected( clientId ) ||\n\t\t\t\tisAncestorMultiSelected( clientId );\n\t\t\tconst blockName = getBlockName( clientId );\n\t\t\tconst blockType = getBlockType( blockName );\n\t\t\tconst attributes = getBlockAttributes( clientId );\n\t\t\tconst match = getActiveBlockVariation( blockName, attributes );\n\n\t\t\treturn {\n\t\t\t\tindex: getBlockIndex( clientId ),\n\t\t\t\tmode: getBlockMode( clientId ),\n\t\t\t\tname: blockName,\n\t\t\t\tblockApiVersion: blockType?.apiVersion || 1,\n\t\t\t\tblockTitle: match?.title || blockType?.title,\n\t\t\t\tisPartOfSelection: isSelected || isPartOfMultiSelection,\n\t\t\t\tadjustScrolling:\n\t\t\t\t\tisSelected || isFirstMultiSelectedBlock( clientId ),\n\t\t\t\tenableAnimation:\n\t\t\t\t\t! isTyping() &&\n\t\t\t\t\tgetGlobalBlockCount() <= BLOCK_ANIMATION_THRESHOLD,\n\t\t\t\tisSubtreeDisabled: isBlockSubtreeDisabled( clientId ),\n\t\t\t};\n\t\t},\n\t\t[ clientId ]\n\t);\n\n\tconst hasOverlay = useBlockOverlayActive( clientId );\n\n\t// translators: %s: Type of block (i.e. Text, Image etc)\n\tconst blockLabel = sprintf( __( 'Block: %s' ), blockTitle );\n\tconst htmlSuffix = mode === 'html' && ! __unstableIsHtml ? '-visual' : '';\n\tconst mergedRefs = useMergeRefs( [\n\t\tprops.ref,\n\t\tuseFocusFirstElement( clientId ),\n\t\tuseBlockRefProvider( clientId ),\n\t\tuseFocusHandler( clientId ),\n\t\tuseEventHandlers( clientId ),\n\t\tuseNavModeExit( clientId ),\n\t\tuseIsHovered(),\n\t\tuseIntersectionObserver(),\n\t\tuseMovingAnimation( {\n\t\t\tisSelected: isPartOfSelection,\n\t\t\tadjustScrolling,\n\t\t\tenableAnimation,\n\t\t\ttriggerAnimationOnChange: index,\n\t\t} ),\n\t\tuseDisabled( { isDisabled: ! hasOverlay } ),\n\t] );\n\n\tconst blockEditContext = useBlockEditContext();\n\t// Ensures it warns only inside the `edit` implementation for the block.\n\tif ( blockApiVersion < 2 && clientId === blockEditContext.clientId ) {\n\t\twarning(\n\t\t\t`Block type \"${ name }\" must support API version 2 or higher to work correctly with \"useBlockProps\" method.`\n\t\t);\n\t}\n\n\treturn {\n\t\ttabIndex: 0,\n\t\t...wrapperProps,\n\t\t...props,\n\t\tref: mergedRefs,\n\t\tid: `block-${ clientId }${ htmlSuffix }`,\n\t\trole: 'document',\n\t\t'aria-label': blockLabel,\n\t\t'data-block': clientId,\n\t\t'data-type': name,\n\t\t'data-title': blockTitle,\n\t\tinert: isSubtreeDisabled ? 'true' : undefined,\n\t\tclassName: classnames(\n\t\t\t// The wp-block className is important for editor styles.\n\t\t\tclassnames( 'block-editor-block-list__block', {\n\t\t\t\t'wp-block': ! isAligned,\n\t\t\t\t'has-block-overlay': hasOverlay,\n\t\t\t} ),\n\t\t\tclassName,\n\t\t\tprops.className,\n\t\t\twrapperProps.className,\n\t\t\tuseBlockClassNames( clientId ),\n\t\t\tuseBlockDefaultClassName( clientId ),\n\t\t\tuseBlockCustomClassName( clientId ),\n\t\t\tuseBlockMovingModeClassNames( clientId )\n\t\t),\n\t\tstyle: { ...wrapperProps.style, ...props.style },\n\t};\n}\n\n/**\n * Call within a save function to get the props for the block wrapper.\n *\n * @param {Object} props Optional. Props to pass to the element.\n */\nuseBlockProps.save = getBlockProps;\n"],"mappings":";;;;;;;AAGA,IAAAA,WAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,OAAA,GAAAH,OAAA;AAKA,IAAAI,QAAA,GAAAJ,OAAA;AACA,IAAAK,KAAA,GAAAL,OAAA;AACA,IAAAM,QAAA,GAAAP,sBAAA,CAAAC,OAAA;AAKA,IAAAO,mBAAA,GAAAR,sBAAA,CAAAC,OAAA;AACA,IAAAQ,sBAAA,GAAAR,OAAA;AACA,IAAAS,qBAAA,GAAAT,OAAA;AACA,IAAAU,aAAA,GAAAV,OAAA;AACA,IAAAW,QAAA,GAAAX,OAAA;AACA,IAAAY,mBAAA,GAAAZ,OAAA;AACA,IAAAa,yBAAA,GAAAb,OAAA;AACA,IAAAc,wBAAA,GAAAd,OAAA;AACA,IAAAe,6BAAA,GAAAf,OAAA;AACA,IAAAgB,gBAAA,GAAAhB,OAAA;AACA,IAAAiB,8BAAA,GAAAjB,OAAA;AACA,IA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EAAEsC;IACtB,CAAE,CAAC,EACHxC,SAAS,EACTH,KAAK,CAACG,SAAS,EACfC,YAAY,CAACD,SAAS,EACtB,IAAAsE,sCAAkB,EAAEvE,QAAS,CAAC,EAC9B,IAAAwE,kDAAwB,EAAExE,QAAS,CAAC,EACpC,IAAAyE,gDAAuB,EAAEzE,QAAS,CAAC,EACnC,IAAA0E,0DAA4B,EAAE1E,QAAS,CACxC,CAAC;IACD2E,KAAK,EAAE;MAAE,GAAGzE,YAAY,CAACyE,KAAK;MAAE,GAAG7E,KAAK,CAAC6E;IAAM;EAChD,CAAC;AACF;;AAEA;AACA;AACA;AACA;AACA;AACA9E,aAAa,CAAC+E,IAAI,GAAGC,+BAAa"}
|
|
@@ -47,7 +47,7 @@ function useNavModeExit(clientId) {
|
|
|
47
47
|
}
|
|
48
48
|
node.addEventListener('mousedown', onMouseDown);
|
|
49
49
|
return () => {
|
|
50
|
-
node.
|
|
50
|
+
node.removeEventListener('mousedown', onMouseDown);
|
|
51
51
|
};
|
|
52
52
|
}, [clientId, isNavigationMode, isBlockSelected, setNavigationMode]);
|
|
53
53
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_data","require","_compose","_store","useNavModeExit","clientId","isNavigationMode","isBlockSelected","useSelect","blockEditorStore","setNavigationMode","selectBlock","useDispatch","useRefEffect","node","onMouseDown","event","defaultPrevented","preventDefault","addEventListener"],"sources":["@wordpress/block-editor/src/components/block-list/use-block-props/use-nav-mode-exit.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { useRefEffect } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../../../store';\n\n/**\n * Allows navigation mode to be exited by clicking in the selected block.\n *\n * @param {string} clientId Block client ID.\n */\nexport function useNavModeExit( clientId ) {\n\tconst { isNavigationMode, isBlockSelected } = useSelect( blockEditorStore );\n\tconst { setNavigationMode, selectBlock } = useDispatch( blockEditorStore );\n\treturn useRefEffect(\n\t\t( node ) => {\n\t\t\tfunction onMouseDown( event ) {\n\t\t\t\t// Don't select a block if it's already handled by a child\n\t\t\t\t// block.\n\t\t\t\tif ( isNavigationMode() && ! event.defaultPrevented ) {\n\t\t\t\t\t// Prevent focus from moving to the block.\n\t\t\t\t\tevent.preventDefault();\n\n\t\t\t\t\t// When clicking on a selected block, exit navigation mode.\n\t\t\t\t\tif ( isBlockSelected( clientId ) ) {\n\t\t\t\t\t\tsetNavigationMode( false );\n\t\t\t\t\t} else {\n\t\t\t\t\t\tselectBlock( clientId );\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tnode.addEventListener( 'mousedown', onMouseDown );\n\n\t\t\treturn () => {\n\t\t\t\tnode.
|
|
1
|
+
{"version":3,"names":["_data","require","_compose","_store","useNavModeExit","clientId","isNavigationMode","isBlockSelected","useSelect","blockEditorStore","setNavigationMode","selectBlock","useDispatch","useRefEffect","node","onMouseDown","event","defaultPrevented","preventDefault","addEventListener","removeEventListener"],"sources":["@wordpress/block-editor/src/components/block-list/use-block-props/use-nav-mode-exit.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { useRefEffect } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../../../store';\n\n/**\n * Allows navigation mode to be exited by clicking in the selected block.\n *\n * @param {string} clientId Block client ID.\n */\nexport function useNavModeExit( clientId ) {\n\tconst { isNavigationMode, isBlockSelected } = useSelect( blockEditorStore );\n\tconst { setNavigationMode, selectBlock } = useDispatch( blockEditorStore );\n\treturn useRefEffect(\n\t\t( node ) => {\n\t\t\tfunction onMouseDown( event ) {\n\t\t\t\t// Don't select a block if it's already handled by a child\n\t\t\t\t// block.\n\t\t\t\tif ( isNavigationMode() && ! event.defaultPrevented ) {\n\t\t\t\t\t// Prevent focus from moving to the block.\n\t\t\t\t\tevent.preventDefault();\n\n\t\t\t\t\t// When clicking on a selected block, exit navigation mode.\n\t\t\t\t\tif ( isBlockSelected( clientId ) ) {\n\t\t\t\t\t\tsetNavigationMode( false );\n\t\t\t\t\t} else {\n\t\t\t\t\t\tselectBlock( clientId );\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tnode.addEventListener( 'mousedown', onMouseDown );\n\n\t\t\treturn () => {\n\t\t\t\tnode.removeEventListener( 'mousedown', onMouseDown );\n\t\t\t};\n\t\t},\n\t\t[ clientId, isNavigationMode, isBlockSelected, setNavigationMode ]\n\t);\n}\n"],"mappings":";;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AAKA,IAAAE,MAAA,GAAAF,OAAA;AATA;AACA;AACA;;AAIA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACO,SAASG,cAAcA,CAAEC,QAAQ,EAAG;EAC1C,MAAM;IAAEC,gBAAgB;IAAEC;EAAgB,CAAC,GAAG,IAAAC,eAAS,EAAEC,YAAiB,CAAC;EAC3E,MAAM;IAAEC,iBAAiB;IAAEC;EAAY,CAAC,GAAG,IAAAC,iBAAW,EAAEH,YAAiB,CAAC;EAC1E,OAAO,IAAAI,qBAAY,EAChBC,IAAI,IAAM;IACX,SAASC,WAAWA,CAAEC,KAAK,EAAG;MAC7B;MACA;MACA,IAAKV,gBAAgB,CAAC,CAAC,IAAI,CAAEU,KAAK,CAACC,gBAAgB,EAAG;QACrD;QACAD,KAAK,CAACE,cAAc,CAAC,CAAC;;QAEtB;QACA,IAAKX,eAAe,CAAEF,QAAS,CAAC,EAAG;UAClCK,iBAAiB,CAAE,KAAM,CAAC;QAC3B,CAAC,MAAM;UACNC,WAAW,CAAEN,QAAS,CAAC;QACxB;MACD;IACD;IAEAS,IAAI,CAACK,gBAAgB,CAAE,WAAW,EAAEJ,WAAY,CAAC;IAEjD,OAAO,MAAM;MACZD,IAAI,CAACM,mBAAmB,CAAE,WAAW,EAAEL,WAAY,CAAC;IACrD,CAAC;EACF,CAAC,EACD,CAAEV,QAAQ,EAAEC,gBAAgB,EAAEC,eAAe,EAAEG,iBAAiB,CACjE,CAAC;AACF"}
|
|
@@ -33,7 +33,9 @@ function BlockLockMenuItem({
|
|
|
33
33
|
const label = isLocked ? (0, _i18n.__)('Unlock') : (0, _i18n.__)('Lock');
|
|
34
34
|
return (0, _element.createElement)(_element.Fragment, null, (0, _element.createElement)(_components.MenuItem, {
|
|
35
35
|
icon: isLocked ? _icons.unlock : _icons.lockOutline,
|
|
36
|
-
onClick: toggleModal
|
|
36
|
+
onClick: toggleModal,
|
|
37
|
+
"aria-expanded": isModalOpen,
|
|
38
|
+
"aria-haspopup": "dialog"
|
|
37
39
|
}, label), isModalOpen && (0, _element.createElement)(_modal.default, {
|
|
38
40
|
clientId: clientId,
|
|
39
41
|
onClose: toggleModal
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_element","require","_i18n","_components","_icons","_useBlockLock","_interopRequireDefault","_modal","BlockLockMenuItem","clientId","canLock","isLocked","useBlockLock","isModalOpen","toggleModal","useReducer","isActive","label","__","createElement","Fragment","MenuItem","icon","unlock","lockOutline","onClick","default","onClose"],"sources":["@wordpress/block-editor/src/components/block-lock/menu-item.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useReducer } from '@wordpress/element';\nimport { MenuItem } from '@wordpress/components';\nimport { lockOutline, unlock } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport useBlockLock from './use-block-lock';\nimport BlockLockModal from './modal';\n\nexport default function BlockLockMenuItem( { clientId } ) {\n\tconst { canLock, isLocked } = useBlockLock( clientId );\n\n\tconst [ isModalOpen, toggleModal ] = useReducer(\n\t\t( isActive ) => ! isActive,\n\t\tfalse\n\t);\n\n\tif ( ! canLock ) {\n\t\treturn null;\n\t}\n\n\tconst label = isLocked ? __( 'Unlock' ) : __( 'Lock' );\n\n\treturn (\n\t\t<>\n\t\t\t<MenuItem\n\t\t\t\ticon={ isLocked ? unlock : lockOutline }\n\t\t\t\tonClick={ toggleModal }\n\t\t\t>\n\t\t\t\t{ label }\n\t\t\t</MenuItem>\n\t\t\t{ isModalOpen && (\n\t\t\t\t<BlockLockModal clientId={ clientId } onClose={ toggleModal } />\n\t\t\t) }\n\t\t</>\n\t);\n}\n"],"mappings":";;;;;;;AAIA,IAAAA,QAAA,GAAAC,OAAA;AADA,IAAAC,KAAA,GAAAD,OAAA;AAEA,IAAAE,WAAA,GAAAF,OAAA;AACA,IAAAG,MAAA,GAAAH,OAAA;AAKA,IAAAI,aAAA,GAAAC,sBAAA,CAAAL,OAAA;AACA,IAAAM,MAAA,GAAAD,sBAAA,CAAAL,OAAA;AAZA;AACA;AACA;;AAMA;AACA;AACA;;AAIe,SAASO,iBAAiBA,CAAE;EAAEC;AAAS,CAAC,EAAG;EACzD,MAAM;IAAEC,OAAO;IAAEC;EAAS,CAAC,GAAG,IAAAC,qBAAY,EAAEH,QAAS,CAAC;EAEtD,MAAM,CAAEI,WAAW,EAAEC,WAAW,CAAE,GAAG,IAAAC,mBAAU,EAC5CC,QAAQ,IAAM,CAAEA,QAAQ,EAC1B,KACD,CAAC;EAED,IAAK,CAAEN,OAAO,EAAG;IAChB,OAAO,IAAI;EACZ;EAEA,MAAMO,KAAK,GAAGN,QAAQ,GAAG,IAAAO,QAAE,EAAE,QAAS,CAAC,GAAG,IAAAA,QAAE,EAAE,MAAO,CAAC;EAEtD,OACC,IAAAlB,QAAA,CAAAmB,aAAA,EAAAnB,QAAA,CAAAoB,QAAA,QACC,IAAApB,QAAA,CAAAmB,aAAA,EAAChB,WAAA,CAAAkB,QAAQ;IACRC,IAAI,EAAGX,QAAQ,GAAGY,aAAM,GAAGC,kBAAa;IACxCC,OAAO,EAAGX;
|
|
1
|
+
{"version":3,"names":["_element","require","_i18n","_components","_icons","_useBlockLock","_interopRequireDefault","_modal","BlockLockMenuItem","clientId","canLock","isLocked","useBlockLock","isModalOpen","toggleModal","useReducer","isActive","label","__","createElement","Fragment","MenuItem","icon","unlock","lockOutline","onClick","default","onClose"],"sources":["@wordpress/block-editor/src/components/block-lock/menu-item.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useReducer } from '@wordpress/element';\nimport { MenuItem } from '@wordpress/components';\nimport { lockOutline, unlock } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport useBlockLock from './use-block-lock';\nimport BlockLockModal from './modal';\n\nexport default function BlockLockMenuItem( { clientId } ) {\n\tconst { canLock, isLocked } = useBlockLock( clientId );\n\n\tconst [ isModalOpen, toggleModal ] = useReducer(\n\t\t( isActive ) => ! isActive,\n\t\tfalse\n\t);\n\n\tif ( ! canLock ) {\n\t\treturn null;\n\t}\n\n\tconst label = isLocked ? __( 'Unlock' ) : __( 'Lock' );\n\n\treturn (\n\t\t<>\n\t\t\t<MenuItem\n\t\t\t\ticon={ isLocked ? unlock : lockOutline }\n\t\t\t\tonClick={ toggleModal }\n\t\t\t\taria-expanded={ isModalOpen }\n\t\t\t\taria-haspopup=\"dialog\"\n\t\t\t>\n\t\t\t\t{ label }\n\t\t\t</MenuItem>\n\t\t\t{ isModalOpen && (\n\t\t\t\t<BlockLockModal clientId={ clientId } onClose={ toggleModal } />\n\t\t\t) }\n\t\t</>\n\t);\n}\n"],"mappings":";;;;;;;AAIA,IAAAA,QAAA,GAAAC,OAAA;AADA,IAAAC,KAAA,GAAAD,OAAA;AAEA,IAAAE,WAAA,GAAAF,OAAA;AACA,IAAAG,MAAA,GAAAH,OAAA;AAKA,IAAAI,aAAA,GAAAC,sBAAA,CAAAL,OAAA;AACA,IAAAM,MAAA,GAAAD,sBAAA,CAAAL,OAAA;AAZA;AACA;AACA;;AAMA;AACA;AACA;;AAIe,SAASO,iBAAiBA,CAAE;EAAEC;AAAS,CAAC,EAAG;EACzD,MAAM;IAAEC,OAAO;IAAEC;EAAS,CAAC,GAAG,IAAAC,qBAAY,EAAEH,QAAS,CAAC;EAEtD,MAAM,CAAEI,WAAW,EAAEC,WAAW,CAAE,GAAG,IAAAC,mBAAU,EAC5CC,QAAQ,IAAM,CAAEA,QAAQ,EAC1B,KACD,CAAC;EAED,IAAK,CAAEN,OAAO,EAAG;IAChB,OAAO,IAAI;EACZ;EAEA,MAAMO,KAAK,GAAGN,QAAQ,GAAG,IAAAO,QAAE,EAAE,QAAS,CAAC,GAAG,IAAAA,QAAE,EAAE,MAAO,CAAC;EAEtD,OACC,IAAAlB,QAAA,CAAAmB,aAAA,EAAAnB,QAAA,CAAAoB,QAAA,QACC,IAAApB,QAAA,CAAAmB,aAAA,EAAChB,WAAA,CAAAkB,QAAQ;IACRC,IAAI,EAAGX,QAAQ,GAAGY,aAAM,GAAGC,kBAAa;IACxCC,OAAO,EAAGX,WAAa;IACvB,iBAAgBD,WAAa;IAC7B,iBAAc;EAAQ,GAEpBI,KACO,CAAC,EACTJ,WAAW,IACZ,IAAAb,QAAA,CAAAmB,aAAA,EAACZ,MAAA,CAAAmB,OAAc;IAACjB,QAAQ,EAAGA,QAAU;IAACkB,OAAO,EAAGb;EAAa,CAAE,CAE/D,CAAC;AAEL"}
|
|
@@ -56,10 +56,12 @@ function BlockLockToolbar({
|
|
|
56
56
|
return (0, _element.createElement)(_element.Fragment, null, (0, _element.createElement)(_components.ToolbarGroup, {
|
|
57
57
|
className: "block-editor-block-lock-toolbar"
|
|
58
58
|
}, (0, _element.createElement)(_components.ToolbarButton, {
|
|
59
|
+
ref: lockButtonRef,
|
|
59
60
|
icon: _icons.lock,
|
|
60
61
|
label: (0, _i18n.__)('Unlock'),
|
|
61
62
|
onClick: toggleModal,
|
|
62
|
-
|
|
63
|
+
"aria-expanded": isModalOpen,
|
|
64
|
+
"aria-haspopup": "dialog"
|
|
63
65
|
})), isModalOpen && (0, _element.createElement)(_modal.default, {
|
|
64
66
|
clientId: clientId,
|
|
65
67
|
onClose: toggleModal
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_element","require","_i18n","_components","_dom","_icons","_modal","_interopRequireDefault","_useBlockLock","BlockLockToolbar","clientId","wrapperRef","canEdit","canMove","canRemove","canLock","useBlockLock","isModalOpen","toggleModal","useReducer","isActive","lockButtonRef","useRef","isFirstRender","shouldHideBlockLockUI","useEffect","current","focus","focusable","find","sequential","element","tagName","createElement","Fragment","ToolbarGroup","className","ToolbarButton","icon","lock","label","__","onClick","
|
|
1
|
+
{"version":3,"names":["_element","require","_i18n","_components","_dom","_icons","_modal","_interopRequireDefault","_useBlockLock","BlockLockToolbar","clientId","wrapperRef","canEdit","canMove","canRemove","canLock","useBlockLock","isModalOpen","toggleModal","useReducer","isActive","lockButtonRef","useRef","isFirstRender","shouldHideBlockLockUI","useEffect","current","focus","focusable","find","sequential","element","tagName","createElement","Fragment","ToolbarGroup","className","ToolbarButton","ref","icon","lock","label","__","onClick","default","onClose"],"sources":["@wordpress/block-editor/src/components/block-lock/toolbar.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { ToolbarButton, ToolbarGroup } from '@wordpress/components';\nimport { focus } from '@wordpress/dom';\nimport { useReducer, useRef, useEffect } from '@wordpress/element';\nimport { lock } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport BlockLockModal from './modal';\nimport useBlockLock from './use-block-lock';\n\nexport default function BlockLockToolbar( { clientId, wrapperRef } ) {\n\tconst { canEdit, canMove, canRemove, canLock } = useBlockLock( clientId );\n\n\tconst [ isModalOpen, toggleModal ] = useReducer(\n\t\t( isActive ) => ! isActive,\n\t\tfalse\n\t);\n\n\tconst lockButtonRef = useRef( null );\n\tconst isFirstRender = useRef( true );\n\n\tconst shouldHideBlockLockUI =\n\t\t! canLock || ( canEdit && canMove && canRemove );\n\n\t// Restore focus manually on the first focusable element in the toolbar\n\t// when the block lock modal is closed and the block is not locked anymore.\n\t// See https://github.com/WordPress/gutenberg/issues/51447\n\tuseEffect( () => {\n\t\tif ( isFirstRender.current ) {\n\t\t\tisFirstRender.current = false;\n\t\t\treturn;\n\t\t}\n\n\t\tif ( ! isModalOpen && shouldHideBlockLockUI ) {\n\t\t\tfocus.focusable\n\t\t\t\t.find( wrapperRef.current, {\n\t\t\t\t\tsequential: false,\n\t\t\t\t} )\n\t\t\t\t.find(\n\t\t\t\t\t( element ) =>\n\t\t\t\t\t\telement.tagName === 'BUTTON' &&\n\t\t\t\t\t\telement !== lockButtonRef.current\n\t\t\t\t)\n\t\t\t\t?.focus();\n\t\t}\n\t\t// wrapperRef is a reference object and should be stable\n\t}, [ isModalOpen, shouldHideBlockLockUI, wrapperRef ] );\n\n\tif ( shouldHideBlockLockUI ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t<ToolbarGroup className=\"block-editor-block-lock-toolbar\">\n\t\t\t\t<ToolbarButton\n\t\t\t\t\tref={ lockButtonRef }\n\t\t\t\t\ticon={ lock }\n\t\t\t\t\tlabel={ __( 'Unlock' ) }\n\t\t\t\t\tonClick={ toggleModal }\n\t\t\t\t\taria-expanded={ isModalOpen }\n\t\t\t\t\taria-haspopup=\"dialog\"\n\t\t\t\t/>\n\t\t\t</ToolbarGroup>\n\t\t\t{ isModalOpen && (\n\t\t\t\t<BlockLockModal clientId={ clientId } onClose={ toggleModal } />\n\t\t\t) }\n\t\t</>\n\t);\n}\n"],"mappings":";;;;;;;AAMA,IAAAA,QAAA,GAAAC,OAAA;AAHA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AACA,IAAAG,IAAA,GAAAH,OAAA;AAEA,IAAAI,MAAA,GAAAJ,OAAA;AAKA,IAAAK,MAAA,GAAAC,sBAAA,CAAAN,OAAA;AACA,IAAAO,aAAA,GAAAD,sBAAA,CAAAN,OAAA;AAbA;AACA;AACA;;AAOA;AACA;AACA;;AAIe,SAASQ,gBAAgBA,CAAE;EAAEC,QAAQ;EAAEC;AAAW,CAAC,EAAG;EACpE,MAAM;IAAEC,O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M;IACbC,KAAK,EAAG,IAAAC,QAAE,EAAE,QAAS,CAAG;IACxBC,OAAO,EAAGzB,WAAa;IACvB,iBAAgBD,WAAa;IAC7B,iBAAc;EAAQ,CACtB,CACY,CAAC,EACbA,WAAW,IACZ,IAAAjB,QAAA,CAAAiC,aAAA,EAAC3B,MAAA,CAAAsC,OAAc;IAAClC,QAAQ,EAAGA,QAAU;IAACmC,OAAO,EAAG3B;EAAa,CAAE,CAE/D,CAAC;AAEL"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_element","require","_classnames","_interopRequireDefault","_i18n","_compose","_components","_data","_blockSelectionClearer","_writingFlow","_useCompatibilityStyles","_store","bubbleEvents","doc","defaultView","frameElement","bubbleEvent","event","prototype","Object","getPrototypeOf","constructorName","constructor","name","Constructor","window","init","key","MouseEvent","rect","getBoundingClientRect","clientX","left","clientY","top","newEvent","type","cancelled","dispatchEvent","preventDefault","eventTypes","addEventListener","Iframe","contentRef","children","tabIndex","scale","frameSize","expand","readonly","forwardedRef","ref","props","resolvedAssets","isPreviewMode","useSelect","select","settings","blockEditorStore","getSettings","__unstableResolvedAssets","__unstableIsPreviewMode","styles","scripts","iframeDocument","setIframeDocument","useState","bodyClasses","setBodyClasses","compatStyles","useCompatibilityStyles","clearerRef","useBlockSelectionClearer","before","writingFlowRef","after","useWritingFlow","contentResizeListener","height","contentHeight","useResizeObserver","setRef","useRefEffect","node","_load","contentDocument","iFrameDocument","preventFileDropDefault","onLoad","ownerDocument","documentElement","Array","from","body","classList","filter","startsWith","dir","compatStyle","getElementById","id","head","appendChild","cloneNode","console","warn","removeEventListener","disabledRef","useDisabled","isDisabled","bodyRef","useMergeRefs","html","src","cleanup","useMemo","_src","URL","createObjectURL","Blob","revokeObjectURL","useEffect","marginFromScaling","createElement","Fragment","style","marginTop","marginBottom","transform","transition","title","__","createPortal","className","classnames","__experimentalStyleProvider","document","IframeIfReady","isInitialised","__internalIsInitialized","_default","forwardRef","exports","default"],"sources":["@wordpress/block-editor/src/components/iframe/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tuseState,\n\tcreatePortal,\n\tforwardRef,\n\tuseMemo,\n\tuseEffect,\n} from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport {\n\tuseResizeObserver,\n\tuseMergeRefs,\n\tuseRefEffect,\n\tuseDisabled,\n} from '@wordpress/compose';\nimport { __experimentalStyleProvider as StyleProvider } from '@wordpress/components';\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { useBlockSelectionClearer } from '../block-selection-clearer';\nimport { useWritingFlow } from '../writing-flow';\nimport { useCompatibilityStyles } from './use-compatibility-styles';\nimport { store as blockEditorStore } from '../../store';\n\n/**\n * Bubbles some event types (keydown, keypress, and dragover) to parent document\n * document to ensure that the keyboard shortcuts and drag and drop work.\n *\n * Ideally, we should remove event bubbling in the future. Keyboard shortcuts\n * should be context dependent, e.g. actions on blocks like Cmd+A should not\n * work globally outside the block editor.\n *\n * @param {Document} doc Document to attach listeners to.\n */\nfunction bubbleEvents( doc ) {\n\tconst { defaultView } = doc;\n\tconst { frameElement } = defaultView;\n\n\tfunction bubbleEvent( event ) {\n\t\tconst prototype = Object.getPrototypeOf( event );\n\t\tconst constructorName = prototype.constructor.name;\n\t\tconst Constructor = window[ constructorName ];\n\n\t\tconst init = {};\n\n\t\tfor ( const key in event ) {\n\t\t\tinit[ key ] = event[ key ];\n\t\t}\n\n\t\tif ( event instanceof defaultView.MouseEvent ) {\n\t\t\tconst rect = frameElement.getBoundingClientRect();\n\t\t\tinit.clientX += rect.left;\n\t\t\tinit.clientY += rect.top;\n\t\t}\n\n\t\tconst newEvent = new Constructor( event.type, init );\n\t\tconst cancelled = ! frameElement.dispatchEvent( newEvent );\n\n\t\tif ( cancelled ) {\n\t\t\tevent.preventDefault();\n\t\t}\n\t}\n\n\tconst eventTypes = [ 'dragover', 'mousemove' ];\n\n\tfor ( const name of eventTypes ) {\n\t\tdoc.addEventListener( name, bubbleEvent );\n\t}\n}\n\nfunction Iframe( {\n\tcontentRef,\n\tchildren,\n\ttabIndex = 0,\n\tscale = 1,\n\tframeSize = 0,\n\texpand = false,\n\treadonly,\n\tforwardedRef: ref,\n\t...props\n} ) {\n\tconst { resolvedAssets, isPreviewMode } = useSelect( ( select ) => {\n\t\tconst settings = select( blockEditorStore ).getSettings();\n\t\treturn {\n\t\t\tresolvedAssets: settings.__unstableResolvedAssets,\n\t\t\tisPreviewMode: settings.__unstableIsPreviewMode,\n\t\t};\n\t}, [] );\n\tconst { styles = '', scripts = '' } = resolvedAssets;\n\tconst [ iframeDocument, setIframeDocument ] = useState();\n\tconst [ bodyClasses, setBodyClasses ] = useState( [] );\n\tconst compatStyles = useCompatibilityStyles();\n\tconst clearerRef = useBlockSelectionClearer();\n\tconst [ before, writingFlowRef, after ] = useWritingFlow();\n\tconst [ contentResizeListener, { height: contentHeight } ] =\n\t\tuseResizeObserver();\n\tconst setRef = useRefEffect( ( node ) => {\n\t\tnode._load = () => {\n\t\t\tsetIframeDocument( node.contentDocument );\n\t\t};\n\t\tlet iFrameDocument;\n\t\t// Prevent the default browser action for files dropped outside of dropzones.\n\t\tfunction preventFileDropDefault( event ) {\n\t\t\tevent.preventDefault();\n\t\t}\n\t\tfunction onLoad() {\n\t\t\tconst { contentDocument, ownerDocument } = node;\n\t\t\tconst { documentElement } = contentDocument;\n\t\t\tiFrameDocument = contentDocument;\n\n\t\t\tbubbleEvents( contentDocument );\n\t\t\tclearerRef( documentElement );\n\n\t\t\t// Ideally ALL classes that are added through get_body_class should\n\t\t\t// be added in the editor too, which we'll somehow have to get from\n\t\t\t// the server in the future (which will run the PHP filters).\n\t\t\tsetBodyClasses(\n\t\t\t\tArray.from( ownerDocument.body.classList ).filter(\n\t\t\t\t\t( name ) =>\n\t\t\t\t\t\tname.startsWith( 'admin-color-' ) ||\n\t\t\t\t\t\tname.startsWith( 'post-type-' ) ||\n\t\t\t\t\t\tname === 'wp-embed-responsive'\n\t\t\t\t)\n\t\t\t);\n\n\t\t\tcontentDocument.dir = ownerDocument.dir;\n\n\t\t\tfor ( const compatStyle of compatStyles ) {\n\t\t\t\tif ( contentDocument.getElementById( compatStyle.id ) ) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\tcontentDocument.head.appendChild(\n\t\t\t\t\tcompatStyle.cloneNode( true )\n\t\t\t\t);\n\n\t\t\t\tif ( ! isPreviewMode ) {\n\t\t\t\t\t// eslint-disable-next-line no-console\n\t\t\t\t\tconsole.warn(\n\t\t\t\t\t\t`${ compatStyle.id } was added to the iframe incorrectly. Please use block.json or enqueue_block_assets to add styles to the iframe.`,\n\t\t\t\t\t\tcompatStyle\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tiFrameDocument.addEventListener(\n\t\t\t\t'dragover',\n\t\t\t\tpreventFileDropDefault,\n\t\t\t\tfalse\n\t\t\t);\n\t\t\tiFrameDocument.addEventListener(\n\t\t\t\t'drop',\n\t\t\t\tpreventFileDropDefault,\n\t\t\t\tfalse\n\t\t\t);\n\t\t}\n\n\t\tnode.addEventListener( 'load', onLoad );\n\n\t\treturn () => {\n\t\t\tdelete node._load;\n\t\t\tnode.removeEventListener( 'load', onLoad );\n\t\t\tiFrameDocument?.removeEventListener(\n\t\t\t\t'dragover',\n\t\t\t\tpreventFileDropDefault\n\t\t\t);\n\t\t\tiFrameDocument?.removeEventListener(\n\t\t\t\t'drop',\n\t\t\t\tpreventFileDropDefault\n\t\t\t);\n\t\t};\n\t}, [] );\n\n\tconst disabledRef = useDisabled( { isDisabled: ! readonly } );\n\tconst bodyRef = useMergeRefs( [\n\t\tcontentRef,\n\t\tclearerRef,\n\t\twritingFlowRef,\n\t\tdisabledRef,\n\t] );\n\n\t// Correct doctype is required to enable rendering in standards\n\t// mode. Also preload the styles to avoid a flash of unstyled\n\t// content.\n\tconst html = `<!doctype html>\n<html>\n\t<head>\n\t\t<script>window.frameElement._load()</script>\n\t\t<style>html{height:auto!important;min-height:100%;}body{margin:0}</style>\n\t\t${ styles }\n\t\t${ scripts }\n\t</head>\n\t<body>\n\t\t<script>document.currentScript.parentElement.remove()</script>\n\t</body>\n</html>`;\n\n\tconst [ src, cleanup ] = useMemo( () => {\n\t\tconst _src = URL.createObjectURL(\n\t\t\tnew window.Blob( [ html ], { type: 'text/html' } )\n\t\t);\n\t\treturn [ _src, () => URL.revokeObjectURL( _src ) ];\n\t}, [ html ] );\n\n\tuseEffect( () => cleanup, [ cleanup ] );\n\n\t// We need to counter the margin created by scaling the iframe. If the scale\n\t// is e.g. 0.45, then the top + bottom margin is 0.55 (1 - scale). Just the\n\t// top or bottom margin is 0.55 / 2 ((1 - scale) / 2).\n\tconst marginFromScaling = ( contentHeight * ( 1 - scale ) ) / 2;\n\n\treturn (\n\t\t<>\n\t\t\t{ tabIndex >= 0 && before }\n\t\t\t<iframe\n\t\t\t\t{ ...props }\n\t\t\t\tstyle={ {\n\t\t\t\t\t...props.style,\n\t\t\t\t\theight: expand ? contentHeight : props.style?.height,\n\t\t\t\t\tmarginTop:\n\t\t\t\t\t\tscale !== 1\n\t\t\t\t\t\t\t? -marginFromScaling + frameSize\n\t\t\t\t\t\t\t: props.style?.marginTop,\n\t\t\t\t\tmarginBottom:\n\t\t\t\t\t\tscale !== 1\n\t\t\t\t\t\t\t? -marginFromScaling + frameSize\n\t\t\t\t\t\t\t: props.style?.marginBottom,\n\t\t\t\t\ttransform:\n\t\t\t\t\t\tscale !== 1\n\t\t\t\t\t\t\t? `scale( ${ scale } )`\n\t\t\t\t\t\t\t: props.style?.transform,\n\t\t\t\t\ttransition: 'all .3s',\n\t\t\t\t} }\n\t\t\t\tref={ useMergeRefs( [ ref, setRef ] ) }\n\t\t\t\ttabIndex={ tabIndex }\n\t\t\t\t// Correct doctype is required to enable rendering in standards\n\t\t\t\t// mode. Also preload the styles to avoid a flash of unstyled\n\t\t\t\t// content.\n\t\t\t\tsrc={ src }\n\t\t\t\ttitle={ __( 'Editor canvas' ) }\n\t\t\t>\n\t\t\t\t{ iframeDocument &&\n\t\t\t\t\tcreatePortal(\n\t\t\t\t\t\t<body\n\t\t\t\t\t\t\tref={ bodyRef }\n\t\t\t\t\t\t\tclassName={ classnames(\n\t\t\t\t\t\t\t\t'block-editor-iframe__body',\n\t\t\t\t\t\t\t\t'editor-styles-wrapper',\n\t\t\t\t\t\t\t\t...bodyClasses\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ contentResizeListener }\n\t\t\t\t\t\t\t<StyleProvider document={ iframeDocument }>\n\t\t\t\t\t\t\t\t{ children }\n\t\t\t\t\t\t\t</StyleProvider>\n\t\t\t\t\t\t</body>,\n\t\t\t\t\t\tiframeDocument.documentElement\n\t\t\t\t\t) }\n\t\t\t</iframe>\n\t\t\t{ tabIndex >= 0 && after }\n\t\t</>\n\t);\n}\n\nfunction IframeIfReady( props, ref ) {\n\tconst isInitialised = useSelect(\n\t\t( select ) =>\n\t\t\tselect( blockEditorStore ).getSettings().__internalIsInitialized,\n\t\t[]\n\t);\n\n\t// We shouldn't render the iframe until the editor settings are initialised.\n\t// The initial settings are needed to get the styles for the srcDoc, which\n\t// cannot be changed after the iframe is mounted. srcDoc is used to to set\n\t// the initial iframe HTML, which is required to avoid a flash of unstyled\n\t// content.\n\tif ( ! isInitialised ) {\n\t\treturn null;\n\t}\n\n\treturn <Iframe { ...props } forwardedRef={ ref } />;\n}\n\nexport default forwardRef( IframeIfReady );\n"],"mappings":";;;;;;;AAQA,IAAAA,QAAA,GAAAC,OAAA;AALA,IAAAC,WAAA,GAAAC,sBAAA,CAAAF,OAAA;AAYA,IAAAG,KAAA,GAAAH,OAAA;AACA,IAAAI,QAAA,GAAAJ,OAAA;AAMA,IAAAK,WAAA,GAAAL,OAAA;AACA,IAAAM,KAAA,GAAAN,OAAA;AAKA,IAAAO,sBAAA,GAAAP,OAAA;AACA,IAAAQ,Y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8B,KAClB,CAAC;AAEL;AAEA,SAAS8D,aAAaA,CAAErF,KAAK,EAAED,GAAG,EAAG;EACpC,MAAMuF,aAAa,GAAG,IAAAnF,eAAS,EAC5BC,MAAM,IACPA,MAAM,CAAEE,YAAiB,CAAC,CAACC,WAAW,CAAC,CAAC,CAACgF,uBAAuB,EACjE,EACD,CAAC;;EAED;EACA;EACA;EACA;EACA;EACA,IAAK,CAAED,aAAa,EAAG;IACtB,OAAO,IAAI;EACZ;EAEA,OAAO,IAAA1I,QAAA,CAAA2H,aAAA,EAACjF,MAAM;IAAA,GAAMU,KAAK;IAAGF,YAAY,EAAGC;EAAK,CAAE,CAAC;AACpD;AAAC,IAAAyF,QAAA,GAEc,IAAAC,mBAAU,EAAEJ,aAAc,CAAC;AAAAK,OAAA,CAAAC,OAAA,GAAAH,QAAA"}
|
|
1
|
+
{"version":3,"names":["_element","require","_classnames","_interopRequireDefault","_i18n","_compose","_components","_data","_blockSelectionClearer","_writingFlow","_useCompatibilityStyles","_store","bubbleEvents","doc","defaultView","frameElement","bubbleEvent","event","prototype","Object","getPrototypeOf","constructorName","constructor","name","Constructor","window","init","key","MouseEvent","rect","getBoundingClientRect","clientX","left","clientY","top","newEvent","type","cancelled","dispatchEvent","preventDefault","eventTypes","addEventListener","Iframe","contentRef","children","tabIndex","scale","frameSize","expand","readonly","forwardedRef","ref","props","resolvedAssets","isPreviewMode","useSelect","select","settings","blockEditorStore","getSettings","__unstableResolvedAssets","__unstableIsPreviewMode","styles","scripts","iframeDocument","setIframeDocument","useState","bodyClasses","setBodyClasses","compatStyles","useCompatibilityStyles","clearerRef","useBlockSelectionClearer","before","writingFlowRef","after","useWritingFlow","contentResizeListener","height","contentHeight","useResizeObserver","setRef","useRefEffect","node","_load","contentDocument","iFrameDocument","preventFileDropDefault","onLoad","ownerDocument","documentElement","Array","from","body","classList","filter","startsWith","dir","compatStyle","getElementById","id","head","appendChild","cloneNode","console","warn","removeEventListener","disabledRef","useDisabled","isDisabled","bodyRef","useMergeRefs","html","src","cleanup","useMemo","_src","URL","createObjectURL","Blob","revokeObjectURL","useEffect","marginFromScaling","createElement","Fragment","style","marginTop","marginBottom","transform","transition","title","__","createPortal","className","classnames","__experimentalStyleProvider","document","IframeIfReady","isInitialised","__internalIsInitialized","_default","forwardRef","exports","default"],"sources":["@wordpress/block-editor/src/components/iframe/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tuseState,\n\tcreatePortal,\n\tforwardRef,\n\tuseMemo,\n\tuseEffect,\n} from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport {\n\tuseResizeObserver,\n\tuseMergeRefs,\n\tuseRefEffect,\n\tuseDisabled,\n} from '@wordpress/compose';\nimport { __experimentalStyleProvider as StyleProvider } from '@wordpress/components';\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { useBlockSelectionClearer } from '../block-selection-clearer';\nimport { useWritingFlow } from '../writing-flow';\nimport { useCompatibilityStyles } from './use-compatibility-styles';\nimport { store as blockEditorStore } from '../../store';\n\n/**\n * Bubbles some event types (keydown, keypress, and dragover) to parent document\n * document to ensure that the keyboard shortcuts and drag and drop work.\n *\n * Ideally, we should remove event bubbling in the future. Keyboard shortcuts\n * should be context dependent, e.g. actions on blocks like Cmd+A should not\n * work globally outside the block editor.\n *\n * @param {Document} doc Document to attach listeners to.\n */\nfunction bubbleEvents( doc ) {\n\tconst { defaultView } = doc;\n\tconst { frameElement } = defaultView;\n\n\tfunction bubbleEvent( event ) {\n\t\tconst prototype = Object.getPrototypeOf( event );\n\t\tconst constructorName = prototype.constructor.name;\n\t\tconst Constructor = window[ constructorName ];\n\n\t\tconst init = {};\n\n\t\tfor ( const key in event ) {\n\t\t\tinit[ key ] = event[ key ];\n\t\t}\n\n\t\tif ( event instanceof defaultView.MouseEvent ) {\n\t\t\tconst rect = frameElement.getBoundingClientRect();\n\t\t\tinit.clientX += rect.left;\n\t\t\tinit.clientY += rect.top;\n\t\t}\n\n\t\tconst newEvent = new Constructor( event.type, init );\n\t\tconst cancelled = ! frameElement.dispatchEvent( newEvent );\n\n\t\tif ( cancelled ) {\n\t\t\tevent.preventDefault();\n\t\t}\n\t}\n\n\tconst eventTypes = [ 'dragover', 'mousemove' ];\n\n\tfor ( const name of eventTypes ) {\n\t\tdoc.addEventListener( name, bubbleEvent );\n\t}\n}\n\nfunction Iframe( {\n\tcontentRef,\n\tchildren,\n\ttabIndex = 0,\n\tscale = 1,\n\tframeSize = 0,\n\texpand = false,\n\treadonly,\n\tforwardedRef: ref,\n\t...props\n} ) {\n\tconst { resolvedAssets, isPreviewMode } = useSelect( ( select ) => {\n\t\tconst settings = select( blockEditorStore ).getSettings();\n\t\treturn {\n\t\t\tresolvedAssets: settings.__unstableResolvedAssets,\n\t\t\tisPreviewMode: settings.__unstableIsPreviewMode,\n\t\t};\n\t}, [] );\n\tconst { styles = '', scripts = '' } = resolvedAssets;\n\tconst [ iframeDocument, setIframeDocument ] = useState();\n\tconst [ bodyClasses, setBodyClasses ] = useState( [] );\n\tconst compatStyles = useCompatibilityStyles();\n\tconst clearerRef = useBlockSelectionClearer();\n\tconst [ before, writingFlowRef, after ] = useWritingFlow();\n\tconst [ contentResizeListener, { height: contentHeight } ] =\n\t\tuseResizeObserver();\n\tconst setRef = useRefEffect( ( node ) => {\n\t\tnode._load = () => {\n\t\t\tsetIframeDocument( node.contentDocument );\n\t\t};\n\t\tlet iFrameDocument;\n\t\t// Prevent the default browser action for files dropped outside of dropzones.\n\t\tfunction preventFileDropDefault( event ) {\n\t\t\tevent.preventDefault();\n\t\t}\n\t\tfunction onLoad() {\n\t\t\tconst { contentDocument, ownerDocument } = node;\n\t\t\tconst { documentElement } = contentDocument;\n\t\t\tiFrameDocument = contentDocument;\n\n\t\t\tbubbleEvents( contentDocument );\n\t\t\tclearerRef( documentElement );\n\n\t\t\t// Ideally ALL classes that are added through get_body_class should\n\t\t\t// be added in the editor too, which we'll somehow have to get from\n\t\t\t// the server in the future (which will run the PHP filters).\n\t\t\tsetBodyClasses(\n\t\t\t\tArray.from( ownerDocument.body.classList ).filter(\n\t\t\t\t\t( name ) =>\n\t\t\t\t\t\tname.startsWith( 'admin-color-' ) ||\n\t\t\t\t\t\tname.startsWith( 'post-type-' ) ||\n\t\t\t\t\t\tname === 'wp-embed-responsive'\n\t\t\t\t)\n\t\t\t);\n\n\t\t\tcontentDocument.dir = ownerDocument.dir;\n\n\t\t\tfor ( const compatStyle of compatStyles ) {\n\t\t\t\tif ( contentDocument.getElementById( compatStyle.id ) ) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\tcontentDocument.head.appendChild(\n\t\t\t\t\tcompatStyle.cloneNode( true )\n\t\t\t\t);\n\n\t\t\t\tif ( ! isPreviewMode ) {\n\t\t\t\t\t// eslint-disable-next-line no-console\n\t\t\t\t\tconsole.warn(\n\t\t\t\t\t\t`${ compatStyle.id } was added to the iframe incorrectly. Please use block.json or enqueue_block_assets to add styles to the iframe.`,\n\t\t\t\t\t\tcompatStyle\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tiFrameDocument.addEventListener(\n\t\t\t\t'dragover',\n\t\t\t\tpreventFileDropDefault,\n\t\t\t\tfalse\n\t\t\t);\n\t\t\tiFrameDocument.addEventListener(\n\t\t\t\t'drop',\n\t\t\t\tpreventFileDropDefault,\n\t\t\t\tfalse\n\t\t\t);\n\t\t}\n\n\t\tnode.addEventListener( 'load', onLoad );\n\n\t\treturn () => {\n\t\t\tdelete node._load;\n\t\t\tnode.removeEventListener( 'load', onLoad );\n\t\t\tiFrameDocument?.removeEventListener(\n\t\t\t\t'dragover',\n\t\t\t\tpreventFileDropDefault\n\t\t\t);\n\t\t\tiFrameDocument?.removeEventListener(\n\t\t\t\t'drop',\n\t\t\t\tpreventFileDropDefault\n\t\t\t);\n\t\t};\n\t}, [] );\n\n\tconst disabledRef = useDisabled( { isDisabled: ! readonly } );\n\tconst bodyRef = useMergeRefs( [\n\t\tcontentRef,\n\t\tclearerRef,\n\t\twritingFlowRef,\n\t\tdisabledRef,\n\t] );\n\n\t// Correct doctype is required to enable rendering in standards\n\t// mode. Also preload the styles to avoid a flash of unstyled\n\t// content.\n\tconst html = `<!doctype html>\n<html>\n\t<head>\n\t\t<meta charset=\"utf-8\">\n\t\t<script>window.frameElement._load()</script>\n\t\t<style>html{height:auto!important;min-height:100%;}body{margin:0}</style>\n\t\t${ styles }\n\t\t${ scripts }\n\t</head>\n\t<body>\n\t\t<script>document.currentScript.parentElement.remove()</script>\n\t</body>\n</html>`;\n\n\tconst [ src, cleanup ] = useMemo( () => {\n\t\tconst _src = URL.createObjectURL(\n\t\t\tnew window.Blob( [ html ], { type: 'text/html' } )\n\t\t);\n\t\treturn [ _src, () => URL.revokeObjectURL( _src ) ];\n\t}, [ html ] );\n\n\tuseEffect( () => cleanup, [ cleanup ] );\n\n\t// We need to counter the margin created by scaling the iframe. If the scale\n\t// is e.g. 0.45, then the top + bottom margin is 0.55 (1 - scale). Just the\n\t// top or bottom margin is 0.55 / 2 ((1 - scale) / 2).\n\tconst marginFromScaling = ( contentHeight * ( 1 - scale ) ) / 2;\n\n\treturn (\n\t\t<>\n\t\t\t{ tabIndex >= 0 && before }\n\t\t\t<iframe\n\t\t\t\t{ ...props }\n\t\t\t\tstyle={ {\n\t\t\t\t\t...props.style,\n\t\t\t\t\theight: expand ? contentHeight : props.style?.height,\n\t\t\t\t\tmarginTop:\n\t\t\t\t\t\tscale !== 1\n\t\t\t\t\t\t\t? -marginFromScaling + frameSize\n\t\t\t\t\t\t\t: props.style?.marginTop,\n\t\t\t\t\tmarginBottom:\n\t\t\t\t\t\tscale !== 1\n\t\t\t\t\t\t\t? -marginFromScaling + frameSize\n\t\t\t\t\t\t\t: props.style?.marginBottom,\n\t\t\t\t\ttransform:\n\t\t\t\t\t\tscale !== 1\n\t\t\t\t\t\t\t? `scale( ${ scale } )`\n\t\t\t\t\t\t\t: props.style?.transform,\n\t\t\t\t\ttransition: 'all .3s',\n\t\t\t\t} }\n\t\t\t\tref={ useMergeRefs( [ ref, setRef ] ) }\n\t\t\t\ttabIndex={ tabIndex }\n\t\t\t\t// Correct doctype is required to enable rendering in standards\n\t\t\t\t// mode. Also preload the styles to avoid a flash of unstyled\n\t\t\t\t// content.\n\t\t\t\tsrc={ src }\n\t\t\t\ttitle={ __( 'Editor canvas' ) }\n\t\t\t>\n\t\t\t\t{ iframeDocument &&\n\t\t\t\t\tcreatePortal(\n\t\t\t\t\t\t<body\n\t\t\t\t\t\t\tref={ bodyRef }\n\t\t\t\t\t\t\tclassName={ classnames(\n\t\t\t\t\t\t\t\t'block-editor-iframe__body',\n\t\t\t\t\t\t\t\t'editor-styles-wrapper',\n\t\t\t\t\t\t\t\t...bodyClasses\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ contentResizeListener }\n\t\t\t\t\t\t\t<StyleProvider document={ iframeDocument }>\n\t\t\t\t\t\t\t\t{ children }\n\t\t\t\t\t\t\t</StyleProvider>\n\t\t\t\t\t\t</body>,\n\t\t\t\t\t\tiframeDocument.documentElement\n\t\t\t\t\t) }\n\t\t\t</iframe>\n\t\t\t{ tabIndex >= 0 && after }\n\t\t</>\n\t);\n}\n\nfunction IframeIfReady( props, ref ) {\n\tconst isInitialised = useSelect(\n\t\t( select ) =>\n\t\t\tselect( blockEditorStore ).getSettings().__internalIsInitialized,\n\t\t[]\n\t);\n\n\t// We shouldn't render the iframe until the editor settings are initialised.\n\t// The initial settings are needed to get the styles for the srcDoc, which\n\t// cannot be changed after the iframe is mounted. srcDoc is used to to set\n\t// the initial iframe HTML, which is required to avoid a flash of unstyled\n\t// content.\n\tif ( ! isInitialised ) {\n\t\treturn null;\n\t}\n\n\treturn <Iframe { ...props } forwardedRef={ ref } />;\n}\n\nexport default forwardRef( IframeIfReady );\n"],"mappings":";;;;;;;AAQA,IAAAA,QAAA,GAAAC,OAAA;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ACvB,GAAGnE,WACJ;EAAG,GAEDU,qBAAqB,EACvB,IAAA7E,QAAA,CAAA2H,aAAA,EAACrH,WAAA,CAAAiI,2BAAa;IAACC,QAAQ,EAAGxE;EAAgB,GACvCpB,QACY,CACV,CAAC,EACPoB,cAAc,CAAC0B,eAChB,CACM,CAAC,EACP7C,QAAQ,IAAI,CAAC,IAAI8B,KAClB,CAAC;AAEL;AAEA,SAAS8D,aAAaA,CAAErF,KAAK,EAAED,GAAG,EAAG;EACpC,MAAMuF,aAAa,GAAG,IAAAnF,eAAS,EAC5BC,MAAM,IACPA,MAAM,CAAEE,YAAiB,CAAC,CAACC,WAAW,CAAC,CAAC,CAACgF,uBAAuB,EACjE,EACD,CAAC;;EAED;EACA;EACA;EACA;EACA;EACA,IAAK,CAAED,aAAa,EAAG;IACtB,OAAO,IAAI;EACZ;EAEA,OAAO,IAAA1I,QAAA,CAAA2H,aAAA,EAACjF,MAAM;IAAA,GAAMU,KAAK;IAAGF,YAAY,EAAGC;EAAK,CAAE,CAAC;AACpD;AAAC,IAAAyF,QAAA,GAEc,IAAAC,mBAAU,EAAEJ,aAAc,CAAC;AAAAK,OAAA,CAAAC,OAAA,GAAAH,QAAA"}
|
|
@@ -36,7 +36,7 @@ function InspectorControlsFill({
|
|
|
36
36
|
const isDisplayed = (0, _useDisplayBlockControls.default)();
|
|
37
37
|
const Fill = _groups.default[group]?.Fill;
|
|
38
38
|
if (!Fill) {
|
|
39
|
-
typeof
|
|
39
|
+
typeof SCRIPT_DEBUG !== "undefined" && SCRIPT_DEBUG === true ? (0, _warning.default)(`Unknown InspectorControls group "${group}" provided.`) : void 0;
|
|
40
40
|
return null;
|
|
41
41
|
}
|
|
42
42
|
if (!isDisplayed) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_element","require","_components","_warning","_interopRequireDefault","_deprecated","_useDisplayBlockControls","_groups","InspectorControlsFill","children","group","__experimentalGroup","resetAllFilter","deprecated","since","version","alternative","isDisplayed","useDisplayBlockControls","Fill","groups","
|
|
1
|
+
{"version":3,"names":["_element","require","_components","_warning","_interopRequireDefault","_deprecated","_useDisplayBlockControls","_groups","InspectorControlsFill","children","group","__experimentalGroup","resetAllFilter","deprecated","since","version","alternative","isDisplayed","useDisplayBlockControls","Fill","groups","SCRIPT_DEBUG","warning","createElement","__experimentalStyleProvider","document","fillProps","ToolsPanelInspectorControl","registerResetAllFilter","deregisterResetAllFilter","useEffect","value","Object","keys","length","__experimentalToolsPanelContext","Provider"],"sources":["@wordpress/block-editor/src/components/inspector-controls/fill.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalStyleProvider as StyleProvider,\n\t__experimentalToolsPanelContext as ToolsPanelContext,\n} from '@wordpress/components';\nimport warning from '@wordpress/warning';\nimport deprecated from '@wordpress/deprecated';\nimport { useEffect } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport useDisplayBlockControls from '../use-display-block-controls';\nimport groups from './groups';\n\nexport default function InspectorControlsFill( {\n\tchildren,\n\tgroup = 'default',\n\t__experimentalGroup,\n\tresetAllFilter,\n} ) {\n\tif ( __experimentalGroup ) {\n\t\tdeprecated(\n\t\t\t'`__experimentalGroup` property in `InspectorControlsFill`',\n\t\t\t{\n\t\t\t\tsince: '6.2',\n\t\t\t\tversion: '6.4',\n\t\t\t\talternative: '`group`',\n\t\t\t}\n\t\t);\n\t\tgroup = __experimentalGroup;\n\t}\n\n\tconst isDisplayed = useDisplayBlockControls();\n\tconst Fill = groups[ group ]?.Fill;\n\tif ( ! Fill ) {\n\t\twarning( `Unknown InspectorControls group \"${ group }\" provided.` );\n\t\treturn null;\n\t}\n\tif ( ! isDisplayed ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<StyleProvider document={ document }>\n\t\t\t<Fill>\n\t\t\t\t{ ( fillProps ) => {\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<ToolsPanelInspectorControl\n\t\t\t\t\t\t\tfillProps={ fillProps }\n\t\t\t\t\t\t\tchildren={ children }\n\t\t\t\t\t\t\tresetAllFilter={ resetAllFilter }\n\t\t\t\t\t\t/>\n\t\t\t\t\t);\n\t\t\t\t} }\n\t\t\t</Fill>\n\t\t</StyleProvider>\n\t);\n}\n\nfunction ToolsPanelInspectorControl( { children, resetAllFilter, fillProps } ) {\n\tconst { registerResetAllFilter, deregisterResetAllFilter } = fillProps;\n\tuseEffect( () => {\n\t\tif ( resetAllFilter && registerResetAllFilter ) {\n\t\t\tregisterResetAllFilter( resetAllFilter );\n\t\t}\n\t\treturn () => {\n\t\t\tif ( resetAllFilter && deregisterResetAllFilter ) {\n\t\t\t\tderegisterResetAllFilter( resetAllFilter );\n\t\t\t}\n\t\t};\n\t}, [ resetAllFilter, registerResetAllFilter, deregisterResetAllFilter ] );\n\n\t// Children passed to InspectorControlsFill will not have\n\t// access to any React Context whose Provider is part of\n\t// the InspectorControlsSlot tree. So we re-create the\n\t// Provider in this subtree.\n\tconst value =\n\t\tfillProps && Object.keys( fillProps ).length > 0 ? fillProps : null;\n\treturn (\n\t\t<ToolsPanelContext.Provider value={ value }>\n\t\t\t{ children }\n\t\t</ToolsPanelContext.Provider>\n\t);\n}\n"],"mappings":";;;;;;;AASA,IAAAA,QAAA,GAAAC,OAAA;AANA,IAAAC,WAAA,GAAAD,OAAA;AAIA,IAAAE,QAAA,GAAAC,sBAAA,CAAAH,OAAA;AACA,IAAAI,WAAA,GAAAD,sBAAA,CAAAH,OAAA;AAMA,IAAAK,wBAAA,GAAAF,sBAAA,CAAAH,OAAA;AACA,IAAAM,OAAA,GAAAH,sBAAA,CAAAH,OAAA;AAfA;AACA;AACA;;AASA;AACA;AACA;;AAIe,SAASO,qBAAqBA,CAAE;EAC9CC,QAAQ;EACRC,KAAK,GAAG,SAAS;EACjBC,mBAAmB;EACnBC;AACD,CAAC,EAAG;EACH,IAAKD,mBAAmB,EAAG;IAC1B,IAAAE,mBAAU,EACT,2DAA2D,EAC3D;MACCC,KAAK,EAAE,KAAK;MACZ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ACVL,SAAS,IAAIM,MAAM,CAACC,IAAI,CAAEP,SAAU,CAAC,CAACQ,MAAM,GAAG,CAAC,GAAGR,SAAS,GAAG,IAAI;EACpE,OACC,IAAA1B,QAAA,CAAAuB,aAAA,EAACrB,WAAA,CAAAiC,+BAAiB,CAACC,QAAQ;IAACL,KAAK,EAAGA;EAAO,GACxCtB,QACyB,CAAC;AAE/B"}
|
|
@@ -42,7 +42,7 @@ function InspectorControlsFill({
|
|
|
42
42
|
const isDisplayed = (0, _useDisplayBlockControls.default)();
|
|
43
43
|
const Fill = _groups.default[group]?.Fill;
|
|
44
44
|
if (!Fill) {
|
|
45
|
-
typeof
|
|
45
|
+
typeof SCRIPT_DEBUG !== "undefined" && SCRIPT_DEBUG === true ? (0, _warning.default)(`Unknown InspectorControls group "${group}" provided.`) : void 0;
|
|
46
46
|
return null;
|
|
47
47
|
}
|
|
48
48
|
if (!isDisplayed) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_element","require","_reactNative","_components","_warning","_interopRequireDefault","_deprecated","_groups","_useDisplayBlockControls","_blockSettings","InspectorControlsFill","children","group","__experimentalGroup","props","deprecated","since","version","alternative","isDisplayed","useDisplayBlockControls","Fill","groups","
|
|
1
|
+
{"version":3,"names":["_element","require","_reactNative","_components","_warning","_interopRequireDefault","_deprecated","_groups","_useDisplayBlockControls","_blockSettings","InspectorControlsFill","children","group","__experimentalGroup","props","deprecated","since","version","alternative","isDisplayed","useDisplayBlockControls","Fill","groups","SCRIPT_DEBUG","warning","createElement","Fragment","BottomSheetConsumer","View","Children","count","BlockSettingsButton"],"sources":["@wordpress/block-editor/src/components/inspector-controls/fill.native.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport { View } from 'react-native';\n\n/**\n * WordPress dependencies\n */\nimport { Children } from '@wordpress/element';\nimport { BottomSheetConsumer } from '@wordpress/components';\nimport warning from '@wordpress/warning';\nimport deprecated from '@wordpress/deprecated';\n\n/**\n * Internal dependencies\n */\nimport groups from './groups';\nimport useDisplayBlockControls from '../use-display-block-controls';\nimport { BlockSettingsButton } from '../block-settings';\n\nexport default function InspectorControlsFill( {\n\tchildren,\n\tgroup = 'default',\n\t__experimentalGroup,\n\t...props\n} ) {\n\tif ( __experimentalGroup ) {\n\t\tdeprecated(\n\t\t\t'`__experimentalGroup` property in `InspectorControlsFill`',\n\t\t\t{\n\t\t\t\tsince: '6.2',\n\t\t\t\tversion: '6.4',\n\t\t\t\talternative: '`group`',\n\t\t\t}\n\t\t);\n\t\tgroup = __experimentalGroup;\n\t}\n\tconst isDisplayed = useDisplayBlockControls();\n\n\tconst Fill = groups[ group ]?.Fill;\n\tif ( ! Fill ) {\n\t\twarning( `Unknown InspectorControls group \"${ group }\" provided.` );\n\t\treturn null;\n\t}\n\tif ( ! isDisplayed ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t<Fill { ...props }>\n\t\t\t\t{\n\t\t\t\t\t<BottomSheetConsumer>\n\t\t\t\t\t\t{ () => <View>{ children }</View> }\n\t\t\t\t\t</BottomSheetConsumer>\n\t\t\t\t}\n\t\t\t</Fill>\n\t\t\t{ Children.count( children ) > 0 && <BlockSettingsButton /> }\n\t\t</>\n\t);\n}\n"],"mappings":";;;;;;;AAQA,IAAAA,QAAA,GAAAC,OAAA;AALA,IAAAC,YAAA,GAAAD,OAAA;AAMA,IAAAE,WAAA,GAAAF,OAAA;AACA,IAAAG,QAAA,GAAAC,sBAAA,CAAAJ,OAAA;AACA,IAAAK,WAAA,GAAAD,sBAAA,CAAAJ,OAAA;AAKA,IAAAM,OAAA,GAAAF,sBAAA,CAAAJ,OAAA;AACA,IAAAO,wBAAA,GAAAH,sBAAA,CAAAJ,OAAA;AACA,IAAAQ,cAAA,GAAAR,OAAA;AAlBA;AACA;AACA;;AAGA;AACA;AACA;;AAMA;AACA;AACA;;AAKe,SAASS,qBAAqBA,CAAE;EAC9CC,QAAQ;EACRC,KAAK,GAAG,SAAS;EACjBC,mBAAmB;EACnB,GAAGC;AACJ,CAAC,EAAG;EACH,IAAKD,mBAAmB,EAAG;IAC1B,IAAAE,mBAAU,EACT,2DAA2D,EAC3D;MACCC,KAAK,EAAE,KAAK;MACZC,OAAO,EAAE,KAAK;MACdC,WAAW,EAAE;IACd,CACD,CAAC;IACDN,KAAK,GAAGC,mBAAmB;EAC5B;EACA,MAAMM,WAAW,GAAG,IAAAC,gCAAuB,EAAC,CAAC;EAE7C,MAAMC,IAAI,GAAGC,eAAM,CAAEV,KAAK,CAAE,EAAES,IAAI;EAClC,IAAK,CAAEA,IAAI,EAAG;IACb,OAAAE,YAAA,oBAAAA,YAAA,gBAAAC,gBAAO,EAAG,oCAAoCZ,KAAO,aAAa,CAAC;IACnE,OAAO,IAAI;EACZ;EACA,IAAK,CAAEO,WAAW,EAAG;IACpB,OAAO,IAAI;EACZ;EAEA,OACC,IAAAnB,QAAA,CAAAyB,aAAA,EAAAzB,QAAA,CAAA0B,QAAA,QACC,IAAA1B,QAAA,CAAAyB,aAAA,EAACJ,IAAI;IAAA,GAAMP;EAAK,GAEd,IAAAd,QAAA,CAAAyB,aAAA,EAACtB,WAAA,CAAAwB,mBAAmB,QACjB,MAAM,IAAA3B,QAAA,CAAAyB,aAAA,EAACvB,YAAA,CAAA0B,IAAI,QAAGjB,QAAgB,CACZ,CAEjB,CAAC,EACLkB,iBAAQ,CAACC,KAAK,CAAEnB,QAAS,CAAC,GAAG,CAAC,IAAI,IAAAX,QAAA,CAAAyB,aAAA,EAAChB,cAAA,CAAAsB,mBAAmB,MAAE,CACzD,CAAC;AAEL"}
|
|
@@ -37,7 +37,7 @@ function InspectorControlsSlot({
|
|
|
37
37
|
const Slot = _groups.default[group]?.Slot;
|
|
38
38
|
const fills = (0, _components.__experimentalUseSlotFills)(Slot?.__unstableName);
|
|
39
39
|
if (!Slot) {
|
|
40
|
-
typeof
|
|
40
|
+
typeof SCRIPT_DEBUG !== "undefined" && SCRIPT_DEBUG === true ? (0, _warning.default)(`Unknown InspectorControls group "${group}" provided.`) : void 0;
|
|
41
41
|
return null;
|
|
42
42
|
}
|
|
43
43
|
if (!fills?.length) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_components","require","_warning","_interopRequireDefault","_deprecated","_blockSupportToolsPanel","_blockSupportSlotContainer","_groups","InspectorControlsSlot","__experimentalGroup","group","label","props","deprecated","since","version","alternative","Slot","groups","fills","useSlotFills","__unstableName","
|
|
1
|
+
{"version":3,"names":["_components","require","_warning","_interopRequireDefault","_deprecated","_blockSupportToolsPanel","_blockSupportSlotContainer","_groups","InspectorControlsSlot","__experimentalGroup","group","label","props","deprecated","since","version","alternative","Slot","groups","fills","useSlotFills","__unstableName","SCRIPT_DEBUG","warning","length","_element","createElement","default","bubblesVirtually"],"sources":["@wordpress/block-editor/src/components/inspector-controls/slot.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __experimentalUseSlotFills as useSlotFills } from '@wordpress/components';\nimport warning from '@wordpress/warning';\nimport deprecated from '@wordpress/deprecated';\n\n/**\n * Internal dependencies\n */\nimport BlockSupportToolsPanel from './block-support-tools-panel';\nimport BlockSupportSlotContainer from './block-support-slot-container';\nimport groups from './groups';\n\nexport default function InspectorControlsSlot( {\n\t__experimentalGroup,\n\tgroup = 'default',\n\tlabel,\n\t...props\n} ) {\n\tif ( __experimentalGroup ) {\n\t\tdeprecated(\n\t\t\t'`__experimentalGroup` property in `InspectorControlsSlot`',\n\t\t\t{\n\t\t\t\tsince: '6.2',\n\t\t\t\tversion: '6.4',\n\t\t\t\talternative: '`group`',\n\t\t\t}\n\t\t);\n\t\tgroup = __experimentalGroup;\n\t}\n\tconst Slot = groups[ group ]?.Slot;\n\tconst fills = useSlotFills( Slot?.__unstableName );\n\tif ( ! Slot ) {\n\t\twarning( `Unknown InspectorControls group \"${ group }\" provided.` );\n\t\treturn null;\n\t}\n\n\tif ( ! fills?.length ) {\n\t\treturn null;\n\t}\n\n\tif ( label ) {\n\t\treturn (\n\t\t\t<BlockSupportToolsPanel group={ group } label={ label }>\n\t\t\t\t<BlockSupportSlotContainer { ...props } Slot={ Slot } />\n\t\t\t</BlockSupportToolsPanel>\n\t\t);\n\t}\n\n\treturn <Slot { ...props } bubblesVirtually />;\n}\n"],"mappings":";;;;;;;;AAGA,IAAAA,WAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,WAAA,GAAAD,sBAAA,CAAAF,OAAA;AAKA,IAAAI,uBAAA,GAAAF,sBAAA,CAAAF,OAAA;AACA,IAAAK,0BAAA,GAAAH,sBAAA,CAAAF,OAAA;AACA,IAAAM,OAAA,GAAAJ,sBAAA,CAAAF,OAAA;AAZA;AACA;AACA;;AAKA;AACA;AACA;;AAKe,SAASO,qBAAqBA,CAAE;EAC9CC,mBAAmB;EACnBC,KAAK,GAAG,SAAS;EACjBC,KAAK;EACL,GAAGC;AACJ,CAAC,EAAG;EACH,IAAKH,mBAAmB,EAAG;IAC1B,IAAAI,mBAAU,EACT,2DAA2D,EAC3D;MACCC,KAAK,EAAE,KAAK;MACZC,OAAO,EAAE,KAAK;MACdC,WAAW,EAAE;IACd,CACD,CAAC;IACDN,KAAK,GAAGD,mBAAmB;EAC5B;EACA,MAAMQ,IAAI,GAAGC,eAAM,CAAER,KAAK,CAAE,EAAEO,IAAI;EAClC,MAAME,KAAK,GAAG,IAAAC,sCAAY,EAAEH,IAAI,EAAEI,cAAe,CAAC;EAClD,IAAK,CAAEJ,IAAI,EAAG;IACb,OAAAK,YAAA,oBAAAA,YAAA,gBAAAC,gBAAO,EAAG,oCAAoCb,KAAO,aAAa,CAAC;IACnE,OAAO,IAAI;EACZ;EAEA,IAAK,CAAES,KAAK,EAAEK,MAAM,EAAG;IACtB,OAAO,IAAI;EACZ;EAEA,IAAKb,KAAK,EAAG;IACZ,OACC,IAAAc,QAAA,CAAAC,aAAA,EAACrB,uBAAA,CAAAsB,OAAsB;MAACjB,KAAK,EAAGA,KAAO;MAACC,KAAK,EAAGA;IAAO,GACtD,IAAAc,QAAA,CAAAC,aAAA,EAACpB,0BAAA,CAAAqB,OAAyB;MAAA,GAAMf,KAAK;MAAGK,IAAI,EAAGA;IAAM,CAAE,CAChC,CAAC;EAE3B;EAEA,OAAO,IAAAQ,QAAA,CAAAC,aAAA,EAACT,IAAI;IAAA,GAAML,KAAK;IAAGgB,gBAAgB;EAAA,CAAE,CAAC;AAC9C"}
|
|
@@ -32,7 +32,7 @@ function InspectorControlsSlot({
|
|
|
32
32
|
}
|
|
33
33
|
const Slot = _groups.default[group]?.Slot;
|
|
34
34
|
if (!Slot) {
|
|
35
|
-
typeof
|
|
35
|
+
typeof SCRIPT_DEBUG !== "undefined" && SCRIPT_DEBUG === true ? (0, _warning.default)(`Unknown InspectorControls group "${group}" provided.`) : void 0;
|
|
36
36
|
return null;
|
|
37
37
|
}
|
|
38
38
|
return (0, _element.createElement)(Slot, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_warning","_interopRequireDefault","require","_deprecated","_groups","InspectorControlsSlot","__experimentalGroup","group","props","deprecated","since","version","alternative","Slot","groups","
|
|
1
|
+
{"version":3,"names":["_warning","_interopRequireDefault","require","_deprecated","_groups","InspectorControlsSlot","__experimentalGroup","group","props","deprecated","since","version","alternative","Slot","groups","SCRIPT_DEBUG","warning","_element","createElement"],"sources":["@wordpress/block-editor/src/components/inspector-controls/slot.native.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport warning from '@wordpress/warning';\nimport deprecated from '@wordpress/deprecated';\n\n/**\n * Internal dependencies\n */\nimport groups from './groups';\n\nexport default function InspectorControlsSlot( {\n\t__experimentalGroup,\n\tgroup = 'default',\n\t...props\n} ) {\n\tif ( __experimentalGroup ) {\n\t\tdeprecated(\n\t\t\t'`__experimentalGroup` property in `InspectorControlsSlot`',\n\t\t\t{\n\t\t\t\tsince: '6.2',\n\t\t\t\tversion: '6.4',\n\t\t\t\talternative: '`group`',\n\t\t\t}\n\t\t);\n\t\tgroup = __experimentalGroup;\n\t}\n\tconst Slot = groups[ group ]?.Slot;\n\tif ( ! Slot ) {\n\t\twarning( `Unknown InspectorControls group \"${ group }\" provided.` );\n\t\treturn null;\n\t}\n\n\treturn <Slot { ...props } />;\n}\n"],"mappings":";;;;;;;;AAGA,IAAAA,QAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,WAAA,GAAAF,sBAAA,CAAAC,OAAA;AAKA,IAAAE,OAAA,GAAAH,sBAAA,CAAAC,OAAA;AATA;AACA;AACA;;AAIA;AACA;AACA;;AAGe,SAASG,qBAAqBA,CAAE;EAC9CC,mBAAmB;EACnBC,KAAK,GAAG,SAAS;EACjB,GAAGC;AACJ,CAAC,EAAG;EACH,IAAKF,mBAAmB,EAAG;IAC1B,IAAAG,mBAAU,EACT,2DAA2D,EAC3D;MACCC,KAAK,EAAE,KAAK;MACZC,OAAO,EAAE,KAAK;MACdC,WAAW,EAAE;IACd,CACD,CAAC;IACDL,KAAK,GAAGD,mBAAmB;EAC5B;EACA,MAAMO,IAAI,GAAGC,eAAM,CAAEP,KAAK,CAAE,EAAEM,IAAI;EAClC,IAAK,CAAEA,IAAI,EAAG;IACb,OAAAE,YAAA,oBAAAA,YAAA,gBAAAC,gBAAO,EAAG,oCAAoCT,KAAO,aAAa,CAAC;IACnE,OAAO,IAAI;EACZ;EAEA,OAAO,IAAAU,QAAA,CAAAC,aAAA,EAACL,IAAI;IAAA,GAAML;EAAK,CAAI,CAAC;AAC7B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_compose","require","_keycodes","useRemoveBrowserShortcuts","useRefEffect","node","onKeydown","event","isKeyboardEvent","primary","primaryShift","preventDefault","addEventListener"],"sources":["@wordpress/block-editor/src/components/rich-text/use-remove-browser-shortcuts.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useRefEffect } from '@wordpress/compose';\nimport { isKeyboardEvent } from '@wordpress/keycodes';\n\n/**\n * Hook to prevent default behaviors for key combinations otherwise handled\n * internally by RichText.\n *\n * @return {import('react').RefObject} The component to be rendered.\n */\nexport function useRemoveBrowserShortcuts() {\n\treturn useRefEffect( ( node ) => {\n\t\tfunction onKeydown( event ) {\n\t\t\tif (\n\t\t\t\tisKeyboardEvent.primary( event, 'z' ) ||\n\t\t\t\tisKeyboardEvent.primary( event, 'y' ) ||\n\t\t\t\tisKeyboardEvent.primaryShift( event, 'z' )\n\t\t\t) {\n\t\t\t\tevent.preventDefault();\n\t\t\t}\n\t\t}\n\t\tnode.addEventListener( 'keydown', onKeydown );\n\t\treturn () => {\n\t\t\tnode.
|
|
1
|
+
{"version":3,"names":["_compose","require","_keycodes","useRemoveBrowserShortcuts","useRefEffect","node","onKeydown","event","isKeyboardEvent","primary","primaryShift","preventDefault","addEventListener","removeEventListener"],"sources":["@wordpress/block-editor/src/components/rich-text/use-remove-browser-shortcuts.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useRefEffect } from '@wordpress/compose';\nimport { isKeyboardEvent } from '@wordpress/keycodes';\n\n/**\n * Hook to prevent default behaviors for key combinations otherwise handled\n * internally by RichText.\n *\n * @return {import('react').RefObject} The component to be rendered.\n */\nexport function useRemoveBrowserShortcuts() {\n\treturn useRefEffect( ( node ) => {\n\t\tfunction onKeydown( event ) {\n\t\t\tif (\n\t\t\t\tisKeyboardEvent.primary( event, 'z' ) ||\n\t\t\t\tisKeyboardEvent.primary( event, 'y' ) ||\n\t\t\t\tisKeyboardEvent.primaryShift( event, 'z' )\n\t\t\t) {\n\t\t\t\tevent.preventDefault();\n\t\t\t}\n\t\t}\n\t\tnode.addEventListener( 'keydown', onKeydown );\n\t\treturn () => {\n\t\t\tnode.removeEventListener( 'keydown', onKeydown );\n\t\t};\n\t}, [] );\n}\n"],"mappings":";;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,SAAA,GAAAD,OAAA;AAJA;AACA;AACA;;AAIA;AACA;AACA;AACA;AACA;AACA;AACO,SAASE,yBAAyBA,CAAA,EAAG;EAC3C,OAAO,IAAAC,qBAAY,EAAIC,IAAI,IAAM;IAChC,SAASC,SAASA,CAAEC,KAAK,EAAG;MAC3B,IACCC,yBAAe,CAACC,OAAO,CAAEF,KAAK,EAAE,GAAI,CAAC,IACrCC,yBAAe,CAACC,OAAO,CAAEF,KAAK,EAAE,GAAI,CAAC,IACrCC,yBAAe,CAACE,YAAY,CAAEH,KAAK,EAAE,GAAI,CAAC,EACzC;QACDA,KAAK,CAACI,cAAc,CAAC,CAAC;MACvB;IACD;IACAN,IAAI,CAACO,gBAAgB,CAAE,SAAS,EAAEN,SAAU,CAAC;IAC7C,OAAO,MAAM;MACZD,IAAI,CAACQ,mBAAmB,CAAE,SAAS,EAAEP,SAAU,CAAC;IACjD,CAAC;EACF,CAAC,EAAE,EAAG,CAAC;AACR"}
|
package/build/store/selectors.js
CHANGED
|
@@ -1831,7 +1831,7 @@ const getInserterItems = (0, _rememo.default)((state, rootClientId = null) => {
|
|
|
1831
1831
|
initialAttributes: {
|
|
1832
1832
|
ref: reusableBlock.id
|
|
1833
1833
|
},
|
|
1834
|
-
title: reusableBlock.title
|
|
1834
|
+
title: reusableBlock.title?.raw,
|
|
1835
1835
|
icon,
|
|
1836
1836
|
category: 'reusable',
|
|
1837
1837
|
keywords: ['reusable'],
|