@wordpress/block-editor 8.5.4 → 9.0.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 +9 -0
- package/README.md +4 -2
- package/build/components/block-alignment-control/constants.js +48 -0
- package/build/components/block-alignment-control/constants.js.map +1 -0
- package/build/components/block-alignment-control/ui.js +9 -40
- package/build/components/block-alignment-control/ui.js.map +1 -1
- package/build/components/block-alignment-control/ui.native.js +92 -0
- package/build/components/block-alignment-control/ui.native.js.map +1 -0
- package/build/components/block-content-overlay/index.js +13 -4
- package/build/components/block-content-overlay/index.js.map +1 -1
- package/build/components/block-list/block.native.js +3 -1
- package/build/components/block-list/block.native.js.map +1 -1
- package/build/components/block-list/use-block-props/use-block-class-names.js +1 -7
- package/build/components/block-list/use-block-props/use-block-class-names.js.map +1 -1
- package/build/components/block-lock/modal.js +34 -4
- package/build/components/block-lock/modal.js.map +1 -1
- package/build/components/block-lock/toolbar.js +2 -1
- package/build/components/block-lock/toolbar.js.map +1 -1
- package/build/components/block-lock/use-block-lock.js +4 -1
- package/build/components/block-lock/use-block-lock.js.map +1 -1
- package/build/components/block-mover/button.js +4 -4
- package/build/components/block-mover/button.js.map +1 -1
- package/build/components/block-mover/index.js +39 -65
- package/build/components/block-mover/index.js.map +1 -1
- package/build/components/block-navigation/dropdown.js +11 -5
- package/build/components/block-navigation/dropdown.js.map +1 -1
- package/build/components/block-popover/inbetween.js +183 -0
- package/build/components/block-popover/inbetween.js.map +1 -0
- package/build/components/block-popover/index.js +97 -0
- package/build/components/block-popover/index.js.map +1 -0
- package/build/components/{block-tools → block-popover}/use-popover-scroll.js +4 -1
- package/build/components/block-popover/use-popover-scroll.js.map +1 -0
- package/build/components/block-styles/index.js +1 -10
- package/build/components/block-styles/index.js.map +1 -1
- package/build/components/block-tools/back-compat.js +2 -2
- package/build/components/block-tools/back-compat.js.map +1 -1
- package/build/components/block-tools/block-selection-button.js +4 -2
- package/build/components/block-tools/block-selection-button.js.map +1 -1
- package/build/components/block-tools/index.js +5 -5
- package/build/components/block-tools/index.js.map +1 -1
- package/build/components/block-tools/insertion-point.js +14 -121
- package/build/components/block-tools/insertion-point.js.map +1 -1
- package/build/components/block-tools/{block-popover.js → selected-block-popover.js} +25 -108
- package/build/components/block-tools/selected-block-popover.js.map +1 -0
- package/build/components/color-style-selector/index.js +9 -0
- package/build/components/color-style-selector/index.js.map +1 -1
- package/build/components/duotone-control/index.js +5 -1
- package/build/components/duotone-control/index.js.map +1 -1
- package/build/components/index.js +0 -9
- package/build/components/index.js.map +1 -1
- package/build/components/inserter/index.native.js +30 -8
- package/build/components/inserter/index.native.js.map +1 -1
- package/build/components/list-view/block.js +15 -15
- package/build/components/list-view/block.js.map +1 -1
- package/build/components/list-view/branch.js +9 -13
- package/build/components/list-view/branch.js.map +1 -1
- package/build/components/list-view/context.js +1 -4
- package/build/components/list-view/context.js.map +1 -1
- package/build/components/list-view/index.js +15 -32
- package/build/components/list-view/index.js.map +1 -1
- package/build/components/rich-text/index.js +0 -5
- package/build/components/rich-text/index.js.map +1 -1
- package/build/components/rich-text/index.native.js +0 -4
- package/build/components/rich-text/index.native.js.map +1 -1
- package/build/components/url-input/index.js +7 -3
- package/build/components/url-input/index.js.map +1 -1
- package/build/components/use-block-display-information/index.js +3 -1
- package/build/components/use-block-display-information/index.js.map +1 -1
- package/build/components/use-setting/index.js +42 -18
- package/build/components/use-setting/index.js.map +1 -1
- package/build/hooks/border.js +468 -44
- package/build/hooks/border.js.map +1 -1
- package/build/hooks/dimensions.js +2 -2
- package/build/hooks/dimensions.js.map +1 -1
- package/build/hooks/index.js +3 -1
- package/build/hooks/index.js.map +1 -1
- package/build/hooks/margin.js +64 -12
- package/build/hooks/margin.js.map +1 -1
- package/build/hooks/padding.js +60 -12
- package/build/hooks/padding.js.map +1 -1
- package/build/hooks/settings.js +32 -0
- package/build/hooks/settings.js.map +1 -0
- package/build/hooks/use-border-props.js +22 -32
- package/build/hooks/use-border-props.js.map +1 -1
- package/build/store/actions.js +14 -2
- package/build/store/actions.js.map +1 -1
- package/build/store/defaults.js +0 -1
- package/build/store/defaults.js.map +1 -1
- package/build/store/reducer.js +0 -26
- package/build/store/reducer.js.map +1 -1
- package/build/store/selectors.js +47 -15
- package/build/store/selectors.js.map +1 -1
- package/build-module/components/block-alignment-control/constants.js +36 -0
- package/build-module/components/block-alignment-control/constants.js.map +1 -0
- package/build-module/components/block-alignment-control/ui.js +4 -35
- package/build-module/components/block-alignment-control/ui.js.map +1 -1
- package/build-module/components/block-alignment-control/ui.native.js +78 -0
- package/build-module/components/block-alignment-control/ui.native.js.map +1 -0
- package/build-module/components/block-content-overlay/index.js +13 -4
- package/build-module/components/block-content-overlay/index.js.map +1 -1
- package/build-module/components/block-list/block.native.js +3 -1
- package/build-module/components/block-list/block.native.js.map +1 -1
- package/build-module/components/block-list/use-block-props/use-block-class-names.js +1 -7
- package/build-module/components/block-list/use-block-props/use-block-class-names.js.map +1 -1
- package/build-module/components/block-lock/modal.js +34 -5
- package/build-module/components/block-lock/modal.js.map +1 -1
- package/build-module/components/block-lock/toolbar.js +2 -1
- package/build-module/components/block-lock/toolbar.js.map +1 -1
- package/build-module/components/block-lock/use-block-lock.js +4 -1
- package/build-module/components/block-lock/use-block-lock.js.map +1 -1
- package/build-module/components/block-mover/button.js +5 -5
- package/build-module/components/block-mover/button.js.map +1 -1
- package/build-module/components/block-mover/index.js +38 -63
- package/build-module/components/block-mover/index.js.map +1 -1
- package/build-module/components/block-navigation/dropdown.js +10 -5
- package/build-module/components/block-navigation/dropdown.js.map +1 -1
- package/build-module/components/block-popover/inbetween.js +165 -0
- package/build-module/components/block-popover/inbetween.js.map +1 -0
- package/build-module/components/block-popover/index.js +83 -0
- package/build-module/components/block-popover/index.js.map +1 -0
- package/build-module/components/{block-tools → block-popover}/use-popover-scroll.js +3 -1
- package/build-module/components/block-popover/use-popover-scroll.js.map +1 -0
- package/build-module/components/block-styles/index.js +1 -9
- package/build-module/components/block-styles/index.js.map +1 -1
- package/build-module/components/block-tools/back-compat.js +1 -1
- package/build-module/components/block-tools/back-compat.js.map +1 -1
- package/build-module/components/block-tools/block-selection-button.js +3 -2
- package/build-module/components/block-tools/block-selection-button.js.map +1 -1
- package/build-module/components/block-tools/index.js +3 -3
- package/build-module/components/block-tools/index.js.map +1 -1
- package/build-module/components/block-tools/insertion-point.js +16 -121
- package/build-module/components/block-tools/insertion-point.js.map +1 -1
- package/build-module/components/block-tools/{block-popover.js → selected-block-popover.js} +25 -105
- package/build-module/components/block-tools/selected-block-popover.js.map +1 -0
- package/build-module/components/color-style-selector/index.js +6 -0
- package/build-module/components/color-style-selector/index.js.map +1 -1
- package/build-module/components/duotone-control/index.js +4 -1
- package/build-module/components/duotone-control/index.js.map +1 -1
- package/build-module/components/index.js +0 -1
- package/build-module/components/index.js.map +1 -1
- package/build-module/components/inserter/index.native.js +31 -10
- package/build-module/components/inserter/index.native.js.map +1 -1
- package/build-module/components/list-view/block.js +15 -16
- package/build-module/components/list-view/block.js.map +1 -1
- package/build-module/components/list-view/branch.js +9 -13
- package/build-module/components/list-view/branch.js.map +1 -1
- package/build-module/components/list-view/context.js +1 -4
- package/build-module/components/list-view/context.js.map +1 -1
- package/build-module/components/list-view/index.js +15 -31
- package/build-module/components/list-view/index.js.map +1 -1
- package/build-module/components/rich-text/index.js +0 -4
- package/build-module/components/rich-text/index.js.map +1 -1
- package/build-module/components/rich-text/index.native.js +0 -4
- package/build-module/components/rich-text/index.native.js.map +1 -1
- package/build-module/components/url-input/index.js +7 -3
- package/build-module/components/url-input/index.js.map +1 -1
- package/build-module/components/use-block-display-information/index.js +3 -1
- package/build-module/components/use-block-display-information/index.js.map +1 -1
- package/build-module/components/use-setting/index.js +43 -19
- package/build-module/components/use-setting/index.js.map +1 -1
- package/build-module/hooks/border.js +458 -44
- package/build-module/hooks/border.js.map +1 -1
- package/build-module/hooks/dimensions.js +5 -5
- package/build-module/hooks/dimensions.js.map +1 -1
- package/build-module/hooks/index.js +2 -1
- package/build-module/hooks/index.js.map +1 -1
- package/build-module/hooks/margin.js +61 -13
- package/build-module/hooks/margin.js.map +1 -1
- package/build-module/hooks/padding.js +57 -13
- package/build-module/hooks/padding.js.map +1 -1
- package/build-module/hooks/settings.js +29 -0
- package/build-module/hooks/settings.js.map +1 -0
- package/build-module/hooks/use-border-props.js +21 -30
- package/build-module/hooks/use-border-props.js.map +1 -1
- package/build-module/store/actions.js +14 -2
- package/build-module/store/actions.js.map +1 -1
- package/build-module/store/defaults.js +0 -1
- package/build-module/store/defaults.js.map +1 -1
- package/build-module/store/reducer.js +0 -24
- package/build-module/store/reducer.js.map +1 -1
- package/build-module/store/selectors.js +44 -15
- package/build-module/store/selectors.js.map +1 -1
- package/build-style/style-rtl.css +128 -276
- package/build-style/style.css +128 -276
- package/package.json +28 -28
- package/src/components/block-alignment-control/constants.js +45 -0
- package/src/components/block-alignment-control/ui.js +69 -109
- package/src/components/block-alignment-control/ui.native.js +86 -0
- package/src/components/block-content-overlay/index.js +19 -2
- package/src/components/block-list/block.native.js +2 -0
- package/src/components/block-list/style.scss +7 -18
- package/src/components/block-list/use-block-props/use-block-class-names.js +1 -11
- package/src/components/block-lock/modal.js +42 -3
- package/src/components/block-lock/toolbar.js +2 -2
- package/src/components/block-lock/use-block-lock.js +4 -1
- package/src/components/block-mover/button.js +5 -7
- package/src/components/block-mover/index.js +37 -60
- package/src/components/block-mover/stories/index.js +110 -0
- package/src/components/block-mover/style.scss +48 -138
- package/src/components/block-navigation/dropdown.js +12 -8
- package/src/components/block-popover/README.md +41 -0
- package/src/components/block-popover/inbetween.js +180 -0
- package/src/components/block-popover/index.js +90 -0
- package/src/components/block-popover/style.scss +27 -0
- package/src/components/{block-tools → block-popover}/use-popover-scroll.js +3 -1
- package/src/components/block-styles/index.js +1 -12
- package/src/components/block-switcher/style.scss +0 -4
- package/src/components/block-toolbar/style.scss +0 -12
- package/src/components/block-tools/back-compat.js +1 -1
- package/src/components/block-tools/block-selection-button.js +3 -1
- package/src/components/block-tools/index.js +6 -4
- package/src/components/block-tools/insertion-point.js +19 -152
- package/src/components/block-tools/{block-popover.js → selected-block-popover.js} +24 -116
- package/src/components/block-tools/style.scss +11 -123
- package/src/components/border-radius-control/style.scss +5 -2
- package/src/components/color-palette/test/__snapshots__/control.js.snap +1 -1
- package/src/components/color-style-selector/index.js +18 -9
- package/src/components/default-block-appender/style.scss +1 -2
- package/src/components/duotone-control/index.js +8 -1
- package/src/components/gradients/README.md +29 -0
- package/src/components/image-size-control/README.md +1 -1
- package/src/components/index.js +0 -1
- package/src/components/inserter/index.native.js +60 -25
- package/src/components/inserter/style.native.scss +25 -3
- package/src/components/list-view/block.js +24 -34
- package/src/components/list-view/branch.js +10 -20
- package/src/components/list-view/context.js +1 -4
- package/src/components/list-view/index.js +11 -41
- package/src/components/navigable-toolbar/README.md +16 -0
- package/src/components/rich-text/index.js +0 -2
- package/src/components/rich-text/index.native.js +0 -4
- package/src/components/url-input/index.js +6 -3
- package/src/components/use-block-display-information/index.js +2 -0
- package/src/components/use-setting/index.js +57 -21
- package/src/hooks/border.js +438 -72
- package/src/hooks/border.scss +48 -0
- package/src/hooks/dimensions.js +44 -38
- package/src/hooks/index.js +2 -1
- package/src/hooks/margin.js +64 -15
- package/src/hooks/padding.js +60 -15
- package/src/hooks/padding.scss +12 -0
- package/src/hooks/settings.js +32 -0
- package/src/hooks/test/settings.js +48 -0
- package/src/hooks/use-border-props.js +15 -32
- package/src/store/actions.js +14 -2
- package/src/store/defaults.js +0 -1
- package/src/store/reducer.js +0 -21
- package/src/store/selectors.js +46 -15
- package/src/store/test/actions.js +0 -18
- package/src/store/test/reducer.js +0 -19
- package/src/store/test/selectors.js +17 -19
- package/src/style.scss +2 -2
- package/tsconfig.tsbuildinfo +1 -1
- package/build/components/block-mobile-toolbar/index.js +0 -42
- package/build/components/block-mobile-toolbar/index.js.map +0 -1
- package/build/components/block-tools/block-popover.js.map +0 -1
- package/build/components/block-tools/use-popover-scroll.js.map +0 -1
- package/build/components/border-style-control/index.js +0 -60
- package/build/components/border-style-control/index.js.map +0 -1
- package/build/components/list-view/appender.js +0 -93
- package/build/components/list-view/appender.js.map +0 -1
- package/build/components/list-view/list-item.js +0 -62
- package/build/components/list-view/list-item.js.map +0 -1
- package/build/components/rich-text/use-caret-in-format.js +0 -43
- package/build/components/rich-text/use-caret-in-format.js.map +0 -1
- package/build/hooks/border-color.js +0 -302
- package/build/hooks/border-color.js.map +0 -1
- package/build/hooks/border-style.js +0 -96
- package/build/hooks/border-style.js.map +0 -1
- package/build/hooks/border-width.js +0 -162
- package/build/hooks/border-width.js.map +0 -1
- package/build-module/components/block-mobile-toolbar/index.js +0 -31
- package/build-module/components/block-mobile-toolbar/index.js.map +0 -1
- package/build-module/components/block-tools/block-popover.js.map +0 -1
- package/build-module/components/block-tools/use-popover-scroll.js.map +0 -1
- package/build-module/components/border-style-control/index.js +0 -50
- package/build-module/components/border-style-control/index.js.map +0 -1
- package/build-module/components/list-view/appender.js +0 -76
- package/build-module/components/list-view/appender.js.map +0 -1
- package/build-module/components/list-view/list-item.js +0 -47
- package/build-module/components/list-view/list-item.js.map +0 -1
- package/build-module/components/rich-text/use-caret-in-format.js +0 -33
- package/build-module/components/rich-text/use-caret-in-format.js.map +0 -1
- package/build-module/hooks/border-color.js +0 -276
- package/build-module/hooks/border-color.js.map +0 -1
- package/build-module/hooks/border-style.js +0 -78
- package/build-module/hooks/border-style.js.map +0 -1
- package/build-module/hooks/border-width.js +0 -143
- package/build-module/hooks/border-width.js.map +0 -1
- package/src/components/block-mobile-toolbar/index.js +0 -24
- package/src/components/block-mobile-toolbar/style.scss +0 -29
- package/src/components/border-style-control/index.js +0 -47
- package/src/components/border-style-control/style.scss +0 -18
- package/src/components/list-view/appender.js +0 -82
- package/src/components/list-view/list-item.js +0 -59
- package/src/components/rich-text/use-caret-in-format.js +0 -28
- package/src/hooks/border-color.js +0 -315
- package/src/hooks/border-style.js +0 -64
- package/src/hooks/border-width.js +0 -139
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { __, _x } from '@wordpress/i18n';
|
|
5
|
+
import { alignNone, positionCenter, positionLeft, positionRight, stretchFullWidth, stretchWide } from '@wordpress/icons';
|
|
6
|
+
export const BLOCK_ALIGNMENTS_CONTROLS = {
|
|
7
|
+
none: {
|
|
8
|
+
icon: alignNone,
|
|
9
|
+
title: _x('None', 'Alignment option')
|
|
10
|
+
},
|
|
11
|
+
left: {
|
|
12
|
+
icon: positionLeft,
|
|
13
|
+
title: __('Align left')
|
|
14
|
+
},
|
|
15
|
+
center: {
|
|
16
|
+
icon: positionCenter,
|
|
17
|
+
title: __('Align center')
|
|
18
|
+
},
|
|
19
|
+
right: {
|
|
20
|
+
icon: positionRight,
|
|
21
|
+
title: __('Align right')
|
|
22
|
+
},
|
|
23
|
+
wide: {
|
|
24
|
+
icon: stretchWide,
|
|
25
|
+
title: __('Wide width')
|
|
26
|
+
},
|
|
27
|
+
full: {
|
|
28
|
+
icon: stretchFullWidth,
|
|
29
|
+
title: __('Full width')
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
export const DEFAULT_CONTROL = 'none';
|
|
33
|
+
export const POPOVER_PROPS = {
|
|
34
|
+
isAlternate: true
|
|
35
|
+
};
|
|
36
|
+
//# sourceMappingURL=constants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-editor/src/components/block-alignment-control/constants.js"],"names":["__","_x","alignNone","positionCenter","positionLeft","positionRight","stretchFullWidth","stretchWide","BLOCK_ALIGNMENTS_CONTROLS","none","icon","title","left","center","right","wide","full","DEFAULT_CONTROL","POPOVER_PROPS","isAlternate"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,EAAT,EAAaC,EAAb,QAAuB,iBAAvB;AACA,SACCC,SADD,EAECC,cAFD,EAGCC,YAHD,EAICC,aAJD,EAKCC,gBALD,EAMCC,WAND,QAOO,kBAPP;AASA,OAAO,MAAMC,yBAAyB,GAAG;AACxCC,EAAAA,IAAI,EAAE;AACLC,IAAAA,IAAI,EAAER,SADD;AAELS,IAAAA,KAAK,EAAEV,EAAE,CAAE,MAAF,EAAU,kBAAV;AAFJ,GADkC;AAKxCW,EAAAA,IAAI,EAAE;AACLF,IAAAA,IAAI,EAAEN,YADD;AAELO,IAAAA,KAAK,EAAEX,EAAE,CAAE,YAAF;AAFJ,GALkC;AASxCa,EAAAA,MAAM,EAAE;AACPH,IAAAA,IAAI,EAAEP,cADC;AAEPQ,IAAAA,KAAK,EAAEX,EAAE,CAAE,cAAF;AAFF,GATgC;AAaxCc,EAAAA,KAAK,EAAE;AACNJ,IAAAA,IAAI,EAAEL,aADA;AAENM,IAAAA,KAAK,EAAEX,EAAE,CAAE,aAAF;AAFH,GAbiC;AAiBxCe,EAAAA,IAAI,EAAE;AACLL,IAAAA,IAAI,EAAEH,WADD;AAELI,IAAAA,KAAK,EAAEX,EAAE,CAAE,YAAF;AAFJ,GAjBkC;AAqBxCgB,EAAAA,IAAI,EAAE;AACLN,IAAAA,IAAI,EAAEJ,gBADD;AAELK,IAAAA,KAAK,EAAEX,EAAE,CAAE,YAAF;AAFJ;AArBkC,CAAlC;AA2BP,OAAO,MAAMiB,eAAe,GAAG,MAAxB;AAEP,OAAO,MAAMC,aAAa,GAAG;AAC5BC,EAAAA,WAAW,EAAE;AADe,CAAtB","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, _x } from '@wordpress/i18n';\nimport {\n\talignNone,\n\tpositionCenter,\n\tpositionLeft,\n\tpositionRight,\n\tstretchFullWidth,\n\tstretchWide,\n} from '@wordpress/icons';\n\nexport const BLOCK_ALIGNMENTS_CONTROLS = {\n\tnone: {\n\t\ticon: alignNone,\n\t\ttitle: _x( 'None', 'Alignment option' ),\n\t},\n\tleft: {\n\t\ticon: positionLeft,\n\t\ttitle: __( 'Align left' ),\n\t},\n\tcenter: {\n\t\ticon: positionCenter,\n\t\ttitle: __( 'Align center' ),\n\t},\n\tright: {\n\t\ticon: positionRight,\n\t\ttitle: __( 'Align right' ),\n\t},\n\twide: {\n\t\ticon: stretchWide,\n\t\ttitle: __( 'Wide width' ),\n\t},\n\tfull: {\n\t\ticon: stretchFullWidth,\n\t\ttitle: __( 'Full width' ),\n\t},\n};\n\nexport const DEFAULT_CONTROL = 'none';\n\nexport const POPOVER_PROPS = {\n\tisAlternate: true,\n};\n"]}
|
|
@@ -9,45 +9,14 @@ import classNames from 'classnames';
|
|
|
9
9
|
* WordPress dependencies
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
|
-
import { __
|
|
12
|
+
import { __ } from '@wordpress/i18n';
|
|
13
13
|
import { ToolbarDropdownMenu, ToolbarGroup, MenuGroup, MenuItem } from '@wordpress/components';
|
|
14
|
-
import { alignNone, positionCenter, positionLeft, positionRight, stretchFullWidth, stretchWide } from '@wordpress/icons';
|
|
15
|
-
import { Platform } from '@wordpress/element';
|
|
16
14
|
/**
|
|
17
15
|
* Internal dependencies
|
|
18
16
|
*/
|
|
19
17
|
|
|
20
18
|
import useAvailableAlignments from './use-available-alignments';
|
|
21
|
-
|
|
22
|
-
none: {
|
|
23
|
-
icon: alignNone,
|
|
24
|
-
title: _x('None', 'Alignment option')
|
|
25
|
-
},
|
|
26
|
-
left: {
|
|
27
|
-
icon: positionLeft,
|
|
28
|
-
title: __('Align left')
|
|
29
|
-
},
|
|
30
|
-
center: {
|
|
31
|
-
icon: positionCenter,
|
|
32
|
-
title: __('Align center')
|
|
33
|
-
},
|
|
34
|
-
right: {
|
|
35
|
-
icon: positionRight,
|
|
36
|
-
title: __('Align right')
|
|
37
|
-
},
|
|
38
|
-
wide: {
|
|
39
|
-
icon: stretchWide,
|
|
40
|
-
title: __('Wide width')
|
|
41
|
-
},
|
|
42
|
-
full: {
|
|
43
|
-
icon: stretchFullWidth,
|
|
44
|
-
title: __('Full width')
|
|
45
|
-
}
|
|
46
|
-
};
|
|
47
|
-
const DEFAULT_CONTROL = 'none';
|
|
48
|
-
const POPOVER_PROPS = {
|
|
49
|
-
isAlternate: true
|
|
50
|
-
};
|
|
19
|
+
import { BLOCK_ALIGNMENTS_CONTROLS, DEFAULT_CONTROL, POPOVER_PROPS } from './constants';
|
|
51
20
|
|
|
52
21
|
function BlockAlignmentUI(_ref) {
|
|
53
22
|
let {
|
|
@@ -79,8 +48,8 @@ function BlockAlignmentUI(_ref) {
|
|
|
79
48
|
describedBy: __('Change alignment')
|
|
80
49
|
}
|
|
81
50
|
};
|
|
82
|
-
const extraProps = isToolbar
|
|
83
|
-
isCollapsed
|
|
51
|
+
const extraProps = isToolbar ? {
|
|
52
|
+
isCollapsed,
|
|
84
53
|
controls: enabledControls.map(_ref2 => {
|
|
85
54
|
let {
|
|
86
55
|
name: controlName
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-editor/src/components/block-alignment-control/ui.js"],"names":["classNames","__","
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-editor/src/components/block-alignment-control/ui.js"],"names":["classNames","__","ToolbarDropdownMenu","ToolbarGroup","MenuGroup","MenuItem","useAvailableAlignments","BLOCK_ALIGNMENTS_CONTROLS","DEFAULT_CONTROL","POPOVER_PROPS","BlockAlignmentUI","value","onChange","controls","isToolbar","isCollapsed","enabledControls","hasEnabledControls","length","onChangeAlignment","align","includes","undefined","activeAlignmentControl","defaultAlignmentControl","UIComponent","commonProps","popoverProps","icon","label","toggleProps","describedBy","extraProps","map","name","controlName","isActive","role","onClick","children","onClose","info","title","isSelected"],"mappings":";;;AAAA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,YAAvB;AAEA;AACA;AACA;;AACA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SACCC,mBADD,EAECC,YAFD,EAGCC,SAHD,EAICC,QAJD,QAKO,uBALP;AAOA;AACA;AACA;;AACA,OAAOC,sBAAP,MAAmC,4BAAnC;AACA,SACCC,yBADD,EAECC,eAFD,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AqCM,UAArC,EAAP;AACA;;AAED,eAAetB,gBAAf","sourcesContent":["/**\n * External dependencies\n */\nimport classNames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport {\n\tToolbarDropdownMenu,\n\tToolbarGroup,\n\tMenuGroup,\n\tMenuItem,\n} from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport useAvailableAlignments from './use-available-alignments';\nimport {\n\tBLOCK_ALIGNMENTS_CONTROLS,\n\tDEFAULT_CONTROL,\n\tPOPOVER_PROPS,\n} from './constants';\n\nfunction BlockAlignmentUI( {\n\tvalue,\n\tonChange,\n\tcontrols,\n\tisToolbar,\n\tisCollapsed = true,\n} ) {\n\tconst enabledControls = useAvailableAlignments( controls );\n\tconst hasEnabledControls = !! enabledControls.length;\n\n\tif ( ! hasEnabledControls ) {\n\t\treturn null;\n\t}\n\n\tfunction onChangeAlignment( align ) {\n\t\tonChange( [ value, 'none' ].includes( align ) ? undefined : align );\n\t}\n\n\tconst activeAlignmentControl = BLOCK_ALIGNMENTS_CONTROLS[ value ];\n\tconst defaultAlignmentControl =\n\t\tBLOCK_ALIGNMENTS_CONTROLS[ DEFAULT_CONTROL ];\n\n\tconst UIComponent = isToolbar ? ToolbarGroup : ToolbarDropdownMenu;\n\tconst commonProps = {\n\t\tpopoverProps: POPOVER_PROPS,\n\t\ticon: activeAlignmentControl\n\t\t\t? activeAlignmentControl.icon\n\t\t\t: defaultAlignmentControl.icon,\n\t\tlabel: __( 'Align' ),\n\t\ttoggleProps: { describedBy: __( 'Change alignment' ) },\n\t};\n\tconst extraProps = isToolbar\n\t\t? {\n\t\t\t\tisCollapsed,\n\t\t\t\tcontrols: enabledControls.map( ( { name: controlName } ) => {\n\t\t\t\t\treturn {\n\t\t\t\t\t\t...BLOCK_ALIGNMENTS_CONTROLS[ controlName ],\n\t\t\t\t\t\tisActive:\n\t\t\t\t\t\t\tvalue === controlName ||\n\t\t\t\t\t\t\t( ! value && controlName === 'none' ),\n\t\t\t\t\t\trole: isCollapsed ? 'menuitemradio' : undefined,\n\t\t\t\t\t\tonClick: () => onChangeAlignment( controlName ),\n\t\t\t\t\t};\n\t\t\t\t} ),\n\t\t }\n\t\t: {\n\t\t\t\tchildren: ( { onClose } ) => {\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t<MenuGroup className=\"block-editor-block-alignment-control__menu-group\">\n\t\t\t\t\t\t\t\t{ enabledControls.map(\n\t\t\t\t\t\t\t\t\t( { name: controlName, info } ) => {\n\t\t\t\t\t\t\t\t\t\tconst {\n\t\t\t\t\t\t\t\t\t\t\ticon,\n\t\t\t\t\t\t\t\t\t\t\ttitle,\n\t\t\t\t\t\t\t\t\t\t} = BLOCK_ALIGNMENTS_CONTROLS[\n\t\t\t\t\t\t\t\t\t\t\tcontrolName\n\t\t\t\t\t\t\t\t\t\t];\n\t\t\t\t\t\t\t\t\t\t// If no value is provided, mark as selected the `none` option.\n\t\t\t\t\t\t\t\t\t\tconst isSelected =\n\t\t\t\t\t\t\t\t\t\t\tcontrolName === value ||\n\t\t\t\t\t\t\t\t\t\t\t( ! value &&\n\t\t\t\t\t\t\t\t\t\t\t\tcontrolName === 'none' );\n\t\t\t\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\t\t\t\t\tkey={ controlName }\n\t\t\t\t\t\t\t\t\t\t\t\ticon={ icon }\n\t\t\t\t\t\t\t\t\t\t\t\ticonPosition=\"left\"\n\t\t\t\t\t\t\t\t\t\t\t\tclassName={ classNames(\n\t\t\t\t\t\t\t\t\t\t\t\t\t'components-dropdown-menu__menu-item',\n\t\t\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t'is-active': isSelected,\n\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t\t\tisSelected={ isSelected }\n\t\t\t\t\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\t\t\t\t\tonChangeAlignment(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tcontrolName\n\t\t\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t\t\t\tonClose();\n\t\t\t\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t\t\t\t\trole=\"menuitemradio\"\n\t\t\t\t\t\t\t\t\t\t\t\tinfo={ info }\n\t\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t\t{ title }\n\t\t\t\t\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t</MenuGroup>\n\t\t\t\t\t\t</>\n\t\t\t\t\t);\n\t\t\t\t},\n\t\t };\n\n\treturn <UIComponent { ...commonProps } { ...extraProps } />;\n}\n\nexport default BlockAlignmentUI;\n"]}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
+
import { createElement } from "@wordpress/element";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* WordPress dependencies
|
|
6
|
+
*/
|
|
7
|
+
import { __ } from '@wordpress/i18n';
|
|
8
|
+
import { ToolbarDropdownMenu, ToolbarGroup, BottomSheetSelectControl } from '@wordpress/components';
|
|
9
|
+
/**
|
|
10
|
+
* Internal dependencies
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
import useAvailableAlignments from './use-available-alignments';
|
|
14
|
+
import { BLOCK_ALIGNMENTS_CONTROLS, DEFAULT_CONTROL, POPOVER_PROPS } from './constants';
|
|
15
|
+
|
|
16
|
+
function BlockAlignmentUI(_ref) {
|
|
17
|
+
let {
|
|
18
|
+
value,
|
|
19
|
+
onChange,
|
|
20
|
+
controls,
|
|
21
|
+
isToolbar,
|
|
22
|
+
isCollapsed = true,
|
|
23
|
+
isBottomSheetControl = false
|
|
24
|
+
} = _ref;
|
|
25
|
+
const enabledControls = useAvailableAlignments(controls);
|
|
26
|
+
const hasEnabledControls = !!enabledControls.length;
|
|
27
|
+
|
|
28
|
+
if (!hasEnabledControls) {
|
|
29
|
+
return null;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
function onChangeAlignment(align) {
|
|
33
|
+
onChange([value, 'none'].includes(align) ? undefined : align);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
const activeAlignmentControl = BLOCK_ALIGNMENTS_CONTROLS[value];
|
|
37
|
+
const defaultAlignmentControl = BLOCK_ALIGNMENTS_CONTROLS[DEFAULT_CONTROL];
|
|
38
|
+
const toolbarUIComponent = isToolbar ? ToolbarGroup : ToolbarDropdownMenu;
|
|
39
|
+
const UIComponent = isBottomSheetControl ? BottomSheetSelectControl : toolbarUIComponent;
|
|
40
|
+
const commonProps = {
|
|
41
|
+
label: __('Align')
|
|
42
|
+
};
|
|
43
|
+
const extraProps = isBottomSheetControl ? {
|
|
44
|
+
options: enabledControls.map(_ref2 => {
|
|
45
|
+
let {
|
|
46
|
+
name: controlName
|
|
47
|
+
} = _ref2;
|
|
48
|
+
const control = BLOCK_ALIGNMENTS_CONTROLS[controlName];
|
|
49
|
+
return {
|
|
50
|
+
value: controlName,
|
|
51
|
+
label: control.title,
|
|
52
|
+
icon: control.icon
|
|
53
|
+
};
|
|
54
|
+
}),
|
|
55
|
+
value: activeAlignmentControl ? value : 'none',
|
|
56
|
+
onChange: align => onChangeAlignment(align)
|
|
57
|
+
} : {
|
|
58
|
+
icon: activeAlignmentControl ? activeAlignmentControl.icon : defaultAlignmentControl.icon,
|
|
59
|
+
isCollapsed: isToolbar ? isCollapsed : undefined,
|
|
60
|
+
controls: enabledControls.map(_ref3 => {
|
|
61
|
+
let {
|
|
62
|
+
name: controlName
|
|
63
|
+
} = _ref3;
|
|
64
|
+
return { ...BLOCK_ALIGNMENTS_CONTROLS[controlName],
|
|
65
|
+
isActive: value === controlName || !value && controlName === 'none',
|
|
66
|
+
onClick: () => onChangeAlignment(controlName)
|
|
67
|
+
};
|
|
68
|
+
}),
|
|
69
|
+
popoverProps: POPOVER_PROPS,
|
|
70
|
+
toggleProps: {
|
|
71
|
+
describedBy: __('Change alignment')
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
return createElement(UIComponent, _extends({}, commonProps, extraProps));
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
export default BlockAlignmentUI;
|
|
78
|
+
//# sourceMappingURL=ui.native.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-editor/src/components/block-alignment-control/ui.native.js"],"names":["__","ToolbarDropdownMenu","ToolbarGroup","BottomSheetSelectControl","useAvailableAlignments","BLOCK_ALIGNMENTS_CONTROLS","DEFAULT_CONTROL","POPOVER_PROPS","BlockAlignmentUI","value","onChange","controls","isToolbar","isCollapsed","isBottomSheetControl","enabledControls","hasEnabledControls","length","onChangeAlignment","align","includes","undefined","activeAlignmentControl","defaultAlignmentControl","toolbarUIComponent","UIComponent","commonProps","label","extraProps","options","map","name","controlName","control","title","icon","isActive","onClick","popoverProps","toggleProps","describedBy"],"mappings":";;;AAAA;AACA;AACA;AACA,SAASA,EAAT,QAAmB,iBAAnB;AACA,SACCC,mBADD,EAECC,YAFD,EAGCC,wBAHD,QAIO,uBAJP;AAMA;AACA;AACA;;AACA,OAAOC,sBAAP,MAAmC,4BAAnC;AACA,SACCC,yBADD,EAECC,eAFD,EAGCC,aAHD,QAIO,aAJP;;AAMA,SAASC,gBAAT,OAOI;AAAA,MAPuB;AAC1BC,IAAAA,KAD0B;AAE1BC,IAAAA,QAF0B;AAG1BC,IAAAA,QAH0B;AAI1BC,IAAAA,SAJ0B;AAK1BC,IAAAA,WAAW,GAAG,IALY;AAM1BC,IAAAA,oBAAoB,GAAG;AANG,GAOvB;AACH,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,CAACa,IADE,GAEzBZ,uBAAuB,CAACY,IAH3B;AAIAtB,IAAAA,WAAW,EAAED,SAAS,GAAGC,WAAH,GAAiBQ,SAJvC;AAKAV,IAAAA,QAAQ,EAAEI,eAAe,CAACe,GAAhB,CAAqB,SAA6B;AAAA,UAA3B;AAAEC,QAAAA,IAAI,EAAEC;AAAR,OAA2B;AAC3D,aAAO,EACN,GAAG3B,yBAAyB,CAAE2B,WAAF,CADtB;AAENI,QAAAA,QAAQ,EACP3B,KAAK,KAAKuB,WAAV,IACE,CAAEvB,KAAF,IAAWuB,WAAW,KAAK,MAJxB;AAKNK,QAAAA,OAAO,EAAE,MAAMnB,iBAAiB,CAAEc,WAAF;AAL1B,OAAP;AAOA,KARS,CALV;AAcAM,IAAAA,YAAY,EAAE/B,aAdd;AAeAgC,IAAAA,WAAW,EAAE;AAAEC,MAAAA,WAAW,EAAExC,EAAE,CAAE,kBAAF;AAAjB;AAfb,GAbH;AA+BA,SAAO,cAAC,WAAD,eAAkB0B,WAAlB,EAAqCE,UAArC,EAAP;AACA;;AAED,eAAepB,gBAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport {\n\tToolbarDropdownMenu,\n\tToolbarGroup,\n\tBottomSheetSelectControl,\n} from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport useAvailableAlignments from './use-available-alignments';\nimport {\n\tBLOCK_ALIGNMENTS_CONTROLS,\n\tDEFAULT_CONTROL,\n\tPOPOVER_PROPS,\n} from './constants';\n\nfunction BlockAlignmentUI( {\n\tvalue,\n\tonChange,\n\tcontrols,\n\tisToolbar,\n\tisCollapsed = true,\n\tisBottomSheetControl = false,\n} ) {\n\tconst enabledControls = useAvailableAlignments( controls );\n\tconst hasEnabledControls = !! enabledControls.length;\n\n\tif ( ! hasEnabledControls ) {\n\t\treturn null;\n\t}\n\n\tfunction onChangeAlignment( align ) {\n\t\tonChange( [ value, 'none' ].includes( align ) ? undefined : align );\n\t}\n\n\tconst activeAlignmentControl = BLOCK_ALIGNMENTS_CONTROLS[ value ];\n\tconst defaultAlignmentControl =\n\t\tBLOCK_ALIGNMENTS_CONTROLS[ DEFAULT_CONTROL ];\n\n\tconst toolbarUIComponent = isToolbar ? ToolbarGroup : ToolbarDropdownMenu;\n\tconst UIComponent = isBottomSheetControl\n\t\t? BottomSheetSelectControl\n\t\t: toolbarUIComponent;\n\n\tconst commonProps = {\n\t\tlabel: __( 'Align' ),\n\t};\n\tconst extraProps = isBottomSheetControl\n\t\t? {\n\t\t\t\toptions: enabledControls.map( ( { name: controlName } ) => {\n\t\t\t\t\tconst control = BLOCK_ALIGNMENTS_CONTROLS[ controlName ];\n\t\t\t\t\treturn {\n\t\t\t\t\t\tvalue: controlName,\n\t\t\t\t\t\tlabel: control.title,\n\t\t\t\t\t\ticon: control.icon,\n\t\t\t\t\t};\n\t\t\t\t} ),\n\t\t\t\tvalue: activeAlignmentControl ? value : 'none',\n\t\t\t\tonChange: ( align ) => onChangeAlignment( align ),\n\t\t }\n\t\t: {\n\t\t\t\ticon: activeAlignmentControl\n\t\t\t\t\t? activeAlignmentControl.icon\n\t\t\t\t\t: defaultAlignmentControl.icon,\n\t\t\t\tisCollapsed: isToolbar ? isCollapsed : undefined,\n\t\t\t\tcontrols: enabledControls.map( ( { name: controlName } ) => {\n\t\t\t\t\treturn {\n\t\t\t\t\t\t...BLOCK_ALIGNMENTS_CONTROLS[ controlName ],\n\t\t\t\t\t\tisActive:\n\t\t\t\t\t\t\tvalue === controlName ||\n\t\t\t\t\t\t\t( ! value && controlName === 'none' ),\n\t\t\t\t\t\tonClick: () => onChangeAlignment( controlName ),\n\t\t\t\t\t};\n\t\t\t\t} ),\n\t\t\t\tpopoverProps: POPOVER_PROPS,\n\t\t\t\ttoggleProps: { describedBy: __( 'Change alignment' ) },\n\t\t };\n\n\treturn <UIComponent { ...commonProps } { ...extraProps } />;\n}\n\nexport default BlockAlignmentUI;\n"]}
|
|
@@ -27,6 +27,7 @@ export default function BlockContentOverlay(_ref) {
|
|
|
27
27
|
const [isOverlayActive, setIsOverlayActive] = useState(true);
|
|
28
28
|
const [isHovered, setIsHovered] = useState(false);
|
|
29
29
|
const {
|
|
30
|
+
canEdit,
|
|
30
31
|
isParentSelected,
|
|
31
32
|
hasChildSelected,
|
|
32
33
|
isDraggingBlocks,
|
|
@@ -36,9 +37,11 @@ export default function BlockContentOverlay(_ref) {
|
|
|
36
37
|
isBlockSelected,
|
|
37
38
|
hasSelectedInnerBlock,
|
|
38
39
|
isDraggingBlocks: _isDraggingBlocks,
|
|
39
|
-
isBlockHighlighted
|
|
40
|
+
isBlockHighlighted,
|
|
41
|
+
canEditBlock
|
|
40
42
|
} = select(blockEditorStore);
|
|
41
43
|
return {
|
|
44
|
+
canEdit: canEditBlock(clientId),
|
|
42
45
|
isParentSelected: isBlockSelected(clientId),
|
|
43
46
|
hasChildSelected: hasSelectedInnerBlock(clientId, true),
|
|
44
47
|
isDraggingBlocks: _isDraggingBlocks(),
|
|
@@ -51,7 +54,13 @@ export default function BlockContentOverlay(_ref) {
|
|
|
51
54
|
'is-dragging-blocks': isDraggingBlocks
|
|
52
55
|
});
|
|
53
56
|
useEffect(() => {
|
|
54
|
-
//
|
|
57
|
+
// The overlay is always active when editing is locked.
|
|
58
|
+
if (!canEdit) {
|
|
59
|
+
setIsOverlayActive(true);
|
|
60
|
+
return;
|
|
61
|
+
} // Reenable when blocks are not in use.
|
|
62
|
+
|
|
63
|
+
|
|
55
64
|
if (!isParentSelected && !hasChildSelected && !isOverlayActive) {
|
|
56
65
|
setIsOverlayActive(true);
|
|
57
66
|
} // Disable if parent selected by another means (such as list view).
|
|
@@ -69,7 +78,7 @@ export default function BlockContentOverlay(_ref) {
|
|
|
69
78
|
if (hasChildSelected && isOverlayActive) {
|
|
70
79
|
setIsOverlayActive(false);
|
|
71
80
|
}
|
|
72
|
-
}, [isParentSelected, hasChildSelected, isOverlayActive, isHovered]); // Disabled because the overlay div doesn't actually have a role or functionality
|
|
81
|
+
}, [isParentSelected, hasChildSelected, isOverlayActive, isHovered, canEdit]); // Disabled because the overlay div doesn't actually have a role or functionality
|
|
73
82
|
// as far as the a11y is concerned. We're just catching the first click so that
|
|
74
83
|
// the block can be selected without interacting with its contents.
|
|
75
84
|
|
|
@@ -79,7 +88,7 @@ export default function BlockContentOverlay(_ref) {
|
|
|
79
88
|
className: classes,
|
|
80
89
|
onMouseEnter: () => setIsHovered(true),
|
|
81
90
|
onMouseLeave: () => setIsHovered(false),
|
|
82
|
-
onMouseUp: isOverlayActive ? () => setIsOverlayActive(false) : undefined
|
|
91
|
+
onMouseUp: isOverlayActive && canEdit ? () => setIsOverlayActive(false) : undefined
|
|
83
92
|
}), wrapperProps === null || wrapperProps === void 0 ? void 0 : wrapperProps.children);
|
|
84
93
|
}
|
|
85
94
|
/* eslint-enable jsx-a11y/no-static-element-interactions */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-editor/src/components/block-content-overlay/index.js"],"names":["useSelect","useState","useEffect","store","blockEditorStore","classnames","BlockContentOverlay","clientId","tagName","TagName","wrapperProps","className","baseClassName","isOverlayActive","setIsOverlayActive","isHovered","setIsHovered","isParentSelected","hasChildSelected","isDraggingBlocks","isParentHighlighted","select","isBlockSelected","hasSelectedInnerBlock","_isDraggingBlocks","isBlockHighlighted","classes","undefined","children"],"mappings":";;;AAAA;AACA;AACA;AACA,SAASA,SAAT,QAA0B,iBAA1B;AACA,SAASC,QAAT,EAAmBC,SAAnB,QAAoC,oBAApC;AAEA;AACA;AACA;;AACA,SAASC,KAAK,IAAIC,gBAAlB,QAA0C,aAA1C;AAEA;AACA;AACA;;AACA,OAAOC,UAAP,MAAuB,YAAvB;AAEA,eAAe,SAASC,mBAAT,OAKX;AAAA,MALyC;AAC5CC,IAAAA,QAD4C;AAE5CC,IAAAA,OAAO,EAAEC,OAAO,GAAG,KAFyB;AAG5CC,IAAAA,YAH4C;AAI5CC,IAAAA;AAJ4C,GAKzC;AACH,QAAMC,aAAa,GAAG,oCAAtB;AACA,QAAM,CAAEC,eAAF,EAAmBC,kBAAnB,IAA0Cb,QAAQ,CAAE,IAAF,CAAxD;AACA,QAAM,CAAEc,SAAF,EAAaC,YAAb,IAA8Bf,QAAQ,CAAE,KAAF,CAA5C;AAEA,QAAM;AACLgB,IAAAA,
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-editor/src/components/block-content-overlay/index.js"],"names":["useSelect","useState","useEffect","store","blockEditorStore","classnames","BlockContentOverlay","clientId","tagName","TagName","wrapperProps","className","baseClassName","isOverlayActive","setIsOverlayActive","isHovered","setIsHovered","canEdit","isParentSelected","hasChildSelected","isDraggingBlocks","isParentHighlighted","select","isBlockSelected","hasSelectedInnerBlock","_isDraggingBlocks","isBlockHighlighted","canEditBlock","classes","undefined","children"],"mappings":";;;AAAA;AACA;AACA;AACA,SAASA,SAAT,QAA0B,iBAA1B;AACA,SAASC,QAAT,EAAmBC,SAAnB,QAAoC,oBAApC;AAEA;AACA;AACA;;AACA,SAASC,KAAK,IAAIC,gBAAlB,QAA0C,aAA1C;AAEA;AACA;AACA;;AACA,OAAOC,UAAP,MAAuB,YAAvB;AAEA,eAAe,SAASC,mBAAT,OAKX;AAAA,MALyC;AAC5CC,IAAAA,QAD4C;AAE5CC,IAAAA,OAAO,EAAEC,OAAO,GAAG,KAFyB;AAG5CC,IAAAA,YAH4C;AAI5CC,IAAAA;AAJ4C,GAKzC;AACH,QAAMC,aAAa,GAAG,oCAAtB;AACA,QAAM,CAAEC,eAAF,EAAmBC,kBAAnB,IAA0Cb,QAAQ,CAAE,IAAF,CAAxD;AACA,QAAM,CAAEc,SAAF,EAAaC,YAAb,IAA8Bf,QAAQ,CAAE,KAAF,CAA5C;AAEA,QAAM;AACLgB,IAAAA,OADK;AAELC,IAAAA,gBAFK;AAGLC,IAAAA,gBAHK;AAILC,IAAAA,gBAJK;AAKLC,IAAAA;AALK,MAMFrB,SAAS,CACVsB,MAAF,IAAc;AACb,UA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ACA;AACD,GAvBQ,EAuBN,CACFI,gBADE,EAEFC,gBAFE,EAGFN,eAHE,EAIFE,SAJE,EAKFE,OALE,CAvBM,CAAT,CA1CG,CAyEH;AACA;AACA;;AACA;;AACA,SACC,cAAC,OAAD,eACMP,YADN;AAEC,IAAA,SAAS,EAAGkB,OAFb;AAGC,IAAA,YAAY,EAAG,MAAMZ,YAAY,CAAE,IAAF,CAHlC;AAIC,IAAA,YAAY,EAAG,MAAMA,YAAY,CAAE,KAAF,CAJlC;AAKC,IAAA,SAAS,EACRH,eAAe,IAAII,OAAnB,GACG,MAAMH,kBAAkB,CAAE,KAAF,CAD3B,GAEGe;AARL,MAWGnB,YAXH,aAWGA,YAXH,uBAWGA,YAAY,CAAEoB,QAXjB,CADD;AAeA;AACD","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { useState, useEffect } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../../store';\n\n/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\nexport default function BlockContentOverlay( {\n\tclientId,\n\ttagName: TagName = 'div',\n\twrapperProps,\n\tclassName,\n} ) {\n\tconst baseClassName = 'block-editor-block-content-overlay';\n\tconst [ isOverlayActive, setIsOverlayActive ] = useState( true );\n\tconst [ isHovered, setIsHovered ] = useState( false );\n\n\tconst {\n\t\tcanEdit,\n\t\tisParentSelected,\n\t\thasChildSelected,\n\t\tisDraggingBlocks,\n\t\tisParentHighlighted,\n\t} = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tisBlockSelected,\n\t\t\t\thasSelectedInnerBlock,\n\t\t\t\tisDraggingBlocks: _isDraggingBlocks,\n\t\t\t\tisBlockHighlighted,\n\t\t\t\tcanEditBlock,\n\t\t\t} = select( blockEditorStore );\n\t\t\treturn {\n\t\t\t\tcanEdit: canEditBlock( clientId ),\n\t\t\t\tisParentSelected: isBlockSelected( clientId ),\n\t\t\t\thasChildSelected: hasSelectedInnerBlock( clientId, true ),\n\t\t\t\tisDraggingBlocks: _isDraggingBlocks(),\n\t\t\t\tisParentHighlighted: isBlockHighlighted( clientId ),\n\t\t\t};\n\t\t},\n\t\t[ clientId ]\n\t);\n\n\tconst classes = classnames(\n\t\tbaseClassName,\n\t\twrapperProps?.className,\n\t\tclassName,\n\t\t{\n\t\t\t'overlay-active': isOverlayActive,\n\t\t\t'parent-highlighted': isParentHighlighted,\n\t\t\t'is-dragging-blocks': isDraggingBlocks,\n\t\t}\n\t);\n\n\tuseEffect( () => {\n\t\t// The overlay is always active when editing is locked.\n\t\tif ( ! canEdit ) {\n\t\t\tsetIsOverlayActive( true );\n\t\t\treturn;\n\t\t}\n\n\t\t// Reenable when blocks are not in use.\n\t\tif ( ! isParentSelected && ! hasChildSelected && ! isOverlayActive ) {\n\t\t\tsetIsOverlayActive( true );\n\t\t}\n\t\t// Disable if parent selected by another means (such as list view).\n\t\t// We check hover to ensure the overlay click interaction is not taking place.\n\t\t// Trying to click the overlay will select the parent block via its 'focusin'\n\t\t// listener on the wrapper, so if the block is selected while hovered we will\n\t\t// let the mouseup disable the overlay instead.\n\t\tif ( isParentSelected && ! isHovered && isOverlayActive ) {\n\t\t\tsetIsOverlayActive( false );\n\t\t}\n\t\t// Ensure overlay is disabled if a child block is selected.\n\t\tif ( hasChildSelected && isOverlayActive ) {\n\t\t\tsetIsOverlayActive( false );\n\t\t}\n\t}, [\n\t\tisParentSelected,\n\t\thasChildSelected,\n\t\tisOverlayActive,\n\t\tisHovered,\n\t\tcanEdit,\n\t] );\n\n\t// Disabled because the overlay div doesn't actually have a role or functionality\n\t// as far as the a11y is concerned. We're just catching the first click so that\n\t// the block can be selected without interacting with its contents.\n\t/* eslint-disable jsx-a11y/no-static-element-interactions */\n\treturn (\n\t\t<TagName\n\t\t\t{ ...wrapperProps }\n\t\t\tclassName={ classes }\n\t\t\tonMouseEnter={ () => setIsHovered( true ) }\n\t\t\tonMouseLeave={ () => setIsHovered( false ) }\n\t\t\tonMouseUp={\n\t\t\t\tisOverlayActive && canEdit\n\t\t\t\t\t? () => setIsOverlayActive( false )\n\t\t\t\t\t: undefined\n\t\t\t}\n\t\t>\n\t\t\t{ wrapperProps?.children }\n\t\t</TagName>\n\t);\n}\n/* eslint-enable jsx-a11y/no-static-element-interactions */\n"]}
|
|
@@ -42,6 +42,7 @@ function BlockForType(_ref) {
|
|
|
42
42
|
onDeleteBlock,
|
|
43
43
|
onReplace,
|
|
44
44
|
parentWidth,
|
|
45
|
+
parentBlockAlignment,
|
|
45
46
|
wrapperProps,
|
|
46
47
|
blockWidth,
|
|
47
48
|
baseGlobalStyles
|
|
@@ -73,7 +74,8 @@ function BlockForType(_ref) {
|
|
|
73
74
|
parentWidth: parentWidth,
|
|
74
75
|
contentStyle: contentStyle,
|
|
75
76
|
onDeleteBlock: onDeleteBlock,
|
|
76
|
-
blockWidth: blockWidth
|
|
77
|
+
blockWidth: blockWidth,
|
|
78
|
+
parentBlockAlignment: parentBlockAlignment
|
|
77
79
|
}), createElement(View, {
|
|
78
80
|
onLayout: getBlockWidth
|
|
79
81
|
}));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-editor/src/components/block-list/block.native.js"],"names":["View","Text","TouchableWithoutFeedback","Dimensions","pick","Component","createRef","useMemo","GlobalStylesContext","getMergedGlobalStyles","useMobileGlobalStylesColors","alignmentHelpers","useGlobalStyles","withDispatch","withSelect","compose","withPreferredColorScheme","getBlockType","__experimentalGetAccessibleBlockLabel","getAccessibleBlockLabel","useSetting","styles","BlockEdit","BlockInvalidWarning","BlockMobileToolbar","store","blockEditorStore","emptyArray","BlockForType","attributes","clientId","contentStyle","getBlockWidth","insertBlocksAfter","isSelected","mergeBlocks","name","onBlockFocus","onChange","onDeleteBlock","onReplace","parentWidth","wrapperProps","blockWidth","baseGlobalStyles","defaultColors","fontSizes","globalStyle","mergedStyle","style","JSON","stringify","BLOCK_STYLE_ATTRIBUTES","BlockListBlock","constructor","arguments","bind","onFocus","state","props","marginHorizontal","anchorNodeRef","firstToSelectId","onSelect","blocks","onInsertBlocks","order","nativeEvent","layout","layoutWidth","Math","floor","width","setState","getBlockForType","renderBlockTitle","blockTitle","render","blockType","icon","isValid","title","isDimmed","isTouchable","isStackedHorizontally","isParentSelected","getStylesFromColorScheme","marginVertical","isInnerBlockSelected","align","accessibilityLabel","isFullWidth","isContainerRelated","accessible","screenWidth","get","isScreenWidthEqual","isScreenWidthWider","isFullWidthToolbar","flex","dimmed","solidBorder","borderFullWidth","containerBorderFullWidth","solidBorderColor","solidBorderColorDark","dashedBorder","dashedBorderColor","dashedBorderColorDark","neutralToolbar","current","wrapperPropsCache","WeakMap","emptyObj","getWrapperProps","value","getWrapperPropsFunction","cachedValue","set","select","getBlockIndex","getSettings","isBlockSelected","getBlock","getSelectedBlockClientId","getLowestCommonAncestorWithSelectedBlock","getBlockParents","hasSelectedInnerBlock","block","parents","parentId","selectedBlockClientId","commonAncestor","commonAncestorIndex","indexOf","length","selectedParents","isDescendantOfParentSelected","includes","__experimentalGlobalStylesBaseStyles","getEditWrapperProps","dispatch","ownProps","insertBlocks","replaceBlocks","selectBlock","updateBlockAttributes","forward","getPreviousBlockClientId","getNextBlockClientId","nextBlockClientId","previousBlockClientId","index","rootClientId","initialPosition","indexToSelect"],"mappings":";;;AAAA;AACA;AACA;AACA,SAASA,IAAT,EAAeC,IAAf,EAAqBC,wBAArB,EAA+CC,UAA/C,QAAiE,cAAjE;AACA,SAASC,IAAT,QAAqB,QAArB;AAEA;AACA;AACA;;AACA,SAASC,SAAT,EAAoBC,SAApB,EAA+BC,OAA/B,QAA8C,oBAA9C;AACA,SACCC,mBADD,EAECC,qBAFD,EAGCC,2BAHD,EAICC,gBAJD,EAKCC,eALD,QAMO,uBANP;AAOA,SAASC,YAAT,EAAuBC,UAAvB,QAAyC,iBAAzC;AACA,SAASC,OAAT,EAAkBC,wBAAlB,QAAkD,oBAAlD;AACA,SACCC,YADD,EAECC,qCAAqC,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qBAAqB,GAAGH,wBAAwB,CACrDtH,QADqD,CAAtD;;AAGA,YAAKyH,qBAAL,EAA6B;AAC5BpH,UAAAA,WAAW,CAAEoH,qBAAF,EAAyBzH,QAAzB,CAAX;AACA;AACD;AACD,KArBK;;AAsBNmC,IAAAA,cAAc,CAAED,MAAF,EAAUwF,KAAV,EAAkB;AAC/BT,MAAAA,YAAY,CAAE/E,MAAF,EAAUwF,KAAV,EAAiBV,QAAQ,CAACW,YAA1B,CAAZ;AACA,KAxBK;;AAyBN1F,IAAAA,QAAQ,GAAkD;AAAA,UAAhDjC,QAAgD,uEAArCgH,QAAQ,CAAChH,QAA4B;AAAA,UAAlB4H,eAAkB;AACzDT,MAAAA,WAAW,CAAEnH,QAAF,EAAY4H,eAAZ,CAAX;AACA,KA3BK;;AA4BNpH,IAAAA,QAAQ,EAAIT,UAAF,IAAkB;AAC3BqH,MAAAA,qBAAqB,CAAEJ,QAAQ,CAAChH,QAAX,EAAqBD,UAArB,CAArB;AACA,KA9BK;;AA+BNW,IAAAA,SAAS,CAAEwB,MAAF,EAAU2F,aAAV,EAA0B;AAClCX,MAAAA,aAAa,CAAE,CAAEF,QAAQ,CAAChH,QAAX,CAAF,EAAyBkC,MAAzB,EAAiC2F,aAAjC,CAAb;AACA;;AAjCK,GAAP;AAmCA,CA5CW,CA3EW,EAwHvB3I,wBAxHuB,CAAF,CAAP,CAyHVqC,cAzHU,CAAf","sourcesContent":["/**\n * External dependencies\n */\nimport { View, Text, TouchableWithoutFeedback, Dimensions } from 'react-native';\nimport { pick } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { Component, createRef, useMemo } from '@wordpress/element';\nimport {\n\tGlobalStylesContext,\n\tgetMergedGlobalStyles,\n\tuseMobileGlobalStylesColors,\n\talignmentHelpers,\n\tuseGlobalStyles,\n} from '@wordpress/components';\nimport { withDispatch, withSelect } from '@wordpress/data';\nimport { compose, withPreferredColorScheme } from '@wordpress/compose';\nimport {\n\tgetBlockType,\n\t__experimentalGetAccessibleBlockLabel as getAccessibleBlockLabel,\n} from '@wordpress/blocks';\nimport { useSetting } from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport styles from './block.scss';\nimport BlockEdit from '../block-edit';\nimport BlockInvalidWarning from './block-invalid-warning';\nimport BlockMobileToolbar from '../block-mobile-toolbar';\nimport { store as blockEditorStore } from '../../store';\n\nconst emptyArray = [];\nfunction BlockForType( {\n\tattributes,\n\tclientId,\n\tcontentStyle,\n\tgetBlockWidth,\n\tinsertBlocksAfter,\n\tisSelected,\n\tmergeBlocks,\n\tname,\n\tonBlockFocus,\n\tonChange,\n\tonDeleteBlock,\n\tonReplace,\n\tparentWidth,\n\twrapperProps,\n\tblockWidth,\n\tbaseGlobalStyles,\n} ) {\n\tconst defaultColors = useMobileGlobalStylesColors();\n\tconst fontSizes = useSetting( 'typography.fontSizes' ) || emptyArray;\n\tconst globalStyle = useGlobalStyles();\n\tconst mergedStyle = useMemo( () => {\n\t\treturn getMergedGlobalStyles(\n\t\t\tbaseGlobalStyles,\n\t\t\tglobalStyle,\n\t\t\twrapperProps.style,\n\t\t\tattributes,\n\t\t\tdefaultColors,\n\t\t\tname,\n\t\t\tfontSizes\n\t\t);\n\t}, [\n\t\tdefaultColors,\n\t\tglobalStyle,\n\t\t// I couldn't simply use attributes and wrapperProps.styles as a dependency because they are almost always a new reference.\n\t\t// Thanks to the JSON.stringify we check if the value is the same instead of reference.\n\t\tJSON.stringify( wrapperProps.style ),\n\t\tJSON.stringify(\n\t\t\tpick( attributes, GlobalStylesContext.BLOCK_STYLE_ATTRIBUTES )\n\t\t),\n\t] );\n\n\treturn (\n\t\t<GlobalStylesContext.Provider value={ mergedStyle }>\n\t\t\t<BlockEdit\n\t\t\t\tname={ name }\n\t\t\t\tisSelected={ isSelected }\n\t\t\t\tattributes={ attributes }\n\t\t\t\tsetAttributes={ onChange }\n\t\t\t\tonFocus={ onBlockFocus }\n\t\t\t\tonReplace={ onReplace }\n\t\t\t\tinsertBlocksAfter={ insertBlocksAfter }\n\t\t\t\tmergeBlocks={ mergeBlocks }\n\t\t\t\t// Block level styles.\n\t\t\t\twrapperProps={ wrapperProps }\n\t\t\t\t// Inherited styles merged with block level styles.\n\t\t\t\tstyle={ mergedStyle }\n\t\t\t\tclientId={ clientId }\n\t\t\t\tparentWidth={ parentWidth }\n\t\t\t\tcontentStyle={ contentStyle }\n\t\t\t\tonDeleteBlock={ onDeleteBlock }\n\t\t\t\tblockWidth={ blockWidth }\n\t\t\t/>\n\t\t\t<View onLayout={ getBlockWidth } />\n\t\t</GlobalStylesContext.Provider>\n\t);\n}\n\nclass BlockListBlock extends Component {\n\tconstructor() {\n\t\tsuper( ...arguments );\n\n\t\tthis.insertBlocksAfter = this.insertBlocksAfter.bind( this );\n\t\tthis.onFocus = this.onFocus.bind( this );\n\t\tthis.getBlockWidth = this.getBlockWidth.bind( this );\n\n\t\tthis.state = {\n\t\t\tblockWidth: this.props.blockWidth - 2 * this.props.marginHorizontal,\n\t\t};\n\n\t\tthis.anchorNodeRef = createRef();\n\t}\n\n\tonFocus() {\n\t\tconst { firstToSelectId, isSelected, onSelect } = this.props;\n\t\tif ( ! isSelected ) {\n\t\t\tonSelect( firstToSelectId );\n\t\t}\n\t}\n\n\tinsertBlocksAfter( blocks ) {\n\t\tthis.props.onInsertBlocks( blocks, this.props.order + 1 );\n\n\t\tif ( blocks[ 0 ] ) {\n\t\t\t// Focus on the first block inserted.\n\t\t\tthis.props.onSelect( blocks[ 0 ].clientId );\n\t\t}\n\t}\n\n\tgetBlockWidth( { nativeEvent } ) {\n\t\tconst { layout } = nativeEvent;\n\t\tconst { blockWidth } = this.state;\n\t\tconst layoutWidth = Math.floor( layout.width );\n\n\t\tif ( ! blockWidth || ! layoutWidth ) {\n\t\t\treturn;\n\t\t}\n\n\t\tif ( blockWidth !== layoutWidth ) {\n\t\t\tthis.setState( { blockWidth: layoutWidth } );\n\t\t}\n\t}\n\n\tgetBlockForType() {\n\t\tconst { blockWidth } = this.state;\n\t\treturn (\n\t\t\t<BlockForType\n\t\t\t\t{ ...this.props }\n\t\t\t\tonBlockFocus={ this.onFocus }\n\t\t\t\tinsertBlocksAfter={ this.insertBlocksAfter }\n\t\t\t\tgetBlockWidth={ this.getBlockWidth }\n\t\t\t\tblockWidth={ blockWidth }\n\t\t\t/>\n\t\t);\n\t}\n\n\trenderBlockTitle() {\n\t\treturn (\n\t\t\t<View style={ styles.blockTitle }>\n\t\t\t\t<Text>BlockType: { this.props.name }</Text>\n\t\t\t</View>\n\t\t);\n\t}\n\n\trender() {\n\t\tconst {\n\t\t\tattributes,\n\t\t\tblockType,\n\t\t\tclientId,\n\t\t\ticon,\n\t\t\tisSelected,\n\t\t\tisValid,\n\t\t\torder,\n\t\t\ttitle,\n\t\t\tisDimmed,\n\t\t\tisTouchable,\n\t\t\tonDeleteBlock,\n\t\t\tisStackedHorizontally,\n\t\t\tisParentSelected,\n\t\t\tgetStylesFromColorScheme,\n\t\t\tmarginVertical,\n\t\t\tmarginHorizontal,\n\t\t\tisInnerBlockSelected,\n\t\t\tname,\n\t\t} = this.props;\n\n\t\tif ( ! attributes || ! blockType ) {\n\t\t\treturn null;\n\t\t}\n\t\tconst { blockWidth } = this.state;\n\t\tconst { align } = attributes;\n\t\tconst accessibilityLabel = getAccessibleBlockLabel(\n\t\t\tblockType,\n\t\t\tattributes,\n\t\t\torder + 1\n\t\t);\n\t\tconst { isFullWidth, isContainerRelated } = alignmentHelpers;\n\t\tconst accessible = ! ( isSelected || isInnerBlockSelected );\n\t\tconst screenWidth = Math.floor( Dimensions.get( 'window' ).width );\n\t\tconst isScreenWidthEqual = blockWidth === screenWidth;\n\t\tconst isScreenWidthWider = blockWidth < screenWidth;\n\t\tconst isFullWidthToolbar = isFullWidth( align ) || isScreenWidthEqual;\n\n\t\treturn (\n\t\t\t<TouchableWithoutFeedback\n\t\t\t\tonPress={ this.onFocus }\n\t\t\t\taccessible={ accessible }\n\t\t\t\taccessibilityRole={ 'button' }\n\t\t\t>\n\t\t\t\t<View\n\t\t\t\t\tstyle={ { flex: 1 } }\n\t\t\t\t\taccessibilityLabel={ accessibilityLabel }\n\t\t\t\t>\n\t\t\t\t\t<View\n\t\t\t\t\t\tpointerEvents={ isTouchable ? 'auto' : 'box-only' }\n\t\t\t\t\t\taccessibilityLabel={ accessibilityLabel }\n\t\t\t\t\t\tstyle={ [\n\t\t\t\t\t\t\t{ marginVertical, marginHorizontal, flex: 1 },\n\t\t\t\t\t\t\tisDimmed && styles.dimmed,\n\t\t\t\t\t\t] }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ isSelected && (\n\t\t\t\t\t\t\t<View\n\t\t\t\t\t\t\t\tpointerEvents=\"box-none\"\n\t\t\t\t\t\t\t\tstyle={ [\n\t\t\t\t\t\t\t\t\tstyles.solidBorder,\n\t\t\t\t\t\t\t\t\tisFullWidth( align ) &&\n\t\t\t\t\t\t\t\t\t\tisScreenWidthWider &&\n\t\t\t\t\t\t\t\t\t\tstyles.borderFullWidth,\n\t\t\t\t\t\t\t\t\tisFullWidth( align ) &&\n\t\t\t\t\t\t\t\t\t\tisContainerRelated( name ) &&\n\t\t\t\t\t\t\t\t\t\tisScreenWidthWider &&\n\t\t\t\t\t\t\t\t\t\tstyles.containerBorderFullWidth,\n\t\t\t\t\t\t\t\t\tgetStylesFromColorScheme(\n\t\t\t\t\t\t\t\t\t\tstyles.solidBorderColor,\n\t\t\t\t\t\t\t\t\t\tstyles.solidBorderColorDark\n\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t] }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t{ isParentSelected && (\n\t\t\t\t\t\t\t<View\n\t\t\t\t\t\t\t\tstyle={ [\n\t\t\t\t\t\t\t\t\tstyles.dashedBorder,\n\t\t\t\t\t\t\t\t\tgetStylesFromColorScheme(\n\t\t\t\t\t\t\t\t\t\tstyles.dashedBorderColor,\n\t\t\t\t\t\t\t\t\t\tstyles.dashedBorderColorDark\n\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t] }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t{ isValid ? (\n\t\t\t\t\t\t\tthis.getBlockForType()\n\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t<BlockInvalidWarning\n\t\t\t\t\t\t\t\tblockTitle={ title }\n\t\t\t\t\t\t\t\ticon={ icon }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t<View\n\t\t\t\t\t\t\tstyle={ styles.neutralToolbar }\n\t\t\t\t\t\t\tref={ this.anchorNodeRef }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ isSelected && (\n\t\t\t\t\t\t\t\t<BlockMobileToolbar\n\t\t\t\t\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\t\t\t\t\tonDelete={ onDeleteBlock }\n\t\t\t\t\t\t\t\t\tisStackedHorizontally={\n\t\t\t\t\t\t\t\t\t\tisStackedHorizontally\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tblockWidth={ blockWidth }\n\t\t\t\t\t\t\t\t\tanchorNodeRef={ this.anchorNodeRef.current }\n\t\t\t\t\t\t\t\t\tisFullWidth={ isFullWidthToolbar }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</View>\n\t\t\t\t\t</View>\n\t\t\t\t</View>\n\t\t\t</TouchableWithoutFeedback>\n\t\t);\n\t}\n}\n\n// Helper function to memoize the wrapperProps since getEditWrapperProps always returns a new reference.\nconst wrapperPropsCache = new WeakMap();\nconst emptyObj = {};\nfunction getWrapperProps( value, getWrapperPropsFunction ) {\n\tif ( ! getWrapperPropsFunction ) {\n\t\treturn emptyObj;\n\t}\n\tconst cachedValue = wrapperPropsCache.get( value );\n\tif ( ! cachedValue ) {\n\t\tconst wrapperProps = getWrapperPropsFunction( value );\n\t\twrapperPropsCache.set( value, wrapperProps );\n\t\treturn wrapperProps;\n\t}\n\treturn cachedValue;\n}\n\nexport default compose( [\n\twithSelect( ( select, { clientId } ) => {\n\t\tconst {\n\t\t\tgetBlockIndex,\n\t\t\tgetSettings,\n\t\t\tisBlockSelected,\n\t\t\tgetBlock,\n\t\t\tgetSelectedBlockClientId,\n\t\t\tgetLowestCommonAncestorWithSelectedBlock,\n\t\t\tgetBlockParents,\n\t\t\thasSelectedInnerBlock,\n\t\t} = select( blockEditorStore );\n\n\t\tconst order = getBlockIndex( clientId );\n\t\tconst isSelected = isBlockSelected( clientId );\n\t\tconst isInnerBlockSelected = hasSelectedInnerBlock( clientId );\n\t\tconst block = getBlock( clientId );\n\t\tconst { name, attributes, isValid } = block || {};\n\n\t\tconst blockType = getBlockType( name || 'core/missing' );\n\t\tconst title = blockType?.title;\n\t\tconst icon = blockType?.icon;\n\n\t\tconst parents = getBlockParents( clientId, true );\n\t\tconst parentId = parents[ 0 ] || '';\n\n\t\tconst selectedBlockClientId = getSelectedBlockClientId();\n\n\t\tconst commonAncestor = getLowestCommonAncestorWithSelectedBlock(\n\t\t\tclientId\n\t\t);\n\t\tconst commonAncestorIndex = parents.indexOf( commonAncestor ) - 1;\n\t\tconst firstToSelectId = commonAncestor\n\t\t\t? parents[ commonAncestorIndex ]\n\t\t\t: parents[ parents.length - 1 ];\n\n\t\tconst isParentSelected =\n\t\t\t// Set false as a default value to prevent re-render when it's changed from null to false.\n\t\t\t( selectedBlockClientId || false ) &&\n\t\t\tselectedBlockClientId === parentId;\n\n\t\tconst selectedParents = selectedBlockClientId\n\t\t\t? getBlockParents( selectedBlockClientId )\n\t\t\t: [];\n\t\tconst isDescendantOfParentSelected = selectedParents.includes(\n\t\t\tparentId\n\t\t);\n\t\tconst isTouchable =\n\t\t\tisSelected ||\n\t\t\tisDescendantOfParentSelected ||\n\t\t\tisParentSelected ||\n\t\t\tparentId === '';\n\t\tconst baseGlobalStyles = getSettings()\n\t\t\t?.__experimentalGlobalStylesBaseStyles;\n\n\t\treturn {\n\t\t\ticon,\n\t\t\tname: name || 'core/missing',\n\t\t\torder,\n\t\t\ttitle,\n\t\t\tattributes,\n\t\t\tblockType,\n\t\t\tisSelected,\n\t\t\tisInnerBlockSelected,\n\t\t\tisValid,\n\t\t\tisParentSelected,\n\t\t\tfirstToSelectId,\n\t\t\tisTouchable,\n\t\t\tbaseGlobalStyles,\n\t\t\twrapperProps: getWrapperProps(\n\t\t\t\tattributes,\n\t\t\t\tblockType.getEditWrapperProps\n\t\t\t),\n\t\t};\n\t} ),\n\twithDispatch( ( dispatch, ownProps, { select } ) => {\n\t\tconst {\n\t\t\tinsertBlocks,\n\t\t\tmergeBlocks,\n\t\t\treplaceBlocks,\n\t\t\tselectBlock,\n\t\t\tupdateBlockAttributes,\n\t\t} = dispatch( blockEditorStore );\n\n\t\treturn {\n\t\t\tmergeBlocks( forward ) {\n\t\t\t\tconst { clientId } = ownProps;\n\t\t\t\tconst {\n\t\t\t\t\tgetPreviousBlockClientId,\n\t\t\t\t\tgetNextBlockClientId,\n\t\t\t\t} = select( blockEditorStore );\n\n\t\t\t\tif ( forward ) {\n\t\t\t\t\tconst nextBlockClientId = getNextBlockClientId( clientId );\n\t\t\t\t\tif ( nextBlockClientId ) {\n\t\t\t\t\t\tmergeBlocks( clientId, nextBlockClientId );\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tconst previousBlockClientId = getPreviousBlockClientId(\n\t\t\t\t\t\tclientId\n\t\t\t\t\t);\n\t\t\t\t\tif ( previousBlockClientId ) {\n\t\t\t\t\t\tmergeBlocks( previousBlockClientId, clientId );\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t},\n\t\t\tonInsertBlocks( blocks, index ) {\n\t\t\t\tinsertBlocks( blocks, index, ownProps.rootClientId );\n\t\t\t},\n\t\t\tonSelect( clientId = ownProps.clientId, initialPosition ) {\n\t\t\t\tselectBlock( clientId, initialPosition );\n\t\t\t},\n\t\t\tonChange: ( attributes ) => {\n\t\t\t\tupdateBlockAttributes( ownProps.clientId, attributes );\n\t\t\t},\n\t\t\tonReplace( blocks, indexToSelect ) {\n\t\t\t\treplaceBlocks( [ ownProps.clientId ], blocks, indexToSelect );\n\t\t\t},\n\t\t};\n\t} ),\n\twithPreferredColorScheme,\n] )( BlockListBlock );\n"]}
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-editor/src/components/block-list/block.native.js"],"names":["View","Text","TouchableWithoutFeedback","Dimensions","pick","Component","createRef","useMemo","GlobalStylesContext","getMergedGlobalStyles","useMobileGlobalStylesColors","alignmentHelpers","useGlobalStyles","withDispatch","withSelect","compose","withPreferredColorScheme","getBlockType","__experimentalGetAccessibleBlockLabel","getAccessibleBlockLabel","useSetting","styles","BlockEdit","BlockInvalidWarning","BlockMobileToolbar","store","blockEditorStore","emptyArray","BlockForType","attributes","clientId","contentStyle","getBlockWidth","insertBlocksAfter","isSelected","mergeBlocks","name","onBlockFocus","onChange","onDeleteBlock","onReplace","parentWidth","parentBlockAlignment","wrapperProps","blockWidth","baseGlobalStyles","defaultColors","fontSizes","globalStyle","mergedStyle","style","JSON","stringify","BLOCK_STYLE_ATTRIBUTES","BlockListBlock","constructor","arguments","bind","onFocus","state","props","marginHorizontal","anchorNodeRef","firstToSelectId","onSelect","blocks","onInsertBlocks","order","nativeEvent","layout","layoutWidth","Math","floor","width","setState","getBlockForType","renderBlockTitle","blockTitle","render","blockType","icon","isValid","title","isDimmed","isTouchable","isStackedHorizontally","isParentSelected","getStylesFromColorScheme","marginVertical","isInnerBlockSelected","align","accessibilityLabel","isFullWidth","isContainerRelated","accessible","screenWidth","get","isScreenWidthEqual","isScreenWidthWider","isFullWidthToolbar","flex","dimmed","solidBorder","borderFullWidth","containerBorderFullWidth","solidBorderColor","solidBorderColorDark","dashedBorder","dashedBorderColor","dashedBorderColorDark","neutralToolbar","current","wrapperPropsCache","WeakMap","emptyObj","getWrapperProps","value","getWrapperPropsFunction","cachedValue","set","select","getBlockIndex","getSettings","isBlockSelected","getBlock","getSelectedBlockClientId","getLowestCommonAncestorWithSelectedBlock","getBlockParents","hasSelectedInnerBlock","block","parents","parentId","selectedBlockClientId","commonAncestor","commonAncestorIndex","indexOf","length","selectedParents","isDescendantOfParentSelected","includes","__experimentalGlobalStylesBaseStyles","getEditWrapperProps","dispatch","ownProps","insertBlocks","replaceBlocks","selectBlock","updateBlockAttributes","forward","getPreviousBlockClientId","getNextBlockClientId","nextBlockClientId","previousBlockClientId","index","rootClientId","initialPosition","indexToSelect"],"mappings":";;;AAAA;AACA;AACA;AACA,SAASA,IAAT,EAAeC,IAAf,EAAqBC,wBAArB,EAA+CC,UAA/C,QAAiE,cAAjE;AACA,SAASC,IAAT,QAAqB,QAArB;AAEA;AACA;AACA;;AACA,SAASC,SAAT,EAAoBC,SAApB,EAA+BC,OAA/B,QAA8C,oBAA9C;AACA,SACCC,mBADD,EAECC,qBAFD,EAGCC,2BAHD,EAICC,gBAJD,EAKCC,eALD,QAMO,uBANP;AAOA,SAASC,YAAT,EAAuBC,UAAvB,QAAyC,iBAAzC;AACA,SAASC,OAAT,EAAkBC,wBAAlB,QAAkD,oBAAlD;AACA,SACCC,YADD,EAECC,qCAAqC,IAAIC,uBAF1C,QAGO,mBAHP;AAIA,SAASC,UAAT,QAA2B,yBAA3B;AAEA;AACA;AACA;;AACA,OAAOC,MAAP,MAAmB,cAAnB;AACA,OAAOC,SAAP,MAAsB,eAAtB;AACA,OAAOC,mBAAP,MAAgC,yBAAhC;AACA,OAAOC,kBAAP,MAA+B,yBAA/B;AACA,SAASC,KAAK,IAAIC,gBAAlB,QAA0C,aAA1C;AAEA,MAAMC,UAAU,GAAG,EAAnB;;AACA,SAASC,YAAT,OAkBI;AAAA,MAlBmB;AACtBC,IAAAA,UADsB;AAEtBC,IAAAA,QAFsB;AAGtBC,IAAAA,YAHsB;AAItBC,IAAAA,aAJsB;AAKtBC,IAAAA,iBALsB;AAMtBC,IAAAA,UANsB;AAOtBC,IAAAA,WAPsB;AAQtBC,IAAAA,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AAEpH,QAAF,EAAY6H,eAAZ,CAAX;AACA,KA3BK;;AA4BNrH,IAAAA,QAAQ,EAAIT,UAAF,IAAkB;AAC3BsH,MAAAA,qBAAqB,CAAEJ,QAAQ,CAACjH,QAAX,EAAqBD,UAArB,CAArB;AACA,KA9BK;;AA+BNW,IAAAA,SAAS,CAAEyB,MAAF,EAAU2F,aAAV,EAA0B;AAClCX,MAAAA,aAAa,CAAE,CAAEF,QAAQ,CAACjH,QAAX,CAAF,EAAyBmC,MAAzB,EAAiC2F,aAAjC,CAAb;AACA;;AAjCK,GAAP;AAmCA,CA5CW,CA3EW,EAwHvB5I,wBAxHuB,CAAF,CAAP,CAyHVsC,cAzHU,CAAf","sourcesContent":["/**\n * External dependencies\n */\nimport { View, Text, TouchableWithoutFeedback, Dimensions } from 'react-native';\nimport { pick } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { Component, createRef, useMemo } from '@wordpress/element';\nimport {\n\tGlobalStylesContext,\n\tgetMergedGlobalStyles,\n\tuseMobileGlobalStylesColors,\n\talignmentHelpers,\n\tuseGlobalStyles,\n} from '@wordpress/components';\nimport { withDispatch, withSelect } from '@wordpress/data';\nimport { compose, withPreferredColorScheme } from '@wordpress/compose';\nimport {\n\tgetBlockType,\n\t__experimentalGetAccessibleBlockLabel as getAccessibleBlockLabel,\n} from '@wordpress/blocks';\nimport { useSetting } from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport styles from './block.scss';\nimport BlockEdit from '../block-edit';\nimport BlockInvalidWarning from './block-invalid-warning';\nimport BlockMobileToolbar from '../block-mobile-toolbar';\nimport { store as blockEditorStore } from '../../store';\n\nconst emptyArray = [];\nfunction BlockForType( {\n\tattributes,\n\tclientId,\n\tcontentStyle,\n\tgetBlockWidth,\n\tinsertBlocksAfter,\n\tisSelected,\n\tmergeBlocks,\n\tname,\n\tonBlockFocus,\n\tonChange,\n\tonDeleteBlock,\n\tonReplace,\n\tparentWidth,\n\tparentBlockAlignment,\n\twrapperProps,\n\tblockWidth,\n\tbaseGlobalStyles,\n} ) {\n\tconst defaultColors = useMobileGlobalStylesColors();\n\tconst fontSizes = useSetting( 'typography.fontSizes' ) || emptyArray;\n\tconst globalStyle = useGlobalStyles();\n\tconst mergedStyle = useMemo( () => {\n\t\treturn getMergedGlobalStyles(\n\t\t\tbaseGlobalStyles,\n\t\t\tglobalStyle,\n\t\t\twrapperProps.style,\n\t\t\tattributes,\n\t\t\tdefaultColors,\n\t\t\tname,\n\t\t\tfontSizes\n\t\t);\n\t}, [\n\t\tdefaultColors,\n\t\tglobalStyle,\n\t\t// I couldn't simply use attributes and wrapperProps.styles as a dependency because they are almost always a new reference.\n\t\t// Thanks to the JSON.stringify we check if the value is the same instead of reference.\n\t\tJSON.stringify( wrapperProps.style ),\n\t\tJSON.stringify(\n\t\t\tpick( attributes, GlobalStylesContext.BLOCK_STYLE_ATTRIBUTES )\n\t\t),\n\t] );\n\n\treturn (\n\t\t<GlobalStylesContext.Provider value={ mergedStyle }>\n\t\t\t<BlockEdit\n\t\t\t\tname={ name }\n\t\t\t\tisSelected={ isSelected }\n\t\t\t\tattributes={ attributes }\n\t\t\t\tsetAttributes={ onChange }\n\t\t\t\tonFocus={ onBlockFocus }\n\t\t\t\tonReplace={ onReplace }\n\t\t\t\tinsertBlocksAfter={ insertBlocksAfter }\n\t\t\t\tmergeBlocks={ mergeBlocks }\n\t\t\t\t// Block level styles.\n\t\t\t\twrapperProps={ wrapperProps }\n\t\t\t\t// Inherited styles merged with block level styles.\n\t\t\t\tstyle={ mergedStyle }\n\t\t\t\tclientId={ clientId }\n\t\t\t\tparentWidth={ parentWidth }\n\t\t\t\tcontentStyle={ contentStyle }\n\t\t\t\tonDeleteBlock={ onDeleteBlock }\n\t\t\t\tblockWidth={ blockWidth }\n\t\t\t\tparentBlockAlignment={ parentBlockAlignment }\n\t\t\t/>\n\t\t\t<View onLayout={ getBlockWidth } />\n\t\t</GlobalStylesContext.Provider>\n\t);\n}\n\nclass BlockListBlock extends Component {\n\tconstructor() {\n\t\tsuper( ...arguments );\n\n\t\tthis.insertBlocksAfter = this.insertBlocksAfter.bind( this );\n\t\tthis.onFocus = this.onFocus.bind( this );\n\t\tthis.getBlockWidth = this.getBlockWidth.bind( this );\n\n\t\tthis.state = {\n\t\t\tblockWidth: this.props.blockWidth - 2 * this.props.marginHorizontal,\n\t\t};\n\n\t\tthis.anchorNodeRef = createRef();\n\t}\n\n\tonFocus() {\n\t\tconst { firstToSelectId, isSelected, onSelect } = this.props;\n\t\tif ( ! isSelected ) {\n\t\t\tonSelect( firstToSelectId );\n\t\t}\n\t}\n\n\tinsertBlocksAfter( blocks ) {\n\t\tthis.props.onInsertBlocks( blocks, this.props.order + 1 );\n\n\t\tif ( blocks[ 0 ] ) {\n\t\t\t// Focus on the first block inserted.\n\t\t\tthis.props.onSelect( blocks[ 0 ].clientId );\n\t\t}\n\t}\n\n\tgetBlockWidth( { nativeEvent } ) {\n\t\tconst { layout } = nativeEvent;\n\t\tconst { blockWidth } = this.state;\n\t\tconst layoutWidth = Math.floor( layout.width );\n\n\t\tif ( ! blockWidth || ! layoutWidth ) {\n\t\t\treturn;\n\t\t}\n\n\t\tif ( blockWidth !== layoutWidth ) {\n\t\t\tthis.setState( { blockWidth: layoutWidth } );\n\t\t}\n\t}\n\n\tgetBlockForType() {\n\t\tconst { blockWidth } = this.state;\n\t\treturn (\n\t\t\t<BlockForType\n\t\t\t\t{ ...this.props }\n\t\t\t\tonBlockFocus={ this.onFocus }\n\t\t\t\tinsertBlocksAfter={ this.insertBlocksAfter }\n\t\t\t\tgetBlockWidth={ this.getBlockWidth }\n\t\t\t\tblockWidth={ blockWidth }\n\t\t\t/>\n\t\t);\n\t}\n\n\trenderBlockTitle() {\n\t\treturn (\n\t\t\t<View style={ styles.blockTitle }>\n\t\t\t\t<Text>BlockType: { this.props.name }</Text>\n\t\t\t</View>\n\t\t);\n\t}\n\n\trender() {\n\t\tconst {\n\t\t\tattributes,\n\t\t\tblockType,\n\t\t\tclientId,\n\t\t\ticon,\n\t\t\tisSelected,\n\t\t\tisValid,\n\t\t\torder,\n\t\t\ttitle,\n\t\t\tisDimmed,\n\t\t\tisTouchable,\n\t\t\tonDeleteBlock,\n\t\t\tisStackedHorizontally,\n\t\t\tisParentSelected,\n\t\t\tgetStylesFromColorScheme,\n\t\t\tmarginVertical,\n\t\t\tmarginHorizontal,\n\t\t\tisInnerBlockSelected,\n\t\t\tname,\n\t\t} = this.props;\n\n\t\tif ( ! attributes || ! blockType ) {\n\t\t\treturn null;\n\t\t}\n\t\tconst { blockWidth } = this.state;\n\t\tconst { align } = attributes;\n\t\tconst accessibilityLabel = getAccessibleBlockLabel(\n\t\t\tblockType,\n\t\t\tattributes,\n\t\t\torder + 1\n\t\t);\n\t\tconst { isFullWidth, isContainerRelated } = alignmentHelpers;\n\t\tconst accessible = ! ( isSelected || isInnerBlockSelected );\n\t\tconst screenWidth = Math.floor( Dimensions.get( 'window' ).width );\n\t\tconst isScreenWidthEqual = blockWidth === screenWidth;\n\t\tconst isScreenWidthWider = blockWidth < screenWidth;\n\t\tconst isFullWidthToolbar = isFullWidth( align ) || isScreenWidthEqual;\n\n\t\treturn (\n\t\t\t<TouchableWithoutFeedback\n\t\t\t\tonPress={ this.onFocus }\n\t\t\t\taccessible={ accessible }\n\t\t\t\taccessibilityRole={ 'button' }\n\t\t\t>\n\t\t\t\t<View\n\t\t\t\t\tstyle={ { flex: 1 } }\n\t\t\t\t\taccessibilityLabel={ accessibilityLabel }\n\t\t\t\t>\n\t\t\t\t\t<View\n\t\t\t\t\t\tpointerEvents={ isTouchable ? 'auto' : 'box-only' }\n\t\t\t\t\t\taccessibilityLabel={ accessibilityLabel }\n\t\t\t\t\t\tstyle={ [\n\t\t\t\t\t\t\t{ marginVertical, marginHorizontal, flex: 1 },\n\t\t\t\t\t\t\tisDimmed && styles.dimmed,\n\t\t\t\t\t\t] }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ isSelected && (\n\t\t\t\t\t\t\t<View\n\t\t\t\t\t\t\t\tpointerEvents=\"box-none\"\n\t\t\t\t\t\t\t\tstyle={ [\n\t\t\t\t\t\t\t\t\tstyles.solidBorder,\n\t\t\t\t\t\t\t\t\tisFullWidth( align ) &&\n\t\t\t\t\t\t\t\t\t\tisScreenWidthWider &&\n\t\t\t\t\t\t\t\t\t\tstyles.borderFullWidth,\n\t\t\t\t\t\t\t\t\tisFullWidth( align ) &&\n\t\t\t\t\t\t\t\t\t\tisContainerRelated( name ) &&\n\t\t\t\t\t\t\t\t\t\tisScreenWidthWider &&\n\t\t\t\t\t\t\t\t\t\tstyles.containerBorderFullWidth,\n\t\t\t\t\t\t\t\t\tgetStylesFromColorScheme(\n\t\t\t\t\t\t\t\t\t\tstyles.solidBorderColor,\n\t\t\t\t\t\t\t\t\t\tstyles.solidBorderColorDark\n\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t] }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t{ isParentSelected && (\n\t\t\t\t\t\t\t<View\n\t\t\t\t\t\t\t\tstyle={ [\n\t\t\t\t\t\t\t\t\tstyles.dashedBorder,\n\t\t\t\t\t\t\t\t\tgetStylesFromColorScheme(\n\t\t\t\t\t\t\t\t\t\tstyles.dashedBorderColor,\n\t\t\t\t\t\t\t\t\t\tstyles.dashedBorderColorDark\n\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t] }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t{ isValid ? (\n\t\t\t\t\t\t\tthis.getBlockForType()\n\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t<BlockInvalidWarning\n\t\t\t\t\t\t\t\tblockTitle={ title }\n\t\t\t\t\t\t\t\ticon={ icon }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t<View\n\t\t\t\t\t\t\tstyle={ styles.neutralToolbar }\n\t\t\t\t\t\t\tref={ this.anchorNodeRef }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ isSelected && (\n\t\t\t\t\t\t\t\t<BlockMobileToolbar\n\t\t\t\t\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\t\t\t\t\tonDelete={ onDeleteBlock }\n\t\t\t\t\t\t\t\t\tisStackedHorizontally={\n\t\t\t\t\t\t\t\t\t\tisStackedHorizontally\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tblockWidth={ blockWidth }\n\t\t\t\t\t\t\t\t\tanchorNodeRef={ this.anchorNodeRef.current }\n\t\t\t\t\t\t\t\t\tisFullWidth={ isFullWidthToolbar }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</View>\n\t\t\t\t\t</View>\n\t\t\t\t</View>\n\t\t\t</TouchableWithoutFeedback>\n\t\t);\n\t}\n}\n\n// Helper function to memoize the wrapperProps since getEditWrapperProps always returns a new reference.\nconst wrapperPropsCache = new WeakMap();\nconst emptyObj = {};\nfunction getWrapperProps( value, getWrapperPropsFunction ) {\n\tif ( ! getWrapperPropsFunction ) {\n\t\treturn emptyObj;\n\t}\n\tconst cachedValue = wrapperPropsCache.get( value );\n\tif ( ! cachedValue ) {\n\t\tconst wrapperProps = getWrapperPropsFunction( value );\n\t\twrapperPropsCache.set( value, wrapperProps );\n\t\treturn wrapperProps;\n\t}\n\treturn cachedValue;\n}\n\nexport default compose( [\n\twithSelect( ( select, { clientId } ) => {\n\t\tconst {\n\t\t\tgetBlockIndex,\n\t\t\tgetSettings,\n\t\t\tisBlockSelected,\n\t\t\tgetBlock,\n\t\t\tgetSelectedBlockClientId,\n\t\t\tgetLowestCommonAncestorWithSelectedBlock,\n\t\t\tgetBlockParents,\n\t\t\thasSelectedInnerBlock,\n\t\t} = select( blockEditorStore );\n\n\t\tconst order = getBlockIndex( clientId );\n\t\tconst isSelected = isBlockSelected( clientId );\n\t\tconst isInnerBlockSelected = hasSelectedInnerBlock( clientId );\n\t\tconst block = getBlock( clientId );\n\t\tconst { name, attributes, isValid } = block || {};\n\n\t\tconst blockType = getBlockType( name || 'core/missing' );\n\t\tconst title = blockType?.title;\n\t\tconst icon = blockType?.icon;\n\n\t\tconst parents = getBlockParents( clientId, true );\n\t\tconst parentId = parents[ 0 ] || '';\n\n\t\tconst selectedBlockClientId = getSelectedBlockClientId();\n\n\t\tconst commonAncestor = getLowestCommonAncestorWithSelectedBlock(\n\t\t\tclientId\n\t\t);\n\t\tconst commonAncestorIndex = parents.indexOf( commonAncestor ) - 1;\n\t\tconst firstToSelectId = commonAncestor\n\t\t\t? parents[ commonAncestorIndex ]\n\t\t\t: parents[ parents.length - 1 ];\n\n\t\tconst isParentSelected =\n\t\t\t// Set false as a default value to prevent re-render when it's changed from null to false.\n\t\t\t( selectedBlockClientId || false ) &&\n\t\t\tselectedBlockClientId === parentId;\n\n\t\tconst selectedParents = selectedBlockClientId\n\t\t\t? getBlockParents( selectedBlockClientId )\n\t\t\t: [];\n\t\tconst isDescendantOfParentSelected = selectedParents.includes(\n\t\t\tparentId\n\t\t);\n\t\tconst isTouchable =\n\t\t\tisSelected ||\n\t\t\tisDescendantOfParentSelected ||\n\t\t\tisParentSelected ||\n\t\t\tparentId === '';\n\t\tconst baseGlobalStyles = getSettings()\n\t\t\t?.__experimentalGlobalStylesBaseStyles;\n\n\t\treturn {\n\t\t\ticon,\n\t\t\tname: name || 'core/missing',\n\t\t\torder,\n\t\t\ttitle,\n\t\t\tattributes,\n\t\t\tblockType,\n\t\t\tisSelected,\n\t\t\tisInnerBlockSelected,\n\t\t\tisValid,\n\t\t\tisParentSelected,\n\t\t\tfirstToSelectId,\n\t\t\tisTouchable,\n\t\t\tbaseGlobalStyles,\n\t\t\twrapperProps: getWrapperProps(\n\t\t\t\tattributes,\n\t\t\t\tblockType.getEditWrapperProps\n\t\t\t),\n\t\t};\n\t} ),\n\twithDispatch( ( dispatch, ownProps, { select } ) => {\n\t\tconst {\n\t\t\tinsertBlocks,\n\t\t\tmergeBlocks,\n\t\t\treplaceBlocks,\n\t\t\tselectBlock,\n\t\t\tupdateBlockAttributes,\n\t\t} = dispatch( blockEditorStore );\n\n\t\treturn {\n\t\t\tmergeBlocks( forward ) {\n\t\t\t\tconst { clientId } = ownProps;\n\t\t\t\tconst {\n\t\t\t\t\tgetPreviousBlockClientId,\n\t\t\t\t\tgetNextBlockClientId,\n\t\t\t\t} = select( blockEditorStore );\n\n\t\t\t\tif ( forward ) {\n\t\t\t\t\tconst nextBlockClientId = getNextBlockClientId( clientId );\n\t\t\t\t\tif ( nextBlockClientId ) {\n\t\t\t\t\t\tmergeBlocks( clientId, nextBlockClientId );\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tconst previousBlockClientId = getPreviousBlockClientId(\n\t\t\t\t\t\tclientId\n\t\t\t\t\t);\n\t\t\t\t\tif ( previousBlockClientId ) {\n\t\t\t\t\t\tmergeBlocks( previousBlockClientId, clientId );\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t},\n\t\t\tonInsertBlocks( blocks, index ) {\n\t\t\t\tinsertBlocks( blocks, index, ownProps.rootClientId );\n\t\t\t},\n\t\t\tonSelect( clientId = ownProps.clientId, initialPosition ) {\n\t\t\t\tselectBlock( clientId, initialPosition );\n\t\t\t},\n\t\t\tonChange: ( attributes ) => {\n\t\t\t\tupdateBlockAttributes( ownProps.clientId, attributes );\n\t\t\t},\n\t\t\tonReplace( blocks, indexToSelect ) {\n\t\t\t\treplaceBlocks( [ ownProps.clientId ], blocks, indexToSelect );\n\t\t\t},\n\t\t};\n\t} ),\n\twithPreferredColorScheme,\n] )( BlockListBlock );\n"]}
|
|
@@ -31,11 +31,9 @@ export function useBlockClassNames(clientId) {
|
|
|
31
31
|
getBlockName,
|
|
32
32
|
getSettings,
|
|
33
33
|
hasSelectedInnerBlock,
|
|
34
|
-
isTyping
|
|
35
|
-
__experimentalGetActiveBlockIdByBlockNames: getActiveBlockIdByBlockNames
|
|
34
|
+
isTyping
|
|
36
35
|
} = select(blockEditorStore);
|
|
37
36
|
const {
|
|
38
|
-
__experimentalSpotlightEntityBlocks: spotlightEntityBlocks,
|
|
39
37
|
outlineMode
|
|
40
38
|
} = getSettings();
|
|
41
39
|
const isDragging = isBlockBeingDragged(clientId);
|
|
@@ -44,7 +42,6 @@ export function useBlockClassNames(clientId) {
|
|
|
44
42
|
const checkDeep = true; // "ancestor" is the more appropriate label due to "deep" check.
|
|
45
43
|
|
|
46
44
|
const isAncestorOfSelectedBlock = hasSelectedInnerBlock(clientId, checkDeep);
|
|
47
|
-
const activeEntityBlockId = getActiveBlockIdByBlockNames(spotlightEntityBlocks);
|
|
48
45
|
return classnames({
|
|
49
46
|
'is-selected': isSelected,
|
|
50
47
|
'is-highlighted': isBlockHighlighted(clientId),
|
|
@@ -52,9 +49,6 @@ export function useBlockClassNames(clientId) {
|
|
|
52
49
|
'is-reusable': isReusableBlock(getBlockType(name)),
|
|
53
50
|
'is-dragging': isDragging,
|
|
54
51
|
'has-child-selected': isAncestorOfSelectedBlock,
|
|
55
|
-
'has-active-entity': activeEntityBlockId,
|
|
56
|
-
// Determine if there is an active entity area to spotlight.
|
|
57
|
-
'is-active-entity': activeEntityBlockId === clientId,
|
|
58
52
|
'remove-outline': isSelected && outlineMode && isTyping()
|
|
59
53
|
});
|
|
60
54
|
}, [clientId]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-editor/src/components/block-list/use-block-props/use-block-class-names.js"],"names":["classnames","useSelect","isReusableBlock","getBlockType","store","blockEditorStore","useBlockClassNames","clientId","select","isBlockBeingDragged","isBlockHighlighted","isBlockSelected","isBlockMultiSelected","getBlockName","getSettings","hasSelectedInnerBlock","isTyping","
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-editor/src/components/block-list/use-block-props/use-block-class-names.js"],"names":["classnames","useSelect","isReusableBlock","getBlockType","store","blockEditorStore","useBlockClassNames","clientId","select","isBlockBeingDragged","isBlockHighlighted","isBlockSelected","isBlockMultiSelected","getBlockName","getSettings","hasSelectedInnerBlock","isTyping","outlineMode","isDragging","isSelected","name","checkDeep","isAncestorOfSelectedBlock"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,YAAvB;AAEA;AACA;AACA;;AACA,SAASC,SAAT,QAA0B,iBAA1B;AACA,SAASC,eAAT,EAA0BC,YAA1B,QAA8C,mBAA9C;AAEA;AACA;AACA;;AACA,SAASC,KAAK,IAAIC,gBAAlB,QAA0C,gBAA1C;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASC,kBAAT,CAA6BC,QAA7B,EAAwC;AAC9C,SAAON,SAAS,CACbO,MAAF,IAAc;AACb,UAAM;AACLC,MAAAA,mBADK;AAELC,MAAAA,kBAFK;AAGLC,MAAAA,eAHK;AAILC,MAAAA,oBAJK;AAKLC,MAAAA,YALK;AAMLC,MAAAA,WANK;AAOLC,MAAAA,qBAPK;AAQLC,MAAAA;AARK,QASFR,MAAM,CAAEH,gBAAF,CATV;AAUA,UAAM;AAAEY,MAAAA;AAAF,QAAkBH,WAAW,EAAnC;AACA,UAAMI,UAAU,GAAGT,mBAAmB,CAAEF,QAAF,CAAtC;AACA,UAAMY,UAAU,GAAGR,eAAe,CAAEJ,QAAF,CAAlC;AACA,UAAMa,IAAI,GAAGP,YAAY,CAAEN,QAAF,CAAzB;AACA,UAAMc,SAAS,GAAG,IAAlB,CAfa,CAgBb;;AACA,UAAMC,yBAAyB,GAAGP,qBAAqB,CACtDR,QADsD,EAEtDc,SAFsD,CAAvD;AAIA,WAAOrB,UAAU,CAAE;AAClB,qBAAemB,UADG;AAElB,wBAAkBT,kBAAkB,CAAEH,QAAF,CAFlB;AAGlB,2BAAqBK,oBAAoB,CAAEL,QAAF,CAHvB;AAIlB,qBAAeL,eAAe,CAAEC,YAAY,CAAEiB,IAAF,CAAd,CAJZ;AAKlB,qBAAeF,UALG;AAMlB,4BAAsBI,yBANJ;AAOlB,wBAAkBH,UAAU,IAAIF,WAAd,IAA6BD,QAAQ;AAPrC,KAAF,CAAjB;AASA,GA/Bc,EAgCf,CAAET,QAAF,CAhCe,CAAhB;AAkCA","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { isReusableBlock, getBlockType } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../../../store';\n\n/**\n * Returns the class names used for the different states of the block.\n *\n * @param {string} clientId The block client ID.\n *\n * @return {string} The class names.\n */\nexport function useBlockClassNames( clientId ) {\n\treturn useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tisBlockBeingDragged,\n\t\t\t\tisBlockHighlighted,\n\t\t\t\tisBlockSelected,\n\t\t\t\tisBlockMultiSelected,\n\t\t\t\tgetBlockName,\n\t\t\t\tgetSettings,\n\t\t\t\thasSelectedInnerBlock,\n\t\t\t\tisTyping,\n\t\t\t} = select( blockEditorStore );\n\t\t\tconst { outlineMode } = getSettings();\n\t\t\tconst isDragging = isBlockBeingDragged( clientId );\n\t\t\tconst isSelected = isBlockSelected( clientId );\n\t\t\tconst name = getBlockName( clientId );\n\t\t\tconst checkDeep = true;\n\t\t\t// \"ancestor\" is the more appropriate label due to \"deep\" check.\n\t\t\tconst isAncestorOfSelectedBlock = hasSelectedInnerBlock(\n\t\t\t\tclientId,\n\t\t\t\tcheckDeep\n\t\t\t);\n\t\t\treturn classnames( {\n\t\t\t\t'is-selected': isSelected,\n\t\t\t\t'is-highlighted': isBlockHighlighted( clientId ),\n\t\t\t\t'is-multi-selected': isBlockMultiSelected( clientId ),\n\t\t\t\t'is-reusable': isReusableBlock( getBlockType( name ) ),\n\t\t\t\t'is-dragging': isDragging,\n\t\t\t\t'has-child-selected': isAncestorOfSelectedBlock,\n\t\t\t\t'remove-outline': isSelected && outlineMode && isTyping(),\n\t\t\t} );\n\t\t},\n\t\t[ clientId ]\n\t);\n}\n"]}
|
|
@@ -8,7 +8,8 @@ import { useEffect, useState } from '@wordpress/element';
|
|
|
8
8
|
import { Button, CheckboxControl, Flex, FlexItem, Icon, Modal } from '@wordpress/components';
|
|
9
9
|
import { lock as lockIcon, unlock as unlockIcon } from '@wordpress/icons';
|
|
10
10
|
import { useInstanceId } from '@wordpress/compose';
|
|
11
|
-
import { useDispatch } from '@wordpress/data';
|
|
11
|
+
import { useDispatch, useSelect } from '@wordpress/data';
|
|
12
|
+
import { isReusableBlock, getBlockType } from '@wordpress/blocks';
|
|
12
13
|
/**
|
|
13
14
|
* Internal dependencies
|
|
14
15
|
*/
|
|
@@ -26,9 +27,21 @@ export default function BlockLockModal(_ref) {
|
|
|
26
27
|
remove: false
|
|
27
28
|
});
|
|
28
29
|
const {
|
|
30
|
+
canEdit,
|
|
29
31
|
canMove,
|
|
30
32
|
canRemove
|
|
31
33
|
} = useBlockLock(clientId);
|
|
34
|
+
const {
|
|
35
|
+
isReusable
|
|
36
|
+
} = useSelect(select => {
|
|
37
|
+
const {
|
|
38
|
+
getBlockName
|
|
39
|
+
} = select(blockEditorStore);
|
|
40
|
+
const blockName = getBlockName(clientId);
|
|
41
|
+
return {
|
|
42
|
+
isReusable: isReusableBlock(getBlockType(blockName))
|
|
43
|
+
};
|
|
44
|
+
}, [clientId]);
|
|
32
45
|
const {
|
|
33
46
|
updateBlockAttributes
|
|
34
47
|
} = useDispatch(blockEditorStore);
|
|
@@ -37,9 +50,12 @@ export default function BlockLockModal(_ref) {
|
|
|
37
50
|
useEffect(() => {
|
|
38
51
|
setLock({
|
|
39
52
|
move: !canMove,
|
|
40
|
-
remove: !canRemove
|
|
53
|
+
remove: !canRemove,
|
|
54
|
+
...(isReusable ? {
|
|
55
|
+
edit: !canEdit
|
|
56
|
+
} : {})
|
|
41
57
|
});
|
|
42
|
-
}, [canMove, canRemove]);
|
|
58
|
+
}, [canEdit, canMove, canRemove, isReusable]);
|
|
43
59
|
const isAllChecked = Object.values(lock).every(Boolean);
|
|
44
60
|
const isMixed = Object.values(lock).some(Boolean) && !isAllChecked;
|
|
45
61
|
return createElement(Modal, {
|
|
@@ -70,11 +86,24 @@ export default function BlockLockModal(_ref) {
|
|
|
70
86
|
indeterminate: isMixed,
|
|
71
87
|
onChange: newValue => setLock({
|
|
72
88
|
move: newValue,
|
|
73
|
-
remove: newValue
|
|
89
|
+
remove: newValue,
|
|
90
|
+
...(isReusable ? {
|
|
91
|
+
edit: newValue
|
|
92
|
+
} : {})
|
|
74
93
|
})
|
|
75
94
|
}), createElement("ul", {
|
|
76
95
|
className: "block-editor-block-lock-modal__checklist"
|
|
77
|
-
}, createElement("li", {
|
|
96
|
+
}, isReusable && createElement("li", {
|
|
97
|
+
className: "block-editor-block-lock-modal__checklist-item"
|
|
98
|
+
}, createElement(CheckboxControl, {
|
|
99
|
+
label: createElement(Fragment, null, __('Restrict editing'), createElement(Icon, {
|
|
100
|
+
icon: lock.edit ? lockIcon : unlockIcon
|
|
101
|
+
})),
|
|
102
|
+
checked: !!lock.edit,
|
|
103
|
+
onChange: edit => setLock(prevLock => ({ ...prevLock,
|
|
104
|
+
edit
|
|
105
|
+
}))
|
|
106
|
+
})), createElement("li", {
|
|
78
107
|
className: "block-editor-block-lock-modal__checklist-item"
|
|
79
108
|
}, createElement(CheckboxControl, {
|
|
80
109
|
label: createElement(Fragment, null, __('Disable movement'), createElement(Icon, {
|