@wordpress/block-editor 12.3.4 → 12.5.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 +4 -0
- package/README.md +4 -0
- package/build/components/block-heading-level-dropdown/heading-level-icon.js +10 -2
- package/build/components/block-heading-level-dropdown/heading-level-icon.js.map +1 -1
- package/build/components/block-heading-level-dropdown/index.native.js +4 -3
- package/build/components/block-heading-level-dropdown/index.native.js.map +1 -1
- package/build/components/block-parent-selector/index.js +8 -5
- package/build/components/block-parent-selector/index.js.map +1 -1
- package/build/components/block-removal-warning-modal/index.js +18 -25
- package/build/components/block-removal-warning-modal/index.js.map +1 -1
- package/build/components/block-tools/block-contextual-toolbar.js +7 -11
- package/build/components/block-tools/block-contextual-toolbar.js.map +1 -1
- package/build/components/global-styles/color-panel.js +1 -1
- package/build/components/global-styles/color-panel.js.map +1 -1
- package/build/components/global-styles/hooks.js +2 -2
- package/build/components/global-styles/hooks.js.map +1 -1
- package/build/components/global-styles/typography-panel.js +34 -2
- package/build/components/global-styles/typography-panel.js.map +1 -1
- package/build/components/index.js +19 -1
- package/build/components/index.js.map +1 -1
- package/build/components/inserter/media-tab/hooks.js +2 -21
- package/build/components/inserter/media-tab/hooks.js.map +1 -1
- package/build/components/inserter/reusable-block-rename-hint.js +62 -0
- package/build/components/inserter/reusable-block-rename-hint.js.map +1 -0
- package/build/components/inserter/reusable-blocks-tab.js +5 -1
- package/build/components/inserter/reusable-blocks-tab.js.map +1 -1
- package/build/components/inserter/reusable-blocks-tab.native.js +2 -2
- package/build/components/inserter/reusable-blocks-tab.native.js.map +1 -1
- package/build/components/inserter/tabs.native.js +1 -1
- package/build/components/inserter/tabs.native.js.map +1 -1
- package/build/components/inserter-draggable-blocks/index.js +9 -1
- package/build/components/inserter-draggable-blocks/index.js.map +1 -1
- package/build/components/link-control/constants.js +1 -1
- package/build/components/link-control/constants.js.map +1 -1
- package/build/components/link-control/search-create-button.js +5 -21
- package/build/components/link-control/search-create-button.js.map +1 -1
- package/build/components/link-control/search-item.js +13 -30
- package/build/components/link-control/search-item.js.map +1 -1
- package/build/components/link-control/search-results.js +2 -2
- package/build/components/link-control/search-results.js.map +1 -1
- package/build/components/list-view/appender.js +2 -6
- package/build/components/list-view/appender.js.map +1 -1
- package/build/components/provider/index.js +5 -2
- package/build/components/provider/index.js.map +1 -1
- package/build/components/writing-flow/use-tab-nav.js +10 -27
- package/build/components/writing-flow/use-tab-nav.js.map +1 -1
- package/build/components/writing-mode-control/index.js +70 -0
- package/build/components/writing-mode-control/index.js.map +1 -0
- package/build/hooks/behaviors.js +25 -20
- package/build/hooks/behaviors.js.map +1 -1
- package/build/hooks/supports.js +7 -1
- package/build/hooks/supports.js.map +1 -1
- package/build/hooks/typography.js +2 -1
- package/build/hooks/typography.js.map +1 -1
- package/build/hooks/utils.js +4 -2
- package/build/hooks/utils.js.map +1 -1
- package/build/private-apis.js +3 -0
- package/build/private-apis.js.map +1 -1
- package/build/private-apis.native.js +3 -0
- package/build/private-apis.native.js.map +1 -1
- package/build/store/actions.js +195 -1
- package/build/store/actions.js.map +1 -1
- package/build/store/index.js +10 -1
- package/build/store/index.js.map +1 -1
- package/build/store/private-actions.js +46 -40
- package/build/store/private-actions.js.map +1 -1
- package/build/store/private-selectors.js +3 -3
- package/build/store/private-selectors.js.map +1 -1
- package/build/store/reducer.js +22 -8
- package/build/store/reducer.js.map +1 -1
- package/build/store/selectors.js +6 -4
- package/build/store/selectors.js.map +1 -1
- package/build-module/components/block-heading-level-dropdown/heading-level-icon.js +9 -2
- package/build-module/components/block-heading-level-dropdown/heading-level-icon.js.map +1 -1
- package/build-module/components/block-heading-level-dropdown/index.native.js +4 -3
- package/build-module/components/block-heading-level-dropdown/index.native.js.map +1 -1
- package/build-module/components/block-parent-selector/index.js +7 -5
- package/build-module/components/block-parent-selector/index.js.map +1 -1
- package/build-module/components/block-removal-warning-modal/index.js +19 -23
- package/build-module/components/block-removal-warning-modal/index.js.map +1 -1
- package/build-module/components/block-tools/block-contextual-toolbar.js +8 -11
- package/build-module/components/block-tools/block-contextual-toolbar.js.map +1 -1
- package/build-module/components/global-styles/color-panel.js +1 -1
- package/build-module/components/global-styles/color-panel.js.map +1 -1
- package/build-module/components/global-styles/hooks.js +2 -2
- package/build-module/components/global-styles/hooks.js.map +1 -1
- package/build-module/components/global-styles/typography-panel.js +33 -2
- package/build-module/components/global-styles/typography-panel.js.map +1 -1
- package/build-module/components/index.js +6 -0
- package/build-module/components/index.js.map +1 -1
- package/build-module/components/inserter/media-tab/hooks.js +2 -21
- package/build-module/components/inserter/media-tab/hooks.js.map +1 -1
- package/build-module/components/inserter/reusable-block-rename-hint.js +48 -0
- package/build-module/components/inserter/reusable-block-rename-hint.js.map +1 -0
- package/build-module/components/inserter/reusable-blocks-tab.js +4 -1
- package/build-module/components/inserter/reusable-blocks-tab.js.map +1 -1
- package/build-module/components/inserter/reusable-blocks-tab.native.js +2 -2
- package/build-module/components/inserter/reusable-blocks-tab.native.js.map +1 -1
- package/build-module/components/inserter/tabs.native.js +1 -1
- package/build-module/components/inserter/tabs.native.js.map +1 -1
- package/build-module/components/inserter-draggable-blocks/index.js +9 -2
- package/build-module/components/inserter-draggable-blocks/index.js.map +1 -1
- package/build-module/components/link-control/constants.js +1 -1
- package/build-module/components/link-control/constants.js.map +1 -1
- package/build-module/components/link-control/search-create-button.js +7 -20
- package/build-module/components/link-control/search-create-button.js.map +1 -1
- package/build-module/components/link-control/search-item.js +14 -28
- package/build-module/components/link-control/search-item.js.map +1 -1
- package/build-module/components/link-control/search-results.js +3 -3
- package/build-module/components/link-control/search-results.js.map +1 -1
- package/build-module/components/list-view/appender.js +2 -6
- package/build-module/components/list-view/appender.js.map +1 -1
- package/build-module/components/provider/index.js +5 -2
- package/build-module/components/provider/index.js.map +1 -1
- package/build-module/components/writing-flow/use-tab-nav.js +8 -26
- package/build-module/components/writing-flow/use-tab-nav.js.map +1 -1
- package/build-module/components/writing-mode-control/index.js +57 -0
- package/build-module/components/writing-mode-control/index.js.map +1 -0
- package/build-module/hooks/behaviors.js +26 -20
- package/build-module/hooks/behaviors.js.map +1 -1
- package/build-module/hooks/supports.js +7 -1
- package/build-module/hooks/supports.js.map +1 -1
- package/build-module/hooks/typography.js +2 -1
- package/build-module/hooks/typography.js.map +1 -1
- package/build-module/hooks/utils.js +4 -2
- package/build-module/hooks/utils.js.map +1 -1
- package/build-module/private-apis.js +2 -0
- package/build-module/private-apis.js.map +1 -1
- package/build-module/private-apis.native.js +2 -0
- package/build-module/private-apis.native.js.map +1 -1
- package/build-module/store/actions.js +191 -1
- package/build-module/store/actions.js.map +1 -1
- package/build-module/store/index.js +10 -1
- package/build-module/store/index.js.map +1 -1
- package/build-module/store/private-actions.js +45 -36
- package/build-module/store/private-actions.js.map +1 -1
- package/build-module/store/private-selectors.js +2 -2
- package/build-module/store/private-selectors.js.map +1 -1
- package/build-module/store/reducer.js +22 -8
- package/build-module/store/reducer.js.map +1 -1
- package/build-module/store/selectors.js +6 -4
- package/build-module/store/selectors.js.map +1 -1
- package/build-style/style-rtl.css +88 -81
- package/build-style/style.css +88 -81
- package/package.json +31 -31
- package/src/components/block-draggable/style.scss +1 -0
- package/src/components/block-heading-level-dropdown/heading-level-icon.js +6 -1
- package/src/components/block-heading-level-dropdown/index.native.js +8 -4
- package/src/components/block-inspector/style.scss +2 -1
- package/src/components/block-parent-selector/index.js +13 -8
- package/src/components/block-removal-warning-modal/index.js +16 -27
- package/src/components/block-tools/block-contextual-toolbar.js +5 -11
- package/src/components/block-tools/style.scss +69 -26
- package/src/components/font-family/README.md +71 -0
- package/src/components/global-styles/color-panel.js +1 -1
- package/src/components/global-styles/hooks.js +2 -0
- package/src/components/global-styles/typography-panel.js +40 -0
- package/src/components/index.js +6 -0
- package/src/components/inserter/media-tab/hooks.js +2 -22
- package/src/components/inserter/reusable-block-rename-hint.js +52 -0
- package/src/components/inserter/reusable-blocks-tab.js +4 -0
- package/src/components/inserter/reusable-blocks-tab.native.js +2 -2
- package/src/components/inserter/style.scss +28 -0
- package/src/components/inserter/tabs.native.js +5 -1
- package/src/components/inserter-draggable-blocks/index.js +13 -2
- package/src/components/link-control/constants.js +1 -1
- package/src/components/link-control/search-create-button.js +8 -26
- package/src/components/link-control/search-item.js +21 -43
- package/src/components/link-control/search-results.js +48 -46
- package/src/components/link-control/style.scss +18 -68
- package/src/components/link-control/test/index.js +6 -7
- package/src/components/list-view/appender.js +5 -6
- package/src/components/panel-color-settings/README.md +98 -0
- package/src/components/provider/index.js +9 -2
- package/src/components/recursion-provider/README.md +101 -0
- package/src/components/writing-flow/use-tab-nav.js +10 -33
- package/src/components/writing-mode-control/index.js +68 -0
- package/src/components/writing-mode-control/style.scss +18 -0
- package/src/hooks/behaviors.js +25 -16
- package/src/hooks/supports.js +7 -0
- package/src/hooks/typography.js +2 -0
- package/src/hooks/utils.js +3 -0
- package/src/private-apis.js +2 -0
- package/src/private-apis.native.js +2 -0
- package/src/store/actions.js +194 -1
- package/src/store/index.js +10 -0
- package/src/store/private-actions.js +39 -39
- package/src/store/private-selectors.js +2 -2
- package/src/store/reducer.js +22 -8
- package/src/store/selectors.js +9 -6
- package/src/store/test/actions.js +111 -0
- package/src/store/test/private-actions.js +56 -0
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = ReusableBlocksRenameHint;
|
|
7
|
+
|
|
8
|
+
var _element = require("@wordpress/element");
|
|
9
|
+
|
|
10
|
+
var _components = require("@wordpress/components");
|
|
11
|
+
|
|
12
|
+
var _data = require("@wordpress/data");
|
|
13
|
+
|
|
14
|
+
var _dom = require("@wordpress/dom");
|
|
15
|
+
|
|
16
|
+
var _i18n = require("@wordpress/i18n");
|
|
17
|
+
|
|
18
|
+
var _icons = require("@wordpress/icons");
|
|
19
|
+
|
|
20
|
+
var _preferences = require("@wordpress/preferences");
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* WordPress dependencies
|
|
24
|
+
*/
|
|
25
|
+
const PREFERENCE_NAME = 'isResuableBlocksrRenameHintVisible';
|
|
26
|
+
|
|
27
|
+
function ReusableBlocksRenameHint() {
|
|
28
|
+
const isReusableBlocksRenameHint = (0, _data.useSelect)(select => {
|
|
29
|
+
var _select$get;
|
|
30
|
+
|
|
31
|
+
return (_select$get = select(_preferences.store).get('core', PREFERENCE_NAME)) !== null && _select$get !== void 0 ? _select$get : true;
|
|
32
|
+
}, []);
|
|
33
|
+
const ref = (0, _element.useRef)();
|
|
34
|
+
const {
|
|
35
|
+
set: setPreference
|
|
36
|
+
} = (0, _data.useDispatch)(_preferences.store);
|
|
37
|
+
|
|
38
|
+
if (!isReusableBlocksRenameHint) {
|
|
39
|
+
return null;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
return (0, _element.createElement)("div", {
|
|
43
|
+
ref: ref,
|
|
44
|
+
className: "reusable-blocks-menu-items__rename-hint"
|
|
45
|
+
}, (0, _element.createElement)("div", {
|
|
46
|
+
className: "reusable-blocks-menu-items__rename-hint-content"
|
|
47
|
+
}, (0, _i18n.__)('Reusable blocks are now called patterns. A synced pattern will behave in exactly the same way as a reusable block.')), (0, _element.createElement)(_components.Button, {
|
|
48
|
+
className: "reusable-blocks-menu-items__rename-hint-dismiss",
|
|
49
|
+
icon: _icons.close,
|
|
50
|
+
iconSize: "16",
|
|
51
|
+
label: (0, _i18n.__)('Dismiss hint'),
|
|
52
|
+
onClick: () => {
|
|
53
|
+
// Retain focus when dismissing the element.
|
|
54
|
+
const previousElement = _dom.focus.tabbable.findPrevious(ref.current);
|
|
55
|
+
|
|
56
|
+
previousElement?.focus();
|
|
57
|
+
setPreference('core', PREFERENCE_NAME, false);
|
|
58
|
+
},
|
|
59
|
+
showTooltip: false
|
|
60
|
+
}));
|
|
61
|
+
}
|
|
62
|
+
//# sourceMappingURL=reusable-block-rename-hint.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-editor/src/components/inserter/reusable-block-rename-hint.js"],"names":["PREFERENCE_NAME","ReusableBlocksRenameHint","isReusableBlocksRenameHint","select","preferencesStore","get","ref","set","setPreference","close","previousElement","focus","tabbable","findPrevious","current"],"mappings":";;;;;;;AAMA;;AAHA;;AACA;;AACA;;AAEA;;AACA;;AACA;;AATA;AACA;AACA;AASA,MAAMA,eAAe,GAAG,oCAAxB;;AAEe,SAASC,wBAAT,GAAoC;AAClD,QAAMC,0BAA0B,GAAG,qBAChCC,MAAF;AAAA;;AAAA,0BACCA,MAAM,CAAEC,kBAAF,CAAN,CAA2BC,GAA3B,CAAgC,MAAhC,EAAwCL,eAAxC,CADD,qDAC8D,IAD9D;AAAA,GADkC,EAGlC,EAHkC,CAAnC;AAMA,QAAMM,GAAG,GAAG,sBAAZ;AAEA,QAAM;AAAEC,IAAAA,GAAG,EAAEC;AAAP,MAAyB,uBAAaJ,kBAAb,CAA/B;;AACA,MAAK,CAAEF,0BAAP,EAAoC;AACnC,WAAO,IAAP;AACA;;AAED,SACC;AAAK,IAAA,GAAG,EAAGI,GAAX;AAAiB,IAAA,SAAS,EAAC;AAA3B,KACC;AAAK,IAAA,SAAS,EAAC;AAAf,KACG,cACD,oHADC,CADH,CADD,EAMC,4BAAC,kBAAD;AACC,IAAA,SAAS,EAAC,iDADX;AAEC,IAAA,IAAI,EAAGG,YAFR;AAGC,IAAA,QAAQ,EAAC,IAHV;AAIC,IAAA,KAAK,EAAG,cAAI,cAAJ,CAJT;AAKC,IAAA,OAAO,EAAG,MAAM;AACf;AACA,YAAMC,eAAe,GAAGC,WAAMC,QAAN,CAAeC,YAAf,CACvBP,GAAG,CAACQ,OADmB,CAAxB;;AAGAJ,MAAAA,eAAe,EAAEC,KAAjB;AACAH,MAAAA,aAAa,CAAE,MAAF,EAAUR,eAAV,EAA2B,KAA3B,CAAb;AACA,KAZF;AAaC,IAAA,WAAW,EAAG;AAbf,IAND,CADD;AAwBA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { Button } from '@wordpress/components';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { focus } from '@wordpress/dom';\nimport { useRef } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport { close } from '@wordpress/icons';\nimport { store as preferencesStore } from '@wordpress/preferences';\n\nconst PREFERENCE_NAME = 'isResuableBlocksrRenameHintVisible';\n\nexport default function ReusableBlocksRenameHint() {\n\tconst isReusableBlocksRenameHint = useSelect(\n\t\t( select ) =>\n\t\t\tselect( preferencesStore ).get( 'core', PREFERENCE_NAME ) ?? true,\n\t\t[]\n\t);\n\n\tconst ref = useRef();\n\n\tconst { set: setPreference } = useDispatch( preferencesStore );\n\tif ( ! isReusableBlocksRenameHint ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<div ref={ ref } className=\"reusable-blocks-menu-items__rename-hint\">\n\t\t\t<div className=\"reusable-blocks-menu-items__rename-hint-content\">\n\t\t\t\t{ __(\n\t\t\t\t\t'Reusable blocks are now called patterns. A synced pattern will behave in exactly the same way as a reusable block.'\n\t\t\t\t) }\n\t\t\t</div>\n\t\t\t<Button\n\t\t\t\tclassName=\"reusable-blocks-menu-items__rename-hint-dismiss\"\n\t\t\t\ticon={ close }\n\t\t\t\ticonSize=\"16\"\n\t\t\t\tlabel={ __( 'Dismiss hint' ) }\n\t\t\t\tonClick={ () => {\n\t\t\t\t\t// Retain focus when dismissing the element.\n\t\t\t\t\tconst previousElement = focus.tabbable.findPrevious(\n\t\t\t\t\t\tref.current\n\t\t\t\t\t);\n\t\t\t\t\tpreviousElement?.focus();\n\t\t\t\t\tsetPreference( 'core', PREFERENCE_NAME, false );\n\t\t\t\t} }\n\t\t\t\tshowTooltip={ false }\n\t\t\t/>\n\t\t</div>\n\t);\n}\n"]}
|
|
@@ -24,6 +24,8 @@ var _noResults = _interopRequireDefault(require("./no-results"));
|
|
|
24
24
|
|
|
25
25
|
var _useBlockTypesState = _interopRequireDefault(require("./hooks/use-block-types-state"));
|
|
26
26
|
|
|
27
|
+
var _reusableBlockRenameHint = _interopRequireDefault(require("./reusable-block-rename-hint"));
|
|
28
|
+
|
|
27
29
|
/**
|
|
28
30
|
* WordPress dependencies
|
|
29
31
|
*/
|
|
@@ -74,7 +76,9 @@ function ReusableBlocksTab({
|
|
|
74
76
|
onInsert,
|
|
75
77
|
onHover
|
|
76
78
|
}) {
|
|
77
|
-
return (0, _element.createElement)(_element.Fragment, null, (0, _element.createElement)(
|
|
79
|
+
return (0, _element.createElement)(_element.Fragment, null, (0, _element.createElement)("div", {
|
|
80
|
+
className: "block-editor-inserter__hint"
|
|
81
|
+
}, (0, _element.createElement)(_reusableBlockRenameHint.default, null)), (0, _element.createElement)(ReusableBlocksList, {
|
|
78
82
|
onHover: onHover,
|
|
79
83
|
onInsert: onInsert,
|
|
80
84
|
rootClientId: rootClientId
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-editor/src/components/inserter/reusable-blocks-tab.js"],"names":["ReusableBlocksList","onHover","onInsert","rootClientId","items","onSelectItem","filteredItems","filter","category","length","ReusableBlocksTab","post_type"],"mappings":";;;;;;;;;;AAGA;;AACA;;AACA;;AACA;;AAKA;;AACA;;AACA;;AACA;;
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-editor/src/components/inserter/reusable-blocks-tab.js"],"names":["ReusableBlocksList","onHover","onInsert","rootClientId","items","onSelectItem","filteredItems","filter","category","length","ReusableBlocksTab","post_type"],"mappings":";;;;;;;;;;AAGA;;AACA;;AACA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AAfA;AACA;AACA;;AAMA;AACA;AACA;AAOA,SAASA,kBAAT,CAA6B;AAAEC,EAAAA,OAAF;AAAWC,EAAAA,QAAX;AAAqBC,EAAAA;AAArB,CAA7B,EAAmE;AAClE,QAAM,CAAEC,KAAF,IAAaC,YAAb,IAA8B,iCACnCF,YADmC,EAEnCD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'@wordpress/i18n';\nimport { addQueryArgs } from '@wordpress/url';\nimport { Button } from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport BlockTypesList from '../block-types-list';\nimport InserterPanel from './panel';\nimport InserterNoResults from './no-results';\nimport useBlockTypesState from './hooks/use-block-types-state';\nimport ReusableBlocksRenameHint from './reusable-block-rename-hint';\n\nfunction ReusableBlocksList( { onHover, onInsert, rootClientId } ) {\n\tconst [ items, , , onSelectItem ] = useBlockTypesState(\n\t\trootClientId,\n\t\tonInsert\n\t);\n\n\tconst filteredItems = useMemo( () => {\n\t\treturn items.filter( ( { category } ) => category === 'reusable' );\n\t}, [ items ] );\n\n\tif ( filteredItems.length === 0 ) {\n\t\treturn <InserterNoResults />;\n\t}\n\n\treturn (\n\t\t<InserterPanel title={ __( 'Synced patterns' ) }>\n\t\t\t<BlockTypesList\n\t\t\t\titems={ filteredItems }\n\t\t\t\tonSelect={ onSelectItem }\n\t\t\t\tonHover={ onHover }\n\t\t\t\tlabel={ __( 'Synced patterns' ) }\n\t\t\t/>\n\t\t</InserterPanel>\n\t);\n}\n\n// The unwrapped component is only exported for use by unit tests.\n/**\n * List of reusable blocks shown in the \"Reusable\" tab of the inserter.\n *\n * @param {Object} props Component props.\n * @param {?string} props.rootClientId Client id of block to insert into.\n * @param {Function} props.onInsert Callback to run when item is inserted.\n * @param {Function} props.onHover Callback to run when item is hovered.\n *\n * @return {WPComponent} The component.\n */\nexport function ReusableBlocksTab( { rootClientId, onInsert, onHover } ) {\n\treturn (\n\t\t<>\n\t\t\t<div className=\"block-editor-inserter__hint\">\n\t\t\t\t<ReusableBlocksRenameHint />\n\t\t\t</div>\n\t\t\t<ReusableBlocksList\n\t\t\t\tonHover={ onHover }\n\t\t\t\tonInsert={ onInsert }\n\t\t\t\trootClientId={ rootClientId }\n\t\t\t/>\n\t\t\t<div className=\"block-editor-inserter__manage-reusable-blocks-container\">\n\t\t\t\t<Button\n\t\t\t\t\tclassName=\"block-editor-inserter__manage-reusable-blocks\"\n\t\t\t\t\tvariant=\"secondary\"\n\t\t\t\t\thref={ addQueryArgs( 'edit.php', {\n\t\t\t\t\t\tpost_type: 'wp_block',\n\t\t\t\t\t} ) }\n\t\t\t\t>\n\t\t\t\t\t{ __( 'Manage my patterns' ) }\n\t\t\t\t</Button>\n\t\t\t</div>\n\t\t</>\n\t);\n}\n\nexport default ReusableBlocksTab;\n"]}
|
|
@@ -49,11 +49,11 @@ function ReusableBlocksTab({
|
|
|
49
49
|
items
|
|
50
50
|
})];
|
|
51
51
|
return (0, _element.createElement)(_blockTypesList.default, {
|
|
52
|
-
name: "
|
|
52
|
+
name: "SyncedPatterns",
|
|
53
53
|
sections: sections,
|
|
54
54
|
onSelect: onSelect,
|
|
55
55
|
listProps: listProps,
|
|
56
|
-
label: (0, _i18n.__)('
|
|
56
|
+
label: (0, _i18n.__)('Synced patterns')
|
|
57
57
|
});
|
|
58
58
|
}
|
|
59
59
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-editor/src/components/inserter/reusable-blocks-tab.native.js"],"names":["ReusableBlocksTab","onSelect","rootClientId","listProps","items","select","getInserterItems","blockEditorStore","allItems","onlyReusable","sections","key"],"mappings":";;;;;;;;;;;AAGA;;AACA;;AAKA;;AACA;;AACA;;AAXA;AACA;AACA;;AAIA;AACA;AACA;AAKA,SAASA,iBAAT,CAA4B;AAAEC,EAAAA,QAAF;AAAYC,EAAAA,YAAZ;AAA0BC,EAAAA;AAA1B,CAA5B,EAAoE;AACnE,QAAM;AAAEC,IAAAA;AAAF,MAAY,qBACfC,MAAF,IAAc;AACb,UAAM;AAAEC,MAAAA;AAAF,QAAuBD,MAAM,CAAEE,YAAF,CAAnC;AACA,UAAMC,QAAQ,GAAGF,gBAAgB,CAAEJ,YAAF,CAAjC;AAEA,WAAO;AACNE,MAAAA,KAAK,EAAE,gCAAqBI,QAArB,EAA+B;AAAEC,QAAAA,YAAY,EAAE;AAAhB,OAA/B;AADD,KAAP;AAGA,GARgB,EASjB,CAAEP,YAAF,CATiB,CAAlB;AAYA,QAAMQ,QAAQ,GAAG,CAAE,kCAAuB;AAAEC,IAAAA,GAAG,EAAE,WAAP;AAAoBP,IAAAA;AAApB,GAAvB,CAAF,CAAjB;AAEA,SACC,4BAAC,uBAAD;AACC,IAAA,IAAI,EAAC,gBADN;AAEC,IAAA,QAAQ,EAAGM,QAFZ;AAGC,IAAA,QAAQ,EAAGT,QAHZ;AAIC,IAAA,SAAS,EAAGE,SAJb;AAKC,IAAA,KAAK,EAAG,cAAI,iBAAJ;AALT,IADD;AASA;;eAEcH,iB","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport BlockTypesList from '../block-types-list';\nimport { store as blockEditorStore } from '../../store';\nimport { createInserterSection, filterInserterItems } from './utils';\n\nfunction ReusableBlocksTab( { onSelect, rootClientId, listProps } ) {\n\tconst { items } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getInserterItems } = select( blockEditorStore );\n\t\t\tconst allItems = getInserterItems( rootClientId );\n\n\t\t\treturn {\n\t\t\t\titems: filterInserterItems( allItems, { onlyReusable: true } ),\n\t\t\t};\n\t\t},\n\t\t[ rootClientId ]\n\t);\n\n\tconst sections = [ createInserterSection( { key: 'reuseable', items } ) ];\n\n\treturn (\n\t\t<BlockTypesList\n\t\t\tname=\"
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-editor/src/components/inserter/reusable-blocks-tab.native.js"],"names":["ReusableBlocksTab","onSelect","rootClientId","listProps","items","select","getInserterItems","blockEditorStore","allItems","onlyReusable","sections","key"],"mappings":";;;;;;;;;;;AAGA;;AACA;;AAKA;;AACA;;AACA;;AAXA;AACA;AACA;;AAIA;AACA;AACA;AAKA,SAASA,iBAAT,CAA4B;AAAEC,EAAAA,QAAF;AAAYC,EAAAA,YAAZ;AAA0BC,EAAAA;AAA1B,CAA5B,EAAoE;AACnE,QAAM;AAAEC,IAAAA;AAAF,MAAY,qBACfC,MAAF,IAAc;AACb,UAAM;AAAEC,MAAAA;AAAF,QAAuBD,MAAM,CAAEE,YAAF,CAAnC;AACA,UAAMC,QAAQ,GAAGF,gBAAgB,CAAEJ,YAAF,CAAjC;AAEA,WAAO;AACNE,MAAAA,KAAK,EAAE,gCAAqBI,QAArB,EAA+B;AAAEC,QAAAA,YAAY,EAAE;AAAhB,OAA/B;AADD,KAAP;AAGA,GARgB,EASjB,CAAEP,YAAF,CATiB,CAAlB;AAYA,QAAMQ,QAAQ,GAAG,CAAE,kCAAuB;AAAEC,IAAAA,GAAG,EAAE,WAAP;AAAoBP,IAAAA;AAApB,GAAvB,CAAF,CAAjB;AAEA,SACC,4BAAC,uBAAD;AACC,IAAA,IAAI,EAAC,gBADN;AAEC,IAAA,QAAQ,EAAGM,QAFZ;AAGC,IAAA,QAAQ,EAAGT,QAHZ;AAIC,IAAA,SAAS,EAAGE,SAJb;AAKC,IAAA,KAAK,EAAG,cAAI,iBAAJ;AALT,IADD;AASA;;eAEcH,iB","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport BlockTypesList from '../block-types-list';\nimport { store as blockEditorStore } from '../../store';\nimport { createInserterSection, filterInserterItems } from './utils';\n\nfunction ReusableBlocksTab( { onSelect, rootClientId, listProps } ) {\n\tconst { items } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getInserterItems } = select( blockEditorStore );\n\t\t\tconst allItems = getInserterItems( rootClientId );\n\n\t\t\treturn {\n\t\t\t\titems: filterInserterItems( allItems, { onlyReusable: true } ),\n\t\t\t};\n\t\t},\n\t\t[ rootClientId ]\n\t);\n\n\tconst sections = [ createInserterSection( { key: 'reuseable', items } ) ];\n\n\treturn (\n\t\t<BlockTypesList\n\t\t\tname=\"SyncedPatterns\"\n\t\t\tsections={ sections }\n\t\t\tonSelect={ onSelect }\n\t\t\tlistProps={ listProps }\n\t\t\tlabel={ __( 'Synced patterns' ) }\n\t\t/>\n\t);\n}\n\nexport default ReusableBlocksTab;\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-editor/src/components/inserter/tabs.native.js"],"names":["TAB_ANIMATION_DURATION","InserterTabs","listProps","onSelect","rootClientId","showReusableBlocks","tabIndex","tabAnimation","Animated","Value","current","lastScrollEvents","wrapperWidth","setWrapperWidth","onScroll","event","nativeEvent","onWrapperLayout","layout","width","timing","duration","toValue","useNativeDriver","start","lastScrollEvent","tabs","tabKeys","filteredTabs","getTabs","filter","name","keys","translateX","length","interpolate","inputRange","outputRange","map","key","containerStyle","styles","transform","component","TabComponent","index","TabsControl","onChangeTab","segments","title","segmentHandler","selectedTab","tabTitles","indexOf","Control","BlockTypesTab","ReusableBlocksTab"],"mappings":";;;;;;;;;AAQA;;AALA;;AAYA;;AACA;;AAKA;;AACA;;AACA;;AAvBA;AACA;AACA;;AAGA;AACA;AACA;;AAWA;AACA;AACA;AAKA,MAAMA,sBAAsB,GAAG,GAA/B;;AAEA,SAASC,YAAT,CAAuB;AACtBC,EAAAA,SADsB;AAEtBC,EAAAA,QAFsB;AAGtBC,EAAAA,YAHsB;AAItBC,EAAAA,kBAJsB;AAKtBC,EAAAA;AALsB,CAAvB,EAMI;AACH,QAAMC,YAAY,GAAG,qBAAQ,IAAIC,sBAASC,KAAb,CAAoB,CAApB,CAAR,EAAkCC,OAAvD;AACA,QAAMC,gBAAgB,GAAG,qBAAQ,EAAR,EAAaD,OAAtC;AACA,QAAM,CAAEE,YAAF,EAAgBC,eAAhB,IAAoC,uBAAU,CAAV,CAA1C;;AAEA,WAASC,QAAT,CAAmBC,KAAnB,EAA2B;AAC1BJ,IAAAA,gBAAgB,CAAEL,QAAF,CAAhB,GAA+BS,KAAK,CAACC,WAArC;AACAd,IAAAA,SAAS,CAACY,QAAV,CAAoBC,KAApB;AACA;;AAED,QAAME,eAAe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c,CAAjB;AAOA,QAAM6C,cAAc,GAAG,0BACpBC,WAAF,IAAmB;AAClB,UAAMC,SAAS,GAAG1B,IAAI,CAACY,GAAL,CAAU,CAAE;AAAEW,MAAAA;AAAF,KAAF,KAAiBA,KAA3B,CAAlB;AACAF,IAAAA,WAAW,CAAEK,SAAS,CAACC,OAAV,CAAmBF,WAAnB,CAAF,CAAX;AACA,GAJqB,EAKtB,CAAEJ,WAAF,CALsB,CAAvB;AAQA,SAAOC,QAAQ,CAACd,MAAT,GAAkB,CAAlB,GACN,4BAAC,4BAAD;AACC,IAAA,QAAQ,EAAGc,QADZ;AAEC,IAAA,cAAc,EAAGE;AAFlB,IADM,GAKH,IALJ;AAMA;;AAEDjD,YAAY,CAACqD,OAAb,GAAuBR,WAAvB;;AAEA7C,YAAY,CAAC4B,OAAb,GAAuB,MAAM,CAC5B;AAAEE,EAAAA,IAAI,EAAE,QAAR;AAAkBkB,EAAAA,KAAK,EAAE,cAAI,QAAJ,CAAzB;AAAyCN,EAAAA,SAAS,EAAEY;AAApD,CAD4B,EAE5B;
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-editor/src/components/inserter/tabs.native.js"],"names":["TAB_ANIMATION_DURATION","InserterTabs","listProps","onSelect","rootClientId","showReusableBlocks","tabIndex","tabAnimation","Animated","Value","current","lastScrollEvents","wrapperWidth","setWrapperWidth","onScroll","event","nativeEvent","onWrapperLayout","layout","width","timing","duration","toValue","useNativeDriver","start","lastScrollEvent","tabs","tabKeys","filteredTabs","getTabs","filter","name","keys","translateX","length","interpolate","inputRange","outputRange","map","key","containerStyle","styles","transform","component","TabComponent","index","TabsControl","onChangeTab","segments","title","segmentHandler","selectedTab","tabTitles","indexOf","Control","BlockTypesTab","ReusableBlocksTab"],"mappings":";;;;;;;;;AAQA;;AALA;;AAYA;;AACA;;AAKA;;AACA;;AACA;;AAvBA;AACA;AACA;;AAGA;AACA;AACA;;AAWA;AACA;AACA;AAKA,MAAMA,sBAAsB,GAAG,GAA/B;;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ADP;AAECkB,EAAAA,KAAK,EAAE,cAAI,iBAAJ,CAFR;AAGCN,EAAAA,SAAS,EAAEa;AAHZ,CAF4B,CAA7B;;eASevD,Y","sourcesContent":["/**\n * External dependencies\n */\nimport { Animated, View } from 'react-native';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tuseCallback,\n\tuseEffect,\n\tuseMemo,\n\tuseRef,\n\tuseState,\n} from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport { SegmentedControl } from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport BlockTypesTab from './block-types-tab';\nimport ReusableBlocksTab from './reusable-blocks-tab';\nimport styles from './style.scss';\n\nconst TAB_ANIMATION_DURATION = 250;\n\nfunction InserterTabs( {\n\tlistProps,\n\tonSelect,\n\trootClientId,\n\tshowReusableBlocks,\n\ttabIndex,\n} ) {\n\tconst tabAnimation = useRef( new Animated.Value( 0 ) ).current;\n\tconst lastScrollEvents = useRef( [] ).current;\n\tconst [ wrapperWidth, setWrapperWidth ] = useState( 0 );\n\n\tfunction onScroll( event ) {\n\t\tlastScrollEvents[ tabIndex ] = event.nativeEvent;\n\t\tlistProps.onScroll( event );\n\t}\n\n\tconst onWrapperLayout = useCallback(\n\t\t( { nativeEvent } ) => {\n\t\t\tsetWrapperWidth( nativeEvent.layout.width );\n\t\t},\n\t\t[ setWrapperWidth ]\n\t);\n\n\tuseEffect( () => {\n\t\tAnimated.timing( tabAnimation, {\n\t\t\tduration: TAB_ANIMATION_DURATION,\n\t\t\ttoValue: tabIndex,\n\t\t\tuseNativeDriver: true,\n\t\t} ).start();\n\n\t\t// Notify upstream with the last scroll event of the current tab.\n\t\tconst lastScrollEvent = lastScrollEvents[ tabIndex ];\n\t\tif ( lastScrollEvent ) {\n\t\t\tlistProps.onScroll( { nativeEvent: lastScrollEvent } );\n\t\t}\n\t}, [ tabIndex ] );\n\n\tconst { tabs, tabKeys } = useMemo( () => {\n\t\tconst filteredTabs = InserterTabs.getTabs().filter(\n\t\t\t( { name } ) => showReusableBlocks || name !== 'reusable'\n\t\t);\n\t\treturn {\n\t\t\ttabs: filteredTabs,\n\t\t\ttabKeys: [ ...filteredTabs.keys() ],\n\t\t};\n\t}, [ showReusableBlocks ] );\n\n\tconst translateX = useMemo(\n\t\t() =>\n\t\t\ttabKeys.length > 1\n\t\t\t\t? tabAnimation.interpolate( {\n\t\t\t\t\t\tinputRange: tabKeys,\n\t\t\t\t\t\toutputRange: tabKeys.map(\n\t\t\t\t\t\t\t( key ) => key * -wrapperWidth\n\t\t\t\t\t\t),\n\t\t\t\t } )\n\t\t\t\t: tabAnimation,\n\t\t[ tabAnimation, tabKeys, wrapperWidth ]\n\t);\n\n\tconst containerStyle = [\n\t\tstyles[ 'inserter-tabs__container' ],\n\t\t{\n\t\t\twidth: wrapperWidth * tabKeys.length,\n\t\t\ttransform: [ { translateX } ],\n\t\t},\n\t];\n\n\treturn (\n\t\t<View\n\t\t\tstyle={ styles[ 'inserter-tabs__wrapper' ] }\n\t\t\tonLayout={ onWrapperLayout }\n\t\t>\n\t\t\t<Animated.View style={ containerStyle }>\n\t\t\t\t{ tabs.map( ( { component: TabComponent }, index ) => (\n\t\t\t\t\t<View key={ `tab-${ index }` }>\n\t\t\t\t\t\t<TabComponent\n\t\t\t\t\t\t\trootClientId={ rootClientId }\n\t\t\t\t\t\t\tonSelect={ onSelect }\n\t\t\t\t\t\t\tlistProps={ { ...listProps, onScroll } }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</View>\n\t\t\t\t) ) }\n\t\t\t</Animated.View>\n\t\t</View>\n\t);\n}\n\nfunction TabsControl( { onChangeTab, showReusableBlocks } ) {\n\tconst tabs = InserterTabs.getTabs();\n\tconst segments = useMemo( () => {\n\t\tconst filteredTabs = tabs.filter(\n\t\t\t( { name } ) => showReusableBlocks || name !== 'reusable'\n\t\t);\n\t\treturn filteredTabs.map( ( { title } ) => title );\n\t}, [ showReusableBlocks ] );\n\n\tconst segmentHandler = useCallback(\n\t\t( selectedTab ) => {\n\t\t\tconst tabTitles = tabs.map( ( { title } ) => title );\n\t\t\tonChangeTab( tabTitles.indexOf( selectedTab ) );\n\t\t},\n\t\t[ onChangeTab ]\n\t);\n\n\treturn segments.length > 1 ? (\n\t\t<SegmentedControl\n\t\t\tsegments={ segments }\n\t\t\tsegmentHandler={ segmentHandler }\n\t\t/>\n\t) : null;\n}\n\nInserterTabs.Control = TabsControl;\n\nInserterTabs.getTabs = () => [\n\t{ name: 'blocks', title: __( 'Blocks' ), component: BlockTypesTab },\n\t{\n\t\tname: 'reusable',\n\t\ttitle: __( 'Synced patterns' ),\n\t\tcomponent: ReusableBlocksTab,\n\t},\n];\n\nexport default InserterTabs;\n"]}
|
|
@@ -13,6 +13,8 @@ var _components = require("@wordpress/components");
|
|
|
13
13
|
|
|
14
14
|
var _blocks = require("@wordpress/blocks");
|
|
15
15
|
|
|
16
|
+
var _data = require("@wordpress/data");
|
|
17
|
+
|
|
16
18
|
var _draggableChip = _interopRequireDefault(require("../block-draggable/draggable-chip"));
|
|
17
19
|
|
|
18
20
|
/**
|
|
@@ -33,6 +35,12 @@ const InserterDraggableBlocks = ({
|
|
|
33
35
|
type: 'inserter',
|
|
34
36
|
blocks
|
|
35
37
|
};
|
|
38
|
+
const blockTypeIcon = (0, _data.useSelect)(select => {
|
|
39
|
+
const {
|
|
40
|
+
getBlockType
|
|
41
|
+
} = select(_blocks.store);
|
|
42
|
+
return blocks.length === 1 && getBlockType(blocks[0].name)?.icon;
|
|
43
|
+
}, [blocks]);
|
|
36
44
|
return (0, _element.createElement)(_components.Draggable, {
|
|
37
45
|
__experimentalTransferDataType: "wp-blocks",
|
|
38
46
|
transferData: transferData,
|
|
@@ -41,7 +49,7 @@ const InserterDraggableBlocks = ({
|
|
|
41
49
|
},
|
|
42
50
|
__experimentalDragComponent: (0, _element.createElement)(_draggableChip.default, {
|
|
43
51
|
count: blocks.length,
|
|
44
|
-
icon: icon,
|
|
52
|
+
icon: icon || !isPattern && blockTypeIcon,
|
|
45
53
|
isPattern: isPattern
|
|
46
54
|
})
|
|
47
55
|
}, ({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-editor/src/components/inserter-draggable-blocks/index.js"],"names":["InserterDraggableBlocks","isEnabled","blocks","icon","children","isPattern","transferData","type","
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-editor/src/components/inserter-draggable-blocks/index.js"],"names":["InserterDraggableBlocks","isEnabled","blocks","icon","children","isPattern","transferData","type","blockTypeIcon","select","getBlockType","blocksStore","length","name","event","dataTransfer","setData","onDraggableStart","onDraggableEnd","draggable","onDragStart","undefined","onDragEnd"],"mappings":";;;;;;;;;;;AAGA;;AACA;;AACA;;AAIA;;AATA;AACA;AACA;;AAIA;AACA;AACA;AAGA,MAAMA,uBAAuB,GAAG,CAAE;AACjCC,EAAAA,SADiC;AAEjCC,EAAAA,MAFiC;AAGjCC,EAAAA,IAHiC;AAIjCC,EAAAA,QAJiC;AAKjCC,EAAAA;AALiC,CAAF,KAMzB;AACN,QAAMC,YAAY,GAAG;AACpBC,IAAAA,IAAI,EAAE,UADc;AAEpBL,IAAAA;AAFoB,GAArB;AAKA,QAAMM,aAAa,GAAG,qBACnBC,MAAF,IAAc;AACb,UAAM;AAAEC,MAAAA;AAAF,QAAmBD,MAAM,CAAEE,aAAF,CAA/B;AACA,WACCT,MAAM,CAACU,MAAP,KAAkB,CAAlB,IAAuBF,YAAY,CAAER,MAAM,CAAE,CAAF,CAAN,CAAYW,IAAd,CAAZ,EAAkCV,IAD1D;AAGA,GANoB,EAOrB,CAAED,MAAF,CAPqB,CAAtB;AAUA,SACC,4BAAC,qBAAD;AACC,IAAA,8BAA8B,EAAC,WADhC;AAEC,IAAA,YAAY,EAAGI,YAFhB;AAGC,IAAA,WAAW,EAAKQ,KAAF,IAAa;AAC1BA,MAAAA,KAAK,CAACC,YAAN,CAAmBC,OAAnB,CAA4B,WAA5B,EAAyC,uBAAWd,MAAX,CAAzC;AACA,KALF;AAMC,IAAA,2BAA2B,EAC1B,4BAAC,sBAAD;AACC,MAAA,KAAK,EAAGA,MAAM,CAACU,MADhB;AAEC,MAAA,IAAI,EAAGT,IAAI,IAAM,CAAEE,SAAF,IAAeG,aAFjC;AAGC,MAAA,SAAS,EAAGH;AAHb;AAPF,KAcG,CAAE;AAAEY,IAAAA,gBAAF;AAAoBC,IAAAA;AAApB,GAAF,KAA4C;AAC7C,WAAOd,QAAQ,CAAE;AAChBe,MAAAA,SAAS,EAAElB,SADK;AAEhBmB,MAAAA,WAAW,EAAEnB,SAAS,GAAGgB,gBAAH,GAAsBI,SAF5B;AAGhBC,MAAAA,SAAS,EAAErB,SAAS,GAAGiB,cAAH,GAAoBG;AAHxB,KAAF,CAAf;AAKA,GApBF,CADD;AAwBA,CA9CD;;eAgDerB,uB","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { Draggable } from '@wordpress/components';\nimport { serialize, store as blocksStore } from '@wordpress/blocks';\nimport { useSelect } from '@wordpress/data';\n/**\n * Internal dependencies\n */\nimport BlockDraggableChip from '../block-draggable/draggable-chip';\n\nconst InserterDraggableBlocks = ( {\n\tisEnabled,\n\tblocks,\n\ticon,\n\tchildren,\n\tisPattern,\n} ) => {\n\tconst transferData = {\n\t\ttype: 'inserter',\n\t\tblocks,\n\t};\n\n\tconst blockTypeIcon = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getBlockType } = select( blocksStore );\n\t\t\treturn (\n\t\t\t\tblocks.length === 1 && getBlockType( blocks[ 0 ].name )?.icon\n\t\t\t);\n\t\t},\n\t\t[ blocks ]\n\t);\n\n\treturn (\n\t\t<Draggable\n\t\t\t__experimentalTransferDataType=\"wp-blocks\"\n\t\t\ttransferData={ transferData }\n\t\t\tonDragStart={ ( event ) => {\n\t\t\t\tevent.dataTransfer.setData( 'text/html', serialize( blocks ) );\n\t\t\t} }\n\t\t\t__experimentalDragComponent={\n\t\t\t\t<BlockDraggableChip\n\t\t\t\t\tcount={ blocks.length }\n\t\t\t\t\ticon={ icon || ( ! isPattern && blockTypeIcon ) }\n\t\t\t\t\tisPattern={ isPattern }\n\t\t\t\t/>\n\t\t\t}\n\t\t>\n\t\t\t{ ( { onDraggableStart, onDraggableEnd } ) => {\n\t\t\t\treturn children( {\n\t\t\t\t\tdraggable: isEnabled,\n\t\t\t\t\tonDragStart: isEnabled ? onDraggableStart : undefined,\n\t\t\t\t\tonDragEnd: isEnabled ? onDraggableEnd : undefined,\n\t\t\t\t} );\n\t\t\t} }\n\t\t</Draggable>\n\t);\n};\n\nexport default InserterDraggableBlocks;\n"]}
|
|
@@ -17,7 +17,7 @@ const CREATE_TYPE = '__CREATE__';
|
|
|
17
17
|
exports.CREATE_TYPE = CREATE_TYPE;
|
|
18
18
|
const TEL_TYPE = 'tel';
|
|
19
19
|
exports.TEL_TYPE = TEL_TYPE;
|
|
20
|
-
const URL_TYPE = '
|
|
20
|
+
const URL_TYPE = 'link';
|
|
21
21
|
exports.URL_TYPE = URL_TYPE;
|
|
22
22
|
const MAILTO_TYPE = 'mailto';
|
|
23
23
|
exports.MAILTO_TYPE = MAILTO_TYPE;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-editor/src/components/link-control/constants.js"],"names":["CREATE_TYPE","TEL_TYPE","URL_TYPE","MAILTO_TYPE","INTERNAL_TYPE","LINK_ENTRY_TYPES","DEFAULT_LINK_SETTINGS","id","title"],"mappings":";;;;;;;AAGA;;AAHA;AACA;AACA;AAGA;AACA;AACA;AACO,MAAMA,WAAW,GAAG,YAApB;;AACA,MAAMC,QAAQ,GAAG,KAAjB;;AACA,MAAMC,QAAQ,GAAG,
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-editor/src/components/link-control/constants.js"],"names":["CREATE_TYPE","TEL_TYPE","URL_TYPE","MAILTO_TYPE","INTERNAL_TYPE","LINK_ENTRY_TYPES","DEFAULT_LINK_SETTINGS","id","title"],"mappings":";;;;;;;AAGA;;AAHA;AACA;AACA;AAGA;AACA;AACA;AACO,MAAMA,WAAW,GAAG,YAApB;;AACA,MAAMC,QAAQ,GAAG,KAAjB;;AACA,MAAMC,QAAQ,GAAG,MAAjB;;AACA,MAAMC,WAAW,GAAG,QAApB;;AACA,MAAMC,aAAa,GAAG,UAAtB;;AAEA,MAAMC,gBAAgB,GAAG,CAC/BH,QAD+B,EAE/BC,WAF+B,EAG/BF,QAH+B,EAI/BG,aAJ+B,CAAzB;;AAOA,MAAME,qBAAqB,GAAG,CACpC;AACCC,EAAAA,EAAE,EAAE,eADL;AAECC,EAAAA,KAAK,EAAE,cAAI,iBAAJ;AAFR,CADoC,CAA9B","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\n\n// Used as a unique identifier for the \"Create\" option within search results.\n// Used to help distinguish the \"Create\" suggestion within the search results in\n// order to handle it as a unique case.\nexport const CREATE_TYPE = '__CREATE__';\nexport const TEL_TYPE = 'tel';\nexport const URL_TYPE = 'link';\nexport const MAILTO_TYPE = 'mailto';\nexport const INTERNAL_TYPE = 'internal';\n\nexport const LINK_ENTRY_TYPES = [\n\tURL_TYPE,\n\tMAILTO_TYPE,\n\tTEL_TYPE,\n\tINTERNAL_TYPE,\n];\n\nexport const DEFAULT_LINK_SETTINGS = [\n\t{\n\t\tid: 'opensInNewTab',\n\t\ttitle: __( 'Open in new tab' ),\n\t},\n];\n"]}
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
3
|
Object.defineProperty(exports, "__esModule", {
|
|
6
4
|
value: true
|
|
7
5
|
});
|
|
@@ -9,18 +7,12 @@ exports.default = exports.LinkControlSearchCreate = void 0;
|
|
|
9
7
|
|
|
10
8
|
var _element = require("@wordpress/element");
|
|
11
9
|
|
|
12
|
-
var _classnames = _interopRequireDefault(require("classnames"));
|
|
13
|
-
|
|
14
10
|
var _i18n = require("@wordpress/i18n");
|
|
15
11
|
|
|
16
12
|
var _components = require("@wordpress/components");
|
|
17
13
|
|
|
18
14
|
var _icons = require("@wordpress/icons");
|
|
19
15
|
|
|
20
|
-
/**
|
|
21
|
-
* External dependencies
|
|
22
|
-
*/
|
|
23
|
-
|
|
24
16
|
/**
|
|
25
17
|
* WordPress dependencies
|
|
26
18
|
*/
|
|
@@ -28,7 +20,6 @@ const LinkControlSearchCreate = ({
|
|
|
28
20
|
searchTerm,
|
|
29
21
|
onClick,
|
|
30
22
|
itemProps,
|
|
31
|
-
isSelected,
|
|
32
23
|
buttonText
|
|
33
24
|
}) => {
|
|
34
25
|
if (!searchTerm) {
|
|
@@ -47,19 +38,12 @@ const LinkControlSearchCreate = ({
|
|
|
47
38
|
});
|
|
48
39
|
}
|
|
49
40
|
|
|
50
|
-
return (0, _element.createElement)(_components.
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
41
|
+
return (0, _element.createElement)(_components.MenuItem, { ...itemProps,
|
|
42
|
+
iconPosition: "left",
|
|
43
|
+
icon: _icons.plus,
|
|
44
|
+
className: "block-editor-link-control__search-item",
|
|
54
45
|
onClick: onClick
|
|
55
|
-
},
|
|
56
|
-
className: "block-editor-link-control__search-item-icon",
|
|
57
|
-
icon: _icons.plus
|
|
58
|
-
}), (0, _element.createElement)("span", {
|
|
59
|
-
className: "block-editor-link-control__search-item-header"
|
|
60
|
-
}, (0, _element.createElement)("span", {
|
|
61
|
-
className: "block-editor-link-control__search-item-title"
|
|
62
|
-
}, text)));
|
|
46
|
+
}, text);
|
|
63
47
|
};
|
|
64
48
|
|
|
65
49
|
exports.LinkControlSearchCreate = LinkControlSearchCreate;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-editor/src/components/link-control/search-create-button.js"],"names":["LinkControlSearchCreate","searchTerm","onClick","itemProps","
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-editor/src/components/link-control/search-create-button.js"],"names":["LinkControlSearchCreate","searchTerm","onClick","itemProps","buttonText","text","mark","plus"],"mappings":";;;;;;;AAKA;;AAFA;;AACA;;AAEA;;AANA;AACA;AACA;AAMO,MAAMA,uBAAuB,GAAG,CAAE;AACxCC,EAAAA,UADwC;AAExCC,EAAAA,OAFwC;AAGxCC,EAAAA,SAHwC;AAIxCC,EAAAA;AAJwC,CAAF,KAKhC;AACN,MAAK,CAAEH,UAAP,EAAoB;AACnB,WAAO,IAAP;AACA;;AAED,MAAII,IAAJ;;AACA,MAAKD,UAAL,EAAkB;AACjBC,IAAAA,IAAI,GACH,OAAOD,UAAP,KAAsB,UAAtB,GACGA,UAAU,CAAEH,UAAF,CADb,GAEGG,UAHJ;AAIA,GALD,MAKO;AACNC,IAAAA,IAAI,GAAG,uCACN;AACC;AACA,kBAAI,yBAAJ,CAFD,EAGCJ,UAHD,CADM,EAMN;AAAEK,MAAAA,IAAI,EAAE;AAAR,KANM,CAAP;AAQA;;AAED,SACC,4BAAC,oBAAD,OACMH,SADN;AAEC,IAAA,YAAY,EAAC,MAFd;AAGC,IAAA,IAAI,EAAGI,WAHR;AAIC,IAAA,SAAS,EAAC,wCAJX;AAKC,IAAA,OAAO,EAAGL;AALX,KAOGG,IAPH,CADD;AAWA,CAtCM;;;eAwCQL,uB","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, sprintf } from '@wordpress/i18n';\nimport { MenuItem } from '@wordpress/components';\nimport { createInterpolateElement } from '@wordpress/element';\nimport { plus } from '@wordpress/icons';\n\nexport const LinkControlSearchCreate = ( {\n\tsearchTerm,\n\tonClick,\n\titemProps,\n\tbuttonText,\n} ) => {\n\tif ( ! searchTerm ) {\n\t\treturn null;\n\t}\n\n\tlet text;\n\tif ( buttonText ) {\n\t\ttext =\n\t\t\ttypeof buttonText === 'function'\n\t\t\t\t? buttonText( searchTerm )\n\t\t\t\t: buttonText;\n\t} else {\n\t\ttext = createInterpolateElement(\n\t\t\tsprintf(\n\t\t\t\t/* translators: %s: search term. */\n\t\t\t\t__( 'Create: <mark>%s</mark>' ),\n\t\t\t\tsearchTerm\n\t\t\t),\n\t\t\t{ mark: <mark /> }\n\t\t);\n\t}\n\n\treturn (\n\t\t<MenuItem\n\t\t\t{ ...itemProps }\n\t\t\ticonPosition=\"left\"\n\t\t\ticon={ plus }\n\t\t\tclassName=\"block-editor-link-control__search-item\"\n\t\t\tonClick={ onClick }\n\t\t>\n\t\t\t{ text }\n\t\t</MenuItem>\n\t);\n};\n\nexport default LinkControlSearchCreate;\n"]}
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
3
|
Object.defineProperty(exports, "__esModule", {
|
|
6
4
|
value: true
|
|
7
5
|
});
|
|
@@ -9,10 +7,6 @@ exports.default = exports.LinkControlSearchItem = void 0;
|
|
|
9
7
|
|
|
10
8
|
var _element = require("@wordpress/element");
|
|
11
9
|
|
|
12
|
-
var _classnames = _interopRequireDefault(require("classnames"));
|
|
13
|
-
|
|
14
|
-
var _url = require("@wordpress/url");
|
|
15
|
-
|
|
16
10
|
var _i18n = require("@wordpress/i18n");
|
|
17
11
|
|
|
18
12
|
var _components = require("@wordpress/components");
|
|
@@ -21,9 +15,7 @@ var _icons = require("@wordpress/icons");
|
|
|
21
15
|
|
|
22
16
|
var _dom = require("@wordpress/dom");
|
|
23
17
|
|
|
24
|
-
|
|
25
|
-
* External dependencies
|
|
26
|
-
*/
|
|
18
|
+
var _url = require("@wordpress/url");
|
|
27
19
|
|
|
28
20
|
/**
|
|
29
21
|
* WordPress dependencies
|
|
@@ -61,36 +53,27 @@ function SearchItemIcon({
|
|
|
61
53
|
const LinkControlSearchItem = ({
|
|
62
54
|
itemProps,
|
|
63
55
|
suggestion,
|
|
64
|
-
|
|
56
|
+
searchTerm,
|
|
65
57
|
onClick,
|
|
66
58
|
isURL = false,
|
|
67
|
-
searchTerm = '',
|
|
68
59
|
shouldShowType = false
|
|
69
60
|
}) => {
|
|
70
|
-
|
|
61
|
+
const info = isURL ? (0, _i18n.__)('Press ENTER to add this link') : (0, _url.filterURLForDisplay)((0, _url.safeDecodeURI)(suggestion?.url));
|
|
62
|
+
return (0, _element.createElement)(_components.MenuItem, { ...itemProps,
|
|
63
|
+
info: info,
|
|
64
|
+
iconPosition: "left",
|
|
65
|
+
icon: (0, _element.createElement)(SearchItemIcon, {
|
|
66
|
+
suggestion: suggestion,
|
|
67
|
+
isURL: isURL
|
|
68
|
+
}),
|
|
71
69
|
onClick: onClick,
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
'is-url': isURL,
|
|
75
|
-
'is-entity': !isURL
|
|
76
|
-
})
|
|
77
|
-
}, (0, _element.createElement)(SearchItemIcon, {
|
|
78
|
-
suggestion: suggestion,
|
|
79
|
-
isURL: isURL
|
|
80
|
-
}), (0, _element.createElement)("span", {
|
|
81
|
-
className: "block-editor-link-control__search-item-header"
|
|
82
|
-
}, (0, _element.createElement)("span", {
|
|
83
|
-
className: "block-editor-link-control__search-item-title"
|
|
70
|
+
shortcut: shouldShowType && getVisualTypeName(suggestion),
|
|
71
|
+
className: "block-editor-link-control__search-item"
|
|
84
72
|
}, (0, _element.createElement)(_components.TextHighlight // The component expects a plain text string.
|
|
85
73
|
, {
|
|
86
74
|
text: (0, _dom.__unstableStripHTML)(suggestion.title),
|
|
87
75
|
highlight: searchTerm
|
|
88
|
-
}))
|
|
89
|
-
"aria-hidden": !isURL,
|
|
90
|
-
className: "block-editor-link-control__search-item-info"
|
|
91
|
-
}, !isURL && ((0, _url.filterURLForDisplay)((0, _url.safeDecodeURI)(suggestion.url)) || ''), isURL && (0, _i18n.__)('Press ENTER to add this link'))), shouldShowType && suggestion.type && (0, _element.createElement)("span", {
|
|
92
|
-
className: "block-editor-link-control__search-item-type"
|
|
93
|
-
}, getVisualTypeName(suggestion)));
|
|
76
|
+
}));
|
|
94
77
|
};
|
|
95
78
|
|
|
96
79
|
exports.LinkControlSearchItem = LinkControlSearchItem;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-editor/src/components/link-control/search-item.js"],"names":["ICONS_MAP","post","postList","page","post_tag","tag","category","attachment","file","SearchItemIcon","isURL","suggestion","icon","globe","type","LinkControlSearchItem","itemProps","
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-editor/src/components/link-control/search-item.js"],"names":["ICONS_MAP","post","postList","page","post_tag","tag","category","attachment","file","SearchItemIcon","isURL","suggestion","icon","globe","type","LinkControlSearchItem","itemProps","searchTerm","onClick","shouldShowType","info","url","getVisualTypeName","title","isFrontPage"],"mappings":";;;;;;;;;AAGA;;AACA;;AACA;;AASA;;AACA;;AAfA;AACA;AACA;AAeA,MAAMA,SAAS,GAAG;AACjBC,EAAAA,IAAI,EAAEC,eADW;AAEjBC,EAAAA,IAAI,EAAJA,WAFiB;AAGjBC,EAAAA,QAAQ,EAAEC,UAHO;AAIjBC,EAAAA,QAAQ,EAARA,eAJiB;AAKjBC,EAAAA,UAAU,EAAEC;AALK,CAAlB;;AAQA,SAASC,cAAT,CAAyB;AAAEC,EAAAA,KAAF;AAASC,EAAAA;AAAT,CAAzB,EAAiD;AAChD,MAAIC,IAAI,GAAG,IAAX;;AAEA,MAAKF,KAAL,EAAa;AACZE,IAAAA,IAAI,GAAGC,YAAP;AACA,GAFD,MAEO,IAAKF,UAAU,CAACG,IAAX,IAAmBd,SAAxB,EAAoC;AAC1CY,IAAAA,IAAI,GAAGZ,SAAS,CAAEW,UAAU,CAACG,IAAb,CAAhB;AACA;;AAED,MAAKF,IAAL,EAAY;AACX,WACC,4BAAC,WAAD;AACC,MAAA,SAAS,EAAC,6CADX;AAEC,MAAA,IAAI,EAAGA;AAFR,MADD;AAMA;;AAED,SAAO,IAAP;AACA;;AAEM,MAAMG,qBAAqB,GAAG,CAAE;AACtCC,EAAAA,SADsC;AAEtCL,EAAAA,UAFsC;AAGtCM,EAAAA,UAHsC;AAItCC,EAAAA,OAJsC;AAKtCR,EAAAA,KAAK,GAAG,KAL8B;AAMtCS,EAAAA,cAAc,GAAG;AANqB,CAAF,KAO9B;AACN,QAAMC,IAAI,GAAGV,KAAK,GACf,cAAI,8BAAJ,CADe,GAEf,8BAAqB,wBAAeC,UAAU,EAAEU,GAA3B,CAArB,CAFH;AAIA,SACC,4BAAC,oBAAD,OACML,SADN;AAEC,IAAA,IAAI,EAAGI,IAFR;AAGC,IAAA,YAAY,EAAC,MAHd;AAIC,IAAA,IAAI,EACH,4BAAC,cAAD;AAAgB,MAAA,UAAU,EAAGT,UAA7B;AAA0C,MAAA,KAAK,EAAGD;AAAlD,MALF;AAOC,IAAA,OAAO,EAAGQ,OAPX;AAQC,IAAA,QAAQ,EAAGC,cAAc,IAAIG,iBAAiB,CAAEX,UAAF,CAR/C;AASC,IAAA,SAAS,EAAC;AATX,KAWC,4BAAC,yBAAD,CACC;AADD;AAEC,IAAA,IAAI,EAAG,8BAAWA,UAAU,CAACY,KAAtB,CAFR;AAGC,IAAA,SAAS,EAAGN;AAHb,IAXD,CADD;AAmBA,CA/BM;;;;AAiCP,SAASK,iBAAT,CAA4BX,UAA5B,EAAyC;AACxC,MAAKA,UAAU,CAACa,WAAhB,EAA8B;AAC7B,WAAO,YAAP;AACA,GAHuC,CAKxC;;;AACA,SAAOb,UAAU,CAACG,IAAX,KAAoB,UAApB,GAAiC,KAAjC,GAAyCH,UAAU,CAACG,IAA3D;AACA;;eAEcC,qB","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { MenuItem, TextHighlight } from '@wordpress/components';\nimport {\n\tIcon,\n\tglobe,\n\tpage,\n\ttag,\n\tpostList,\n\tcategory,\n\tfile,\n} from '@wordpress/icons';\nimport { __unstableStripHTML as stripHTML } from '@wordpress/dom';\nimport { safeDecodeURI, filterURLForDisplay } from '@wordpress/url';\n\nconst ICONS_MAP = {\n\tpost: postList,\n\tpage,\n\tpost_tag: tag,\n\tcategory,\n\tattachment: file,\n};\n\nfunction SearchItemIcon( { isURL, suggestion } ) {\n\tlet icon = null;\n\n\tif ( isURL ) {\n\t\ticon = globe;\n\t} else if ( suggestion.type in ICONS_MAP ) {\n\t\ticon = ICONS_MAP[ suggestion.type ];\n\t}\n\n\tif ( icon ) {\n\t\treturn (\n\t\t\t<Icon\n\t\t\t\tclassName=\"block-editor-link-control__search-item-icon\"\n\t\t\t\ticon={ icon }\n\t\t\t/>\n\t\t);\n\t}\n\n\treturn null;\n}\n\nexport const LinkControlSearchItem = ( {\n\titemProps,\n\tsuggestion,\n\tsearchTerm,\n\tonClick,\n\tisURL = false,\n\tshouldShowType = false,\n} ) => {\n\tconst info = isURL\n\t\t? __( 'Press ENTER to add this link' )\n\t\t: filterURLForDisplay( safeDecodeURI( suggestion?.url ) );\n\n\treturn (\n\t\t<MenuItem\n\t\t\t{ ...itemProps }\n\t\t\tinfo={ info }\n\t\t\ticonPosition=\"left\"\n\t\t\ticon={\n\t\t\t\t<SearchItemIcon suggestion={ suggestion } isURL={ isURL } />\n\t\t\t}\n\t\t\tonClick={ onClick }\n\t\t\tshortcut={ shouldShowType && getVisualTypeName( suggestion ) }\n\t\t\tclassName=\"block-editor-link-control__search-item\"\n\t\t>\n\t\t\t<TextHighlight\n\t\t\t\t// The component expects a plain text string.\n\t\t\t\ttext={ stripHTML( suggestion.title ) }\n\t\t\t\thighlight={ searchTerm }\n\t\t\t/>\n\t\t</MenuItem>\n\t);\n};\n\nfunction getVisualTypeName( suggestion ) {\n\tif ( suggestion.isFrontPage ) {\n\t\treturn 'front page';\n\t}\n\n\t// Rename 'post_tag' to 'tag'. Ideally, the API would return the localised CPT or taxonomy label.\n\treturn suggestion.type === 'post_tag' ? 'tag' : suggestion.type;\n}\n\nexport default LinkControlSearchItem;\n"]}
|
|
@@ -70,7 +70,7 @@ function LinkControlSearchResults({
|
|
|
70
70
|
}, searchResultsLabel, (0, _element.createElement)("div", { ...suggestionsListProps,
|
|
71
71
|
className: resultsListClasses,
|
|
72
72
|
"aria-labelledby": searchResultsLabelId
|
|
73
|
-
}, suggestions.map((suggestion, index) => {
|
|
73
|
+
}, (0, _element.createElement)(_components.MenuGroup, null, suggestions.map((suggestion, index) => {
|
|
74
74
|
if (shouldShowCreateSuggestion && _constants.CREATE_TYPE === suggestion.type) {
|
|
75
75
|
return (0, _element.createElement)(_searchCreateButton.default, {
|
|
76
76
|
searchTerm: currentInputValue,
|
|
@@ -105,6 +105,6 @@ function LinkControlSearchResults({
|
|
|
105
105
|
shouldShowType: shouldShowSuggestionsTypes,
|
|
106
106
|
isFrontPage: suggestion?.isFrontPage
|
|
107
107
|
});
|
|
108
|
-
})));
|
|
108
|
+
}))));
|
|
109
109
|
}
|
|
110
110
|
//# sourceMappingURL=search-results.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-editor/src/components/link-control/search-results.js"],"names":["LinkControlSearchResults","instanceId","withCreateSuggestion","currentInputValue","handleSuggestionClick","suggestionsListProps","buildSuggestionItemProps","suggestions","selectedSuggestion","isLoading","isInitialSuggestions","createSuggestionButtonText","suggestionsQuery","resultsListClasses","isSingleDirectEntryResult","length","LINK_ENTRY_TYPES","includes","type","shouldShowCreateSuggestion","shouldShowSuggestionsTypes","searchResultsLabelId","labelText","searchResultsLabel","map","suggestion","index","CREATE_TYPE","id","isFrontPage"],"mappings":";;;;;;;;;;;AAGA;;AACA;;AAKA;;AAKA;;AACA;;AACA;;AAhBA;AACA;AACA;;AAIA;AACA;AACA;;AAGA;AACA;AACA;AAKe,SAASA,wBAAT,CAAmC;AACjDC,EAAAA,UADiD;AAEjDC,EAAAA,oBAFiD;AAGjDC,EAAAA,iBAHiD;AAIjDC,EAAAA,qBAJiD;AAKjDC,EAAAA,oBALiD;AAMjDC,EAAAA,wBANiD;AAOjDC,EAAAA,WAPiD;AAQjDC,EAAAA,kBARiD;AASjDC,EAAAA,SATiD;AAUjDC,EAAAA,oBAViD;AAWjDC,EAAAA,0BAXiD;AAYjDC,EAAAA;AAZiD,CAAnC,EAaX;AACH,QAAMC,kBAAkB,GAAG,yBAC1B,2CAD0B,EAE1B;AACC,kBAAcJ;AADf,GAF0B,CAA3B;;AAOA,QAAMK,yBAAyB,GAC9BP,WAAW,CAACQ,MAAZ,KAAuB,CAAvB,IACAC,4BAAiBC,QAAjB,CAA2BV,WAAW,CAAE,CAAF,CAAX,CAAiBW,IAA5C,CAFD;;AAGA,QAAMC,0BAA0B,GAC/BjB,oBAAoB,IACpB,CAAEY,yBADF,IAEA,CAAEJ,oBAHH,CAXG,CAeH;;AACA,QAAMU,0BAA0B,GAAG,CAAER,gBAAgB,EAAEM,IAAvD,CAhBG,CAkBH;AACA;AACA;;AACA,QAAMG,oBAAoB,GAAI,kDAAkDpB,UAAY,EAA5F;AACA,QAAMqB,SAAS,GAAGZ,oBAAoB,GACnC,cAAI,aAAJ,CADmC,GAEnC;AACA;AACA,gBAAI,yBAAJ,CAFA,EAGAP,iBAHA,CAFH;AAOA,QAAMoB,kBAAkB,GACvB,4BAAC,0BAAD;AAAgB,IAAA,EAAE,EAAGF;AAArB,KACGC,SADH,CADD;AAMA,SACC;AAAK,IAAA,SAAS,EAAC;AAAf,KACGC,kBADH,EAEC,wCACMlB,oBADN;AAEC,IAAA,SAAS,EAAGQ,kBAFb;AAGC,uBAAkBQ;AAHnB,
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-editor/src/components/link-control/search-results.js"],"names":["LinkControlSearchResults","instanceId","withCreateSuggestion","currentInputValue","handleSuggestionClick","suggestionsListProps","buildSuggestionItemProps","suggestions","selectedSuggestion","isLoading","isInitialSuggestions","createSuggestionButtonText","suggestionsQuery","resultsListClasses","isSingleDirectEntryResult","length","LINK_ENTRY_TYPES","includes","type","shouldShowCreateSuggestion","shouldShowSuggestionsTypes","searchResultsLabelId","labelText","searchResultsLabel","map","suggestion","index","CREATE_TYPE","id","isFrontPage"],"mappings":";;;;;;;;;;;AAGA;;AACA;;AAKA;;AAKA;;AACA;;AAC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EAAcC,KAAd,KAAyB;AAC3C,QACCP,0BAA0B,IAC1BQ,2BAAgBF,UAAU,CAACP,IAF5B,EAGE;AACD,aACC,4BAAC,2BAAD;AACC,QAAA,UAAU,EAAGf,iBADd;AAEC,QAAA,UAAU,EAAGQ,0BAFd;AAGC,QAAA,OAAO,EAAG,MACTP,qBAAqB,CAAEqB,UAAF,CAJvB,CAMC;AACA;AACA;AARD;AASC,QAAA,GAAG,EAAGA,UAAU,CAACP,IATlB;AAUC,QAAA,SAAS,EAAGZ,wBAAwB,CACnCmB,UADmC,EAEnCC,KAFmC,CAVrC;AAcC,QAAA,UAAU,EAAGA,KAAK,KAAKlB;AAdxB,QADD;AAkBA,KAvB0C,CAyB3C;AACA;;;AACA,QAAKmB,2BAAgBF,UAAU,CAACP,IAAhC,EAAuC;AACtC,aAAO,IAAP;AACA;;AAED,WACC,4BAAC,mBAAD;AACC,MAAA,GAAG,EAAI,GAAGO,UAAU,CAACG,EAAI,IAAIH,UAAU,CAACP,IAAM,EAD/C;AAEC,MAAA,SAAS,EAAGZ,wBAAwB,CACnCmB,UADmC,EAEnCC,KAFmC,CAFrC;AAMC,MAAA,UAAU,EAAGD,UANd;AAOC,MAAA,KAAK,EAAGC,KAPT;AAQC,MAAA,OAAO,EAAG,MAAM;AACftB,QAAAA,qBAAqB,CAAEqB,UAAF,CAArB;AACA,OAVF;AAWC,MAAA,UAAU,EAAGC,KAAK,KAAKlB,kBAXxB;AAYC,MAAA,KAAK,EAAGQ,4BAAiBC,QAAjB,CACPQ,UAAU,CAACP,IADJ,CAZT;AAeC,MAAA,UAAU,EAAGf,iBAfd;AAgBC,MAAA,cAAc,EAAGiB,0BAhBlB;AAiBC,MAAA,WAAW,EAAGK,UAAU,EAAEI;AAjB3B,MADD;AAqBA,GApDC,CADH,CALD,CAFD,CADD;AAkEA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, sprintf } from '@wordpress/i18n';\nimport { VisuallyHidden, MenuGroup } from '@wordpress/components';\n\n/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * Internal dependencies\n */\nimport LinkControlSearchCreate from './search-create-button';\nimport LinkControlSearchItem from './search-item';\nimport { CREATE_TYPE, LINK_ENTRY_TYPES } from './constants';\n\nexport default function LinkControlSearchResults( {\n\tinstanceId,\n\twithCreateSuggestion,\n\tcurrentInputValue,\n\thandleSuggestionClick,\n\tsuggestionsListProps,\n\tbuildSuggestionItemProps,\n\tsuggestions,\n\tselectedSuggestion,\n\tisLoading,\n\tisInitialSuggestions,\n\tcreateSuggestionButtonText,\n\tsuggestionsQuery,\n} ) {\n\tconst resultsListClasses = classnames(\n\t\t'block-editor-link-control__search-results',\n\t\t{\n\t\t\t'is-loading': isLoading,\n\t\t}\n\t);\n\n\tconst isSingleDirectEntryResult =\n\t\tsuggestions.length === 1 &&\n\t\tLINK_ENTRY_TYPES.includes( suggestions[ 0 ].type );\n\tconst shouldShowCreateSuggestion =\n\t\twithCreateSuggestion &&\n\t\t! isSingleDirectEntryResult &&\n\t\t! isInitialSuggestions;\n\t// If the query has a specified type, then we can skip showing them in the result. See #24839.\n\tconst shouldShowSuggestionsTypes = ! suggestionsQuery?.type;\n\n\t// According to guidelines aria-label should be added if the label\n\t// itself is not visible.\n\t// See: https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles/listbox_role\n\tconst searchResultsLabelId = `block-editor-link-control-search-results-label-${ instanceId }`;\n\tconst labelText = isInitialSuggestions\n\t\t? __( 'Suggestions' )\n\t\t: sprintf(\n\t\t\t\t/* translators: %s: search term. */\n\t\t\t\t__( 'Search results for \"%s\"' ),\n\t\t\t\tcurrentInputValue\n\t\t );\n\tconst searchResultsLabel = (\n\t\t<VisuallyHidden id={ searchResultsLabelId }>\n\t\t\t{ labelText }\n\t\t</VisuallyHidden>\n\t);\n\n\treturn (\n\t\t<div className=\"block-editor-link-control__search-results-wrapper\">\n\t\t\t{ searchResultsLabel }\n\t\t\t<div\n\t\t\t\t{ ...suggestionsListProps }\n\t\t\t\tclassName={ resultsListClasses }\n\t\t\t\taria-labelledby={ searchResultsLabelId }\n\t\t\t>\n\t\t\t\t<MenuGroup>\n\t\t\t\t\t{ suggestions.map( ( suggestion, index ) => {\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\tshouldShowCreateSuggestion &&\n\t\t\t\t\t\t\tCREATE_TYPE === suggestion.type\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t<LinkControlSearchCreate\n\t\t\t\t\t\t\t\t\tsearchTerm={ currentInputValue }\n\t\t\t\t\t\t\t\t\tbuttonText={ createSuggestionButtonText }\n\t\t\t\t\t\t\t\t\tonClick={ () =>\n\t\t\t\t\t\t\t\t\t\thandleSuggestionClick( suggestion )\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t// Intentionally only using `type` here as\n\t\t\t\t\t\t\t\t\t// the constant is enough to uniquely\n\t\t\t\t\t\t\t\t\t// identify the single \"CREATE\" suggestion.\n\t\t\t\t\t\t\t\t\tkey={ suggestion.type }\n\t\t\t\t\t\t\t\t\titemProps={ buildSuggestionItemProps(\n\t\t\t\t\t\t\t\t\t\tsuggestion,\n\t\t\t\t\t\t\t\t\t\tindex\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\tisSelected={ index === selectedSuggestion }\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\n\t\t\t\t\t\t// If we're not handling \"Create\" suggestions above then\n\t\t\t\t\t\t// we don't want them in the main results so exit early.\n\t\t\t\t\t\tif ( CREATE_TYPE === suggestion.type ) {\n\t\t\t\t\t\t\treturn null;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t<LinkControlSearchItem\n\t\t\t\t\t\t\t\tkey={ `${ suggestion.id }-${ suggestion.type }` }\n\t\t\t\t\t\t\t\titemProps={ buildSuggestionItemProps(\n\t\t\t\t\t\t\t\t\tsuggestion,\n\t\t\t\t\t\t\t\t\tindex\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\tsuggestion={ suggestion }\n\t\t\t\t\t\t\t\tindex={ index }\n\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\thandleSuggestionClick( suggestion );\n\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\tisSelected={ index === selectedSuggestion }\n\t\t\t\t\t\t\t\tisURL={ LINK_ENTRY_TYPES.includes(\n\t\t\t\t\t\t\t\t\tsuggestion.type\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\tsearchTerm={ currentInputValue }\n\t\t\t\t\t\t\t\tshouldShowType={ shouldShowSuggestionsTypes }\n\t\t\t\t\t\t\t\tisFrontPage={ suggestion?.isFrontPage }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t);\n\t\t\t\t\t} ) }\n\t\t\t\t</MenuGroup>\n\t\t\t</div>\n\t\t</div>\n\t);\n}\n"]}
|
|
@@ -45,16 +45,12 @@ const Appender = (0, _element.forwardRef)(({
|
|
|
45
45
|
setInsertedBlock
|
|
46
46
|
} = (0, _context.useListViewContext)();
|
|
47
47
|
const instanceId = (0, _compose.useInstanceId)(Appender);
|
|
48
|
-
const {
|
|
49
|
-
hideInserter
|
|
50
|
-
} = (0, _data.useSelect)(select => {
|
|
48
|
+
const hideInserter = (0, _data.useSelect)(select => {
|
|
51
49
|
const {
|
|
52
50
|
getTemplateLock,
|
|
53
51
|
__unstableGetEditorMode
|
|
54
52
|
} = select(_store.store);
|
|
55
|
-
return
|
|
56
|
-
hideInserter: !!getTemplateLock(clientId) || __unstableGetEditorMode() === 'zoom-out'
|
|
57
|
-
};
|
|
53
|
+
return !!getTemplateLock(clientId) || __unstableGetEditorMode() === 'zoom-out';
|
|
58
54
|
}, [clientId]);
|
|
59
55
|
const blockTitle = (0, _useBlockDisplayTitle.default)({
|
|
60
56
|
clientId,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-editor/src/components/list-view/appender.js"],"names":["Appender","nestingLevel","blockCount","clientId","props","ref","insertedBlock","setInsertedBlock","instanceId","hideInserter","select","getTemplateLock","__unstableGetEditorMode","blockEditorStore","blockTitle","context","insertedBlockTitle","length","descriptionId","description","maybeInsertedBlock"],"mappings":";;;;;;;;;AAMA;;AAHA;;AACA;;AACA;;AAEA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AAhBA;AACA;AACA;;AAOA;AACA;AACA;AAOO,MAAMA,QAAQ,GAAG,yBACvB,CAAE;AAAEC,EAAAA,YAAF;AAAgBC,EAAAA,UAAhB;AAA4BC,EAAAA,QAA5B;AAAsC,KAAGC;AAAzC,CAAF,EAAoDC,GAApD,KAA6D;AAC5D,QAAM;AAAEC,IAAAA,aAAF;AAAiBC,IAAAA;AAAjB,MAAsC,kCAA5C;AAEA,QAAMC,UAAU,GAAG,4BAAeR,QAAf,CAAnB;AACA,
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-editor/src/components/list-view/appender.js"],"names":["Appender","nestingLevel","blockCount","clientId","props","ref","insertedBlock","setInsertedBlock","instanceId","hideInserter","select","getTemplateLock","__unstableGetEditorMode","blockEditorStore","blockTitle","context","insertedBlockTitle","length","descriptionId","description","maybeInsertedBlock"],"mappings":";;;;;;;;;AAMA;;AAHA;;AACA;;AACA;;AAEA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AAhBA;AACA;AACA;;AAOA;AACA;AACA;AAOO,MAAMA,QAAQ,GAAG,yBACvB,CAAE;AAAEC,EAAAA,YAAF;AAAgBC,EAAAA,UAAhB;AAA4BC,EAAAA,QAA5B;AAAsC,KAAGC;AAAzC,CAAF,EAAoDC,GAApD,KAA6D;AAC5D,QAAM;AAAEC,IAAAA,aAAF;AAAiBC,IAAAA;AAAjB,MAAsC,kCAA5C;AAEA,QAAMC,UAAU,GAAG,4BAAeR,QAAf,CAAnB;AACA,QAAMS,YAAY,GAAG,qBAClB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BAAF,IAA0B;AAC3C,UAAKA,kBAAkB,EAAEjB,QAAzB,EAAoC;AACnCI,QAAAA,gBAAgB,CAAEa,kBAAF,CAAhB;AACA;AACD;AAdF,IADD,EAiBC,4BAAC,2BAAD;AAAoB,IAAA,EAAE,EAAGF;AAAzB,KACGC,WADH,CAjBD,CADD;AAuBA,CA/EsB,CAAjB","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useInstanceId } from '@wordpress/compose';\nimport { speak } from '@wordpress/a11y';\nimport { useSelect } from '@wordpress/data';\nimport { forwardRef, useEffect } from '@wordpress/element';\nimport { __, sprintf } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../../store';\nimport useBlockDisplayTitle from '../block-title/use-block-display-title';\nimport { useListViewContext } from './context';\nimport Inserter from '../inserter';\nimport AriaReferencedText from './aria-referenced-text';\n\nexport const Appender = forwardRef(\n\t( { nestingLevel, blockCount, clientId, ...props }, ref ) => {\n\t\tconst { insertedBlock, setInsertedBlock } = useListViewContext();\n\n\t\tconst instanceId = useInstanceId( Appender );\n\t\tconst hideInserter = useSelect(\n\t\t\t( select ) => {\n\t\t\t\tconst { getTemplateLock, __unstableGetEditorMode } =\n\t\t\t\t\tselect( blockEditorStore );\n\n\t\t\t\treturn (\n\t\t\t\t\t!! getTemplateLock( clientId ) ||\n\t\t\t\t\t__unstableGetEditorMode() === 'zoom-out'\n\t\t\t\t);\n\t\t\t},\n\t\t\t[ clientId ]\n\t\t);\n\n\t\tconst blockTitle = useBlockDisplayTitle( {\n\t\t\tclientId,\n\t\t\tcontext: 'list-view',\n\t\t} );\n\n\t\tconst insertedBlockTitle = useBlockDisplayTitle( {\n\t\t\tclientId: insertedBlock?.clientId,\n\t\t\tcontext: 'list-view',\n\t\t} );\n\n\t\tuseEffect( () => {\n\t\t\tif ( ! insertedBlockTitle?.length ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tspeak(\n\t\t\t\tsprintf(\n\t\t\t\t\t// translators: %s: name of block being inserted (i.e. Paragraph, Image, Group etc)\n\t\t\t\t\t__( '%s block inserted' ),\n\t\t\t\t\tinsertedBlockTitle\n\t\t\t\t),\n\t\t\t\t'assertive'\n\t\t\t);\n\t\t}, [ insertedBlockTitle ] );\n\n\t\tif ( hideInserter ) {\n\t\t\treturn null;\n\t\t}\n\n\t\tconst descriptionId = `list-view-appender__${ instanceId }`;\n\t\tconst description = sprintf(\n\t\t\t/* translators: 1: The name of the block. 2: The numerical position of the block. 3: The level of nesting for the block. */\n\t\t\t__( 'Append to %1$s block at position %2$d, Level %3$d' ),\n\t\t\tblockTitle,\n\t\t\tblockCount + 1,\n\t\t\tnestingLevel\n\t\t);\n\n\t\treturn (\n\t\t\t<div className=\"list-view-appender\">\n\t\t\t\t<Inserter\n\t\t\t\t\tref={ ref }\n\t\t\t\t\trootClientId={ clientId }\n\t\t\t\t\tposition=\"bottom right\"\n\t\t\t\t\tisAppender\n\t\t\t\t\tselectBlockOnInsert={ false }\n\t\t\t\t\tshouldDirectInsert={ false }\n\t\t\t\t\t__experimentalIsQuick\n\t\t\t\t\t{ ...props }\n\t\t\t\t\ttoggleProps={ { 'aria-describedby': descriptionId } }\n\t\t\t\t\tonSelectOrClose={ ( maybeInsertedBlock ) => {\n\t\t\t\t\t\tif ( maybeInsertedBlock?.clientId ) {\n\t\t\t\t\t\t\tsetInsertedBlock( maybeInsertedBlock );\n\t\t\t\t\t\t}\n\t\t\t\t\t} }\n\t\t\t\t/>\n\t\t\t\t<AriaReferencedText id={ descriptionId }>\n\t\t\t\t\t{ description }\n\t\t\t\t</AriaReferencedText>\n\t\t\t</div>\n\t\t);\n\t}\n);\n"]}
|
|
@@ -42,8 +42,11 @@ const ExperimentalBlockEditorProvider = (0, _withRegistryProvider.default)(props
|
|
|
42
42
|
(0, _element.useEffect)(() => {
|
|
43
43
|
__experimentalUpdateSettings({ ...settings,
|
|
44
44
|
__internalIsInitialized: true
|
|
45
|
-
},
|
|
46
|
-
|
|
45
|
+
}, {
|
|
46
|
+
stripExperimentalSettings,
|
|
47
|
+
reset: true
|
|
48
|
+
});
|
|
49
|
+
}, [settings, stripExperimentalSettings, __experimentalUpdateSettings]); // Syncs the entity provider with changes in the block-editor store.
|
|
47
50
|
|
|
48
51
|
(0, _useBlockSync.default)(props);
|
|
49
52
|
return (0, _element.createElement)(_blockRefsProvider.BlockRefsProvider, null, children);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-editor/src/components/provider/index.js"],"names":["ExperimentalBlockEditorProvider","props","children","settings","stripExperimentalSettings","__experimentalUpdateSettings","blockEditorStore","__internalIsInitialized","BlockEditorProvider"],"mappings":";;;;;;;;;AAIA;;AADA;;AAMA;;AACA;;AACA;;AACA;;AACA;;AAbA;AACA;AACA;;AAIA;AACA;AACA;;AAOA;AAEO,MAAMA,+BAA+B,GAAG,mCAC5CC,KAAF,IAAa;AACZ,QAAM;AAAEC,IAAAA,QAAF;AAAYC,IAAAA,QAAZ;AAAsBC,IAAAA,yBAAyB,GAAG;AAAlD,MAA4DH,KAAlE;AAEA,QAAM;AAAEI,IAAAA;AAAF,MAAmC,wBACxC,uBAAaC,YAAb,CADwC,CAAzC;AAGA,0BAAW,MAAM;AAChBD,IAAAA,4BAA4B,CAC3B,EACC,GAAGF,QADJ;AAECI,MAAAA,uBAAuB,EAAE;AAF1B,KAD2B,
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-editor/src/components/provider/index.js"],"names":["ExperimentalBlockEditorProvider","props","children","settings","stripExperimentalSettings","__experimentalUpdateSettings","blockEditorStore","__internalIsInitialized","reset","BlockEditorProvider"],"mappings":";;;;;;;;;AAIA;;AADA;;AAMA;;AACA;;AACA;;AACA;;AACA;;AAbA;AACA;AACA;;AAIA;AACA;AACA;;AAOA;AAEO,MAAMA,+BAA+B,GAAG,mCAC5CC,KAAF,IAAa;AACZ,QAAM;AAAEC,IAAAA,QAAF;AAAYC,IAAAA,QAAZ;AAAsBC,IAAAA,yBAAyB,GAAG;AAAlD,MAA4DH,KAAlE;AAEA,QAAM;AAAEI,IAAAA;AAAF,MAAmC,wBACxC,uBAAaC,YAAb,CADwC,CAAzC;AAGA,0BAAW,MAAM;AAChBD,IAAAA,4BAA4B,CAC3B,EACC,GAAGF,QADJ;AAECI,MAAAA,uBAAuB,EAAE;AAF1B,KAD2B,EAK3B;AACCH,MAAAA,yBADD;AAECI,MAAAA,KAAK,EAAE;AAFR,KAL2B,CAA5B;AAUA,GAXD,EAWG,CACFL,QADE,EAEFC,yBAFE,EAGFC,4BAHE,CAXH,EANY,CAuBZ;;AACA,6BAAcJ,KAAd;AAEA,SAAO,4BAAC,oCAAD,QAAqBC,QAArB,CAAP;AACA,CA5B6C,CAAxC;;;AA+BA,MAAMO,mBAAmB,GAAKR,KAAF,IAAa;AAC/C,SACC,4BAAC,+BAAD,OACMA,KADN;AAEC,IAAA,yBAAyB,EAAG;AAF7B,KAIGA,KAAK,CAACC,QAJT,CADD;AAQA,CATM;;;eAWQO,mB","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useDispatch } from '@wordpress/data';\nimport { useEffect } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport withRegistryProvider from './with-registry-provider';\nimport useBlockSync from './use-block-sync';\nimport { store as blockEditorStore } from '../../store';\nimport { BlockRefsProvider } from './block-refs-provider';\nimport { unlock } from '../../lock-unlock';\n\n/** @typedef {import('@wordpress/data').WPDataRegistry} WPDataRegistry */\n\nexport const ExperimentalBlockEditorProvider = withRegistryProvider(\n\t( props ) => {\n\t\tconst { children, settings, stripExperimentalSettings = false } = props;\n\n\t\tconst { __experimentalUpdateSettings } = unlock(\n\t\t\tuseDispatch( blockEditorStore )\n\t\t);\n\t\tuseEffect( () => {\n\t\t\t__experimentalUpdateSettings(\n\t\t\t\t{\n\t\t\t\t\t...settings,\n\t\t\t\t\t__internalIsInitialized: true,\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tstripExperimentalSettings,\n\t\t\t\t\treset: true,\n\t\t\t\t}\n\t\t\t);\n\t\t}, [\n\t\t\tsettings,\n\t\t\tstripExperimentalSettings,\n\t\t\t__experimentalUpdateSettings,\n\t\t] );\n\n\t\t// Syncs the entity provider with changes in the block-editor store.\n\t\tuseBlockSync( props );\n\n\t\treturn <BlockRefsProvider>{ children }</BlockRefsProvider>;\n\t}\n);\n\nexport const BlockEditorProvider = ( props ) => {\n\treturn (\n\t\t<ExperimentalBlockEditorProvider\n\t\t\t{ ...props }\n\t\t\tstripExperimentalSettings={ true }\n\t\t>\n\t\t\t{ props.children }\n\t\t</ExperimentalBlockEditorProvider>\n\t);\n};\n\nexport default BlockEditorProvider;\n"]}
|