@wordpress/block-editor 14.3.5 → 14.3.6
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 +4 -0
- package/build/components/block-list/block.js +0 -3
- package/build/components/block-list/block.js.map +1 -1
- package/build/components/block-list/use-block-props/index.js +1 -4
- package/build/components/block-list/use-block-props/index.js.map +1 -1
- package/build/components/block-list/use-block-props/use-zoom-out-mode-exit.js +9 -12
- package/build/components/block-list/use-block-props/use-zoom-out-mode-exit.js.map +1 -1
- package/build/components/iframe/index.js +6 -1
- package/build/components/iframe/index.js.map +1 -1
- package/build/components/inserter/menu.js +3 -0
- package/build/components/inserter/menu.js.map +1 -1
- package/build/components/tool-selector/index.js +5 -1
- package/build/components/tool-selector/index.js.map +1 -1
- package/build/components/use-resize-canvas/index.js +1 -2
- package/build/components/use-resize-canvas/index.js.map +1 -1
- package/build/hooks/grid-visualizer.js +13 -11
- package/build/hooks/grid-visualizer.js.map +1 -1
- package/build/hooks/layout-child.js +41 -3
- package/build/hooks/layout-child.js.map +1 -1
- package/build/private-apis.js +2 -0
- package/build/private-apis.js.map +1 -1
- package/build/utils/block-bindings.js +9 -6
- package/build/utils/block-bindings.js.map +1 -1
- package/build-module/components/block-list/block.js +0 -3
- package/build-module/components/block-list/block.js.map +1 -1
- package/build-module/components/block-list/use-block-props/index.js +1 -4
- package/build-module/components/block-list/use-block-props/index.js.map +1 -1
- package/build-module/components/block-list/use-block-props/use-zoom-out-mode-exit.js +9 -12
- package/build-module/components/block-list/use-block-props/use-zoom-out-mode-exit.js.map +1 -1
- package/build-module/components/iframe/index.js +6 -1
- package/build-module/components/iframe/index.js.map +1 -1
- package/build-module/components/inserter/menu.js +3 -0
- package/build-module/components/inserter/menu.js.map +1 -1
- package/build-module/components/tool-selector/index.js +5 -1
- package/build-module/components/tool-selector/index.js.map +1 -1
- package/build-module/components/use-resize-canvas/index.js +1 -2
- package/build-module/components/use-resize-canvas/index.js.map +1 -1
- package/build-module/hooks/grid-visualizer.js +13 -11
- package/build-module/hooks/grid-visualizer.js.map +1 -1
- package/build-module/hooks/layout-child.js +41 -3
- package/build-module/hooks/layout-child.js.map +1 -1
- package/build-module/private-apis.js +2 -0
- package/build-module/private-apis.js.map +1 -1
- package/build-module/utils/block-bindings.js +9 -6
- package/build-module/utils/block-bindings.js.map +1 -1
- package/build-style/content-rtl.css +6 -7
- package/build-style/content.css +6 -7
- package/build-style/style-rtl.css +9 -1
- package/build-style/style.css +9 -1
- package/package.json +5 -5
- package/src/components/block-list/block.js +0 -3
- package/src/components/block-list/use-block-props/index.js +1 -2
- package/src/components/block-list/use-block-props/use-zoom-out-mode-exit.js +19 -11
- package/src/components/iframe/content.scss +7 -8
- package/src/components/iframe/index.js +7 -1
- package/src/components/iframe/style.scss +17 -0
- package/src/components/inserter/menu.js +5 -0
- package/src/components/list-view/style.scss +9 -0
- package/src/components/tool-selector/index.js +5 -2
- package/src/components/use-resize-canvas/index.js +1 -3
- package/src/hooks/grid-visualizer.js +23 -9
- package/src/hooks/layout-child.js +48 -3
- package/src/private-apis.js +2 -0
- package/src/utils/block-bindings.js +9 -6
- package/src/utils/test/use-block-bindings-utils.js +174 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["globalStyles","ExperimentalBlockEditorProvider","lock","getRichTextValues","ResizableBoxPopover","default","PrivateQuickInserter","extractWords","getNormalizedSearchTerms","normalizeString","PrivateListView","BlockInfo","useHasBlockToolbar","cleanEmptyObject","BlockQuickNavigation","LayoutStyle","BlockRemovalWarningModal","setBackgroundStyleDefaults","useLayoutClasses","useLayoutStyles","__unstableBlockStyleVariationOverridesWithConfig","DimensionsTool","ResolutionTool","TextAlignmentControl","usesContextKey","ExperimentalBlockCanvas","getDuotoneFilter","useFlashEditableBlocks","selectBlockPatternsKey","reusableBlocksSelectKey","globalStylesDataKey","globalStylesLinksDataKey","sectionRootClientIdKey","requiresWrapperOnCopy","PrivateRichText","PrivateBlockPopover","PrivateInserterLibrary","PrivatePublishDateTimePicker","useSpacingSizes","useBlockDisplayTitle","TabbedSidebar","privateApis"],"sources":["@wordpress/block-editor/src/private-apis.js"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport * as globalStyles from './components/global-styles';\nimport { ExperimentalBlockEditorProvider } from './components/provider';\nimport { lock } from './lock-unlock';\nimport { getRichTextValues } from './components/rich-text/get-rich-text-values';\nimport ResizableBoxPopover from './components/resizable-box-popover';\nimport { default as PrivateQuickInserter } from './components/inserter/quick-inserter';\nimport {\n\textractWords,\n\tgetNormalizedSearchTerms,\n\tnormalizeString,\n} from './components/inserter/search-items';\nimport { PrivateListView } from './components/list-view';\nimport BlockInfo from './components/block-info-slot-fill';\nimport { useHasBlockToolbar } from './components/block-toolbar/use-has-block-toolbar';\nimport { cleanEmptyObject } from './hooks/utils';\nimport BlockQuickNavigation from './components/block-quick-navigation';\nimport { LayoutStyle } from './components/block-list/layout';\nimport { BlockRemovalWarningModal } from './components/block-removal-warning-modal';\nimport {\n\tsetBackgroundStyleDefaults,\n\tuseLayoutClasses,\n\tuseLayoutStyles,\n\t__unstableBlockStyleVariationOverridesWithConfig,\n} from './hooks';\nimport DimensionsTool from './components/dimensions-tool';\nimport ResolutionTool from './components/resolution-tool';\nimport TextAlignmentControl from './components/text-alignment-control';\nimport { usesContextKey } from './components/rich-text/format-edit';\nimport { ExperimentalBlockCanvas } from './components/block-canvas';\nimport { getDuotoneFilter } from './components/duotone/utils';\nimport { useFlashEditableBlocks } from './components/use-flash-editable-blocks';\nimport {\n\tselectBlockPatternsKey,\n\treusableBlocksSelectKey,\n\tglobalStylesDataKey,\n\tglobalStylesLinksDataKey,\n\tsectionRootClientIdKey,\n} from './store/private-keys';\nimport { requiresWrapperOnCopy } from './components/writing-flow/utils';\nimport { PrivateRichText } from './components/rich-text/';\nimport { PrivateBlockPopover } from './components/block-popover';\nimport { PrivateInserterLibrary } from './components/inserter/library';\nimport { PrivatePublishDateTimePicker } from './components/publish-date-time-picker';\nimport useSpacingSizes from './components/spacing-sizes-control/hooks/use-spacing-sizes';\nimport useBlockDisplayTitle from './components/block-title/use-block-display-title';\nimport TabbedSidebar from './components/tabbed-sidebar';\n\n/**\n * Private @wordpress/block-editor APIs.\n */\nexport const privateApis = {};\nlock( privateApis, {\n\t...globalStyles,\n\tExperimentalBlockCanvas,\n\tExperimentalBlockEditorProvider,\n\tgetDuotoneFilter,\n\tgetRichTextValues,\n\tPrivateQuickInserter,\n\textractWords,\n\tgetNormalizedSearchTerms,\n\tnormalizeString,\n\tPrivateListView,\n\tResizableBoxPopover,\n\tBlockInfo,\n\tuseHasBlockToolbar,\n\tcleanEmptyObject,\n\tBlockQuickNavigation,\n\tLayoutStyle,\n\tBlockRemovalWarningModal,\n\tuseLayoutClasses,\n\tuseLayoutStyles,\n\tDimensionsTool,\n\tResolutionTool,\n\tTabbedSidebar,\n\tTextAlignmentControl,\n\tusesContextKey,\n\tuseFlashEditableBlocks,\n\tglobalStylesDataKey,\n\tglobalStylesLinksDataKey,\n\tselectBlockPatternsKey,\n\trequiresWrapperOnCopy,\n\tPrivateRichText,\n\tPrivateInserterLibrary,\n\treusableBlocksSelectKey,\n\tPrivateBlockPopover,\n\tPrivatePublishDateTimePicker,\n\tuseSpacingSizes,\n\tuseBlockDisplayTitle,\n\t__unstableBlockStyleVariationOverridesWithConfig,\n\tsetBackgroundStyleDefaults,\n\tsectionRootClientIdKey,\n} );\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAO,KAAKA,YAAY,MAAM,4BAA4B;AAC1D,SAASC,+BAA+B,QAAQ,uBAAuB;AACvE,SAASC,IAAI,QAAQ,eAAe;AACpC,SAASC,iBAAiB,QAAQ,6CAA6C;AAC/E,OAAOC,mBAAmB,MAAM,oCAAoC;AACpE,SAASC,OAAO,IAAIC,oBAAoB,QAAQ,sCAAsC;AACtF,SACCC,YAAY,EACZC,wBAAwB,EACxBC,eAAe,QACT,oCAAoC;AAC3C,SAASC,eAAe,QAAQ,wBAAwB;AACxD,OAAOC,SAAS,MAAM,mCAAmC;AACzD,SAASC,kBAAkB,QAAQ,kDAAkD;AACrF,SAASC,gBAAgB,QAAQ,eAAe;AAChD,OAAOC,oBAAoB,MAAM,qCAAqC;AACtE,SAASC,WAAW,QAAQ,gCAAgC;AAC5D,SAASC,wBAAwB,QAAQ,0CAA0C;AACnF,SACCC,0BAA0B,EAC1BC,gBAAgB,EAChBC,eAAe,EACfC,gDAAgD,QAC1C,SAAS;AAChB,OAAOC,cAAc,MAAM,8BAA8B;AACzD,OAAOC,cAAc,MAAM,8BAA8B;AACzD,OAAOC,oBAAoB,MAAM,qCAAqC;AACtE,SAASC,cAAc,QAAQ,oCAAoC;AACnE,SAASC,uBAAuB,QAAQ,2BAA2B;AACnE,SAASC,gBAAgB,QAAQ,4BAA4B;AAC7D,SAASC,sBAAsB,QAAQ,wCAAwC;AAC/E,SACCC,sBAAsB,EACtBC,uBAAuB,EACvBC,mBAAmB,EACnBC,wBAAwB,EACxBC,sBAAsB,QAChB,sBAAsB;AAC7B,SAASC,qBAAqB,QAAQ,iCAAiC;AACvE,SAASC,eAAe,QAAQ,yBAAyB;AACzD,SAASC,mBAAmB,QAAQ,4BAA4B;AAChE,SAASC,sBAAsB,QAAQ,+BAA+B;AACtE,SAASC,4BAA4B,QAAQ,uCAAuC;AACpF,OAAOC,eAAe,MAAM,4DAA4D;AACxF,OAAOC,oBAAoB,MAAM,kDAAkD;AACnF,OAAOC,aAAa,MAAM,6BAA6B;;AAEvD;AACA;AACA;AACA,OAAO,MAAMC,WAAW,GAAG,CAAC,CAAC;
|
|
1
|
+
{"version":3,"names":["globalStyles","ExperimentalBlockEditorProvider","lock","getRichTextValues","ResizableBoxPopover","default","PrivateQuickInserter","extractWords","getNormalizedSearchTerms","normalizeString","PrivateListView","BlockInfo","useHasBlockToolbar","cleanEmptyObject","BlockQuickNavigation","LayoutStyle","BlockRemovalWarningModal","setBackgroundStyleDefaults","useLayoutClasses","useLayoutStyles","__unstableBlockStyleVariationOverridesWithConfig","DimensionsTool","ResolutionTool","TextAlignmentControl","usesContextKey","ExperimentalBlockCanvas","getDuotoneFilter","useFlashEditableBlocks","useZoomOutModeExit","selectBlockPatternsKey","reusableBlocksSelectKey","globalStylesDataKey","globalStylesLinksDataKey","sectionRootClientIdKey","requiresWrapperOnCopy","PrivateRichText","PrivateBlockPopover","PrivateInserterLibrary","PrivatePublishDateTimePicker","useSpacingSizes","useBlockDisplayTitle","TabbedSidebar","privateApis"],"sources":["@wordpress/block-editor/src/private-apis.js"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport * as globalStyles from './components/global-styles';\nimport { ExperimentalBlockEditorProvider } from './components/provider';\nimport { lock } from './lock-unlock';\nimport { getRichTextValues } from './components/rich-text/get-rich-text-values';\nimport ResizableBoxPopover from './components/resizable-box-popover';\nimport { default as PrivateQuickInserter } from './components/inserter/quick-inserter';\nimport {\n\textractWords,\n\tgetNormalizedSearchTerms,\n\tnormalizeString,\n} from './components/inserter/search-items';\nimport { PrivateListView } from './components/list-view';\nimport BlockInfo from './components/block-info-slot-fill';\nimport { useHasBlockToolbar } from './components/block-toolbar/use-has-block-toolbar';\nimport { cleanEmptyObject } from './hooks/utils';\nimport BlockQuickNavigation from './components/block-quick-navigation';\nimport { LayoutStyle } from './components/block-list/layout';\nimport { BlockRemovalWarningModal } from './components/block-removal-warning-modal';\nimport {\n\tsetBackgroundStyleDefaults,\n\tuseLayoutClasses,\n\tuseLayoutStyles,\n\t__unstableBlockStyleVariationOverridesWithConfig,\n} from './hooks';\nimport DimensionsTool from './components/dimensions-tool';\nimport ResolutionTool from './components/resolution-tool';\nimport TextAlignmentControl from './components/text-alignment-control';\nimport { usesContextKey } from './components/rich-text/format-edit';\nimport { ExperimentalBlockCanvas } from './components/block-canvas';\nimport { getDuotoneFilter } from './components/duotone/utils';\nimport { useFlashEditableBlocks } from './components/use-flash-editable-blocks';\nimport { useZoomOutModeExit } from './components/block-list/use-block-props/use-zoom-out-mode-exit';\nimport {\n\tselectBlockPatternsKey,\n\treusableBlocksSelectKey,\n\tglobalStylesDataKey,\n\tglobalStylesLinksDataKey,\n\tsectionRootClientIdKey,\n} from './store/private-keys';\nimport { requiresWrapperOnCopy } from './components/writing-flow/utils';\nimport { PrivateRichText } from './components/rich-text/';\nimport { PrivateBlockPopover } from './components/block-popover';\nimport { PrivateInserterLibrary } from './components/inserter/library';\nimport { PrivatePublishDateTimePicker } from './components/publish-date-time-picker';\nimport useSpacingSizes from './components/spacing-sizes-control/hooks/use-spacing-sizes';\nimport useBlockDisplayTitle from './components/block-title/use-block-display-title';\nimport TabbedSidebar from './components/tabbed-sidebar';\n\n/**\n * Private @wordpress/block-editor APIs.\n */\nexport const privateApis = {};\nlock( privateApis, {\n\t...globalStyles,\n\tExperimentalBlockCanvas,\n\tExperimentalBlockEditorProvider,\n\tgetDuotoneFilter,\n\tgetRichTextValues,\n\tPrivateQuickInserter,\n\textractWords,\n\tgetNormalizedSearchTerms,\n\tnormalizeString,\n\tPrivateListView,\n\tResizableBoxPopover,\n\tBlockInfo,\n\tuseHasBlockToolbar,\n\tcleanEmptyObject,\n\tBlockQuickNavigation,\n\tLayoutStyle,\n\tBlockRemovalWarningModal,\n\tuseLayoutClasses,\n\tuseLayoutStyles,\n\tDimensionsTool,\n\tResolutionTool,\n\tTabbedSidebar,\n\tTextAlignmentControl,\n\tusesContextKey,\n\tuseFlashEditableBlocks,\n\tuseZoomOutModeExit,\n\tglobalStylesDataKey,\n\tglobalStylesLinksDataKey,\n\tselectBlockPatternsKey,\n\trequiresWrapperOnCopy,\n\tPrivateRichText,\n\tPrivateInserterLibrary,\n\treusableBlocksSelectKey,\n\tPrivateBlockPopover,\n\tPrivatePublishDateTimePicker,\n\tuseSpacingSizes,\n\tuseBlockDisplayTitle,\n\t__unstableBlockStyleVariationOverridesWithConfig,\n\tsetBackgroundStyleDefaults,\n\tsectionRootClientIdKey,\n} );\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAO,KAAKA,YAAY,MAAM,4BAA4B;AAC1D,SAASC,+BAA+B,QAAQ,uBAAuB;AACvE,SAASC,IAAI,QAAQ,eAAe;AACpC,SAASC,iBAAiB,QAAQ,6CAA6C;AAC/E,OAAOC,mBAAmB,MAAM,oCAAoC;AACpE,SAASC,OAAO,IAAIC,oBAAoB,QAAQ,sCAAsC;AACtF,SACCC,YAAY,EACZC,wBAAwB,EACxBC,eAAe,QACT,oCAAoC;AAC3C,SAASC,eAAe,QAAQ,wBAAwB;AACxD,OAAOC,SAAS,MAAM,mCAAmC;AACzD,SAASC,kBAAkB,QAAQ,kDAAkD;AACrF,SAASC,gBAAgB,QAAQ,eAAe;AAChD,OAAOC,oBAAoB,MAAM,qCAAqC;AACtE,SAASC,WAAW,QAAQ,gCAAgC;AAC5D,SAASC,wBAAwB,QAAQ,0CAA0C;AACnF,SACCC,0BAA0B,EAC1BC,gBAAgB,EAChBC,eAAe,EACfC,gDAAgD,QAC1C,SAAS;AAChB,OAAOC,cAAc,MAAM,8BAA8B;AACzD,OAAOC,cAAc,MAAM,8BAA8B;AACzD,OAAOC,oBAAoB,MAAM,qCAAqC;AACtE,SAASC,cAAc,QAAQ,oCAAoC;AACnE,SAASC,uBAAuB,QAAQ,2BAA2B;AACnE,SAASC,gBAAgB,QAAQ,4BAA4B;AAC7D,SAASC,sBAAsB,QAAQ,wCAAwC;AAC/E,SAASC,kBAAkB,QAAQ,gEAAgE;AACnG,SACCC,sBAAsB,EACtBC,uBAAuB,EACvBC,mBAAmB,EACnBC,wBAAwB,EACxBC,sBAAsB,QAChB,sBAAsB;AAC7B,SAASC,qBAAqB,QAAQ,iCAAiC;AACvE,SAASC,eAAe,QAAQ,yBAAyB;AACzD,SAASC,mBAAmB,QAAQ,4BAA4B;AAChE,SAASC,sBAAsB,QAAQ,+BAA+B;AACtE,SAASC,4BAA4B,QAAQ,uCAAuC;AACpF,OAAOC,eAAe,MAAM,4DAA4D;AACxF,OAAOC,oBAAoB,MAAM,kDAAkD;AACnF,OAAOC,aAAa,MAAM,6BAA6B;;AAEvD;AACA;AACA;AACA,OAAO,MAAMC,WAAW,GAAG,CAAC,CAAC;AAC7BxC,IAAI,CAAEwC,WAAW,EAAE;EAClB,GAAG1C,YAAY;EACfyB,uBAAuB;EACvBxB,+BAA+B;EAC/ByB,gBAAgB;EAChBvB,iBAAiB;EACjBG,oBAAoB;EACpBC,YAAY;EACZC,wBAAwB;EACxBC,eAAe;EACfC,eAAe;EACfN,mBAAmB;EACnBO,SAAS;EACTC,kBAAkB;EAClBC,gBAAgB;EAChBC,oBAAoB;EACpBC,WAAW;EACXC,wBAAwB;EACxBE,gBAAgB;EAChBC,eAAe;EACfE,cAAc;EACdC,cAAc;EACdmB,aAAa;EACblB,oBAAoB;EACpBC,cAAc;EACdG,sBAAsB;EACtBC,kBAAkB;EAClBG,mBAAmB;EACnBC,wBAAwB;EACxBH,sBAAsB;EACtBK,qBAAqB;EACrBC,eAAe;EACfE,sBAAsB;EACtBP,uBAAuB;EACvBM,mBAAmB;EACnBE,4BAA4B;EAC5BC,eAAe;EACfC,oBAAoB;EACpBpB,gDAAgD;EAChDH,0BAA0B;EAC1BgB;AACD,CAAE,CAAC","ignoreList":[]}
|
|
@@ -29,6 +29,8 @@ function isObjectEmpty(object) {
|
|
|
29
29
|
* - `updateBlockBindings`: Updates the value of the bindings connected to block attributes. It can be used to remove a specific binding by setting the value to `undefined`.
|
|
30
30
|
* - `removeAllBlockBindings`: Removes the bindings property of the `metadata` attribute.
|
|
31
31
|
*
|
|
32
|
+
* @param {?string} clientId Optional block client ID. If not set, it will use the current block client ID from the context.
|
|
33
|
+
*
|
|
32
34
|
* @return {?WPBlockBindingsUtils} Object containing the block bindings utils.
|
|
33
35
|
*
|
|
34
36
|
* @example
|
|
@@ -59,10 +61,11 @@ function isObjectEmpty(object) {
|
|
|
59
61
|
* removeAllBlockBindings();
|
|
60
62
|
* ```
|
|
61
63
|
*/
|
|
62
|
-
export function useBlockBindingsUtils() {
|
|
64
|
+
export function useBlockBindingsUtils(clientId) {
|
|
63
65
|
const {
|
|
64
|
-
clientId
|
|
66
|
+
clientId: contextClientId
|
|
65
67
|
} = useBlockEditContext();
|
|
68
|
+
const blockClientId = clientId || contextClientId;
|
|
66
69
|
const {
|
|
67
70
|
updateBlockAttributes
|
|
68
71
|
} = useDispatch(blockEditorStore);
|
|
@@ -105,7 +108,7 @@ export function useBlockBindingsUtils() {
|
|
|
105
108
|
bindings: currentBindings,
|
|
106
109
|
...metadata
|
|
107
110
|
} = {}
|
|
108
|
-
} = getBlockAttributes(
|
|
111
|
+
} = getBlockAttributes(blockClientId);
|
|
109
112
|
const newBindings = {
|
|
110
113
|
...currentBindings
|
|
111
114
|
};
|
|
@@ -123,7 +126,7 @@ export function useBlockBindingsUtils() {
|
|
|
123
126
|
if (isObjectEmpty(newMetadata.bindings)) {
|
|
124
127
|
delete newMetadata.bindings;
|
|
125
128
|
}
|
|
126
|
-
updateBlockAttributes(
|
|
129
|
+
updateBlockAttributes(blockClientId, {
|
|
127
130
|
metadata: isObjectEmpty(newMetadata) ? undefined : newMetadata
|
|
128
131
|
});
|
|
129
132
|
};
|
|
@@ -145,8 +148,8 @@ export function useBlockBindingsUtils() {
|
|
|
145
148
|
bindings,
|
|
146
149
|
...metadata
|
|
147
150
|
} = {}
|
|
148
|
-
} = getBlockAttributes(
|
|
149
|
-
updateBlockAttributes(
|
|
151
|
+
} = getBlockAttributes(blockClientId);
|
|
152
|
+
updateBlockAttributes(blockClientId, {
|
|
150
153
|
metadata: isObjectEmpty(metadata) ? undefined : metadata
|
|
151
154
|
});
|
|
152
155
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useDispatch","useRegistry","store","blockEditorStore","useBlockEditContext","isObjectEmpty","object","Object","keys","length","useBlockBindingsUtils","clientId","updateBlockAttributes","getBlockAttributes","select","updateBlockBindings","bindings","metadata","currentBindings","newBindings","entries","forEach","attribute","binding","newMetadata","undefined","removeAllBlockBindings"],"sources":["@wordpress/block-editor/src/utils/block-bindings.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useDispatch, useRegistry } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../store';\nimport { useBlockEditContext } from '../components/block-edit';\n\nfunction isObjectEmpty( object ) {\n\treturn ! object || Object.keys( object ).length === 0;\n}\n\n/**\n * Contains utils to update the block `bindings` metadata.\n *\n * @typedef {Object} WPBlockBindingsUtils\n *\n * @property {Function} updateBlockBindings Updates the value of the bindings connected to block attributes.\n * @property {Function} removeAllBlockBindings Removes the bindings property of the `metadata` attribute.\n */\n\n/**\n * Retrieves the existing utils needed to update the block `bindings` metadata.\n * They can be used to create, modify, or remove connections from the existing block attributes.\n *\n * It contains the following utils:\n * - `updateBlockBindings`: Updates the value of the bindings connected to block attributes. It can be used to remove a specific binding by setting the value to `undefined`.\n * - `removeAllBlockBindings`: Removes the bindings property of the `metadata` attribute.\n *\n * @return {?WPBlockBindingsUtils} Object containing the block bindings utils.\n *\n * @example\n * ```js\n * import { useBlockBindingsUtils } from '@wordpress/block-editor'\n * const { updateBlockBindings, removeAllBlockBindings } = useBlockBindingsUtils();\n *\n * // Update url and alt attributes.\n * updateBlockBindings( {\n * url: {\n * source: 'core/post-meta',\n * args: {\n * key: 'url_custom_field',\n * },\n * },\n * alt: {\n * source: 'core/post-meta',\n * args: {\n * key: 'text_custom_field',\n * },\n * },\n * } );\n *\n * // Remove binding from url attribute.\n * updateBlockBindings( { url: undefined } );\n *\n * // Remove bindings from all attributes.\n * removeAllBlockBindings();\n * ```\n */\nexport function useBlockBindingsUtils() {\n\tconst { clientId } = useBlockEditContext();\n\tconst { updateBlockAttributes } = useDispatch( blockEditorStore );\n\tconst { getBlockAttributes } = useRegistry().select( blockEditorStore );\n\n\t/**\n\t * Updates the value of the bindings connected to block attributes.\n\t * It removes the binding when the new value is `undefined`.\n\t *\n\t * @param {Object} bindings Bindings including the attributes to update and the new object.\n\t * @param {string} bindings.source The source name to connect to.\n\t * @param {Object} [bindings.args] Object containing the arguments needed by the source.\n\t *\n\t * @example\n\t * ```js\n\t * import { useBlockBindingsUtils } from '@wordpress/block-editor'\n\t *\n\t * const { updateBlockBindings } = useBlockBindingsUtils();\n\t * updateBlockBindings( {\n\t * url: {\n\t * source: 'core/post-meta',\n\t * args: {\n\t * key: 'url_custom_field',\n\t * },\n\t * \t },\n\t * alt: {\n\t * source: 'core/post-meta',\n\t * args: {\n\t * key: 'text_custom_field',\n\t * },\n\t * \t }\n\t * } );\n\t * ```\n\t */\n\tconst updateBlockBindings = ( bindings ) => {\n\t\tconst { metadata: { bindings: currentBindings, ...metadata } = {} } =\n\t\t\tgetBlockAttributes(
|
|
1
|
+
{"version":3,"names":["useDispatch","useRegistry","store","blockEditorStore","useBlockEditContext","isObjectEmpty","object","Object","keys","length","useBlockBindingsUtils","clientId","contextClientId","blockClientId","updateBlockAttributes","getBlockAttributes","select","updateBlockBindings","bindings","metadata","currentBindings","newBindings","entries","forEach","attribute","binding","newMetadata","undefined","removeAllBlockBindings"],"sources":["@wordpress/block-editor/src/utils/block-bindings.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useDispatch, useRegistry } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../store';\nimport { useBlockEditContext } from '../components/block-edit';\n\nfunction isObjectEmpty( object ) {\n\treturn ! object || Object.keys( object ).length === 0;\n}\n\n/**\n * Contains utils to update the block `bindings` metadata.\n *\n * @typedef {Object} WPBlockBindingsUtils\n *\n * @property {Function} updateBlockBindings Updates the value of the bindings connected to block attributes.\n * @property {Function} removeAllBlockBindings Removes the bindings property of the `metadata` attribute.\n */\n\n/**\n * Retrieves the existing utils needed to update the block `bindings` metadata.\n * They can be used to create, modify, or remove connections from the existing block attributes.\n *\n * It contains the following utils:\n * - `updateBlockBindings`: Updates the value of the bindings connected to block attributes. It can be used to remove a specific binding by setting the value to `undefined`.\n * - `removeAllBlockBindings`: Removes the bindings property of the `metadata` attribute.\n *\n * @param {?string} clientId Optional block client ID. If not set, it will use the current block client ID from the context.\n *\n * @return {?WPBlockBindingsUtils} Object containing the block bindings utils.\n *\n * @example\n * ```js\n * import { useBlockBindingsUtils } from '@wordpress/block-editor'\n * const { updateBlockBindings, removeAllBlockBindings } = useBlockBindingsUtils();\n *\n * // Update url and alt attributes.\n * updateBlockBindings( {\n * url: {\n * source: 'core/post-meta',\n * args: {\n * key: 'url_custom_field',\n * },\n * },\n * alt: {\n * source: 'core/post-meta',\n * args: {\n * key: 'text_custom_field',\n * },\n * },\n * } );\n *\n * // Remove binding from url attribute.\n * updateBlockBindings( { url: undefined } );\n *\n * // Remove bindings from all attributes.\n * removeAllBlockBindings();\n * ```\n */\nexport function useBlockBindingsUtils( clientId ) {\n\tconst { clientId: contextClientId } = useBlockEditContext();\n\tconst blockClientId = clientId || contextClientId;\n\tconst { updateBlockAttributes } = useDispatch( blockEditorStore );\n\tconst { getBlockAttributes } = useRegistry().select( blockEditorStore );\n\n\t/**\n\t * Updates the value of the bindings connected to block attributes.\n\t * It removes the binding when the new value is `undefined`.\n\t *\n\t * @param {Object} bindings Bindings including the attributes to update and the new object.\n\t * @param {string} bindings.source The source name to connect to.\n\t * @param {Object} [bindings.args] Object containing the arguments needed by the source.\n\t *\n\t * @example\n\t * ```js\n\t * import { useBlockBindingsUtils } from '@wordpress/block-editor'\n\t *\n\t * const { updateBlockBindings } = useBlockBindingsUtils();\n\t * updateBlockBindings( {\n\t * url: {\n\t * source: 'core/post-meta',\n\t * args: {\n\t * key: 'url_custom_field',\n\t * },\n\t * \t },\n\t * alt: {\n\t * source: 'core/post-meta',\n\t * args: {\n\t * key: 'text_custom_field',\n\t * },\n\t * \t }\n\t * } );\n\t * ```\n\t */\n\tconst updateBlockBindings = ( bindings ) => {\n\t\tconst { metadata: { bindings: currentBindings, ...metadata } = {} } =\n\t\t\tgetBlockAttributes( blockClientId );\n\t\tconst newBindings = { ...currentBindings };\n\n\t\tObject.entries( bindings ).forEach( ( [ attribute, binding ] ) => {\n\t\t\tif ( ! binding && newBindings[ attribute ] ) {\n\t\t\t\tdelete newBindings[ attribute ];\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tnewBindings[ attribute ] = binding;\n\t\t} );\n\n\t\tconst newMetadata = {\n\t\t\t...metadata,\n\t\t\tbindings: newBindings,\n\t\t};\n\n\t\tif ( isObjectEmpty( newMetadata.bindings ) ) {\n\t\t\tdelete newMetadata.bindings;\n\t\t}\n\n\t\tupdateBlockAttributes( blockClientId, {\n\t\t\tmetadata: isObjectEmpty( newMetadata ) ? undefined : newMetadata,\n\t\t} );\n\t};\n\n\t/**\n\t * Removes the bindings property of the `metadata` attribute.\n\t *\n\t * @example\n\t * ```js\n\t * import { useBlockBindingsUtils } from '@wordpress/block-editor'\n\t *\n\t * const { removeAllBlockBindings } = useBlockBindingsUtils();\n\t * removeAllBlockBindings();\n\t * ```\n\t */\n\tconst removeAllBlockBindings = () => {\n\t\tconst { metadata: { bindings, ...metadata } = {} } =\n\t\t\tgetBlockAttributes( blockClientId );\n\t\tupdateBlockAttributes( blockClientId, {\n\t\t\tmetadata: isObjectEmpty( metadata ) ? undefined : metadata,\n\t\t} );\n\t};\n\n\treturn { updateBlockBindings, removeAllBlockBindings };\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,WAAW,EAAEC,WAAW,QAAQ,iBAAiB;;AAE1D;AACA;AACA;AACA,SAASC,KAAK,IAAIC,gBAAgB,QAAQ,UAAU;AACpD,SAASC,mBAAmB,QAAQ,0BAA0B;AAE9D,SAASC,aAAaA,CAAEC,MAAM,EAAG;EAChC,OAAO,CAAEA,MAAM,IAAIC,MAAM,CAACC,IAAI,CAAEF,MAAO,CAAC,CAACG,MAAM,KAAK,CAAC;AACtD;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,qBAAqBA,CAAEC,QAAQ,EAAG;EACjD,MAAM;IAAEA,QAAQ,EAAEC;EAAgB,CAAC,GAAGR,mBAAmB,CAAC,CAAC;EAC3D,MAAMS,aAAa,GAAGF,QAAQ,IAAIC,eAAe;EACjD,MAAM;IAAEE;EAAsB,CAAC,GAAGd,WAAW,CAAEG,gBAAiB,CAAC;EACjE,MAAM;IAAEY;EAAmB,CAAC,GAAGd,WAAW,CAAC,CAAC,CAACe,MAAM,CAAEb,gBAAiB,CAAC;;EAEvE;AACD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EACC,MAAMc,mBAAmB,GAAKC,QAAQ,IAAM;IAC3C,MAAM;MAAEC,QAAQ,EAAE;QAAED,QAAQ,EAAEE,eAAe;QAAE,GAAGD;MAAS,CAAC,GAAG,CAAC;IAAE,CAAC,GAClEJ,kBAAkB,CAAEF,aAAc,CAAC;IACpC,MAAMQ,WAAW,GAAG;MAAE,GAAGD;IAAgB,CAAC;IAE1Cb,MAAM,CAACe,OAAO,CAAEJ,QAAS,CAAC,CAACK,OAAO,CAAE,CAAE,CAAEC,SAAS,EAAEC,OAAO,CAAE,KAAM;MACjE,IAAK,CAAEA,OAAO,IAAIJ,WAAW,CAAEG,SAAS,CAAE,EAAG;QAC5C,OAAOH,WAAW,CAAEG,SAAS,CAAE;QAC/B;MACD;MACAH,WAAW,CAAEG,SAAS,CAAE,GAAGC,OAAO;IACnC,CAAE,CAAC;IAEH,MAAMC,WAAW,GAAG;MACnB,GAAGP,QAAQ;MACXD,QAAQ,EAAEG;IACX,CAAC;IAED,IAAKhB,aAAa,CAAEqB,WAAW,CAACR,QAAS,CAAC,EAAG;MAC5C,OAAOQ,WAAW,CAACR,QAAQ;IAC5B;IAEAJ,qBAAqB,CAAED,aAAa,EAAE;MACrCM,QAAQ,EAAEd,aAAa,CAAEqB,WAAY,CAAC,GAAGC,SAAS,GAAGD;IACtD,CAAE,CAAC;EACJ,CAAC;;EAED;AACD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EACC,MAAME,sBAAsB,GAAGA,CAAA,KAAM;IACpC,MAAM;MAAET,QAAQ,EAAE;QAAED,QAAQ;QAAE,GAAGC;MAAS,CAAC,GAAG,CAAC;IAAE,CAAC,GACjDJ,kBAAkB,CAAEF,aAAc,CAAC;IACpCC,qBAAqB,CAAED,aAAa,EAAE;MACrCM,QAAQ,EAAEd,aAAa,CAAEc,QAAS,CAAC,GAAGQ,SAAS,GAAGR;IACnD,CAAE,CAAC;EACJ,CAAC;EAED,OAAO;IAAEF,mBAAmB;IAAEW;EAAuB,CAAC;AACvD","ignoreList":[]}
|
|
@@ -800,6 +800,7 @@ _::-webkit-full-page-media, _:future, :root .has-multi-selection .block-editor-b
|
|
|
800
800
|
|
|
801
801
|
.block-editor-iframe__body {
|
|
802
802
|
position: relative;
|
|
803
|
+
border: 0.01px solid transparent;
|
|
803
804
|
}
|
|
804
805
|
|
|
805
806
|
.block-editor-iframe__container {
|
|
@@ -820,9 +821,8 @@ _::-webkit-full-page-media, _:future, :root .has-multi-selection .block-editor-b
|
|
|
820
821
|
}
|
|
821
822
|
|
|
822
823
|
.block-editor-iframe__html {
|
|
823
|
-
border: 0 solid #ddd;
|
|
824
824
|
transform-origin: top center;
|
|
825
|
-
transition: all 0.
|
|
825
|
+
transition: all 0.4s cubic-bezier(0.46, 0.03, 0.52, 0.96);
|
|
826
826
|
}
|
|
827
827
|
@media (prefers-reduced-motion: reduce) {
|
|
828
828
|
.block-editor-iframe__html {
|
|
@@ -834,13 +834,12 @@ _::-webkit-full-page-media, _:future, :root .has-multi-selection .block-editor-b
|
|
|
834
834
|
.block-editor-iframe__html.is-zoomed-out {
|
|
835
835
|
transform: scale(var(--wp-block-editor-iframe-zoom-out-scale));
|
|
836
836
|
background-color: #ddd;
|
|
837
|
-
|
|
838
|
-
|
|
837
|
+
margin-bottom: calc(-1 * calc(calc(var(--wp-block-editor-iframe-zoom-out-content-height) * (1 - var(--wp-block-editor-iframe-zoom-out-scale))) + calc(2 * var(--wp-block-editor-iframe-zoom-out-frame-size) / var(--wp-block-editor-iframe-zoom-out-scale)) + 2px));
|
|
838
|
+
padding-top: calc(var(--wp-block-editor-iframe-zoom-out-frame-size) / var(--wp-block-editor-iframe-zoom-out-scale));
|
|
839
|
+
padding-bottom: calc(var(--wp-block-editor-iframe-zoom-out-frame-size) / var(--wp-block-editor-iframe-zoom-out-scale));
|
|
839
840
|
}
|
|
840
841
|
.block-editor-iframe__html.is-zoomed-out body {
|
|
841
|
-
min-height: calc((var(--wp-block-editor-iframe-zoom-out-inner-height) - calc(2 * var(--wp-block-editor-iframe-zoom-out-frame-size))) / var(--wp-block-editor-iframe-zoom-out-scale));
|
|
842
|
-
display: flex;
|
|
843
|
-
flex-direction: column;
|
|
842
|
+
min-height: calc((var(--wp-block-editor-iframe-zoom-out-inner-height) - calc(2 * var(--wp-block-editor-iframe-zoom-out-frame-size) / var(--wp-block-editor-iframe-zoom-out-scale))) / var(--wp-block-editor-iframe-zoom-out-scale));
|
|
844
843
|
}
|
|
845
844
|
.block-editor-iframe__html.is-zoomed-out body > .is-root-container:not(.wp-block-post-content) {
|
|
846
845
|
flex: 1;
|
package/build-style/content.css
CHANGED
|
@@ -800,6 +800,7 @@ _::-webkit-full-page-media, _:future, :root .has-multi-selection .block-editor-b
|
|
|
800
800
|
|
|
801
801
|
.block-editor-iframe__body {
|
|
802
802
|
position: relative;
|
|
803
|
+
border: 0.01px solid transparent;
|
|
803
804
|
}
|
|
804
805
|
|
|
805
806
|
.block-editor-iframe__container {
|
|
@@ -820,9 +821,8 @@ _::-webkit-full-page-media, _:future, :root .has-multi-selection .block-editor-b
|
|
|
820
821
|
}
|
|
821
822
|
|
|
822
823
|
.block-editor-iframe__html {
|
|
823
|
-
border: 0 solid #ddd;
|
|
824
824
|
transform-origin: top center;
|
|
825
|
-
transition: all 0.
|
|
825
|
+
transition: all 0.4s cubic-bezier(0.46, 0.03, 0.52, 0.96);
|
|
826
826
|
}
|
|
827
827
|
@media (prefers-reduced-motion: reduce) {
|
|
828
828
|
.block-editor-iframe__html {
|
|
@@ -834,13 +834,12 @@ _::-webkit-full-page-media, _:future, :root .has-multi-selection .block-editor-b
|
|
|
834
834
|
.block-editor-iframe__html.is-zoomed-out {
|
|
835
835
|
transform: scale(var(--wp-block-editor-iframe-zoom-out-scale));
|
|
836
836
|
background-color: #ddd;
|
|
837
|
-
|
|
838
|
-
|
|
837
|
+
margin-bottom: calc(-1 * calc(calc(var(--wp-block-editor-iframe-zoom-out-content-height) * (1 - var(--wp-block-editor-iframe-zoom-out-scale))) + calc(2 * var(--wp-block-editor-iframe-zoom-out-frame-size) / var(--wp-block-editor-iframe-zoom-out-scale)) + 2px));
|
|
838
|
+
padding-top: calc(var(--wp-block-editor-iframe-zoom-out-frame-size) / var(--wp-block-editor-iframe-zoom-out-scale));
|
|
839
|
+
padding-bottom: calc(var(--wp-block-editor-iframe-zoom-out-frame-size) / var(--wp-block-editor-iframe-zoom-out-scale));
|
|
839
840
|
}
|
|
840
841
|
.block-editor-iframe__html.is-zoomed-out body {
|
|
841
|
-
min-height: calc((var(--wp-block-editor-iframe-zoom-out-inner-height) - calc(2 * var(--wp-block-editor-iframe-zoom-out-frame-size))) / var(--wp-block-editor-iframe-zoom-out-scale));
|
|
842
|
-
display: flex;
|
|
843
|
-
flex-direction: column;
|
|
842
|
+
min-height: calc((var(--wp-block-editor-iframe-zoom-out-inner-height) - calc(2 * var(--wp-block-editor-iframe-zoom-out-frame-size) / var(--wp-block-editor-iframe-zoom-out-scale))) / var(--wp-block-editor-iframe-zoom-out-scale));
|
|
844
843
|
}
|
|
845
844
|
.block-editor-iframe__html.is-zoomed-out body > .is-root-container:not(.wp-block-post-content) {
|
|
846
845
|
flex: 1;
|
|
@@ -270,7 +270,7 @@ iframe[name=editor-canvas] {
|
|
|
270
270
|
height: 100%;
|
|
271
271
|
display: block;
|
|
272
272
|
background-color: transparent;
|
|
273
|
-
transition: all 0.
|
|
273
|
+
transition: all 0.4s cubic-bezier(0.46, 0.03, 0.52, 0.96);
|
|
274
274
|
}
|
|
275
275
|
@media (prefers-reduced-motion: reduce) {
|
|
276
276
|
iframe[name=editor-canvas] {
|
|
@@ -2430,6 +2430,14 @@ iframe[name=editor-canvas] {
|
|
|
2430
2430
|
.block-editor-list-view-leaf .block-editor-list-view-block-select-button:hover {
|
|
2431
2431
|
color: var(--wp-admin-theme-color);
|
|
2432
2432
|
}
|
|
2433
|
+
.block-editor-list-view-leaf .block-editor-list-view-block-select-button svg {
|
|
2434
|
+
fill: currentColor;
|
|
2435
|
+
}
|
|
2436
|
+
@media (forced-colors: active) {
|
|
2437
|
+
.block-editor-list-view-leaf .block-editor-list-view-block-select-button svg {
|
|
2438
|
+
fill: CanvasText;
|
|
2439
|
+
}
|
|
2440
|
+
}
|
|
2433
2441
|
.is-dragging-components-draggable .block-editor-list-view-leaf:not(.is-selected) .block-editor-list-view-block-select-button:hover {
|
|
2434
2442
|
color: inherit;
|
|
2435
2443
|
}
|
package/build-style/style.css
CHANGED
|
@@ -270,7 +270,7 @@ iframe[name=editor-canvas] {
|
|
|
270
270
|
height: 100%;
|
|
271
271
|
display: block;
|
|
272
272
|
background-color: transparent;
|
|
273
|
-
transition: all 0.
|
|
273
|
+
transition: all 0.4s cubic-bezier(0.46, 0.03, 0.52, 0.96);
|
|
274
274
|
}
|
|
275
275
|
@media (prefers-reduced-motion: reduce) {
|
|
276
276
|
iframe[name=editor-canvas] {
|
|
@@ -2431,6 +2431,14 @@ iframe[name=editor-canvas] {
|
|
|
2431
2431
|
.block-editor-list-view-leaf .block-editor-list-view-block-select-button:hover {
|
|
2432
2432
|
color: var(--wp-admin-theme-color);
|
|
2433
2433
|
}
|
|
2434
|
+
.block-editor-list-view-leaf .block-editor-list-view-block-select-button svg {
|
|
2435
|
+
fill: currentColor;
|
|
2436
|
+
}
|
|
2437
|
+
@media (forced-colors: active) {
|
|
2438
|
+
.block-editor-list-view-leaf .block-editor-list-view-block-select-button svg {
|
|
2439
|
+
fill: CanvasText;
|
|
2440
|
+
}
|
|
2441
|
+
}
|
|
2434
2442
|
.is-dragging-components-draggable .block-editor-list-view-leaf:not(.is-selected) .block-editor-list-view-block-select-button:hover {
|
|
2435
2443
|
color: inherit;
|
|
2436
2444
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wordpress/block-editor",
|
|
3
|
-
"version": "14.3.
|
|
3
|
+
"version": "14.3.6",
|
|
4
4
|
"description": "Generic block editor.",
|
|
5
5
|
"author": "The WordPress Contributors",
|
|
6
6
|
"license": "GPL-2.0-or-later",
|
|
@@ -41,8 +41,8 @@
|
|
|
41
41
|
"@wordpress/blob": "^4.8.1",
|
|
42
42
|
"@wordpress/block-serialization-default-parser": "^5.8.1",
|
|
43
43
|
"@wordpress/blocks": "^13.8.4",
|
|
44
|
-
"@wordpress/commands": "^1.8.
|
|
45
|
-
"@wordpress/components": "^28.8.
|
|
44
|
+
"@wordpress/commands": "^1.8.6",
|
|
45
|
+
"@wordpress/components": "^28.8.6",
|
|
46
46
|
"@wordpress/compose": "^7.8.3",
|
|
47
47
|
"@wordpress/data": "^10.8.3",
|
|
48
48
|
"@wordpress/date": "^5.8.2",
|
|
@@ -58,7 +58,7 @@
|
|
|
58
58
|
"@wordpress/keyboard-shortcuts": "^5.8.3",
|
|
59
59
|
"@wordpress/keycodes": "^4.8.2",
|
|
60
60
|
"@wordpress/notices": "^5.8.3",
|
|
61
|
-
"@wordpress/preferences": "^4.8.
|
|
61
|
+
"@wordpress/preferences": "^4.8.6",
|
|
62
62
|
"@wordpress/private-apis": "^1.8.1",
|
|
63
63
|
"@wordpress/rich-text": "^7.8.3",
|
|
64
64
|
"@wordpress/style-engine": "^2.8.1",
|
|
@@ -88,5 +88,5 @@
|
|
|
88
88
|
"publishConfig": {
|
|
89
89
|
"access": "public"
|
|
90
90
|
},
|
|
91
|
-
"gitHead": "
|
|
91
|
+
"gitHead": "b7af02f8431034ee19cdc33dd105d21705823eed"
|
|
92
92
|
}
|
|
@@ -710,7 +710,6 @@ function BlockListBlockProvider( props ) {
|
|
|
710
710
|
) && hasSelectedInnerBlock( clientId ),
|
|
711
711
|
blockApiVersion: blockType?.apiVersion || 1,
|
|
712
712
|
blockTitle: match?.title || blockType?.title,
|
|
713
|
-
editorMode,
|
|
714
713
|
isSubtreeDisabled:
|
|
715
714
|
blockEditingMode === 'disabled' &&
|
|
716
715
|
isBlockSubtreeDisabled( clientId ),
|
|
@@ -766,7 +765,6 @@ function BlockListBlockProvider( props ) {
|
|
|
766
765
|
themeSupportsLayout,
|
|
767
766
|
isTemporarilyEditingAsBlocks,
|
|
768
767
|
blockEditingMode,
|
|
769
|
-
editorMode,
|
|
770
768
|
mayDisplayControls,
|
|
771
769
|
mayDisplayParentControls,
|
|
772
770
|
index,
|
|
@@ -821,7 +819,6 @@ function BlockListBlockProvider( props ) {
|
|
|
821
819
|
hasOverlay,
|
|
822
820
|
initialPosition,
|
|
823
821
|
blockEditingMode,
|
|
824
|
-
editorMode,
|
|
825
822
|
isHighlighted,
|
|
826
823
|
isMultiSelected,
|
|
827
824
|
isPartiallySelected,
|
|
@@ -86,7 +86,6 @@ export function useBlockProps( props = {}, { __unstableIsHtml } = {} ) {
|
|
|
86
86
|
name,
|
|
87
87
|
blockApiVersion,
|
|
88
88
|
blockTitle,
|
|
89
|
-
editorMode,
|
|
90
89
|
isSelected,
|
|
91
90
|
isSubtreeDisabled,
|
|
92
91
|
hasOverlay,
|
|
@@ -117,7 +116,7 @@ export function useBlockProps( props = {}, { __unstableIsHtml } = {} ) {
|
|
|
117
116
|
useFocusHandler( clientId ),
|
|
118
117
|
useEventHandlers( { clientId, isSelected } ),
|
|
119
118
|
useNavModeExit( clientId ),
|
|
120
|
-
useZoomOutModeExit(
|
|
119
|
+
useZoomOutModeExit(),
|
|
121
120
|
useIsHovered( { clientId } ),
|
|
122
121
|
useIntersectionObserver(),
|
|
123
122
|
useMovingAnimation( { triggerAnimationOnChange: index, clientId } ),
|
|
@@ -12,25 +12,27 @@ import { unlock } from '../../../lock-unlock';
|
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
14
|
* Allows Zoom Out mode to be exited by double clicking in the selected block.
|
|
15
|
-
*
|
|
16
|
-
* @param {string} clientId Block client ID.
|
|
17
15
|
*/
|
|
18
|
-
export function useZoomOutModeExit(
|
|
19
|
-
const { getSettings, isZoomOut } = unlock(
|
|
16
|
+
export function useZoomOutModeExit() {
|
|
17
|
+
const { getSettings, isZoomOut, __unstableGetEditorMode } = unlock(
|
|
18
|
+
useSelect( blockEditorStore )
|
|
19
|
+
);
|
|
20
|
+
|
|
20
21
|
const { __unstableSetEditorMode, resetZoomLevel } = unlock(
|
|
21
22
|
useDispatch( blockEditorStore )
|
|
22
23
|
);
|
|
23
24
|
|
|
24
25
|
return useRefEffect(
|
|
25
26
|
( node ) => {
|
|
26
|
-
|
|
27
|
-
|
|
27
|
+
function onDoubleClick( event ) {
|
|
28
|
+
// In "compose" mode.
|
|
29
|
+
const composeMode =
|
|
30
|
+
__unstableGetEditorMode() === 'zoom-out' && isZoomOut();
|
|
28
31
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
+
if ( ! composeMode ) {
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
32
35
|
|
|
33
|
-
function onDoubleClick( event ) {
|
|
34
36
|
if ( ! event.defaultPrevented ) {
|
|
35
37
|
event.preventDefault();
|
|
36
38
|
|
|
@@ -52,6 +54,12 @@ export function useZoomOutModeExit( { editorMode } ) {
|
|
|
52
54
|
node.removeEventListener( 'dblclick', onDoubleClick );
|
|
53
55
|
};
|
|
54
56
|
},
|
|
55
|
-
[
|
|
57
|
+
[
|
|
58
|
+
getSettings,
|
|
59
|
+
__unstableSetEditorMode,
|
|
60
|
+
__unstableGetEditorMode,
|
|
61
|
+
isZoomOut,
|
|
62
|
+
resetZoomLevel,
|
|
63
|
+
]
|
|
56
64
|
);
|
|
57
65
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
.block-editor-iframe__body {
|
|
2
2
|
position: relative;
|
|
3
|
+
border: 0.01px solid transparent;
|
|
3
4
|
}
|
|
4
5
|
|
|
5
6
|
.block-editor-iframe__container {
|
|
@@ -22,7 +23,6 @@
|
|
|
22
23
|
}
|
|
23
24
|
|
|
24
25
|
.block-editor-iframe__html {
|
|
25
|
-
border: 0 solid $gray-300;
|
|
26
26
|
transform-origin: top center;
|
|
27
27
|
@include editor-canvas-resize-animation;
|
|
28
28
|
}
|
|
@@ -38,21 +38,20 @@
|
|
|
38
38
|
|
|
39
39
|
background-color: $gray-300;
|
|
40
40
|
|
|
41
|
-
// Firefox and Safari don't render margin-bottom here and margin-bottom is needed for Chrome
|
|
42
|
-
// layout, so we use border matching the background instead of margins.
|
|
43
|
-
border: calc(#{$frame-size} / #{$scale}) solid $gray-300;
|
|
44
|
-
|
|
45
41
|
// Chrome seems to respect that transform scale shouldn't affect the layout size of the element,
|
|
46
42
|
// so we need to adjust the height of the content to match the scale by using negative margins.
|
|
47
43
|
$extra-content-height: calc(#{$content-height} * (1 - #{$scale}));
|
|
48
|
-
$total-frame-height: calc(2 * #{$frame-size});
|
|
44
|
+
$total-frame-height: calc(2 * #{$frame-size} / #{$scale});
|
|
49
45
|
$total-height: calc(#{$extra-content-height} + #{$total-frame-height} + 2px);
|
|
50
46
|
margin-bottom: calc(-1 * #{$total-height});
|
|
47
|
+
// Add the top/bottom frame size. We use scaling to account for the left/right, as
|
|
48
|
+
// the padding left/right causes the contents to reflow, which breaks the 1:1 scaling
|
|
49
|
+
// of the content.
|
|
50
|
+
padding-top: calc(#{$frame-size} / #{$scale});
|
|
51
|
+
padding-bottom: calc(#{$frame-size} / #{$scale});
|
|
51
52
|
|
|
52
53
|
body {
|
|
53
54
|
min-height: calc((#{$inner-height} - #{$total-frame-height}) / #{$scale});
|
|
54
|
-
display: flex;
|
|
55
|
-
flex-direction: column;
|
|
56
55
|
|
|
57
56
|
> .is-root-container:not(.wp-block-post-content) {
|
|
58
57
|
flex: 1;
|
|
@@ -306,13 +306,19 @@ function Iframe( {
|
|
|
306
306
|
iframeDocument.documentElement.classList.add( 'is-zoomed-out' );
|
|
307
307
|
|
|
308
308
|
const maxWidth = 750;
|
|
309
|
+
// This scaling calculation has to happen within the JS because CSS calc() can
|
|
310
|
+
// only divide and multiply by a unitless value. I.e. calc( 100px / 2 ) is valid
|
|
311
|
+
// but calc( 100px / 2px ) is not.
|
|
309
312
|
iframeDocument.documentElement.style.setProperty(
|
|
310
313
|
'--wp-block-editor-iframe-zoom-out-scale',
|
|
311
314
|
scale === 'default'
|
|
312
|
-
? Math.min( containerWidth, maxWidth )
|
|
315
|
+
? ( Math.min( containerWidth, maxWidth ) -
|
|
316
|
+
parseInt( frameSize ) * 2 ) /
|
|
313
317
|
prevContainerWidthRef.current
|
|
314
318
|
: scale
|
|
315
319
|
);
|
|
320
|
+
|
|
321
|
+
// frameSize has to be a px value for the scaling and frame size to be computed correctly.
|
|
316
322
|
iframeDocument.documentElement.style.setProperty(
|
|
317
323
|
'--wp-block-editor-iframe-zoom-out-frame-size',
|
|
318
324
|
typeof frameSize === 'number' ? `${ frameSize }px` : frameSize
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
.block-editor-iframe__container {
|
|
2
|
+
width: 100%;
|
|
3
|
+
height: 100%;
|
|
4
|
+
overflow-x: hidden;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
.block-editor-iframe__scale-container {
|
|
8
|
+
height: 100%;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
.block-editor-iframe__scale-container.is-zoomed-out {
|
|
12
|
+
$container-width: var(--wp-block-editor-iframe-zoom-out-container-width, 100vw);
|
|
13
|
+
$prev-container-width: var(--wp-block-editor-iframe-zoom-out-prev-container-width, 100vw);
|
|
14
|
+
width: $prev-container-width;
|
|
15
|
+
// This is to offset the movement of the iframe when we open sidebars
|
|
16
|
+
margin-left: calc(-1 * (#{$prev-container-width} - #{$container-width}) / 2);
|
|
17
|
+
}
|
|
@@ -32,6 +32,7 @@ import InserterSearchResults from './search-results';
|
|
|
32
32
|
import useInsertionPoint from './hooks/use-insertion-point';
|
|
33
33
|
import { store as blockEditorStore } from '../../store';
|
|
34
34
|
import TabbedSidebar from '../tabbed-sidebar';
|
|
35
|
+
import { useZoomOut } from '../../hooks/use-zoom-out';
|
|
35
36
|
|
|
36
37
|
const NOOP = () => {};
|
|
37
38
|
function InserterMenu(
|
|
@@ -77,6 +78,10 @@ function InserterMenu(
|
|
|
77
78
|
}
|
|
78
79
|
const [ selectedTab, setSelectedTab ] = useState( getInitialTab() );
|
|
79
80
|
|
|
81
|
+
const shouldUseZoomOut =
|
|
82
|
+
selectedTab === 'patterns' || selectedTab === 'media';
|
|
83
|
+
useZoomOut( shouldUseZoomOut );
|
|
84
|
+
|
|
80
85
|
const [ destinationRootClientId, onInsertBlocks, onToggleInsertionPoint ] =
|
|
81
86
|
useInsertionPoint( {
|
|
82
87
|
rootClientId,
|
|
@@ -41,6 +41,15 @@
|
|
|
41
41
|
&:hover {
|
|
42
42
|
color: var(--wp-admin-theme-color);
|
|
43
43
|
}
|
|
44
|
+
|
|
45
|
+
svg {
|
|
46
|
+
fill: currentColor;
|
|
47
|
+
// Optimizate for high contrast modes.
|
|
48
|
+
// See also https://blogs.windows.com/msedgedev/2020/09/17/styling-for-windows-high-contrast-with-new-standards-for-forced-colors/.
|
|
49
|
+
@media (forced-colors: active) {
|
|
50
|
+
fill: CanvasText;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
44
53
|
}
|
|
45
54
|
|
|
46
55
|
&:not(.is-selected) .block-editor-list-view-block-select-button {
|
|
@@ -36,7 +36,7 @@ function ToolSelector( props, ref ) {
|
|
|
36
36
|
( select ) => select( blockEditorStore ).__unstableGetEditorMode(),
|
|
37
37
|
[]
|
|
38
38
|
);
|
|
39
|
-
const { __unstableSetEditorMode } = unlock(
|
|
39
|
+
const { resetZoomLevel, __unstableSetEditorMode } = unlock(
|
|
40
40
|
useDispatch( blockEditorStore )
|
|
41
41
|
);
|
|
42
42
|
|
|
@@ -63,7 +63,10 @@ function ToolSelector( props, ref ) {
|
|
|
63
63
|
value={
|
|
64
64
|
mode === 'navigation' ? 'navigation' : 'edit'
|
|
65
65
|
}
|
|
66
|
-
onSelect={
|
|
66
|
+
onSelect={ ( newMode ) => {
|
|
67
|
+
resetZoomLevel();
|
|
68
|
+
__unstableSetEditorMode( newMode );
|
|
69
|
+
} }
|
|
67
70
|
choices={ [
|
|
68
71
|
{
|
|
69
72
|
value: 'edit',
|
|
@@ -43,11 +43,9 @@ export default function useResizeCanvas( deviceType ) {
|
|
|
43
43
|
return deviceWidth < actualWidth ? deviceWidth : actualWidth;
|
|
44
44
|
};
|
|
45
45
|
|
|
46
|
-
const marginValue = () => ( window.innerHeight < 800 ? 36 : 64 );
|
|
47
|
-
|
|
48
46
|
const contentInlineStyles = ( device ) => {
|
|
49
47
|
const height = device === 'Mobile' ? '768px' : '1024px';
|
|
50
|
-
const marginVertical =
|
|
48
|
+
const marginVertical = '40px';
|
|
51
49
|
const marginHorizontal = 'auto';
|
|
52
50
|
|
|
53
51
|
switch ( device ) {
|
|
@@ -16,20 +16,34 @@ function GridLayoutSync( props ) {
|
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
function GridTools( { clientId, layout } ) {
|
|
19
|
-
const
|
|
20
|
-
|
|
21
|
-
|
|
19
|
+
const isVisible = useSelect(
|
|
20
|
+
( select ) => {
|
|
21
|
+
const {
|
|
22
|
+
isBlockSelected,
|
|
23
|
+
isDraggingBlocks,
|
|
24
|
+
getTemplateLock,
|
|
25
|
+
getBlockEditingMode,
|
|
26
|
+
} = select( blockEditorStore );
|
|
22
27
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
+
// These calls are purposely ordered from least expensive to most expensive.
|
|
29
|
+
// Hides the visualizer in cases where the user is not or cannot interact with it.
|
|
30
|
+
if (
|
|
31
|
+
( ! isDraggingBlocks() && ! isBlockSelected( clientId ) ) ||
|
|
32
|
+
getTemplateLock( clientId ) ||
|
|
33
|
+
getBlockEditingMode( clientId ) !== 'default'
|
|
34
|
+
) {
|
|
35
|
+
return false;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
return true;
|
|
39
|
+
},
|
|
40
|
+
[ clientId ]
|
|
41
|
+
);
|
|
28
42
|
|
|
29
43
|
return (
|
|
30
44
|
<>
|
|
31
45
|
<GridLayoutSync clientId={ clientId } />
|
|
32
|
-
{
|
|
46
|
+
{ isVisible && (
|
|
33
47
|
<GridVisualizer clientId={ clientId } parentLayout={ layout } />
|
|
34
48
|
) }
|
|
35
49
|
</>
|
|
@@ -172,9 +172,54 @@ function ChildLayoutControlsPure( { clientId, style, setAttributes } ) {
|
|
|
172
172
|
isManualPlacement,
|
|
173
173
|
} = parentLayout;
|
|
174
174
|
|
|
175
|
-
|
|
175
|
+
if ( parentLayoutType !== 'grid' ) {
|
|
176
|
+
return null;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
return (
|
|
180
|
+
<GridTools
|
|
181
|
+
clientId={ clientId }
|
|
182
|
+
style={ style }
|
|
183
|
+
setAttributes={ setAttributes }
|
|
184
|
+
allowSizingOnChildren={ allowSizingOnChildren }
|
|
185
|
+
isManualPlacement={ isManualPlacement }
|
|
186
|
+
parentLayout={ parentLayout }
|
|
187
|
+
/>
|
|
188
|
+
);
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
function GridTools( {
|
|
192
|
+
clientId,
|
|
193
|
+
style,
|
|
194
|
+
setAttributes,
|
|
195
|
+
allowSizingOnChildren,
|
|
196
|
+
isManualPlacement,
|
|
197
|
+
parentLayout,
|
|
198
|
+
} ) {
|
|
199
|
+
const { rootClientId, isVisible } = useSelect(
|
|
176
200
|
( select ) => {
|
|
177
|
-
|
|
201
|
+
const {
|
|
202
|
+
getBlockRootClientId,
|
|
203
|
+
getBlockEditingMode,
|
|
204
|
+
getTemplateLock,
|
|
205
|
+
} = select( blockEditorStore );
|
|
206
|
+
|
|
207
|
+
const _rootClientId = getBlockRootClientId( clientId );
|
|
208
|
+
|
|
209
|
+
if (
|
|
210
|
+
getTemplateLock( _rootClientId ) ||
|
|
211
|
+
getBlockEditingMode( _rootClientId ) !== 'default'
|
|
212
|
+
) {
|
|
213
|
+
return {
|
|
214
|
+
rootClientId: _rootClientId,
|
|
215
|
+
isVisible: false,
|
|
216
|
+
};
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
return {
|
|
220
|
+
rootClientId: _rootClientId,
|
|
221
|
+
isVisible: true,
|
|
222
|
+
};
|
|
178
223
|
},
|
|
179
224
|
[ clientId ]
|
|
180
225
|
);
|
|
@@ -182,7 +227,7 @@ function ChildLayoutControlsPure( { clientId, style, setAttributes } ) {
|
|
|
182
227
|
// Use useState() instead of useRef() so that GridItemResizer updates when ref is set.
|
|
183
228
|
const [ resizerBounds, setResizerBounds ] = useState();
|
|
184
229
|
|
|
185
|
-
if (
|
|
230
|
+
if ( ! isVisible ) {
|
|
186
231
|
return null;
|
|
187
232
|
}
|
|
188
233
|
|