@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
|
@@ -54,7 +54,6 @@ const {
|
|
|
54
54
|
getDraggedBlockClientIds,
|
|
55
55
|
isBlockBeingDragged,
|
|
56
56
|
isAncestorBeingDragged,
|
|
57
|
-
isCaretWithinFormattedText,
|
|
58
57
|
getBlockInsertionPoint,
|
|
59
58
|
isBlockInsertionPointVisible,
|
|
60
59
|
isSelectionEnabled,
|
|
@@ -2056,24 +2055,6 @@ describe( 'selectors', () => {
|
|
|
2056
2055
|
} );
|
|
2057
2056
|
} );
|
|
2058
2057
|
|
|
2059
|
-
describe( 'isCaretWithinFormattedText', () => {
|
|
2060
|
-
it( 'returns true if the isCaretWithinFormattedText state is also true', () => {
|
|
2061
|
-
const state = {
|
|
2062
|
-
isCaretWithinFormattedText: true,
|
|
2063
|
-
};
|
|
2064
|
-
|
|
2065
|
-
expect( isCaretWithinFormattedText( state ) ).toBe( true );
|
|
2066
|
-
} );
|
|
2067
|
-
|
|
2068
|
-
it( 'returns false if the isCaretWithinFormattedText state is also false', () => {
|
|
2069
|
-
const state = {
|
|
2070
|
-
isCaretWithinFormattedText: false,
|
|
2071
|
-
};
|
|
2072
|
-
|
|
2073
|
-
expect( isCaretWithinFormattedText( state ) ).toBe( false );
|
|
2074
|
-
} );
|
|
2075
|
-
} );
|
|
2076
|
-
|
|
2077
2058
|
describe( 'isSelectionEnabled', () => {
|
|
2078
2059
|
it( 'should return true if selection is enable', () => {
|
|
2079
2060
|
const state = {
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Helper function that maps attribute definition properties to the
|
|
3
|
+
* ones used by RichText utils like `create, toHTMLString, etc..`.
|
|
4
|
+
*
|
|
5
|
+
* @param {Object} attributeDefinition A block's attribute definition object.
|
|
6
|
+
* @return {Object} The mapped object.
|
|
7
|
+
*/
|
|
8
|
+
export function mapRichTextSettings( attributeDefinition ) {
|
|
9
|
+
const {
|
|
10
|
+
multiline: multilineTag,
|
|
11
|
+
__unstableMultilineWrapperTags: multilineWrapperTags,
|
|
12
|
+
__unstablePreserveWhiteSpace: preserveWhiteSpace,
|
|
13
|
+
} = attributeDefinition;
|
|
14
|
+
return {
|
|
15
|
+
multilineTag,
|
|
16
|
+
multilineWrapperTags,
|
|
17
|
+
preserveWhiteSpace,
|
|
18
|
+
};
|
|
19
|
+
}
|
package/src/style.scss
CHANGED
|
@@ -12,11 +12,11 @@
|
|
|
12
12
|
@import "./components/block-compare/style.scss";
|
|
13
13
|
@import "./components/block-content-overlay/style.scss";
|
|
14
14
|
@import "./components/block-draggable/style.scss";
|
|
15
|
-
@import "./components/block-mobile-toolbar/style.scss";
|
|
16
15
|
@import "./components/block-mover/style.scss";
|
|
17
16
|
@import "./components/block-navigation/style.scss";
|
|
18
17
|
@import "./components/block-parent-selector/style.scss";
|
|
19
18
|
@import "./components/block-patterns-list/style.scss";
|
|
19
|
+
@import "./components/block-popover/style.scss";
|
|
20
20
|
@import "./components/block-preview/style.scss";
|
|
21
21
|
@import "./components/block-settings-menu/style.scss";
|
|
22
22
|
@import "./components/block-styles/style.scss";
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
|
-
Object.defineProperty(exports, "__esModule", {
|
|
6
|
-
value: true
|
|
7
|
-
});
|
|
8
|
-
exports.default = void 0;
|
|
9
|
-
|
|
10
|
-
var _element = require("@wordpress/element");
|
|
11
|
-
|
|
12
|
-
var _compose = require("@wordpress/compose");
|
|
13
|
-
|
|
14
|
-
var _blockMover = _interopRequireDefault(require("../block-mover"));
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* WordPress dependencies
|
|
18
|
-
*/
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* Internal dependencies
|
|
22
|
-
*/
|
|
23
|
-
function BlockMobileToolbar(_ref) {
|
|
24
|
-
let {
|
|
25
|
-
clientId
|
|
26
|
-
} = _ref;
|
|
27
|
-
const isMobile = (0, _compose.useViewportMatch)('small', '<');
|
|
28
|
-
|
|
29
|
-
if (!isMobile) {
|
|
30
|
-
return null;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
return (0, _element.createElement)("div", {
|
|
34
|
-
className: "block-editor-block-mobile-toolbar"
|
|
35
|
-
}, (0, _element.createElement)(_blockMover.default, {
|
|
36
|
-
clientIds: [clientId]
|
|
37
|
-
}));
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
var _default = BlockMobileToolbar;
|
|
41
|
-
exports.default = _default;
|
|
42
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-editor/src/components/block-mobile-toolbar/index.js"],"names":["BlockMobileToolbar","clientId","isMobile"],"mappings":";;;;;;;;;;;AAGA;;AAKA;;AARA;AACA;AACA;;AAGA;AACA;AACA;AAGA,SAASA,kBAAT,OAA4C;AAAA,MAAf;AAAEC,IAAAA;AAAF,GAAe;AAC3C,QAAMC,QAAQ,GAAG,+BAAkB,OAAlB,EAA2B,GAA3B,CAAjB;;AACA,MAAK,CAAEA,QAAP,EAAkB;AACjB,WAAO,IAAP;AACA;;AAED,SACC;AAAK,IAAA,SAAS,EAAC;AAAf,KACC,4BAAC,mBAAD;AAAY,IAAA,SAAS,EAAG,CAAED,QAAF;AAAxB,IADD,CADD;AAKA;;eAEcD,kB","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useViewportMatch } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport BlockMover from '../block-mover';\n\nfunction BlockMobileToolbar( { clientId } ) {\n\tconst isMobile = useViewportMatch( 'small', '<' );\n\tif ( ! isMobile ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<div className=\"block-editor-block-mobile-toolbar\">\n\t\t\t<BlockMover clientIds={ [ clientId ] } />\n\t\t</div>\n\t);\n}\n\nexport default BlockMobileToolbar;\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-editor/src/components/block-tools/block-popover.js"],"names":["selector","select","isNavigationMode","isMultiSelecting","hasMultiSelection","isTyping","isCaretWithinFormattedText","getSettings","getLastMultiSelectedBlockClientId","blockEditorStore","hasFixedToolbar","lastClientId","BlockPopover","clientId","rootClientId","isValid","isEmptyDefaultBlock","capturingClientId","__unstablePopoverSlot","__unstableContentRef","isInsertionPointVisible","isBlockInsertionPointVisible","getBlockInsertionPoint","getBlockOrder","insertionPoint","order","index","isLargeViewport","isToolbarForced","setIsToolbarForced","isInserterShown","setIsInserterShown","stopTyping","showEmptyBlockSideInserter","shouldShowBreadcrumb","shouldShowContextualToolbar","canFocusHiddenToolbar","isDisabled","initialToolbarItemIndexRef","selectedElement","lastSelectedElement","capturingElement","popoverScrollRef","node","anchorRef","top","bottom","onFocus","onBlur","popoverPosition","ownerDocument","stickyBoundaryElement","undefined","defaultView","frameElement","body","current","wrapperSelector","getSelectedBlockClientId","getFirstMultiSelectedBlockClientId","getBlockRootClientId","getBlock","getBlockParents","__experimentalGetBlockListSettingsForBlocks","name","attributes","blockParentsClientIds","parentBlockListSettings","parentClientId","__experimentalCaptureToolbars","WrappedBlockPopover","selected"],"mappings":";;;;;;;;;AASA;;AANA;;AACA;;AAMA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAzBA;AACA;AACA;;AAIA;AACA;AACA;;AASA;AACA;AACA;AAQA,SAASA,QAAT,CAAmBC,MAAnB,EAA4B;AAC3B,QAAM;AACLC,IAAAA,gBADK;AAELC,IAAAA,gBAFK;AAGLC,IAAAA,iBAHK;AAILC,IAAAA,QAJK;AAKLC,IAAAA,0BALK;AAMLC,IAAAA,WANK;AAOLC,IAAAA;AAPK,MAQFP,MAAM,CAAEQ,YAAF,CARV;AASA,SAAO;AACNP,IAAAA,gBAAgB,EAAEA,gBAAgB,EAD5B;AAENC,IAAAA,gBAAgB,EAAEA,gBAAgB,EAF5B;AAGNE,IAAAA,QAAQ,EAAEA,QAAQ,EAHZ;AAINC,IAAAA,0BAA0B,EAAEA,0BAA0B,EAJhD;AAKNF,IAAAA,iBAAiB,EAAEA,iBAAiB,EAL9B;AAMNM,IAAAA,eAAe,EAAEH,WAAW,GAAGG,eANzB;AAONC,IAAAA,YAAY,EAAEH,iCAAiC;AAPzC,GAAP;AASA;;AAED,SAASI,YAAT,OAQI;AAAA,MARmB;AACtBC,IAAAA,QADsB;AAEtBC,IAAAA,YAFsB;AAGtBC,IAAAA,OAHsB;AAItBC,IAAAA,mBAJsB;AAKtBC,IAAAA,iBALsB;AAMtBC,IAAAA,qBANsB;AAOtBC,IAAAA;AAPsB,GAQnB;AACH,QAAM;AACLjB,IAAAA,gBADK;AAELC,IAAAA,gBAFK;AAGLE,IAAAA,QAHK;AAILC,IAAAA,0BAJK;AAKLF,IAAAA,iBALK;AAMLM,IAAAA,eANK;AAOLC,IAAAA;AAPK,MAQF,qBAAWX,QAAX,EAAqB,EAArB,CARJ;AASA,QAAMoB,uBAAuB,GAA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ACzBiD,qBADyB,EAEvBE,cAAF;AAAA;;AAAA,oCACCD,uBAAuB,CAAEC,cAAF,CADxB,0DACC,sBACGC,6BAFJ;AAAA,GAFyB,CAA1B;AAOA,SAAO;AACNxD,IAAAA,QADM;AAENC,IAAAA,YAAY,EAAE8C,oBAAoB,CAAE/C,QAAF,CAF5B;AAGNmD,IAAAA,IAHM;AAINjD,IAAAA,OAJM;AAKNC,IAAAA,mBAAmB,EAClBgD,IAAI,IAAI,sCAA0B;AAAEA,MAAAA,IAAF;AAAQC,MAAAA;AAAR,KAA1B,CANH;AAONhD,IAAAA;AAPM,GAAP;AASA;;AAEc,SAASqD,mBAAT,QAGX;AAAA,MAHyC;AAC5CpD,IAAAA,qBAD4C;AAE5CC,IAAAA;AAF4C,GAGzC;AACH,QAAMoD,QAAQ,GAAG,qBAAWd,eAAX,EAA4B,EAA5B,CAAjB;;AAEA,MAAK,CAAEc,QAAP,EAAkB;AACjB,WAAO,IAAP;AACA;;AAED,QAAM;AACL1D,IAAAA,QADK;AAELC,IAAAA,YAFK;AAGLkD,IAAAA,IAHK;AAILjD,IAAAA,OAJK;AAKLC,IAAAA,mBALK;AAMLC,IAAAA;AANK,MAOFsD,QAPJ;;AASA,MAAK,CAAEP,IAAP,EAAc;AACb,WAAO,IAAP;AACA;;AAED,SACC,4BAAC,YAAD;AACC,IAAA,QAAQ,EAAGnD,QADZ;AAEC,IAAA,YAAY,EAAGC,YAFhB;AAGC,IAAA,OAAO,EAAGC,OAHX;AAIC,IAAA,mBAAmB,EAAGC,mBAJvB;AAKC,IAAA,iBAAiB,EAAGC,iBALrB;AAMC,IAAA,qBAAqB,EAAGC,qBANzB;AAOC,IAAA,oBAAoB,EAAGC;AAPxB,IADD;AAWA","sourcesContent":["/**\n * External dependencies\n */\nimport { find } from 'lodash';\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { useState, useRef, useEffect } from '@wordpress/element';\nimport { isUnmodifiedDefaultBlock } from '@wordpress/blocks';\nimport { Popover } from '@wordpress/components';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { useShortcut } from '@wordpress/keyboard-shortcuts';\nimport { useViewportMatch } from '@wordpress/compose';\nimport { getScrollContainer } from '@wordpress/dom';\n\n/**\n * Internal dependencies\n */\nimport BlockSelectionButton from './block-selection-button';\nimport BlockContextualToolbar from './block-contextual-toolbar';\nimport Inserter from '../inserter';\nimport { store as blockEditorStore } from '../../store';\nimport { __unstableUseBlockElement as useBlockElement } from '../block-list/use-block-props/use-block-refs';\nimport { usePopoverScroll } from './use-popover-scroll';\n\nfunction selector( select ) {\n\tconst {\n\t\tisNavigationMode,\n\t\tisMultiSelecting,\n\t\thasMultiSelection,\n\t\tisTyping,\n\t\tisCaretWithinFormattedText,\n\t\tgetSettings,\n\t\tgetLastMultiSelectedBlockClientId,\n\t} = select( blockEditorStore );\n\treturn {\n\t\tisNavigationMode: isNavigationMode(),\n\t\tisMultiSelecting: isMultiSelecting(),\n\t\tisTyping: isTyping(),\n\t\tisCaretWithinFormattedText: isCaretWithinFormattedText(),\n\t\thasMultiSelection: hasMultiSelection(),\n\t\thasFixedToolbar: getSettings().hasFixedToolbar,\n\t\tlastClientId: getLastMultiSelectedBlockClientId(),\n\t};\n}\n\nfunction BlockPopover( {\n\tclientId,\n\trootClientId,\n\tisValid,\n\tisEmptyDefaultBlock,\n\tcapturingClientId,\n\t__unstablePopoverSlot,\n\t__unstableContentRef,\n} ) {\n\tconst {\n\t\tisNavigationMode,\n\t\tisMultiSelecting,\n\t\tisTyping,\n\t\tisCaretWithinFormattedText,\n\t\thasMultiSelection,\n\t\thasFixedToolbar,\n\t\tlastClientId,\n\t} = useSelect( selector, [] );\n\tconst isInsertionPointVisible = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tisBlockInsertionPointVisible,\n\t\t\t\tgetBlockInsertionPoint,\n\t\t\t\tgetBlockOrder,\n\t\t\t} = select( blockEditorStore );\n\n\t\t\tif ( ! isBlockInsertionPointVisible() ) {\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\tconst insertionPoint = getBlockInsertionPoint();\n\t\t\tconst order = getBlockOrder( insertionPoint.rootClientId );\n\t\t\treturn order[ insertionPoint.index ] === clientId;\n\t\t},\n\t\t[ clientId ]\n\t);\n\tconst isLargeViewport = useViewportMatch( 'medium' );\n\tconst [ isToolbarForced, setIsToolbarForced ] = useState( false );\n\tconst [ isInserterShown, setIsInserterShown ] = useState( false );\n\tconst { stopTyping } = useDispatch( blockEditorStore );\n\n\t// Controls when the side inserter on empty lines should\n\t// be shown, including writing and selection modes.\n\tconst showEmptyBlockSideInserter =\n\t\t! isTyping && ! isNavigationMode && isEmptyDefaultBlock && isValid;\n\tconst shouldShowBreadcrumb = isNavigationMode;\n\tconst shouldShowContextualToolbar =\n\t\t! isNavigationMode &&\n\t\t! hasFixedToolbar &&\n\t\tisLargeViewport &&\n\t\t! showEmptyBlockSideInserter &&\n\t\t! isMultiSelecting &&\n\t\t( ! isTyping || isCaretWithinFormattedText );\n\tconst canFocusHiddenToolbar =\n\t\t! isNavigationMode &&\n\t\t! shouldShowContextualToolbar &&\n\t\t! hasFixedToolbar &&\n\t\t! isEmptyDefaultBlock;\n\n\tuseShortcut(\n\t\t'core/block-editor/focus-toolbar',\n\t\t() => {\n\t\t\tsetIsToolbarForced( true );\n\t\t\tstopTyping( true );\n\t\t},\n\t\t{\n\t\t\tisDisabled: ! canFocusHiddenToolbar,\n\t\t}\n\t);\n\n\tuseEffect( () => {\n\t\tif ( ! shouldShowContextualToolbar ) {\n\t\t\tsetIsToolbarForced( false );\n\t\t}\n\t}, [ shouldShowContextualToolbar ] );\n\n\t// Stores the active toolbar item index so the block toolbar can return focus\n\t// to it when re-mounting.\n\tconst initialToolbarItemIndexRef = useRef();\n\n\tconst selectedElement = useBlockElement( clientId );\n\tconst lastSelectedElement = useBlockElement( lastClientId );\n\tconst capturingElement = useBlockElement( capturingClientId );\n\n\tconst popoverScrollRef = usePopoverScroll( __unstableContentRef );\n\n\tif (\n\t\t! shouldShowBreadcrumb &&\n\t\t! shouldShowContextualToolbar &&\n\t\t! isToolbarForced &&\n\t\t! showEmptyBlockSideInserter\n\t) {\n\t\treturn null;\n\t}\n\n\tlet node = selectedElement;\n\n\tif ( ! node ) {\n\t\treturn null;\n\t}\n\n\tif ( capturingClientId ) {\n\t\tnode = capturingElement;\n\t}\n\n\tlet anchorRef = node;\n\n\tif ( hasMultiSelection ) {\n\t\t// Wait to render the popover until the bottom reference is available\n\t\t// as well.\n\t\tif ( ! lastSelectedElement ) {\n\t\t\treturn null;\n\t\t}\n\n\t\tanchorRef = {\n\t\t\ttop: node,\n\t\t\tbottom: lastSelectedElement,\n\t\t};\n\t}\n\n\tfunction onFocus() {\n\t\tsetIsInserterShown( true );\n\t}\n\n\tfunction onBlur() {\n\t\tsetIsInserterShown( false );\n\t}\n\n\t// Position above the anchor, pop out towards the right, and position in the\n\t// left corner. For the side inserter, pop out towards the left, and\n\t// position in the right corner.\n\t// To do: refactor `Popover` to make this prop clearer.\n\tconst popoverPosition = showEmptyBlockSideInserter\n\t\t? 'top left right'\n\t\t: 'top right left';\n\tconst { ownerDocument } = node;\n\tconst stickyBoundaryElement = showEmptyBlockSideInserter\n\t\t? undefined\n\t\t: // The sticky boundary element should be the boundary at which the\n\t\t // the block toolbar becomes sticky when the block scolls out of view.\n\t\t // In case of an iframe, this should be the iframe boundary, otherwise\n\t\t // the scroll container.\n\t\t ownerDocument.defaultView.frameElement ||\n\t\t getScrollContainer( node ) ||\n\t\t ownerDocument.body;\n\n\treturn (\n\t\t<Popover\n\t\t\tref={ popoverScrollRef }\n\t\t\tnoArrow\n\t\t\tanimate={ false }\n\t\t\tposition={ popoverPosition }\n\t\t\tfocusOnMount={ false }\n\t\t\tanchorRef={ anchorRef }\n\t\t\tclassName={ classnames( 'block-editor-block-list__block-popover', {\n\t\t\t\t'is-insertion-point-visible': isInsertionPointVisible,\n\t\t\t} ) }\n\t\t\t__unstableStickyBoundaryElement={ stickyBoundaryElement }\n\t\t\t// Render in the old slot if needed for backward compatibility,\n\t\t\t// otherwise render in place (not in the the default popover slot).\n\t\t\t__unstableSlotName={ __unstablePopoverSlot || null }\n\t\t\t__unstableBoundaryParent\n\t\t\t// Observe movement for block animations (especially horizontal).\n\t\t\t__unstableObserveElement={ node }\n\t\t\tshouldAnchorIncludePadding\n\t\t\t// Used to safeguard sticky position behavior against cases where it would permanently\n\t\t\t// obscure specific sections of a block.\n\t\t\t__unstableEditorCanvasWrapper={ __unstableContentRef?.current }\n\t\t>\n\t\t\t{ ( shouldShowContextualToolbar || isToolbarForced ) && (\n\t\t\t\t<div\n\t\t\t\t\tonFocus={ onFocus }\n\t\t\t\t\tonBlur={ onBlur }\n\t\t\t\t\t// While ideally it would be enough to capture the\n\t\t\t\t\t// bubbling focus event from the Inserter, due to the\n\t\t\t\t\t// characteristics of click focusing of `button`s in\n\t\t\t\t\t// Firefox and Safari, it is not reliable.\n\t\t\t\t\t//\n\t\t\t\t\t// See: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button#Clicking_and_focus\n\t\t\t\t\ttabIndex={ -1 }\n\t\t\t\t\tclassName={ classnames(\n\t\t\t\t\t\t'block-editor-block-list__block-popover-inserter',\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t'is-visible': isInserterShown,\n\t\t\t\t\t\t}\n\t\t\t\t\t) }\n\t\t\t\t>\n\t\t\t\t\t<Inserter\n\t\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\t\trootClientId={ rootClientId }\n\t\t\t\t\t\t__experimentalIsQuick\n\t\t\t\t\t/>\n\t\t\t\t</div>\n\t\t\t) }\n\t\t\t{ ( shouldShowContextualToolbar || isToolbarForced ) && (\n\t\t\t\t<BlockContextualToolbar\n\t\t\t\t\t// If the toolbar is being shown because of being forced\n\t\t\t\t\t// it should focus the toolbar right after the mount.\n\t\t\t\t\tfocusOnMount={ isToolbarForced }\n\t\t\t\t\t__experimentalInitialIndex={\n\t\t\t\t\t\tinitialToolbarItemIndexRef.current\n\t\t\t\t\t}\n\t\t\t\t\t__experimentalOnIndexChange={ ( index ) => {\n\t\t\t\t\t\tinitialToolbarItemIndexRef.current = index;\n\t\t\t\t\t} }\n\t\t\t\t\t// Resets the index whenever the active block changes so\n\t\t\t\t\t// this is not persisted. See https://github.com/WordPress/gutenberg/pull/25760#issuecomment-717906169\n\t\t\t\t\tkey={ clientId }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ shouldShowBreadcrumb && (\n\t\t\t\t<BlockSelectionButton\n\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\trootClientId={ rootClientId }\n\t\t\t\t\tblockElement={ node }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ showEmptyBlockSideInserter && (\n\t\t\t\t<div className=\"block-editor-block-list__empty-block-inserter\">\n\t\t\t\t\t<Inserter\n\t\t\t\t\t\tposition=\"bottom right\"\n\t\t\t\t\t\trootClientId={ rootClientId }\n\t\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\t\t__experimentalIsQuick\n\t\t\t\t\t/>\n\t\t\t\t</div>\n\t\t\t) }\n\t\t</Popover>\n\t);\n}\n\nfunction wrapperSelector( select ) {\n\tconst {\n\t\tgetSelectedBlockClientId,\n\t\tgetFirstMultiSelectedBlockClientId,\n\t\tgetBlockRootClientId,\n\t\tgetBlock,\n\t\tgetBlockParents,\n\t\t__experimentalGetBlockListSettingsForBlocks,\n\t} = select( blockEditorStore );\n\n\tconst clientId =\n\t\tgetSelectedBlockClientId() || getFirstMultiSelectedBlockClientId();\n\n\tif ( ! clientId ) {\n\t\treturn;\n\t}\n\n\tconst { name, attributes = {}, isValid } = getBlock( clientId ) || {};\n\tconst blockParentsClientIds = getBlockParents( clientId );\n\n\t// Get Block List Settings for all ancestors of the current Block clientId.\n\tconst parentBlockListSettings = __experimentalGetBlockListSettingsForBlocks(\n\t\tblockParentsClientIds\n\t);\n\n\t// Get the clientId of the topmost parent with the capture toolbars setting.\n\tconst capturingClientId = find(\n\t\tblockParentsClientIds,\n\t\t( parentClientId ) =>\n\t\t\tparentBlockListSettings[ parentClientId ]\n\t\t\t\t?.__experimentalCaptureToolbars\n\t);\n\n\treturn {\n\t\tclientId,\n\t\trootClientId: getBlockRootClientId( clientId ),\n\t\tname,\n\t\tisValid,\n\t\tisEmptyDefaultBlock:\n\t\t\tname && isUnmodifiedDefaultBlock( { name, attributes } ),\n\t\tcapturingClientId,\n\t};\n}\n\nexport default function WrappedBlockPopover( {\n\t__unstablePopoverSlot,\n\t__unstableContentRef,\n} ) {\n\tconst selected = useSelect( wrapperSelector, [] );\n\n\tif ( ! selected ) {\n\t\treturn null;\n\t}\n\n\tconst {\n\t\tclientId,\n\t\trootClientId,\n\t\tname,\n\t\tisValid,\n\t\tisEmptyDefaultBlock,\n\t\tcapturingClientId,\n\t} = selected;\n\n\tif ( ! name ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<BlockPopover\n\t\t\tclientId={ clientId }\n\t\t\trootClientId={ rootClientId }\n\t\t\tisValid={ isValid }\n\t\t\tisEmptyDefaultBlock={ isEmptyDefaultBlock }\n\t\t\tcapturingClientId={ capturingClientId }\n\t\t\t__unstablePopoverSlot={ __unstablePopoverSlot }\n\t\t\t__unstableContentRef={ __unstableContentRef }\n\t\t/>\n\t);\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-editor/src/components/block-tools/use-popover-scroll.js"],"names":["usePopoverScroll","scrollableRef","node","onWheel","event","deltaX","deltaY","current","scrollBy","options","passive","addEventListener","removeEventListener"],"mappings":";;;;;;;AAGA;;AAHA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,gBAAT,CAA2BC,aAA3B,EAA2C;AACjD,SAAO,2BACJC,IAAF,IAAY;AACX,QAAK,CAAED,aAAP,EAAuB;AACtB;AACA;;AAED,aAASE,OAAT,CAAkBC,KAAlB,EAA0B;AACzB,YAAM;AAAEC,QAAAA,MAAF;AAAUC,QAAAA;AAAV,UAAqBF,KAA3B;AACAH,MAAAA,aAAa,CAACM,OAAd,CAAsBC,QAAtB,CAAgCH,MAAhC,EAAwCC,MAAxC;AACA,KARU,CASX;AACA;;;AACA,UAAMG,OAAO,GAAG;AAAEC,MAAAA,OAAO,EAAE;AAAX,KAAhB;AACAR,IAAAA,IAAI,CAACS,gBAAL,CAAuB,OAAvB,EAAgCR,OAAhC,EAAyCM,OAAzC;AACA,WAAO,MAAM;AACZP,MAAAA,IAAI,CAACU,mBAAL,CAA0B,OAA1B,EAAmCT,OAAnC,EAA4CM,OAA5C;AACA,KAFD;AAGA,GAjBK,EAkBN,CAAER,aAAF,CAlBM,CAAP;AAoBA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useRefEffect } from '@wordpress/compose';\n\n/**\n * Allow scrolling \"through\" popovers over the canvas. This is only called for\n * as long as the pointer is over a popover. Do not use React events because it\n * will bubble through portals.\n *\n * @param {Object} scrollableRef\n */\nexport function usePopoverScroll( scrollableRef ) {\n\treturn useRefEffect(\n\t\t( node ) => {\n\t\t\tif ( ! scrollableRef ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tfunction onWheel( event ) {\n\t\t\t\tconst { deltaX, deltaY } = event;\n\t\t\t\tscrollableRef.current.scrollBy( deltaX, deltaY );\n\t\t\t}\n\t\t\t// Tell the browser that we do not call event.preventDefault\n\t\t\t// See https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener#improving_scrolling_performance_with_passive_listeners\n\t\t\tconst options = { passive: true };\n\t\t\tnode.addEventListener( 'wheel', onWheel, options );\n\t\t\treturn () => {\n\t\t\t\tnode.removeEventListener( 'wheel', onWheel, options );\n\t\t\t};\n\t\t},\n\t\t[ scrollableRef ]\n\t);\n}\n"]}
|
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
|
-
Object.defineProperty(exports, "__esModule", {
|
|
6
|
-
value: true
|
|
7
|
-
});
|
|
8
|
-
exports.default = ListViewAppender;
|
|
9
|
-
|
|
10
|
-
var _element = require("@wordpress/element");
|
|
11
|
-
|
|
12
|
-
var _classnames = _interopRequireDefault(require("classnames"));
|
|
13
|
-
|
|
14
|
-
var _components = require("@wordpress/components");
|
|
15
|
-
|
|
16
|
-
var _compose = require("@wordpress/compose");
|
|
17
|
-
|
|
18
|
-
var _i18n = require("@wordpress/i18n");
|
|
19
|
-
|
|
20
|
-
var _data = require("@wordpress/data");
|
|
21
|
-
|
|
22
|
-
var _leaf = _interopRequireDefault(require("./leaf"));
|
|
23
|
-
|
|
24
|
-
var _inserter = _interopRequireDefault(require("../inserter"));
|
|
25
|
-
|
|
26
|
-
var _store = require("../../store");
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* External dependencies
|
|
30
|
-
*/
|
|
31
|
-
|
|
32
|
-
/**
|
|
33
|
-
* WordPress dependencies
|
|
34
|
-
*/
|
|
35
|
-
|
|
36
|
-
/**
|
|
37
|
-
* Internal dependencies
|
|
38
|
-
*/
|
|
39
|
-
function ListViewAppender(_ref) {
|
|
40
|
-
let {
|
|
41
|
-
parentBlockClientId,
|
|
42
|
-
position,
|
|
43
|
-
level,
|
|
44
|
-
rowCount,
|
|
45
|
-
path
|
|
46
|
-
} = _ref;
|
|
47
|
-
const isDragging = (0, _data.useSelect)(select => {
|
|
48
|
-
const {
|
|
49
|
-
isBlockBeingDragged,
|
|
50
|
-
isAncestorBeingDragged
|
|
51
|
-
} = select(_store.store);
|
|
52
|
-
return isBlockBeingDragged(parentBlockClientId) || isAncestorBeingDragged(parentBlockClientId);
|
|
53
|
-
}, [parentBlockClientId]);
|
|
54
|
-
const instanceId = (0, _compose.useInstanceId)(ListViewAppender);
|
|
55
|
-
const descriptionId = `list-view-appender-row__description_${instanceId}`;
|
|
56
|
-
const appenderPositionDescription = (0, _i18n.sprintf)(
|
|
57
|
-
/* translators: 1: The numerical position of the block that will be inserted. 2: The level of nesting for the block that will be inserted. */
|
|
58
|
-
(0, _i18n.__)('Add block at position %1$d, Level %2$d'), position, level);
|
|
59
|
-
return (0, _element.createElement)(_leaf.default, {
|
|
60
|
-
className: (0, _classnames.default)({
|
|
61
|
-
'is-dragging': isDragging
|
|
62
|
-
}),
|
|
63
|
-
level: level,
|
|
64
|
-
position: position,
|
|
65
|
-
rowCount: rowCount,
|
|
66
|
-
path: path
|
|
67
|
-
}, (0, _element.createElement)(_components.__experimentalTreeGridCell, {
|
|
68
|
-
className: "block-editor-list-view-appender__cell",
|
|
69
|
-
colSpan: "3"
|
|
70
|
-
}, _ref2 => {
|
|
71
|
-
let {
|
|
72
|
-
ref,
|
|
73
|
-
tabIndex,
|
|
74
|
-
onFocus
|
|
75
|
-
} = _ref2;
|
|
76
|
-
return (0, _element.createElement)("div", {
|
|
77
|
-
className: "block-editor-list-view-appender__container"
|
|
78
|
-
}, (0, _element.createElement)(_inserter.default, {
|
|
79
|
-
rootClientId: parentBlockClientId,
|
|
80
|
-
__experimentalIsQuick: true,
|
|
81
|
-
"aria-describedby": descriptionId,
|
|
82
|
-
toggleProps: {
|
|
83
|
-
ref,
|
|
84
|
-
tabIndex,
|
|
85
|
-
onFocus
|
|
86
|
-
}
|
|
87
|
-
}), (0, _element.createElement)("div", {
|
|
88
|
-
className: "block-editor-list-view-appender__description",
|
|
89
|
-
id: descriptionId
|
|
90
|
-
}, appenderPositionDescription));
|
|
91
|
-
}));
|
|
92
|
-
}
|
|
93
|
-
//# sourceMappingURL=appender.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-editor/src/components/list-view/appender.js"],"names":["ListViewAppender","parentBlockClientId","position","level","rowCount","path","isDragging","select","isBlockBeingDragged","isAncestorBeingDragged","blockEditorStore","instanceId","descriptionId","appenderPositionDescription","ref","tabIndex","onFocus"],"mappings":";;;;;;;;;;;AAGA;;AAKA;;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AA,WAAW,EAAG;AAAEE,QAAAA,GAAF;AAAOC,QAAAA,QAAP;AAAiBC,QAAAA;AAAjB;AAJf,MADD,EAOC;AACC,MAAA,SAAS,EAAC,8CADX;AAEC,MAAA,EAAE,EAAGJ;AAFN,OAIGC,2BAJH,CAPD,CADC;AAAA,GAJH,CAPD,CADD;AA+BA","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { __experimentalTreeGridCell as TreeGridCell } from '@wordpress/components';\nimport { useInstanceId } from '@wordpress/compose';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport ListViewLeaf from './leaf';\nimport Inserter from '../inserter';\nimport { store as blockEditorStore } from '../../store';\n\nexport default function ListViewAppender( {\n\tparentBlockClientId,\n\tposition,\n\tlevel,\n\trowCount,\n\tpath,\n} ) {\n\tconst isDragging = useSelect(\n\t\t( select ) => {\n\t\t\tconst { isBlockBeingDragged, isAncestorBeingDragged } = select(\n\t\t\t\tblockEditorStore\n\t\t\t);\n\n\t\t\treturn (\n\t\t\t\tisBlockBeingDragged( parentBlockClientId ) ||\n\t\t\t\tisAncestorBeingDragged( parentBlockClientId )\n\t\t\t);\n\t\t},\n\t\t[ parentBlockClientId ]\n\t);\n\tconst instanceId = useInstanceId( ListViewAppender );\n\tconst descriptionId = `list-view-appender-row__description_${ instanceId }`;\n\n\tconst appenderPositionDescription = sprintf(\n\t\t/* translators: 1: The numerical position of the block that will be inserted. 2: The level of nesting for the block that will be inserted. */\n\t\t__( 'Add block at position %1$d, Level %2$d' ),\n\t\tposition,\n\t\tlevel\n\t);\n\n\treturn (\n\t\t<ListViewLeaf\n\t\t\tclassName={ classnames( { 'is-dragging': isDragging } ) }\n\t\t\tlevel={ level }\n\t\t\tposition={ position }\n\t\t\trowCount={ rowCount }\n\t\t\tpath={ path }\n\t\t>\n\t\t\t<TreeGridCell\n\t\t\t\tclassName=\"block-editor-list-view-appender__cell\"\n\t\t\t\tcolSpan=\"3\"\n\t\t\t>\n\t\t\t\t{ ( { ref, tabIndex, onFocus } ) => (\n\t\t\t\t\t<div className=\"block-editor-list-view-appender__container\">\n\t\t\t\t\t\t<Inserter\n\t\t\t\t\t\t\trootClientId={ parentBlockClientId }\n\t\t\t\t\t\t\t__experimentalIsQuick\n\t\t\t\t\t\t\taria-describedby={ descriptionId }\n\t\t\t\t\t\t\ttoggleProps={ { ref, tabIndex, onFocus } }\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<div\n\t\t\t\t\t\t\tclassName=\"block-editor-list-view-appender__description\"\n\t\t\t\t\t\t\tid={ descriptionId }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ appenderPositionDescription }\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>\n\t\t\t\t) }\n\t\t\t</TreeGridCell>\n\t\t</ListViewLeaf>\n\t);\n}\n"]}
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
|
-
Object.defineProperty(exports, "__esModule", {
|
|
6
|
-
value: true
|
|
7
|
-
});
|
|
8
|
-
exports.default = ListViewListItem;
|
|
9
|
-
|
|
10
|
-
var _element = require("@wordpress/element");
|
|
11
|
-
|
|
12
|
-
var _classnames = _interopRequireDefault(require("classnames"));
|
|
13
|
-
|
|
14
|
-
var _components = require("@wordpress/components");
|
|
15
|
-
|
|
16
|
-
var _blocks = require("@wordpress/blocks");
|
|
17
|
-
|
|
18
|
-
var _i18n = require("@wordpress/i18n");
|
|
19
|
-
|
|
20
|
-
var _blockIcon = _interopRequireDefault(require("../block-icon"));
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* External dependencies
|
|
24
|
-
*/
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* WordPress dependencies
|
|
28
|
-
*/
|
|
29
|
-
|
|
30
|
-
/**
|
|
31
|
-
* Internal dependencies
|
|
32
|
-
*/
|
|
33
|
-
function ListViewListItem(_ref) {
|
|
34
|
-
let {
|
|
35
|
-
block,
|
|
36
|
-
onClick,
|
|
37
|
-
isSelected,
|
|
38
|
-
wrapperComponent: WrapperComponent,
|
|
39
|
-
children
|
|
40
|
-
} = _ref;
|
|
41
|
-
const blockType = (0, _blocks.getBlockType)(block.name);
|
|
42
|
-
const blockLabel = blockType ? (0, _blocks.__experimentalGetBlockLabel)(blockType, block.attributes) : null;
|
|
43
|
-
return (0, _element.createElement)("div", {
|
|
44
|
-
className: "block-editor-list-view__list-item"
|
|
45
|
-
}, (0, _element.createElement)(WrapperComponent, {
|
|
46
|
-
className: (0, _classnames.default)('block-editor-list-view__list-item-button', {
|
|
47
|
-
'is-selected': isSelected
|
|
48
|
-
}),
|
|
49
|
-
onClick: onClick
|
|
50
|
-
}, (0, _element.createElement)(_blockIcon.default, {
|
|
51
|
-
icon: blockType === null || blockType === void 0 ? void 0 : blockType.icon,
|
|
52
|
-
showColors: true
|
|
53
|
-
}), children ? children : blockLabel, isSelected && (0, _element.createElement)(_components.VisuallyHidden, {
|
|
54
|
-
as: "span"
|
|
55
|
-
}, (0, _i18n.__)('(selected block)'))));
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
ListViewListItem.defaultProps = {
|
|
59
|
-
onClick: () => {},
|
|
60
|
-
wrapperComponent: props => (0, _element.createElement)(_components.Button, props)
|
|
61
|
-
};
|
|
62
|
-
//# sourceMappingURL=list-item.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-editor/src/components/list-view/list-item.js"],"names":["ListViewListItem","block","onClick","isSelected","wrapperComponent","WrapperComponent","children","blockType","name","blockLabel","attributes","icon","defaultProps","props"],"mappings":";;;;;;;;;;;AAGA;;AAKA;;AACA;;AAIA;;AAKA;;AAlBA;AACA;AACA;;AAGA;AACA;AACA;;AAQA;AACA;AACA;AAGe,SAASA,gBAAT,OAMX;AAAA,MANsC;AACzCC,IAAAA,KADyC;AAEzCC,IAAAA,OAFyC;AAGzCC,IAAAA,UAHyC;AAIzCC,IAAAA,gBAAgB,EAAEC,gBAJuB;AAKzCC,IAAAA;AALyC,GAMtC;AACH,QAAMC,SAAS,GAAG,0BAAcN,KAAK,CAACO,IAApB,CAAlB;AACA,QAAMC,UAAU,GAAGF,SAAS,GACzB,yCAAeA,SAAf,EAA0BN,KAAK,CAACS,UAAhC,CADyB,GAEzB,IAFH;AAIA,SACC;AAAK,IAAA,SAAS,EAAC;AAAf,KACC,4BAAC,gBAAD;AACC,IAAA,SAAS,EAAG,yBACX,0CADW,EAEX;AACC,qBAAeP;AADhB,KAFW,CADb;AAOC,IAAA,OAAO,EAAGD;AAPX,KASC,4BAAC,kBAAD;AAAW,IAAA,IAAI,EAAGK,SAAH,aAAGA,SAAH,uBAAGA,SAAS,CAAEI,IAA7B;AAAoC,IAAA,UAAU;AAA9C,IATD,EAUGL,QAAQ,GAAGA,QAAH,GAAcG,UAVzB,EAWGN,UAAU,IACX,4BAAC,0BAAD;AAAgB,IAAA,EAAE,EAAC;AAAnB,KACG,cAAI,kBAAJ,CADH,CAZF,CADD,CADD;AAqBA;;AAEDH,gBAAgB,CAACY,YAAjB,GAAgC;AAC/BV,EAAAA,OAAO,EAAE,MAAM,CAAE,CADc;AAE/BE,EAAAA,gBAAgB,EAAIS,KAAF,IAAa,4BAAC,kBAAD,EAAaA,KAAb;AAFA,CAAhC","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { Button, VisuallyHidden } from '@wordpress/components';\nimport {\n\t__experimentalGetBlockLabel as getBlockLabel,\n\tgetBlockType,\n} from '@wordpress/blocks';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport BlockIcon from '../block-icon';\n\nexport default function ListViewListItem( {\n\tblock,\n\tonClick,\n\tisSelected,\n\twrapperComponent: WrapperComponent,\n\tchildren,\n} ) {\n\tconst blockType = getBlockType( block.name );\n\tconst blockLabel = blockType\n\t\t? getBlockLabel( blockType, block.attributes )\n\t\t: null;\n\n\treturn (\n\t\t<div className=\"block-editor-list-view__list-item\">\n\t\t\t<WrapperComponent\n\t\t\t\tclassName={ classnames(\n\t\t\t\t\t'block-editor-list-view__list-item-button',\n\t\t\t\t\t{\n\t\t\t\t\t\t'is-selected': isSelected,\n\t\t\t\t\t}\n\t\t\t\t) }\n\t\t\t\tonClick={ onClick }\n\t\t\t>\n\t\t\t\t<BlockIcon icon={ blockType?.icon } showColors />\n\t\t\t\t{ children ? children : blockLabel }\n\t\t\t\t{ isSelected && (\n\t\t\t\t\t<VisuallyHidden as=\"span\">\n\t\t\t\t\t\t{ __( '(selected block)' ) }\n\t\t\t\t\t</VisuallyHidden>\n\t\t\t\t) }\n\t\t\t</WrapperComponent>\n\t\t</div>\n\t);\n}\n\nListViewListItem.defaultProps = {\n\tonClick: () => {},\n\twrapperComponent: ( props ) => <Button { ...props } />,\n};\n"]}
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.useCaretInFormat = useCaretInFormat;
|
|
7
|
-
|
|
8
|
-
var _element = require("@wordpress/element");
|
|
9
|
-
|
|
10
|
-
var _data = require("@wordpress/data");
|
|
11
|
-
|
|
12
|
-
var _store = require("../../store");
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* WordPress dependencies
|
|
16
|
-
*/
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* Internal dependencies
|
|
20
|
-
*/
|
|
21
|
-
function useCaretInFormat(_ref) {
|
|
22
|
-
let {
|
|
23
|
-
value
|
|
24
|
-
} = _ref;
|
|
25
|
-
const hasActiveFormats = value.activeFormats && !!value.activeFormats.length;
|
|
26
|
-
const {
|
|
27
|
-
isCaretWithinFormattedText
|
|
28
|
-
} = (0, _data.useSelect)(_store.store);
|
|
29
|
-
const {
|
|
30
|
-
enterFormattedText,
|
|
31
|
-
exitFormattedText
|
|
32
|
-
} = (0, _data.useDispatch)(_store.store);
|
|
33
|
-
(0, _element.useEffect)(() => {
|
|
34
|
-
if (hasActiveFormats) {
|
|
35
|
-
if (!isCaretWithinFormattedText()) {
|
|
36
|
-
enterFormattedText();
|
|
37
|
-
}
|
|
38
|
-
} else if (isCaretWithinFormattedText()) {
|
|
39
|
-
exitFormattedText();
|
|
40
|
-
}
|
|
41
|
-
}, [hasActiveFormats]);
|
|
42
|
-
}
|
|
43
|
-
//# sourceMappingURL=use-caret-in-format.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-editor/src/components/rich-text/use-caret-in-format.js"],"names":["useCaretInFormat","value","hasActiveFormats","activeFormats","length","isCaretWithinFormattedText","blockEditorStore","enterFormattedText","exitFormattedText"],"mappings":";;;;;;;AAGA;;AACA;;AAKA;;AATA;AACA;AACA;;AAIA;AACA;AACA;AAGO,SAASA,gBAAT,OAAuC;AAAA,MAAZ;AAAEC,IAAAA;AAAF,GAAY;AAC7C,QAAMC,gBAAgB,GACrBD,KAAK,CAACE,aAAN,IAAuB,CAAC,CAAEF,KAAK,CAACE,aAAN,CAAoBC,MAD/C;AAEA,QAAM;AAAEC,IAAAA;AAAF,MAAiC,qBAAWC,YAAX,CAAvC;AACA,QAAM;AAAEC,IAAAA,kBAAF;AAAsBC,IAAAA;AAAtB,MAA4C,uBACjDF,YADiD,CAAlD;AAGA,0BAAW,MAAM;AAChB,QAAKJ,gBAAL,EAAwB;AACvB,UAAK,CAAEG,0BAA0B,EAAjC,EAAsC;AACrCE,QAAAA,kBAAkB;AAClB;AACD,KAJD,MAIO,IAAKF,0BAA0B,EAA/B,EAAoC;AAC1CG,MAAAA,iBAAiB;AACjB;AACD,GARD,EAQG,CAAEN,gBAAF,CARH;AASA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useEffect } from '@wordpress/element';\nimport { useDispatch, useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../../store';\n\nexport function useCaretInFormat( { value } ) {\n\tconst hasActiveFormats =\n\t\tvalue.activeFormats && !! value.activeFormats.length;\n\tconst { isCaretWithinFormattedText } = useSelect( blockEditorStore );\n\tconst { enterFormattedText, exitFormattedText } = useDispatch(\n\t\tblockEditorStore\n\t);\n\tuseEffect( () => {\n\t\tif ( hasActiveFormats ) {\n\t\t\tif ( ! isCaretWithinFormattedText() ) {\n\t\t\t\tenterFormattedText();\n\t\t\t}\n\t\t} else if ( isCaretWithinFormattedText() ) {\n\t\t\texitFormattedText();\n\t\t}\n\t}, [ hasActiveFormats ] );\n}\n"]}
|