@wordpress/block-editor 8.5.0 → 8.6.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-alignment-control/ui.js +1 -1
- package/build/components/block-alignment-control/ui.js.map +1 -1
- 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-lock/index.js +8 -0
- package/build/components/block-lock/index.js.map +1 -1
- package/build/components/block-lock/menu-item.js +5 -20
- package/build/components/block-lock/menu-item.js.map +1 -1
- package/build/components/block-lock/modal.js +33 -12
- package/build/components/block-lock/modal.js.map +1 -1
- package/build/components/block-lock/toolbar.js +7 -20
- package/build/components/block-lock/toolbar.js.map +1 -1
- package/build/components/block-lock/use-block-lock.js +50 -0
- package/build/components/block-lock/use-block-lock.js.map +1 -0
- 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-pattern-setup/index.js +37 -22
- package/build/components/block-pattern-setup/index.js.map +1 -1
- package/build/components/block-pattern-setup/setup-toolbar.js +1 -1
- package/build/components/block-pattern-setup/setup-toolbar.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 +82 -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-preview/auto.js +6 -3
- package/build/components/block-preview/auto.js.map +1 -1
- package/build/components/block-preview/index.js +4 -2
- package/build/components/block-preview/index.js.map +1 -1
- package/build/components/block-styles/index.js +1 -10
- package/build/components/block-styles/index.js.map +1 -1
- package/build/components/block-switcher/index.js +7 -2
- package/build/components/block-switcher/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/copy-handler/index.js +44 -9
- package/build/components/copy-handler/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/inserter/index.native.js +30 -8
- package/build/components/inserter/index.native.js.map +1 -1
- package/build/components/link-control/index.js +6 -7
- package/build/components/link-control/index.js.map +1 -1
- package/build/components/list-view/block-select-button.js +4 -10
- package/build/components/list-view/block-select-button.js.map +1 -1
- package/build/components/list-view/block.js +13 -2
- package/build/components/list-view/block.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/use-block-display-information/index.js +3 -1
- package/build/components/use-block-display-information/index.js.map +1 -1
- package/build/hooks/border.js +468 -44
- package/build/hooks/border.js.map +1 -1
- package/build/hooks/duotone.js +66 -16
- package/build/hooks/duotone.js.map +1 -1
- package/build/hooks/index.js +8 -2
- package/build/hooks/index.js.map +1 -1
- package/build/hooks/use-border-props.js +22 -32
- package/build/hooks/use-border-props.js.map +1 -1
- package/build/index.js +7 -0
- package/build/index.js.map +1 -1
- package/build/store/actions.js +36 -31
- package/build/store/actions.js.map +1 -1
- package/build/store/reducer.js +0 -26
- package/build/store/reducer.js.map +1 -1
- package/build/store/selectors.js +131 -6
- package/build/store/selectors.js.map +1 -1
- package/build/store/utils.js +27 -0
- package/build/store/utils.js.map +1 -0
- package/build-module/components/block-alignment-control/ui.js +2 -2
- package/build-module/components/block-alignment-control/ui.js.map +1 -1
- 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-lock/index.js +1 -0
- package/build-module/components/block-lock/index.js.map +1 -1
- package/build-module/components/block-lock/menu-item.js +4 -18
- package/build-module/components/block-lock/menu-item.js.map +1 -1
- package/build-module/components/block-lock/modal.js +31 -12
- package/build-module/components/block-lock/modal.js.map +1 -1
- package/build-module/components/block-lock/toolbar.js +6 -18
- package/build-module/components/block-lock/toolbar.js.map +1 -1
- package/build-module/components/block-lock/use-block-lock.js +41 -0
- package/build-module/components/block-lock/use-block-lock.js.map +1 -0
- 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-pattern-setup/index.js +39 -24
- package/build-module/components/block-pattern-setup/index.js.map +1 -1
- package/build-module/components/block-pattern-setup/setup-toolbar.js +1 -1
- package/build-module/components/block-pattern-setup/setup-toolbar.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 +67 -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-preview/auto.js +6 -3
- package/build-module/components/block-preview/auto.js.map +1 -1
- package/build-module/components/block-preview/index.js +4 -2
- package/build-module/components/block-preview/index.js.map +1 -1
- 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-switcher/index.js +7 -2
- package/build-module/components/block-switcher/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/copy-handler/index.js +44 -9
- package/build-module/components/copy-handler/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/inserter/index.native.js +31 -10
- package/build-module/components/inserter/index.native.js.map +1 -1
- package/build-module/components/link-control/index.js +6 -7
- package/build-module/components/link-control/index.js.map +1 -1
- package/build-module/components/list-view/block-select-button.js +4 -9
- package/build-module/components/list-view/block-select-button.js.map +1 -1
- package/build-module/components/list-view/block.js +13 -2
- package/build-module/components/list-view/block.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/use-block-display-information/index.js +3 -1
- package/build-module/components/use-block-display-information/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/duotone.js +63 -16
- package/build-module/hooks/duotone.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/use-border-props.js +21 -30
- package/build-module/hooks/use-border-props.js.map +1 -1
- package/build-module/index.js +1 -1
- package/build-module/index.js.map +1 -1
- package/build-module/store/actions.js +19 -16
- package/build-module/store/actions.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 +120 -5
- package/build-module/store/selectors.js.map +1 -1
- package/build-module/store/utils.js +20 -0
- package/build-module/store/utils.js.map +1 -0
- package/build-style/style-rtl.css +145 -272
- package/build-style/style.css +145 -272
- package/package.json +28 -28
- package/src/components/block-alignment-control/ui.js +2 -2
- package/src/components/block-content-overlay/index.js +19 -2
- package/src/components/block-list/block.native.js +2 -0
- package/src/components/block-lock/index.js +1 -0
- package/src/components/block-lock/menu-item.js +3 -23
- package/src/components/block-lock/modal.js +37 -13
- package/src/components/block-lock/style.scss +1 -2
- package/src/components/block-lock/toolbar.js +4 -21
- package/src/components/block-lock/use-block-lock.js +45 -0
- 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-pattern-setup/index.js +84 -59
- package/src/components/block-pattern-setup/setup-toolbar.js +3 -1
- package/src/components/block-pattern-setup/style.scss +32 -26
- 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 +73 -0
- package/src/components/block-popover/style.scss +24 -0
- package/src/components/{block-tools → block-popover}/use-popover-scroll.js +3 -1
- package/src/components/block-preview/auto.js +10 -1
- package/src/components/block-preview/index.js +2 -0
- package/src/components/block-styles/index.js +1 -12
- package/src/components/block-switcher/index.js +13 -1
- package/src/components/block-switcher/style.scss +4 -4
- package/src/components/block-switcher/test/__snapshots__/index.js.snap +15 -13
- 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/copy-handler/index.js +52 -10
- 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/inserter/index.native.js +60 -25
- package/src/components/inserter/style.native.scss +24 -3
- package/src/components/link-control/index.js +5 -5
- package/src/components/list-view/block-select-button.js +2 -10
- package/src/components/list-view/block.js +16 -7
- 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/use-block-display-information/index.js +2 -0
- package/src/hooks/border.js +438 -72
- package/src/hooks/border.scss +48 -0
- package/src/hooks/duotone.js +98 -62
- package/src/hooks/index.js +2 -1
- package/src/hooks/use-border-props.js +15 -32
- package/src/index.js +1 -0
- package/src/store/actions.js +19 -15
- package/src/store/reducer.js +0 -21
- package/src/store/selectors.js +160 -5
- package/src/store/test/actions.js +0 -18
- package/src/store/test/reducer.js +0 -19
- package/src/store/test/selectors.js +0 -19
- package/src/store/utils.js +19 -0
- package/src/style.scss +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/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/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/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
package/src/hooks/duotone.js
CHANGED
|
@@ -60,82 +60,109 @@ export function getValuesFromColors( colors = [] ) {
|
|
|
60
60
|
*/
|
|
61
61
|
|
|
62
62
|
/**
|
|
63
|
-
*
|
|
63
|
+
* Stylesheet for rendering the duotone filter.
|
|
64
64
|
*
|
|
65
65
|
* @param {Object} props Duotone props.
|
|
66
66
|
* @param {string} props.selector Selector to apply the filter to.
|
|
67
67
|
* @param {string} props.id Unique id for this duotone filter.
|
|
68
|
-
* @param {Values} props.values R, G, B, and A values to filter with.
|
|
69
68
|
*
|
|
70
69
|
* @return {WPElement} Duotone element.
|
|
71
70
|
*/
|
|
72
|
-
function
|
|
73
|
-
const
|
|
71
|
+
function DuotoneStylesheet( { selector, id } ) {
|
|
72
|
+
const css = `
|
|
74
73
|
${ selector } {
|
|
75
74
|
filter: url( #${ id } );
|
|
76
75
|
}
|
|
77
76
|
`;
|
|
77
|
+
return <style>{ css }</style>;
|
|
78
|
+
}
|
|
78
79
|
|
|
80
|
+
/**
|
|
81
|
+
* SVG for rendering the duotone filter.
|
|
82
|
+
*
|
|
83
|
+
* @param {Object} props Duotone props.
|
|
84
|
+
* @param {string} props.id Unique id for this duotone filter.
|
|
85
|
+
* @param {Values} props.values R, G, B, and A values to filter with.
|
|
86
|
+
*
|
|
87
|
+
* @return {WPElement} Duotone element.
|
|
88
|
+
*/
|
|
89
|
+
function DuotoneFilter( { id, values } ) {
|
|
79
90
|
return (
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
>
|
|
95
|
-
<
|
|
96
|
-
<
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
91
|
+
<SVG
|
|
92
|
+
xmlnsXlink="http://www.w3.org/1999/xlink"
|
|
93
|
+
viewBox="0 0 0 0"
|
|
94
|
+
width="0"
|
|
95
|
+
height="0"
|
|
96
|
+
focusable="false"
|
|
97
|
+
role="none"
|
|
98
|
+
style={ {
|
|
99
|
+
visibility: 'hidden',
|
|
100
|
+
position: 'absolute',
|
|
101
|
+
left: '-9999px',
|
|
102
|
+
overflow: 'hidden',
|
|
103
|
+
} }
|
|
104
|
+
>
|
|
105
|
+
<defs>
|
|
106
|
+
<filter id={ id }>
|
|
107
|
+
<feColorMatrix
|
|
108
|
+
// Use sRGB instead of linearRGB so transparency looks correct.
|
|
109
|
+
colorInterpolationFilters="sRGB"
|
|
110
|
+
type="matrix"
|
|
111
|
+
// Use perceptual brightness to convert to grayscale.
|
|
112
|
+
values="
|
|
113
|
+
.299 .587 .114 0 0
|
|
114
|
+
.299 .587 .114 0 0
|
|
115
|
+
.299 .587 .114 0 0
|
|
116
|
+
.299 .587 .114 0 0
|
|
117
|
+
"
|
|
118
|
+
/>
|
|
119
|
+
<feComponentTransfer
|
|
120
|
+
// Use sRGB instead of linearRGB to be consistent with how CSS gradients work.
|
|
121
|
+
colorInterpolationFilters="sRGB"
|
|
122
|
+
>
|
|
123
|
+
<feFuncR
|
|
124
|
+
type="table"
|
|
125
|
+
tableValues={ values.r.join( ' ' ) }
|
|
126
|
+
/>
|
|
127
|
+
<feFuncG
|
|
128
|
+
type="table"
|
|
129
|
+
tableValues={ values.g.join( ' ' ) }
|
|
130
|
+
/>
|
|
131
|
+
<feFuncB
|
|
132
|
+
type="table"
|
|
133
|
+
tableValues={ values.b.join( ' ' ) }
|
|
108
134
|
/>
|
|
109
|
-
<
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
>
|
|
113
|
-
<feFuncR
|
|
114
|
-
type="table"
|
|
115
|
-
tableValues={ values.r.join( ' ' ) }
|
|
116
|
-
/>
|
|
117
|
-
<feFuncG
|
|
118
|
-
type="table"
|
|
119
|
-
tableValues={ values.g.join( ' ' ) }
|
|
120
|
-
/>
|
|
121
|
-
<feFuncB
|
|
122
|
-
type="table"
|
|
123
|
-
tableValues={ values.b.join( ' ' ) }
|
|
124
|
-
/>
|
|
125
|
-
<feFuncA
|
|
126
|
-
type="table"
|
|
127
|
-
tableValues={ values.a.join( ' ' ) }
|
|
128
|
-
/>
|
|
129
|
-
</feComponentTransfer>
|
|
130
|
-
<feComposite
|
|
131
|
-
// Re-mask the image with the original transparency since the feColorMatrix above loses that information.
|
|
132
|
-
in2="SourceGraphic"
|
|
133
|
-
operator="in"
|
|
135
|
+
<feFuncA
|
|
136
|
+
type="table"
|
|
137
|
+
tableValues={ values.a.join( ' ' ) }
|
|
134
138
|
/>
|
|
135
|
-
</
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
+
</feComponentTransfer>
|
|
140
|
+
<feComposite
|
|
141
|
+
// Re-mask the image with the original transparency since the feColorMatrix above loses that information.
|
|
142
|
+
in2="SourceGraphic"
|
|
143
|
+
operator="in"
|
|
144
|
+
/>
|
|
145
|
+
</filter>
|
|
146
|
+
</defs>
|
|
147
|
+
</SVG>
|
|
148
|
+
);
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
/**
|
|
152
|
+
* SVG and stylesheet needed for rendering the duotone filter.
|
|
153
|
+
*
|
|
154
|
+
* @param {Object} props Duotone props.
|
|
155
|
+
* @param {string} props.selector Selector to apply the filter to.
|
|
156
|
+
* @param {string} props.id Unique id for this duotone filter.
|
|
157
|
+
* @param {Values} props.values R, G, B, and A values to filter with.
|
|
158
|
+
*
|
|
159
|
+
* @return {WPElement} Duotone element.
|
|
160
|
+
*/
|
|
161
|
+
function InlineDuotone( { selector, id, values } ) {
|
|
162
|
+
return (
|
|
163
|
+
<>
|
|
164
|
+
<DuotoneFilter id={ id } values={ values } />
|
|
165
|
+
<DuotoneStylesheet id={ id } selector={ selector } />
|
|
139
166
|
</>
|
|
140
167
|
);
|
|
141
168
|
}
|
|
@@ -321,7 +348,7 @@ const withDuotoneStyles = createHigherOrderComponent(
|
|
|
321
348
|
<>
|
|
322
349
|
{ element &&
|
|
323
350
|
createPortal(
|
|
324
|
-
<
|
|
351
|
+
<InlineDuotone
|
|
325
352
|
selector={ selectorsGroup }
|
|
326
353
|
id={ id }
|
|
327
354
|
values={ getValuesFromColors( values ) }
|
|
@@ -335,6 +362,15 @@ const withDuotoneStyles = createHigherOrderComponent(
|
|
|
335
362
|
'withDuotoneStyles'
|
|
336
363
|
);
|
|
337
364
|
|
|
365
|
+
export function PresetDuotoneFilter( { preset } ) {
|
|
366
|
+
return (
|
|
367
|
+
<DuotoneFilter
|
|
368
|
+
id={ `wp-duotone-${ preset.slug }` }
|
|
369
|
+
values={ getValuesFromColors( preset.colors ) }
|
|
370
|
+
/>
|
|
371
|
+
);
|
|
372
|
+
}
|
|
373
|
+
|
|
338
374
|
addFilter(
|
|
339
375
|
'blocks.registerBlockType',
|
|
340
376
|
'core/editor/duotone/add-attributes',
|
package/src/hooks/index.js
CHANGED
|
@@ -11,7 +11,7 @@ import './style';
|
|
|
11
11
|
import './color';
|
|
12
12
|
import './duotone';
|
|
13
13
|
import './font-size';
|
|
14
|
-
import './border
|
|
14
|
+
import './border';
|
|
15
15
|
import './layout';
|
|
16
16
|
|
|
17
17
|
export { useCustomSides } from './dimensions';
|
|
@@ -19,3 +19,4 @@ export { getBorderClassesAndStyles, useBorderProps } from './use-border-props';
|
|
|
19
19
|
export { getColorClassesAndStyles, useColorProps } from './use-color-props';
|
|
20
20
|
export { getSpacingClassesAndStyles } from './use-spacing-props';
|
|
21
21
|
export { useCachedTruthy } from './use-cached-truthy';
|
|
22
|
+
export { PresetDuotoneFilter } from './duotone';
|
|
@@ -1,46 +1,28 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* External dependencies
|
|
3
|
-
*/
|
|
4
|
-
import classnames from 'classnames';
|
|
5
|
-
|
|
6
1
|
/**
|
|
7
2
|
* Internal dependencies
|
|
8
3
|
*/
|
|
9
4
|
import { getInlineStyles } from './style';
|
|
10
|
-
import {
|
|
11
|
-
|
|
12
|
-
getColorObjectByAttributeValues,
|
|
13
|
-
} from '../components/colors';
|
|
14
|
-
import useSetting from '../components/use-setting';
|
|
5
|
+
import { getBorderClasses, getMultiOriginColor } from './border';
|
|
6
|
+
import useMultipleOriginColorsAndGradients from '../components/colors-gradients/use-multiple-origin-colors-and-gradients';
|
|
15
7
|
|
|
16
8
|
// This utility is intended to assist where the serialization of the border
|
|
17
9
|
// block support is being skipped for a block but the border related CSS classes
|
|
18
10
|
// & styles still need to be generated so they can be applied to inner elements.
|
|
19
11
|
|
|
20
|
-
const EMPTY_ARRAY = [];
|
|
21
|
-
|
|
22
12
|
/**
|
|
23
13
|
* Provides the CSS class names and inline styles for a block's border support
|
|
24
14
|
* attributes.
|
|
25
15
|
*
|
|
26
|
-
* @param {Object} attributes
|
|
27
|
-
* @param {string} attributes.borderColor Selected named border color.
|
|
28
|
-
* @param {Object} attributes.style Block's styles attribute.
|
|
29
|
-
*
|
|
16
|
+
* @param {Object} attributes Block attributes.
|
|
30
17
|
* @return {Object} Border block support derived CSS classes & styles.
|
|
31
18
|
*/
|
|
32
|
-
export function getBorderClassesAndStyles(
|
|
33
|
-
const
|
|
34
|
-
const
|
|
35
|
-
|
|
36
|
-
const className = classnames( {
|
|
37
|
-
[ borderClass ]: !! borderClass,
|
|
38
|
-
'has-border-color': borderColor || style?.border?.color,
|
|
39
|
-
} );
|
|
19
|
+
export function getBorderClassesAndStyles( attributes ) {
|
|
20
|
+
const border = attributes.style?.border || {};
|
|
21
|
+
const className = getBorderClasses( attributes );
|
|
40
22
|
|
|
41
23
|
return {
|
|
42
24
|
className: className || undefined,
|
|
43
|
-
style: getInlineStyles( { border
|
|
25
|
+
style: getInlineStyles( { border } ),
|
|
44
26
|
};
|
|
45
27
|
}
|
|
46
28
|
|
|
@@ -56,16 +38,17 @@ export function getBorderClassesAndStyles( { borderColor, style } ) {
|
|
|
56
38
|
* @return {Object} ClassName & style props from border block support.
|
|
57
39
|
*/
|
|
58
40
|
export function useBorderProps( attributes ) {
|
|
59
|
-
const colors =
|
|
41
|
+
const { colors } = useMultipleOriginColorsAndGradients();
|
|
60
42
|
const borderProps = getBorderClassesAndStyles( attributes );
|
|
43
|
+
const { borderColor } = attributes;
|
|
61
44
|
|
|
62
|
-
// Force inline
|
|
63
|
-
// color stylesheets in the editor.
|
|
64
|
-
if (
|
|
65
|
-
const borderColorObject =
|
|
45
|
+
// Force inline styles to apply named border colors when themes do not load
|
|
46
|
+
// their color stylesheets in the editor.
|
|
47
|
+
if ( borderColor ) {
|
|
48
|
+
const borderColorObject = getMultiOriginColor( {
|
|
66
49
|
colors,
|
|
67
|
-
|
|
68
|
-
);
|
|
50
|
+
namedColor: borderColor,
|
|
51
|
+
} );
|
|
69
52
|
|
|
70
53
|
borderProps.style.borderColor = borderColorObject.color;
|
|
71
54
|
}
|
package/src/index.js
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import './hooks';
|
|
5
5
|
export {
|
|
6
|
+
PresetDuotoneFilter as __unstablePresetDuotoneFilter,
|
|
6
7
|
getBorderClassesAndStyles as __experimentalGetBorderClassesAndStyles,
|
|
7
8
|
useBorderProps as __experimentalUseBorderProps,
|
|
8
9
|
getColorClassesAndStyles as __experimentalGetColorClassesAndStyles,
|
package/src/store/actions.js
CHANGED
|
@@ -22,6 +22,11 @@ import { __, _n, sprintf } from '@wordpress/i18n';
|
|
|
22
22
|
import { create, insert, remove, toHTMLString } from '@wordpress/rich-text';
|
|
23
23
|
import deprecated from '@wordpress/deprecated';
|
|
24
24
|
|
|
25
|
+
/**
|
|
26
|
+
* Internal dependencies
|
|
27
|
+
*/
|
|
28
|
+
import { mapRichTextSettings } from './utils';
|
|
29
|
+
|
|
25
30
|
/**
|
|
26
31
|
* Action which will insert a default block insert action if there
|
|
27
32
|
* are no other blocks at the root of the editor. This action should be used
|
|
@@ -667,19 +672,6 @@ export const synchronizeTemplate = () => ( { select, dispatch } ) => {
|
|
|
667
672
|
dispatch.resetBlocks( updatedBlockList );
|
|
668
673
|
};
|
|
669
674
|
|
|
670
|
-
function mapRichTextSettings( attributeDefinition ) {
|
|
671
|
-
const {
|
|
672
|
-
multiline: multilineTag,
|
|
673
|
-
__unstableMultilineWrapperTags: multilineWrapperTags,
|
|
674
|
-
__unstablePreserveWhiteSpace: preserveWhiteSpace,
|
|
675
|
-
} = attributeDefinition;
|
|
676
|
-
return {
|
|
677
|
-
multilineTag,
|
|
678
|
-
multilineWrapperTags,
|
|
679
|
-
preserveWhiteSpace,
|
|
680
|
-
};
|
|
681
|
-
}
|
|
682
|
-
|
|
683
675
|
/**
|
|
684
676
|
* Delete the current selection.
|
|
685
677
|
*
|
|
@@ -1269,22 +1261,34 @@ export function stopDraggingBlocks() {
|
|
|
1269
1261
|
/**
|
|
1270
1262
|
* Returns an action object used in signalling that the caret has entered formatted text.
|
|
1271
1263
|
*
|
|
1264
|
+
* @deprecated
|
|
1265
|
+
*
|
|
1272
1266
|
* @return {Object} Action object.
|
|
1273
1267
|
*/
|
|
1274
1268
|
export function enterFormattedText() {
|
|
1269
|
+
deprecated( 'wp.data.dispatch( "core/block-editor" ).enterFormattedText', {
|
|
1270
|
+
since: '6.1',
|
|
1271
|
+
version: '6.3',
|
|
1272
|
+
} );
|
|
1275
1273
|
return {
|
|
1276
|
-
type: '
|
|
1274
|
+
type: 'DO_NOTHING',
|
|
1277
1275
|
};
|
|
1278
1276
|
}
|
|
1279
1277
|
|
|
1280
1278
|
/**
|
|
1281
1279
|
* Returns an action object used in signalling that the user caret has exited formatted text.
|
|
1282
1280
|
*
|
|
1281
|
+
* @deprecated
|
|
1282
|
+
*
|
|
1283
1283
|
* @return {Object} Action object.
|
|
1284
1284
|
*/
|
|
1285
1285
|
export function exitFormattedText() {
|
|
1286
|
+
deprecated( 'wp.data.dispatch( "core/block-editor" ).exitFormattedText', {
|
|
1287
|
+
since: '6.1',
|
|
1288
|
+
version: '6.3',
|
|
1289
|
+
} );
|
|
1286
1290
|
return {
|
|
1287
|
-
type: '
|
|
1291
|
+
type: 'DO_NOTHING',
|
|
1288
1292
|
};
|
|
1289
1293
|
}
|
|
1290
1294
|
|
package/src/store/reducer.js
CHANGED
|
@@ -1181,26 +1181,6 @@ export function draggedBlocks( state = [], action ) {
|
|
|
1181
1181
|
return state;
|
|
1182
1182
|
}
|
|
1183
1183
|
|
|
1184
|
-
/**
|
|
1185
|
-
* Reducer returning whether the caret is within formatted text.
|
|
1186
|
-
*
|
|
1187
|
-
* @param {boolean} state Current state.
|
|
1188
|
-
* @param {Object} action Dispatched action.
|
|
1189
|
-
*
|
|
1190
|
-
* @return {boolean} Updated state.
|
|
1191
|
-
*/
|
|
1192
|
-
export function isCaretWithinFormattedText( state = false, action ) {
|
|
1193
|
-
switch ( action.type ) {
|
|
1194
|
-
case 'ENTER_FORMATTED_TEXT':
|
|
1195
|
-
return true;
|
|
1196
|
-
|
|
1197
|
-
case 'EXIT_FORMATTED_TEXT':
|
|
1198
|
-
return false;
|
|
1199
|
-
}
|
|
1200
|
-
|
|
1201
|
-
return state;
|
|
1202
|
-
}
|
|
1203
|
-
|
|
1204
1184
|
/**
|
|
1205
1185
|
* Internal helper reducer for selectionStart and selectionEnd. Can hold a block
|
|
1206
1186
|
* selection, represented by an object with property clientId.
|
|
@@ -1765,7 +1745,6 @@ export default combineReducers( {
|
|
|
1765
1745
|
blocks,
|
|
1766
1746
|
isTyping,
|
|
1767
1747
|
draggedBlocks,
|
|
1768
|
-
isCaretWithinFormattedText,
|
|
1769
1748
|
selection,
|
|
1770
1749
|
isMultiSelecting,
|
|
1771
1750
|
isSelectionEnabled,
|
package/src/store/selectors.js
CHANGED
|
@@ -33,6 +33,13 @@ import { Platform } from '@wordpress/element';
|
|
|
33
33
|
import { applyFilters } from '@wordpress/hooks';
|
|
34
34
|
import { symbol } from '@wordpress/icons';
|
|
35
35
|
import { __ } from '@wordpress/i18n';
|
|
36
|
+
import { create, remove, toHTMLString } from '@wordpress/rich-text';
|
|
37
|
+
import deprecated from '@wordpress/deprecated';
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Internal dependencies
|
|
41
|
+
*/
|
|
42
|
+
import { mapRichTextSettings } from './utils';
|
|
36
43
|
|
|
37
44
|
/**
|
|
38
45
|
* A block selection object.
|
|
@@ -926,6 +933,25 @@ export function __unstableIsFullySelected( state ) {
|
|
|
926
933
|
);
|
|
927
934
|
}
|
|
928
935
|
|
|
936
|
+
/**
|
|
937
|
+
* Returns true if the selection is collapsed.
|
|
938
|
+
*
|
|
939
|
+
* @param {Object} state Editor state.
|
|
940
|
+
*
|
|
941
|
+
* @return {boolean} Whether the selection is collapsed.
|
|
942
|
+
*/
|
|
943
|
+
export function __unstableIsSelectionCollapsed( state ) {
|
|
944
|
+
const selectionAnchor = getSelectionStart( state );
|
|
945
|
+
const selectionFocus = getSelectionEnd( state );
|
|
946
|
+
return (
|
|
947
|
+
!! selectionAnchor &&
|
|
948
|
+
!! selectionFocus &&
|
|
949
|
+
selectionAnchor.clientId === selectionFocus.clientId &&
|
|
950
|
+
selectionAnchor.attributeKey === selectionFocus.attributeKey &&
|
|
951
|
+
selectionAnchor.offset === selectionFocus.offset
|
|
952
|
+
);
|
|
953
|
+
}
|
|
954
|
+
|
|
929
955
|
/**
|
|
930
956
|
* Check whether the selection is mergeable.
|
|
931
957
|
*
|
|
@@ -1004,6 +1030,107 @@ export function __unstableIsSelectionMergeable( state, isForward ) {
|
|
|
1004
1030
|
return blocksToMerge && blocksToMerge.length;
|
|
1005
1031
|
}
|
|
1006
1032
|
|
|
1033
|
+
/**
|
|
1034
|
+
* Get partial selected blocks with their content updated
|
|
1035
|
+
* based on the selection.
|
|
1036
|
+
*
|
|
1037
|
+
* @param {Object} state Editor state.
|
|
1038
|
+
*
|
|
1039
|
+
* @return {Object[]} Updated partial selected blocks.
|
|
1040
|
+
*/
|
|
1041
|
+
export const __unstableGetSelectedBlocksWithPartialSelection = ( state ) => {
|
|
1042
|
+
const selectionAnchor = getSelectionStart( state );
|
|
1043
|
+
const selectionFocus = getSelectionEnd( state );
|
|
1044
|
+
|
|
1045
|
+
if ( selectionAnchor.clientId === selectionFocus.clientId ) {
|
|
1046
|
+
return EMPTY_ARRAY;
|
|
1047
|
+
}
|
|
1048
|
+
|
|
1049
|
+
// Can't split if the selection is not set.
|
|
1050
|
+
if (
|
|
1051
|
+
! selectionAnchor.attributeKey ||
|
|
1052
|
+
! selectionFocus.attributeKey ||
|
|
1053
|
+
typeof selectionAnchor.offset === 'undefined' ||
|
|
1054
|
+
typeof selectionFocus.offset === 'undefined'
|
|
1055
|
+
) {
|
|
1056
|
+
return EMPTY_ARRAY;
|
|
1057
|
+
}
|
|
1058
|
+
|
|
1059
|
+
const anchorRootClientId = getBlockRootClientId(
|
|
1060
|
+
state,
|
|
1061
|
+
selectionAnchor.clientId
|
|
1062
|
+
);
|
|
1063
|
+
const focusRootClientId = getBlockRootClientId(
|
|
1064
|
+
state,
|
|
1065
|
+
selectionFocus.clientId
|
|
1066
|
+
);
|
|
1067
|
+
|
|
1068
|
+
// It's not splittable if the selection doesn't start and end in the same
|
|
1069
|
+
// block list. Maybe in the future it should be allowed.
|
|
1070
|
+
if ( anchorRootClientId !== focusRootClientId ) {
|
|
1071
|
+
return EMPTY_ARRAY;
|
|
1072
|
+
}
|
|
1073
|
+
|
|
1074
|
+
const blockOrder = getBlockOrder( state, anchorRootClientId );
|
|
1075
|
+
const anchorIndex = blockOrder.indexOf( selectionAnchor.clientId );
|
|
1076
|
+
const focusIndex = blockOrder.indexOf( selectionFocus.clientId );
|
|
1077
|
+
|
|
1078
|
+
// Reassign selection start and end based on order.
|
|
1079
|
+
const [ selectionStart, selectionEnd ] =
|
|
1080
|
+
anchorIndex > focusIndex
|
|
1081
|
+
? [ selectionFocus, selectionAnchor ]
|
|
1082
|
+
: [ selectionAnchor, selectionFocus ];
|
|
1083
|
+
|
|
1084
|
+
const blockA = getBlock( state, selectionStart.clientId );
|
|
1085
|
+
const blockAType = getBlockType( blockA.name );
|
|
1086
|
+
|
|
1087
|
+
const blockB = getBlock( state, selectionEnd.clientId );
|
|
1088
|
+
const blockBType = getBlockType( blockB.name );
|
|
1089
|
+
|
|
1090
|
+
const htmlA = blockA.attributes[ selectionStart.attributeKey ];
|
|
1091
|
+
const htmlB = blockB.attributes[ selectionEnd.attributeKey ];
|
|
1092
|
+
|
|
1093
|
+
const attributeDefinitionA =
|
|
1094
|
+
blockAType.attributes[ selectionStart.attributeKey ];
|
|
1095
|
+
const attributeDefinitionB =
|
|
1096
|
+
blockBType.attributes[ selectionEnd.attributeKey ];
|
|
1097
|
+
|
|
1098
|
+
let valueA = create( {
|
|
1099
|
+
html: htmlA,
|
|
1100
|
+
...mapRichTextSettings( attributeDefinitionA ),
|
|
1101
|
+
} );
|
|
1102
|
+
let valueB = create( {
|
|
1103
|
+
html: htmlB,
|
|
1104
|
+
...mapRichTextSettings( attributeDefinitionB ),
|
|
1105
|
+
} );
|
|
1106
|
+
|
|
1107
|
+
valueA = remove( valueA, 0, selectionStart.offset );
|
|
1108
|
+
valueB = remove( valueB, selectionEnd.offset, valueB.text.length );
|
|
1109
|
+
|
|
1110
|
+
return [
|
|
1111
|
+
{
|
|
1112
|
+
...blockA,
|
|
1113
|
+
attributes: {
|
|
1114
|
+
...blockA.attributes,
|
|
1115
|
+
[ selectionStart.attributeKey ]: toHTMLString( {
|
|
1116
|
+
value: valueA,
|
|
1117
|
+
...mapRichTextSettings( attributeDefinitionA ),
|
|
1118
|
+
} ),
|
|
1119
|
+
},
|
|
1120
|
+
},
|
|
1121
|
+
{
|
|
1122
|
+
...blockB,
|
|
1123
|
+
attributes: {
|
|
1124
|
+
...blockB.attributes,
|
|
1125
|
+
[ selectionEnd.attributeKey ]: toHTMLString( {
|
|
1126
|
+
value: valueB,
|
|
1127
|
+
...mapRichTextSettings( attributeDefinitionB ),
|
|
1128
|
+
} ),
|
|
1129
|
+
},
|
|
1130
|
+
},
|
|
1131
|
+
];
|
|
1132
|
+
};
|
|
1133
|
+
|
|
1007
1134
|
/**
|
|
1008
1135
|
* Returns an array containing all block client IDs in the editor in the order
|
|
1009
1136
|
* they appear. Optionally accepts a root client ID of the block list for which
|
|
@@ -1218,12 +1345,20 @@ export function isAncestorBeingDragged( state, clientId ) {
|
|
|
1218
1345
|
/**
|
|
1219
1346
|
* Returns true if the caret is within formatted text, or false otherwise.
|
|
1220
1347
|
*
|
|
1221
|
-
* @
|
|
1348
|
+
* @deprecated
|
|
1222
1349
|
*
|
|
1223
1350
|
* @return {boolean} Whether the caret is within formatted text.
|
|
1224
1351
|
*/
|
|
1225
|
-
export function isCaretWithinFormattedText(
|
|
1226
|
-
|
|
1352
|
+
export function isCaretWithinFormattedText() {
|
|
1353
|
+
deprecated(
|
|
1354
|
+
'wp.data.select( "core/block-editor" ).isCaretWithinFormattedText',
|
|
1355
|
+
{
|
|
1356
|
+
since: '6.1',
|
|
1357
|
+
version: '6.3',
|
|
1358
|
+
}
|
|
1359
|
+
);
|
|
1360
|
+
|
|
1361
|
+
return false;
|
|
1227
1362
|
}
|
|
1228
1363
|
|
|
1229
1364
|
/**
|
|
@@ -1504,7 +1639,7 @@ export function canRemoveBlock( state, clientId, rootClientId = null ) {
|
|
|
1504
1639
|
|
|
1505
1640
|
const { lock } = attributes;
|
|
1506
1641
|
const parentIsLocked = !! getTemplateLock( state, rootClientId );
|
|
1507
|
-
// If we don't have a lock on the blockType level, we
|
|
1642
|
+
// If we don't have a lock on the blockType level, we defer to the parent templateLock.
|
|
1508
1643
|
if ( lock === undefined || lock?.remove === undefined ) {
|
|
1509
1644
|
return ! parentIsLocked;
|
|
1510
1645
|
}
|
|
@@ -1545,7 +1680,7 @@ export function canMoveBlock( state, clientId, rootClientId = null ) {
|
|
|
1545
1680
|
|
|
1546
1681
|
const { lock } = attributes;
|
|
1547
1682
|
const parentIsLocked = getTemplateLock( state, rootClientId ) === 'all';
|
|
1548
|
-
// If we don't have a lock on the blockType level, we
|
|
1683
|
+
// If we don't have a lock on the blockType level, we defer to the parent templateLock.
|
|
1549
1684
|
if ( lock === undefined || lock?.move === undefined ) {
|
|
1550
1685
|
return ! parentIsLocked;
|
|
1551
1686
|
}
|
|
@@ -1569,6 +1704,26 @@ export function canMoveBlocks( state, clientIds, rootClientId = null ) {
|
|
|
1569
1704
|
);
|
|
1570
1705
|
}
|
|
1571
1706
|
|
|
1707
|
+
/**
|
|
1708
|
+
* Determines if the given block is allowed to be edited.
|
|
1709
|
+
*
|
|
1710
|
+
* @param {Object} state Editor state.
|
|
1711
|
+
* @param {string} clientId The block client Id.
|
|
1712
|
+
*
|
|
1713
|
+
* @return {boolean} Whether the given block is allowed to be edited.
|
|
1714
|
+
*/
|
|
1715
|
+
export function canEditBlock( state, clientId ) {
|
|
1716
|
+
const attributes = getBlockAttributes( state, clientId );
|
|
1717
|
+
if ( attributes === null ) {
|
|
1718
|
+
return true;
|
|
1719
|
+
}
|
|
1720
|
+
|
|
1721
|
+
const { lock } = attributes;
|
|
1722
|
+
|
|
1723
|
+
// When the edit is true, we cannot edit the block.
|
|
1724
|
+
return ! lock?.edit;
|
|
1725
|
+
}
|
|
1726
|
+
|
|
1572
1727
|
/**
|
|
1573
1728
|
* Determines if the given block type can be locked/unlocked by a user.
|
|
1574
1729
|
*
|
|
@@ -26,8 +26,6 @@ import { STORE_NAME as blockEditorStoreName } from '../../store/constants';
|
|
|
26
26
|
|
|
27
27
|
const {
|
|
28
28
|
clearSelectedBlock,
|
|
29
|
-
enterFormattedText,
|
|
30
|
-
exitFormattedText,
|
|
31
29
|
hideInsertionPoint,
|
|
32
30
|
insertBlock,
|
|
33
31
|
insertBlocks,
|
|
@@ -819,22 +817,6 @@ describe( 'actions', () => {
|
|
|
819
817
|
} );
|
|
820
818
|
} );
|
|
821
819
|
|
|
822
|
-
describe( 'enterFormattedText', () => {
|
|
823
|
-
it( 'should return the ENTER_FORMATTED_TEXT action', () => {
|
|
824
|
-
expect( enterFormattedText() ).toEqual( {
|
|
825
|
-
type: 'ENTER_FORMATTED_TEXT',
|
|
826
|
-
} );
|
|
827
|
-
} );
|
|
828
|
-
} );
|
|
829
|
-
|
|
830
|
-
describe( 'exitFormattedText', () => {
|
|
831
|
-
it( 'should return the EXIT_FORMATTED_TEXT action', () => {
|
|
832
|
-
expect( exitFormattedText() ).toEqual( {
|
|
833
|
-
type: 'EXIT_FORMATTED_TEXT',
|
|
834
|
-
} );
|
|
835
|
-
} );
|
|
836
|
-
} );
|
|
837
|
-
|
|
838
820
|
describe( 'toggleSelection', () => {
|
|
839
821
|
it( 'should return the TOGGLE_SELECTION action with default value for isSelectionEnabled = true', () => {
|
|
840
822
|
expect( toggleSelection() ).toEqual( {
|
|
@@ -22,7 +22,6 @@ import {
|
|
|
22
22
|
blocks,
|
|
23
23
|
isTyping,
|
|
24
24
|
draggedBlocks,
|
|
25
|
-
isCaretWithinFormattedText,
|
|
26
25
|
selection,
|
|
27
26
|
initialPosition,
|
|
28
27
|
isMultiSelecting,
|
|
@@ -2160,24 +2159,6 @@ describe( 'state', () => {
|
|
|
2160
2159
|
} );
|
|
2161
2160
|
} );
|
|
2162
2161
|
|
|
2163
|
-
describe( 'isCaretWithinFormattedText()', () => {
|
|
2164
|
-
it( 'should set the flag to true', () => {
|
|
2165
|
-
const state = isCaretWithinFormattedText( false, {
|
|
2166
|
-
type: 'ENTER_FORMATTED_TEXT',
|
|
2167
|
-
} );
|
|
2168
|
-
|
|
2169
|
-
expect( state ).toBe( true );
|
|
2170
|
-
} );
|
|
2171
|
-
|
|
2172
|
-
it( 'should set the flag to false', () => {
|
|
2173
|
-
const state = isCaretWithinFormattedText( true, {
|
|
2174
|
-
type: 'EXIT_FORMATTED_TEXT',
|
|
2175
|
-
} );
|
|
2176
|
-
|
|
2177
|
-
expect( state ).toBe( false );
|
|
2178
|
-
} );
|
|
2179
|
-
} );
|
|
2180
|
-
|
|
2181
2162
|
describe( 'initialPosition()', () => {
|
|
2182
2163
|
it( 'should return with block clientId as selected', () => {
|
|
2183
2164
|
const state = initialPosition( undefined, {
|