@wordpress/block-editor 8.5.2 → 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-list/block.native.js +3 -1
- package/build/components/block-list/block.native.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-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-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/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/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 +14 -2
- 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 +9 -3
- package/build/store/selectors.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-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-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-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/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/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 +14 -2
- 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 +8 -3
- package/build-module/store/selectors.js.map +1 -1
- package/build-style/style-rtl.css +111 -246
- package/build-style/style.css +111 -246
- package/package.json +28 -28
- package/src/components/block-list/block.native.js +2 -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-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-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/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/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 +14 -2
- package/src/store/reducer.js +0 -21
- package/src/store/selectors.js +12 -3
- 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/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
|
@@ -9,11 +9,9 @@ import classnames from 'classnames';
|
|
|
9
9
|
*/
|
|
10
10
|
import { useState, useRef, useEffect } from '@wordpress/element';
|
|
11
11
|
import { isUnmodifiedDefaultBlock } from '@wordpress/blocks';
|
|
12
|
-
import { Popover } from '@wordpress/components';
|
|
13
12
|
import { useDispatch, useSelect } from '@wordpress/data';
|
|
14
13
|
import { useShortcut } from '@wordpress/keyboard-shortcuts';
|
|
15
14
|
import { useViewportMatch } from '@wordpress/compose';
|
|
16
|
-
import { getScrollContainer } from '@wordpress/dom';
|
|
17
15
|
|
|
18
16
|
/**
|
|
19
17
|
* Internal dependencies
|
|
@@ -22,8 +20,7 @@ import BlockSelectionButton from './block-selection-button';
|
|
|
22
20
|
import BlockContextualToolbar from './block-contextual-toolbar';
|
|
23
21
|
import Inserter from '../inserter';
|
|
24
22
|
import { store as blockEditorStore } from '../../store';
|
|
25
|
-
import
|
|
26
|
-
import { usePopoverScroll } from './use-popover-scroll';
|
|
23
|
+
import BlockPopover from '../block-popover';
|
|
27
24
|
|
|
28
25
|
function selector( select ) {
|
|
29
26
|
const {
|
|
@@ -31,7 +28,6 @@ function selector( select ) {
|
|
|
31
28
|
isMultiSelecting,
|
|
32
29
|
hasMultiSelection,
|
|
33
30
|
isTyping,
|
|
34
|
-
isCaretWithinFormattedText,
|
|
35
31
|
getSettings,
|
|
36
32
|
getLastMultiSelectedBlockClientId,
|
|
37
33
|
} = select( blockEditorStore );
|
|
@@ -39,17 +35,16 @@ function selector( select ) {
|
|
|
39
35
|
isNavigationMode: isNavigationMode(),
|
|
40
36
|
isMultiSelecting: isMultiSelecting(),
|
|
41
37
|
isTyping: isTyping(),
|
|
42
|
-
isCaretWithinFormattedText: isCaretWithinFormattedText(),
|
|
43
|
-
hasMultiSelection: hasMultiSelection(),
|
|
44
38
|
hasFixedToolbar: getSettings().hasFixedToolbar,
|
|
45
|
-
lastClientId:
|
|
39
|
+
lastClientId: hasMultiSelection()
|
|
40
|
+
? getLastMultiSelectedBlockClientId()
|
|
41
|
+
: null,
|
|
46
42
|
};
|
|
47
43
|
}
|
|
48
44
|
|
|
49
|
-
function
|
|
45
|
+
function SelectedBlockPopover( {
|
|
50
46
|
clientId,
|
|
51
47
|
rootClientId,
|
|
52
|
-
isValid,
|
|
53
48
|
isEmptyDefaultBlock,
|
|
54
49
|
capturingClientId,
|
|
55
50
|
__unstablePopoverSlot,
|
|
@@ -59,8 +54,6 @@ function BlockPopover( {
|
|
|
59
54
|
isNavigationMode,
|
|
60
55
|
isMultiSelecting,
|
|
61
56
|
isTyping,
|
|
62
|
-
isCaretWithinFormattedText,
|
|
63
|
-
hasMultiSelection,
|
|
64
57
|
hasFixedToolbar,
|
|
65
58
|
lastClientId,
|
|
66
59
|
} = useSelect( selector, [] );
|
|
@@ -83,22 +76,20 @@ function BlockPopover( {
|
|
|
83
76
|
[ clientId ]
|
|
84
77
|
);
|
|
85
78
|
const isLargeViewport = useViewportMatch( 'medium' );
|
|
86
|
-
const
|
|
79
|
+
const isToolbarForced = useRef( false );
|
|
87
80
|
const [ isInserterShown, setIsInserterShown ] = useState( false );
|
|
88
81
|
const { stopTyping } = useDispatch( blockEditorStore );
|
|
89
82
|
|
|
90
|
-
// Controls when the side inserter on empty lines should
|
|
91
|
-
// be shown, including writing and selection modes.
|
|
92
83
|
const showEmptyBlockSideInserter =
|
|
93
|
-
! isTyping && ! isNavigationMode && isEmptyDefaultBlock
|
|
84
|
+
! isTyping && ! isNavigationMode && isEmptyDefaultBlock;
|
|
94
85
|
const shouldShowBreadcrumb = isNavigationMode;
|
|
95
86
|
const shouldShowContextualToolbar =
|
|
96
87
|
! isNavigationMode &&
|
|
97
88
|
! hasFixedToolbar &&
|
|
98
89
|
isLargeViewport &&
|
|
99
|
-
! showEmptyBlockSideInserter &&
|
|
100
90
|
! isMultiSelecting &&
|
|
101
|
-
|
|
91
|
+
! showEmptyBlockSideInserter &&
|
|
92
|
+
! isTyping;
|
|
102
93
|
const canFocusHiddenToolbar =
|
|
103
94
|
! isNavigationMode &&
|
|
104
95
|
! shouldShowContextualToolbar &&
|
|
@@ -108,7 +99,7 @@ function BlockPopover( {
|
|
|
108
99
|
useShortcut(
|
|
109
100
|
'core/block-editor/focus-toolbar',
|
|
110
101
|
() => {
|
|
111
|
-
|
|
102
|
+
isToolbarForced.current = true;
|
|
112
103
|
stopTyping( true );
|
|
113
104
|
},
|
|
114
105
|
{
|
|
@@ -117,55 +108,17 @@ function BlockPopover( {
|
|
|
117
108
|
);
|
|
118
109
|
|
|
119
110
|
useEffect( () => {
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
}
|
|
123
|
-
}, [ shouldShowContextualToolbar ] );
|
|
111
|
+
isToolbarForced.current = false;
|
|
112
|
+
} );
|
|
124
113
|
|
|
125
114
|
// Stores the active toolbar item index so the block toolbar can return focus
|
|
126
115
|
// to it when re-mounting.
|
|
127
116
|
const initialToolbarItemIndexRef = useRef();
|
|
128
117
|
|
|
129
|
-
|
|
130
|
-
const lastSelectedElement = useBlockElement( lastClientId );
|
|
131
|
-
const capturingElement = useBlockElement( capturingClientId );
|
|
132
|
-
|
|
133
|
-
const popoverScrollRef = usePopoverScroll( __unstableContentRef );
|
|
134
|
-
|
|
135
|
-
if (
|
|
136
|
-
! shouldShowBreadcrumb &&
|
|
137
|
-
! shouldShowContextualToolbar &&
|
|
138
|
-
! isToolbarForced &&
|
|
139
|
-
! showEmptyBlockSideInserter
|
|
140
|
-
) {
|
|
118
|
+
if ( ! shouldShowBreadcrumb && ! shouldShowContextualToolbar ) {
|
|
141
119
|
return null;
|
|
142
120
|
}
|
|
143
121
|
|
|
144
|
-
let node = selectedElement;
|
|
145
|
-
|
|
146
|
-
if ( ! node ) {
|
|
147
|
-
return null;
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
if ( capturingClientId ) {
|
|
151
|
-
node = capturingElement;
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
let anchorRef = node;
|
|
155
|
-
|
|
156
|
-
if ( hasMultiSelection ) {
|
|
157
|
-
// Wait to render the popover until the bottom reference is available
|
|
158
|
-
// as well.
|
|
159
|
-
if ( ! lastSelectedElement ) {
|
|
160
|
-
return null;
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
anchorRef = {
|
|
164
|
-
top: node,
|
|
165
|
-
bottom: lastSelectedElement,
|
|
166
|
-
};
|
|
167
|
-
}
|
|
168
|
-
|
|
169
122
|
function onFocus() {
|
|
170
123
|
setIsInserterShown( true );
|
|
171
124
|
}
|
|
@@ -174,48 +127,17 @@ function BlockPopover( {
|
|
|
174
127
|
setIsInserterShown( false );
|
|
175
128
|
}
|
|
176
129
|
|
|
177
|
-
// Position above the anchor, pop out towards the right, and position in the
|
|
178
|
-
// left corner. For the side inserter, pop out towards the left, and
|
|
179
|
-
// position in the right corner.
|
|
180
|
-
// To do: refactor `Popover` to make this prop clearer.
|
|
181
|
-
const popoverPosition = showEmptyBlockSideInserter
|
|
182
|
-
? 'top left right'
|
|
183
|
-
: 'top right left';
|
|
184
|
-
const { ownerDocument } = node;
|
|
185
|
-
const stickyBoundaryElement = showEmptyBlockSideInserter
|
|
186
|
-
? undefined
|
|
187
|
-
: // The sticky boundary element should be the boundary at which the
|
|
188
|
-
// the block toolbar becomes sticky when the block scolls out of view.
|
|
189
|
-
// In case of an iframe, this should be the iframe boundary, otherwise
|
|
190
|
-
// the scroll container.
|
|
191
|
-
ownerDocument.defaultView.frameElement ||
|
|
192
|
-
getScrollContainer( node ) ||
|
|
193
|
-
ownerDocument.body;
|
|
194
|
-
|
|
195
130
|
return (
|
|
196
|
-
<
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
animate={ false }
|
|
200
|
-
position={ popoverPosition }
|
|
201
|
-
focusOnMount={ false }
|
|
202
|
-
anchorRef={ anchorRef }
|
|
131
|
+
<BlockPopover
|
|
132
|
+
clientId={ capturingClientId || clientId }
|
|
133
|
+
bottomClientId={ lastClientId }
|
|
203
134
|
className={ classnames( 'block-editor-block-list__block-popover', {
|
|
204
135
|
'is-insertion-point-visible': isInsertionPointVisible,
|
|
205
136
|
} ) }
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
// otherwise render in place (not in the the default popover slot).
|
|
209
|
-
__unstableSlotName={ __unstablePopoverSlot || null }
|
|
210
|
-
__unstableBoundaryParent
|
|
211
|
-
// Observe movement for block animations (especially horizontal).
|
|
212
|
-
__unstableObserveElement={ node }
|
|
213
|
-
shouldAnchorIncludePadding
|
|
214
|
-
// Used to safeguard sticky position behavior against cases where it would permanently
|
|
215
|
-
// obscure specific sections of a block.
|
|
216
|
-
__unstableEditorCanvasWrapper={ __unstableContentRef?.current }
|
|
137
|
+
__unstablePopoverSlot={ __unstablePopoverSlot }
|
|
138
|
+
__unstableContentRef={ __unstableContentRef }
|
|
217
139
|
>
|
|
218
|
-
{
|
|
140
|
+
{ shouldShowContextualToolbar && (
|
|
219
141
|
<div
|
|
220
142
|
onFocus={ onFocus }
|
|
221
143
|
onBlur={ onBlur }
|
|
@@ -240,11 +162,11 @@ function BlockPopover( {
|
|
|
240
162
|
/>
|
|
241
163
|
</div>
|
|
242
164
|
) }
|
|
243
|
-
{
|
|
165
|
+
{ shouldShowContextualToolbar && (
|
|
244
166
|
<BlockContextualToolbar
|
|
245
167
|
// If the toolbar is being shown because of being forced
|
|
246
168
|
// it should focus the toolbar right after the mount.
|
|
247
|
-
focusOnMount={ isToolbarForced }
|
|
169
|
+
focusOnMount={ isToolbarForced.current }
|
|
248
170
|
__experimentalInitialIndex={
|
|
249
171
|
initialToolbarItemIndexRef.current
|
|
250
172
|
}
|
|
@@ -260,20 +182,9 @@ function BlockPopover( {
|
|
|
260
182
|
<BlockSelectionButton
|
|
261
183
|
clientId={ clientId }
|
|
262
184
|
rootClientId={ rootClientId }
|
|
263
|
-
blockElement={ node }
|
|
264
185
|
/>
|
|
265
186
|
) }
|
|
266
|
-
|
|
267
|
-
<div className="block-editor-block-list__empty-block-inserter">
|
|
268
|
-
<Inserter
|
|
269
|
-
position="bottom right"
|
|
270
|
-
rootClientId={ rootClientId }
|
|
271
|
-
clientId={ clientId }
|
|
272
|
-
__experimentalIsQuick
|
|
273
|
-
/>
|
|
274
|
-
</div>
|
|
275
|
-
) }
|
|
276
|
-
</Popover>
|
|
187
|
+
</BlockPopover>
|
|
277
188
|
);
|
|
278
189
|
}
|
|
279
190
|
|
|
@@ -294,7 +205,7 @@ function wrapperSelector( select ) {
|
|
|
294
205
|
return;
|
|
295
206
|
}
|
|
296
207
|
|
|
297
|
-
const { name, attributes = {}
|
|
208
|
+
const { name, attributes = {} } = getBlock( clientId ) || {};
|
|
298
209
|
const blockParentsClientIds = getBlockParents( clientId );
|
|
299
210
|
|
|
300
211
|
// Get Block List Settings for all ancestors of the current Block clientId.
|
|
@@ -314,7 +225,6 @@ function wrapperSelector( select ) {
|
|
|
314
225
|
clientId,
|
|
315
226
|
rootClientId: getBlockRootClientId( clientId ),
|
|
316
227
|
name,
|
|
317
|
-
isValid,
|
|
318
228
|
isEmptyDefaultBlock:
|
|
319
229
|
name && isUnmodifiedDefaultBlock( { name, attributes } ),
|
|
320
230
|
capturingClientId,
|
|
@@ -335,7 +245,6 @@ export default function WrappedBlockPopover( {
|
|
|
335
245
|
clientId,
|
|
336
246
|
rootClientId,
|
|
337
247
|
name,
|
|
338
|
-
isValid,
|
|
339
248
|
isEmptyDefaultBlock,
|
|
340
249
|
capturingClientId,
|
|
341
250
|
} = selected;
|
|
@@ -345,10 +254,9 @@ export default function WrappedBlockPopover( {
|
|
|
345
254
|
}
|
|
346
255
|
|
|
347
256
|
return (
|
|
348
|
-
<
|
|
257
|
+
<SelectedBlockPopover
|
|
349
258
|
clientId={ clientId }
|
|
350
259
|
rootClientId={ rootClientId }
|
|
351
|
-
isValid={ isValid }
|
|
352
260
|
isEmptyDefaultBlock={ isEmptyDefaultBlock }
|
|
353
261
|
capturingClientId={ capturingClientId }
|
|
354
262
|
__unstablePopoverSlot={ __unstablePopoverSlot }
|
|
@@ -4,6 +4,10 @@
|
|
|
4
4
|
|
|
5
5
|
.block-editor-block-list__insertion-point {
|
|
6
6
|
position: absolute;
|
|
7
|
+
top: 0;
|
|
8
|
+
bottom: 0;
|
|
9
|
+
left: 0;
|
|
10
|
+
right: 0;
|
|
7
11
|
}
|
|
8
12
|
|
|
9
13
|
.block-editor-block-list__insertion-point-indicator {
|
|
@@ -49,7 +53,6 @@
|
|
|
49
53
|
}
|
|
50
54
|
|
|
51
55
|
// Sibling inserter / "inbetweenserter".
|
|
52
|
-
.block-editor-block-list__empty-block-inserter,
|
|
53
56
|
.block-editor-default-block-appender,
|
|
54
57
|
.block-editor-block-list__insertion-point-inserter,
|
|
55
58
|
.block-editor-block-list__block-popover-inserter {
|
|
@@ -98,7 +101,7 @@
|
|
|
98
101
|
position: sticky;
|
|
99
102
|
top: 0;
|
|
100
103
|
width: 100%;
|
|
101
|
-
z-index: z-index(".block-editor-block-
|
|
104
|
+
z-index: z-index(".block-editor-block-popover");
|
|
102
105
|
// Fill up when empty
|
|
103
106
|
min-height: $block-toolbar-height;
|
|
104
107
|
display: block;
|
|
@@ -112,42 +115,6 @@
|
|
|
112
115
|
border-right-color: $gray-200;
|
|
113
116
|
}
|
|
114
117
|
}
|
|
115
|
-
|
|
116
|
-
.block-editor-block-mover-button {
|
|
117
|
-
overflow: hidden;
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
// Extra specificity to override standard toolbar button styles.
|
|
121
|
-
.block-editor-block-mover.is-horizontal .block-editor-block-mover-button.block-editor-block-mover-button {
|
|
122
|
-
min-width: $block-toolbar-height*0.5;
|
|
123
|
-
width: $block-toolbar-height*0.5;
|
|
124
|
-
|
|
125
|
-
svg {
|
|
126
|
-
min-width: $block-toolbar-height*0.5;
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
// Position mover arrows for both toolbars.
|
|
132
|
-
.block-editor-block-contextual-toolbar .block-editor-block-mover:not(.is-horizontal) {
|
|
133
|
-
// Position SVGs.
|
|
134
|
-
.block-editor-block-mover-button {
|
|
135
|
-
&:focus::before {
|
|
136
|
-
left: 0 !important;
|
|
137
|
-
min-width: 0;
|
|
138
|
-
width: 100%;
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
@include break-small() {
|
|
143
|
-
.block-editor-block-mover-button.is-up-button svg {
|
|
144
|
-
top: 5px;
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
.block-editor-block-mover-button.is-down-button svg {
|
|
148
|
-
bottom: 5px;
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
118
|
}
|
|
152
119
|
|
|
153
120
|
/**
|
|
@@ -217,37 +184,6 @@
|
|
|
217
184
|
}
|
|
218
185
|
}
|
|
219
186
|
|
|
220
|
-
/**
|
|
221
|
-
* Popovers.
|
|
222
|
-
*/
|
|
223
|
-
|
|
224
|
-
.block-editor-block-list__insertion-point-popover.is-without-arrow {
|
|
225
|
-
z-index: z-index(".block-editor-block-list__insertion-point-popover");
|
|
226
|
-
position: absolute;
|
|
227
|
-
pointer-events: none;
|
|
228
|
-
|
|
229
|
-
* {
|
|
230
|
-
pointer-events: none;
|
|
231
|
-
}
|
|
232
|
-
|
|
233
|
-
.is-with-inserter {
|
|
234
|
-
pointer-events: all;
|
|
235
|
-
|
|
236
|
-
* {
|
|
237
|
-
pointer-events: all;
|
|
238
|
-
}
|
|
239
|
-
}
|
|
240
|
-
|
|
241
|
-
.components-popover__content.components-popover__content {
|
|
242
|
-
// Needs specificity.
|
|
243
|
-
background: none;
|
|
244
|
-
border: none;
|
|
245
|
-
box-shadow: none;
|
|
246
|
-
overflow-y: visible;
|
|
247
|
-
margin-left: 0;
|
|
248
|
-
}
|
|
249
|
-
}
|
|
250
|
-
|
|
251
187
|
// Hide the popover block editor list while dragging.
|
|
252
188
|
// Using a hacky animation to delay hiding the element.
|
|
253
189
|
// It's needed because if we hide the element immediately upon dragging,
|
|
@@ -262,33 +198,12 @@
|
|
|
262
198
|
}
|
|
263
199
|
|
|
264
200
|
.components-popover.block-editor-block-list__block-popover {
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
margin:
|
|
270
|
-
|
|
271
|
-
width: max-content;
|
|
272
|
-
background: none;
|
|
273
|
-
border: none;
|
|
274
|
-
box-shadow: none;
|
|
275
|
-
overflow-y: visible;
|
|
276
|
-
|
|
277
|
-
// Allow clicking through the toolbar holder.
|
|
278
|
-
pointer-events: none;
|
|
279
|
-
|
|
280
|
-
.block-editor-block-list__block-selection-button,
|
|
281
|
-
.block-editor-block-contextual-toolbar,
|
|
282
|
-
.block-editor-block-list__empty-block-inserter {
|
|
283
|
-
pointer-events: all;
|
|
284
|
-
}
|
|
285
|
-
|
|
286
|
-
// Position the block toolbar.
|
|
287
|
-
.block-editor-block-list__block-selection-button,
|
|
288
|
-
.block-editor-block-contextual-toolbar {
|
|
289
|
-
margin-top: $grid-unit-15;
|
|
290
|
-
margin-bottom: $grid-unit-15;
|
|
291
|
-
}
|
|
201
|
+
// Position the block toolbar.
|
|
202
|
+
.block-editor-block-list__block-selection-button,
|
|
203
|
+
.block-editor-block-contextual-toolbar {
|
|
204
|
+
pointer-events: all;
|
|
205
|
+
margin-top: $grid-unit-15;
|
|
206
|
+
margin-bottom: $grid-unit-15;
|
|
292
207
|
}
|
|
293
208
|
|
|
294
209
|
// Hide the block toolbar if the insertion point is shown.
|
|
@@ -307,30 +222,3 @@
|
|
|
307
222
|
.is-dragging-components-draggable .components-tooltip {
|
|
308
223
|
display: none;
|
|
309
224
|
}
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
// Size multiple sequential buttons to be optically balanced.
|
|
313
|
-
// Icons are 36px, as set by a 24px icon and 12px padding.
|
|
314
|
-
.block-editor-block-toolbar > .components-toolbar > .block-editor-block-toolbar__slot, // When a plugin adds to a slot, the segment has a `components-toolbar` class.
|
|
315
|
-
.block-editor-block-toolbar > .block-editor-block-toolbar__slot > .components-toolbar, // The nesting order is sometimes reversed.
|
|
316
|
-
.block-editor-block-toolbar > .block-editor-block-toolbar__slot > .components-dropdown, // Targets unique markup for the "Replace" button.
|
|
317
|
-
.block-editor-block-toolbar .components-toolbar-group {
|
|
318
|
-
padding-left: $grid-unit-15 * 0.5; // 6px.
|
|
319
|
-
padding-right: $grid-unit-15 * 0.5;
|
|
320
|
-
|
|
321
|
-
.components-button,
|
|
322
|
-
.components-button.has-icon.has-icon {
|
|
323
|
-
min-width: $block-toolbar-height - $grid-unit-15;
|
|
324
|
-
padding-left: $grid-unit-15 * 0.5; // 6px.
|
|
325
|
-
padding-right: $grid-unit-15 * 0.5;
|
|
326
|
-
|
|
327
|
-
svg {
|
|
328
|
-
min-width: $button-size-small; // This is the optimal icon size, and we size the whole button after this.
|
|
329
|
-
}
|
|
330
|
-
|
|
331
|
-
&::before {
|
|
332
|
-
left: 2px;
|
|
333
|
-
right: 2px;
|
|
334
|
-
}
|
|
335
|
-
}
|
|
336
|
-
}
|
|
@@ -11,12 +11,14 @@
|
|
|
11
11
|
align-items: flex-start;
|
|
12
12
|
|
|
13
13
|
> .components-unit-control-wrapper {
|
|
14
|
-
width:
|
|
14
|
+
width: 110px;
|
|
15
15
|
margin-bottom: 0;
|
|
16
|
+
margin-right: #{ $grid-unit-10 };
|
|
17
|
+
flex-shrink: 0;
|
|
16
18
|
}
|
|
17
19
|
|
|
18
20
|
.components-range-control {
|
|
19
|
-
|
|
21
|
+
flex: 1;
|
|
20
22
|
margin-bottom: 0;
|
|
21
23
|
|
|
22
24
|
.components-base-control__field {
|
|
@@ -49,6 +51,7 @@
|
|
|
49
51
|
.component-border-radius-control__linked-button.has-icon {
|
|
50
52
|
display: flex;
|
|
51
53
|
justify-content: center;
|
|
54
|
+
margin-left: 2px;
|
|
52
55
|
|
|
53
56
|
svg {
|
|
54
57
|
margin-right: 0;
|
|
@@ -34,8 +34,7 @@
|
|
|
34
34
|
|
|
35
35
|
// The black plus that shows up on the right side of an empty paragraph block, or the initial appender
|
|
36
36
|
// that exists only on empty documents.
|
|
37
|
-
.block-editor-default-block-appender .block-editor-inserter
|
|
38
|
-
.block-editor-block-list__empty-block-inserter.block-editor-block-list__empty-block-inserter { // This needs specificity to override inherited popover styles.
|
|
37
|
+
.block-editor-default-block-appender .block-editor-inserter {
|
|
39
38
|
position: absolute;
|
|
40
39
|
top: 0;
|
|
41
40
|
right: 0;
|
|
@@ -10,6 +10,7 @@ import {
|
|
|
10
10
|
} from '@wordpress/components';
|
|
11
11
|
import { __ } from '@wordpress/i18n';
|
|
12
12
|
import { DOWN } from '@wordpress/keycodes';
|
|
13
|
+
import { Icon, filter } from '@wordpress/icons';
|
|
13
14
|
|
|
14
15
|
function DuotoneControl( {
|
|
15
16
|
colorPalette,
|
|
@@ -41,7 +42,13 @@ function DuotoneControl( {
|
|
|
41
42
|
aria-expanded={ isOpen }
|
|
42
43
|
onKeyDown={ openOnArrowDown }
|
|
43
44
|
label={ __( 'Apply duotone filter' ) }
|
|
44
|
-
icon={
|
|
45
|
+
icon={
|
|
46
|
+
value ? (
|
|
47
|
+
<DuotoneSwatch values={ value } />
|
|
48
|
+
) : (
|
|
49
|
+
<Icon icon={ filter } />
|
|
50
|
+
)
|
|
51
|
+
}
|
|
45
52
|
/>
|
|
46
53
|
);
|
|
47
54
|
} }
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# Gradients
|
|
2
|
+
|
|
3
|
+
The `Gradients` component exposes tools for working with gradients
|
|
4
|
+
|
|
5
|
+
<a name="getGradientSlugByValue" href="#getGradientSlugByValue">#</a> **getGradientSlugByValue**
|
|
6
|
+
|
|
7
|
+
Retrieves the gradient slug per slug.
|
|
8
|
+
|
|
9
|
+
_Parameters_
|
|
10
|
+
|
|
11
|
+
- _gradients_ `Array`: Gradient Palette
|
|
12
|
+
- _value_ `string`: Gradient value
|
|
13
|
+
|
|
14
|
+
_Returns_
|
|
15
|
+
|
|
16
|
+
- `string`: Gradient slug.
|
|
17
|
+
|
|
18
|
+
<a name="getGradientValueBySlug" href="#getGradientValueBySlug">#</a> **getGradientValueBySlug**
|
|
19
|
+
|
|
20
|
+
Retrieves the gradient value per slug.
|
|
21
|
+
|
|
22
|
+
_Parameters_
|
|
23
|
+
|
|
24
|
+
- _gradients_ `Array`: Gradient Palette
|
|
25
|
+
- _slug_ `string`: Gradient slug
|
|
26
|
+
|
|
27
|
+
_Returns_
|
|
28
|
+
|
|
29
|
+
- `string`: Gradient value.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* External dependencies
|
|
3
3
|
*/
|
|
4
|
-
import { AccessibilityInfo, Platform } from 'react-native';
|
|
4
|
+
import { AccessibilityInfo, Platform, Text } from 'react-native';
|
|
5
5
|
import { delay } from 'lodash';
|
|
6
6
|
|
|
7
7
|
/**
|
|
@@ -15,6 +15,7 @@ import { compose, withPreferredColorScheme } from '@wordpress/compose';
|
|
|
15
15
|
import { isUnmodifiedDefaultBlock } from '@wordpress/blocks';
|
|
16
16
|
import {
|
|
17
17
|
Icon,
|
|
18
|
+
plus,
|
|
18
19
|
plusCircle,
|
|
19
20
|
plusCircleFilled,
|
|
20
21
|
insertAfter,
|
|
@@ -32,27 +33,51 @@ import { store as blockEditorStore } from '../../store';
|
|
|
32
33
|
|
|
33
34
|
const VOICE_OVER_ANNOUNCEMENT_DELAY = 1000;
|
|
34
35
|
|
|
35
|
-
const defaultRenderToggle = ( {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
36
|
+
const defaultRenderToggle = ( {
|
|
37
|
+
onToggle,
|
|
38
|
+
disabled,
|
|
39
|
+
style,
|
|
40
|
+
containerStyle,
|
|
41
|
+
onLongPress,
|
|
42
|
+
useExpandedMode,
|
|
43
|
+
} ) => {
|
|
44
|
+
// The "expanded mode" refers to the editor's appearance when no blocks
|
|
45
|
+
// are currently selected. The "add block" button has a separate style
|
|
46
|
+
// for the "expanded mode", which are added via the below "expandedModeViewProps"
|
|
47
|
+
// and "expandedModeViewText" variables.
|
|
48
|
+
const expandedModeViewProps = useExpandedMode && {
|
|
49
|
+
icon: <Icon icon={ plus } style={ style } />,
|
|
50
|
+
customContainerStyles: containerStyle,
|
|
51
|
+
fixedRatio: false,
|
|
52
|
+
};
|
|
53
|
+
const expandedModeViewText = (
|
|
54
|
+
<Text style={ styles[ 'inserter-menu__add-block-button-text' ] }>
|
|
55
|
+
{ __( 'Add Blocks' ) }
|
|
56
|
+
</Text>
|
|
57
|
+
);
|
|
58
|
+
|
|
59
|
+
return (
|
|
60
|
+
<ToolbarButton
|
|
61
|
+
title={ _x(
|
|
62
|
+
'Add block',
|
|
63
|
+
'Generic label for block inserter button'
|
|
64
|
+
) }
|
|
65
|
+
icon={ <Icon icon={ plusCircleFilled } style={ style } /> }
|
|
66
|
+
onClick={ onToggle }
|
|
67
|
+
extraProps={ {
|
|
68
|
+
hint: __( 'Double tap to add a block' ),
|
|
69
|
+
// testID is present to disambiguate this element for native UI tests. It's not
|
|
70
|
+
// usually required for components. See: https://git.io/JeQ7G.
|
|
71
|
+
testID: 'add-block-button',
|
|
72
|
+
onLongPress,
|
|
73
|
+
} }
|
|
74
|
+
isDisabled={ disabled }
|
|
75
|
+
{ ...expandedModeViewProps }
|
|
76
|
+
>
|
|
77
|
+
{ useExpandedMode && expandedModeViewText }
|
|
78
|
+
</ToolbarButton>
|
|
79
|
+
);
|
|
80
|
+
};
|
|
56
81
|
|
|
57
82
|
export class Inserter extends Component {
|
|
58
83
|
constructor() {
|
|
@@ -219,13 +244,21 @@ export class Inserter extends Component {
|
|
|
219
244
|
renderToggle = defaultRenderToggle,
|
|
220
245
|
getStylesFromColorScheme,
|
|
221
246
|
showSeparator,
|
|
247
|
+
useExpandedMode,
|
|
222
248
|
} = this.props;
|
|
223
249
|
if ( showSeparator && isOpen ) {
|
|
224
250
|
return <BlockInsertionPoint />;
|
|
225
251
|
}
|
|
226
|
-
const style =
|
|
227
|
-
styles
|
|
228
|
-
|
|
252
|
+
const style = useExpandedMode
|
|
253
|
+
? styles[ 'inserter-menu__add-block-button-icon--expanded' ]
|
|
254
|
+
: getStylesFromColorScheme(
|
|
255
|
+
styles[ 'inserter-menu__add-block-button-icon' ],
|
|
256
|
+
styles[ 'inserter-menu__add-block-button-icon--dark' ]
|
|
257
|
+
);
|
|
258
|
+
|
|
259
|
+
const containerStyle = getStylesFromColorScheme(
|
|
260
|
+
styles[ 'inserter-menu__add-block-button' ],
|
|
261
|
+
styles[ 'inserter-menu__add-block-button--dark' ]
|
|
229
262
|
);
|
|
230
263
|
|
|
231
264
|
const onPress = () => {
|
|
@@ -265,7 +298,9 @@ export class Inserter extends Component {
|
|
|
265
298
|
isOpen,
|
|
266
299
|
disabled,
|
|
267
300
|
style,
|
|
301
|
+
containerStyle,
|
|
268
302
|
onLongPress,
|
|
303
|
+
useExpandedMode,
|
|
269
304
|
} ) }
|
|
270
305
|
<Picker
|
|
271
306
|
ref={ ( instance ) => ( this.picker = instance ) }
|