@wordpress/edit-widgets 5.16.0 → 5.17.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/blocks/widget-area/edit/index.js +4 -16
- package/build/blocks/widget-area/edit/index.js.map +1 -1
- package/build/blocks/widget-area/edit/inner-blocks.js +5 -10
- package/build/blocks/widget-area/edit/inner-blocks.js.map +1 -1
- package/build/blocks/widget-area/edit/use-is-dragging-within.js +5 -10
- package/build/blocks/widget-area/edit/use-is-dragging-within.js.map +1 -1
- package/build/blocks/widget-area/index.js +0 -5
- package/build/blocks/widget-area/index.js.map +1 -1
- package/build/components/error-boundary/index.js +1 -15
- package/build/components/error-boundary/index.js.map +1 -1
- package/build/components/header/index.js +9 -32
- package/build/components/header/index.js.map +1 -1
- package/build/components/header/undo-redo/redo.js +3 -9
- package/build/components/header/undo-redo/redo.js.map +1 -1
- package/build/components/header/undo-redo/undo.js +3 -9
- package/build/components/header/undo-redo/undo.js.map +1 -1
- package/build/components/keyboard-shortcut-help-modal/config.js +1 -2
- package/build/components/keyboard-shortcut-help-modal/config.js.map +1 -1
- package/build/components/keyboard-shortcut-help-modal/dynamic-shortcut.js +1 -9
- package/build/components/keyboard-shortcut-help-modal/dynamic-shortcut.js.map +1 -1
- package/build/components/keyboard-shortcut-help-modal/index.js +4 -20
- package/build/components/keyboard-shortcut-help-modal/index.js.map +1 -1
- package/build/components/keyboard-shortcut-help-modal/shortcut.js +1 -6
- package/build/components/keyboard-shortcut-help-modal/shortcut.js.map +1 -1
- package/build/components/keyboard-shortcuts/index.js +1 -18
- package/build/components/keyboard-shortcuts/index.js.map +1 -1
- package/build/components/layout/index.js +2 -19
- package/build/components/layout/index.js.map +1 -1
- package/build/components/layout/interface.js +5 -21
- package/build/components/layout/interface.js.map +1 -1
- package/build/components/layout/unsaved-changes-warning.js +0 -6
- package/build/components/layout/unsaved-changes-warning.js.map +1 -1
- package/build/components/more-menu/index.js +2 -17
- package/build/components/more-menu/index.js.map +1 -1
- package/build/components/more-menu/tools-more-menu-group.js +1 -5
- package/build/components/more-menu/tools-more-menu-group.js.map +1 -1
- package/build/components/notices/index.js +1 -6
- package/build/components/notices/index.js.map +1 -1
- package/build/components/save-button/index.js +1 -7
- package/build/components/save-button/index.js.map +1 -1
- package/build/components/secondary-sidebar/index.js +1 -10
- package/build/components/secondary-sidebar/index.js.map +1 -1
- package/build/components/secondary-sidebar/inserter-sidebar.js +1 -11
- package/build/components/secondary-sidebar/inserter-sidebar.js.map +1 -1
- package/build/components/secondary-sidebar/list-view-sidebar.js +6 -15
- package/build/components/secondary-sidebar/list-view-sidebar.js.map +1 -1
- package/build/components/sidebar/index.js +12 -26
- package/build/components/sidebar/index.js.map +1 -1
- package/build/components/sidebar/widget-areas.js +1 -12
- package/build/components/sidebar/widget-areas.js.map +1 -1
- package/build/components/welcome-guide/index.js +3 -12
- package/build/components/welcome-guide/index.js.map +1 -1
- package/build/components/widget-areas-block-editor-content/index.js +1 -8
- package/build/components/widget-areas-block-editor-content/index.js.map +1 -1
- package/build/components/widget-areas-block-editor-provider/index.js +8 -23
- package/build/components/widget-areas-block-editor-provider/index.js.map +1 -1
- package/build/constants.js.map +1 -1
- package/build/filters/index.js +0 -1
- package/build/filters/index.js.map +1 -1
- package/build/filters/move-to-widget-area.js +3 -9
- package/build/filters/move-to-widget-area.js.map +1 -1
- package/build/filters/replace-media-upload.js +1 -3
- package/build/filters/replace-media-upload.js.map +1 -1
- package/build/hooks/use-last-selected-widget-area.js +5 -13
- package/build/hooks/use-last-selected-widget-area.js.map +1 -1
- package/build/hooks/use-widget-library-insertion-point.js +6 -14
- package/build/hooks/use-widget-library-insertion-point.js.map +1 -1
- package/build/index.js +6 -34
- package/build/index.js.map +1 -1
- package/build/lock-unlock.js +1 -2
- package/build/lock-unlock.js.map +1 -1
- package/build/store/actions.js +41 -79
- package/build/store/actions.js.map +1 -1
- package/build/store/constants.js +0 -1
- package/build/store/constants.js.map +1 -1
- package/build/store/index.js +4 -15
- package/build/store/index.js.map +1 -1
- package/build/store/reducer.js +4 -16
- package/build/store/reducer.js.map +1 -1
- package/build/store/resolvers.js +1 -17
- package/build/store/resolvers.js.map +1 -1
- package/build/store/selectors.js +28 -49
- package/build/store/selectors.js.map +1 -1
- package/build/store/transformers.js +7 -16
- package/build/store/transformers.js.map +1 -1
- package/build/store/utils.js +7 -16
- package/build/store/utils.js.map +1 -1
- package/build-module/blocks/widget-area/edit/index.js +5 -8
- package/build-module/blocks/widget-area/edit/index.js.map +1 -1
- package/build-module/blocks/widget-area/edit/inner-blocks.js +6 -6
- package/build-module/blocks/widget-area/edit/inner-blocks.js.map +1 -1
- package/build-module/blocks/widget-area/edit/use-is-dragging-within.js +6 -9
- package/build-module/blocks/widget-area/edit/use-is-dragging-within.js.map +1 -1
- package/build-module/blocks/widget-area/index.js +1 -1
- package/build-module/blocks/widget-area/index.js.map +1 -1
- package/build-module/components/error-boundary/index.js +0 -9
- package/build-module/components/error-boundary/index.js.map +1 -1
- package/build-module/components/header/index.js +9 -17
- package/build-module/components/header/index.js.map +1 -1
- package/build-module/components/header/undo-redo/redo.js +2 -2
- package/build-module/components/header/undo-redo/redo.js.map +1 -1
- package/build-module/components/header/undo-redo/undo.js +2 -2
- package/build-module/components/header/undo-redo/undo.js.map +1 -1
- package/build-module/components/keyboard-shortcut-help-modal/config.js.map +1 -1
- package/build-module/components/keyboard-shortcut-help-modal/dynamic-shortcut.js +1 -6
- package/build-module/components/keyboard-shortcut-help-modal/dynamic-shortcut.js.map +1 -1
- package/build-module/components/keyboard-shortcut-help-modal/index.js +5 -13
- package/build-module/components/keyboard-shortcut-help-modal/index.js.map +1 -1
- package/build-module/components/keyboard-shortcut-help-modal/shortcut.js +0 -5
- package/build-module/components/keyboard-shortcut-help-modal/shortcut.js.map +1 -1
- package/build-module/components/keyboard-shortcuts/index.js +1 -10
- package/build-module/components/keyboard-shortcuts/index.js.map +1 -1
- package/build-module/components/layout/index.js +2 -8
- package/build-module/components/layout/index.js.map +1 -1
- package/build-module/components/layout/interface.js +5 -9
- package/build-module/components/layout/interface.js.map +1 -1
- package/build-module/components/layout/unsaved-changes-warning.js +2 -3
- package/build-module/components/layout/unsaved-changes-warning.js.map +1 -1
- package/build-module/components/more-menu/index.js +2 -6
- package/build-module/components/more-menu/index.js.map +1 -1
- package/build-module/components/more-menu/tools-more-menu-group.js +0 -3
- package/build-module/components/more-menu/tools-more-menu-group.js.map +1 -1
- package/build-module/components/notices/index.js +0 -3
- package/build-module/components/notices/index.js.map +1 -1
- package/build-module/components/save-button/index.js +1 -4
- package/build-module/components/save-button/index.js.map +1 -1
- package/build-module/components/secondary-sidebar/index.js +1 -6
- package/build-module/components/secondary-sidebar/index.js.map +1 -1
- package/build-module/components/secondary-sidebar/inserter-sidebar.js +1 -2
- package/build-module/components/secondary-sidebar/inserter-sidebar.js.map +1 -1
- package/build-module/components/secondary-sidebar/list-view-sidebar.js +6 -7
- package/build-module/components/secondary-sidebar/list-view-sidebar.js.map +1 -1
- package/build-module/components/sidebar/index.js +13 -18
- package/build-module/components/sidebar/index.js.map +1 -1
- package/build-module/components/sidebar/widget-areas.js +1 -4
- package/build-module/components/sidebar/widget-areas.js.map +1 -1
- package/build-module/components/welcome-guide/index.js +3 -7
- package/build-module/components/welcome-guide/index.js.map +1 -1
- package/build-module/components/widget-areas-block-editor-content/index.js +1 -2
- package/build-module/components/widget-areas-block-editor-content/index.js.map +1 -1
- package/build-module/components/widget-areas-block-editor-provider/index.js +8 -7
- package/build-module/components/widget-areas-block-editor-provider/index.js.map +1 -1
- package/build-module/constants.js.map +1 -1
- package/build-module/filters/index.js.map +1 -1
- package/build-module/filters/move-to-widget-area.js +4 -4
- package/build-module/filters/move-to-widget-area.js.map +1 -1
- package/build-module/filters/replace-media-upload.js +0 -2
- package/build-module/filters/replace-media-upload.js.map +1 -1
- package/build-module/hooks/use-last-selected-widget-area.js +7 -9
- package/build-module/hooks/use-last-selected-widget-area.js.map +1 -1
- package/build-module/hooks/use-widget-library-insertion-point.js +6 -10
- package/build-module/hooks/use-widget-library-insertion-point.js.map +1 -1
- package/build-module/index.js +8 -20
- package/build-module/index.js.map +1 -1
- package/build-module/lock-unlock.js.map +1 -1
- package/build-module/store/actions.js +43 -56
- package/build-module/store/actions.js.map +1 -1
- package/build-module/store/constants.js.map +1 -1
- package/build-module/store/index.js +6 -6
- package/build-module/store/index.js.map +1 -1
- package/build-module/store/reducer.js +5 -11
- package/build-module/store/reducer.js.map +1 -1
- package/build-module/store/resolvers.js +3 -10
- package/build-module/store/resolvers.js.map +1 -1
- package/build-module/store/selectors.js +29 -38
- package/build-module/store/selectors.js.map +1 -1
- package/build-module/store/transformers.js +8 -13
- package/build-module/store/transformers.js.map +1 -1
- package/build-module/store/utils.js +7 -7
- package/build-module/store/utils.js.map +1 -1
- package/build-style/style-rtl.css +14 -8
- package/build-style/style.css +14 -8
- package/package.json +28 -27
- package/src/components/widget-areas-block-editor-provider/index.js +3 -3
- package/src/index.js +0 -1
- package/src/store/selectors.js +10 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"names":["_blocks","require","_widgets","transformWidgetToBlock","widget","id_base","parsedBlocks","parse","instance","raw","content","__unstableSkipAutop","length","addWidgetIdToBlock","createBlock","id","attributes","_embedded","about","is_multi","idBase","transformBlockToWidget","block","relatedWidget","isValidLegacyWidgetBlock","name","_block$attributes$id","_block$attributes$idB","_block$attributes$ins","serialize","rendered","rendered_form"],"sources":["@wordpress/edit-widgets/src/store/transformers.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { createBlock, parse, serialize } from '@wordpress/blocks';\nimport { addWidgetIdToBlock } from '@wordpress/widgets';\n\n/**\n * Converts a widget entity record into a block.\n *\n * @param {Object} widget The widget entity record.\n * @return {Object} a block (converted from the entity record).\n */\nexport function transformWidgetToBlock( widget ) {\n\tif ( widget.id_base === 'block' ) {\n\t\tconst parsedBlocks = parse( widget.instance.raw.content, {\n\t\t\t__unstableSkipAutop: true,\n\t\t} );\n\t\tif ( ! parsedBlocks.length ) {\n\t\t\treturn addWidgetIdToBlock(\n\t\t\t\tcreateBlock( 'core/paragraph', {}, [] ),\n\t\t\t\twidget.id\n\t\t\t);\n\t\t}\n\t\treturn addWidgetIdToBlock( parsedBlocks[ 0 ], widget.id );\n\t}\n\n\tlet attributes;\n\tif ( widget._embedded.about[ 0 ].is_multi ) {\n\t\tattributes = {\n\t\t\tidBase: widget.id_base,\n\t\t\tinstance: widget.instance,\n\t\t};\n\t} else {\n\t\tattributes = {\n\t\t\tid: widget.id,\n\t\t};\n\t}\n\n\treturn addWidgetIdToBlock(\n\t\tcreateBlock( 'core/legacy-widget', attributes, [] ),\n\t\twidget.id\n\t);\n}\n\n/**\n * Converts a block to a widget entity record.\n *\n * @param {Object} block The block.\n * @param {Object?} relatedWidget A related widget entity record from the API (optional).\n * @return {Object} the widget object (converted from block).\n */\nexport function transformBlockToWidget( block, relatedWidget = {} ) {\n\tlet widget;\n\n\tconst isValidLegacyWidgetBlock =\n\t\tblock.name === 'core/legacy-widget' &&\n\t\t( block.attributes.id || block.attributes.instance );\n\n\tif ( isValidLegacyWidgetBlock ) {\n\t\twidget = {\n\t\t\t...relatedWidget,\n\t\t\tid: block.attributes.id ?? relatedWidget.id,\n\t\t\tid_base: block.attributes.idBase ?? relatedWidget.id_base,\n\t\t\tinstance: block.attributes.instance ?? relatedWidget.instance,\n\t\t};\n\t} else {\n\t\twidget = {\n\t\t\t...relatedWidget,\n\t\t\tid_base: 'block',\n\t\t\tinstance: {\n\t\t\t\traw: {\n\t\t\t\t\tcontent: serialize( block ),\n\t\t\t\t},\n\t\t\t},\n\t\t};\n\t}\n\n\t// Delete read-only properties.\n\tdelete widget.rendered;\n\tdelete widget.rendered_form;\n\n\treturn widget;\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AAJA;AACA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IAAKgB,wBAAwB,EAAG;IAAA,IAAAE,oBAAA,EAAAC,qBAAA,EAAAC,qBAAA;IAC/BxB,MAAM,GAAG;MACR,GAAGmB,aAAa;MAChBR,EAAE,GAAAW,oBAAA,GAAEJ,KAAK,CAACN,UAAU,CAACD,EAAE,cAAAW,oBAAA,cAAAA,oBAAA,GAAIH,aAAa,CAACR,EAAE;MAC3CV,OAAO,GAAAsB,qBAAA,GAAEL,KAAK,CAACN,UAAU,CAACI,MAAM,cAAAO,qBAAA,cAAAA,qBAAA,GAAIJ,aAAa,CAAClB,OAAO;MACzDG,QAAQ,GAAAoB,qBAAA,GAAEN,KAAK,CAACN,UAAU,CAACR,QAAQ,cAAAoB,qBAAA,cAAAA,qBAAA,GAAIL,aAAa,CAACf;IACtD,CAAC;EACF,CAAC,MAAM;IACNJ,MAAM,GAAG;MACR,GAAGmB,aAAa;MAChBlB,OAAO,EAAE,OAAO;MAChBG,QAAQ,EAAE;QACTC,GAAG,EAAE;UACJC,OAAO,EAAE,IAAAmB,iBAAS,EAAEP,KAAM;QAC3B;MACD;IACD,CAAC;EACF;;EAEA;EACA,OAAOlB,MAAM,CAAC0B,QAAQ;EACtB,OAAO1B,MAAM,CAAC2B,aAAa;EAE3B,OAAO3B,MAAM;AACd"}
|
package/build/store/utils.js
CHANGED
|
@@ -7,76 +7,70 @@ exports.buildWidgetAreasPostId = exports.buildWidgetAreaPostId = exports.WIDGET_
|
|
|
7
7
|
exports.buildWidgetAreasQuery = buildWidgetAreasQuery;
|
|
8
8
|
exports.buildWidgetsQuery = buildWidgetsQuery;
|
|
9
9
|
exports.createStubPost = void 0;
|
|
10
|
-
|
|
11
10
|
/**
|
|
12
11
|
* "Kind" of the navigation post.
|
|
13
12
|
*
|
|
14
13
|
* @type {string}
|
|
15
14
|
*/
|
|
16
15
|
const KIND = 'root';
|
|
16
|
+
|
|
17
17
|
/**
|
|
18
18
|
* "post type" of the navigation post.
|
|
19
19
|
*
|
|
20
20
|
* @type {string}
|
|
21
21
|
*/
|
|
22
|
-
|
|
23
22
|
exports.KIND = KIND;
|
|
24
23
|
const WIDGET_AREA_ENTITY_TYPE = 'sidebar';
|
|
24
|
+
|
|
25
25
|
/**
|
|
26
26
|
* "post type" of the widget area post.
|
|
27
27
|
*
|
|
28
28
|
* @type {string}
|
|
29
29
|
*/
|
|
30
|
-
|
|
31
30
|
exports.WIDGET_AREA_ENTITY_TYPE = WIDGET_AREA_ENTITY_TYPE;
|
|
32
31
|
const POST_TYPE = 'postType';
|
|
32
|
+
|
|
33
33
|
/**
|
|
34
34
|
* Builds an ID for a new widget area post.
|
|
35
35
|
*
|
|
36
36
|
* @param {number} widgetAreaId Widget area id.
|
|
37
37
|
* @return {string} An ID.
|
|
38
38
|
*/
|
|
39
|
-
|
|
40
39
|
exports.POST_TYPE = POST_TYPE;
|
|
41
|
-
|
|
42
40
|
const buildWidgetAreaPostId = widgetAreaId => `widget-area-${widgetAreaId}`;
|
|
41
|
+
|
|
43
42
|
/**
|
|
44
43
|
* Builds an ID for a global widget areas post.
|
|
45
44
|
*
|
|
46
45
|
* @return {string} An ID.
|
|
47
46
|
*/
|
|
48
|
-
|
|
49
|
-
|
|
50
47
|
exports.buildWidgetAreaPostId = buildWidgetAreaPostId;
|
|
51
|
-
|
|
52
48
|
const buildWidgetAreasPostId = () => `widget-areas`;
|
|
49
|
+
|
|
53
50
|
/**
|
|
54
51
|
* Builds a query to resolve sidebars.
|
|
55
52
|
*
|
|
56
53
|
* @return {Object} Query.
|
|
57
54
|
*/
|
|
58
|
-
|
|
59
|
-
|
|
60
55
|
exports.buildWidgetAreasPostId = buildWidgetAreasPostId;
|
|
61
|
-
|
|
62
56
|
function buildWidgetAreasQuery() {
|
|
63
57
|
return {
|
|
64
58
|
per_page: -1
|
|
65
59
|
};
|
|
66
60
|
}
|
|
61
|
+
|
|
67
62
|
/**
|
|
68
63
|
* Builds a query to resolve widgets.
|
|
69
64
|
*
|
|
70
65
|
* @return {Object} Query.
|
|
71
66
|
*/
|
|
72
|
-
|
|
73
|
-
|
|
74
67
|
function buildWidgetsQuery() {
|
|
75
68
|
return {
|
|
76
69
|
per_page: -1,
|
|
77
70
|
_embed: 'about'
|
|
78
71
|
};
|
|
79
72
|
}
|
|
73
|
+
|
|
80
74
|
/**
|
|
81
75
|
* Creates a stub post with given id and set of blocks. Used as a governing entity records
|
|
82
76
|
* for all widget areas.
|
|
@@ -85,8 +79,6 @@ function buildWidgetsQuery() {
|
|
|
85
79
|
* @param {Array} blocks The list of blocks.
|
|
86
80
|
* @return {Object} A stub post object formatted in compliance with the data layer.
|
|
87
81
|
*/
|
|
88
|
-
|
|
89
|
-
|
|
90
82
|
const createStubPost = (id, blocks) => ({
|
|
91
83
|
id,
|
|
92
84
|
slug: id,
|
|
@@ -97,6 +89,5 @@ const createStubPost = (id, blocks) => ({
|
|
|
97
89
|
widgetAreaId: id
|
|
98
90
|
}
|
|
99
91
|
});
|
|
100
|
-
|
|
101
92
|
exports.createStubPost = createStubPost;
|
|
102
93
|
//# sourceMappingURL=utils.js.map
|
package/build/store/utils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"names":["KIND","exports","WIDGET_AREA_ENTITY_TYPE","POST_TYPE","buildWidgetAreaPostId","widgetAreaId","buildWidgetAreasPostId","buildWidgetAreasQuery","per_page","buildWidgetsQuery","_embed","createStubPost","id","blocks","slug","status","type","meta"],"sources":["@wordpress/edit-widgets/src/store/utils.js"],"sourcesContent":["/**\n * \"Kind\" of the navigation post.\n *\n * @type {string}\n */\nexport const KIND = 'root';\n\n/**\n * \"post type\" of the navigation post.\n *\n * @type {string}\n */\nexport const WIDGET_AREA_ENTITY_TYPE = 'sidebar';\n\n/**\n * \"post type\" of the widget area post.\n *\n * @type {string}\n */\nexport const POST_TYPE = 'postType';\n\n/**\n * Builds an ID for a new widget area post.\n *\n * @param {number} widgetAreaId Widget area id.\n * @return {string} An ID.\n */\nexport const buildWidgetAreaPostId = ( widgetAreaId ) =>\n\t`widget-area-${ widgetAreaId }`;\n\n/**\n * Builds an ID for a global widget areas post.\n *\n * @return {string} An ID.\n */\nexport const buildWidgetAreasPostId = () => `widget-areas`;\n\n/**\n * Builds a query to resolve sidebars.\n *\n * @return {Object} Query.\n */\nexport function buildWidgetAreasQuery() {\n\treturn {\n\t\tper_page: -1,\n\t};\n}\n\n/**\n * Builds a query to resolve widgets.\n *\n * @return {Object} Query.\n */\nexport function buildWidgetsQuery() {\n\treturn {\n\t\tper_page: -1,\n\t\t_embed: 'about',\n\t};\n}\n\n/**\n * Creates a stub post with given id and set of blocks. Used as a governing entity records\n * for all widget areas.\n *\n * @param {string} id Post ID.\n * @param {Array} blocks The list of blocks.\n * @return {Object} A stub post object formatted in compliance with the data layer.\n */\nexport const createStubPost = ( id, blocks ) => ( {\n\tid,\n\tslug: id,\n\tstatus: 'draft',\n\ttype: 'page',\n\tblocks,\n\tmeta: {\n\t\twidgetAreaId: id,\n\t},\n} );\n"],"mappings":";;;;;;;;;AAAA;AACA;AACA;AACA;AACA;AACO,MAAMA,IAAI,GAAG,MAAM;;AAE1B;AACA;AACA;AACA;AACA;AAJAC,OAAA,CAAAD,IAAA,GAAAA,IAAA;AAKO,MAAME,uBAAuB,GAAG,SAAS;;AAEhD;AACA;AACA;AACA;AACA;AAJAD,OAAA,CAAAC,uBAAA,GAAAA,uBAAA;AAKO,MAAMC,SAAS,GAAG,UAAU;;AAEnC;AACA;AACA;AACA;AACA;AACA;AALAF,OAAA,CAAAE,SAAA,GAAAA,SAAA;AAMO,MAAMC,qBAAqB,GAAKC,YAAY,IACjD,eAAeA,YAAc,EAAC;;AAEhC;AACA;AACA;AACA;AACA;AAJAJ,OAAA,CAAAG,qBAAA,GAAAA,qBAAA;AAKO,MAAME,sBAAsB,GAAGA,CAAA,KAAO,cAAa;;AAE1D;AACA;AACA;AACA;AACA;AAJAL,OAAA,CAAAK,sBAAA,GAAAA,sBAAA;AAKO,SAASC,qBAAqBA,CAAA,EAAG;EACvC,OAAO;IACNC,QAAQ,EAAE,CAAC;EACZ,CAAC;AACF;;AAEA;AACA;AACA;AACA;AACA;AACO,SAASC,iBAAiBA,CAAA,EAAG;EACnC,OAAO;IACND,QAAQ,EAAE,CAAC,CAAC;IACZE,MAAM,EAAE;EACT,CAAC;AACF;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMC,cAAc,GAAGA,CAAEC,EAAE,EAAEC,MAAM,MAAQ;EACjDD,EAAE;EACFE,IAAI,EAAEF,EAAE;EACRG,MAAM,EAAE,OAAO;EACfC,IAAI,EAAE,MAAM;EACZH,MAAM;EACNI,IAAI,EAAE;IACLZ,YAAY,EAAEO;EACf;AACD,CAAC,CAAE;AAACX,OAAA,CAAAU,cAAA,GAAAA,cAAA"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { createElement } from "@wordpress/element";
|
|
2
|
-
|
|
3
2
|
/**
|
|
4
3
|
* WordPress dependencies
|
|
5
4
|
*/
|
|
@@ -7,13 +6,14 @@ import { useEffect, useState, useCallback, useRef } from '@wordpress/element';
|
|
|
7
6
|
import { useSelect, useDispatch } from '@wordpress/data';
|
|
8
7
|
import { EntityProvider } from '@wordpress/core-data';
|
|
9
8
|
import { __unstableDisclosureContent as DisclosureContent, Panel, PanelBody } from '@wordpress/components';
|
|
9
|
+
|
|
10
10
|
/**
|
|
11
11
|
* Internal dependencies
|
|
12
12
|
*/
|
|
13
|
-
|
|
14
13
|
import WidgetAreaInnerBlocks from './inner-blocks';
|
|
15
14
|
import { store as editWidgetsStore } from '../../../store';
|
|
16
15
|
import useIsDraggingWithin from './use-is-dragging-within';
|
|
16
|
+
|
|
17
17
|
/** @typedef {import('@wordpress/element').RefObject} RefObject */
|
|
18
18
|
|
|
19
19
|
export default function WidgetAreaEdit({
|
|
@@ -38,7 +38,6 @@ export default function WidgetAreaEdit({
|
|
|
38
38
|
setOpenedWhileDragging(false);
|
|
39
39
|
return;
|
|
40
40
|
}
|
|
41
|
-
|
|
42
41
|
if (isDraggingWithin && !isOpen) {
|
|
43
42
|
setOpen(true);
|
|
44
43
|
setOpenedWhileDragging(true);
|
|
@@ -58,7 +57,8 @@ export default function WidgetAreaEdit({
|
|
|
58
57
|
scrollAfterOpen: !isDragging
|
|
59
58
|
}, ({
|
|
60
59
|
opened
|
|
61
|
-
}) =>
|
|
60
|
+
}) =>
|
|
61
|
+
// This is required to ensure LegacyWidget blocks are not
|
|
62
62
|
// unmounted when the panel is collapsed. Unmounting legacy
|
|
63
63
|
// widgets may have unintended consequences (e.g. TinyMCE
|
|
64
64
|
// not being properly reinitialized)
|
|
@@ -73,6 +73,7 @@ export default function WidgetAreaEdit({
|
|
|
73
73
|
id: id
|
|
74
74
|
})))));
|
|
75
75
|
}
|
|
76
|
+
|
|
76
77
|
/**
|
|
77
78
|
* A React hook to determine if dragging is active.
|
|
78
79
|
*
|
|
@@ -80,22 +81,18 @@ export default function WidgetAreaEdit({
|
|
|
80
81
|
*
|
|
81
82
|
* @return {boolean} Is dragging within the entire document.
|
|
82
83
|
*/
|
|
83
|
-
|
|
84
84
|
const useIsDragging = elementRef => {
|
|
85
85
|
const [isDragging, setIsDragging] = useState(false);
|
|
86
86
|
useEffect(() => {
|
|
87
87
|
const {
|
|
88
88
|
ownerDocument
|
|
89
89
|
} = elementRef.current;
|
|
90
|
-
|
|
91
90
|
function handleDragStart() {
|
|
92
91
|
setIsDragging(true);
|
|
93
92
|
}
|
|
94
|
-
|
|
95
93
|
function handleDragEnd() {
|
|
96
94
|
setIsDragging(false);
|
|
97
95
|
}
|
|
98
|
-
|
|
99
96
|
ownerDocument.addEventListener('dragstart', handleDragStart);
|
|
100
97
|
ownerDocument.addEventListener('dragend', handleDragEnd);
|
|
101
98
|
return () => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"names":["useEffect","useState","useCallback","useRef","useSelect","useDispatch","EntityProvider","__unstableDisclosureContent","DisclosureContent","Panel","PanelBody","WidgetAreaInnerBlocks","store","editWidgetsStore","useIsDraggingWithin","WidgetAreaEdit","clientId","className","attributes","id","name","isOpen","select","getIsWidgetAreaOpen","setIsWidgetAreaOpen","wrapper","setOpen","openState","isDragging","useIsDragging","isDraggingWithin","openedWhileDragging","setOpenedWhileDragging","createElement","ref","title","opened","onToggle","scrollAfterOpen","visible","kind","type","elementRef","setIsDragging","ownerDocument","current","handleDragStart","handleDragEnd","addEventListener","removeEventListener"],"sources":["@wordpress/edit-widgets/src/blocks/widget-area/edit/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useEffect, useState, useCallback, useRef } from '@wordpress/element';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { EntityProvider } from '@wordpress/core-data';\nimport {\n\t__unstableDisclosureContent as DisclosureContent,\n\tPanel,\n\tPanelBody,\n} from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport WidgetAreaInnerBlocks from './inner-blocks';\nimport { store as editWidgetsStore } from '../../../store';\nimport useIsDraggingWithin from './use-is-dragging-within';\n\n/** @typedef {import('@wordpress/element').RefObject} RefObject */\n\nexport default function WidgetAreaEdit( {\n\tclientId,\n\tclassName,\n\tattributes: { id, name },\n} ) {\n\tconst isOpen = useSelect(\n\t\t( select ) =>\n\t\t\tselect( editWidgetsStore ).getIsWidgetAreaOpen( clientId ),\n\t\t[ clientId ]\n\t);\n\tconst { setIsWidgetAreaOpen } = useDispatch( editWidgetsStore );\n\n\tconst wrapper = useRef();\n\tconst setOpen = useCallback(\n\t\t( openState ) => setIsWidgetAreaOpen( clientId, openState ),\n\t\t[ clientId ]\n\t);\n\tconst isDragging = useIsDragging( wrapper );\n\tconst isDraggingWithin = useIsDraggingWithin( wrapper );\n\n\tconst [ openedWhileDragging, setOpenedWhileDragging ] = useState( false );\n\tuseEffect( () => {\n\t\tif ( ! isDragging ) {\n\t\t\tsetOpenedWhileDragging( false );\n\t\t\treturn;\n\t\t}\n\n\t\tif ( isDraggingWithin && ! isOpen ) {\n\t\t\tsetOpen( true );\n\t\t\tsetOpenedWhileDragging( true );\n\t\t} else if ( ! isDraggingWithin && isOpen && openedWhileDragging ) {\n\t\t\tsetOpen( false );\n\t\t}\n\t}, [ isOpen, isDragging, isDraggingWithin, openedWhileDragging ] );\n\n\treturn (\n\t\t<Panel className={ className } ref={ wrapper }>\n\t\t\t<PanelBody\n\t\t\t\ttitle={ name }\n\t\t\t\topened={ isOpen }\n\t\t\t\tonToggle={ () => {\n\t\t\t\t\tsetIsWidgetAreaOpen( clientId, ! isOpen );\n\t\t\t\t} }\n\t\t\t\tscrollAfterOpen={ ! isDragging }\n\t\t\t>\n\t\t\t\t{ ( { opened } ) => (\n\t\t\t\t\t// This is required to ensure LegacyWidget blocks are not\n\t\t\t\t\t// unmounted when the panel is collapsed. Unmounting legacy\n\t\t\t\t\t// widgets may have unintended consequences (e.g. TinyMCE\n\t\t\t\t\t// not being properly reinitialized)\n\t\t\t\t\t<DisclosureContent\n\t\t\t\t\t\tclassName=\"wp-block-widget-area__panel-body-content\"\n\t\t\t\t\t\tvisible={ opened }\n\t\t\t\t\t>\n\t\t\t\t\t\t<EntityProvider\n\t\t\t\t\t\t\tkind=\"root\"\n\t\t\t\t\t\t\ttype=\"postType\"\n\t\t\t\t\t\t\tid={ `widget-area-${ id }` }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<WidgetAreaInnerBlocks id={ id } />\n\t\t\t\t\t\t</EntityProvider>\n\t\t\t\t\t</DisclosureContent>\n\t\t\t\t) }\n\t\t\t</PanelBody>\n\t\t</Panel>\n\t);\n}\n\n/**\n * A React hook to determine if dragging is active.\n *\n * @param {RefObject<HTMLElement>} elementRef The target elementRef object.\n *\n * @return {boolean} Is dragging within the entire document.\n */\nconst useIsDragging = ( elementRef ) => {\n\tconst [ isDragging, setIsDragging ] = useState( false );\n\n\tuseEffect( () => {\n\t\tconst { ownerDocument } = elementRef.current;\n\n\t\tfunction handleDragStart() {\n\t\t\tsetIsDragging( true );\n\t\t}\n\n\t\tfunction handleDragEnd() {\n\t\t\tsetIsDragging( false );\n\t\t}\n\n\t\townerDocument.addEventListener( 'dragstart', handleDragStart );\n\t\townerDocument.addEventListener( 'dragend', handleDragEnd );\n\n\t\treturn () => {\n\t\t\townerDocument.removeEventListener( 'dragstart', handleDragStart );\n\t\t\townerDocument.removeEventListener( 'dragend', handleDragEnd );\n\t\t};\n\t}, [] );\n\n\treturn isDragging;\n};\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,SAAS,EAAEC,QAAQ,EAAEC,WAAW,EAAEC,MAAM,QAAQ,oBAAoB;AAC7E,SAASC,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;AACxD,SAASC,cAAc,QAAQ,sBAAsB;AACrD,SACCC,2BAA2B,IAAIC,iBAAiB,EAChDC,KAAK,EACLC,SAAS,QACH,uBAAuB;;AAE9B;AACA;AACA;AACA,OAAOC,qBAAqB,MAAM,gBAAgB;AAClD,SAASC,KAAK,IAAIC,gBAAgB,QAAQ,gBAAgB;AAC1D,OAAOC,mBAAmB,MAAM,0BAA0B;;AAE1D;;AAEA,eAAe,SAASC,cAAcA,CAAE;EACvCC,QAAQ;EACRC,SAAS;EACTC,UAAU,EAAE;IAAEC,EAAE;IAAEC;EAAK;AACxB,CAAC,EAAG;EACH,MAAMC,MAAM,GAAGjB,SAAS,CACrBkB,MAAM,IACPA,MAAM,CAAET,gBAAiB,CAAC,CAACU,mBAAmB,CAAEP,QAAS,CAAC,EAC3D,CAAEA,QAAQ,CACX,CAAC;EACD,MAAM;IAAEQ;EAAoB,CAAC,GAAGnB,WAAW,CAAEQ,gBAAiB,CAAC;EAE/D,MAAMY,OAAO,GAAGtB,MAAM,CAAC,CAAC;EACxB,MAAMuB,OAAO,GAAGxB,WAAW,CACxByB,SAAS,IAAMH,mBAAmB,CAAER,QAAQ,EAAEW,SAAU,CAAC,EAC3D,CAAEX,QAAQ,CACX,CAAC;EACD,MAAMY,UAAU,GAAGC,aAAa,CAAEJ,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AACA;AACA;AACA;AACA;AACA;AACA,MAAMU,aAAa,GAAKa,UAAU,IAAM;EACvC,MAAM,CAAEd,UAAU,EAAEe,aAAa,CAAE,GAAG1C,QAAQ,CAAE,KAAM,CAAC;EAEvDD,SAAS,CAAE,MAAM;IAChB,MAAM;MAAE4C;IAAc,CAAC,GAAGF,UAAU,CAACG,OAAO;IAE5C,SAASC,eAAeA,CAAA,EAAG;MAC1BH,aAAa,CAAE,IAAK,CAAC;IACtB;IAEA,SAASI,aAAaA,CAAA,EAAG;MACxBJ,aAAa,CAAE,KAAM,CAAC;IACvB;IAEAC,aAAa,CAACI,gBAAgB,CAAE,WAAW,EAAEF,eAAgB,CAAC;IAC9DF,aAAa,CAACI,gBAAgB,CAAE,SAAS,EAAED,aAAc,CAAC;IAE1D,OAAO,MAAM;MACZH,aAAa,CAACK,mBAAmB,CAAE,WAAW,EAAEH,eAAgB,CAAC;MACjEF,aAAa,CAACK,mBAAmB,CAAE,SAAS,EAAEF,aAAc,CAAC;IAC9D,CAAC;EACF,CAAC,EAAE,EAAG,CAAC;EAEP,OAAOnB,UAAU;AAClB,CAAC"}
|
|
@@ -1,20 +1,19 @@
|
|
|
1
1
|
import { createElement } from "@wordpress/element";
|
|
2
|
-
|
|
3
2
|
/**
|
|
4
3
|
* External dependencies
|
|
5
4
|
*/
|
|
6
5
|
import classnames from 'classnames';
|
|
6
|
+
|
|
7
7
|
/**
|
|
8
8
|
* WordPress dependencies
|
|
9
9
|
*/
|
|
10
|
-
|
|
11
10
|
import { useEntityBlockEditor } from '@wordpress/core-data';
|
|
12
11
|
import { InnerBlocks, useInnerBlocksProps } from '@wordpress/block-editor';
|
|
13
12
|
import { useRef } from '@wordpress/element';
|
|
13
|
+
|
|
14
14
|
/**
|
|
15
15
|
* Internal dependencies
|
|
16
16
|
*/
|
|
17
|
-
|
|
18
17
|
import useIsDraggingWithin from './use-is-dragging-within';
|
|
19
18
|
export default function WidgetAreaInnerBlocks({
|
|
20
19
|
id
|
|
@@ -22,8 +21,8 @@ export default function WidgetAreaInnerBlocks({
|
|
|
22
21
|
const [blocks, onInput, onChange] = useEntityBlockEditor('root', 'postType');
|
|
23
22
|
const innerBlocksRef = useRef();
|
|
24
23
|
const isDraggingWithinInnerBlocks = useIsDraggingWithin(innerBlocksRef);
|
|
25
|
-
const shouldHighlightDropZone = isDraggingWithinInnerBlocks;
|
|
26
|
-
|
|
24
|
+
const shouldHighlightDropZone = isDraggingWithinInnerBlocks;
|
|
25
|
+
// Using the experimental hook so that we can control the className of the element.
|
|
27
26
|
const innerBlocksProps = useInnerBlocksProps({
|
|
28
27
|
ref: innerBlocksRef
|
|
29
28
|
}, {
|
|
@@ -38,7 +37,8 @@ export default function WidgetAreaInnerBlocks({
|
|
|
38
37
|
className: classnames('wp-block-widget-area__inner-blocks block-editor-inner-blocks editor-styles-wrapper', {
|
|
39
38
|
'wp-block-widget-area__highlight-drop-zone': shouldHighlightDropZone
|
|
40
39
|
})
|
|
41
|
-
}, createElement("div", {
|
|
40
|
+
}, createElement("div", {
|
|
41
|
+
...innerBlocksProps
|
|
42
42
|
}));
|
|
43
43
|
}
|
|
44
44
|
//# sourceMappingURL=inner-blocks.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"names":["classnames","useEntityBlockEditor","InnerBlocks","useInnerBlocksProps","useRef","useIsDraggingWithin","WidgetAreaInnerBlocks","id","blocks","onInput","onChange","innerBlocksRef","isDraggingWithinInnerBlocks","shouldHighlightDropZone","innerBlocksProps","ref","value","templateLock","renderAppender","ButtonBlockAppender","createElement","className"],"sources":["@wordpress/edit-widgets/src/blocks/widget-area/edit/inner-blocks.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { useEntityBlockEditor } from '@wordpress/core-data';\nimport { InnerBlocks, useInnerBlocksProps } from '@wordpress/block-editor';\nimport { useRef } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport useIsDraggingWithin from './use-is-dragging-within';\n\nexport default function WidgetAreaInnerBlocks( { id } ) {\n\tconst [ blocks, onInput, onChange ] = useEntityBlockEditor(\n\t\t'root',\n\t\t'postType'\n\t);\n\tconst innerBlocksRef = useRef();\n\tconst isDraggingWithinInnerBlocks = useIsDraggingWithin( innerBlocksRef );\n\tconst shouldHighlightDropZone = isDraggingWithinInnerBlocks;\n\t// Using the experimental hook so that we can control the className of the element.\n\tconst innerBlocksProps = useInnerBlocksProps(\n\t\t{ ref: innerBlocksRef },\n\t\t{\n\t\t\tvalue: blocks,\n\t\t\tonInput,\n\t\t\tonChange,\n\t\t\ttemplateLock: false,\n\t\t\trenderAppender: InnerBlocks.ButtonBlockAppender,\n\t\t}\n\t);\n\n\treturn (\n\t\t<div\n\t\t\tdata-widget-area-id={ id }\n\t\t\tclassName={ classnames(\n\t\t\t\t'wp-block-widget-area__inner-blocks block-editor-inner-blocks editor-styles-wrapper',\n\t\t\t\t{\n\t\t\t\t\t'wp-block-widget-area__highlight-drop-zone':\n\t\t\t\t\t\tshouldHighlightDropZone,\n\t\t\t\t}\n\t\t\t) }\n\t\t>\n\t\t\t<div { ...innerBlocksProps } />\n\t\t</div>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,OAAOA,UAAU,MAAM,YAAY;;AAEnC;AACA;AACA;AACA,SAASC,oBAAoB,QAAQ,sBAAsB;AAC3D,SAASC,WAAW,EAAEC,mBAAmB,QAAQ,yBAAyB;AAC1E,SAASC,MAAM,QAAQ,oBAAoB;;AAE3C;AACA;AACA;AACA,OAAOC,mBAAmB,MAAM,0BAA0B;AAE1D,eAAe,SAASC,qBAAqBA,CAAE;EAAEC;AAAG,CAAC,EAAG;EACvD,MAAM,CAAEC,MAAM,EAAEC,OAAO,EAAEC,QAAQ,CAAE,GAAGT,oBAAoB,CACzD,MAAM,EACN,UACD,CAAC;EACD,MAAMU,cAAc,GAAGP,MAAM,CAAC,CAAC;EAC/B,MAAMQ,2BAA2B,GAAGP,mBAAmB,CAAEM,cAAe,CAAC;EACzE,MAAME,uBAAuB,GAAGD,2BAA2B;EAC3D;EACA,MAAME,gBAAgB,GAAGX,mBAAmB,CAC3C;IAAEY,GAAG,EAAEJ;EAAe,CAAC,EACvB;IACCK,KAAK,EAAER,MAAM;IACbC,OAAO;IACPC,QAAQ;IACRO,YAAY,EAAE,KAAK;IACnBC,cAAc,EAAEhB,WAAW,CAACiB;EAC7B,CACD,CAAC;EAED,OACCC,aAAA;IACC,uBAAsBb,EAAI;IAC1Bc,SAAS,EAAGrB,UAAU,CACrB,oFAAoF,EACpF;MACC,2CAA2C,EAC1Ca;IACF,CACD;EAAG,GAEHO,aAAA;IAAA,GAAUN;EAAgB,CAAI,CAC1B,CAAC;AAER"}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
4
|
import { useState, useEffect } from '@wordpress/element';
|
|
5
|
+
|
|
5
6
|
/** @typedef {import('@wordpress/element').RefObject} RefObject */
|
|
6
7
|
|
|
7
8
|
/**
|
|
@@ -11,24 +12,21 @@ import { useState, useEffect } from '@wordpress/element';
|
|
|
11
12
|
*
|
|
12
13
|
* @return {boolean} Is dragging within the target element.
|
|
13
14
|
*/
|
|
14
|
-
|
|
15
15
|
const useIsDraggingWithin = elementRef => {
|
|
16
16
|
const [isDraggingWithin, setIsDraggingWithin] = useState(false);
|
|
17
17
|
useEffect(() => {
|
|
18
18
|
const {
|
|
19
19
|
ownerDocument
|
|
20
20
|
} = elementRef.current;
|
|
21
|
-
|
|
22
21
|
function handleDragStart(event) {
|
|
23
22
|
// Check the first time when the dragging starts.
|
|
24
23
|
handleDragEnter(event);
|
|
25
|
-
}
|
|
26
|
-
|
|
24
|
+
}
|
|
27
25
|
|
|
26
|
+
// Set to false whenever the user cancel the drag event by either releasing the mouse or press Escape.
|
|
28
27
|
function handleDragEnd() {
|
|
29
28
|
setIsDraggingWithin(false);
|
|
30
29
|
}
|
|
31
|
-
|
|
32
30
|
function handleDragEnter(event) {
|
|
33
31
|
// Check if the current target is inside the item element.
|
|
34
32
|
if (elementRef.current.contains(event.target)) {
|
|
@@ -36,10 +34,10 @@ const useIsDraggingWithin = elementRef => {
|
|
|
36
34
|
} else {
|
|
37
35
|
setIsDraggingWithin(false);
|
|
38
36
|
}
|
|
39
|
-
}
|
|
40
|
-
// Ideally, we can also use `event.relatedTarget`, but sadly that doesn't work in Safari.
|
|
41
|
-
|
|
37
|
+
}
|
|
42
38
|
|
|
39
|
+
// Bind these events to the document to catch all drag events.
|
|
40
|
+
// Ideally, we can also use `event.relatedTarget`, but sadly that doesn't work in Safari.
|
|
43
41
|
ownerDocument.addEventListener('dragstart', handleDragStart);
|
|
44
42
|
ownerDocument.addEventListener('dragend', handleDragEnd);
|
|
45
43
|
ownerDocument.addEventListener('dragenter', handleDragEnter);
|
|
@@ -51,6 +49,5 @@ const useIsDraggingWithin = elementRef => {
|
|
|
51
49
|
}, []);
|
|
52
50
|
return isDraggingWithin;
|
|
53
51
|
};
|
|
54
|
-
|
|
55
52
|
export default useIsDraggingWithin;
|
|
56
53
|
//# sourceMappingURL=use-is-dragging-within.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"names":["useState","useEffect","useIsDraggingWithin","elementRef","isDraggingWithin","setIsDraggingWithin","ownerDocument","current","handleDragStart","event","handleDragEnter","handleDragEnd","contains","target","addEventListener","removeEventListener"],"sources":["@wordpress/edit-widgets/src/blocks/widget-area/edit/use-is-dragging-within.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useState, useEffect } from '@wordpress/element';\n\n/** @typedef {import('@wordpress/element').RefObject} RefObject */\n\n/**\n * A React hook to determine if it's dragging within the target element.\n *\n * @param {RefObject<HTMLElement>} elementRef The target elementRef object.\n *\n * @return {boolean} Is dragging within the target element.\n */\nconst useIsDraggingWithin = ( elementRef ) => {\n\tconst [ isDraggingWithin, setIsDraggingWithin ] = useState( false );\n\n\tuseEffect( () => {\n\t\tconst { ownerDocument } = elementRef.current;\n\n\t\tfunction handleDragStart( event ) {\n\t\t\t// Check the first time when the dragging starts.\n\t\t\thandleDragEnter( event );\n\t\t}\n\n\t\t// Set to false whenever the user cancel the drag event by either releasing the mouse or press Escape.\n\t\tfunction handleDragEnd() {\n\t\t\tsetIsDraggingWithin( false );\n\t\t}\n\n\t\tfunction handleDragEnter( event ) {\n\t\t\t// Check if the current target is inside the item element.\n\t\t\tif ( elementRef.current.contains( event.target ) ) {\n\t\t\t\tsetIsDraggingWithin( true );\n\t\t\t} else {\n\t\t\t\tsetIsDraggingWithin( false );\n\t\t\t}\n\t\t}\n\n\t\t// Bind these events to the document to catch all drag events.\n\t\t// Ideally, we can also use `event.relatedTarget`, but sadly that doesn't work in Safari.\n\t\townerDocument.addEventListener( 'dragstart', handleDragStart );\n\t\townerDocument.addEventListener( 'dragend', handleDragEnd );\n\t\townerDocument.addEventListener( 'dragenter', handleDragEnter );\n\n\t\treturn () => {\n\t\t\townerDocument.removeEventListener( 'dragstart', handleDragStart );\n\t\t\townerDocument.removeEventListener( 'dragend', handleDragEnd );\n\t\t\townerDocument.removeEventListener( 'dragenter', handleDragEnter );\n\t\t};\n\t}, [] );\n\n\treturn isDraggingWithin;\n};\n\nexport default useIsDraggingWithin;\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,QAAQ,EAAEC,SAAS,QAAQ,oBAAoB;;AAExD;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMC,mBAAmB,GAAKC,UAAU,IAAM;EAC7C,MAAM,CAAEC,gBAAgB,EAAEC,mBAAmB,CAAE,GAAGL,QAAQ,CAAE,KAAM,CAAC;EAEnEC,SAAS,CAAE,MAAM;IAChB,MAAM;MAAEK;IAAc,CAAC,GAAGH,UAAU,CAACI,OAAO;IAE5C,SAASC,eAAeA,CAAEC,KAAK,EAAG;MACjC;MACAC,eAAe,CAAED,KAAM,CAAC;IACzB;;IAEA;IACA,SAASE,aAAaA,CAAA,EAAG;MACxBN,mBAAmB,CAAE,KAAM,CAAC;IAC7B;IAEA,SAASK,eAAeA,CAAED,KAAK,EAAG;MACjC;MACA,IAAKN,UAAU,CAACI,OAAO,CAACK,QAAQ,CAAEH,KAAK,CAACI,MAAO,CAAC,EAAG;QAClDR,mBAAmB,CAAE,IAAK,CAAC;MAC5B,CAAC,MAAM;QACNA,mBAAmB,CAAE,KAAM,CAAC;MAC7B;IACD;;IAEA;IACA;IACAC,aAAa,CAACQ,gBAAgB,CAAE,WAAW,EAAEN,eAAgB,CAAC;IAC9DF,aAAa,CAACQ,gBAAgB,CAAE,SAAS,EAAEH,aAAc,CAAC;IAC1DL,aAAa,CAACQ,gBAAgB,CAAE,WAAW,EAAEJ,eAAgB,CAAC;IAE9D,OAAO,MAAM;MACZJ,aAAa,CAACS,mBAAmB,CAAE,WAAW,EAAEP,eAAgB,CAAC;MACjEF,aAAa,CAACS,mBAAmB,CAAE,SAAS,EAAEJ,aAAc,CAAC;MAC7DL,aAAa,CAACS,mBAAmB,CAAE,WAAW,EAAEL,eAAgB,CAAC;IAClE,CAAC;EACF,CAAC,EAAE,EAAG,CAAC;EAEP,OAAON,gBAAgB;AACxB,CAAC;AAED,eAAeF,mBAAmB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"names":["__","metadata","name","category","attributes","id","type","supports","html","inserter","customClassName","reusable","__experimentalToolbar","__experimentalParentSelector","__experimentalDisableBlockOverlay","editorStyle","style","edit","settings","title","description","__experimentalLabel","label"],"sources":["@wordpress/edit-widgets/src/blocks/widget-area/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport metadata from './block.json';\nimport edit from './edit';\n\nconst { name } = metadata;\nexport { metadata, name };\n\nexport const settings = {\n\ttitle: __( 'Widget Area' ),\n\tdescription: __( 'A widget area container.' ),\n\t__experimentalLabel: ( { name: label } ) => label,\n\tedit,\n};\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,EAAE,QAAQ,iBAAiB;;AAEpC;AACA;AACA;AAFA,MAAAC,QAAA;EAAAC,IAAA;EAAAC,QAAA;EAAAC,UAAA;IAAAC,EAAA;MAAAC,IAAA;IAAA;IAAAJ,IAAA;MAAAI,IAAA;IAAA;EAAA;EAAAC,QAAA;IAAAC,IAAA;IAAAC,QAAA;IAAAC,eAAA;IAAAC,QAAA;IAAAC,qBAAA;IAAAC,4BAAA;IAAAC,iCAAA;EAAA;EAAAC,WAAA;EAAAC,KAAA;AAAA;AAIA,OAAOC,IAAI,MAAM,QAAQ;AAEzB,MAAM;EAAEf;AAAK,CAAC,GAAGD,QAAQ;AACzB,SAASA,QAAQ,EAAEC,IAAI;AAEvB,OAAO,MAAMgB,QAAQ,GAAG;EACvBC,KAAK,EAAEnB,EAAE,CAAE,aAAc,CAAC;EAC1BoB,WAAW,EAAEpB,EAAE,CAAE,0BAA2B,CAAC;EAC7CqB,mBAAmB,EAAEA,CAAE;IAAEnB,IAAI,EAAEoB;EAAM,CAAC,KAAMA,KAAK;EACjDL;AACD,CAAC"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { createElement } from "@wordpress/element";
|
|
2
|
-
|
|
3
2
|
/**
|
|
4
3
|
* WordPress dependencies
|
|
5
4
|
*/
|
|
@@ -9,7 +8,6 @@ import { Button } from '@wordpress/components';
|
|
|
9
8
|
import { Warning } from '@wordpress/block-editor';
|
|
10
9
|
import { useCopyToClipboard } from '@wordpress/compose';
|
|
11
10
|
import { doAction } from '@wordpress/hooks';
|
|
12
|
-
|
|
13
11
|
function CopyButton({
|
|
14
12
|
text,
|
|
15
13
|
children
|
|
@@ -20,7 +18,6 @@ function CopyButton({
|
|
|
20
18
|
ref: ref
|
|
21
19
|
}, children);
|
|
22
20
|
}
|
|
23
|
-
|
|
24
21
|
function ErrorBoundaryWarning({
|
|
25
22
|
message,
|
|
26
23
|
error
|
|
@@ -34,7 +31,6 @@ function ErrorBoundaryWarning({
|
|
|
34
31
|
actions: actions
|
|
35
32
|
}, message);
|
|
36
33
|
}
|
|
37
|
-
|
|
38
34
|
export default class ErrorBoundary extends Component {
|
|
39
35
|
constructor() {
|
|
40
36
|
super(...arguments);
|
|
@@ -42,27 +38,22 @@ export default class ErrorBoundary extends Component {
|
|
|
42
38
|
error: null
|
|
43
39
|
};
|
|
44
40
|
}
|
|
45
|
-
|
|
46
41
|
componentDidCatch(error) {
|
|
47
42
|
doAction('editor.ErrorBoundary.errorLogged', error);
|
|
48
43
|
}
|
|
49
|
-
|
|
50
44
|
static getDerivedStateFromError(error) {
|
|
51
45
|
return {
|
|
52
46
|
error
|
|
53
47
|
};
|
|
54
48
|
}
|
|
55
|
-
|
|
56
49
|
render() {
|
|
57
50
|
if (!this.state.error) {
|
|
58
51
|
return this.props.children;
|
|
59
52
|
}
|
|
60
|
-
|
|
61
53
|
return createElement(ErrorBoundaryWarning, {
|
|
62
54
|
message: __('The editor has encountered an unexpected error.'),
|
|
63
55
|
error: this.state.error
|
|
64
56
|
});
|
|
65
57
|
}
|
|
66
|
-
|
|
67
58
|
}
|
|
68
59
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"names":["Component","__","Button","Warning","useCopyToClipboard","doAction","CopyButton","text","children","ref","createElement","variant","ErrorBoundaryWarning","message","error","actions","key","stack","className","ErrorBoundary","constructor","arguments","state","componentDidCatch","getDerivedStateFromError","render","props"],"sources":["@wordpress/edit-widgets/src/components/error-boundary/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { Component } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport { Button } from '@wordpress/components';\nimport { Warning } from '@wordpress/block-editor';\nimport { useCopyToClipboard } from '@wordpress/compose';\nimport { doAction } from '@wordpress/hooks';\n\nfunction CopyButton( { text, children } ) {\n\tconst ref = useCopyToClipboard( text );\n\treturn (\n\t\t<Button variant=\"secondary\" ref={ ref }>\n\t\t\t{ children }\n\t\t</Button>\n\t);\n}\n\nfunction ErrorBoundaryWarning( { message, error } ) {\n\tconst actions = [\n\t\t<CopyButton key=\"copy-error\" text={ error.stack }>\n\t\t\t{ __( 'Copy Error' ) }\n\t\t</CopyButton>,\n\t];\n\n\treturn (\n\t\t<Warning className=\"edit-widgets-error-boundary\" actions={ actions }>\n\t\t\t{ message }\n\t\t</Warning>\n\t);\n}\n\nexport default class ErrorBoundary extends Component {\n\tconstructor() {\n\t\tsuper( ...arguments );\n\n\t\tthis.state = {\n\t\t\terror: null,\n\t\t};\n\t}\n\n\tcomponentDidCatch( error ) {\n\t\tdoAction( 'editor.ErrorBoundary.errorLogged', error );\n\t}\n\n\tstatic getDerivedStateFromError( error ) {\n\t\treturn { error };\n\t}\n\n\trender() {\n\t\tif ( ! this.state.error ) {\n\t\t\treturn this.props.children;\n\t\t}\n\n\t\treturn (\n\t\t\t<ErrorBoundaryWarning\n\t\t\t\tmessage={ __(\n\t\t\t\t\t'The editor has encountered an unexpected error.'\n\t\t\t\t) }\n\t\t\t\terror={ this.state.error }\n\t\t\t/>\n\t\t);\n\t}\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,SAAS,QAAQ,oBAAoB;AAC9C,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SAASC,MAAM,QAAQ,uBAAuB;AAC9C,SAASC,OAAO,QAAQ,yBAAyB;AACjD,SAASC,kBAAkB,QAAQ,oBAAoB;AACvD,SAASC,QAAQ,QAAQ,kBAAkB;AAE3C,SAASC,UAAUA,CAAE;EAAEC,IAAI;EAAEC;AAAS,CAAC,EAAG;EACzC,MAAMC,GAAG,GAAGL,kBAAkB,CAAEG,IAAK,CAAC;EACtC,OACCG,aAAA,CAACR,MAAM;IAACS,OAAO,EAAC,WAAW;IAACF,GAAG,EAAGA;EAAK,GACpCD,QACK,CAAC;AAEX;AAEA,SAASI,oBAAoBA,CAAE;EAAEC,OAAO;EAAEC;AAAM,CAAC,EAAG;EACnD,MAAMC,OAAO,GAAG,CACfL,aAAA,CAACJ,UAAU;IAACU,GAAG,EAAC,YAAY;IAACT,IAAI,EAAGO,KAAK,CAACG;EAAO,GAC9ChB,EAAE,CAAE,YAAa,CACR,CAAC,CACb;EAED,OACCS,aAAA,CAACP,OAAO;IAACe,SAAS,EAAC,6BAA6B;IAACH,OAAO,EAAGA;EAAS,GACjEF,OACM,CAAC;AAEZ;AAEA,eAAe,MAAMM,aAAa,SAASnB,SAAS,CAAC;EACpDoB,WAAWA,CAAA,EAAG;IACb,KAAK,CAAE,GAAGC,SAAU,CAAC;IAErB,IAAI,CAACC,KAAK,GAAG;MACZR,KAAK,EAAE;IACR,CAAC;EACF;EAEAS,iBAAiBA,CAAET,KAAK,EAAG;IAC1BT,QAAQ,CAAE,kCAAkC,EAAES,KAAM,CAAC;EACtD;EAEA,OAAOU,wBAAwBA,CAAEV,KAAK,EAAG;IACxC,OAAO;MAAEA;IAAM,CAAC;EACjB;EAEAW,MAAMA,CAAA,EAAG;IACR,IAAK,CAAE,IAAI,CAACH,KAAK,CAACR,KAAK,EAAG;MACzB,OAAO,IAAI,CAACY,KAAK,CAAClB,QAAQ;IAC3B;IAEA,OACCE,aAAA,CAACE,oBAAoB;MACpBC,OAAO,EAAGZ,EAAE,CACX,iDACD,CAAG;MACHa,KAAK,EAAG,IAAI,CAACQ,KAAK,CAACR;IAAO,CAC1B,CAAC;EAEJ;AACD"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { createElement, Fragment } from "@wordpress/element";
|
|
2
|
-
|
|
3
2
|
/**
|
|
4
3
|
* WordPress dependencies
|
|
5
4
|
*/
|
|
@@ -11,10 +10,10 @@ import { PinnedItems } from '@wordpress/interface';
|
|
|
11
10
|
import { listView, plus } from '@wordpress/icons';
|
|
12
11
|
import { useCallback, useRef } from '@wordpress/element';
|
|
13
12
|
import { useViewportMatch } from '@wordpress/compose';
|
|
13
|
+
|
|
14
14
|
/**
|
|
15
15
|
* Internal dependencies
|
|
16
16
|
*/
|
|
17
|
-
|
|
18
17
|
import SaveButton from '../save-button';
|
|
19
18
|
import UndoButton from './undo-redo/undo';
|
|
20
19
|
import RedoButton from './undo-redo/redo';
|
|
@@ -25,7 +24,6 @@ import { unlock } from '../../lock-unlock';
|
|
|
25
24
|
const {
|
|
26
25
|
useShouldContextualToolbarShow
|
|
27
26
|
} = unlock(blockEditorPrivateApis);
|
|
28
|
-
|
|
29
27
|
function Header() {
|
|
30
28
|
const isMediumViewport = useViewportMatch('medium');
|
|
31
29
|
const inserterButton = useRef();
|
|
@@ -52,7 +50,6 @@ function Header() {
|
|
|
52
50
|
const {
|
|
53
51
|
selectBlock
|
|
54
52
|
} = useDispatch(blockEditorStore);
|
|
55
|
-
|
|
56
53
|
const handleClick = () => {
|
|
57
54
|
if (isInserterOpen) {
|
|
58
55
|
// Focusing the inserter button closes the inserter popover.
|
|
@@ -60,28 +57,26 @@ function Header() {
|
|
|
60
57
|
} else {
|
|
61
58
|
if (!isLastSelectedWidgetAreaOpen) {
|
|
62
59
|
// Select the last selected block if hasn't already.
|
|
63
|
-
selectBlock(widgetAreaClientId);
|
|
64
|
-
|
|
60
|
+
selectBlock(widgetAreaClientId);
|
|
61
|
+
// Open the last selected widget area when opening the inserter.
|
|
65
62
|
setIsWidgetAreaOpen(widgetAreaClientId, true);
|
|
66
|
-
}
|
|
63
|
+
}
|
|
64
|
+
// The DOM updates resulting from selectBlock() and setIsInserterOpened() calls are applied the
|
|
67
65
|
// same tick and pretty much in a random order. The inserter is closed if any other part of the
|
|
68
66
|
// app receives focus. If selectBlock() happens to take effect after setIsInserterOpened() then
|
|
69
67
|
// the inserter is visible for a brief moment and then gets auto-closed due to focus moving to
|
|
70
68
|
// the selected block.
|
|
71
|
-
|
|
72
|
-
|
|
73
69
|
window.requestAnimationFrame(() => setIsInserterOpened(true));
|
|
74
70
|
}
|
|
75
71
|
};
|
|
76
|
-
|
|
77
72
|
const toggleListView = useCallback(() => setIsListViewOpened(!isListViewOpen), [setIsListViewOpened, isListViewOpen]);
|
|
78
73
|
const {
|
|
79
74
|
shouldShowContextualToolbar,
|
|
80
75
|
canFocusHiddenToolbar,
|
|
81
76
|
fixedToolbarCanBeFocused
|
|
82
|
-
} = useShouldContextualToolbarShow();
|
|
77
|
+
} = useShouldContextualToolbarShow();
|
|
78
|
+
// If there's a block toolbar to be focused, disable the focus shortcut for the document toolbar.
|
|
83
79
|
// There's a fixed block toolbar when the fixed toolbar option is enabled or when the browser width is less than the large viewport.
|
|
84
|
-
|
|
85
80
|
const blockToolbarCanBeFocused = shouldShowContextualToolbar || canFocusHiddenToolbar || fixedToolbarCanBeFocused;
|
|
86
81
|
return createElement(Fragment, null, createElement("div", {
|
|
87
82
|
className: "edit-widgets-header"
|
|
@@ -108,16 +103,14 @@ function Header() {
|
|
|
108
103
|
onClick: handleClick,
|
|
109
104
|
icon: plus
|
|
110
105
|
/* translators: button label text should, if possible, be under 16
|
|
111
|
-
characters.
|
|
112
|
-
,
|
|
106
|
+
characters. */,
|
|
113
107
|
label: _x('Toggle block inserter', 'Generic label for block inserter button')
|
|
114
108
|
}), isMediumViewport && createElement(Fragment, null, createElement(UndoButton, null), createElement(RedoButton, null), createElement(ToolbarItem, {
|
|
115
109
|
as: Button,
|
|
116
110
|
className: "edit-widgets-header-toolbar__list-view-toggle",
|
|
117
111
|
icon: listView,
|
|
118
112
|
isPressed: isListViewOpen
|
|
119
|
-
/* translators: button label text should, if possible, be under 16 characters.
|
|
120
|
-
,
|
|
113
|
+
/* translators: button label text should, if possible, be under 16 characters. */,
|
|
121
114
|
label: __('List View'),
|
|
122
115
|
onClick: toggleListView
|
|
123
116
|
})))), createElement("div", {
|
|
@@ -126,6 +119,5 @@ function Header() {
|
|
|
126
119
|
scope: "core/edit-widgets"
|
|
127
120
|
}), createElement(MoreMenu, null))));
|
|
128
121
|
}
|
|
129
|
-
|
|
130
122
|
export default Header;
|
|
131
123
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-widgets/src/components/header/index.js"],"names":["useSelect","useDispatch","__","_x","Button","ToolbarItem","VisuallyHidden","NavigableToolbar","store","blockEditorStore","privateApis","blockEditorPrivateApis","PinnedItems","listView","plus","useCallback","useRef","useViewportMatch","SaveButton","UndoButton","RedoButton","MoreMenu","useLastSelectedWidgetArea","editWidgetsStore","unlock","useShouldContextualToolbarShow","Header","isMediumViewport","inserterButton","widgetAreaClientId","isLastSelectedWidgetAreaOpen","select","getIsWidgetAreaOpen","isInserterOpen","isListViewOpen","isInserterOpened","isListViewOpened","setIsWidgetAreaOpen","setIsInserterOpened","setIsListViewOpened","selectBlock","handleClick","window","requestAnimationFrame","toggleListView","shouldShowContextualToolbar","canFocusHiddenToolbar","fixedToolbarCanBeFocused","blockToolbarCanBeFocused","event","preventDefault"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,SAAT,EAAoBC,WAApB,QAAuC,iBAAvC;AACA,SAASC,EAAT,EAAaC,EAAb,QAAuB,iBAAvB;AACA,SAASC,MAAT,EAAiBC,WAAjB,EAA8BC,cAA9B,QAAoD,uBAApD;AACA,SACCC,gBADD,EAECC,KAAK,IAAIC,gBAFV,EAGCC,WAAW,IAAIC,sBAHhB,QAIO,yBAJP;AAKA,SAASC,WAAT,QAA4B,sBAA5B;AACA,SAASC,QAAT,EAAmBC,IAAnB,QAA+B,kBAA/B;AACA,SAASC,WAAT,EAAsBC,MAAtB,QAAoC,oBAApC;AACA,SAASC,gBAAT,QAAiC,oBAAjC;AAEA;AACA;AACA;;AACA,OAAOC,UAAP,MAAuB,gBAAvB;AACA,OAAOC,UAAP,MAAuB,kBAAvB;AACA,OAAOC,UAAP,MAAuB,kBAAvB;AACA,OAAOC,QAAP,MAAqB,cAArB;AACA,OAAOC,yBAAP,MAAsC,2CAAtC;AACA,SAASd,KAAK,IAAIe,gBAAlB,QAA0C,aAA1C;AACA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IAPD,EAyBGwB,gBAAgB,IACjB,8BACC,cAAC,UAAD,OADD,EAEC,cAAC,UAAD,OAFD,EAGC,cAAC,WAAD;AACC,IAAA,EAAE,EAAGvB,MADN;AAEC,IAAA,SAAS,EAAC,+CAFX;AAGC,IAAA,IAAI,EAAGS,QAHR;AAIC,IAAA,SAAS,EAAGqB;AACZ;AALD;AAMC,IAAA,KAAK,EAAGhC,EAAE,CAAE,WAAF,CANX;AAOC,IAAA,OAAO,EAAG0C;AAPX,IAHD,CA1BF,CAdD,CADD,EAyDC;AAAK,IAAA,SAAS,EAAC;AAAf,KACC,cAAC,UAAD,OADD,EAEC,cAAC,WAAD,CAAa,IAAb;AAAkB,IAAA,KAAK,EAAC;AAAxB,IAFD,EAGC,cAAC,QAAD,OAHD,CAzDD,CADD,CADD;AAmEA;;AAED,eAAelB,MAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { __, _x } from '@wordpress/i18n';\nimport { Button, ToolbarItem, VisuallyHidden } from '@wordpress/components';\nimport {\n\tNavigableToolbar,\n\tstore as blockEditorStore,\n\tprivateApis as blockEditorPrivateApis,\n} from '@wordpress/block-editor';\nimport { PinnedItems } from '@wordpress/interface';\nimport { listView, plus } from '@wordpress/icons';\nimport { useCallback, useRef } from '@wordpress/element';\nimport { useViewportMatch } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport SaveButton from '../save-button';\nimport UndoButton from './undo-redo/undo';\nimport RedoButton from './undo-redo/redo';\nimport MoreMenu from '../more-menu';\nimport useLastSelectedWidgetArea from '../../hooks/use-last-selected-widget-area';\nimport { store as editWidgetsStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\n\nconst { useShouldContextualToolbarShow } = unlock( blockEditorPrivateApis );\n\nfunction Header() {\n\tconst isMediumViewport = useViewportMatch( 'medium' );\n\tconst inserterButton = useRef();\n\tconst widgetAreaClientId = useLastSelectedWidgetArea();\n\tconst isLastSelectedWidgetAreaOpen = useSelect(\n\t\t( select ) =>\n\t\t\tselect( editWidgetsStore ).getIsWidgetAreaOpen(\n\t\t\t\twidgetAreaClientId\n\t\t\t),\n\t\t[ widgetAreaClientId ]\n\t);\n\tconst { isInserterOpen, isListViewOpen } = useSelect( ( select ) => {\n\t\tconst { isInserterOpened, isListViewOpened } =\n\t\t\tselect( editWidgetsStore );\n\t\treturn {\n\t\t\tisInserterOpen: isInserterOpened(),\n\t\t\tisListViewOpen: isListViewOpened(),\n\t\t};\n\t}, [] );\n\tconst { setIsWidgetAreaOpen, setIsInserterOpened, setIsListViewOpened } =\n\t\tuseDispatch( editWidgetsStore );\n\tconst { selectBlock } = useDispatch( blockEditorStore );\n\tconst handleClick = () => {\n\t\tif ( isInserterOpen ) {\n\t\t\t// Focusing the inserter button closes the inserter popover.\n\t\t\tsetIsInserterOpened( false );\n\t\t} else {\n\t\t\tif ( ! isLastSelectedWidgetAreaOpen ) {\n\t\t\t\t// Select the last selected block if hasn't already.\n\t\t\t\tselectBlock( widgetAreaClientId );\n\t\t\t\t// Open the last selected widget area when opening the inserter.\n\t\t\t\tsetIsWidgetAreaOpen( widgetAreaClientId, true );\n\t\t\t}\n\t\t\t// The DOM updates resulting from selectBlock() and setIsInserterOpened() calls are applied the\n\t\t\t// same tick and pretty much in a random order. The inserter is closed if any other part of the\n\t\t\t// app receives focus. If selectBlock() happens to take effect after setIsInserterOpened() then\n\t\t\t// the inserter is visible for a brief moment and then gets auto-closed due to focus moving to\n\t\t\t// the selected block.\n\t\t\twindow.requestAnimationFrame( () => setIsInserterOpened( true ) );\n\t\t}\n\t};\n\n\tconst toggleListView = useCallback(\n\t\t() => setIsListViewOpened( ! isListViewOpen ),\n\t\t[ setIsListViewOpened, isListViewOpen ]\n\t);\n\n\tconst {\n\t\tshouldShowContextualToolbar,\n\t\tcanFocusHiddenToolbar,\n\t\tfixedToolbarCanBeFocused,\n\t} = useShouldContextualToolbarShow();\n\t// If there's a block toolbar to be focused, disable the focus shortcut for the document toolbar.\n\t// There's a fixed block toolbar when the fixed toolbar option is enabled or when the browser width is less than the large viewport.\n\tconst blockToolbarCanBeFocused =\n\t\tshouldShowContextualToolbar ||\n\t\tcanFocusHiddenToolbar ||\n\t\tfixedToolbarCanBeFocused;\n\n\treturn (\n\t\t<>\n\t\t\t<div className=\"edit-widgets-header\">\n\t\t\t\t<div className=\"edit-widgets-header__navigable-toolbar-wrapper\">\n\t\t\t\t\t{ isMediumViewport && (\n\t\t\t\t\t\t<h1 className=\"edit-widgets-header__title\">\n\t\t\t\t\t\t\t{ __( 'Widgets' ) }\n\t\t\t\t\t\t</h1>\n\t\t\t\t\t) }\n\t\t\t\t\t{ ! isMediumViewport && (\n\t\t\t\t\t\t<VisuallyHidden\n\t\t\t\t\t\t\tas=\"h1\"\n\t\t\t\t\t\t\tclassName=\"edit-widgets-header__title\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Widgets' ) }\n\t\t\t\t\t\t</VisuallyHidden>\n\t\t\t\t\t) }\n\t\t\t\t\t<NavigableToolbar\n\t\t\t\t\t\tclassName=\"edit-widgets-header-toolbar\"\n\t\t\t\t\t\taria-label={ __( 'Document tools' ) }\n\t\t\t\t\t\tshouldUseKeyboardFocusShortcut={\n\t\t\t\t\t\t\t! blockToolbarCanBeFocused\n\t\t\t\t\t\t}\n\t\t\t\t\t>\n\t\t\t\t\t\t<ToolbarItem\n\t\t\t\t\t\t\tref={ inserterButton }\n\t\t\t\t\t\t\tas={ Button }\n\t\t\t\t\t\t\tclassName=\"edit-widgets-header-toolbar__inserter-toggle\"\n\t\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\t\tisPressed={ isInserterOpen }\n\t\t\t\t\t\t\tonMouseDown={ ( event ) => {\n\t\t\t\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tonClick={ handleClick }\n\t\t\t\t\t\t\ticon={ plus }\n\t\t\t\t\t\t\t/* translators: button label text should, if possible, be under 16\n\t\t\t\t\tcharacters. */\n\t\t\t\t\t\t\tlabel={ _x(\n\t\t\t\t\t\t\t\t'Toggle block inserter',\n\t\t\t\t\t\t\t\t'Generic label for block inserter button'\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t{ isMediumViewport && (\n\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t<UndoButton />\n\t\t\t\t\t\t\t\t<RedoButton />\n\t\t\t\t\t\t\t\t<ToolbarItem\n\t\t\t\t\t\t\t\t\tas={ Button }\n\t\t\t\t\t\t\t\t\tclassName=\"edit-widgets-header-toolbar__list-view-toggle\"\n\t\t\t\t\t\t\t\t\ticon={ listView }\n\t\t\t\t\t\t\t\t\tisPressed={ isListViewOpen }\n\t\t\t\t\t\t\t\t\t/* translators: button label text should, if possible, be under 16 characters. */\n\t\t\t\t\t\t\t\t\tlabel={ __( 'List View' ) }\n\t\t\t\t\t\t\t\t\tonClick={ toggleListView }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t) }\n\t\t\t\t\t</NavigableToolbar>\n\t\t\t\t</div>\n\t\t\t\t<div className=\"edit-widgets-header__actions\">\n\t\t\t\t\t<SaveButton />\n\t\t\t\t\t<PinnedItems.Slot scope=\"core/edit-widgets\" />\n\t\t\t\t\t<MoreMenu />\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t</>\n\t);\n}\n\nexport default Header;\n"]}
|
|
1
|
+
{"version":3,"names":["useSelect","useDispatch","__","_x","Button","ToolbarItem","VisuallyHidden","NavigableToolbar","store","blockEditorStore","privateApis","blockEditorPrivateApis","PinnedItems","listView","plus","useCallback","useRef","useViewportMatch","SaveButton","UndoButton","RedoButton","MoreMenu","useLastSelectedWidgetArea","editWidgetsStore","unlock","useShouldContextualToolbarShow","Header","isMediumViewport","inserterButton","widgetAreaClientId","isLastSelectedWidgetAreaOpen","select","getIsWidgetAreaOpen","isInserterOpen","isListViewOpen","isInserterOpened","isListViewOpened","setIsWidgetAreaOpen","setIsInserterOpened","setIsListViewOpened","selectBlock","handleClick","window","requestAnimationFrame","toggleListView","shouldShowContextualToolbar","canFocusHiddenToolbar","fixedToolbarCanBeFocused","blockToolbarCanBeFocused","createElement","Fragment","className","as","shouldUseKeyboardFocusShortcut","ref","variant","isPressed","onMouseDown","event","preventDefault","onClick","icon","label","Slot","scope"],"sources":["@wordpress/edit-widgets/src/components/header/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { __, _x } from '@wordpress/i18n';\nimport { Button, ToolbarItem, VisuallyHidden } from '@wordpress/components';\nimport {\n\tNavigableToolbar,\n\tstore as blockEditorStore,\n\tprivateApis as blockEditorPrivateApis,\n} from '@wordpress/block-editor';\nimport { PinnedItems } from '@wordpress/interface';\nimport { listView, plus } from '@wordpress/icons';\nimport { useCallback, useRef } from '@wordpress/element';\nimport { useViewportMatch } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport SaveButton from '../save-button';\nimport UndoButton from './undo-redo/undo';\nimport RedoButton from './undo-redo/redo';\nimport MoreMenu from '../more-menu';\nimport useLastSelectedWidgetArea from '../../hooks/use-last-selected-widget-area';\nimport { store as editWidgetsStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\n\nconst { useShouldContextualToolbarShow } = unlock( blockEditorPrivateApis );\n\nfunction Header() {\n\tconst isMediumViewport = useViewportMatch( 'medium' );\n\tconst inserterButton = useRef();\n\tconst widgetAreaClientId = useLastSelectedWidgetArea();\n\tconst isLastSelectedWidgetAreaOpen = useSelect(\n\t\t( select ) =>\n\t\t\tselect( editWidgetsStore ).getIsWidgetAreaOpen(\n\t\t\t\twidgetAreaClientId\n\t\t\t),\n\t\t[ widgetAreaClientId ]\n\t);\n\tconst { isInserterOpen, isListViewOpen } = useSelect( ( select ) => {\n\t\tconst { isInserterOpened, isListViewOpened } =\n\t\t\tselect( editWidgetsStore );\n\t\treturn {\n\t\t\tisInserterOpen: isInserterOpened(),\n\t\t\tisListViewOpen: isListViewOpened(),\n\t\t};\n\t}, [] );\n\tconst { setIsWidgetAreaOpen, setIsInserterOpened, setIsListViewOpened } =\n\t\tuseDispatch( editWidgetsStore );\n\tconst { selectBlock } = useDispatch( blockEditorStore );\n\tconst handleClick = () => {\n\t\tif ( isInserterOpen ) {\n\t\t\t// Focusing the inserter button closes the inserter popover.\n\t\t\tsetIsInserterOpened( false );\n\t\t} else {\n\t\t\tif ( ! isLastSelectedWidgetAreaOpen ) {\n\t\t\t\t// Select the last selected block if hasn't already.\n\t\t\t\tselectBlock( widgetAreaClientId );\n\t\t\t\t// Open the last selected widget area when opening the inserter.\n\t\t\t\tsetIsWidgetAreaOpen( widgetAreaClientId, true );\n\t\t\t}\n\t\t\t// The DOM updates resulting from selectBlock() and setIsInserterOpened() calls are applied the\n\t\t\t// same tick and pretty much in a random order. The inserter is closed if any other part of the\n\t\t\t// app receives focus. If selectBlock() happens to take effect after setIsInserterOpened() then\n\t\t\t// the inserter is visible for a brief moment and then gets auto-closed due to focus moving to\n\t\t\t// the selected block.\n\t\t\twindow.requestAnimationFrame( () => setIsInserterOpened( true ) );\n\t\t}\n\t};\n\n\tconst toggleListView = useCallback(\n\t\t() => setIsListViewOpened( ! isListViewOpen ),\n\t\t[ setIsListViewOpened, isListViewOpen ]\n\t);\n\n\tconst {\n\t\tshouldShowContextualToolbar,\n\t\tcanFocusHiddenToolbar,\n\t\tfixedToolbarCanBeFocused,\n\t} = useShouldContextualToolbarShow();\n\t// If there's a block toolbar to be focused, disable the focus shortcut for the document toolbar.\n\t// There's a fixed block toolbar when the fixed toolbar option is enabled or when the browser width is less than the large viewport.\n\tconst blockToolbarCanBeFocused =\n\t\tshouldShowContextualToolbar ||\n\t\tcanFocusHiddenToolbar ||\n\t\tfixedToolbarCanBeFocused;\n\n\treturn (\n\t\t<>\n\t\t\t<div className=\"edit-widgets-header\">\n\t\t\t\t<div className=\"edit-widgets-header__navigable-toolbar-wrapper\">\n\t\t\t\t\t{ isMediumViewport && (\n\t\t\t\t\t\t<h1 className=\"edit-widgets-header__title\">\n\t\t\t\t\t\t\t{ __( 'Widgets' ) }\n\t\t\t\t\t\t</h1>\n\t\t\t\t\t) }\n\t\t\t\t\t{ ! isMediumViewport && (\n\t\t\t\t\t\t<VisuallyHidden\n\t\t\t\t\t\t\tas=\"h1\"\n\t\t\t\t\t\t\tclassName=\"edit-widgets-header__title\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Widgets' ) }\n\t\t\t\t\t\t</VisuallyHidden>\n\t\t\t\t\t) }\n\t\t\t\t\t<NavigableToolbar\n\t\t\t\t\t\tclassName=\"edit-widgets-header-toolbar\"\n\t\t\t\t\t\taria-label={ __( 'Document tools' ) }\n\t\t\t\t\t\tshouldUseKeyboardFocusShortcut={\n\t\t\t\t\t\t\t! blockToolbarCanBeFocused\n\t\t\t\t\t\t}\n\t\t\t\t\t>\n\t\t\t\t\t\t<ToolbarItem\n\t\t\t\t\t\t\tref={ inserterButton }\n\t\t\t\t\t\t\tas={ Button }\n\t\t\t\t\t\t\tclassName=\"edit-widgets-header-toolbar__inserter-toggle\"\n\t\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\t\tisPressed={ isInserterOpen }\n\t\t\t\t\t\t\tonMouseDown={ ( event ) => {\n\t\t\t\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tonClick={ handleClick }\n\t\t\t\t\t\t\ticon={ plus }\n\t\t\t\t\t\t\t/* translators: button label text should, if possible, be under 16\n\t\t\t\t\tcharacters. */\n\t\t\t\t\t\t\tlabel={ _x(\n\t\t\t\t\t\t\t\t'Toggle block inserter',\n\t\t\t\t\t\t\t\t'Generic label for block inserter button'\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t{ isMediumViewport && (\n\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t<UndoButton />\n\t\t\t\t\t\t\t\t<RedoButton />\n\t\t\t\t\t\t\t\t<ToolbarItem\n\t\t\t\t\t\t\t\t\tas={ Button }\n\t\t\t\t\t\t\t\t\tclassName=\"edit-widgets-header-toolbar__list-view-toggle\"\n\t\t\t\t\t\t\t\t\ticon={ listView }\n\t\t\t\t\t\t\t\t\tisPressed={ isListViewOpen }\n\t\t\t\t\t\t\t\t\t/* translators: button label text should, if possible, be under 16 characters. */\n\t\t\t\t\t\t\t\t\tlabel={ __( 'List View' ) }\n\t\t\t\t\t\t\t\t\tonClick={ toggleListView }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t) }\n\t\t\t\t\t</NavigableToolbar>\n\t\t\t\t</div>\n\t\t\t\t<div className=\"edit-widgets-header__actions\">\n\t\t\t\t\t<SaveButton />\n\t\t\t\t\t<PinnedItems.Slot scope=\"core/edit-widgets\" />\n\t\t\t\t\t<MoreMenu />\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t</>\n\t);\n}\n\nexport default Header;\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;AACxD,SAASC,EAAE,EAAEC,EAAE,QAAQ,iBAAiB;AACxC,SAASC,MAAM,EAAEC,WAAW,EAAEC,cAAc,QAAQ,uBAAuB;AAC3E,SACCC,gBAAgB,EAChBC,KAAK,IAAIC,gBAAgB,EACzBC,WAAW,IAAIC,sBAAsB,QAC/B,yBAAyB;AAChC,SAASC,WAAW,QAAQ,sBAAsB;AAClD,SAASC,QAAQ,EAAEC,IAAI,QAAQ,kBAAkB;AACjD,SAASC,WAAW,EAAEC,MAAM,QAAQ,oBAAoB;AACxD,SAASC,gBAAgB,QAAQ,oBAAoB;;AAErD;AACA;AACA;AACA,OAAOC,UAAU,MAAM,gBAAgB;AACvC,OAAOC,UAAU,MAAM,kBAAkB;AACzC,OAAOC,UAAU,MAAM,kBAAkB;AACzC,OAAOC,QAAQ,MAAM,c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