@wordpress/block-editor 12.19.2 → 12.20.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +2 -0
- package/build/components/block-canvas/index.js +2 -0
- package/build/components/block-canvas/index.js.map +1 -1
- package/build/components/block-heading-level-dropdown/index.js +14 -17
- package/build/components/block-heading-level-dropdown/index.js.map +1 -1
- package/build/components/block-inspector/index.js +0 -3
- package/build/components/block-inspector/index.js.map +1 -1
- package/build/components/block-list/index.js +9 -9
- package/build/components/block-list/index.js.map +1 -1
- package/build/components/block-preview/index.js +4 -0
- package/build/components/block-preview/index.js.map +1 -1
- package/build/components/block-settings-menu/block-parent-selector-menu-item.js +54 -0
- package/build/components/block-settings-menu/block-parent-selector-menu-item.js.map +1 -0
- package/build/components/block-settings-menu/block-settings-dropdown.js +9 -37
- package/build/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
- package/build/components/block-tools/insertion-point.js +4 -1
- package/build/components/block-tools/insertion-point.js.map +1 -1
- package/build/components/child-layout-control/index.js +37 -5
- package/build/components/child-layout-control/index.js.map +1 -1
- package/build/components/date-format-picker/index.js +0 -1
- package/build/components/date-format-picker/index.js.map +1 -1
- package/build/components/font-appearance-control/index.js +1 -2
- package/build/components/font-appearance-control/index.js.map +1 -1
- package/build/components/global-styles/advanced-panel.js +5 -10
- package/build/components/global-styles/advanced-panel.js.map +1 -1
- package/build/components/global-styles/dimensions-panel.js +30 -19
- package/build/components/global-styles/dimensions-panel.js.map +1 -1
- package/build/components/global-styles/shadow-panel-components.js +3 -3
- package/build/components/global-styles/shadow-panel-components.js.map +1 -1
- package/build/components/inserter/media-tab/media-preview.js +1 -1
- package/build/components/inserter/media-tab/media-preview.js.map +1 -1
- package/build/components/inspector-controls-tabs/styles-tab.js +0 -4
- package/build/components/inspector-controls-tabs/styles-tab.js.map +1 -1
- package/build/components/observe-typing/index.js +5 -10
- package/build/components/observe-typing/index.js.map +1 -1
- package/build/components/rich-text/format-toolbar-container.js +1 -31
- package/build/components/rich-text/format-toolbar-container.js.map +1 -1
- package/build/components/rich-text/index.js +8 -5
- package/build/components/rich-text/index.js.map +1 -1
- package/build/components/rich-text/use-paste-handler.js +25 -26
- package/build/components/rich-text/use-paste-handler.js.map +1 -1
- package/build/components/skip-to-selected-block/index.js +7 -14
- package/build/components/skip-to-selected-block/index.js.map +1 -1
- package/build/components/spacing-sizes-control/input-controls/spacing-input-control.js +0 -1
- package/build/components/spacing-sizes-control/input-controls/spacing-input-control.js.map +1 -1
- package/build/components/url-input/index.js +5 -8
- package/build/components/url-input/index.js.map +1 -1
- package/build/hooks/background.js +4 -2
- package/build/hooks/background.js.map +1 -1
- package/build/hooks/layout-child.js +50 -1
- package/build/hooks/layout-child.js.map +1 -1
- package/build/hooks/position.js +0 -1
- package/build/hooks/position.js.map +1 -1
- package/build/layouts/grid.js +105 -12
- package/build/layouts/grid.js.map +1 -1
- package/build/private-apis.js +3 -1
- package/build/private-apis.js.map +1 -1
- package/build/store/actions.js +2 -30
- package/build/store/actions.js.map +1 -1
- package/build/store/index.js +0 -2
- package/build/store/index.js.map +1 -1
- package/build/store/private-keys.js +8 -0
- package/build/store/private-keys.js.map +1 -0
- package/build/store/private-selectors.js +6 -9
- package/build/store/private-selectors.js.map +1 -1
- package/build/store/reducer.js +1 -9
- package/build/store/reducer.js.map +1 -1
- package/build/store/selectors.js +7 -12
- package/build/store/selectors.js.map +1 -1
- package/build/store/utils.js +7 -2
- package/build/store/utils.js.map +1 -1
- package/build-module/components/block-canvas/index.js +2 -0
- package/build-module/components/block-canvas/index.js.map +1 -1
- package/build-module/components/block-heading-level-dropdown/index.js +14 -17
- package/build-module/components/block-heading-level-dropdown/index.js.map +1 -1
- package/build-module/components/block-inspector/index.js +1 -4
- package/build-module/components/block-inspector/index.js.map +1 -1
- package/build-module/components/block-list/index.js +9 -9
- package/build-module/components/block-list/index.js.map +1 -1
- package/build-module/components/block-preview/index.js +4 -0
- package/build-module/components/block-preview/index.js.map +1 -1
- package/build-module/components/block-settings-menu/block-parent-selector-menu-item.js +46 -0
- package/build-module/components/block-settings-menu/block-parent-selector-menu-item.js.map +1 -0
- package/build-module/components/block-settings-menu/block-settings-dropdown.js +12 -40
- package/build-module/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
- package/build-module/components/block-tools/insertion-point.js +4 -1
- package/build-module/components/block-tools/insertion-point.js.map +1 -1
- package/build-module/components/child-layout-control/index.js +38 -6
- package/build-module/components/child-layout-control/index.js.map +1 -1
- package/build-module/components/date-format-picker/index.js +0 -1
- package/build-module/components/date-format-picker/index.js.map +1 -1
- package/build-module/components/font-appearance-control/index.js +1 -2
- package/build-module/components/font-appearance-control/index.js.map +1 -1
- package/build-module/components/global-styles/advanced-panel.js +6 -11
- package/build-module/components/global-styles/advanced-panel.js.map +1 -1
- package/build-module/components/global-styles/dimensions-panel.js +30 -19
- package/build-module/components/global-styles/dimensions-panel.js.map +1 -1
- package/build-module/components/global-styles/shadow-panel-components.js +3 -3
- package/build-module/components/global-styles/shadow-panel-components.js.map +1 -1
- package/build-module/components/inserter/media-tab/media-preview.js +1 -1
- package/build-module/components/inserter/media-tab/media-preview.js.map +1 -1
- package/build-module/components/inspector-controls-tabs/styles-tab.js +0 -4
- package/build-module/components/inspector-controls-tabs/styles-tab.js.map +1 -1
- package/build-module/components/observe-typing/index.js +5 -10
- package/build-module/components/observe-typing/index.js.map +1 -1
- package/build-module/components/rich-text/format-toolbar-container.js +1 -31
- package/build-module/components/rich-text/format-toolbar-container.js.map +1 -1
- package/build-module/components/rich-text/index.js +8 -5
- package/build-module/components/rich-text/index.js.map +1 -1
- package/build-module/components/rich-text/use-paste-handler.js +25 -26
- package/build-module/components/rich-text/use-paste-handler.js.map +1 -1
- package/build-module/components/skip-to-selected-block/index.js +8 -14
- package/build-module/components/skip-to-selected-block/index.js.map +1 -1
- package/build-module/components/spacing-sizes-control/input-controls/spacing-input-control.js +0 -1
- package/build-module/components/spacing-sizes-control/input-controls/spacing-input-control.js.map +1 -1
- package/build-module/components/url-input/index.js +5 -8
- package/build-module/components/url-input/index.js.map +1 -1
- package/build-module/hooks/background.js +4 -2
- package/build-module/hooks/background.js.map +1 -1
- package/build-module/hooks/layout-child.js +50 -1
- package/build-module/hooks/layout-child.js.map +1 -1
- package/build-module/hooks/position.js +0 -1
- package/build-module/hooks/position.js.map +1 -1
- package/build-module/layouts/grid.js +107 -14
- package/build-module/layouts/grid.js.map +1 -1
- package/build-module/private-apis.js +3 -1
- package/build-module/private-apis.js.map +1 -1
- package/build-module/store/actions.js +2 -30
- package/build-module/store/actions.js.map +1 -1
- package/build-module/store/index.js +0 -2
- package/build-module/store/index.js.map +1 -1
- package/build-module/store/private-keys.js +2 -0
- package/build-module/store/private-keys.js.map +1 -0
- package/build-module/store/private-selectors.js +5 -6
- package/build-module/store/private-selectors.js.map +1 -1
- package/build-module/store/reducer.js +1 -9
- package/build-module/store/reducer.js.map +1 -1
- package/build-module/store/selectors.js +8 -13
- package/build-module/store/selectors.js.map +1 -1
- package/build-module/store/utils.js +6 -2
- package/build-module/store/utils.js.map +1 -1
- package/build-style/style-rtl.css +12 -27
- package/build-style/style.css +12 -27
- package/package.json +31 -32
- package/src/components/block-canvas/index.js +2 -0
- package/src/components/block-heading-level-dropdown/index.js +17 -25
- package/src/components/block-inspector/index.js +0 -11
- package/src/components/block-list/index.js +55 -55
- package/src/components/block-preview/index.js +6 -1
- package/src/components/block-settings-menu/block-parent-selector-menu-item.js +50 -0
- package/src/components/block-settings-menu/block-settings-dropdown.js +9 -50
- package/src/components/block-styles/style.scss +0 -4
- package/src/components/block-toolbar/style.scss +11 -6
- package/src/components/block-tools/insertion-point.js +6 -1
- package/src/components/child-layout-control/index.js +85 -44
- package/src/components/date-format-picker/index.js +0 -1
- package/src/components/font-appearance-control/index.js +0 -1
- package/src/components/global-styles/advanced-panel.js +6 -12
- package/src/components/global-styles/dimensions-panel.js +36 -24
- package/src/components/global-styles/shadow-panel-components.js +3 -3
- package/src/components/global-styles/style.scss +0 -10
- package/src/components/global-styles/test/use-global-styles-output.js +3 -2
- package/src/components/inserter/media-tab/media-preview.js +6 -1
- package/src/components/inspector-controls-tabs/styles-tab.js +0 -7
- package/src/components/observe-typing/index.js +7 -10
- package/src/components/rich-text/format-toolbar-container.js +1 -48
- package/src/components/rich-text/index.js +12 -6
- package/src/components/rich-text/use-paste-handler.js +26 -25
- package/src/components/skip-to-selected-block/index.js +10 -13
- package/src/components/spacing-sizes-control/input-controls/spacing-input-control.js +0 -1
- package/src/components/url-input/index.js +6 -15
- package/src/hooks/anchor.scss +1 -1
- package/src/hooks/background.js +5 -2
- package/src/hooks/layout-child.js +53 -1
- package/src/hooks/position.js +0 -1
- package/src/layouts/grid.js +131 -52
- package/src/layouts/test/grid.js +16 -2
- package/src/private-apis.js +2 -0
- package/src/store/actions.js +2 -38
- package/src/store/index.js +0 -2
- package/src/store/private-keys.js +1 -0
- package/src/store/private-selectors.js +4 -7
- package/src/store/reducer.js +0 -10
- package/src/store/selectors.js +7 -15
- package/src/store/test/actions.js +0 -101
- package/src/store/utils.js +7 -2
- package/src/style.scss +0 -1
- package/build/components/default-style-picker/index.js +0 -70
- package/build/components/default-style-picker/index.js.map +0 -1
- package/build/store/resolvers.js +0 -27
- package/build/store/resolvers.js.map +0 -1
- package/build-module/components/default-style-picker/index.js +0 -63
- package/build-module/components/default-style-picker/index.js.map +0 -1
- package/build-module/store/resolvers.js +0 -20
- package/build-module/store/resolvers.js.map +0 -1
- package/src/components/block-settings-menu/style.scss +0 -3
- package/src/components/default-style-picker/index.js +0 -70
- package/src/store/resolvers.js +0 -17
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Internal dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { selectBlockPatternsKey } from './private-keys';
|
|
1
5
|
export const checkAllowList = (list, item, defaultResult = null) => {
|
|
2
6
|
if (typeof list === 'boolean') {
|
|
3
7
|
return list;
|
|
@@ -30,7 +34,7 @@ export const checkAllowListRecursive = (blocks, allowedBlockTypes) => {
|
|
|
30
34
|
}
|
|
31
35
|
return true;
|
|
32
36
|
};
|
|
33
|
-
export const getAllPatternsDependants = state => {
|
|
34
|
-
return [state.settings.__experimentalBlockPatterns, state.settings.__experimentalUserPatternCategories, state.settings.__experimentalReusableBlocks, state.settings
|
|
37
|
+
export const getAllPatternsDependants = select => state => {
|
|
38
|
+
return [state.settings.__experimentalBlockPatterns, state.settings.__experimentalUserPatternCategories, state.settings.__experimentalReusableBlocks, state.settings[selectBlockPatternsKey]?.(select), state.blockPatterns];
|
|
35
39
|
};
|
|
36
40
|
//# sourceMappingURL=utils.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["checkAllowList","list","item","defaultResult","Array","isArray","includes","checkAllowListRecursive","blocks","allowedBlockTypes","blocksQueue","length","block","shift","isAllowed","name","blockName","innerBlocks","forEach","innerBlock","push","getAllPatternsDependants","state","settings","__experimentalBlockPatterns","__experimentalUserPatternCategories","__experimentalReusableBlocks","
|
|
1
|
+
{"version":3,"names":["selectBlockPatternsKey","checkAllowList","list","item","defaultResult","Array","isArray","includes","checkAllowListRecursive","blocks","allowedBlockTypes","blocksQueue","length","block","shift","isAllowed","name","blockName","innerBlocks","forEach","innerBlock","push","getAllPatternsDependants","select","state","settings","__experimentalBlockPatterns","__experimentalUserPatternCategories","__experimentalReusableBlocks","blockPatterns"],"sources":["@wordpress/block-editor/src/store/utils.js"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport { selectBlockPatternsKey } from './private-keys';\n\nexport const checkAllowList = ( list, item, defaultResult = null ) => {\n\tif ( typeof list === 'boolean' ) {\n\t\treturn list;\n\t}\n\tif ( Array.isArray( list ) ) {\n\t\t// TODO: when there is a canonical way to detect that we are editing a post\n\t\t// the following check should be changed to something like:\n\t\t// if ( list.includes( 'core/post-content' ) && getEditorMode() === 'post-content' && item === null )\n\t\tif ( list.includes( 'core/post-content' ) && item === null ) {\n\t\t\treturn true;\n\t\t}\n\t\treturn list.includes( item );\n\t}\n\treturn defaultResult;\n};\n\nexport const checkAllowListRecursive = ( blocks, allowedBlockTypes ) => {\n\tif ( typeof allowedBlockTypes === 'boolean' ) {\n\t\treturn allowedBlockTypes;\n\t}\n\n\tconst blocksQueue = [ ...blocks ];\n\twhile ( blocksQueue.length > 0 ) {\n\t\tconst block = blocksQueue.shift();\n\n\t\tconst isAllowed = checkAllowList(\n\t\t\tallowedBlockTypes,\n\t\t\tblock.name || block.blockName,\n\t\t\ttrue\n\t\t);\n\t\tif ( ! isAllowed ) {\n\t\t\treturn false;\n\t\t}\n\n\t\tblock.innerBlocks?.forEach( ( innerBlock ) => {\n\t\t\tblocksQueue.push( innerBlock );\n\t\t} );\n\t}\n\n\treturn true;\n};\n\nexport const getAllPatternsDependants = ( select ) => ( state ) => {\n\treturn [\n\t\tstate.settings.__experimentalBlockPatterns,\n\t\tstate.settings.__experimentalUserPatternCategories,\n\t\tstate.settings.__experimentalReusableBlocks,\n\t\tstate.settings[ selectBlockPatternsKey ]?.( select ),\n\t\tstate.blockPatterns,\n\t];\n};\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,sBAAsB,QAAQ,gBAAgB;AAEvD,OAAO,MAAMC,cAAc,GAAGA,CAAEC,IAAI,EAAEC,IAAI,EAAEC,aAAa,GAAG,IAAI,KAAM;EACrE,IAAK,OAAOF,IAAI,KAAK,SAAS,EAAG;IAChC,OAAOA,IAAI;EACZ;EACA,IAAKG,KAAK,CAACC,OAAO,CAAEJ,IAAK,CAAC,EAAG;IAC5B;IACA;IACA;IACA,IAAKA,IAAI,CAACK,QAAQ,CAAE,mBAAoB,CAAC,IAAIJ,IAAI,KAAK,IAAI,EAAG;MAC5D,OAAO,IAAI;IACZ;IACA,OAAOD,IAAI,CAACK,QAAQ,CAAEJ,IAAK,CAAC;EAC7B;EACA,OAAOC,aAAa;AACrB,CAAC;AAED,OAAO,MAAMI,uBAAuB,GAAGA,CAAEC,MAAM,EAAEC,iBAAiB,KAAM;EACvE,IAAK,OAAOA,iBAAiB,KAAK,SAAS,EAAG;IAC7C,OAAOA,iBAAiB;EACzB;EAEA,MAAMC,WAAW,GAAG,CAAE,GAAGF,MAAM,CAAE;EACjC,OAAQE,WAAW,CAACC,MAAM,GAAG,CAAC,EAAG;IAChC,MAAMC,KAAK,GAAGF,WAAW,CAACG,KAAK,CAAC,CAAC;IAEjC,MAAMC,SAAS,GAAGd,cAAc,CAC/BS,iBAAiB,EACjBG,KAAK,CAACG,IAAI,IAAIH,KAAK,CAACI,SAAS,EAC7B,IACD,CAAC;IACD,IAAK,CAAEF,SAAS,EAAG;MAClB,OAAO,KAAK;IACb;IAEAF,KAAK,CAACK,WAAW,EAAEC,OAAO,CAAIC,UAAU,IAAM;MAC7CT,WAAW,CAACU,IAAI,CAAED,UAAW,CAAC;IAC/B,CAAE,CAAC;EACJ;EAEA,OAAO,IAAI;AACZ,CAAC;AAED,OAAO,MAAME,wBAAwB,GAAKC,MAAM,IAAQC,KAAK,IAAM;EAClE,OAAO,CACNA,KAAK,CAACC,QAAQ,CAACC,2BAA2B,EAC1CF,KAAK,CAACC,QAAQ,CAACE,mCAAmC,EAClDH,KAAK,CAACC,QAAQ,CAACG,4BAA4B,EAC3CJ,KAAK,CAACC,QAAQ,CAAEzB,sBAAsB,CAAE,GAAIuB,MAAO,CAAC,EACpDC,KAAK,CAACK,aAAa,CACnB;AACF,CAAC"}
|
|
@@ -782,7 +782,7 @@ iframe[name=editor-canvas].has-editor-padding {
|
|
|
782
782
|
outline: none;
|
|
783
783
|
}
|
|
784
784
|
.components-button.block-editor-block-mover-button:focus-visible::before {
|
|
785
|
-
box-shadow: inset 0 0 0 1px
|
|
785
|
+
box-shadow: inset 0 0 0 1px #fff, 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color);
|
|
786
786
|
outline: 2px solid transparent;
|
|
787
787
|
}
|
|
788
788
|
|
|
@@ -957,14 +957,6 @@ iframe[name=editor-canvas].has-editor-padding {
|
|
|
957
957
|
z-index: 1000001;
|
|
958
958
|
}
|
|
959
959
|
|
|
960
|
-
.block-editor-block-settings-menu__popover .components-dropdown-menu__menu {
|
|
961
|
-
padding: 0;
|
|
962
|
-
}
|
|
963
|
-
|
|
964
|
-
.block-editor-block-styles + .default-style-picker__default-switcher {
|
|
965
|
-
margin-top: 16px;
|
|
966
|
-
}
|
|
967
|
-
|
|
968
960
|
.block-editor-block-styles__preview-panel {
|
|
969
961
|
display: none;
|
|
970
962
|
z-index: 90;
|
|
@@ -1002,7 +994,7 @@ iframe[name=editor-canvas].has-editor-padding {
|
|
|
1002
994
|
color: #fff;
|
|
1003
995
|
}
|
|
1004
996
|
.block-editor-block-styles__variants button.components-button.block-editor-block-styles__item:focus, .block-editor-block-styles__variants button.components-button.block-editor-block-styles__item.is-active:focus {
|
|
1005
|
-
box-shadow: inset 0 0 0 1px
|
|
997
|
+
box-shadow: inset 0 0 0 1px #fff, 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color);
|
|
1006
998
|
outline: 2px solid transparent;
|
|
1007
999
|
}
|
|
1008
1000
|
.block-editor-block-styles__variants .block-editor-block-styles__item-text {
|
|
@@ -1587,16 +1579,6 @@ iframe[name=editor-canvas].has-editor-padding {
|
|
|
1587
1579
|
direction: ltr;
|
|
1588
1580
|
}
|
|
1589
1581
|
|
|
1590
|
-
.block-editor-global-styles-advanced-panel__custom-css-validation-wrapper {
|
|
1591
|
-
position: absolute;
|
|
1592
|
-
bottom: 16px;
|
|
1593
|
-
left: 24px;
|
|
1594
|
-
}
|
|
1595
|
-
|
|
1596
|
-
.block-editor-global-styles-advanced-panel__custom-css-validation-icon {
|
|
1597
|
-
fill: #cc1818;
|
|
1598
|
-
}
|
|
1599
|
-
|
|
1600
1582
|
.block-editor-height-control {
|
|
1601
1583
|
border: 0;
|
|
1602
1584
|
margin: 0;
|
|
@@ -2015,7 +1997,7 @@ iframe[name=editor-canvas].has-editor-padding {
|
|
|
2015
1997
|
box-shadow: none;
|
|
2016
1998
|
}
|
|
2017
1999
|
.block-editor-link-control__search-item .block-editor-link-control__search-item-title:focus-visible {
|
|
2018
|
-
box-shadow: inset 0 0 0 1px
|
|
2000
|
+
box-shadow: inset 0 0 0 1px #fff, 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color);
|
|
2019
2001
|
outline: 2px solid transparent;
|
|
2020
2002
|
text-decoration: none;
|
|
2021
2003
|
}
|
|
@@ -3160,7 +3142,7 @@ iframe[name=editor-canvas].has-editor-padding {
|
|
|
3160
3142
|
}
|
|
3161
3143
|
|
|
3162
3144
|
.html-anchor-control .components-external-link {
|
|
3163
|
-
display: block;
|
|
3145
|
+
display: inline-block;
|
|
3164
3146
|
margin-top: 8px;
|
|
3165
3147
|
}
|
|
3166
3148
|
|
|
@@ -3531,16 +3513,14 @@ iframe[name=editor-canvas].has-editor-padding {
|
|
|
3531
3513
|
}
|
|
3532
3514
|
.show-icon-labels .block-editor-block-mover .block-editor-block-mover__move-button-container {
|
|
3533
3515
|
width: auto;
|
|
3516
|
+
position: relative;
|
|
3534
3517
|
}
|
|
3535
3518
|
@media (min-width: 600px) {
|
|
3536
|
-
.show-icon-labels .block-editor-block-mover .block-editor-block-mover__move-button-container {
|
|
3537
|
-
position: relative;
|
|
3538
|
-
}
|
|
3539
|
-
.show-icon-labels .block-editor-block-mover .block-editor-block-mover__move-button-container::before {
|
|
3519
|
+
.show-icon-labels .block-editor-block-mover:not(.is-horizontal) .block-editor-block-mover__move-button-container::before {
|
|
3540
3520
|
content: "";
|
|
3541
3521
|
height: 1px;
|
|
3542
3522
|
width: 100%;
|
|
3543
|
-
background: #
|
|
3523
|
+
background: #e0e0e0;
|
|
3544
3524
|
position: absolute;
|
|
3545
3525
|
top: 50%;
|
|
3546
3526
|
right: 50%;
|
|
@@ -3548,6 +3528,11 @@ iframe[name=editor-canvas].has-editor-padding {
|
|
|
3548
3528
|
margin-top: -0.5px;
|
|
3549
3529
|
}
|
|
3550
3530
|
}
|
|
3531
|
+
@media (min-width: 782px) {
|
|
3532
|
+
.show-icon-labels .block-editor-block-mover:not(.is-horizontal) .block-editor-block-mover__move-button-container::before {
|
|
3533
|
+
background: #1e1e1e;
|
|
3534
|
+
}
|
|
3535
|
+
}
|
|
3551
3536
|
.show-icon-labels .block-editor-block-mover.is-horizontal .block-editor-block-mover__move-button-container,
|
|
3552
3537
|
.show-icon-labels .block-editor-block-mover.is-horizontal .block-editor-block-mover-button {
|
|
3553
3538
|
padding-right: 6px;
|
package/build-style/style.css
CHANGED
|
@@ -782,7 +782,7 @@ iframe[name=editor-canvas].has-editor-padding {
|
|
|
782
782
|
outline: none;
|
|
783
783
|
}
|
|
784
784
|
.components-button.block-editor-block-mover-button:focus-visible::before {
|
|
785
|
-
box-shadow: inset 0 0 0 1px
|
|
785
|
+
box-shadow: inset 0 0 0 1px #fff, 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color);
|
|
786
786
|
outline: 2px solid transparent;
|
|
787
787
|
}
|
|
788
788
|
|
|
@@ -957,14 +957,6 @@ iframe[name=editor-canvas].has-editor-padding {
|
|
|
957
957
|
z-index: 1000001;
|
|
958
958
|
}
|
|
959
959
|
|
|
960
|
-
.block-editor-block-settings-menu__popover .components-dropdown-menu__menu {
|
|
961
|
-
padding: 0;
|
|
962
|
-
}
|
|
963
|
-
|
|
964
|
-
.block-editor-block-styles + .default-style-picker__default-switcher {
|
|
965
|
-
margin-top: 16px;
|
|
966
|
-
}
|
|
967
|
-
|
|
968
960
|
.block-editor-block-styles__preview-panel {
|
|
969
961
|
display: none;
|
|
970
962
|
z-index: 90;
|
|
@@ -1002,7 +994,7 @@ iframe[name=editor-canvas].has-editor-padding {
|
|
|
1002
994
|
color: #fff;
|
|
1003
995
|
}
|
|
1004
996
|
.block-editor-block-styles__variants button.components-button.block-editor-block-styles__item:focus, .block-editor-block-styles__variants button.components-button.block-editor-block-styles__item.is-active:focus {
|
|
1005
|
-
box-shadow: inset 0 0 0 1px
|
|
997
|
+
box-shadow: inset 0 0 0 1px #fff, 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color);
|
|
1006
998
|
outline: 2px solid transparent;
|
|
1007
999
|
}
|
|
1008
1000
|
.block-editor-block-styles__variants .block-editor-block-styles__item-text {
|
|
@@ -1588,16 +1580,6 @@ iframe[name=editor-canvas].has-editor-padding {
|
|
|
1588
1580
|
direction: ltr;
|
|
1589
1581
|
}
|
|
1590
1582
|
|
|
1591
|
-
.block-editor-global-styles-advanced-panel__custom-css-validation-wrapper {
|
|
1592
|
-
position: absolute;
|
|
1593
|
-
bottom: 16px;
|
|
1594
|
-
right: 24px;
|
|
1595
|
-
}
|
|
1596
|
-
|
|
1597
|
-
.block-editor-global-styles-advanced-panel__custom-css-validation-icon {
|
|
1598
|
-
fill: #cc1818;
|
|
1599
|
-
}
|
|
1600
|
-
|
|
1601
1583
|
.block-editor-height-control {
|
|
1602
1584
|
border: 0;
|
|
1603
1585
|
margin: 0;
|
|
@@ -2016,7 +1998,7 @@ iframe[name=editor-canvas].has-editor-padding {
|
|
|
2016
1998
|
box-shadow: none;
|
|
2017
1999
|
}
|
|
2018
2000
|
.block-editor-link-control__search-item .block-editor-link-control__search-item-title:focus-visible {
|
|
2019
|
-
box-shadow: inset 0 0 0 1px
|
|
2001
|
+
box-shadow: inset 0 0 0 1px #fff, 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color);
|
|
2020
2002
|
outline: 2px solid transparent;
|
|
2021
2003
|
text-decoration: none;
|
|
2022
2004
|
}
|
|
@@ -3161,7 +3143,7 @@ iframe[name=editor-canvas].has-editor-padding {
|
|
|
3161
3143
|
}
|
|
3162
3144
|
|
|
3163
3145
|
.html-anchor-control .components-external-link {
|
|
3164
|
-
display: block;
|
|
3146
|
+
display: inline-block;
|
|
3165
3147
|
margin-top: 8px;
|
|
3166
3148
|
}
|
|
3167
3149
|
|
|
@@ -3532,16 +3514,14 @@ iframe[name=editor-canvas].has-editor-padding {
|
|
|
3532
3514
|
}
|
|
3533
3515
|
.show-icon-labels .block-editor-block-mover .block-editor-block-mover__move-button-container {
|
|
3534
3516
|
width: auto;
|
|
3517
|
+
position: relative;
|
|
3535
3518
|
}
|
|
3536
3519
|
@media (min-width: 600px) {
|
|
3537
|
-
.show-icon-labels .block-editor-block-mover .block-editor-block-mover__move-button-container {
|
|
3538
|
-
position: relative;
|
|
3539
|
-
}
|
|
3540
|
-
.show-icon-labels .block-editor-block-mover .block-editor-block-mover__move-button-container::before {
|
|
3520
|
+
.show-icon-labels .block-editor-block-mover:not(.is-horizontal) .block-editor-block-mover__move-button-container::before {
|
|
3541
3521
|
content: "";
|
|
3542
3522
|
height: 1px;
|
|
3543
3523
|
width: 100%;
|
|
3544
|
-
background: #
|
|
3524
|
+
background: #e0e0e0;
|
|
3545
3525
|
position: absolute;
|
|
3546
3526
|
top: 50%;
|
|
3547
3527
|
left: 50%;
|
|
@@ -3549,6 +3529,11 @@ iframe[name=editor-canvas].has-editor-padding {
|
|
|
3549
3529
|
margin-top: -0.5px;
|
|
3550
3530
|
}
|
|
3551
3531
|
}
|
|
3532
|
+
@media (min-width: 782px) {
|
|
3533
|
+
.show-icon-labels .block-editor-block-mover:not(.is-horizontal) .block-editor-block-mover__move-button-container::before {
|
|
3534
|
+
background: #1e1e1e;
|
|
3535
|
+
}
|
|
3536
|
+
}
|
|
3552
3537
|
.show-icon-labels .block-editor-block-mover.is-horizontal .block-editor-block-mover__move-button-container,
|
|
3553
3538
|
.show-icon-labels .block-editor-block-mover.is-horizontal .block-editor-block-mover-button {
|
|
3554
3539
|
padding-left: 6px;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wordpress/block-editor",
|
|
3
|
-
"version": "12.
|
|
3
|
+
"version": "12.20.0",
|
|
4
4
|
"description": "Generic block editor.",
|
|
5
5
|
"author": "The WordPress Contributors",
|
|
6
6
|
"license": "GPL-2.0-or-later",
|
|
@@ -35,41 +35,40 @@
|
|
|
35
35
|
"@emotion/react": "^11.7.1",
|
|
36
36
|
"@emotion/styled": "^11.6.0",
|
|
37
37
|
"@react-spring/web": "^9.4.5",
|
|
38
|
-
"@wordpress/a11y": "^3.
|
|
39
|
-
"@wordpress/api-fetch": "^6.
|
|
40
|
-
"@wordpress/blob": "^3.
|
|
41
|
-
"@wordpress/blocks": "^12.
|
|
42
|
-
"@wordpress/commands": "^0.
|
|
43
|
-
"@wordpress/components": "^
|
|
44
|
-
"@wordpress/compose": "^6.
|
|
45
|
-
"@wordpress/data": "^9.
|
|
46
|
-
"@wordpress/date": "^4.
|
|
47
|
-
"@wordpress/deprecated": "^3.
|
|
48
|
-
"@wordpress/dom": "^3.
|
|
49
|
-
"@wordpress/element": "^5.
|
|
50
|
-
"@wordpress/escape-html": "^2.
|
|
51
|
-
"@wordpress/hooks": "^3.
|
|
52
|
-
"@wordpress/html-entities": "^3.
|
|
53
|
-
"@wordpress/i18n": "^4.
|
|
54
|
-
"@wordpress/icons": "^9.
|
|
55
|
-
"@wordpress/is-shallow-equal": "^4.
|
|
56
|
-
"@wordpress/keyboard-shortcuts": "^4.
|
|
57
|
-
"@wordpress/keycodes": "^3.
|
|
58
|
-
"@wordpress/notices": "^4.
|
|
59
|
-
"@wordpress/preferences": "^3.
|
|
60
|
-
"@wordpress/private-apis": "^0.
|
|
61
|
-
"@wordpress/rich-text": "^6.
|
|
62
|
-
"@wordpress/style-engine": "^1.
|
|
63
|
-
"@wordpress/token-list": "^2.
|
|
64
|
-
"@wordpress/url": "^3.
|
|
65
|
-
"@wordpress/warning": "^2.
|
|
66
|
-
"@wordpress/wordcount": "^3.
|
|
38
|
+
"@wordpress/a11y": "^3.52.0",
|
|
39
|
+
"@wordpress/api-fetch": "^6.49.0",
|
|
40
|
+
"@wordpress/blob": "^3.52.0",
|
|
41
|
+
"@wordpress/blocks": "^12.29.0",
|
|
42
|
+
"@wordpress/commands": "^0.23.0",
|
|
43
|
+
"@wordpress/components": "^27.0.0",
|
|
44
|
+
"@wordpress/compose": "^6.29.0",
|
|
45
|
+
"@wordpress/data": "^9.22.0",
|
|
46
|
+
"@wordpress/date": "^4.52.0",
|
|
47
|
+
"@wordpress/deprecated": "^3.52.0",
|
|
48
|
+
"@wordpress/dom": "^3.52.0",
|
|
49
|
+
"@wordpress/element": "^5.29.0",
|
|
50
|
+
"@wordpress/escape-html": "^2.52.0",
|
|
51
|
+
"@wordpress/hooks": "^3.52.0",
|
|
52
|
+
"@wordpress/html-entities": "^3.52.0",
|
|
53
|
+
"@wordpress/i18n": "^4.52.0",
|
|
54
|
+
"@wordpress/icons": "^9.43.0",
|
|
55
|
+
"@wordpress/is-shallow-equal": "^4.52.0",
|
|
56
|
+
"@wordpress/keyboard-shortcuts": "^4.29.0",
|
|
57
|
+
"@wordpress/keycodes": "^3.52.0",
|
|
58
|
+
"@wordpress/notices": "^4.20.0",
|
|
59
|
+
"@wordpress/preferences": "^3.29.0",
|
|
60
|
+
"@wordpress/private-apis": "^0.34.0",
|
|
61
|
+
"@wordpress/rich-text": "^6.29.0",
|
|
62
|
+
"@wordpress/style-engine": "^1.35.0",
|
|
63
|
+
"@wordpress/token-list": "^2.52.0",
|
|
64
|
+
"@wordpress/url": "^3.53.0",
|
|
65
|
+
"@wordpress/warning": "^2.52.0",
|
|
66
|
+
"@wordpress/wordcount": "^3.52.0",
|
|
67
67
|
"change-case": "^4.1.2",
|
|
68
68
|
"classnames": "^2.3.1",
|
|
69
69
|
"colord": "^2.7.0",
|
|
70
70
|
"deepmerge": "^4.3.0",
|
|
71
71
|
"diff": "^4.0.2",
|
|
72
|
-
"dom-scroll-into-view": "^1.2.1",
|
|
73
72
|
"fast-deep-equal": "^3.1.3",
|
|
74
73
|
"memize": "^2.1.0",
|
|
75
74
|
"postcss": "^8.4.21",
|
|
@@ -87,5 +86,5 @@
|
|
|
87
86
|
"publishConfig": {
|
|
88
87
|
"access": "public"
|
|
89
88
|
},
|
|
90
|
-
"gitHead": "
|
|
89
|
+
"gitHead": "c139588f4c668b38bafbc5431f2f4e3903dbe683"
|
|
91
90
|
}
|
|
@@ -14,6 +14,7 @@ import Iframe from '../iframe';
|
|
|
14
14
|
import WritingFlow from '../writing-flow';
|
|
15
15
|
import { useMouseMoveTypingReset } from '../observe-typing';
|
|
16
16
|
import { useBlockSelectionClearer } from '../block-selection-clearer';
|
|
17
|
+
import { useBlockCommands } from '../use-block-commands';
|
|
17
18
|
|
|
18
19
|
export function ExperimentalBlockCanvas( {
|
|
19
20
|
shouldIframe = true,
|
|
@@ -23,6 +24,7 @@ export function ExperimentalBlockCanvas( {
|
|
|
23
24
|
contentRef: contentRefProp,
|
|
24
25
|
iframeProps,
|
|
25
26
|
} ) {
|
|
27
|
+
useBlockCommands();
|
|
26
28
|
const resetTypingRef = useMouseMoveTypingReset();
|
|
27
29
|
const clearerRef = useBlockSelectionClearer();
|
|
28
30
|
const localRef = useRef();
|
|
@@ -46,31 +46,23 @@ export default function HeadingLevelDropdown( {
|
|
|
46
46
|
icon={ <HeadingLevelIcon level={ value } /> }
|
|
47
47
|
label={ __( 'Change level' ) }
|
|
48
48
|
controls={ options.map( ( targetLevel ) => {
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
),
|
|
67
|
-
isActive,
|
|
68
|
-
onClick() {
|
|
69
|
-
onChange( targetLevel );
|
|
70
|
-
},
|
|
71
|
-
role: 'menuitemradio',
|
|
72
|
-
};
|
|
73
|
-
}
|
|
49
|
+
const isActive = targetLevel === value;
|
|
50
|
+
return {
|
|
51
|
+
icon: <HeadingLevelIcon level={ targetLevel } />,
|
|
52
|
+
title:
|
|
53
|
+
targetLevel === 0
|
|
54
|
+
? __( 'Paragraph' )
|
|
55
|
+
: sprintf(
|
|
56
|
+
// translators: %s: heading level e.g: "1", "2", "3"
|
|
57
|
+
__( 'Heading %d' ),
|
|
58
|
+
targetLevel
|
|
59
|
+
),
|
|
60
|
+
isActive,
|
|
61
|
+
onClick() {
|
|
62
|
+
onChange( targetLevel );
|
|
63
|
+
},
|
|
64
|
+
role: 'menuitemradio',
|
|
65
|
+
};
|
|
74
66
|
} ) }
|
|
75
67
|
/>
|
|
76
68
|
);
|
|
@@ -5,7 +5,6 @@ import { __ } from '@wordpress/i18n';
|
|
|
5
5
|
import {
|
|
6
6
|
getBlockType,
|
|
7
7
|
getUnregisteredTypeHandlerName,
|
|
8
|
-
hasBlockSupport,
|
|
9
8
|
store as blocksStore,
|
|
10
9
|
} from '@wordpress/blocks';
|
|
11
10
|
import { PanelBody, __unstableMotion as motion } from '@wordpress/components';
|
|
@@ -21,7 +20,6 @@ import BlockVariationTransforms from '../block-variation-transforms';
|
|
|
21
20
|
import useBlockDisplayInformation from '../use-block-display-information';
|
|
22
21
|
import { store as blockEditorStore } from '../../store';
|
|
23
22
|
import BlockStyles from '../block-styles';
|
|
24
|
-
import DefaultStylePicker from '../default-style-picker';
|
|
25
23
|
import { default as InspectorControls } from '../inspector-controls';
|
|
26
24
|
import { default as InspectorControlsTabs } from '../inspector-controls-tabs';
|
|
27
25
|
import useInspectorControlsTabs from '../inspector-controls-tabs/use-inspector-controls-tabs';
|
|
@@ -275,15 +273,6 @@ const BlockInspectorSingleBlock = ( { clientId, blockName } ) => {
|
|
|
275
273
|
<div>
|
|
276
274
|
<PanelBody title={ __( 'Styles' ) }>
|
|
277
275
|
<BlockStyles clientId={ clientId } />
|
|
278
|
-
{ hasBlockSupport(
|
|
279
|
-
blockName,
|
|
280
|
-
'defaultStylePicker',
|
|
281
|
-
true
|
|
282
|
-
) && (
|
|
283
|
-
<DefaultStylePicker
|
|
284
|
-
blockName={ blockName }
|
|
285
|
-
/>
|
|
286
|
-
) }
|
|
287
276
|
</PanelBody>
|
|
288
277
|
</div>
|
|
289
278
|
) }
|
|
@@ -46,19 +46,26 @@ const pendingBlockVisibilityUpdatesPerRegistry = new WeakMap();
|
|
|
46
46
|
|
|
47
47
|
function Root( { className, ...settings } ) {
|
|
48
48
|
const isLargeViewport = useViewportMatch( 'medium' );
|
|
49
|
-
const {
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
|
|
49
|
+
const {
|
|
50
|
+
isOutlineMode,
|
|
51
|
+
isFocusMode,
|
|
52
|
+
editorMode,
|
|
53
|
+
temporarilyEditingAsBlocks,
|
|
54
|
+
} = useSelect( ( select ) => {
|
|
55
|
+
const {
|
|
56
|
+
getSettings,
|
|
57
|
+
__unstableGetEditorMode,
|
|
58
|
+
__unstableGetTemporarilyEditingAsBlocks,
|
|
59
|
+
} = select( blockEditorStore );
|
|
60
|
+
const { outlineMode, focusMode } = getSettings();
|
|
61
|
+
return {
|
|
62
|
+
isOutlineMode: outlineMode,
|
|
63
|
+
isFocusMode: focusMode,
|
|
64
|
+
editorMode: __unstableGetEditorMode(),
|
|
65
|
+
temporarilyEditingAsBlocks:
|
|
66
|
+
__unstableGetTemporarilyEditingAsBlocks(),
|
|
67
|
+
};
|
|
68
|
+
}, [] );
|
|
62
69
|
const registry = useRegistry();
|
|
63
70
|
const { setBlockVisibility } = useDispatch( blockEditorStore );
|
|
64
71
|
|
|
@@ -115,6 +122,11 @@ function Root( { className, ...settings } ) {
|
|
|
115
122
|
return (
|
|
116
123
|
<IntersectionObserver.Provider value={ intersectionObserver }>
|
|
117
124
|
<div { ...innerBlocksProps } />
|
|
125
|
+
{ !! temporarilyEditingAsBlocks && (
|
|
126
|
+
<StopEditingAsBlocksOnOutsideSelect
|
|
127
|
+
clientId={ temporarilyEditingAsBlocks }
|
|
128
|
+
/>
|
|
129
|
+
) }
|
|
118
130
|
</IntersectionObserver.Provider>
|
|
119
131
|
);
|
|
120
132
|
}
|
|
@@ -159,43 +171,36 @@ function Items( {
|
|
|
159
171
|
// function on every render.
|
|
160
172
|
const hasAppender = CustomAppender !== false;
|
|
161
173
|
const hasCustomAppender = !! CustomAppender;
|
|
162
|
-
const {
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
__unstableGetEditorMode() !== 'zoom-out'
|
|
193
|
-
: rootClientId === selectedBlockClientId ||
|
|
194
|
-
( ! rootClientId && ! selectedBlockClientId ) ),
|
|
195
|
-
};
|
|
196
|
-
},
|
|
197
|
-
[ rootClientId, hasAppender, hasCustomAppender ]
|
|
198
|
-
);
|
|
174
|
+
const { order, selectedBlocks, visibleBlocks, shouldRenderAppender } =
|
|
175
|
+
useSelect(
|
|
176
|
+
( select ) => {
|
|
177
|
+
const {
|
|
178
|
+
getBlockOrder,
|
|
179
|
+
getSelectedBlockClientId,
|
|
180
|
+
getSelectedBlockClientIds,
|
|
181
|
+
__unstableGetVisibleBlocks,
|
|
182
|
+
getTemplateLock,
|
|
183
|
+
getBlockEditingMode,
|
|
184
|
+
__unstableGetEditorMode,
|
|
185
|
+
} = select( blockEditorStore );
|
|
186
|
+
const selectedBlockClientId = getSelectedBlockClientId();
|
|
187
|
+
return {
|
|
188
|
+
order: getBlockOrder( rootClientId ),
|
|
189
|
+
selectedBlocks: getSelectedBlockClientIds(),
|
|
190
|
+
visibleBlocks: __unstableGetVisibleBlocks(),
|
|
191
|
+
shouldRenderAppender:
|
|
192
|
+
hasAppender &&
|
|
193
|
+
( hasCustomAppender
|
|
194
|
+
? ! getTemplateLock( rootClientId ) &&
|
|
195
|
+
getBlockEditingMode( rootClientId ) !==
|
|
196
|
+
'disabled' &&
|
|
197
|
+
__unstableGetEditorMode() !== 'zoom-out'
|
|
198
|
+
: rootClientId === selectedBlockClientId ||
|
|
199
|
+
( ! rootClientId && ! selectedBlockClientId ) ),
|
|
200
|
+
};
|
|
201
|
+
},
|
|
202
|
+
[ rootClientId, hasAppender, hasCustomAppender ]
|
|
203
|
+
);
|
|
199
204
|
|
|
200
205
|
return (
|
|
201
206
|
<LayoutProvider value={ layout }>
|
|
@@ -216,11 +221,6 @@ function Items( {
|
|
|
216
221
|
</AsyncModeProvider>
|
|
217
222
|
) ) }
|
|
218
223
|
{ order.length < 1 && placeholder }
|
|
219
|
-
{ !! temporarilyEditingAsBlocks && (
|
|
220
|
-
<StopEditingAsBlocksOnOutsideSelect
|
|
221
|
-
clientId={ temporarilyEditingAsBlocks }
|
|
222
|
-
/>
|
|
223
|
-
) }
|
|
224
224
|
{ shouldRenderAppender && (
|
|
225
225
|
<BlockListAppender
|
|
226
226
|
tagName={ __experimentalAppenderTagName }
|
|
@@ -54,7 +54,11 @@ export function BlockPreview( {
|
|
|
54
54
|
[]
|
|
55
55
|
);
|
|
56
56
|
const settings = useMemo(
|
|
57
|
-
() => ( {
|
|
57
|
+
() => ( {
|
|
58
|
+
...originalSettings,
|
|
59
|
+
focusMode: false, // Disable "Spotlight mode".
|
|
60
|
+
__unstableIsPreviewMode: true,
|
|
61
|
+
} ),
|
|
58
62
|
[ originalSettings ]
|
|
59
63
|
);
|
|
60
64
|
const renderedBlocks = useMemo(
|
|
@@ -117,6 +121,7 @@ export function useBlockPreview( { blocks, props = {}, layout } ) {
|
|
|
117
121
|
() => ( {
|
|
118
122
|
...originalSettings,
|
|
119
123
|
styles: undefined, // Clear styles included by the parent settings, as they are already output by the parent's EditorStyles.
|
|
124
|
+
focusMode: false, // Disable "Spotlight mode".
|
|
120
125
|
__unstableIsPreviewMode: true,
|
|
121
126
|
} ),
|
|
122
127
|
[ originalSettings ]
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { useRef } from '@wordpress/element';
|
|
5
|
+
import { MenuItem } from '@wordpress/components';
|
|
6
|
+
import { useViewportMatch } from '@wordpress/compose';
|
|
7
|
+
import { useDispatch } from '@wordpress/data';
|
|
8
|
+
import { __, sprintf } from '@wordpress/i18n';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Internal dependencies
|
|
12
|
+
*/
|
|
13
|
+
import BlockIcon from '../block-icon';
|
|
14
|
+
import { useShowHoveredOrFocusedGestures } from '../block-toolbar/utils';
|
|
15
|
+
import { store as blockEditorStore } from '../../store';
|
|
16
|
+
|
|
17
|
+
export default function BlockParentSelectorMenuItem( {
|
|
18
|
+
parentClientId,
|
|
19
|
+
parentBlockType,
|
|
20
|
+
} ) {
|
|
21
|
+
const isSmallViewport = useViewportMatch( 'medium', '<' );
|
|
22
|
+
const { selectBlock } = useDispatch( blockEditorStore );
|
|
23
|
+
|
|
24
|
+
// Allows highlighting the parent block outline when focusing or hovering
|
|
25
|
+
// the parent block selector within the child.
|
|
26
|
+
const menuItemRef = useRef();
|
|
27
|
+
const gesturesProps = useShowHoveredOrFocusedGestures( {
|
|
28
|
+
ref: menuItemRef,
|
|
29
|
+
highlightParent: true,
|
|
30
|
+
} );
|
|
31
|
+
|
|
32
|
+
if ( ! isSmallViewport ) {
|
|
33
|
+
return null;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
return (
|
|
37
|
+
<MenuItem
|
|
38
|
+
{ ...gesturesProps }
|
|
39
|
+
ref={ menuItemRef }
|
|
40
|
+
icon={ <BlockIcon icon={ parentBlockType.icon } /> }
|
|
41
|
+
onClick={ () => selectBlock( parentClientId ) }
|
|
42
|
+
>
|
|
43
|
+
{ sprintf(
|
|
44
|
+
/* translators: %s: Name of the block's parent. */
|
|
45
|
+
__( 'Select parent block (%s)' ),
|
|
46
|
+
parentBlockType.title
|
|
47
|
+
) }
|
|
48
|
+
</MenuItem>
|
|
49
|
+
);
|
|
50
|
+
}
|