@wordpress/block-editor 15.4.1-next.f56bd8138.0 → 15.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.
Files changed (106) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/build/components/background-image-control/index.js +51 -24
  3. package/build/components/background-image-control/index.js.map +1 -1
  4. package/build/components/block-edit/edit.js +13 -5
  5. package/build/components/block-edit/edit.js.map +1 -1
  6. package/build/components/block-list/block.js +14 -4
  7. package/build/components/block-list/block.js.map +1 -1
  8. package/build/components/block-list/use-block-props/index.js +5 -4
  9. package/build/components/block-list/use-block-props/index.js.map +1 -1
  10. package/build/components/block-settings-menu-controls/index.js +10 -2
  11. package/build/components/block-settings-menu-controls/index.js.map +1 -1
  12. package/build/components/block-toolbar/index.js +5 -0
  13. package/build/components/block-toolbar/index.js.map +1 -1
  14. package/build/components/block-visibility/index.js +21 -0
  15. package/build/components/block-visibility/index.js.map +1 -0
  16. package/build/components/block-visibility/menu-item.js +52 -0
  17. package/build/components/block-visibility/menu-item.js.map +1 -0
  18. package/build/components/block-visibility/toolbar.js +88 -0
  19. package/build/components/block-visibility/toolbar.js.map +1 -0
  20. package/build/components/inspector-controls-tabs/index.js +23 -0
  21. package/build/components/inspector-controls-tabs/index.js.map +1 -1
  22. package/build/components/link-control/index.js +1 -1
  23. package/build/components/link-control/index.js.map +1 -1
  24. package/build/components/list-view/block-select-button.js +23 -4
  25. package/build/components/list-view/block-select-button.js.map +1 -1
  26. package/build/components/list-view/block.js +9 -3
  27. package/build/components/list-view/block.js.map +1 -1
  28. package/build/components/rich-text/index.js +4 -2
  29. package/build/components/rich-text/index.js.map +1 -1
  30. package/build/components/use-block-drop-zone/index.js +5 -1
  31. package/build/components/use-block-drop-zone/index.js.map +1 -1
  32. package/build/hooks/block-bindings.js +9 -4
  33. package/build/hooks/block-bindings.js.map +1 -1
  34. package/build/store/private-selectors.js +19 -1
  35. package/build/store/private-selectors.js.map +1 -1
  36. package/build/store/reducer.js +1 -5
  37. package/build/store/reducer.js.map +1 -1
  38. package/build/utils/block-bindings.js +3 -48
  39. package/build/utils/block-bindings.js.map +1 -1
  40. package/build-module/components/background-image-control/index.js +52 -25
  41. package/build-module/components/background-image-control/index.js.map +1 -1
  42. package/build-module/components/block-edit/edit.js +14 -6
  43. package/build-module/components/block-edit/edit.js.map +1 -1
  44. package/build-module/components/block-list/block.js +14 -4
  45. package/build-module/components/block-list/block.js.map +1 -1
  46. package/build-module/components/block-list/use-block-props/index.js +5 -4
  47. package/build-module/components/block-list/use-block-props/index.js.map +1 -1
  48. package/build-module/components/block-settings-menu-controls/index.js +10 -2
  49. package/build-module/components/block-settings-menu-controls/index.js.map +1 -1
  50. package/build-module/components/block-toolbar/index.js +5 -0
  51. package/build-module/components/block-toolbar/index.js.map +1 -1
  52. package/build-module/components/block-visibility/index.js +3 -0
  53. package/build-module/components/block-visibility/index.js.map +1 -0
  54. package/build-module/components/block-visibility/menu-item.js +45 -0
  55. package/build-module/components/block-visibility/menu-item.js.map +1 -0
  56. package/build-module/components/block-visibility/toolbar.js +81 -0
  57. package/build-module/components/block-visibility/toolbar.js.map +1 -0
  58. package/build-module/components/inspector-controls-tabs/index.js +23 -0
  59. package/build-module/components/inspector-controls-tabs/index.js.map +1 -1
  60. package/build-module/components/link-control/index.js +1 -1
  61. package/build-module/components/link-control/index.js.map +1 -1
  62. package/build-module/components/list-view/block-select-button.js +24 -5
  63. package/build-module/components/list-view/block-select-button.js.map +1 -1
  64. package/build-module/components/list-view/block.js +9 -3
  65. package/build-module/components/list-view/block.js.map +1 -1
  66. package/build-module/components/rich-text/index.js +4 -2
  67. package/build-module/components/rich-text/index.js.map +1 -1
  68. package/build-module/components/use-block-drop-zone/index.js +6 -2
  69. package/build-module/components/use-block-drop-zone/index.js.map +1 -1
  70. package/build-module/hooks/block-bindings.js +10 -5
  71. package/build-module/hooks/block-bindings.js.map +1 -1
  72. package/build-module/store/private-selectors.js +18 -1
  73. package/build-module/store/private-selectors.js.map +1 -1
  74. package/build-module/store/reducer.js +1 -5
  75. package/build-module/store/reducer.js.map +1 -1
  76. package/build-module/utils/block-bindings.js +3 -45
  77. package/build-module/utils/block-bindings.js.map +1 -1
  78. package/build-style/content-rtl.css +13 -0
  79. package/build-style/content.css +13 -0
  80. package/build-style/style-rtl.css +27 -0
  81. package/build-style/style.css +27 -0
  82. package/package.json +34 -34
  83. package/src/components/background-image-control/index.js +54 -27
  84. package/src/components/background-image-control/style.scss +28 -0
  85. package/src/components/block-edit/edit.js +23 -5
  86. package/src/components/block-list/block.js +16 -0
  87. package/src/components/block-list/content.scss +19 -0
  88. package/src/components/block-list/use-block-props/index.js +9 -9
  89. package/src/components/block-settings-menu-controls/index.js +21 -1
  90. package/src/components/block-toolbar/index.js +9 -0
  91. package/src/components/block-visibility/index.js +2 -0
  92. package/src/components/block-visibility/menu-item.js +53 -0
  93. package/src/components/block-visibility/toolbar.js +88 -0
  94. package/src/components/inspector-controls-tabs/index.js +33 -1
  95. package/src/components/link-control/index.js +1 -1
  96. package/src/components/link-control/test/index.js +4 -4
  97. package/src/components/list-view/block-select-button.js +32 -9
  98. package/src/components/list-view/block.js +24 -14
  99. package/src/components/list-view/style.scss +1 -0
  100. package/src/components/media-replace-flow/test/index.js +1 -1
  101. package/src/components/rich-text/index.js +6 -2
  102. package/src/components/use-block-drop-zone/index.js +14 -1
  103. package/src/hooks/block-bindings.js +49 -43
  104. package/src/store/private-selectors.js +21 -1
  105. package/src/store/reducer.js +1 -6
  106. package/src/utils/block-bindings.js +6 -48
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ Object.defineProperty(exports, "BlockVisibilityMenuItem", {
8
+ enumerable: true,
9
+ get: function () {
10
+ return _menuItem.default;
11
+ }
12
+ });
13
+ Object.defineProperty(exports, "BlockVisibilityToolbar", {
14
+ enumerable: true,
15
+ get: function () {
16
+ return _toolbar.default;
17
+ }
18
+ });
19
+ var _menuItem = _interopRequireDefault(require("./menu-item"));
20
+ var _toolbar = _interopRequireDefault(require("./toolbar"));
21
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_menuItem","_interopRequireDefault","require","_toolbar"],"sources":["@wordpress/block-editor/src/components/block-visibility/index.js"],"sourcesContent":["export { default as BlockVisibilityMenuItem } from './menu-item';\nexport { default as BlockVisibilityToolbar } from './toolbar';\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA,IAAAA,SAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,QAAA,GAAAF,sBAAA,CAAAC,OAAA","ignoreList":[]}
@@ -0,0 +1,52 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = BlockVisibilityMenuItem;
7
+ var _i18n = require("@wordpress/i18n");
8
+ var _components = require("@wordpress/components");
9
+ var _icons = require("@wordpress/icons");
10
+ var _data = require("@wordpress/data");
11
+ var _utils = require("../../hooks/utils");
12
+ var _store = require("../../store");
13
+ var _jsxRuntime = require("react/jsx-runtime");
14
+ /**
15
+ * WordPress dependencies
16
+ */
17
+
18
+ /**
19
+ * Internal dependencies
20
+ */
21
+
22
+ function BlockVisibilityMenuItem({
23
+ clientIds
24
+ }) {
25
+ const {
26
+ updateBlockAttributes
27
+ } = (0, _data.useDispatch)(_store.store);
28
+ const blocks = (0, _data.useSelect)(select => {
29
+ return select(_store.store).getBlocksByClientId(clientIds);
30
+ }, [clientIds]);
31
+ const hasHiddenBlock = blocks.some(block => block.attributes.metadata?.blockVisibility === false);
32
+ const toggleBlockVisibility = () => {
33
+ const attributesByClientId = Object.fromEntries(blocks?.map(({
34
+ clientId,
35
+ attributes
36
+ }) => [clientId, {
37
+ metadata: (0, _utils.cleanEmptyObject)({
38
+ ...attributes?.metadata,
39
+ blockVisibility: hasHiddenBlock ? undefined : false
40
+ })
41
+ }]));
42
+ updateBlockAttributes(clientIds, attributesByClientId, {
43
+ uniqueByBlock: true
44
+ });
45
+ };
46
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.MenuItem, {
47
+ icon: hasHiddenBlock ? _icons.seen : _icons.unseen,
48
+ onClick: toggleBlockVisibility,
49
+ children: hasHiddenBlock ? (0, _i18n.__)('Show') : (0, _i18n.__)('Hide')
50
+ });
51
+ }
52
+ //# sourceMappingURL=menu-item.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_i18n","require","_components","_icons","_data","_utils","_store","_jsxRuntime","BlockVisibilityMenuItem","clientIds","updateBlockAttributes","useDispatch","blockEditorStore","blocks","useSelect","select","getBlocksByClientId","hasHiddenBlock","some","block","attributes","metadata","blockVisibility","toggleBlockVisibility","attributesByClientId","Object","fromEntries","map","clientId","cleanEmptyObject","undefined","uniqueByBlock","jsx","MenuItem","icon","seen","unseen","onClick","children","__"],"sources":["@wordpress/block-editor/src/components/block-visibility/menu-item.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { MenuItem } from '@wordpress/components';\nimport { seen, unseen } from '@wordpress/icons';\nimport { useSelect, useDispatch } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { cleanEmptyObject } from '../../hooks/utils';\nimport { store as blockEditorStore } from '../../store';\n\nexport default function BlockVisibilityMenuItem( { clientIds } ) {\n\tconst { updateBlockAttributes } = useDispatch( blockEditorStore );\n\tconst blocks = useSelect(\n\t\t( select ) => {\n\t\t\treturn select( blockEditorStore ).getBlocksByClientId( clientIds );\n\t\t},\n\t\t[ clientIds ]\n\t);\n\n\tconst hasHiddenBlock = blocks.some(\n\t\t( block ) => block.attributes.metadata?.blockVisibility === false\n\t);\n\n\tconst toggleBlockVisibility = () => {\n\t\tconst attributesByClientId = Object.fromEntries(\n\t\t\tblocks?.map( ( { clientId, attributes } ) => [\n\t\t\t\tclientId,\n\t\t\t\t{\n\t\t\t\t\tmetadata: cleanEmptyObject( {\n\t\t\t\t\t\t...attributes?.metadata,\n\t\t\t\t\t\tblockVisibility: hasHiddenBlock ? undefined : false,\n\t\t\t\t\t} ),\n\t\t\t\t},\n\t\t\t] )\n\t\t);\n\t\tupdateBlockAttributes( clientIds, attributesByClientId, {\n\t\t\tuniqueByBlock: true,\n\t\t} );\n\t};\n\n\treturn (\n\t\t<MenuItem\n\t\t\ticon={ hasHiddenBlock ? seen : unseen }\n\t\t\tonClick={ toggleBlockVisibility }\n\t\t>\n\t\t\t{ hasHiddenBlock ? __( 'Show' ) : __( 'Hide' ) }\n\t\t</MenuItem>\n\t);\n}\n"],"mappings":";;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAF,OAAA;AACA,IAAAG,KAAA,GAAAH,OAAA;AAKA,IAAAI,MAAA,GAAAJ,OAAA;AACA,IAAAK,MAAA,GAAAL,OAAA;AAAwD,IAAAM,WAAA,GAAAN,OAAA;AAZxD;AACA;AACA;;AAMA;AACA;AACA;;AAIe,SAASO,uBAAuBA,CAAE;EAAEC;AAAU,CAAC,EAAG;EAChE,MAAM;IAAEC;EAAsB,CAAC,GAAG,IAAAC,iBAAW,EAAEC,YAAiB,CAAC;EACjE,MAAMC,MAAM,GAAG,IAAAC,eAAS,EACrBC,MAAM,IAAM;IACb,OAAOA,MAAM,CAAEH,YAAiB,CAAC,CAACI,mBAAmB,CAAEP,SAAU,CAAC;EACnE,CAAC,EACD,CAAEA,SAAS,CACZ,CAAC;EAED,MAAMQ,cAAc,GAAGJ,MAAM,CAACK,IAAI,CAC/BC,KAAK,IAAMA,KAAK,CAACC,UAAU,CAACC,QAAQ,EAAEC,eAAe,KAAK,KAC7D,CAAC;EAED,MAAMC,qBAAqB,GAAGA,CAAA,KAAM;IACnC,MAAMC,oBAAoB,GAAGC,MAAM,CAACC,WAAW,CAC9Cb,MAAM,EAAEc,GAAG,CAAE,CAAE;MAAEC,QAAQ;MAAER;IAAW,CAAC,KAAM,CAC5CQ,QAAQ,EACR;MACCP,QAAQ,EAAE,IAAAQ,uBAAgB,EAAE;QAC3B,GAAGT,UAAU,EAAEC,QAAQ;QACvBC,eAAe,EAAEL,cAAc,GAAGa,SAAS,GAAG;MAC/C,CAAE;IACH,CAAC,CACA,CACH,CAAC;IACDpB,qBAAqB,CAAED,SAAS,EAAEe,oBAAoB,EAAE;MACvDO,aAAa,EAAE;IAChB,CAAE,CAAC;EACJ,CAAC;EAED,oBACC,IAAAxB,WAAA,CAAAyB,GAAA,EAAC9B,WAAA,CAAA+B,QAAQ;IACRC,IAAI,EAAGjB,cAAc,GAAGkB,WAAI,GAAGC,aAAQ;IACvCC,OAAO,EAAGd,qBAAuB;IAAAe,QAAA,EAE/BrB,cAAc,GAAG,IAAAsB,QAAE,EAAE,MAAO,CAAC,GAAG,IAAAA,QAAE,EAAE,MAAO;EAAC,CACrC,CAAC;AAEb","ignoreList":[]}
@@ -0,0 +1,88 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = BlockVisibilityToolbar;
7
+ var _i18n = require("@wordpress/i18n");
8
+ var _components = require("@wordpress/components");
9
+ var _element = require("@wordpress/element");
10
+ var _icons = require("@wordpress/icons");
11
+ var _data = require("@wordpress/data");
12
+ var _blocks2 = require("@wordpress/blocks");
13
+ var _store = require("../../store");
14
+ var _utils = require("../../hooks/utils");
15
+ var _jsxRuntime = require("react/jsx-runtime");
16
+ /**
17
+ * WordPress dependencies
18
+ */
19
+
20
+ /**
21
+ * Internal dependencies
22
+ */
23
+
24
+ function BlockVisibilityToolbar({
25
+ clientIds
26
+ }) {
27
+ const {
28
+ blocks,
29
+ canToggleBlockVisibility
30
+ } = (0, _data.useSelect)(select => {
31
+ const {
32
+ getBlockName,
33
+ getBlocksByClientId
34
+ } = select(_store.store);
35
+ const _blocks = getBlocksByClientId(clientIds);
36
+ return {
37
+ blocks: _blocks,
38
+ canToggleBlockVisibility: _blocks.every(({
39
+ clientId
40
+ }) => (0, _blocks2.hasBlockSupport)(getBlockName(clientId), 'blockVisibility', true))
41
+ };
42
+ }, [clientIds]);
43
+ const hasHiddenBlock = blocks.some(block => block.attributes.metadata?.blockVisibility === false);
44
+ const hasBlockVisibilityButtonShownRef = (0, _element.useRef)(false);
45
+ const {
46
+ updateBlockAttributes
47
+ } = (0, _data.useDispatch)(_store.store);
48
+
49
+ // If the block visibility button has been shown, we don't want to
50
+ // remove it from the toolbar until the toolbar is rendered again
51
+ // without it. Removing it beforehand can cause focus loss issues.
52
+ // It needs to return focus from whence it came, and to do that,
53
+ // we need to leave the button in the toolbar.
54
+ (0, _element.useEffect)(() => {
55
+ if (hasHiddenBlock) {
56
+ hasBlockVisibilityButtonShownRef.current = true;
57
+ }
58
+ }, [hasHiddenBlock]);
59
+ if (!hasHiddenBlock && !hasBlockVisibilityButtonShownRef.current) {
60
+ return null;
61
+ }
62
+ const toggleBlockVisibility = () => {
63
+ const attributesByClientId = Object.fromEntries(blocks?.map(({
64
+ clientId,
65
+ attributes
66
+ }) => [clientId, {
67
+ metadata: (0, _utils.cleanEmptyObject)({
68
+ ...attributes?.metadata,
69
+ blockVisibility: hasHiddenBlock ? undefined : false
70
+ })
71
+ }]));
72
+ updateBlockAttributes(clientIds, attributesByClientId, {
73
+ uniqueByBlock: true
74
+ });
75
+ };
76
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {
77
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.ToolbarGroup, {
78
+ className: "block-editor-block-lock-toolbar",
79
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.ToolbarButton, {
80
+ disabled: !canToggleBlockVisibility,
81
+ icon: hasHiddenBlock ? _icons.unseen : _icons.seen,
82
+ label: hasHiddenBlock ? (0, _i18n.__)('Hidden') : (0, _i18n.__)('Visible'),
83
+ onClick: toggleBlockVisibility
84
+ })
85
+ })
86
+ });
87
+ }
88
+ //# sourceMappingURL=toolbar.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_i18n","require","_components","_element","_icons","_data","_blocks2","_store","_utils","_jsxRuntime","BlockVisibilityToolbar","clientIds","blocks","canToggleBlockVisibility","useSelect","select","getBlockName","getBlocksByClientId","blockEditorStore","_blocks","every","clientId","hasBlockSupport","hasHiddenBlock","some","block","attributes","metadata","blockVisibility","hasBlockVisibilityButtonShownRef","useRef","updateBlockAttributes","useDispatch","useEffect","current","toggleBlockVisibility","attributesByClientId","Object","fromEntries","map","cleanEmptyObject","undefined","uniqueByBlock","jsx","Fragment","children","ToolbarGroup","className","ToolbarButton","disabled","icon","unseen","seen","label","__","onClick"],"sources":["@wordpress/block-editor/src/components/block-visibility/toolbar.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { ToolbarButton, ToolbarGroup } from '@wordpress/components';\nimport { useRef, useEffect } from '@wordpress/element';\nimport { seen, unseen } from '@wordpress/icons';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { hasBlockSupport } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../../store';\nimport { cleanEmptyObject } from '../../hooks/utils';\n\nexport default function BlockVisibilityToolbar( { clientIds } ) {\n\tconst { blocks, canToggleBlockVisibility } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getBlockName, getBlocksByClientId } =\n\t\t\t\tselect( blockEditorStore );\n\t\t\tconst _blocks = getBlocksByClientId( clientIds );\n\t\t\treturn {\n\t\t\t\tblocks: _blocks,\n\t\t\t\tcanToggleBlockVisibility: _blocks.every( ( { clientId } ) =>\n\t\t\t\t\thasBlockSupport(\n\t\t\t\t\t\tgetBlockName( clientId ),\n\t\t\t\t\t\t'blockVisibility',\n\t\t\t\t\t\ttrue\n\t\t\t\t\t)\n\t\t\t\t),\n\t\t\t};\n\t\t},\n\t\t[ clientIds ]\n\t);\n\n\tconst hasHiddenBlock = blocks.some(\n\t\t( block ) => block.attributes.metadata?.blockVisibility === false\n\t);\n\n\tconst hasBlockVisibilityButtonShownRef = useRef( false );\n\tconst { updateBlockAttributes } = useDispatch( blockEditorStore );\n\n\t// If the block visibility button has been shown, we don't want to\n\t// remove it from the toolbar until the toolbar is rendered again\n\t// without it. Removing it beforehand can cause focus loss issues.\n\t// It needs to return focus from whence it came, and to do that,\n\t// we need to leave the button in the toolbar.\n\tuseEffect( () => {\n\t\tif ( hasHiddenBlock ) {\n\t\t\thasBlockVisibilityButtonShownRef.current = true;\n\t\t}\n\t}, [ hasHiddenBlock ] );\n\n\tif ( ! hasHiddenBlock && ! hasBlockVisibilityButtonShownRef.current ) {\n\t\treturn null;\n\t}\n\n\tconst toggleBlockVisibility = () => {\n\t\tconst attributesByClientId = Object.fromEntries(\n\t\t\tblocks?.map( ( { clientId, attributes } ) => [\n\t\t\t\tclientId,\n\t\t\t\t{\n\t\t\t\t\tmetadata: cleanEmptyObject( {\n\t\t\t\t\t\t...attributes?.metadata,\n\t\t\t\t\t\tblockVisibility: hasHiddenBlock ? undefined : false,\n\t\t\t\t\t} ),\n\t\t\t\t},\n\t\t\t] )\n\t\t);\n\t\tupdateBlockAttributes( clientIds, attributesByClientId, {\n\t\t\tuniqueByBlock: true,\n\t\t} );\n\t};\n\n\treturn (\n\t\t<>\n\t\t\t<ToolbarGroup className=\"block-editor-block-lock-toolbar\">\n\t\t\t\t<ToolbarButton\n\t\t\t\t\tdisabled={ ! canToggleBlockVisibility }\n\t\t\t\t\ticon={ hasHiddenBlock ? unseen : seen }\n\t\t\t\t\tlabel={ hasHiddenBlock ? __( 'Hidden' ) : __( 'Visible' ) }\n\t\t\t\t\tonClick={ toggleBlockVisibility }\n\t\t\t\t/>\n\t\t\t</ToolbarGroup>\n\t\t</>\n\t);\n}\n"],"mappings":";;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAA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Ac,IAAI,CAAEM,gCAAgC,CAACK,OAAO,EAAG;IACrE,OAAO,IAAI;EACZ;EAEA,MAAMC,qBAAqB,GAAGA,CAAA,KAAM;IACnC,MAAMC,oBAAoB,GAAGC,MAAM,CAACC,WAAW,CAC9C1B,MAAM,EAAE2B,GAAG,CAAE,CAAE;MAAElB,QAAQ;MAAEK;IAAW,CAAC,KAAM,CAC5CL,QAAQ,EACR;MACCM,QAAQ,EAAE,IAAAa,uBAAgB,EAAE;QAC3B,GAAGd,UAAU,EAAEC,QAAQ;QACvBC,eAAe,EAAEL,cAAc,GAAGkB,SAAS,GAAG;MAC/C,CAAE;IACH,CAAC,CACA,CACH,CAAC;IACDV,qBAAqB,CAAEpB,SAAS,EAAEyB,oBAAoB,EAAE;MACvDM,aAAa,EAAE;IAChB,CAAE,CAAC;EACJ,CAAC;EAED,oBACC,IAAAjC,WAAA,CAAAkC,GAAA,EAAAlC,WAAA,CAAAmC,QAAA;IAAAC,QAAA,eACC,IAAApC,WAAA,CAAAkC,GAAA,EAACzC,WAAA,CAAA4C,YAAY;MAACC,SAAS,EAAC,iCAAiC;MAAAF,QAAA,eACxD,IAAApC,WAAA,CAAAkC,GAAA,EAACzC,WAAA,CAAA8C,aAAa;QACbC,QAAQ,EAAG,CAAEpC,wBAA0B;QACvCqC,IAAI,EAAG3B,cAAc,GAAG4B,aAAM,GAAGC,WAAM;QACvCC,KAAK,EAAG9B,cAAc,GAAG,IAAA+B,QAAE,EAAE,QAAS,CAAC,GAAG,IAAAA,QAAE,EAAE,SAAU,CAAG;QAC3DC,OAAO,EAAGpB;MAAuB,CACjC;IAAC,CACW;EAAC,CACd,CAAC;AAEL","ignoreList":[]}
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", {
6
6
  });
7
7
  exports.default = InspectorControlsTabs;
8
8
  var _components = require("@wordpress/components");
9
+ var _element = require("@wordpress/element");
9
10
  var _preferences = require("@wordpress/preferences");
10
11
  var _data = require("@wordpress/data");
11
12
  var _utils = require("./utils");
@@ -45,10 +46,32 @@ function InspectorControlsTabs({
45
46
  // which at the time is the first tab. This check allows blocks known to
46
47
  // include the list view tab to set it as the tab selected by default.
47
48
  const initialTabName = !(0, _useIsListViewTabDisabled.default)(blockName) ? _utils.TAB_LIST_VIEW.name : undefined;
49
+ const [selectedTabId, setSelectedTabId] = (0, _element.useState)(initialTabName !== null && initialTabName !== void 0 ? initialTabName : tabs[0]?.name);
50
+
51
+ // When the active tab is not amongst the available `tabs`, it indicates
52
+ // the list of tabs was changed dynamically with the active one being
53
+ // removed. Set the active tab back to the first tab.
54
+ (0, _element.useEffect)(() => {
55
+ // Skip this behavior if `initialTabName` is supplied. In the navigation
56
+ // block, the list view tab isn't present in `tabs` initially. The early
57
+ // return here prevents the dynamic behavior that follows from overriding
58
+ // `initialTabName`.
59
+ if (initialTabName) {
60
+ return;
61
+ }
62
+ if (tabs?.length && selectedTabId) {
63
+ const activeTab = tabs.find(tab => tab.name === selectedTabId);
64
+ if (!activeTab) {
65
+ setSelectedTabId(tabs[0].name);
66
+ }
67
+ }
68
+ }, [tabs, selectedTabId, initialTabName]);
48
69
  return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
49
70
  className: "block-editor-block-inspector__tabs",
50
71
  children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(Tabs, {
51
72
  defaultTabId: initialTabName,
73
+ selectedTabId: selectedTabId,
74
+ onSelect: setSelectedTabId,
52
75
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(Tabs.TabList, {
53
76
  children: tabs.map(tab => showIconLabels ? /*#__PURE__*/(0, _jsxRuntime.jsx)(Tabs.Tab, {
54
77
  tabId: tab.name,
@@ -1 +1 @@
1
- {"version":3,"names":["_components","require","_preferences","_data","_utils","_settingsTab","_interopRequireDefault","_stylesTab","_contentTab","_inspectorControls","_useIsListViewTabDisabled","_lockUnlock","_jsxRuntime","Tabs","unlock","componentsPrivateApis","InspectorControlsTabs","blockName","clientId","hasBlockStyles","tabs","isSectionBlock","contentClientIds","showIconLabels","useSelect","select","preferencesStore","get","initialTabName","useIsListViewTabDisabled","TAB_LIST_VIEW","name","undefined","jsx","className","children","jsxs","defaultTabId","TabList","map","tab","Tab","tabId","title","Tooltip","text","Icon","icon","TabPanel","TAB_SETTINGS","focusable","default","showAdvancedControls","TAB_STYLES","TAB_CONTENT","Slot","group"],"sources":["@wordpress/block-editor/src/components/inspector-controls-tabs/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tIcon,\n\tTooltip,\n\tprivateApis as componentsPrivateApis,\n} from '@wordpress/components';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { TAB_SETTINGS, TAB_STYLES, TAB_LIST_VIEW, TAB_CONTENT } from './utils';\nimport SettingsTab from './settings-tab';\nimport StylesTab from './styles-tab';\nimport ContentTab from './content-tab';\nimport InspectorControls from '../inspector-controls';\nimport useIsListViewTabDisabled from './use-is-list-view-tab-disabled';\nimport { unlock } from '../../lock-unlock';\n\nconst { Tabs } = unlock( componentsPrivateApis );\n\nexport default function InspectorControlsTabs( {\n\tblockName,\n\tclientId,\n\thasBlockStyles,\n\ttabs,\n\tisSectionBlock,\n\tcontentClientIds,\n} ) {\n\tconst showIconLabels = useSelect( ( select ) => {\n\t\treturn select( preferencesStore ).get( 'core', 'showIconLabels' );\n\t}, [] );\n\n\t// The tabs panel will mount before fills are rendered to the list view\n\t// slot. This means the list view tab isn't initially included in the\n\t// available tabs so the panel defaults selection to the settings tab\n\t// which at the time is the first tab. This check allows blocks known to\n\t// include the list view tab to set it as the tab selected by default.\n\tconst initialTabName = ! useIsListViewTabDisabled( blockName )\n\t\t? TAB_LIST_VIEW.name\n\t\t: undefined;\n\n\treturn (\n\t\t<div className=\"block-editor-block-inspector__tabs\">\n\t\t\t<Tabs defaultTabId={ initialTabName } key={ clientId }>\n\t\t\t\t<Tabs.TabList>\n\t\t\t\t\t{ tabs.map( ( tab ) =>\n\t\t\t\t\t\tshowIconLabels ? (\n\t\t\t\t\t\t\t<Tabs.Tab key={ tab.name } tabId={ tab.name }>\n\t\t\t\t\t\t\t\t{ tab.title }\n\t\t\t\t\t\t\t</Tabs.Tab>\n\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t<Tooltip text={ tab.title } key={ tab.name }>\n\t\t\t\t\t\t\t\t<Tabs.Tab\n\t\t\t\t\t\t\t\t\ttabId={ tab.name }\n\t\t\t\t\t\t\t\t\taria-label={ tab.title }\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t<Icon icon={ tab.icon } />\n\t\t\t\t\t\t\t\t</Tabs.Tab>\n\t\t\t\t\t\t\t</Tooltip>\n\t\t\t\t\t\t)\n\t\t\t\t\t) }\n\t\t\t\t</Tabs.TabList>\n\t\t\t\t<Tabs.TabPanel tabId={ TAB_SETTINGS.name } focusable={ false }>\n\t\t\t\t\t<SettingsTab showAdvancedControls={ !! blockName } />\n\t\t\t\t</Tabs.TabPanel>\n\t\t\t\t<Tabs.TabPanel tabId={ TAB_STYLES.name } focusable={ false }>\n\t\t\t\t\t<StylesTab\n\t\t\t\t\t\tblockName={ blockName }\n\t\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\t\thasBlockStyles={ hasBlockStyles }\n\t\t\t\t\t\tisSectionBlock={ isSectionBlock }\n\t\t\t\t\t/>\n\t\t\t\t</Tabs.TabPanel>\n\t\t\t\t<Tabs.TabPanel tabId={ TAB_CONTENT.name } focusable={ false }>\n\t\t\t\t\t<ContentTab contentClientIds={ contentClientIds } />\n\t\t\t\t</Tabs.TabPanel>\n\t\t\t\t<Tabs.TabPanel tabId={ TAB_LIST_VIEW.name } focusable={ false }>\n\t\t\t\t\t<InspectorControls.Slot group=\"list\" />\n\t\t\t\t</Tabs.TabPanel>\n\t\t\t</Tabs>\n\t\t</div>\n\t);\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,WAAA,GAAAC,OAAA;AAKA,IAAAC,YAAA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ACmC,QAAQ;QAACN,KAAK,EAAGY,kBAAW,CAACvB,IAAM;QAACmB,SAAS,EAAG,KAAO;QAAAf,QAAA,eAC5D,IAAAvB,WAAA,CAAAqB,GAAA,EAACzB,WAAA,CAAA2C,OAAU;UAAC7B,gBAAgB,EAAGA;QAAkB,CAAE;MAAC,CACtC,CAAC,eAChB,IAAAV,WAAA,CAAAqB,GAAA,EAACpB,IAAI,CAACmC,QAAQ;QAACN,KAAK,EAAGZ,oBAAa,CAACC,IAAM;QAACmB,SAAS,EAAG,KAAO;QAAAf,QAAA,eAC9D,IAAAvB,WAAA,CAAAqB,GAAA,EAACxB,kBAAA,CAAA0C,OAAiB,CAACI,IAAI;UAACC,KAAK,EAAC;QAAM,CAAE;MAAC,CACzB,CAAC;IAAA,GAnC2BtC,QAoCtC;EAAC,CACH,CAAC;AAER","ignoreList":[]}
1
+ {"version":3,"names":["_components","require","_element","_preferences","_data","_utils","_settingsTab","_interopRequireDefault","_stylesTab","_contentTab","_inspectorControls","_useIsListViewTabDisabled","_lockUnlock","_jsxRuntime","Tabs","unlock","componentsPrivateApis","InspectorControlsTabs","blockName","clientId","hasBlockStyles","tabs","isSectionBlock","contentClientIds","showIconLabels","useSelect","select","preferencesStore","get","initialTabName","useIsListViewTabDisabled","TAB_LIST_VIEW","name","undefined","selectedTabId","setSelectedTabId","useState","useEffect","length","activeTab","find","tab","jsx","className","children","jsxs","defaultTabId","onSelect","TabList","map","Tab","tabId","title","Tooltip","text","Icon","icon","TabPanel","TAB_SETTINGS","focusable","default","showAdvancedControls","TAB_STYLES","TAB_CONTENT","Slot","group"],"sources":["@wordpress/block-editor/src/components/inspector-controls-tabs/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tIcon,\n\tTooltip,\n\tprivateApis as componentsPrivateApis,\n} from '@wordpress/components';\nimport { useEffect, useState } from '@wordpress/element';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { TAB_SETTINGS, TAB_STYLES, TAB_LIST_VIEW, TAB_CONTENT } from './utils';\nimport SettingsTab from './settings-tab';\nimport StylesTab from './styles-tab';\nimport ContentTab from './content-tab';\nimport InspectorControls from '../inspector-controls';\nimport useIsListViewTabDisabled from './use-is-list-view-tab-disabled';\nimport { unlock } from '../../lock-unlock';\n\nconst { Tabs } = unlock( componentsPrivateApis );\n\nexport default function InspectorControlsTabs( {\n\tblockName,\n\tclientId,\n\thasBlockStyles,\n\ttabs,\n\tisSectionBlock,\n\tcontentClientIds,\n} ) {\n\tconst showIconLabels = useSelect( ( select ) => {\n\t\treturn select( preferencesStore ).get( 'core', 'showIconLabels' );\n\t}, [] );\n\n\t// The tabs panel will mount before fills are rendered to the list view\n\t// slot. This means the list view tab isn't initially included in the\n\t// available tabs so the panel defaults selection to the settings tab\n\t// which at the time is the first tab. This check allows blocks known to\n\t// include the list view tab to set it as the tab selected by default.\n\tconst initialTabName = ! useIsListViewTabDisabled( blockName )\n\t\t? TAB_LIST_VIEW.name\n\t\t: undefined;\n\n\tconst [ selectedTabId, setSelectedTabId ] = useState(\n\t\tinitialTabName ?? tabs[ 0 ]?.name\n\t);\n\n\t// When the active tab is not amongst the available `tabs`, it indicates\n\t// the list of tabs was changed dynamically with the active one being\n\t// removed. Set the active tab back to the first tab.\n\tuseEffect( () => {\n\t\t// Skip this behavior if `initialTabName` is supplied. In the navigation\n\t\t// block, the list view tab isn't present in `tabs` initially. The early\n\t\t// return here prevents the dynamic behavior that follows from overriding\n\t\t// `initialTabName`.\n\t\tif ( initialTabName ) {\n\t\t\treturn;\n\t\t}\n\n\t\tif ( tabs?.length && selectedTabId ) {\n\t\t\tconst activeTab = tabs.find(\n\t\t\t\t( tab ) => tab.name === selectedTabId\n\t\t\t);\n\t\t\tif ( ! activeTab ) {\n\t\t\t\tsetSelectedTabId( tabs[ 0 ].name );\n\t\t\t}\n\t\t}\n\t}, [ tabs, selectedTabId, initialTabName ] );\n\n\treturn (\n\t\t<div className=\"block-editor-block-inspector__tabs\">\n\t\t\t<Tabs\n\t\t\t\tdefaultTabId={ initialTabName }\n\t\t\t\tselectedTabId={ selectedTabId }\n\t\t\t\tonSelect={ setSelectedTabId }\n\t\t\t\tkey={ clientId }\n\t\t\t>\n\t\t\t\t<Tabs.TabList>\n\t\t\t\t\t{ tabs.map( ( tab ) =>\n\t\t\t\t\t\tshowIconLabels ? (\n\t\t\t\t\t\t\t<Tabs.Tab key={ tab.name } tabId={ tab.name }>\n\t\t\t\t\t\t\t\t{ tab.title }\n\t\t\t\t\t\t\t</Tabs.Tab>\n\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t<Tooltip text={ tab.title } key={ tab.name }>\n\t\t\t\t\t\t\t\t<Tabs.Tab\n\t\t\t\t\t\t\t\t\ttabId={ tab.name }\n\t\t\t\t\t\t\t\t\taria-label={ tab.title }\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t<Icon icon={ tab.icon } />\n\t\t\t\t\t\t\t\t</Tabs.Tab>\n\t\t\t\t\t\t\t</Tooltip>\n\t\t\t\t\t\t)\n\t\t\t\t\t) }\n\t\t\t\t</Tabs.TabList>\n\t\t\t\t<Tabs.TabPanel tabId={ TAB_SETTINGS.name } focusable={ false }>\n\t\t\t\t\t<SettingsTab showAdvancedControls={ !! blockName } />\n\t\t\t\t</Tabs.TabPanel>\n\t\t\t\t<Tabs.TabPanel tabId={ TAB_STYLES.name } focusable={ false }>\n\t\t\t\t\t<StylesTab\n\t\t\t\t\t\tblockName={ blockName }\n\t\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\t\thasBlockStyles={ hasBlockStyles }\n\t\t\t\t\t\tisSectionBlock={ isSectionBlock }\n\t\t\t\t\t/>\n\t\t\t\t</Tabs.TabPanel>\n\t\t\t\t<Tabs.TabPanel tabId={ TAB_CONTENT.name } focusable={ false }>\n\t\t\t\t\t<ContentTab contentClientIds={ contentClientIds } />\n\t\t\t\t</Tabs.TabPanel>\n\t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pB,oBAAa,CAACC,IAAM;QAAC2B,SAAS,EAAG,KAAO;QAAAf,QAAA,eAC9D,IAAA/B,WAAA,CAAA6B,GAAA,EAAChC,kBAAA,CAAAkD,OAAiB,CAACI,IAAI;UAACC,KAAK,EAAC;QAAM,CAAE;MAAC,CACzB,CAAC;IAAA,GApCV9C,QAqCD;EAAC,CACH,CAAC;AAER","ignoreList":[]}
@@ -400,7 +400,7 @@ function LinkControl({
400
400
  onClick: isDisabled ? noop : handleSubmit,
401
401
  className: "block-editor-link-control__search-submit",
402
402
  "aria-disabled": isDisabled,
403
- children: (0, _i18n.__)('Save')
403
+ children: (0, _i18n.__)('Apply')
404
404
  })]
405
405
  }), !isCreatingPage && renderControlBottom && renderControlBottom()]
406
406
  });
@@ -1 +1 @@
1
- {"version":3,"names":["_clsx","_interopRequireDefault","require","_components","_i18n","_element","_dom","_keycodes","_isShallowEqual","_data","_preferences","_icons","_settingsDrawer","_searchInput","_linkPreview","_settings","_useCreatePage","_useInternalValue","_viewerSlot","_constants","_deprecated","_jsxRuntime","noop","PREFERENCE_SCOPE","PREFERENCE_KEY","LinkControl","searchInputPlaceholder","value","settings","DEFAULT_LINK_SETTINGS","onChange","onRemove","onCancel","noDirectEntry","showSuggestions","showInitialSuggestions","forceIsEditingLink","createSuggestion","withCreateSuggestion","inputValue","propInputValue","suggestionsQuery","noURLSuggestion","createSuggestionButtonText","hasRichPreviews","hasTextControl","renderControlBottom","undefined","settingsOpen","setSettingsOpen","useState","advancedSettingsPreference","useSelect","select","_prefsStore$get","prefsStore","preferencesStore","get","set","setPreference","useDispatch","setSettingsOpenWithPreference","prefVal","isSettingsOpen","isMountingRef","useRef","wrapperNode","textInputRef","isEndingEditWithFocusRef","settingsKeys","map","id","internalControlValue","setInternalControlValue","setInternalURLInputValue","setInternalTextInputValue","createSetInternalSettingValueHandler","useInternalValue","valueHasChanges","isShallowEqualObjects","isEditingLink","setIsEditingLink","url","createPage","isCreatingPage","errorMessage","useCreatePage","useEffect","current","nextFocusTarget","focus","focusable","find","hasLinkValue","trim","length","stopEditing","contains","ownerDocument","activeElement","handleSelectSuggestion","updatedValue","nonSettingsChanges","Object","keys","reduce","acc","key","includes","title","handleSubmit","currentUrlInputValue","handleSubmitWithEnter","event","keyCode","ENTER","currentInputIsEmpty","preventDefault","resetInternalValues","handleCancel","stopPropagation","shownUnlinkControl","showActions","showTextControl","isEditing","isDisabled","showSettings","jsxs","tabIndex","ref","className","children","jsx","Spinner","__","Fragment","clsx","TextControl","__nextHasNoMarginBottom","label","onKeyDown","__next40pxDefaultSize","default","currentLink","placeholder","onCreateSuggestion","onSelect","allowDirectEntry","withURLSuggestion","hideLabelFromVision","suffix","__experimentalInputControlSuffixWrapper","variant","Button","onClick","icon","keyboardReturn","size","Notice","status","isDismissible","onEditClick","hasUnlinkControl","__experimentalHStack","justify","ViewerFill","DeprecatedExperimentalLinkControl","props","deprecated","since","alternative","exports","_default"],"sources":["@wordpress/block-editor/src/components/link-control/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tButton,\n\tSpinner,\n\tNotice,\n\tTextControl,\n\t__experimentalHStack as HStack,\n\t__experimentalInputControlSuffixWrapper as InputControlSuffixWrapper,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { useRef, useState, useEffect } from '@wordpress/element';\nimport { focus } from '@wordpress/dom';\nimport { ENTER } from '@wordpress/keycodes';\nimport { isShallowEqualObjects } from '@wordpress/is-shallow-equal';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport { keyboardReturn } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport LinkControlSettingsDrawer from './settings-drawer';\nimport LinkControlSearchInput from './search-input';\nimport LinkPreview from './link-preview';\nimport LinkSettings from './settings';\nimport useCreatePage from './use-create-page';\nimport useInternalValue from './use-internal-value';\nimport { ViewerFill } from './viewer-slot';\nimport { DEFAULT_LINK_SETTINGS } from './constants';\nimport deprecated from '@wordpress/deprecated';\n\n/**\n * Default properties associated with a link control value.\n *\n * @typedef WPLinkControlDefaultValue\n *\n * @property {string} url Link URL.\n * @property {string=} title Link title.\n * @property {boolean=} opensInNewTab Whether link should open in a new browser\n * tab. This value is only assigned if not\n * providing a custom `settings` prop.\n */\n\n/* eslint-disable jsdoc/valid-types */\n/**\n * Custom settings values associated with a link.\n *\n * @typedef {{[setting:string]:any}} WPLinkControlSettingsValue\n */\n/* eslint-enable */\n\n/**\n * Custom settings values associated with a link.\n *\n * @typedef WPLinkControlSetting\n *\n * @property {string} id Identifier to use as property for setting value.\n * @property {string} title Human-readable label to show in user interface.\n */\n\n/**\n * Properties associated with a link control value, composed as a union of the\n * default properties and any custom settings values.\n *\n * @typedef {WPLinkControlDefaultValue&WPLinkControlSettingsValue} WPLinkControlValue\n */\n\n/** @typedef {(nextValue:WPLinkControlValue)=>void} WPLinkControlOnChangeProp */\n\n/**\n * Properties associated with a search suggestion used within the LinkControl.\n *\n * @typedef WPLinkControlSuggestion\n *\n * @property {string} id Identifier to use to uniquely identify the suggestion.\n * @property {string} type Identifies the type of the suggestion (eg: `post`,\n * `page`, `url`...etc)\n * @property {string} title Human-readable label to show in user interface.\n * @property {string} url A URL for the suggestion.\n */\n\n/** @typedef {(title:string)=>WPLinkControlSuggestion} WPLinkControlCreateSuggestionProp */\n\n/**\n * @typedef WPLinkControlProps\n *\n * @property {(WPLinkControlSetting[])=} settings An array of settings objects. Each object will used to\n * render a `ToggleControl` for that setting.\n * @property {boolean=} forceIsEditingLink If passed as either `true` or `false`, controls the\n * internal editing state of the component to respective\n * show or not show the URL input field.\n * @property {WPLinkControlValue=} value Current link value.\n * @property {WPLinkControlOnChangeProp=} onChange Value change handler, called with the updated value if\n * the user selects a new link or updates settings.\n * @property {boolean=} noDirectEntry Whether to allow turning a URL-like search query directly into a link.\n * @property {boolean=} showSuggestions Whether to present suggestions when typing the URL.\n * @property {boolean=} showInitialSuggestions Whether to present initial suggestions immediately.\n * @property {boolean=} withCreateSuggestion Whether to allow creation of link value from suggestion.\n * @property {Object=} suggestionsQuery Query parameters to pass along to wp.blockEditor.__experimentalFetchLinkSuggestions.\n * @property {boolean=} noURLSuggestion Whether to add a fallback suggestion which treats the search query as a URL.\n * @property {boolean=} hasTextControl Whether to add a text field to the UI to update the value.title.\n * @property {string|Function|undefined} createSuggestionButtonText The text to use in the button that calls createSuggestion.\n * @property {Function} renderControlBottom Optional controls to be rendered at the bottom of the component.\n */\n\nconst noop = () => {};\n\nconst PREFERENCE_SCOPE = 'core/block-editor';\nconst PREFERENCE_KEY = 'linkControlSettingsDrawer';\n\n/**\n * Renders a link control. A link control is a controlled input which maintains\n * a value associated with a link (HTML anchor element) and relevant settings\n * for how that link is expected to behave.\n *\n * @param {WPLinkControlProps} props Component props.\n */\nfunction LinkControl( {\n\tsearchInputPlaceholder,\n\tvalue,\n\tsettings = DEFAULT_LINK_SETTINGS,\n\tonChange = noop,\n\tonRemove,\n\tonCancel,\n\tnoDirectEntry = false,\n\tshowSuggestions = true,\n\tshowInitialSuggestions,\n\tforceIsEditingLink,\n\tcreateSuggestion,\n\twithCreateSuggestion,\n\tinputValue: propInputValue = '',\n\tsuggestionsQuery = {},\n\tnoURLSuggestion = false,\n\tcreateSuggestionButtonText,\n\thasRichPreviews = false,\n\thasTextControl = false,\n\trenderControlBottom = null,\n} ) {\n\tif ( withCreateSuggestion === undefined && createSuggestion ) {\n\t\twithCreateSuggestion = true;\n\t}\n\n\tconst [ settingsOpen, setSettingsOpen ] = useState( false );\n\n\tconst { advancedSettingsPreference } = useSelect( ( select ) => {\n\t\tconst prefsStore = select( preferencesStore );\n\n\t\treturn {\n\t\t\tadvancedSettingsPreference:\n\t\t\t\tprefsStore.get( PREFERENCE_SCOPE, PREFERENCE_KEY ) ?? false,\n\t\t};\n\t}, [] );\n\n\tconst { set: setPreference } = useDispatch( preferencesStore );\n\n\t/**\n\t * Sets the open/closed state of the Advanced Settings Drawer,\n\t * optionlly persisting the state to the user's preferences.\n\t *\n\t * Note that Block Editor components can be consumed by non-WordPress\n\t * environments which may not have preferences setup.\n\t * Therefore a local state is also used as a fallback.\n\t *\n\t * @param {boolean} prefVal the open/closed state of the Advanced Settings Drawer.\n\t */\n\tconst setSettingsOpenWithPreference = ( prefVal ) => {\n\t\tif ( setPreference ) {\n\t\t\tsetPreference( PREFERENCE_SCOPE, PREFERENCE_KEY, prefVal );\n\t\t}\n\t\tsetSettingsOpen( prefVal );\n\t};\n\n\t// Block Editor components can be consumed by non-WordPress environments\n\t// which may not have these preferences setup.\n\t// Therefore a local state is used as a fallback.\n\tconst isSettingsOpen = advancedSettingsPreference || settingsOpen;\n\n\tconst isMountingRef = useRef( true );\n\tconst wrapperNode = useRef();\n\tconst textInputRef = useRef();\n\tconst isEndingEditWithFocusRef = useRef( false );\n\n\tconst settingsKeys = settings.map( ( { id } ) => id );\n\n\tconst [\n\t\tinternalControlValue,\n\t\tsetInternalControlValue,\n\t\tsetInternalURLInputValue,\n\t\tsetInternalTextInputValue,\n\t\tcreateSetInternalSettingValueHandler,\n\t] = useInternalValue( value );\n\n\tconst valueHasChanges =\n\t\tvalue && ! isShallowEqualObjects( internalControlValue, value );\n\n\tconst [ isEditingLink, setIsEditingLink ] = useState(\n\t\tforceIsEditingLink !== undefined\n\t\t\t? forceIsEditingLink\n\t\t\t: ! value || ! value.url\n\t);\n\n\tconst { createPage, isCreatingPage, errorMessage } =\n\t\tuseCreatePage( createSuggestion );\n\n\tuseEffect( () => {\n\t\tif ( forceIsEditingLink === undefined ) {\n\t\t\treturn;\n\t\t}\n\n\t\tsetIsEditingLink( forceIsEditingLink );\n\t}, [ forceIsEditingLink ] );\n\n\tuseEffect( () => {\n\t\t// We don't auto focus into the Link UI on mount\n\t\t// because otherwise using the keyboard to select text\n\t\t// *within* the link format is not possible.\n\t\tif ( isMountingRef.current ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Scenario - when:\n\t\t// - switching between editable and non editable LinkControl\n\t\t// - clicking on a link\n\t\t// ...then move focus to the *first* element to avoid focus loss\n\t\t// and to ensure focus is *within* the Link UI.\n\t\tconst nextFocusTarget =\n\t\t\tfocus.focusable.find( wrapperNode.current )[ 0 ] ||\n\t\t\twrapperNode.current;\n\n\t\tnextFocusTarget.focus();\n\n\t\tisEndingEditWithFocusRef.current = false;\n\t}, [ isEditingLink, isCreatingPage ] );\n\n\t// The component mounting reference is maintained separately\n\t// to correctly reset values in `StrictMode`.\n\tuseEffect( () => {\n\t\tisMountingRef.current = false;\n\n\t\treturn () => {\n\t\t\tisMountingRef.current = true;\n\t\t};\n\t}, [] );\n\n\tconst hasLinkValue = value?.url?.trim()?.length > 0;\n\n\t/**\n\t * Cancels editing state and marks that focus may need to be restored after\n\t * the next render, if focus was within the wrapper when editing finished.\n\t */\n\tconst stopEditing = () => {\n\t\tisEndingEditWithFocusRef.current = !! wrapperNode.current?.contains(\n\t\t\twrapperNode.current.ownerDocument.activeElement\n\t\t);\n\n\t\tsetIsEditingLink( false );\n\t};\n\n\tconst handleSelectSuggestion = ( updatedValue ) => {\n\t\t// Suggestions may contains \"settings\" values (e.g. `opensInNewTab`)\n\t\t// which should not override any existing settings values set by the\n\t\t// user. This filters out any settings values from the suggestion.\n\t\tconst nonSettingsChanges = Object.keys( updatedValue ).reduce(\n\t\t\t( acc, key ) => {\n\t\t\t\tif ( ! settingsKeys.includes( key ) ) {\n\t\t\t\t\tacc[ key ] = updatedValue[ key ];\n\t\t\t\t}\n\t\t\t\treturn acc;\n\t\t\t},\n\t\t\t{}\n\t\t);\n\n\t\tonChange( {\n\t\t\t...internalControlValue,\n\t\t\t...nonSettingsChanges,\n\t\t\t// As title is not a setting, it must be manually applied\n\t\t\t// in such a way as to preserve the users changes over\n\t\t\t// any \"title\" value provided by the \"suggestion\".\n\t\t\ttitle: internalControlValue?.title || updatedValue?.title,\n\t\t} );\n\n\t\tstopEditing();\n\t};\n\n\tconst handleSubmit = () => {\n\t\tif ( valueHasChanges ) {\n\t\t\t// Submit the original value with new stored values applied\n\t\t\t// on top. URL is a special case as it may also be a prop.\n\t\t\tonChange( {\n\t\t\t\t...value,\n\t\t\t\t...internalControlValue,\n\t\t\t\turl: currentUrlInputValue,\n\t\t\t} );\n\t\t}\n\t\tstopEditing();\n\t};\n\n\tconst handleSubmitWithEnter = ( event ) => {\n\t\tconst { keyCode } = event;\n\n\t\tif (\n\t\t\tkeyCode === ENTER &&\n\t\t\t! currentInputIsEmpty // Disallow submitting empty values.\n\t\t) {\n\t\t\tevent.preventDefault();\n\t\t\thandleSubmit();\n\t\t}\n\t};\n\n\tconst resetInternalValues = () => {\n\t\tsetInternalControlValue( value );\n\t};\n\n\tconst handleCancel = ( event ) => {\n\t\tevent.preventDefault();\n\t\tevent.stopPropagation();\n\n\t\t// Ensure that any unsubmitted input changes are reset.\n\t\tresetInternalValues();\n\n\t\tif ( hasLinkValue ) {\n\t\t\t// If there is a link then exist editing mode and show preview.\n\t\t\tstopEditing();\n\t\t} else {\n\t\t\t// If there is no link value, then remove the link entirely.\n\t\t\tonRemove?.();\n\t\t}\n\n\t\tonCancel?.();\n\t};\n\n\tconst currentUrlInputValue =\n\t\tpropInputValue || internalControlValue?.url || '';\n\n\tconst currentInputIsEmpty = ! currentUrlInputValue?.trim()?.length;\n\n\tconst shownUnlinkControl =\n\t\tonRemove && value && ! isEditingLink && ! isCreatingPage;\n\n\tconst showActions = isEditingLink && hasLinkValue;\n\n\t// Only show text control once a URL value has been committed\n\t// and it isn't just empty whitespace.\n\t// See https://github.com/WordPress/gutenberg/pull/33849/#issuecomment-932194927.\n\tconst showTextControl = hasLinkValue && hasTextControl;\n\n\tconst isEditing = ( isEditingLink || ! value ) && ! isCreatingPage;\n\tconst isDisabled = ! valueHasChanges || currentInputIsEmpty;\n\tconst showSettings = !! settings?.length && isEditingLink && hasLinkValue;\n\n\treturn (\n\t\t<div\n\t\t\ttabIndex={ -1 }\n\t\t\tref={ wrapperNode }\n\t\t\tclassName=\"block-editor-link-control\"\n\t\t>\n\t\t\t{ isCreatingPage && (\n\t\t\t\t<div className=\"block-editor-link-control__loading\">\n\t\t\t\t\t<Spinner /> { __( 'Creating' ) }…\n\t\t\t\t</div>\n\t\t\t) }\n\n\t\t\t{ isEditing && (\n\t\t\t\t<>\n\t\t\t\t\t<div\n\t\t\t\t\t\tclassName={ clsx( {\n\t\t\t\t\t\t\t'block-editor-link-control__search-input-wrapper': true,\n\t\t\t\t\t\t\t'has-text-control': showTextControl,\n\t\t\t\t\t\t\t'has-actions': showActions,\n\t\t\t\t\t\t} ) }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ showTextControl && (\n\t\t\t\t\t\t\t<TextControl\n\t\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\t\tref={ textInputRef }\n\t\t\t\t\t\t\t\tclassName=\"block-editor-link-control__field block-editor-link-control__text-content\"\n\t\t\t\t\t\t\t\tlabel={ __( 'Text' ) }\n\t\t\t\t\t\t\t\tvalue={ internalControlValue?.title }\n\t\t\t\t\t\t\t\tonChange={ setInternalTextInputValue }\n\t\t\t\t\t\t\t\tonKeyDown={ handleSubmitWithEnter }\n\t\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t<LinkControlSearchInput\n\t\t\t\t\t\t\tcurrentLink={ value }\n\t\t\t\t\t\t\tclassName=\"block-editor-link-control__field block-editor-link-control__search-input\"\n\t\t\t\t\t\t\tplaceholder={ searchInputPlaceholder }\n\t\t\t\t\t\t\tvalue={ currentUrlInputValue }\n\t\t\t\t\t\t\twithCreateSuggestion={ withCreateSuggestion }\n\t\t\t\t\t\t\tonCreateSuggestion={ createPage }\n\t\t\t\t\t\t\tonChange={ setInternalURLInputValue }\n\t\t\t\t\t\t\tonSelect={ handleSelectSuggestion }\n\t\t\t\t\t\t\tshowInitialSuggestions={ showInitialSuggestions }\n\t\t\t\t\t\t\tallowDirectEntry={ ! noDirectEntry }\n\t\t\t\t\t\t\tshowSuggestions={ showSuggestions }\n\t\t\t\t\t\t\tsuggestionsQuery={ suggestionsQuery }\n\t\t\t\t\t\t\twithURLSuggestion={ ! noURLSuggestion }\n\t\t\t\t\t\t\tcreateSuggestionButtonText={\n\t\t\t\t\t\t\t\tcreateSuggestionButtonText\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\thideLabelFromVision={ ! showTextControl }\n\t\t\t\t\t\t\tsuffix={\n\t\t\t\t\t\t\t\tshowActions ? undefined : (\n\t\t\t\t\t\t\t\t\t<InputControlSuffixWrapper variant=\"control\">\n\t\t\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\t\t\tonClick={\n\t\t\t\t\t\t\t\t\t\t\t\tisDisabled ? noop : handleSubmit\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\tlabel={ __( 'Submit' ) }\n\t\t\t\t\t\t\t\t\t\t\ticon={ keyboardReturn }\n\t\t\t\t\t\t\t\t\t\t\tclassName=\"block-editor-link-control__search-submit\"\n\t\t\t\t\t\t\t\t\t\t\taria-disabled={ isDisabled }\n\t\t\t\t\t\t\t\t\t\t\tsize=\"small\"\n\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t</InputControlSuffixWrapper>\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</div>\n\t\t\t\t\t{ errorMessage && (\n\t\t\t\t\t\t<Notice\n\t\t\t\t\t\t\tclassName=\"block-editor-link-control__search-error\"\n\t\t\t\t\t\t\tstatus=\"error\"\n\t\t\t\t\t\t\tisDismissible={ false }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ errorMessage }\n\t\t\t\t\t\t</Notice>\n\t\t\t\t\t) }\n\t\t\t\t</>\n\t\t\t) }\n\n\t\t\t{ value && ! isEditingLink && ! isCreatingPage && (\n\t\t\t\t<LinkPreview\n\t\t\t\t\tkey={ value?.url } // force remount when URL changes to avoid race conditions for rich previews\n\t\t\t\t\tvalue={ value }\n\t\t\t\t\tonEditClick={ () => setIsEditingLink( true ) }\n\t\t\t\t\thasRichPreviews={ hasRichPreviews }\n\t\t\t\t\thasUnlinkControl={ shownUnlinkControl }\n\t\t\t\t\tonRemove={ () => {\n\t\t\t\t\t\tonRemove();\n\t\t\t\t\t\tsetIsEditingLink( true );\n\t\t\t\t\t} }\n\t\t\t\t/>\n\t\t\t) }\n\n\t\t\t{ showSettings && (\n\t\t\t\t<div className=\"block-editor-link-control__tools\">\n\t\t\t\t\t{ ! currentInputIsEmpty && (\n\t\t\t\t\t\t<LinkControlSettingsDrawer\n\t\t\t\t\t\t\tsettingsOpen={ isSettingsOpen }\n\t\t\t\t\t\t\tsetSettingsOpen={ setSettingsOpenWithPreference }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<LinkSettings\n\t\t\t\t\t\t\t\tvalue={ internalControlValue }\n\t\t\t\t\t\t\t\tsettings={ settings }\n\t\t\t\t\t\t\t\tonChange={ createSetInternalSettingValueHandler(\n\t\t\t\t\t\t\t\t\tsettingsKeys\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</LinkControlSettingsDrawer>\n\t\t\t\t\t) }\n\t\t\t\t</div>\n\t\t\t) }\n\n\t\t\t{ showActions && (\n\t\t\t\t<HStack\n\t\t\t\t\tjustify=\"right\"\n\t\t\t\t\tclassName=\"block-editor-link-control__search-actions\"\n\t\t\t\t>\n\t\t\t\t\t<Button\n\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\t\tonClick={ handleCancel }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Cancel' ) }\n\t\t\t\t\t</Button>\n\t\t\t\t\t<Button\n\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\tonClick={ isDisabled ? noop : handleSubmit }\n\t\t\t\t\t\tclassName=\"block-editor-link-control__search-submit\"\n\t\t\t\t\t\taria-disabled={ isDisabled }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Save' ) }\n\t\t\t\t\t</Button>\n\t\t\t\t</HStack>\n\t\t\t) }\n\n\t\t\t{ ! isCreatingPage && renderControlBottom && renderControlBottom() }\n\t\t</div>\n\t);\n}\n\nLinkControl.ViewerFill = ViewerFill;\nLinkControl.DEFAULT_LINK_SETTINGS = DEFAULT_LINK_SETTINGS;\n\nconst DeprecatedExperimentalLinkControl = ( props ) => {\n\tdeprecated( 'wp.blockEditor.__experimentalLinkControl', {\n\t\tsince: '6.8',\n\t\talternative: 'wp.blockEditor.LinkControl',\n\t} );\n\n\treturn <LinkControl { ...props } />;\n};\n\nDeprecatedExperimentalLinkControl.ViewerFill = LinkControl.ViewerFill;\nDeprecatedExperimentalLinkControl.DEFAULT_LINK_SETTINGS =\n\tLinkControl.DEFAULT_LINK_SETTINGS;\n\nexport { DeprecatedExperimentalLinkControl };\nexport default LinkControl;\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,WAAA,GAAAD,OAAA;AAQA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AACA,IAAAI,IAAA,GAAAJ,OAAA;AACA,IAAAK,SAAA,GAAAL,OAAA;AACA,IAAAM,eAAA,GAAAN,OAAA;AACA,IAAAO,KAAA,GAAAP,OAAA;AACA,IAAAQ,YAAA,GAAAR,OAAA;AACA,IAAAS,MAAA,GAAAT,OAAA;AAKA,IAAAU,eAAA,GAAAX,sBAAA,CAAAC,OAAA;AACA,IAAAW,YAAA,GAAAZ,sBAAA,CAAAC,OAAA;AACA,IAAAY,YAAA,GAAAb,sBAAA,CAAAC,OAAA;AACA,IAAAa,SAAA,GAAAd,sBAAA,CAAAC,OAAA;AACA,IAAAc,cAAA,GA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,WAAW,CAAC4I,UAAU,GAAGA,sBAAU;AACnC5I,WAAW,CAACI,qBAAqB,GAAGA,gCAAqB;AAEzD,MAAMyI,iCAAiC,GAAKC,KAAK,IAAM;EACtD,IAAAC,mBAAU,EAAE,0CAA0C,EAAE;IACvDC,KAAK,EAAE,KAAK;IACZC,WAAW,EAAE;EACd,CAAE,CAAC;EAEH,oBAAO,IAAArJ,WAAA,CAAA+G,GAAA,EAAC3G,WAAW;IAAA,GAAM8I;EAAK,CAAI,CAAC;AACpC,CAAC;AAACI,OAAA,CAAAL,iCAAA,GAAAA,iCAAA;AAEFA,iCAAiC,CAACD,UAAU,GAAG5I,WAAW,CAAC4I,UAAU;AACrEC,iCAAiC,CAACzI,qBAAqB,GACtDJ,WAAW,CAACI,qBAAqB;AAAC,IAAA+I,QAAA,GAAAD,OAAA,CAAA7B,OAAA,GAGpBrH,WAAW","ignoreList":[]}
1
+ {"version":3,"names":["_clsx","_interopRequireDefault","require","_components","_i18n","_element","_dom","_keycodes","_isShallowEqual","_data","_preferences","_icons","_settingsDrawer","_searchInput","_linkPreview","_settings","_useCreatePage","_useInternalValue","_viewerSlot","_constants","_deprecated","_jsxRuntime","noop","PREFERENCE_SCOPE","PREFERENCE_KEY","LinkControl","searchInputPlaceholder","value","settings","DEFAULT_LINK_SETTINGS","onChange","onRemove","onCancel","noDirectEntry","showSuggestions","showInitialSuggestions","forceIsEditingLink","createSuggestion","withCreateSuggestion","inputValue","propInputValue","suggestionsQuery","noURLSuggestion","createSuggestionButtonText","hasRichPreviews","hasTextControl","renderControlBottom","undefined","settingsOpen","setSettingsOpen","useState","advancedSettingsPreference","useSelect","select","_prefsStore$get","prefsStore","preferencesStore","get","set","setPreference","useDispatch","setSettingsOpenWithPreference","prefVal","isSettingsOpen","isMountingRef","useRef","wrapperNode","textInputRef","isEndingEditWithFocusRef","settingsKeys","map","id","internalControlValue","setInternalControlValue","setInternalURLInputValue","setInternalTextInputValue","createSetInternalSettingValueHandler","useInternalValue","valueHasChanges","isShallowEqualObjects","isEditingLink","setIsEditingLink","url","createPage","isCreatingPage","errorMessage","useCreatePage","useEffect","current","nextFocusTarget","focus","focusable","find","hasLinkValue","trim","length","stopEditing","contains","ownerDocument","activeElement","handleSelectSuggestion","updatedValue","nonSettingsChanges","Object","keys","reduce","acc","key","includes","title","handleSubmit","currentUrlInputValue","handleSubmitWithEnter","event","keyCode","ENTER","currentInputIsEmpty","preventDefault","resetInternalValues","handleCancel","stopPropagation","shownUnlinkControl","showActions","showTextControl","isEditing","isDisabled","showSettings","jsxs","tabIndex","ref","className","children","jsx","Spinner","__","Fragment","clsx","TextControl","__nextHasNoMarginBottom","label","onKeyDown","__next40pxDefaultSize","default","currentLink","placeholder","onCreateSuggestion","onSelect","allowDirectEntry","withURLSuggestion","hideLabelFromVision","suffix","__experimentalInputControlSuffixWrapper","variant","Button","onClick","icon","keyboardReturn","size","Notice","status","isDismissible","onEditClick","hasUnlinkControl","__experimentalHStack","justify","ViewerFill","DeprecatedExperimentalLinkControl","props","deprecated","since","alternative","exports","_default"],"sources":["@wordpress/block-editor/src/components/link-control/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tButton,\n\tSpinner,\n\tNotice,\n\tTextControl,\n\t__experimentalHStack as HStack,\n\t__experimentalInputControlSuffixWrapper as InputControlSuffixWrapper,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { useRef, useState, useEffect } from '@wordpress/element';\nimport { focus } from '@wordpress/dom';\nimport { ENTER } from '@wordpress/keycodes';\nimport { isShallowEqualObjects } from '@wordpress/is-shallow-equal';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport { keyboardReturn } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport LinkControlSettingsDrawer from './settings-drawer';\nimport LinkControlSearchInput from './search-input';\nimport LinkPreview from './link-preview';\nimport LinkSettings from './settings';\nimport useCreatePage from './use-create-page';\nimport useInternalValue from './use-internal-value';\nimport { ViewerFill } from './viewer-slot';\nimport { DEFAULT_LINK_SETTINGS } from './constants';\nimport deprecated from '@wordpress/deprecated';\n\n/**\n * Default properties associated with a link control value.\n *\n * @typedef WPLinkControlDefaultValue\n *\n * @property {string} url Link URL.\n * @property {string=} title Link title.\n * @property {boolean=} opensInNewTab Whether link should open in a new browser\n * tab. This value is only assigned if not\n * providing a custom `settings` prop.\n */\n\n/* eslint-disable jsdoc/valid-types */\n/**\n * Custom settings values associated with a link.\n *\n * @typedef {{[setting:string]:any}} WPLinkControlSettingsValue\n */\n/* eslint-enable */\n\n/**\n * Custom settings values associated with a link.\n *\n * @typedef WPLinkControlSetting\n *\n * @property {string} id Identifier to use as property for setting value.\n * @property {string} title Human-readable label to show in user interface.\n */\n\n/**\n * Properties associated with a link control value, composed as a union of the\n * default properties and any custom settings values.\n *\n * @typedef {WPLinkControlDefaultValue&WPLinkControlSettingsValue} WPLinkControlValue\n */\n\n/** @typedef {(nextValue:WPLinkControlValue)=>void} WPLinkControlOnChangeProp */\n\n/**\n * Properties associated with a search suggestion used within the LinkControl.\n *\n * @typedef WPLinkControlSuggestion\n *\n * @property {string} id Identifier to use to uniquely identify the suggestion.\n * @property {string} type Identifies the type of the suggestion (eg: `post`,\n * `page`, `url`...etc)\n * @property {string} title Human-readable label to show in user interface.\n * @property {string} url A URL for the suggestion.\n */\n\n/** @typedef {(title:string)=>WPLinkControlSuggestion} WPLinkControlCreateSuggestionProp */\n\n/**\n * @typedef WPLinkControlProps\n *\n * @property {(WPLinkControlSetting[])=} settings An array of settings objects. Each object will used to\n * render a `ToggleControl` for that setting.\n * @property {boolean=} forceIsEditingLink If passed as either `true` or `false`, controls the\n * internal editing state of the component to respective\n * show or not show the URL input field.\n * @property {WPLinkControlValue=} value Current link value.\n * @property {WPLinkControlOnChangeProp=} onChange Value change handler, called with the updated value if\n * the user selects a new link or updates settings.\n * @property {boolean=} noDirectEntry Whether to allow turning a URL-like search query directly into a link.\n * @property {boolean=} showSuggestions Whether to present suggestions when typing the URL.\n * @property {boolean=} showInitialSuggestions Whether to present initial suggestions immediately.\n * @property {boolean=} withCreateSuggestion Whether to allow creation of link value from suggestion.\n * @property {Object=} suggestionsQuery Query parameters to pass along to wp.blockEditor.__experimentalFetchLinkSuggestions.\n * @property {boolean=} noURLSuggestion Whether to add a fallback suggestion which treats the search query as a URL.\n * @property {boolean=} hasTextControl Whether to add a text field to the UI to update the value.title.\n * @property {string|Function|undefined} createSuggestionButtonText The text to use in the button that calls createSuggestion.\n * @property {Function} renderControlBottom Optional controls to be rendered at the bottom of the component.\n */\n\nconst noop = () => {};\n\nconst PREFERENCE_SCOPE = 'core/block-editor';\nconst PREFERENCE_KEY = 'linkControlSettingsDrawer';\n\n/**\n * Renders a link control. A link control is a controlled input which maintains\n * a value associated with a link (HTML anchor element) and relevant settings\n * for how that link is expected to behave.\n *\n * @param {WPLinkControlProps} props Component props.\n */\nfunction LinkControl( {\n\tsearchInputPlaceholder,\n\tvalue,\n\tsettings = DEFAULT_LINK_SETTINGS,\n\tonChange = noop,\n\tonRemove,\n\tonCancel,\n\tnoDirectEntry = false,\n\tshowSuggestions = true,\n\tshowInitialSuggestions,\n\tforceIsEditingLink,\n\tcreateSuggestion,\n\twithCreateSuggestion,\n\tinputValue: propInputValue = '',\n\tsuggestionsQuery = {},\n\tnoURLSuggestion = false,\n\tcreateSuggestionButtonText,\n\thasRichPreviews = false,\n\thasTextControl = false,\n\trenderControlBottom = null,\n} ) {\n\tif ( withCreateSuggestion === undefined && createSuggestion ) {\n\t\twithCreateSuggestion = true;\n\t}\n\n\tconst [ settingsOpen, setSettingsOpen ] = useState( false );\n\n\tconst { advancedSettingsPreference } = useSelect( ( select ) => {\n\t\tconst prefsStore = select( preferencesStore );\n\n\t\treturn {\n\t\t\tadvancedSettingsPreference:\n\t\t\t\tprefsStore.get( PREFERENCE_SCOPE, PREFERENCE_KEY ) ?? false,\n\t\t};\n\t}, [] );\n\n\tconst { set: setPreference } = useDispatch( preferencesStore );\n\n\t/**\n\t * Sets the open/closed state of the Advanced Settings Drawer,\n\t * optionlly persisting the state to the user's preferences.\n\t *\n\t * Note that Block Editor components can be consumed by non-WordPress\n\t * environments which may not have preferences setup.\n\t * Therefore a local state is also used as a fallback.\n\t *\n\t * @param {boolean} prefVal the open/closed state of the Advanced Settings Drawer.\n\t */\n\tconst setSettingsOpenWithPreference = ( prefVal ) => {\n\t\tif ( setPreference ) {\n\t\t\tsetPreference( PREFERENCE_SCOPE, PREFERENCE_KEY, prefVal );\n\t\t}\n\t\tsetSettingsOpen( prefVal );\n\t};\n\n\t// Block Editor components can be consumed by non-WordPress environments\n\t// which may not have these preferences setup.\n\t// Therefore a local state is used as a fallback.\n\tconst isSettingsOpen = advancedSettingsPreference || settingsOpen;\n\n\tconst isMountingRef = useRef( true );\n\tconst wrapperNode = useRef();\n\tconst textInputRef = useRef();\n\tconst isEndingEditWithFocusRef = useRef( false );\n\n\tconst settingsKeys = settings.map( ( { id } ) => id );\n\n\tconst [\n\t\tinternalControlValue,\n\t\tsetInternalControlValue,\n\t\tsetInternalURLInputValue,\n\t\tsetInternalTextInputValue,\n\t\tcreateSetInternalSettingValueHandler,\n\t] = useInternalValue( value );\n\n\tconst valueHasChanges =\n\t\tvalue && ! isShallowEqualObjects( internalControlValue, value );\n\n\tconst [ isEditingLink, setIsEditingLink ] = useState(\n\t\tforceIsEditingLink !== undefined\n\t\t\t? forceIsEditingLink\n\t\t\t: ! value || ! value.url\n\t);\n\n\tconst { createPage, isCreatingPage, errorMessage } =\n\t\tuseCreatePage( createSuggestion );\n\n\tuseEffect( () => {\n\t\tif ( forceIsEditingLink === undefined ) {\n\t\t\treturn;\n\t\t}\n\n\t\tsetIsEditingLink( forceIsEditingLink );\n\t}, [ forceIsEditingLink ] );\n\n\tuseEffect( () => {\n\t\t// We don't auto focus into the Link UI on mount\n\t\t// because otherwise using the keyboard to select text\n\t\t// *within* the link format is not possible.\n\t\tif ( isMountingRef.current ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Scenario - when:\n\t\t// - switching between editable and non editable LinkControl\n\t\t// - clicking on a link\n\t\t// ...then move focus to the *first* element to avoid focus loss\n\t\t// and to ensure focus is *within* the Link UI.\n\t\tconst nextFocusTarget =\n\t\t\tfocus.focusable.find( wrapperNode.current )[ 0 ] ||\n\t\t\twrapperNode.current;\n\n\t\tnextFocusTarget.focus();\n\n\t\tisEndingEditWithFocusRef.current = false;\n\t}, [ isEditingLink, isCreatingPage ] );\n\n\t// The component mounting reference is maintained separately\n\t// to correctly reset values in `StrictMode`.\n\tuseEffect( () => {\n\t\tisMountingRef.current = false;\n\n\t\treturn () => {\n\t\t\tisMountingRef.current = true;\n\t\t};\n\t}, [] );\n\n\tconst hasLinkValue = value?.url?.trim()?.length > 0;\n\n\t/**\n\t * Cancels editing state and marks that focus may need to be restored after\n\t * the next render, if focus was within the wrapper when editing finished.\n\t */\n\tconst stopEditing = () => {\n\t\tisEndingEditWithFocusRef.current = !! wrapperNode.current?.contains(\n\t\t\twrapperNode.current.ownerDocument.activeElement\n\t\t);\n\n\t\tsetIsEditingLink( false );\n\t};\n\n\tconst handleSelectSuggestion = ( updatedValue ) => {\n\t\t// Suggestions may contains \"settings\" values (e.g. `opensInNewTab`)\n\t\t// which should not override any existing settings values set by the\n\t\t// user. This filters out any settings values from the suggestion.\n\t\tconst nonSettingsChanges = Object.keys( updatedValue ).reduce(\n\t\t\t( acc, key ) => {\n\t\t\t\tif ( ! settingsKeys.includes( key ) ) {\n\t\t\t\t\tacc[ key ] = updatedValue[ key ];\n\t\t\t\t}\n\t\t\t\treturn acc;\n\t\t\t},\n\t\t\t{}\n\t\t);\n\n\t\tonChange( {\n\t\t\t...internalControlValue,\n\t\t\t...nonSettingsChanges,\n\t\t\t// As title is not a setting, it must be manually applied\n\t\t\t// in such a way as to preserve the users changes over\n\t\t\t// any \"title\" value provided by the \"suggestion\".\n\t\t\ttitle: internalControlValue?.title || updatedValue?.title,\n\t\t} );\n\n\t\tstopEditing();\n\t};\n\n\tconst handleSubmit = () => {\n\t\tif ( valueHasChanges ) {\n\t\t\t// Submit the original value with new stored values applied\n\t\t\t// on top. URL is a special case as it may also be a prop.\n\t\t\tonChange( {\n\t\t\t\t...value,\n\t\t\t\t...internalControlValue,\n\t\t\t\turl: currentUrlInputValue,\n\t\t\t} );\n\t\t}\n\t\tstopEditing();\n\t};\n\n\tconst handleSubmitWithEnter = ( event ) => {\n\t\tconst { keyCode } = event;\n\n\t\tif (\n\t\t\tkeyCode === ENTER &&\n\t\t\t! currentInputIsEmpty // Disallow submitting empty values.\n\t\t) {\n\t\t\tevent.preventDefault();\n\t\t\thandleSubmit();\n\t\t}\n\t};\n\n\tconst resetInternalValues = () => {\n\t\tsetInternalControlValue( value );\n\t};\n\n\tconst handleCancel = ( event ) => {\n\t\tevent.preventDefault();\n\t\tevent.stopPropagation();\n\n\t\t// Ensure that any unsubmitted input changes are reset.\n\t\tresetInternalValues();\n\n\t\tif ( hasLinkValue ) {\n\t\t\t// If there is a link then exist editing mode and show preview.\n\t\t\tstopEditing();\n\t\t} else {\n\t\t\t// If there is no link value, then remove the link entirely.\n\t\t\tonRemove?.();\n\t\t}\n\n\t\tonCancel?.();\n\t};\n\n\tconst currentUrlInputValue =\n\t\tpropInputValue || internalControlValue?.url || '';\n\n\tconst currentInputIsEmpty = ! currentUrlInputValue?.trim()?.length;\n\n\tconst shownUnlinkControl =\n\t\tonRemove && value && ! isEditingLink && ! isCreatingPage;\n\n\tconst showActions = isEditingLink && hasLinkValue;\n\n\t// Only show text control once a URL value has been committed\n\t// and it isn't just empty whitespace.\n\t// See https://github.com/WordPress/gutenberg/pull/33849/#issuecomment-932194927.\n\tconst showTextControl = hasLinkValue && hasTextControl;\n\n\tconst isEditing = ( isEditingLink || ! value ) && ! isCreatingPage;\n\tconst isDisabled = ! valueHasChanges || currentInputIsEmpty;\n\tconst showSettings = !! settings?.length && isEditingLink && hasLinkValue;\n\n\treturn (\n\t\t<div\n\t\t\ttabIndex={ -1 }\n\t\t\tref={ wrapperNode }\n\t\t\tclassName=\"block-editor-link-control\"\n\t\t>\n\t\t\t{ isCreatingPage && (\n\t\t\t\t<div className=\"block-editor-link-control__loading\">\n\t\t\t\t\t<Spinner /> { __( 'Creating' ) }…\n\t\t\t\t</div>\n\t\t\t) }\n\n\t\t\t{ isEditing && (\n\t\t\t\t<>\n\t\t\t\t\t<div\n\t\t\t\t\t\tclassName={ clsx( {\n\t\t\t\t\t\t\t'block-editor-link-control__search-input-wrapper': true,\n\t\t\t\t\t\t\t'has-text-control': showTextControl,\n\t\t\t\t\t\t\t'has-actions': showActions,\n\t\t\t\t\t\t} ) }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ showTextControl && (\n\t\t\t\t\t\t\t<TextControl\n\t\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\t\tref={ textInputRef }\n\t\t\t\t\t\t\t\tclassName=\"block-editor-link-control__field block-editor-link-control__text-content\"\n\t\t\t\t\t\t\t\tlabel={ __( 'Text' ) }\n\t\t\t\t\t\t\t\tvalue={ internalControlValue?.title }\n\t\t\t\t\t\t\t\tonChange={ setInternalTextInputValue }\n\t\t\t\t\t\t\t\tonKeyDown={ handleSubmitWithEnter }\n\t\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t<LinkControlSearchInput\n\t\t\t\t\t\t\tcurrentLink={ value }\n\t\t\t\t\t\t\tclassName=\"block-editor-link-control__field block-editor-link-control__search-input\"\n\t\t\t\t\t\t\tplaceholder={ searchInputPlaceholder }\n\t\t\t\t\t\t\tvalue={ currentUrlInputValue }\n\t\t\t\t\t\t\twithCreateSuggestion={ withCreateSuggestion }\n\t\t\t\t\t\t\tonCreateSuggestion={ createPage }\n\t\t\t\t\t\t\tonChange={ setInternalURLInputValue }\n\t\t\t\t\t\t\tonSelect={ handleSelectSuggestion }\n\t\t\t\t\t\t\tshowInitialSuggestions={ showInitialSuggestions }\n\t\t\t\t\t\t\tallowDirectEntry={ ! noDirectEntry }\n\t\t\t\t\t\t\tshowSuggestions={ showSuggestions }\n\t\t\t\t\t\t\tsuggestionsQuery={ suggestionsQuery }\n\t\t\t\t\t\t\twithURLSuggestion={ ! noURLSuggestion }\n\t\t\t\t\t\t\tcreateSuggestionButtonText={\n\t\t\t\t\t\t\t\tcreateSuggestionButtonText\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\thideLabelFromVision={ ! showTextControl }\n\t\t\t\t\t\t\tsuffix={\n\t\t\t\t\t\t\t\tshowActions ? undefined : (\n\t\t\t\t\t\t\t\t\t<InputControlSuffixWrapper variant=\"control\">\n\t\t\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\t\t\tonClick={\n\t\t\t\t\t\t\t\t\t\t\t\tisDisabled ? noop : handleSubmit\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\tlabel={ __( 'Submit' ) }\n\t\t\t\t\t\t\t\t\t\t\ticon={ keyboardReturn }\n\t\t\t\t\t\t\t\t\t\t\tclassName=\"block-editor-link-control__search-submit\"\n\t\t\t\t\t\t\t\t\t\t\taria-disabled={ isDisabled }\n\t\t\t\t\t\t\t\t\t\t\tsize=\"small\"\n\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t</InputControlSuffixWrapper>\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</div>\n\t\t\t\t\t{ errorMessage && (\n\t\t\t\t\t\t<Notice\n\t\t\t\t\t\t\tclassName=\"block-editor-link-control__search-error\"\n\t\t\t\t\t\t\tstatus=\"error\"\n\t\t\t\t\t\t\tisDismissible={ false }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ errorMessage }\n\t\t\t\t\t\t</Notice>\n\t\t\t\t\t) }\n\t\t\t\t</>\n\t\t\t) }\n\n\t\t\t{ value && ! isEditingLink && ! isCreatingPage && (\n\t\t\t\t<LinkPreview\n\t\t\t\t\tkey={ value?.url } // force remount when URL changes to avoid race conditions for rich previews\n\t\t\t\t\tvalue={ value }\n\t\t\t\t\tonEditClick={ () => setIsEditingLink( true ) }\n\t\t\t\t\thasRichPreviews={ hasRichPreviews }\n\t\t\t\t\thasUnlinkControl={ shownUnlinkControl }\n\t\t\t\t\tonRemove={ () => {\n\t\t\t\t\t\tonRemove();\n\t\t\t\t\t\tsetIsEditingLink( true );\n\t\t\t\t\t} }\n\t\t\t\t/>\n\t\t\t) }\n\n\t\t\t{ showSettings && (\n\t\t\t\t<div className=\"block-editor-link-control__tools\">\n\t\t\t\t\t{ ! currentInputIsEmpty && (\n\t\t\t\t\t\t<LinkControlSettingsDrawer\n\t\t\t\t\t\t\tsettingsOpen={ isSettingsOpen }\n\t\t\t\t\t\t\tsetSettingsOpen={ setSettingsOpenWithPreference }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<LinkSettings\n\t\t\t\t\t\t\t\tvalue={ internalControlValue }\n\t\t\t\t\t\t\t\tsettings={ settings }\n\t\t\t\t\t\t\t\tonChange={ createSetInternalSettingValueHandler(\n\t\t\t\t\t\t\t\t\tsettingsKeys\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</LinkControlSettingsDrawer>\n\t\t\t\t\t) }\n\t\t\t\t</div>\n\t\t\t) }\n\n\t\t\t{ showActions && (\n\t\t\t\t<HStack\n\t\t\t\t\tjustify=\"right\"\n\t\t\t\t\tclassName=\"block-editor-link-control__search-actions\"\n\t\t\t\t>\n\t\t\t\t\t<Button\n\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\t\tonClick={ handleCancel }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Cancel' ) }\n\t\t\t\t\t</Button>\n\t\t\t\t\t<Button\n\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\tonClick={ isDisabled ? noop : handleSubmit }\n\t\t\t\t\t\tclassName=\"block-editor-link-control__search-submit\"\n\t\t\t\t\t\taria-disabled={ isDisabled }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Apply' ) }\n\t\t\t\t\t</Button>\n\t\t\t\t</HStack>\n\t\t\t) }\n\n\t\t\t{ ! isCreatingPage && renderControlBottom && renderControlBottom() }\n\t\t</div>\n\t);\n}\n\nLinkControl.ViewerFill = ViewerFill;\nLinkControl.DEFAULT_LINK_SETTINGS = DEFAULT_LINK_SETTINGS;\n\nconst DeprecatedExperimentalLinkControl = ( props ) => {\n\tdeprecated( 'wp.blockEditor.__experimentalLinkControl', {\n\t\tsince: '6.8',\n\t\talternative: 'wp.blockEditor.LinkControl',\n\t} );\n\n\treturn <LinkControl { ...props } />;\n};\n\nDeprecatedExperimentalLinkControl.ViewerFill = LinkControl.ViewerFill;\nDeprecatedExperimentalLinkControl.DEFAULT_LINK_SETTINGS =\n\tLinkControl.DEFAULT_LINK_SETTINGS;\n\nexport { DeprecatedExperimentalLinkControl };\nexport default LinkControl;\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,WAAA,GAAAD,OAAA;AAQA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AACA,IAAAI,IAAA,GAAAJ,OAAA;AACA,IAAAK,SAAA,GAAAL,OAAA;AACA,IAAAM,eAAA,GAAAN,OAAA;AACA,IAAAO,KAAA,GAAAP,OAAA;AACA,IAAAQ,YAAA,GAAAR,OAAA;AACA,IAAAS,MAAA,GAAAT,OAAA;AAKA,IAAAU,eAAA,GAAAX,sBAAA,CAAAC,OAAA;AACA,IAAAW,YAAA,GAAAZ,sBAAA,CAAAC,OAAA;AACA,IAAAY,YAAA,GAAAb,sBAAA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D,cAAc,IAAItC,mBAAmB,IAAIA,mBAAmB,CAAC,CAAC;EAAA,CAC9D,CAAC;AAER;AAEArB,WAAW,CAAC4I,UAAU,GAAGA,sBAAU;AACnC5I,WAAW,CAACI,qBAAqB,GAAGA,gCAAqB;AAEzD,MAAMyI,iCAAiC,GAAKC,KAAK,IAAM;EACtD,IAAAC,mBAAU,EAAE,0CAA0C,EAAE;IACvDC,KAAK,EAAE,KAAK;IACZC,WAAW,EAAE;EACd,CAAE,CAAC;EAEH,oBAAO,IAAArJ,WAAA,CAAA+G,GAAA,EAAC3G,WAAW;IAAA,GAAM8I;EAAK,CAAI,CAAC;AACpC,CAAC;AAACI,OAAA,CAAAL,iCAAA,GAAAA,iCAAA;AAEFA,iCAAiC,CAACD,UAAU,GAAG5I,WAAW,CAAC4I,UAAU;AACrEC,iCAAiC,CAACzI,qBAAqB,GACtDJ,WAAW,CAACI,qBAAqB;AAAC,IAAA+I,QAAA,GAAAD,OAAA,CAAA7B,OAAA,GAGpBrH,WAAW","ignoreList":[]}
@@ -11,6 +11,7 @@ var _element = require("@wordpress/element");
11
11
  var _icons = require("@wordpress/icons");
12
12
  var _keycodes = require("@wordpress/keycodes");
13
13
  var _data = require("@wordpress/data");
14
+ var _blocks = require("@wordpress/blocks");
14
15
  var _blockIcon = _interopRequireDefault(require("../block-icon"));
15
16
  var _useBlockDisplayInformation = _interopRequireDefault(require("../use-block-display-information"));
16
17
  var _useBlockDisplayTitle = _interopRequireDefault(require("../block-title/use-block-display-title"));
@@ -61,11 +62,24 @@ function ListViewBlockSelectButton({
61
62
  isLocked
62
63
  } = (0, _blockLock.useBlockLock)(clientId);
63
64
  const {
65
+ canToggleBlockVisibility,
66
+ isBlockHidden,
64
67
  isContentOnly
65
- } = (0, _data.useSelect)(select => ({
66
- isContentOnly: select(_store.store).getBlockEditingMode(clientId) === 'contentOnly'
67
- }), [clientId]);
68
+ } = (0, _data.useSelect)(select => {
69
+ const {
70
+ getBlockName
71
+ } = select(_store.store);
72
+ const {
73
+ isBlockHidden: _isBlockHidden
74
+ } = (0, _lockUnlock.unlock)(select(_store.store));
75
+ return {
76
+ canToggleBlockVisibility: (0, _blocks.hasBlockSupport)(getBlockName(clientId), 'blockVisibility', true),
77
+ isBlockHidden: _isBlockHidden(clientId),
78
+ isContentOnly: select(_store.store).getBlockEditingMode(clientId) === 'contentOnly'
79
+ };
80
+ }, [clientId]);
68
81
  const shouldShowLockIcon = isLocked && !isContentOnly;
82
+ const shouldShowBlockVisibilityIcon = canToggleBlockVisibility && isBlockHidden;
69
83
  const isSticky = blockInformation?.positionType === 'sticky';
70
84
  const images = (0, _useListViewImages.default)({
71
85
  clientId,
@@ -142,7 +156,12 @@ function ListViewBlockSelectButton({
142
156
  zIndex: images.length - index // Ensure the first image is on top, and subsequent images are behind.
143
157
  }
144
158
  }, image.clientId))
145
- }) : null, shouldShowLockIcon && /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
159
+ }) : null, shouldShowBlockVisibilityIcon && /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
160
+ className: "block-editor-list-view-block-select-button__block-visibility",
161
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_icons.Icon, {
162
+ icon: _icons.unseen
163
+ })
164
+ }), shouldShowLockIcon && /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
146
165
  className: "block-editor-list-view-block-select-button__lock",
147
166
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_icons.Icon, {
148
167
  icon: _icons.lockSmall
@@ -1 +1 @@
1
- {"version":3,"names":["_clsx","_interopRequireDefault","require","_components","_element","_icons","_keycodes","_data","_blockIcon","_useBlockDisplayInformation","_useBlockDisplayTitle","_expander","_blockLock","_useListViewImages","_store","_lockUnlock","_jsxRuntime","Badge","unlock","componentsPrivateApis","ListViewBlockSelectButton","className","block","clientId","onClick","onContextMenu","onMouseDown","onToggleExpanded","tabIndex","onFocus","onDragStart","onDragEnd","draggable","isExpanded","ariaDescribedBy","ref","blockInformation","useBlockDisplayInformation","blockTitle","useBlockDisplayTitle","context","isLocked","useBlockLock","isContentOnly","useSelect","select","blockEditorStore","getBlockEditingMode","shouldShowLockIcon","isSticky","positionType","images","useListViewImages","onDragStartHandler","event","dataTransfer","clearData","onKeyDown","keyCode","ENTER","SPACE","jsxs","clsx","href","children","jsx","default","icon","showColors","__experimentalHStack","alignment","justify","spacing","__experimentalTruncate","ellipsizeMode","anchor","Icon","pinSmall","length","map","image","index","style","backgroundImage","url","zIndex","lock","_default","exports","forwardRef"],"sources":["@wordpress/block-editor/src/components/list-view/block-select-button.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalHStack as HStack,\n\t__experimentalTruncate as Truncate,\n\tprivateApis as componentsPrivateApis,\n} from '@wordpress/components';\nimport { forwardRef } from '@wordpress/element';\nimport { Icon, lockSmall as lock, pinSmall } from '@wordpress/icons';\nimport { SPACE, ENTER } from '@wordpress/keycodes';\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport BlockIcon from '../block-icon';\nimport useBlockDisplayInformation from '../use-block-display-information';\nimport useBlockDisplayTitle from '../block-title/use-block-display-title';\nimport ListViewExpander from './expander';\nimport { useBlockLock } from '../block-lock';\nimport useListViewImages from './use-list-view-images';\nimport { store as blockEditorStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\nconst { Badge } = unlock( componentsPrivateApis );\n\nfunction ListViewBlockSelectButton(\n\t{\n\t\tclassName,\n\t\tblock: { clientId },\n\t\tonClick,\n\t\tonContextMenu,\n\t\tonMouseDown,\n\t\tonToggleExpanded,\n\t\ttabIndex,\n\t\tonFocus,\n\t\tonDragStart,\n\t\tonDragEnd,\n\t\tdraggable,\n\t\tisExpanded,\n\t\tariaDescribedBy,\n\t},\n\tref\n) {\n\tconst blockInformation = useBlockDisplayInformation( clientId );\n\tconst blockTitle = useBlockDisplayTitle( {\n\t\tclientId,\n\t\tcontext: 'list-view',\n\t} );\n\tconst { isLocked } = useBlockLock( clientId );\n\tconst { isContentOnly } = useSelect(\n\t\t( select ) => ( {\n\t\t\tisContentOnly:\n\t\t\t\tselect( blockEditorStore ).getBlockEditingMode( clientId ) ===\n\t\t\t\t'contentOnly',\n\t\t} ),\n\t\t[ clientId ]\n\t);\n\tconst shouldShowLockIcon = isLocked && ! isContentOnly;\n\tconst isSticky = blockInformation?.positionType === 'sticky';\n\tconst images = useListViewImages( { clientId, isExpanded } );\n\n\t// The `href` attribute triggers the browser's native HTML drag operations.\n\t// When the link is dragged, the element's outerHTML is set in DataTransfer object as text/html.\n\t// We need to clear any HTML drag data to prevent `pasteHandler` from firing\n\t// inside the `useOnBlockDrop` hook.\n\tconst onDragStartHandler = ( event ) => {\n\t\tevent.dataTransfer.clearData();\n\t\tonDragStart?.( event );\n\t};\n\n\t/**\n\t * @param {KeyboardEvent} event\n\t */\n\tfunction onKeyDown( event ) {\n\t\tif ( event.keyCode === ENTER || event.keyCode === SPACE ) {\n\t\t\tonClick( event );\n\t\t}\n\t}\n\n\treturn (\n\t\t<a\n\t\t\tclassName={ clsx(\n\t\t\t\t'block-editor-list-view-block-select-button',\n\t\t\t\tclassName\n\t\t\t) }\n\t\t\tonClick={ onClick }\n\t\t\tonContextMenu={ onContextMenu }\n\t\t\tonKeyDown={ onKeyDown }\n\t\t\tonMouseDown={ onMouseDown }\n\t\t\tref={ ref }\n\t\t\ttabIndex={ tabIndex }\n\t\t\tonFocus={ onFocus }\n\t\t\tonDragStart={ onDragStartHandler }\n\t\t\tonDragEnd={ onDragEnd }\n\t\t\tdraggable={ draggable }\n\t\t\thref={ `#block-${ clientId }` }\n\t\t\taria-describedby={ ariaDescribedBy }\n\t\t\taria-expanded={ isExpanded }\n\t\t>\n\t\t\t<ListViewExpander onClick={ onToggleExpanded } />\n\t\t\t<BlockIcon\n\t\t\t\ticon={ blockInformation?.icon }\n\t\t\t\tshowColors\n\t\t\t\tcontext=\"list-view\"\n\t\t\t/>\n\t\t\t<HStack\n\t\t\t\talignment=\"center\"\n\t\t\t\tclassName=\"block-editor-list-view-block-select-button__label-wrapper\"\n\t\t\t\tjustify=\"flex-start\"\n\t\t\t\tspacing={ 1 }\n\t\t\t>\n\t\t\t\t<span className=\"block-editor-list-view-block-select-button__title\">\n\t\t\t\t\t<Truncate ellipsizeMode=\"auto\">{ blockTitle }</Truncate>\n\t\t\t\t</span>\n\t\t\t\t{ blockInformation?.anchor && (\n\t\t\t\t\t<span className=\"block-editor-list-view-block-select-button__anchor-wrapper\">\n\t\t\t\t\t\t<Badge className=\"block-editor-list-view-block-select-button__anchor\">\n\t\t\t\t\t\t\t{ blockInformation.anchor }\n\t\t\t\t\t\t</Badge>\n\t\t\t\t\t</span>\n\t\t\t\t) }\n\t\t\t\t{ isSticky && (\n\t\t\t\t\t<span className=\"block-editor-list-view-block-select-button__sticky\">\n\t\t\t\t\t\t<Icon icon={ pinSmall } />\n\t\t\t\t\t</span>\n\t\t\t\t) }\n\t\t\t\t{ images.length ? (\n\t\t\t\t\t<span\n\t\t\t\t\t\tclassName=\"block-editor-list-view-block-select-button__images\"\n\t\t\t\t\t\taria-hidden\n\t\t\t\t\t>\n\t\t\t\t\t\t{ images.map( ( image, index ) => (\n\t\t\t\t\t\t\t<span\n\t\t\t\t\t\t\t\tclassName=\"block-editor-list-view-block-select-button__image\"\n\t\t\t\t\t\t\t\tkey={ image.clientId }\n\t\t\t\t\t\t\t\tstyle={ {\n\t\t\t\t\t\t\t\t\tbackgroundImage: `url(${ image.url })`,\n\t\t\t\t\t\t\t\t\tzIndex: images.length - index, // Ensure the first image is on top, and subsequent images are behind.\n\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t) ) }\n\t\t\t\t\t</span>\n\t\t\t\t) : null }\n\t\t\t\t{ shouldShowLockIcon && (\n\t\t\t\t\t<span className=\"block-editor-list-view-block-select-button__lock\">\n\t\t\t\t\t\t<Icon icon={ lock } />\n\t\t\t\t\t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AAA;QACC5C,SAAS,EAAC,oDAAoD;QAC9D,mBAAW;QAAA2C,QAAA,EAETb,MAAM,CAAC4B,GAAG,CAAE,CAAEC,KAAK,EAAEC,KAAK,kBAC3B,IAAAjE,WAAA,CAAAiD,GAAA;UACC5C,SAAS,EAAC,mDAAmD;UAE7D6D,KAAK,EAAG;YACPC,eAAe,EAAE,OAAQH,KAAK,CAACI,GAAG,GAAI;YACtCC,MAAM,EAAElC,MAAM,CAAC2B,MAAM,GAAGG,KAAK,CAAE;UAChC;QAAG,GAJGD,KAAK,CAACzD,QAKZ,CACA;MAAC,CACE,CAAC,GACJ,IAAI,EACNyB,kBAAkB,iBACnB,IAAAhC,WAAA,CAAAiD,GAAA;QAAM5C,SAAS,EAAC,kDAAkD;QAAA2C,QAAA,eACjE,IAAAhD,WAAA,CAAAiD,GAAA,EAAC5D,MAAA,CAAAuE,IAAI;UAACT,IAAI,EAAGmB;QAAM,CAAE;MAAC,CACjB,CACN;IAAA,CACM,CAAC;EAAA,CACP,CAAC;AAEN;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAtB,OAAA,GAEc,IAAAuB,mBAAU,EAAErE,yBAA0B,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["_clsx","_interopRequireDefault","require","_components","_element","_icons","_keycodes","_data","_blocks","_blockIcon","_useBlockDisplayInformation","_useBlockDisplayTitle","_expander","_blockLock","_useListViewImages","_store","_lockUnlock","_jsxRuntime","Badge","unlock","componentsPrivateApis","ListViewBlockSelectButton","className","block","clientId","onClick","onContextMenu","onMouseDown","onToggleExpanded","tabIndex","onFocus","onDragStart","onDragEnd","draggable","isExpanded","ariaDescribedBy","ref","blockInformation","useBlockDisplayInformation","blockTitle","useBlockDisplayTitle","context","isLocked","useBlockLock","canToggleBlockVisibility","isBlockHidden","isContentOnly","useSelect","select","getBlockName","blockEditorStore","_isBlockHidden","hasBlockSupport","getBlockEditingMode","shouldShowLockIcon","shouldShowBlockVisibilityIcon","isSticky","positionType","images","useListViewImages","onDragStartHandler","event","dataTransfer","clearData","onKeyDown","keyCode","ENTER","SPACE","jsxs","clsx","href","children","jsx","default","icon","showColors","__experimentalHStack","alignment","justify","spacing","__experimentalTruncate","ellipsizeMode","anchor","Icon","pinSmall","length","map","image","index","style","backgroundImage","url","zIndex","unseen","lock","_default","exports","forwardRef"],"sources":["@wordpress/block-editor/src/components/list-view/block-select-button.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalHStack as HStack,\n\t__experimentalTruncate as Truncate,\n\tprivateApis as componentsPrivateApis,\n} from '@wordpress/components';\nimport { forwardRef } from '@wordpress/element';\nimport { Icon, lockSmall as lock, pinSmall, unseen } from '@wordpress/icons';\nimport { SPACE, ENTER } from '@wordpress/keycodes';\nimport { useSelect } from '@wordpress/data';\nimport { hasBlockSupport } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport BlockIcon from '../block-icon';\nimport useBlockDisplayInformation from '../use-block-display-information';\nimport useBlockDisplayTitle from '../block-title/use-block-display-title';\nimport ListViewExpander from './expander';\nimport { useBlockLock } from '../block-lock';\nimport useListViewImages from './use-list-view-images';\nimport { store as blockEditorStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\n\nconst { Badge } = unlock( componentsPrivateApis );\n\nfunction ListViewBlockSelectButton(\n\t{\n\t\tclassName,\n\t\tblock: { clientId },\n\t\tonClick,\n\t\tonContextMenu,\n\t\tonMouseDown,\n\t\tonToggleExpanded,\n\t\ttabIndex,\n\t\tonFocus,\n\t\tonDragStart,\n\t\tonDragEnd,\n\t\tdraggable,\n\t\tisExpanded,\n\t\tariaDescribedBy,\n\t},\n\tref\n) {\n\tconst blockInformation = useBlockDisplayInformation( clientId );\n\tconst blockTitle = useBlockDisplayTitle( {\n\t\tclientId,\n\t\tcontext: 'list-view',\n\t} );\n\tconst { isLocked } = useBlockLock( clientId );\n\tconst { canToggleBlockVisibility, isBlockHidden, isContentOnly } =\n\t\tuseSelect(\n\t\t\t( select ) => {\n\t\t\t\tconst { getBlockName } = select( blockEditorStore );\n\t\t\t\tconst { isBlockHidden: _isBlockHidden } = unlock(\n\t\t\t\t\tselect( blockEditorStore )\n\t\t\t\t);\n\t\t\t\treturn {\n\t\t\t\t\tcanToggleBlockVisibility: hasBlockSupport(\n\t\t\t\t\t\tgetBlockName( clientId ),\n\t\t\t\t\t\t'blockVisibility',\n\t\t\t\t\t\ttrue\n\t\t\t\t\t),\n\t\t\t\t\tisBlockHidden: _isBlockHidden( clientId ),\n\t\t\t\t\tisContentOnly:\n\t\t\t\t\t\tselect( blockEditorStore ).getBlockEditingMode(\n\t\t\t\t\t\t\tclientId\n\t\t\t\t\t\t) === 'contentOnly',\n\t\t\t\t};\n\t\t\t},\n\t\t\t[ clientId ]\n\t\t);\n\tconst shouldShowLockIcon = isLocked && ! isContentOnly;\n\tconst shouldShowBlockVisibilityIcon =\n\t\tcanToggleBlockVisibility && isBlockHidden;\n\tconst isSticky = blockInformation?.positionType === 'sticky';\n\tconst images = useListViewImages( { clientId, isExpanded } );\n\n\t// The `href` attribute triggers the browser's native HTML drag operations.\n\t// When the link is dragged, the element's outerHTML is set in DataTransfer object as text/html.\n\t// We need to clear any HTML drag data to prevent `pasteHandler` from firing\n\t// inside the `useOnBlockDrop` hook.\n\tconst onDragStartHandler = ( event ) => {\n\t\tevent.dataTransfer.clearData();\n\t\tonDragStart?.( event );\n\t};\n\n\t/**\n\t * @param {KeyboardEvent} event\n\t */\n\tfunction onKeyDown( event ) {\n\t\tif ( event.keyCode === ENTER || event.keyCode === SPACE ) {\n\t\t\tonClick( event );\n\t\t}\n\t}\n\n\treturn (\n\t\t<a\n\t\t\tclassName={ clsx(\n\t\t\t\t'block-editor-list-view-block-select-button',\n\t\t\t\tclassName\n\t\t\t) }\n\t\t\tonClick={ onClick }\n\t\t\tonContextMenu={ onContextMenu }\n\t\t\tonKeyDown={ onKeyDown }\n\t\t\tonMouseDown={ onMouseDown }\n\t\t\tref={ ref }\n\t\t\ttabIndex={ tabIndex }\n\t\t\tonFocus={ onFocus }\n\t\t\tonDragStart={ onDragStartHandler }\n\t\t\tonDragEnd={ onDragEnd }\n\t\t\tdraggable={ draggable }\n\t\t\thref={ `#block-${ clientId }` }\n\t\t\taria-describedby={ ariaDescribedBy }\n\t\t\taria-expanded={ isExpanded }\n\t\t>\n\t\t\t<ListViewExpander onClick={ onToggleExpanded } />\n\t\t\t<BlockIcon\n\t\t\t\ticon={ blockInformation?.icon }\n\t\t\t\tshowColors\n\t\t\t\tcontext=\"list-view\"\n\t\t\t/>\n\t\t\t<HStack\n\t\t\t\talignment=\"center\"\n\t\t\t\tclassName=\"block-editor-list-view-block-select-button__label-wrapper\"\n\t\t\t\tjustify=\"flex-start\"\n\t\t\t\tspacing={ 1 }\n\t\t\t>\n\t\t\t\t<span className=\"block-editor-list-view-block-select-button__title\">\n\t\t\t\t\t<Truncate ellipsizeMode=\"auto\">{ blockTitle }</Truncate>\n\t\t\t\t</span>\n\t\t\t\t{ blockInformation?.anchor && (\n\t\t\t\t\t<span className=\"block-editor-list-view-block-select-button__anchor-wrapper\">\n\t\t\t\t\t\t<Badge className=\"block-editor-list-view-block-select-button__anchor\">\n\t\t\t\t\t\t\t{ blockInformation.anchor }\n\t\t\t\t\t\t</Badge>\n\t\t\t\t\t</span>\n\t\t\t\t) }\n\t\t\t\t{ isSticky && (\n\t\t\t\t\t<span className=\"block-editor-list-view-block-select-button__sticky\">\n\t\t\t\t\t\t<Icon icon={ pinSmall } />\n\t\t\t\t\t</span>\n\t\t\t\t) }\n\t\t\t\t{ images.length ? (\n\t\t\t\t\t<span\n\t\t\t\t\t\tclassName=\"block-editor-list-view-block-select-button__images\"\n\t\t\t\t\t\taria-hidden\n\t\t\t\t\t>\n\t\t\t\t\t\t{ images.map( ( image, index ) => (\n\t\t\t\t\t\t\t<span\n\t\t\t\t\t\t\t\tclassName=\"block-editor-list-view-block-select-button__image\"\n\t\t\t\t\t\t\t\tkey={ image.clientId }\n\t\t\t\t\t\t\t\tstyle={ {\n\t\t\t\t\t\t\t\t\tbackgroundImage: `url(${ image.url })`,\n\t\t\t\t\t\t\t\t\tzIndex: images.length - index, // Ensure the first image is on top, and subsequent images are behind.\n\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t) ) }\n\t\t\t\t\t</span>\n\t\t\t\t) : null }\n\t\t\t\t{ shouldShowBlockVisibilityIcon && (\n\t\t\t\t\t<span className=\"block-editor-list-view-block-select-button__block-visibility\">\n\t\t\t\t\t\t<Icon icon={ unseen } />\n\t\t\t\t\t</span>\n\t\t\t\t) }\n\t\t\t\t{ shouldShowLockIcon && (\n\t\t\t\t\t<span className=\"block-editor-list-view-block-select-button__lock\">\n\t\t\t\t\t\t<Icon icon={ lock } />\n\t\t\t\t\t</span>\n\t\t\t\t) }\n\t\t\t</HStack>\n\t\t</a>\n\t);\n}\n\nexport default forwardRef( ListViewBlockSelectButton );\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,WAAA,GAAAD,OAAA;AAKA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,MAAA,GAAAH,OAAA;AACA,IAAAI,SAAA,GAAAJ,OAAA;AACA,IAAAK,KAAA,GAAAL,OAAA;AACA,IAAAM,OAAA,GAAAN,OAAA;AAKA,IAAAO,UAAA,GAAAR,sBAAA,CAAAC,OAAA;AACA,IAAAQ,2BAAA,GAAAT,sBAAA,CAAAC,OAAA;AACA,IAAAS,qBAAA,GAAAV,sBAAA,CAAAC,OAAA;AACA,IAAAU,SAAA,GAAAX,sBAAA,CAAAC,OAAA;AACA,IAAAW,UAAA,GAAAX,OAAA;AACA,IAAAY,kBAAA,GAAAb,sBAAA,CAAAC,OAAA;AACA,IAAAa,MAAA,GAAAb,OAAA;AACA,IAAAc,WAAA,GAAAd,OAAA;AAA2C,IAAAe,WAAA,GAAAf,OAAA;AA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CC,MAAM,EAAElC,MAAM,CAAC2B,MAAM,GAAGG,KAAK,CAAE;UAChC;QAAG,GAJGD,KAAK,CAAC/D,QAKZ,CACA;MAAC,CACE,CAAC,GACJ,IAAI,EACN+B,6BAA6B,iBAC9B,IAAAtC,WAAA,CAAAuD,GAAA;QAAMlD,SAAS,EAAC,8DAA8D;QAAAiD,QAAA,eAC7E,IAAAtD,WAAA,CAAAuD,GAAA,EAACnE,MAAA,CAAA8E,IAAI;UAACT,IAAI,EAAGmB;QAAQ,CAAE;MAAC,CACnB,CACN,EACCvC,kBAAkB,iBACnB,IAAArC,WAAA,CAAAuD,GAAA;QAAMlD,SAAS,EAAC,kDAAkD;QAAAiD,QAAA,eACjE,IAAAtD,WAAA,CAAAuD,GAAA,EAACnE,MAAA,CAAA8E,IAAI;UAACT,IAAI,EAAGoB;QAAM,CAAE;MAAC,CACjB,CACN;IAAA,CACM,CAAC;EAAA,CACP,CAAC;AAEN;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAvB,OAAA,GAEc,IAAAwB,mBAAU,EAAE5E,yBAA0B,CAAC","ignoreList":[]}
@@ -105,17 +105,22 @@ function ListViewBlock({
105
105
  const {
106
106
  block,
107
107
  blockName,
108
- allowRightClickOverrides
108
+ allowRightClickOverrides,
109
+ isBlockHidden
109
110
  } = (0, _data.useSelect)(select => {
110
111
  const {
111
112
  getBlock,
112
113
  getBlockName,
113
114
  getSettings
114
115
  } = select(_store.store);
116
+ const {
117
+ isBlockHidden: _isBlockHidden
118
+ } = (0, _lockUnlock.unlock)(select(_store.store));
115
119
  return {
116
120
  block: getBlock(clientId),
117
121
  blockName: getBlockName(clientId),
118
- allowRightClickOverrides: getSettings().allowRightClickOverrides
122
+ allowRightClickOverrides: getSettings().allowRightClickOverrides,
123
+ isBlockHidden: _isBlockHidden(clientId)
119
124
  };
120
125
  }, [clientId]);
121
126
  const showBlockActions =
@@ -393,6 +398,7 @@ function ListViewBlock({
393
398
  }
394
399
  const blockPositionDescription = (0, _utils.getBlockPositionDescription)(position, siblingBlockCount, level);
395
400
  const blockPropertiesDescription = (0, _utils.getBlockPropertiesDescription)(blockInformation, isLocked);
401
+ const blockVisibilityDescription = isBlockHidden ? (0, _i18n.__)('Block is hidden.') : null;
396
402
  const hasSiblings = siblingBlockCount > 0;
397
403
  const hasRenderedMovers = showBlockMovers && hasSiblings;
398
404
  const moverCellClassName = (0, _clsx.default)('block-editor-list-view-block__mover-cell', {
@@ -477,7 +483,7 @@ function ListViewBlock({
477
483
  ariaDescribedBy: descriptionId
478
484
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ariaReferencedText.default, {
479
485
  id: descriptionId,
480
- children: [blockPositionDescription, blockPropertiesDescription].filter(Boolean).join(' ')
486
+ children: [blockPositionDescription, blockPropertiesDescription, blockVisibilityDescription].filter(Boolean).join(' ')
481
487
  })]
482
488
  })
483
489
  }), hasRenderedMovers && /*#__PURE__*/(0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {