@wordpress/block-library 7.3.5 → 7.3.6
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/build/index.js +1 -3
- package/build/index.js.map +1 -1
- package/build/navigation/edit/index.js +5 -28
- package/build/navigation/edit/index.js.map +1 -1
- package/build/navigation/index.js +0 -1
- package/build/navigation/index.js.map +1 -1
- package/build-module/index.js +1 -2
- package/build-module/index.js.map +1 -1
- package/build-module/navigation/edit/index.js +6 -28
- package/build-module/navigation/edit/index.js.map +1 -1
- package/build-module/navigation/index.js +0 -1
- package/build-module/navigation/index.js.map +1 -1
- package/package.json +7 -7
- package/src/comment-template/index.php +4 -0
- package/src/comments-pagination/index.php +4 -0
- package/src/comments-title/index.php +4 -0
- package/src/index.js +0 -2
- package/src/navigation/block.json +0 -1
- package/src/navigation/edit/index.js +6 -36
- package/src/post-comments-form/index.php +4 -0
- package/build/navigation-area/edit.js +0 -110
- package/build/navigation-area/edit.js.map +0 -1
- package/build/navigation-area/index.js +0 -62
- package/build/navigation-area/index.js.map +0 -1
- package/build/navigation-area/inner-blocks.js +0 -34
- package/build/navigation-area/inner-blocks.js.map +0 -1
- package/build/navigation-area/save.js +0 -18
- package/build/navigation-area/save.js.map +0 -1
- package/build-module/navigation-area/edit.js +0 -94
- package/build-module/navigation-area/edit.js.map +0 -1
- package/build-module/navigation-area/index.js +0 -48
- package/build-module/navigation-area/index.js.map +0 -1
- package/build-module/navigation-area/inner-blocks.js +0 -26
- package/build-module/navigation-area/inner-blocks.js.map +0 -1
- package/build-module/navigation-area/save.js +0 -10
- package/build-module/navigation-area/save.js.map +0 -1
- package/src/navigation-area/block.json +0 -23
- package/src/navigation-area/edit.js +0 -111
- package/src/navigation-area/index.js +0 -26
- package/src/navigation-area/index.php +0 -22
- package/src/navigation-area/inner-blocks.js +0 -24
- package/src/navigation-area/save.js +0 -8
|
@@ -1,110 +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 _i18n = require("@wordpress/i18n");
|
|
13
|
-
|
|
14
|
-
var _deprecated = _interopRequireDefault(require("@wordpress/deprecated"));
|
|
15
|
-
|
|
16
|
-
var _coreData = require("@wordpress/core-data");
|
|
17
|
-
|
|
18
|
-
var _components = require("@wordpress/components");
|
|
19
|
-
|
|
20
|
-
var _blockEditor = require("@wordpress/block-editor");
|
|
21
|
-
|
|
22
|
-
var _data = require("@wordpress/data");
|
|
23
|
-
|
|
24
|
-
var _innerBlocks = _interopRequireDefault(require("./inner-blocks"));
|
|
25
|
-
|
|
26
|
-
var _placeholderPreview = _interopRequireDefault(require("../navigation/edit/placeholder/placeholder-preview"));
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* WordPress dependencies
|
|
30
|
-
*/
|
|
31
|
-
|
|
32
|
-
/**
|
|
33
|
-
* Internal dependencies
|
|
34
|
-
*/
|
|
35
|
-
function NavigationAreaBlock(_ref) {
|
|
36
|
-
let {
|
|
37
|
-
attributes,
|
|
38
|
-
setAttributes
|
|
39
|
-
} = _ref;
|
|
40
|
-
const {
|
|
41
|
-
area
|
|
42
|
-
} = attributes;
|
|
43
|
-
const {
|
|
44
|
-
navigationAreas,
|
|
45
|
-
hasResolvedNavigationAreas
|
|
46
|
-
} = (0, _data.useSelect)(select => {
|
|
47
|
-
const {
|
|
48
|
-
getEntityRecords,
|
|
49
|
-
hasFinishedResolution
|
|
50
|
-
} = select(_coreData.store);
|
|
51
|
-
return {
|
|
52
|
-
navigationAreas: getEntityRecords('root', 'navigationArea'),
|
|
53
|
-
hasResolvedNavigationAreas: hasFinishedResolution('getEntityRecords', ['root', 'navigationArea'])
|
|
54
|
-
};
|
|
55
|
-
});
|
|
56
|
-
const navigationMenuId = navigationAreas !== null && navigationAreas !== void 0 && navigationAreas.length ? navigationAreas[area] : undefined;
|
|
57
|
-
const choices = (0, _element.useMemo)(() => navigationAreas === null || navigationAreas === void 0 ? void 0 : navigationAreas.map(_ref2 => {
|
|
58
|
-
let {
|
|
59
|
-
name,
|
|
60
|
-
description
|
|
61
|
-
} = _ref2;
|
|
62
|
-
return {
|
|
63
|
-
label: description,
|
|
64
|
-
value: name
|
|
65
|
-
};
|
|
66
|
-
}), [navigationAreas]);
|
|
67
|
-
(0, _deprecated.default)('wp.blockLibrary.NavigationArea', {
|
|
68
|
-
since: '12.0',
|
|
69
|
-
plugin: 'gutenberg'
|
|
70
|
-
});
|
|
71
|
-
return (0, _element.createElement)(_element.Fragment, null, (0, _element.createElement)(_blockEditor.BlockControls, null, (0, _element.createElement)(_components.ToolbarGroup, null, (0, _element.createElement)(_components.ToolbarDropdownMenu, {
|
|
72
|
-
label: (0, _i18n.__)('Select Area'),
|
|
73
|
-
text: (0, _i18n.__)('Select Area'),
|
|
74
|
-
icon: null
|
|
75
|
-
}, _ref3 => {
|
|
76
|
-
let {
|
|
77
|
-
onClose
|
|
78
|
-
} = _ref3;
|
|
79
|
-
return (0, _element.createElement)(_components.MenuGroup, null, (0, _element.createElement)(_components.MenuItemsChoice, {
|
|
80
|
-
value: area,
|
|
81
|
-
onSelect: selectedArea => {
|
|
82
|
-
setAttributes({
|
|
83
|
-
area: selectedArea
|
|
84
|
-
});
|
|
85
|
-
onClose();
|
|
86
|
-
},
|
|
87
|
-
choices: choices
|
|
88
|
-
}));
|
|
89
|
-
}))), (0, _element.createElement)(_blockEditor.InspectorControls, null, (0, _element.createElement)(_components.PanelBody, {
|
|
90
|
-
title: (0, _i18n.__)('Options')
|
|
91
|
-
}, (0, _element.createElement)(_components.SelectControl, {
|
|
92
|
-
label: (0, _i18n._x)('Area'),
|
|
93
|
-
value: area // `undefined` is required for the preload attribute to be unset.
|
|
94
|
-
,
|
|
95
|
-
onChange: value => setAttributes({
|
|
96
|
-
area: value
|
|
97
|
-
}),
|
|
98
|
-
options: choices
|
|
99
|
-
}))), !hasResolvedNavigationAreas && (0, _element.createElement)(_placeholderPreview.default, {
|
|
100
|
-
isLoading: true
|
|
101
|
-
}), // Render inner blocks only when navigationMenuId is known so
|
|
102
|
-
// that inner blocks template is correct from the start.
|
|
103
|
-
hasResolvedNavigationAreas && (0, _element.createElement)(_innerBlocks.default, {
|
|
104
|
-
navigationMenuId: navigationMenuId
|
|
105
|
-
}));
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
var _default = NavigationAreaBlock;
|
|
109
|
-
exports.default = _default;
|
|
110
|
-
//# sourceMappingURL=edit.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-library/src/navigation-area/edit.js"],"names":["NavigationAreaBlock","attributes","setAttributes","area","navigationAreas","hasResolvedNavigationAreas","select","getEntityRecords","hasFinishedResolution","coreStore","navigationMenuId","length","undefined","choices","map","name","description","label","value","since","plugin","onClose","selectedArea"],"mappings":";;;;;;;;;AAcA;;AAXA;;AACA;;AACA;;AACA;;AASA;;AACA;;AAKA;;AACA;;AAtBA;AACA;AACA;;AAgBA;AACA;AACA;AAIA,SAASA,mBAAT,OAA8D;AAAA,MAAhC;AAAEC,IAAAA,UAAF;AAAcC,IAAAA;AAAd,GAAgC;AAC7D,QAAM;AAAEC,IAAAA;AAAF,MAAWF,UAAjB;AAEA,QAAM;AAAEG,IAAAA,eAAF;AAAmBC,IAAAA;AAAnB,MAAkD,qBACrDC,MAAF,IAAc;AACb,UAAM;AAAEC,MAAAA,gBAAF;AAAoBC,MAAAA;AAApB,QAA8CF,MAAM,CACzDG,eADyD,CAA1D;AAGA,WAAO;AACNL,MAAAA,eAAe,EAAEG,gBAAgB,CAAE,MAAF,EAAU,gBAAV,CAD3B;AAENF,MAAAA,0BAA0B,EAAEG,qBAAqB,CAChD,kBADgD,EAEhD,CAAE,MAAF,EAAU,gBAAV,CAFgD;AAF3C,KAAP;AAOA,GAZsD,CAAxD;AAcA,QAAME,gBAAgB,GAAGN,eAAe,SAAf,IAAAA,eAAe,WAAf,IAAAA,eAAe,CAAEO,MAAjB,GACtBP,eAAe,CAAED,IAAF,CADO,GAEtBS,SAFH;AAIA,QAAMC,OAAO,GAAG,sBACf,MACCT,eADD,aACCA,eADD,uBACCA,eAAe,CAAEU,GAAjB,CAAsB;AAAA,QAAE;AAAEC,MAAAA,IAAF;AAAQC,MAAAA;AAAR,KAAF;AAAA,WAA+B;AACpDC,MAAAA,KAAK,EAAED,WAD6C;AAEpDE,MAAAA,KAAK,EAAEH;AAF6C,KAA/B;AAAA,GAAtB,CAFc,EAMf,CAAEX,eAAF,CANe,CAAhB;AASA,2BAAY,gCAAZ,EAA8C;AAC7Ce,IAAAA,KAAK,EAAE,MADsC;AAE7CC,IAAAA,MAAM,EAAE;AAFqC,GAA9C;AAKA,SACC,qDACC,4BAAC,0BAAD,QACC,4BAAC,wBAAD,QACC,4BAAC,+BAAD;AACC,IAAA,KAAK,EAAG,cAAI,aAAJ,CADT;AAEC,IAAA,IAAI,EAAG,cAAI,aAAJ,CAFR;AAGC,IAAA,IAAI,EAAG;AAHR,KAKG;AAAA,QAAE;AAAEC,MAAAA;AAAF,KAAF;AAAA,WACD,4BAAC,qBAAD,QACC,4BAAC,2BAAD;AACC,MAAA,KAAK,EAAGlB,IADT;AAEC,MAAA,QAAQ,EAAKmB,YAAF,IAAoB;AAC9BpB,QAAAA,aAAa,CAAE;AAAEC,UAAAA,IAAI,EAAEmB;AAAR,SAAF,CAAb;AACAD,QAAAA,OAAO;AACP,OALF;AAMC,MAAA,OAAO,EAAGR;AANX,MADD,CADC;AAAA,GALH,CADD,CADD,CADD,EAuBC,4BAAC,8BAAD,QACC,4BAAC,qBAAD;AAAW,IAAA,KAAK,EAAG,cAAI,SAAJ;AAAnB,KACC,4BAAC,yBAAD;AACC,IAAA,KAAK,EAAG,cAAI,MAAJ,CADT;AAEC,IAAA,KAAK,EAAGV,IAFT,CAGC;AAHD;AAIC,IAAA,QAAQ,EAAKe,KAAF,IACVhB,aAAa,CAAE;AACdC,MAAAA,IAAI,EAAEe;AADQ,KAAF,CALf;AASC,IAAA,OAAO,EAAGL;AATX,IADD,CADD,CAvBD,EAsCG,CAAER,0BAAF,IAAgC,4BAAC,2BAAD;AAAoB,IAAA,SAAS;AAA7B,IAtCnC,EAwCE;AACA;AACAA,EAAAA,0BAA0B,IACzB,4BAAC,oBAAD;AAAa,IAAA,gBAAgB,EAAGK;AAAhC,IA3CH,CADD;AAiDA;;eAEcV,mB","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, _x } from '@wordpress/i18n';\nimport deprecated from '@wordpress/deprecated';\nimport { store as coreStore } from '@wordpress/core-data';\nimport {\n\tMenuGroup,\n\tMenuItemsChoice,\n\tPanelBody,\n\tSelectControl,\n\tToolbarDropdownMenu,\n\tToolbarGroup,\n} from '@wordpress/components';\nimport { useMemo } from '@wordpress/element';\nimport { BlockControls, InspectorControls } from '@wordpress/block-editor';\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport InnerBlocks from './inner-blocks';\nimport PlaceholderPreview from '../navigation/edit/placeholder/placeholder-preview';\n\nfunction NavigationAreaBlock( { attributes, setAttributes } ) {\n\tconst { area } = attributes;\n\n\tconst { navigationAreas, hasResolvedNavigationAreas } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getEntityRecords, hasFinishedResolution } = select(\n\t\t\t\tcoreStore\n\t\t\t);\n\t\t\treturn {\n\t\t\t\tnavigationAreas: getEntityRecords( 'root', 'navigationArea' ),\n\t\t\t\thasResolvedNavigationAreas: hasFinishedResolution(\n\t\t\t\t\t'getEntityRecords',\n\t\t\t\t\t[ 'root', 'navigationArea' ]\n\t\t\t\t),\n\t\t\t};\n\t\t}\n\t);\n\tconst navigationMenuId = navigationAreas?.length\n\t\t? navigationAreas[ area ]\n\t\t: undefined;\n\n\tconst choices = useMemo(\n\t\t() =>\n\t\t\tnavigationAreas?.map( ( { name, description } ) => ( {\n\t\t\t\tlabel: description,\n\t\t\t\tvalue: name,\n\t\t\t} ) ),\n\t\t[ navigationAreas ]\n\t);\n\n\tdeprecated( 'wp.blockLibrary.NavigationArea', {\n\t\tsince: '12.0',\n\t\tplugin: 'gutenberg',\n\t} );\n\n\treturn (\n\t\t<>\n\t\t\t<BlockControls>\n\t\t\t\t<ToolbarGroup>\n\t\t\t\t\t<ToolbarDropdownMenu\n\t\t\t\t\t\tlabel={ __( 'Select Area' ) }\n\t\t\t\t\t\ttext={ __( 'Select Area' ) }\n\t\t\t\t\t\ticon={ null }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ ( { onClose } ) => (\n\t\t\t\t\t\t\t<MenuGroup>\n\t\t\t\t\t\t\t\t<MenuItemsChoice\n\t\t\t\t\t\t\t\t\tvalue={ area }\n\t\t\t\t\t\t\t\t\tonSelect={ ( selectedArea ) => {\n\t\t\t\t\t\t\t\t\t\tsetAttributes( { area: selectedArea } );\n\t\t\t\t\t\t\t\t\t\tonClose();\n\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t\tchoices={ choices }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</MenuGroup>\n\t\t\t\t\t\t) }\n\t\t\t\t\t</ToolbarDropdownMenu>\n\t\t\t\t</ToolbarGroup>\n\t\t\t</BlockControls>\n\t\t\t<InspectorControls>\n\t\t\t\t<PanelBody title={ __( 'Options' ) }>\n\t\t\t\t\t<SelectControl\n\t\t\t\t\t\tlabel={ _x( 'Area' ) }\n\t\t\t\t\t\tvalue={ area }\n\t\t\t\t\t\t// `undefined` is required for the preload attribute to be unset.\n\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\tarea: value,\n\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t}\n\t\t\t\t\t\toptions={ choices }\n\t\t\t\t\t/>\n\t\t\t\t</PanelBody>\n\t\t\t</InspectorControls>\n\t\t\t{ ! hasResolvedNavigationAreas && <PlaceholderPreview isLoading /> }\n\t\t\t{\n\t\t\t\t// Render inner blocks only when navigationMenuId is known so\n\t\t\t\t// that inner blocks template is correct from the start.\n\t\t\t\thasResolvedNavigationAreas && (\n\t\t\t\t\t<InnerBlocks navigationMenuId={ navigationMenuId } />\n\t\t\t\t)\n\t\t\t}\n\t\t</>\n\t);\n}\n\nexport default NavigationAreaBlock;\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.settings = exports.name = exports.metadata = void 0;
|
|
9
|
-
|
|
10
|
-
var _icons = require("@wordpress/icons");
|
|
11
|
-
|
|
12
|
-
var _edit = _interopRequireDefault(require("./edit"));
|
|
13
|
-
|
|
14
|
-
var _save = _interopRequireDefault(require("./save"));
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* WordPress dependencies
|
|
18
|
-
*/
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* Internal dependencies
|
|
22
|
-
*/
|
|
23
|
-
const metadata = {
|
|
24
|
-
$schema: "https://schemas.wp.org/trunk/block.json",
|
|
25
|
-
apiVersion: 2,
|
|
26
|
-
name: "core/navigation-area",
|
|
27
|
-
title: "Navigation Area",
|
|
28
|
-
category: "theme",
|
|
29
|
-
description: "Define a navigation area for your theme. The navigation block associated with this area will be automatically displayed.",
|
|
30
|
-
keywords: ["menu", "navigation", "links", "location"],
|
|
31
|
-
textdomain: "default",
|
|
32
|
-
attributes: {
|
|
33
|
-
area: {
|
|
34
|
-
type: "string",
|
|
35
|
-
"default": "primary"
|
|
36
|
-
}
|
|
37
|
-
},
|
|
38
|
-
providesContext: {
|
|
39
|
-
navigationArea: "area"
|
|
40
|
-
},
|
|
41
|
-
supports: {
|
|
42
|
-
html: false,
|
|
43
|
-
inserter: false
|
|
44
|
-
}
|
|
45
|
-
};
|
|
46
|
-
exports.metadata = metadata;
|
|
47
|
-
const {
|
|
48
|
-
name
|
|
49
|
-
} = metadata;
|
|
50
|
-
exports.name = name;
|
|
51
|
-
const settings = {
|
|
52
|
-
icon: _icons.symbolFilled,
|
|
53
|
-
example: {
|
|
54
|
-
attributes: {
|
|
55
|
-
area: 'primary'
|
|
56
|
-
}
|
|
57
|
-
},
|
|
58
|
-
edit: _edit.default,
|
|
59
|
-
save: _save.default
|
|
60
|
-
};
|
|
61
|
-
exports.settings = settings;
|
|
62
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-library/src/navigation-area/index.js"],"names":["name","metadata","settings","icon","example","attributes","area","edit","save"],"mappings":";;;;;;;;;AAGA;;AAKA;;AAEA;;AAVA;AACA;AACA;;AAGA;AACA;AACA;;;;;;;;;;;;;;;;;;;;;;;;;AAKA,MAAM;AAAEA,EAAAA;AAAF,IAAWC,QAAjB;;AAIO,MAAMC,QAAQ,GAAG;AACvBC,EAAAA,IAAI,EAAJA,mBADuB;AAEvBC,EAAAA,OAAO,EAAE;AACRC,IAAAA,UAAU,EAAE;AACXC,MAAAA,IAAI,EAAE;AADK;AADJ,GAFc;AAOvBC,EAAAA,IAAI,EAAJA,aAPuB;AAQvBC,EAAAA,IAAI,EAAJA;AARuB,CAAjB","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { symbolFilled as icon } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport edit from './edit';\nimport metadata from './block.json';\nimport save from './save';\n\nconst { name } = metadata;\n\nexport { metadata, name };\n\nexport const settings = {\n\ticon,\n\texample: {\n\t\tattributes: {\n\t\t\tarea: 'primary',\n\t\t},\n\t},\n\tedit,\n\tsave,\n};\n"]}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = NavigationAreaInnerBlocks;
|
|
7
|
-
|
|
8
|
-
var _element = require("@wordpress/element");
|
|
9
|
-
|
|
10
|
-
var _blockEditor = require("@wordpress/block-editor");
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* WordPress dependencies
|
|
14
|
-
*/
|
|
15
|
-
const ALLOWED_BLOCKS = ['core/navigation'];
|
|
16
|
-
|
|
17
|
-
function NavigationAreaInnerBlocks(_ref) {
|
|
18
|
-
let {
|
|
19
|
-
navigationMenuId
|
|
20
|
-
} = _ref;
|
|
21
|
-
const template = (0, _element.useMemo)(() => [['core/navigation', {
|
|
22
|
-
navigationMenuId
|
|
23
|
-
}]], [navigationMenuId]);
|
|
24
|
-
const blockProps = (0, _blockEditor.useBlockProps)();
|
|
25
|
-
const innerBlocksProps = (0, _blockEditor.useInnerBlocksProps)(blockProps, {
|
|
26
|
-
orientation: 'horizontal',
|
|
27
|
-
renderAppender: false,
|
|
28
|
-
template,
|
|
29
|
-
templateLock: 'all',
|
|
30
|
-
allowedBlocks: ALLOWED_BLOCKS
|
|
31
|
-
});
|
|
32
|
-
return (0, _element.createElement)("div", innerBlocksProps);
|
|
33
|
-
}
|
|
34
|
-
//# sourceMappingURL=inner-blocks.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-library/src/navigation-area/inner-blocks.js"],"names":["ALLOWED_BLOCKS","NavigationAreaInnerBlocks","navigationMenuId","template","blockProps","innerBlocksProps","orientation","renderAppender","templateLock","allowedBlocks"],"mappings":";;;;;;;AAGA;;AACA;;AAJA;AACA;AACA;AAIA,MAAMA,cAAc,GAAG,CAAE,iBAAF,CAAvB;;AAEe,SAASC,yBAAT,OAA2D;AAAA,MAAvB;AAAEC,IAAAA;AAAF,GAAuB;AACzE,QAAMC,QAAQ,GAAG,sBAChB,MAAM,CAAE,CAAE,iBAAF,EAAqB;AAAED,IAAAA;AAAF,GAArB,CAAF,CADU,EAEhB,CAAEA,gBAAF,CAFgB,CAAjB;AAKA,QAAME,UAAU,GAAG,iCAAnB;AACA,QAAMC,gBAAgB,GAAG,sCAAqBD,UAArB,EAAiC;AACzDE,IAAAA,WAAW,EAAE,YAD4C;AAEzDC,IAAAA,cAAc,EAAE,KAFyC;AAGzDJ,IAAAA,QAHyD;AAIzDK,IAAAA,YAAY,EAAE,KAJ2C;AAKzDC,IAAAA,aAAa,EAAET;AAL0C,GAAjC,CAAzB;AAOA,SAAO,mCAAUK,gBAAV,CAAP;AACA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useMemo } from '@wordpress/element';\nimport { useBlockProps, useInnerBlocksProps } from '@wordpress/block-editor';\n\nconst ALLOWED_BLOCKS = [ 'core/navigation' ];\n\nexport default function NavigationAreaInnerBlocks( { navigationMenuId } ) {\n\tconst template = useMemo(\n\t\t() => [ [ 'core/navigation', { navigationMenuId } ] ],\n\t\t[ navigationMenuId ]\n\t);\n\n\tconst blockProps = useBlockProps();\n\tconst innerBlocksProps = useInnerBlocksProps( blockProps, {\n\t\torientation: 'horizontal',\n\t\trenderAppender: false,\n\t\ttemplate,\n\t\ttemplateLock: 'all',\n\t\tallowedBlocks: ALLOWED_BLOCKS,\n\t} );\n\treturn <div { ...innerBlocksProps } />;\n}\n"]}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = save;
|
|
7
|
-
|
|
8
|
-
var _element = require("@wordpress/element");
|
|
9
|
-
|
|
10
|
-
var _blockEditor = require("@wordpress/block-editor");
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* WordPress dependencies
|
|
14
|
-
*/
|
|
15
|
-
function save() {
|
|
16
|
-
return (0, _element.createElement)(_blockEditor.InnerBlocks.Content, null);
|
|
17
|
-
}
|
|
18
|
-
//# sourceMappingURL=save.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-library/src/navigation-area/save.js"],"names":["save"],"mappings":";;;;;;;;;AAGA;;AAHA;AACA;AACA;AAGe,SAASA,IAAT,GAAgB;AAC9B,SAAO,4BAAC,wBAAD,CAAa,OAAb,OAAP;AACA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { InnerBlocks } from '@wordpress/block-editor';\n\nexport default function save() {\n\treturn <InnerBlocks.Content />;\n}\n"]}
|
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
import { createElement, Fragment } from "@wordpress/element";
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* WordPress dependencies
|
|
5
|
-
*/
|
|
6
|
-
import { __, _x } from '@wordpress/i18n';
|
|
7
|
-
import deprecated from '@wordpress/deprecated';
|
|
8
|
-
import { store as coreStore } from '@wordpress/core-data';
|
|
9
|
-
import { MenuGroup, MenuItemsChoice, PanelBody, SelectControl, ToolbarDropdownMenu, ToolbarGroup } from '@wordpress/components';
|
|
10
|
-
import { useMemo } from '@wordpress/element';
|
|
11
|
-
import { BlockControls, InspectorControls } from '@wordpress/block-editor';
|
|
12
|
-
import { useSelect } from '@wordpress/data';
|
|
13
|
-
/**
|
|
14
|
-
* Internal dependencies
|
|
15
|
-
*/
|
|
16
|
-
|
|
17
|
-
import InnerBlocks from './inner-blocks';
|
|
18
|
-
import PlaceholderPreview from '../navigation/edit/placeholder/placeholder-preview';
|
|
19
|
-
|
|
20
|
-
function NavigationAreaBlock(_ref) {
|
|
21
|
-
let {
|
|
22
|
-
attributes,
|
|
23
|
-
setAttributes
|
|
24
|
-
} = _ref;
|
|
25
|
-
const {
|
|
26
|
-
area
|
|
27
|
-
} = attributes;
|
|
28
|
-
const {
|
|
29
|
-
navigationAreas,
|
|
30
|
-
hasResolvedNavigationAreas
|
|
31
|
-
} = useSelect(select => {
|
|
32
|
-
const {
|
|
33
|
-
getEntityRecords,
|
|
34
|
-
hasFinishedResolution
|
|
35
|
-
} = select(coreStore);
|
|
36
|
-
return {
|
|
37
|
-
navigationAreas: getEntityRecords('root', 'navigationArea'),
|
|
38
|
-
hasResolvedNavigationAreas: hasFinishedResolution('getEntityRecords', ['root', 'navigationArea'])
|
|
39
|
-
};
|
|
40
|
-
});
|
|
41
|
-
const navigationMenuId = navigationAreas !== null && navigationAreas !== void 0 && navigationAreas.length ? navigationAreas[area] : undefined;
|
|
42
|
-
const choices = useMemo(() => navigationAreas === null || navigationAreas === void 0 ? void 0 : navigationAreas.map(_ref2 => {
|
|
43
|
-
let {
|
|
44
|
-
name,
|
|
45
|
-
description
|
|
46
|
-
} = _ref2;
|
|
47
|
-
return {
|
|
48
|
-
label: description,
|
|
49
|
-
value: name
|
|
50
|
-
};
|
|
51
|
-
}), [navigationAreas]);
|
|
52
|
-
deprecated('wp.blockLibrary.NavigationArea', {
|
|
53
|
-
since: '12.0',
|
|
54
|
-
plugin: 'gutenberg'
|
|
55
|
-
});
|
|
56
|
-
return createElement(Fragment, null, createElement(BlockControls, null, createElement(ToolbarGroup, null, createElement(ToolbarDropdownMenu, {
|
|
57
|
-
label: __('Select Area'),
|
|
58
|
-
text: __('Select Area'),
|
|
59
|
-
icon: null
|
|
60
|
-
}, _ref3 => {
|
|
61
|
-
let {
|
|
62
|
-
onClose
|
|
63
|
-
} = _ref3;
|
|
64
|
-
return createElement(MenuGroup, null, createElement(MenuItemsChoice, {
|
|
65
|
-
value: area,
|
|
66
|
-
onSelect: selectedArea => {
|
|
67
|
-
setAttributes({
|
|
68
|
-
area: selectedArea
|
|
69
|
-
});
|
|
70
|
-
onClose();
|
|
71
|
-
},
|
|
72
|
-
choices: choices
|
|
73
|
-
}));
|
|
74
|
-
}))), createElement(InspectorControls, null, createElement(PanelBody, {
|
|
75
|
-
title: __('Options')
|
|
76
|
-
}, createElement(SelectControl, {
|
|
77
|
-
label: _x('Area'),
|
|
78
|
-
value: area // `undefined` is required for the preload attribute to be unset.
|
|
79
|
-
,
|
|
80
|
-
onChange: value => setAttributes({
|
|
81
|
-
area: value
|
|
82
|
-
}),
|
|
83
|
-
options: choices
|
|
84
|
-
}))), !hasResolvedNavigationAreas && createElement(PlaceholderPreview, {
|
|
85
|
-
isLoading: true
|
|
86
|
-
}), // Render inner blocks only when navigationMenuId is known so
|
|
87
|
-
// that inner blocks template is correct from the start.
|
|
88
|
-
hasResolvedNavigationAreas && createElement(InnerBlocks, {
|
|
89
|
-
navigationMenuId: navigationMenuId
|
|
90
|
-
}));
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
export default NavigationAreaBlock;
|
|
94
|
-
//# sourceMappingURL=edit.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-library/src/navigation-area/edit.js"],"names":["__","_x","deprecated","store","coreStore","MenuGroup","MenuItemsChoice","PanelBody","SelectControl","ToolbarDropdownMenu","ToolbarGroup","useMemo","BlockControls","InspectorControls","useSelect","InnerBlocks","PlaceholderPreview","NavigationAreaBlock","attributes","setAttributes","area","navigationAreas","hasResolvedNavigationAreas","select","getEntityRecords","hasFinishedResolution","navigationMenuId","length","undefined","choices","map","name","description","label","value","since","plugin","onClose","selectedArea"],"mappings":"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","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, _x } from '@wordpress/i18n';\nimport deprecated from '@wordpress/deprecated';\nimport { store as coreStore } from '@wordpress/core-data';\nimport {\n\tMenuGroup,\n\tMenuItemsChoice,\n\tPanelBody,\n\tSelectControl,\n\tToolbarDropdownMenu,\n\tToolbarGroup,\n} from '@wordpress/components';\nimport { useMemo } from '@wordpress/element';\nimport { BlockControls, InspectorControls } from '@wordpress/block-editor';\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport InnerBlocks from './inner-blocks';\nimport PlaceholderPreview from '../navigation/edit/placeholder/placeholder-preview';\n\nfunction NavigationAreaBlock( { attributes, setAttributes } ) {\n\tconst { area } = attributes;\n\n\tconst { navigationAreas, hasResolvedNavigationAreas } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getEntityRecords, hasFinishedResolution } = select(\n\t\t\t\tcoreStore\n\t\t\t);\n\t\t\treturn {\n\t\t\t\tnavigationAreas: getEntityRecords( 'root', 'navigationArea' ),\n\t\t\t\thasResolvedNavigationAreas: hasFinishedResolution(\n\t\t\t\t\t'getEntityRecords',\n\t\t\t\t\t[ 'root', 'navigationArea' ]\n\t\t\t\t),\n\t\t\t};\n\t\t}\n\t);\n\tconst navigationMenuId = navigationAreas?.length\n\t\t? navigationAreas[ area ]\n\t\t: undefined;\n\n\tconst choices = useMemo(\n\t\t() =>\n\t\t\tnavigationAreas?.map( ( { name, description } ) => ( {\n\t\t\t\tlabel: description,\n\t\t\t\tvalue: name,\n\t\t\t} ) ),\n\t\t[ navigationAreas ]\n\t);\n\n\tdeprecated( 'wp.blockLibrary.NavigationArea', {\n\t\tsince: '12.0',\n\t\tplugin: 'gutenberg',\n\t} );\n\n\treturn (\n\t\t<>\n\t\t\t<BlockControls>\n\t\t\t\t<ToolbarGroup>\n\t\t\t\t\t<ToolbarDropdownMenu\n\t\t\t\t\t\tlabel={ __( 'Select Area' ) }\n\t\t\t\t\t\ttext={ __( 'Select Area' ) }\n\t\t\t\t\t\ticon={ null }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ ( { onClose } ) => (\n\t\t\t\t\t\t\t<MenuGroup>\n\t\t\t\t\t\t\t\t<MenuItemsChoice\n\t\t\t\t\t\t\t\t\tvalue={ area }\n\t\t\t\t\t\t\t\t\tonSelect={ ( selectedArea ) => {\n\t\t\t\t\t\t\t\t\t\tsetAttributes( { area: selectedArea } );\n\t\t\t\t\t\t\t\t\t\tonClose();\n\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t\tchoices={ choices }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</MenuGroup>\n\t\t\t\t\t\t) }\n\t\t\t\t\t</ToolbarDropdownMenu>\n\t\t\t\t</ToolbarGroup>\n\t\t\t</BlockControls>\n\t\t\t<InspectorControls>\n\t\t\t\t<PanelBody title={ __( 'Options' ) }>\n\t\t\t\t\t<SelectControl\n\t\t\t\t\t\tlabel={ _x( 'Area' ) }\n\t\t\t\t\t\tvalue={ area }\n\t\t\t\t\t\t// `undefined` is required for the preload attribute to be unset.\n\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\tarea: value,\n\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t}\n\t\t\t\t\t\toptions={ choices }\n\t\t\t\t\t/>\n\t\t\t\t</PanelBody>\n\t\t\t</InspectorControls>\n\t\t\t{ ! hasResolvedNavigationAreas && <PlaceholderPreview isLoading /> }\n\t\t\t{\n\t\t\t\t// Render inner blocks only when navigationMenuId is known so\n\t\t\t\t// that inner blocks template is correct from the start.\n\t\t\t\thasResolvedNavigationAreas && (\n\t\t\t\t\t<InnerBlocks navigationMenuId={ navigationMenuId } />\n\t\t\t\t)\n\t\t\t}\n\t\t</>\n\t);\n}\n\nexport default NavigationAreaBlock;\n"]}
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* WordPress dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { symbolFilled as icon } from '@wordpress/icons';
|
|
5
|
-
/**
|
|
6
|
-
* Internal dependencies
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
|
-
import edit from './edit';
|
|
10
|
-
const metadata = {
|
|
11
|
-
$schema: "https://schemas.wp.org/trunk/block.json",
|
|
12
|
-
apiVersion: 2,
|
|
13
|
-
name: "core/navigation-area",
|
|
14
|
-
title: "Navigation Area",
|
|
15
|
-
category: "theme",
|
|
16
|
-
description: "Define a navigation area for your theme. The navigation block associated with this area will be automatically displayed.",
|
|
17
|
-
keywords: ["menu", "navigation", "links", "location"],
|
|
18
|
-
textdomain: "default",
|
|
19
|
-
attributes: {
|
|
20
|
-
area: {
|
|
21
|
-
type: "string",
|
|
22
|
-
"default": "primary"
|
|
23
|
-
}
|
|
24
|
-
},
|
|
25
|
-
providesContext: {
|
|
26
|
-
navigationArea: "area"
|
|
27
|
-
},
|
|
28
|
-
supports: {
|
|
29
|
-
html: false,
|
|
30
|
-
inserter: false
|
|
31
|
-
}
|
|
32
|
-
};
|
|
33
|
-
import save from './save';
|
|
34
|
-
const {
|
|
35
|
-
name
|
|
36
|
-
} = metadata;
|
|
37
|
-
export { metadata, name };
|
|
38
|
-
export const settings = {
|
|
39
|
-
icon,
|
|
40
|
-
example: {
|
|
41
|
-
attributes: {
|
|
42
|
-
area: 'primary'
|
|
43
|
-
}
|
|
44
|
-
},
|
|
45
|
-
edit,
|
|
46
|
-
save
|
|
47
|
-
};
|
|
48
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-library/src/navigation-area/index.js"],"names":["symbolFilled","icon","edit","save","name","metadata","settings","example","attributes","area"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,YAAY,IAAIC,IAAzB,QAAqC,kBAArC;AAEA;AACA;AACA;;AACA,OAAOC,IAAP,MAAiB,QAAjB;;;;;;;;;;;;;;;;;;;;;;;;AAEA,OAAOC,IAAP,MAAiB,QAAjB;AAEA,MAAM;AAAEC,EAAAA;AAAF,IAAWC,QAAjB;AAEA,SAASA,QAAT,EAAmBD,IAAnB;AAEA,OAAO,MAAME,QAAQ,GAAG;AACvBL,EAAAA,IADuB;AAEvBM,EAAAA,OAAO,EAAE;AACRC,IAAAA,UAAU,EAAE;AACXC,MAAAA,IAAI,EAAE;AADK;AADJ,GAFc;AAOvBP,EAAAA,IAPuB;AAQvBC,EAAAA;AARuB,CAAjB","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { symbolFilled as icon } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport edit from './edit';\nimport metadata from './block.json';\nimport save from './save';\n\nconst { name } = metadata;\n\nexport { metadata, name };\n\nexport const settings = {\n\ticon,\n\texample: {\n\t\tattributes: {\n\t\t\tarea: 'primary',\n\t\t},\n\t},\n\tedit,\n\tsave,\n};\n"]}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { createElement } from "@wordpress/element";
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* WordPress dependencies
|
|
5
|
-
*/
|
|
6
|
-
import { useMemo } from '@wordpress/element';
|
|
7
|
-
import { useBlockProps, useInnerBlocksProps } from '@wordpress/block-editor';
|
|
8
|
-
const ALLOWED_BLOCKS = ['core/navigation'];
|
|
9
|
-
export default function NavigationAreaInnerBlocks(_ref) {
|
|
10
|
-
let {
|
|
11
|
-
navigationMenuId
|
|
12
|
-
} = _ref;
|
|
13
|
-
const template = useMemo(() => [['core/navigation', {
|
|
14
|
-
navigationMenuId
|
|
15
|
-
}]], [navigationMenuId]);
|
|
16
|
-
const blockProps = useBlockProps();
|
|
17
|
-
const innerBlocksProps = useInnerBlocksProps(blockProps, {
|
|
18
|
-
orientation: 'horizontal',
|
|
19
|
-
renderAppender: false,
|
|
20
|
-
template,
|
|
21
|
-
templateLock: 'all',
|
|
22
|
-
allowedBlocks: ALLOWED_BLOCKS
|
|
23
|
-
});
|
|
24
|
-
return createElement("div", innerBlocksProps);
|
|
25
|
-
}
|
|
26
|
-
//# sourceMappingURL=inner-blocks.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-library/src/navigation-area/inner-blocks.js"],"names":["useMemo","useBlockProps","useInnerBlocksProps","ALLOWED_BLOCKS","NavigationAreaInnerBlocks","navigationMenuId","template","blockProps","innerBlocksProps","orientation","renderAppender","templateLock","allowedBlocks"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,OAAT,QAAwB,oBAAxB;AACA,SAASC,aAAT,EAAwBC,mBAAxB,QAAmD,yBAAnD;AAEA,MAAMC,cAAc,GAAG,CAAE,iBAAF,CAAvB;AAEA,eAAe,SAASC,yBAAT,OAA2D;AAAA,MAAvB;AAAEC,IAAAA;AAAF,GAAuB;AACzE,QAAMC,QAAQ,GAAGN,OAAO,CACvB,MAAM,CAAE,CAAE,iBAAF,EAAqB;AAAEK,IAAAA;AAAF,GAArB,CAAF,CADiB,EAEvB,CAAEA,gBAAF,CAFuB,CAAxB;AAKA,QAAME,UAAU,GAAGN,aAAa,EAAhC;AACA,QAAMO,gBAAgB,GAAGN,mBAAmB,CAAEK,UAAF,EAAc;AACzDE,IAAAA,WAAW,EAAE,YAD4C;AAEzDC,IAAAA,cAAc,EAAE,KAFyC;AAGzDJ,IAAAA,QAHyD;AAIzDK,IAAAA,YAAY,EAAE,KAJ2C;AAKzDC,IAAAA,aAAa,EAAET;AAL0C,GAAd,CAA5C;AAOA,SAAO,qBAAUK,gBAAV,CAAP;AACA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useMemo } from '@wordpress/element';\nimport { useBlockProps, useInnerBlocksProps } from '@wordpress/block-editor';\n\nconst ALLOWED_BLOCKS = [ 'core/navigation' ];\n\nexport default function NavigationAreaInnerBlocks( { navigationMenuId } ) {\n\tconst template = useMemo(\n\t\t() => [ [ 'core/navigation', { navigationMenuId } ] ],\n\t\t[ navigationMenuId ]\n\t);\n\n\tconst blockProps = useBlockProps();\n\tconst innerBlocksProps = useInnerBlocksProps( blockProps, {\n\t\torientation: 'horizontal',\n\t\trenderAppender: false,\n\t\ttemplate,\n\t\ttemplateLock: 'all',\n\t\tallowedBlocks: ALLOWED_BLOCKS,\n\t} );\n\treturn <div { ...innerBlocksProps } />;\n}\n"]}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { createElement } from "@wordpress/element";
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* WordPress dependencies
|
|
5
|
-
*/
|
|
6
|
-
import { InnerBlocks } from '@wordpress/block-editor';
|
|
7
|
-
export default function save() {
|
|
8
|
-
return createElement(InnerBlocks.Content, null);
|
|
9
|
-
}
|
|
10
|
-
//# sourceMappingURL=save.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-library/src/navigation-area/save.js"],"names":["InnerBlocks","save"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,WAAT,QAA4B,yBAA5B;AAEA,eAAe,SAASC,IAAT,GAAgB;AAC9B,SAAO,cAAC,WAAD,CAAa,OAAb,OAAP;AACA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { InnerBlocks } from '@wordpress/block-editor';\n\nexport default function save() {\n\treturn <InnerBlocks.Content />;\n}\n"]}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"$schema": "https://schemas.wp.org/trunk/block.json",
|
|
3
|
-
"apiVersion": 2,
|
|
4
|
-
"name": "core/navigation-area",
|
|
5
|
-
"title": "Navigation Area",
|
|
6
|
-
"category": "theme",
|
|
7
|
-
"description": "Define a navigation area for your theme. The navigation block associated with this area will be automatically displayed.",
|
|
8
|
-
"keywords": [ "menu", "navigation", "links", "location" ],
|
|
9
|
-
"textdomain": "default",
|
|
10
|
-
"attributes": {
|
|
11
|
-
"area": {
|
|
12
|
-
"type": "string",
|
|
13
|
-
"default": "primary"
|
|
14
|
-
}
|
|
15
|
-
},
|
|
16
|
-
"providesContext": {
|
|
17
|
-
"navigationArea": "area"
|
|
18
|
-
},
|
|
19
|
-
"supports": {
|
|
20
|
-
"html": false,
|
|
21
|
-
"inserter": false
|
|
22
|
-
}
|
|
23
|
-
}
|
|
@@ -1,111 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* WordPress dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { __, _x } from '@wordpress/i18n';
|
|
5
|
-
import deprecated from '@wordpress/deprecated';
|
|
6
|
-
import { store as coreStore } from '@wordpress/core-data';
|
|
7
|
-
import {
|
|
8
|
-
MenuGroup,
|
|
9
|
-
MenuItemsChoice,
|
|
10
|
-
PanelBody,
|
|
11
|
-
SelectControl,
|
|
12
|
-
ToolbarDropdownMenu,
|
|
13
|
-
ToolbarGroup,
|
|
14
|
-
} from '@wordpress/components';
|
|
15
|
-
import { useMemo } from '@wordpress/element';
|
|
16
|
-
import { BlockControls, InspectorControls } from '@wordpress/block-editor';
|
|
17
|
-
import { useSelect } from '@wordpress/data';
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* Internal dependencies
|
|
21
|
-
*/
|
|
22
|
-
import InnerBlocks from './inner-blocks';
|
|
23
|
-
import PlaceholderPreview from '../navigation/edit/placeholder/placeholder-preview';
|
|
24
|
-
|
|
25
|
-
function NavigationAreaBlock( { attributes, setAttributes } ) {
|
|
26
|
-
const { area } = attributes;
|
|
27
|
-
|
|
28
|
-
const { navigationAreas, hasResolvedNavigationAreas } = useSelect(
|
|
29
|
-
( select ) => {
|
|
30
|
-
const { getEntityRecords, hasFinishedResolution } = select(
|
|
31
|
-
coreStore
|
|
32
|
-
);
|
|
33
|
-
return {
|
|
34
|
-
navigationAreas: getEntityRecords( 'root', 'navigationArea' ),
|
|
35
|
-
hasResolvedNavigationAreas: hasFinishedResolution(
|
|
36
|
-
'getEntityRecords',
|
|
37
|
-
[ 'root', 'navigationArea' ]
|
|
38
|
-
),
|
|
39
|
-
};
|
|
40
|
-
}
|
|
41
|
-
);
|
|
42
|
-
const navigationMenuId = navigationAreas?.length
|
|
43
|
-
? navigationAreas[ area ]
|
|
44
|
-
: undefined;
|
|
45
|
-
|
|
46
|
-
const choices = useMemo(
|
|
47
|
-
() =>
|
|
48
|
-
navigationAreas?.map( ( { name, description } ) => ( {
|
|
49
|
-
label: description,
|
|
50
|
-
value: name,
|
|
51
|
-
} ) ),
|
|
52
|
-
[ navigationAreas ]
|
|
53
|
-
);
|
|
54
|
-
|
|
55
|
-
deprecated( 'wp.blockLibrary.NavigationArea', {
|
|
56
|
-
since: '12.0',
|
|
57
|
-
plugin: 'gutenberg',
|
|
58
|
-
} );
|
|
59
|
-
|
|
60
|
-
return (
|
|
61
|
-
<>
|
|
62
|
-
<BlockControls>
|
|
63
|
-
<ToolbarGroup>
|
|
64
|
-
<ToolbarDropdownMenu
|
|
65
|
-
label={ __( 'Select Area' ) }
|
|
66
|
-
text={ __( 'Select Area' ) }
|
|
67
|
-
icon={ null }
|
|
68
|
-
>
|
|
69
|
-
{ ( { onClose } ) => (
|
|
70
|
-
<MenuGroup>
|
|
71
|
-
<MenuItemsChoice
|
|
72
|
-
value={ area }
|
|
73
|
-
onSelect={ ( selectedArea ) => {
|
|
74
|
-
setAttributes( { area: selectedArea } );
|
|
75
|
-
onClose();
|
|
76
|
-
} }
|
|
77
|
-
choices={ choices }
|
|
78
|
-
/>
|
|
79
|
-
</MenuGroup>
|
|
80
|
-
) }
|
|
81
|
-
</ToolbarDropdownMenu>
|
|
82
|
-
</ToolbarGroup>
|
|
83
|
-
</BlockControls>
|
|
84
|
-
<InspectorControls>
|
|
85
|
-
<PanelBody title={ __( 'Options' ) }>
|
|
86
|
-
<SelectControl
|
|
87
|
-
label={ _x( 'Area' ) }
|
|
88
|
-
value={ area }
|
|
89
|
-
// `undefined` is required for the preload attribute to be unset.
|
|
90
|
-
onChange={ ( value ) =>
|
|
91
|
-
setAttributes( {
|
|
92
|
-
area: value,
|
|
93
|
-
} )
|
|
94
|
-
}
|
|
95
|
-
options={ choices }
|
|
96
|
-
/>
|
|
97
|
-
</PanelBody>
|
|
98
|
-
</InspectorControls>
|
|
99
|
-
{ ! hasResolvedNavigationAreas && <PlaceholderPreview isLoading /> }
|
|
100
|
-
{
|
|
101
|
-
// Render inner blocks only when navigationMenuId is known so
|
|
102
|
-
// that inner blocks template is correct from the start.
|
|
103
|
-
hasResolvedNavigationAreas && (
|
|
104
|
-
<InnerBlocks navigationMenuId={ navigationMenuId } />
|
|
105
|
-
)
|
|
106
|
-
}
|
|
107
|
-
</>
|
|
108
|
-
);
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
export default NavigationAreaBlock;
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* WordPress dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { symbolFilled as icon } from '@wordpress/icons';
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Internal dependencies
|
|
8
|
-
*/
|
|
9
|
-
import edit from './edit';
|
|
10
|
-
import metadata from './block.json';
|
|
11
|
-
import save from './save';
|
|
12
|
-
|
|
13
|
-
const { name } = metadata;
|
|
14
|
-
|
|
15
|
-
export { metadata, name };
|
|
16
|
-
|
|
17
|
-
export const settings = {
|
|
18
|
-
icon,
|
|
19
|
-
example: {
|
|
20
|
-
attributes: {
|
|
21
|
-
area: 'primary',
|
|
22
|
-
},
|
|
23
|
-
},
|
|
24
|
-
edit,
|
|
25
|
-
save,
|
|
26
|
-
};
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
<?php
|
|
2
|
-
/**
|
|
3
|
-
* Server-side rendering of the `core/navigation-area` block.
|
|
4
|
-
*
|
|
5
|
-
* @deprecated 5.9.0 See https://github.com/WordPress/gutenberg/issues/36524
|
|
6
|
-
* @package WordPress
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* Registers the `core/navigation-area` block on the server.
|
|
11
|
-
*/
|
|
12
|
-
function register_block_core_navigation_area() {
|
|
13
|
-
register_block_type_from_metadata(
|
|
14
|
-
__DIR__ . '/navigation-area',
|
|
15
|
-
array(
|
|
16
|
-
'provides_context' => array(
|
|
17
|
-
'navigationArea' => 'area',
|
|
18
|
-
),
|
|
19
|
-
)
|
|
20
|
-
);
|
|
21
|
-
}
|
|
22
|
-
add_action( 'init', 'register_block_core_navigation_area' );
|