@wordpress/block-directory 4.12.0 → 4.12.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/components/downloadable-block-list-item/index.js +4 -6
- package/build/components/downloadable-block-list-item/index.js.map +1 -1
- package/build/components/downloadable-blocks-list/index.js +2 -4
- package/build/components/downloadable-blocks-list/index.js.map +1 -1
- package/build/plugins/get-install-missing/index.js +6 -6
- package/build/plugins/get-install-missing/index.js.map +1 -1
- package/build-module/components/downloadable-block-list-item/index.js +4 -5
- package/build-module/components/downloadable-block-list-item/index.js.map +1 -1
- package/build-module/components/downloadable-blocks-list/index.js +2 -3
- package/build-module/components/downloadable-blocks-list/index.js.map +1 -1
- package/build-module/plugins/get-install-missing/index.js +6 -5
- package/build-module/plugins/get-install-missing/index.js.map +1 -1
- package/package.json +20 -20
|
@@ -9,8 +9,6 @@ exports.default = void 0;
|
|
|
9
9
|
|
|
10
10
|
var _element = require("@wordpress/element");
|
|
11
11
|
|
|
12
|
-
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
13
|
-
|
|
14
12
|
var _i18n = require("@wordpress/i18n");
|
|
15
13
|
|
|
16
14
|
var _components = require("@wordpress/components");
|
|
@@ -113,11 +111,11 @@ function DownloadableBlockListItem({
|
|
|
113
111
|
statusText = (0, _i18n.__)('Installing…');
|
|
114
112
|
}
|
|
115
113
|
|
|
116
|
-
return (0, _element.createElement)(_components.__unstableCompositeItem,
|
|
114
|
+
return (0, _element.createElement)(_components.__unstableCompositeItem, {
|
|
117
115
|
__experimentalIsFocusable: true,
|
|
118
116
|
role: "option",
|
|
119
|
-
as: _components.Button
|
|
120
|
-
|
|
117
|
+
as: _components.Button,
|
|
118
|
+
...composite,
|
|
121
119
|
className: "block-directory-downloadable-block-list-item",
|
|
122
120
|
onClick: event => {
|
|
123
121
|
event.preventDefault();
|
|
@@ -132,7 +130,7 @@ function DownloadableBlockListItem({
|
|
|
132
130
|
}),
|
|
133
131
|
showTooltip: true,
|
|
134
132
|
tooltipPosition: "top center"
|
|
135
|
-
}
|
|
133
|
+
}, (0, _element.createElement)("div", {
|
|
136
134
|
className: "block-directory-downloadable-block-list-item__icon"
|
|
137
135
|
}, (0, _element.createElement)(_downloadableBlockIcon.default, {
|
|
138
136
|
icon: icon,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-directory/src/components/downloadable-block-list-item/index.js"],"names":["getDownloadableBlockLabel","title","rating","ratingCount","hasNotice","isInstalled","isInstalling","stars","Math","round","DownloadableBlockListItem","composite","item","onClick","author","description","icon","name","isInstallable","select","getErrorNoticeForBlock","isBlockInstalling","blockDirectoryStore","notice","id","hasFatal","isFatal","statusText","Button","event","preventDefault","span"],"mappings":";;;;;;;;;AAUA
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-directory/src/components/downloadable-block-list-item/index.js"],"names":["getDownloadableBlockLabel","title","rating","ratingCount","hasNotice","isInstalled","isInstalling","stars","Math","round","DownloadableBlockListItem","composite","item","onClick","author","description","icon","name","isInstallable","select","getErrorNoticeForBlock","isBlockInstalling","blockDirectoryStore","notice","id","hasFatal","isFatal","statusText","Button","event","preventDefault","span"],"mappings":";;;;;;;;;AAUA;;AAPA;;AACA;;AAOA;;AACA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AArBA;AACA;AACA;;AAaA;AACA;AACA;AAMA;AACA,SAASA,yBAAT,CACC;AAAEC,EAAAA,KAAF;AAASC,EAAAA,MAAT;AAAiBC,EAAAA;AAAjB,CADD,EAEC;AAAEC,EAAAA,SAAF;AAAaC,EAAAA,WAAb;AAA0BC,EAAAA;AAA1B,CAFD,EAGE;AACD,QAAMC,KAAK,GAAGC,IAAI,CAACC,KAAL,CAAYP,MAAM,GAAG,GAArB,IAA6B,GAA3C;;AAEA,MAAK,CAAEG,WAAF,IAAiBD,SAAtB,EAAkC;AACjC;AACA,WAAO,mBAAS,sBAAT,EAAiC,kCAAgBH,KAAh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AAI,2BAAJ,CAFD,EAGC,kCAAgBD,KAAhB,CAHD,EAICa,MAJD,CADC,EAOD;AACCiB,IAAAA,IAAI,EACH;AAAM,MAAA,SAAS,EAAC;AAAhB;AAFF,GAPC,CADH,CADD,EAgBG3B,SAAS,GACV,4BAAC,gCAAD;AAAyB,IAAA,KAAK,EAAGQ;AAAjC,IADU,GAGV,qDACC;AAAM,IAAA,SAAS,EAAC;AAAhB,KACG,CAAC,CAAEe,UAAH,GACCA,UADD,GAEC,kCAAgBZ,WAAhB,CAHJ,CADD,EAMGG,aAAa,IACd,EAAIb,WAAW,IAAIC,YAAnB,CADC,IAEA,4BAAC,0BAAD,QACG,cAAI,eAAJ,CADH,CARH,CAnBF,CA9BD,CADD;AAmEA;;eAEcI,yB","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, _n, sprintf } from '@wordpress/i18n';\nimport {\n\tButton,\n\tSpinner,\n\tVisuallyHidden,\n\t__unstableCompositeItem as CompositeItem,\n} from '@wordpress/components';\nimport { createInterpolateElement } from '@wordpress/element';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { getBlockType } from '@wordpress/blocks';\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport BlockRatings from '../block-ratings';\nimport DownloadableBlockIcon from '../downloadable-block-icon';\nimport DownloadableBlockNotice from '../downloadable-block-notice';\nimport { store as blockDirectoryStore } from '../../store';\n\n// Return the appropriate block item label, given the block data and status.\nfunction getDownloadableBlockLabel(\n\t{ title, rating, ratingCount },\n\t{ hasNotice, isInstalled, isInstalling }\n) {\n\tconst stars = Math.round( rating / 0.5 ) * 0.5;\n\n\tif ( ! isInstalled && hasNotice ) {\n\t\t/* translators: %1$s: block title */\n\t\treturn sprintf( 'Retry installing %s.', decodeEntities( title ) );\n\t}\n\n\tif ( isInstalled ) {\n\t\t/* translators: %1$s: block title */\n\t\treturn sprintf( 'Add %s.', decodeEntities( title ) );\n\t}\n\n\tif ( isInstalling ) {\n\t\t/* translators: %1$s: block title */\n\t\treturn sprintf( 'Installing %s.', decodeEntities( title ) );\n\t}\n\n\t// No ratings yet, just use the title.\n\tif ( ratingCount < 1 ) {\n\t\t/* translators: %1$s: block title */\n\t\treturn sprintf( 'Install %s.', decodeEntities( title ) );\n\t}\n\n\treturn sprintf(\n\t\t/* translators: %1$s: block title, %2$s: average rating, %3$s: total ratings count. */\n\t\t_n(\n\t\t\t'Install %1$s. %2$s stars with %3$s review.',\n\t\t\t'Install %1$s. %2$s stars with %3$s reviews.',\n\t\t\tratingCount\n\t\t),\n\t\tdecodeEntities( title ),\n\t\tstars,\n\t\tratingCount\n\t);\n}\n\nfunction DownloadableBlockListItem( { composite, item, onClick } ) {\n\tconst { author, description, icon, rating, title } = item;\n\t// getBlockType returns a block object if this block exists, or null if not.\n\tconst isInstalled = !! getBlockType( item.name );\n\n\tconst { hasNotice, isInstalling, isInstallable } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getErrorNoticeForBlock, isInstalling: isBlockInstalling } =\n\t\t\t\tselect( blockDirectoryStore );\n\t\t\tconst notice = getErrorNoticeForBlock( item.id );\n\t\t\tconst hasFatal = notice && notice.isFatal;\n\t\t\treturn {\n\t\t\t\thasNotice: !! notice,\n\t\t\t\tisInstalling: isBlockInstalling( item.id ),\n\t\t\t\tisInstallable: ! hasFatal,\n\t\t\t};\n\t\t},\n\t\t[ item ]\n\t);\n\n\tlet statusText = '';\n\tif ( isInstalled ) {\n\t\tstatusText = __( 'Installed!' );\n\t} else if ( isInstalling ) {\n\t\tstatusText = __( 'Installing…' );\n\t}\n\n\treturn (\n\t\t<CompositeItem\n\t\t\t__experimentalIsFocusable\n\t\t\trole=\"option\"\n\t\t\tas={ Button }\n\t\t\t{ ...composite }\n\t\t\tclassName=\"block-directory-downloadable-block-list-item\"\n\t\t\tonClick={ ( event ) => {\n\t\t\t\tevent.preventDefault();\n\t\t\t\tonClick();\n\t\t\t} }\n\t\t\tisBusy={ isInstalling }\n\t\t\tdisabled={ isInstalling || ! isInstallable }\n\t\t\tlabel={ getDownloadableBlockLabel( item, {\n\t\t\t\thasNotice,\n\t\t\t\tisInstalled,\n\t\t\t\tisInstalling,\n\t\t\t} ) }\n\t\t\tshowTooltip={ true }\n\t\t\ttooltipPosition=\"top center\"\n\t\t>\n\t\t\t<div className=\"block-directory-downloadable-block-list-item__icon\">\n\t\t\t\t<DownloadableBlockIcon icon={ icon } title={ title } />\n\t\t\t\t{ isInstalling ? (\n\t\t\t\t\t<span className=\"block-directory-downloadable-block-list-item__spinner\">\n\t\t\t\t\t\t<Spinner />\n\t\t\t\t\t</span>\n\t\t\t\t) : (\n\t\t\t\t\t<BlockRatings rating={ rating } />\n\t\t\t\t) }\n\t\t\t</div>\n\t\t\t<span className=\"block-directory-downloadable-block-list-item__details\">\n\t\t\t\t<span className=\"block-directory-downloadable-block-list-item__title\">\n\t\t\t\t\t{ createInterpolateElement(\n\t\t\t\t\t\tsprintf(\n\t\t\t\t\t\t\t/* translators: %1$s: block title, %2$s: author name. */\n\t\t\t\t\t\t\t__( '%1$s <span>by %2$s</span>' ),\n\t\t\t\t\t\t\tdecodeEntities( title ),\n\t\t\t\t\t\t\tauthor\n\t\t\t\t\t\t),\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tspan: (\n\t\t\t\t\t\t\t\t<span className=\"block-directory-downloadable-block-list-item__author\" />\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t}\n\t\t\t\t\t) }\n\t\t\t\t</span>\n\t\t\t\t{ hasNotice ? (\n\t\t\t\t\t<DownloadableBlockNotice block={ item } />\n\t\t\t\t) : (\n\t\t\t\t\t<>\n\t\t\t\t\t\t<span className=\"block-directory-downloadable-block-list-item__desc\">\n\t\t\t\t\t\t\t{ !! statusText\n\t\t\t\t\t\t\t\t? statusText\n\t\t\t\t\t\t\t\t: decodeEntities( description ) }\n\t\t\t\t\t\t</span>\n\t\t\t\t\t\t{ isInstallable &&\n\t\t\t\t\t\t\t! ( isInstalled || isInstalling ) && (\n\t\t\t\t\t\t\t\t<VisuallyHidden>\n\t\t\t\t\t\t\t\t\t{ __( 'Install block' ) }\n\t\t\t\t\t\t\t\t</VisuallyHidden>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t</>\n\t\t\t\t) }\n\t\t\t</span>\n\t\t</CompositeItem>\n\t);\n}\n\nexport default DownloadableBlockListItem;\n"]}
|
|
@@ -9,8 +9,6 @@ exports.default = void 0;
|
|
|
9
9
|
|
|
10
10
|
var _element = require("@wordpress/element");
|
|
11
11
|
|
|
12
|
-
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
13
|
-
|
|
14
12
|
var _i18n = require("@wordpress/i18n");
|
|
15
13
|
|
|
16
14
|
var _components = require("@wordpress/components");
|
|
@@ -46,11 +44,11 @@ function DownloadableBlocksList({
|
|
|
46
44
|
return null;
|
|
47
45
|
}
|
|
48
46
|
|
|
49
|
-
return (0, _element.createElement)(_components.__unstableComposite,
|
|
47
|
+
return (0, _element.createElement)(_components.__unstableComposite, { ...composite,
|
|
50
48
|
role: "listbox",
|
|
51
49
|
className: "block-directory-downloadable-blocks-list",
|
|
52
50
|
"aria-label": (0, _i18n.__)('Blocks available for install')
|
|
53
|
-
}
|
|
51
|
+
}, items.map(item => {
|
|
54
52
|
return (0, _element.createElement)(_downloadableBlockListItem.default, {
|
|
55
53
|
key: item.id,
|
|
56
54
|
composite: composite,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-directory/src/components/downloadable-blocks-list/index.js"],"names":["noop","DownloadableBlocksList","items","onHover","onSelect","composite","installBlockType","blockDirectoryStore","length","map","item","id","name","then","success"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-directory/src/components/downloadable-blocks-list/index.js"],"names":["noop","DownloadableBlocksList","items","onHover","onSelect","composite","installBlockType","blockDirectoryStore","length","map","item","id","name","then","success"],"mappings":";;;;;;;;;;;AAGA;;AACA;;AAIA;;AACA;;AAKA;;AACA;;AAfA;AACA;AACA;;AASA;AACA;AACA;AAIA,MAAMA,IAAI,GAAG,MAAM,CAAE,CAArB;;AAEA,SAASC,sBAAT,CAAiC;AAAEC,EAAAA,KAAF;AAASC,EAAAA,OAAO,GAAGH,IAAnB;AAAyBI,EAAAA;AAAzB,CAAjC,EAAuE;AACtE,QAAMC,SAAS,GAAG,8CAAlB;AACA,QAAM;AAAEC,IAAAA;AAAF,MAAuB,uBAAaC,YAAb,CAA7B;;AAEA,MAAK,CAAEL,KAAK,CAACM,MAAb,EAAsB;AACrB,WAAO,IAAP;AACA;;AAED,SACC,4BAAC,+BAAD,OACMH,SADN;AAEC,IAAA,IAAI,EAAC,SAFN;AAGC,IAAA,SAAS,EAAC,0CAHX;AAIC,kBAAa,cAAI,8BAAJ;AAJd,KAMGH,KAAK,CAACO,GAAN,CAAaC,IAAF,IAAY;AACxB,WACC,4BAAC,kCAAD;AACC,MAAA,GAAG,EAAGA,IAAI,CAACC,EADZ;AAEC,MAAA,SAAS,EAAGN,SAFb;AAGC,MAAA,OAAO,EAAG,MAAM;AACf;AACA;AACA;AACA,YAAK,0BAAcK,IAAI,CAACE,IAAnB,CAAL,EAAiC;AAChCR,UAAAA,QAAQ,CAAEM,IAAF,CAAR;AACA,SAFD,MAEO;AACNJ,UAAAA,gBAAgB,CAAEI,IAAF,CAAhB,CAAyBG,IAAzB,CAAiCC,OAAF,IAAe;AAC7C,gBAAKA,OAAL,EAAe;AACdV,cAAAA,QAAQ,CAAEM,IAAF,CAAR;AACA;AACD,WAJD;AAKA;;AACDP,QAAAA,OAAO,CAAE,IAAF,CAAP;AACA,OAjBF;AAkBC,MAAA,OAAO,EAAGA,OAlBX;AAmBC,MAAA,IAAI,EAAGO;AAnBR,MADD;AAuBA,GAxBC,CANH,CADD;AAkCA;;eAEcT,sB","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport {\n\t__unstableComposite as Composite,\n\t__unstableUseCompositeState as useCompositeState,\n} from '@wordpress/components';\nimport { getBlockType } from '@wordpress/blocks';\nimport { useDispatch } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport DownloadableBlockListItem from '../downloadable-block-list-item';\nimport { store as blockDirectoryStore } from '../../store';\n\nconst noop = () => {};\n\nfunction DownloadableBlocksList( { items, onHover = noop, onSelect } ) {\n\tconst composite = useCompositeState();\n\tconst { installBlockType } = useDispatch( blockDirectoryStore );\n\n\tif ( ! items.length ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<Composite\n\t\t\t{ ...composite }\n\t\t\trole=\"listbox\"\n\t\t\tclassName=\"block-directory-downloadable-blocks-list\"\n\t\t\taria-label={ __( 'Blocks available for install' ) }\n\t\t>\n\t\t\t{ items.map( ( item ) => {\n\t\t\t\treturn (\n\t\t\t\t\t<DownloadableBlockListItem\n\t\t\t\t\t\tkey={ item.id }\n\t\t\t\t\t\tcomposite={ composite }\n\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t// Check if the block is registered (`getBlockType`\n\t\t\t\t\t\t\t// will return an object). If so, insert the block.\n\t\t\t\t\t\t\t// This prevents installing existing plugins.\n\t\t\t\t\t\t\tif ( getBlockType( item.name ) ) {\n\t\t\t\t\t\t\t\tonSelect( item );\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tinstallBlockType( item ).then( ( success ) => {\n\t\t\t\t\t\t\t\t\tif ( success ) {\n\t\t\t\t\t\t\t\t\t\tonSelect( item );\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tonHover( null );\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tonHover={ onHover }\n\t\t\t\t\t\titem={ item }\n\t\t\t\t\t/>\n\t\t\t\t);\n\t\t\t} ) }\n\t\t</Composite>\n\t);\n}\n\nexport default DownloadableBlocksList;\n"]}
|
|
@@ -9,8 +9,6 @@ exports.default = void 0;
|
|
|
9
9
|
|
|
10
10
|
var _element = require("@wordpress/element");
|
|
11
11
|
|
|
12
|
-
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
13
|
-
|
|
14
12
|
var _i18n = require("@wordpress/i18n");
|
|
15
13
|
|
|
16
14
|
var _components = require("@wordpress/components");
|
|
@@ -57,12 +55,13 @@ const getInstallMissing = OriginalComponent => props => {
|
|
|
57
55
|
}, [originalName]); // The user can't install blocks, or the block isn't available for download.
|
|
58
56
|
|
|
59
57
|
if (!hasPermission || !block) {
|
|
60
|
-
return (0, _element.createElement)(OriginalComponent, props
|
|
58
|
+
return (0, _element.createElement)(OriginalComponent, { ...props
|
|
59
|
+
});
|
|
61
60
|
}
|
|
62
61
|
|
|
63
|
-
return (0, _element.createElement)(ModifiedWarning,
|
|
62
|
+
return (0, _element.createElement)(ModifiedWarning, { ...props,
|
|
64
63
|
originalBlock: block
|
|
65
|
-
})
|
|
64
|
+
});
|
|
66
65
|
};
|
|
67
66
|
|
|
68
67
|
const ModifiedWarning = ({
|
|
@@ -113,7 +112,8 @@ const ModifiedWarning = ({
|
|
|
113
112
|
}, (0, _i18n.__)('Keep as HTML')));
|
|
114
113
|
}
|
|
115
114
|
|
|
116
|
-
return (0, _element.createElement)("div", (0, _blockEditor.useBlockProps)()
|
|
115
|
+
return (0, _element.createElement)("div", { ...(0, _blockEditor.useBlockProps)()
|
|
116
|
+
}, (0, _element.createElement)(_blockEditor.Warning, {
|
|
117
117
|
actions: actions
|
|
118
118
|
}, messageHTML), (0, _element.createElement)(_element.RawHTML, null, originalUndelimitedContent));
|
|
119
119
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-directory/src/plugins/get-install-missing/index.js"],"names":["getInstallMissing","OriginalComponent","props","originalName","attributes","block","hasPermission","select","getDownloadableBlocks","blockDirectoryStore","blocks","filter","name","coreStore","canUser","length","ModifiedWarning","originalBlock","originalUndelimitedContent","clientId","replaceBlock","blockEditorStore","convertToHTML","content","hasContent","hasHTMLBlock","canInsertBlockType","getBlockRootClientId","messageHTML","title","actions","push"],"mappings":";;;;;;;;;AAMA
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-directory/src/plugins/get-install-missing/index.js"],"names":["getInstallMissing","OriginalComponent","props","originalName","attributes","block","hasPermission","select","getDownloadableBlocks","blockDirectoryStore","blocks","filter","name","coreStore","canUser","length","ModifiedWarning","originalBlock","originalUndelimitedContent","clientId","replaceBlock","blockEditorStore","convertToHTML","content","hasContent","hasHTMLBlock","canInsertBlockType","getBlockRootClientId","messageHTML","title","actions","push"],"mappings":";;;;;;;;;AAMA;;AAHA;;AACA;;AACA;;AAEA;;AACA;;AACA;;AASA;;AACA;;AAnBA;AACA;AACA;;AAaA;AACA;AACA;AAIA,MAAMA,iBAAiB,GAAKC,iBAAF,IAA2BC,KAAF,IAAa;AAC/D,QAAM;AAAEC,IAAAA;AAAF,MAAmBD,KAAK,CAACE,UAA/B,CAD+D,CAE/D;AACA;;AACA,QAAM;AAAEC,IAAAA,KAAF;AAASC,IAAAA;AAAT,MAA2B,qBAC9BC,MAAF,IAAc;AACb,UAAM;AAAEC,MAAAA;AAAF,QAA4BD,MAAM,CAAEE,YAAF,CAAxC;AACA,UAAMC,MAAM,GAAGF,qBAAqB,CACnC,WAAWL,YADwB,CAArB,CAEbQ,MAFa,CAEL,CAAE;AAAEC,MAAAA;AAAF,KAAF,KAAgBT,YAAY,KAAKS,IAF5B,CAAf;AAGA,WAAO;AACNN,MAAAA,aAAa,EAAEC,MAAM,CAAEM,eAAF,CAAN,CAAoBC,OAApB,CACd,MADc,EAEd,wBAFc,CADT;AAKNT,MAAAA,KAAK,EAAEK,MAAM,CAACK,MAAP,IAAiBL,MAAM,CAAE,CAAF;AALxB,KAAP;AAOA,GAb+B,EAchC,CAAEP,YAAF,CAdgC,CAAjC,CAJ+D,CAqB/D;;AACA,MAAK,CAAEG,aAAF,IAAmB,CAAED,KAA1B,EAAkC;AACjC,WAAO,4BAAC,iBAAD,OAAwBH;AA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iJADD,CAFa,EAKbX,aAAa,CAACY,KAAd,IAAuB1B,YALV,CAAd;AAOA2B,IAAAA,OAAO,CAACC,IAAR,CACC,4BAAC,kBAAD;AAAQ,MAAA,GAAG,EAAC,SAAZ;AAAsB,MAAA,OAAO,EAAGT,aAAhC;AAAgD,MAAA,OAAO,EAAC;AAAxD,OACG,cAAI,cAAJ,CADH,CADD;AAKA;;AAED,SACC,wCAAU;AAAV,KACC,4BAAC,oBAAD;AAAS,IAAA,OAAO,EAAGQ;AAAnB,KAA+BF,WAA/B,CADD,EAEC,4BAAC,gBAAD,QAAWV,0BAAX,CAFD,CADD;AAMA,CAhED;;eAkEelB,iB","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, sprintf } from '@wordpress/i18n';\nimport { Button } from '@wordpress/components';\nimport { createBlock } from '@wordpress/blocks';\nimport { RawHTML } from '@wordpress/element';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport {\n\tWarning,\n\tuseBlockProps,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport InstallButton from './install-button';\nimport { store as blockDirectoryStore } from '../../store';\n\nconst getInstallMissing = ( OriginalComponent ) => ( props ) => {\n\tconst { originalName } = props.attributes;\n\t// Disable reason: This is a valid component, but it's mistaken for a callback.\n\t// eslint-disable-next-line react-hooks/rules-of-hooks\n\tconst { block, hasPermission } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getDownloadableBlocks } = select( blockDirectoryStore );\n\t\t\tconst blocks = getDownloadableBlocks(\n\t\t\t\t'block:' + originalName\n\t\t\t).filter( ( { name } ) => originalName === name );\n\t\t\treturn {\n\t\t\t\thasPermission: select( coreStore ).canUser(\n\t\t\t\t\t'read',\n\t\t\t\t\t'block-directory/search'\n\t\t\t\t),\n\t\t\t\tblock: blocks.length && blocks[ 0 ],\n\t\t\t};\n\t\t},\n\t\t[ originalName ]\n\t);\n\n\t// The user can't install blocks, or the block isn't available for download.\n\tif ( ! hasPermission || ! block ) {\n\t\treturn <OriginalComponent { ...props } />;\n\t}\n\n\treturn <ModifiedWarning { ...props } originalBlock={ block } />;\n};\n\nconst ModifiedWarning = ( { originalBlock, ...props } ) => {\n\tconst { originalName, originalUndelimitedContent, clientId } =\n\t\tprops.attributes;\n\tconst { replaceBlock } = useDispatch( blockEditorStore );\n\tconst convertToHTML = () => {\n\t\treplaceBlock(\n\t\t\tprops.clientId,\n\t\t\tcreateBlock( 'core/html', {\n\t\t\t\tcontent: originalUndelimitedContent,\n\t\t\t} )\n\t\t);\n\t};\n\n\tconst hasContent = !! originalUndelimitedContent;\n\tconst hasHTMLBlock = useSelect(\n\t\t( select ) => {\n\t\t\tconst { canInsertBlockType, getBlockRootClientId } =\n\t\t\t\tselect( blockEditorStore );\n\n\t\t\treturn canInsertBlockType(\n\t\t\t\t'core/html',\n\t\t\t\tgetBlockRootClientId( clientId )\n\t\t\t);\n\t\t},\n\t\t[ clientId ]\n\t);\n\n\tlet messageHTML = sprintf(\n\t\t/* translators: %s: block name */\n\t\t__(\n\t\t\t'Your site doesn’t include support for the %s block. You can try installing the block or remove it entirely.'\n\t\t),\n\t\toriginalBlock.title || originalName\n\t);\n\tconst actions = [\n\t\t<InstallButton\n\t\t\tkey=\"install\"\n\t\t\tblock={ originalBlock }\n\t\t\tattributes={ props.attributes }\n\t\t\tclientId={ props.clientId }\n\t\t/>,\n\t];\n\n\tif ( hasContent && hasHTMLBlock ) {\n\t\tmessageHTML = sprintf(\n\t\t\t/* translators: %s: block name */\n\t\t\t__(\n\t\t\t\t'Your site doesn’t include support for the %s block. You can try installing the block, convert it to a Custom HTML block, or remove it entirely.'\n\t\t\t),\n\t\t\toriginalBlock.title || originalName\n\t\t);\n\t\tactions.push(\n\t\t\t<Button key=\"convert\" onClick={ convertToHTML } variant=\"tertiary\">\n\t\t\t\t{ __( 'Keep as HTML' ) }\n\t\t\t</Button>\n\t\t);\n\t}\n\n\treturn (\n\t\t<div { ...useBlockProps() }>\n\t\t\t<Warning actions={ actions }>{ messageHTML }</Warning>\n\t\t\t<RawHTML>{ originalUndelimitedContent }</RawHTML>\n\t\t</div>\n\t);\n};\n\nexport default getInstallMissing;\n"]}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
1
|
import { createElement, Fragment } from "@wordpress/element";
|
|
3
2
|
|
|
4
3
|
/**
|
|
@@ -95,11 +94,11 @@ function DownloadableBlockListItem({
|
|
|
95
94
|
statusText = __('Installing…');
|
|
96
95
|
}
|
|
97
96
|
|
|
98
|
-
return createElement(CompositeItem,
|
|
97
|
+
return createElement(CompositeItem, {
|
|
99
98
|
__experimentalIsFocusable: true,
|
|
100
99
|
role: "option",
|
|
101
|
-
as: Button
|
|
102
|
-
|
|
100
|
+
as: Button,
|
|
101
|
+
...composite,
|
|
103
102
|
className: "block-directory-downloadable-block-list-item",
|
|
104
103
|
onClick: event => {
|
|
105
104
|
event.preventDefault();
|
|
@@ -114,7 +113,7 @@ function DownloadableBlockListItem({
|
|
|
114
113
|
}),
|
|
115
114
|
showTooltip: true,
|
|
116
115
|
tooltipPosition: "top center"
|
|
117
|
-
}
|
|
116
|
+
}, createElement("div", {
|
|
118
117
|
className: "block-directory-downloadable-block-list-item__icon"
|
|
119
118
|
}, createElement(DownloadableBlockIcon, {
|
|
120
119
|
icon: icon,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-directory/src/components/downloadable-block-list-item/index.js"],"names":["__","_n","sprintf","Button","Spinner","VisuallyHidden","__unstableCompositeItem","CompositeItem","createInterpolateElement","decodeEntities","getBlockType","useSelect","BlockRatings","DownloadableBlockIcon","DownloadableBlockNotice","store","blockDirectoryStore","getDownloadableBlockLabel","title","rating","ratingCount","hasNotice","isInstalled","isInstalling","stars","Math","round","DownloadableBlockListItem","composite","item","onClick","author","description","icon","name","isInstallable","select","getErrorNoticeForBlock","isBlockInstalling","notice","id","hasFatal","isFatal","statusText","event","preventDefault","span"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-directory/src/components/downloadable-block-list-item/index.js"],"names":["__","_n","sprintf","Button","Spinner","VisuallyHidden","__unstableCompositeItem","CompositeItem","createInterpolateElement","decodeEntities","getBlockType","useSelect","BlockRatings","DownloadableBlockIcon","DownloadableBlockNotice","store","blockDirectoryStore","getDownloadableBlockLabel","title","rating","ratingCount","hasNotice","isInstalled","isInstalling","stars","Math","round","DownloadableBlockListItem","composite","item","onClick","author","description","icon","name","isInstallable","select","getErrorNoticeForBlock","isBlockInstalling","notice","id","hasFatal","isFatal","statusText","event","preventDefault","span"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,EAAT,EAAaC,EAAb,EAAiBC,OAAjB,QAAgC,iBAAhC;AACA,SACCC,MADD,EAECC,OAFD,EAGCC,cAHD,EAICC,uBAAuB,IAAIC,aAJ5B,QAKO,uBALP;AAMA,SAASC,wBAAT,QAAyC,oBAAzC;AACA,SAASC,cAAT,QAA+B,0BAA/B;AACA,SAASC,YAAT,QAA6B,mBAA7B;AACA,SAASC,SAAT,QAA0B,iBAA1B;AAEA;AACA;AACA;;AACA,OAAOC,YAAP,MAAyB,kBAAzB;AACA,OAAOC,qBAAP,MAAkC,4BAAlC;AACA,OAAOC,uBAAP,MAAoC,8BAApC;AACA,SAASC,KAAK,IAAIC,mBAAlB,QAA6C,aAA7C,C,CAEA;;AACA,SAASC,yBAAT,CACC;AAAEC,EAAAA,KAAF;AAASC,EAAAA,MAAT;AAAiBC,EAAAA;AAAjB,CADD,EAEC;AAAEC,EAAAA,SAAF;AAAaC,EAAAA,WAAb;AAA0BC,EAAAA;AAA1B,CAFD,EAGE;AACD,QAAMC,KAAK,GAAGC,IAAI,CAACC,KAAL,CAAYP,MAAM,GAAG,GAArB,IAA6B,GAA3C;;AAEA,MAAK,CAAEG,WAAF,IAAiBD,SAAtB,EAAkC;AACjC;AACA,WAAOnB,OAAO,CAAE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IAPF,CApBD,EA8BC;AAAM,IAAA,SAAS,EAAC;AAAhB,KACC;AAAM,IAAA,SAAS,EAAC;AAAhB,KACGX,wBAAwB,CACzBN,OAAO;AACN;AACAF,EAAAA,EAAE,CAAE,2BAAF,CAFI,EAGNS,cAAc,CAAES,KAAF,CAHR,EAINa,MAJM,CADkB,EAOzB;AACCe,IAAAA,IAAI,EACH;AAAM,MAAA,SAAS,EAAC;AAAhB;AAFF,GAPyB,CAD3B,CADD,EAgBGzB,SAAS,GACV,cAAC,uBAAD;AAAyB,IAAA,KAAK,EAAGQ;AAAjC,IADU,GAGV,8BACC;AAAM,IAAA,SAAS,EAAC;AAAhB,KACG,CAAC,CAAEc,UAAH,GACCA,UADD,GAEClC,cAAc,CAAEuB,WAAF,CAHlB,CADD,EAMGG,aAAa,IACd,EAAIb,WAAW,IAAIC,YAAnB,CADC,IAEA,cAAC,cAAD,QACGvB,EAAE,CAAE,eAAF,CADL,CARH,CAnBF,CA9BD,CADD;AAmEA;;AAED,eAAe2B,yBAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, _n, sprintf } from '@wordpress/i18n';\nimport {\n\tButton,\n\tSpinner,\n\tVisuallyHidden,\n\t__unstableCompositeItem as CompositeItem,\n} from '@wordpress/components';\nimport { createInterpolateElement } from '@wordpress/element';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { getBlockType } from '@wordpress/blocks';\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport BlockRatings from '../block-ratings';\nimport DownloadableBlockIcon from '../downloadable-block-icon';\nimport DownloadableBlockNotice from '../downloadable-block-notice';\nimport { store as blockDirectoryStore } from '../../store';\n\n// Return the appropriate block item label, given the block data and status.\nfunction getDownloadableBlockLabel(\n\t{ title, rating, ratingCount },\n\t{ hasNotice, isInstalled, isInstalling }\n) {\n\tconst stars = Math.round( rating / 0.5 ) * 0.5;\n\n\tif ( ! isInstalled && hasNotice ) {\n\t\t/* translators: %1$s: block title */\n\t\treturn sprintf( 'Retry installing %s.', decodeEntities( title ) );\n\t}\n\n\tif ( isInstalled ) {\n\t\t/* translators: %1$s: block title */\n\t\treturn sprintf( 'Add %s.', decodeEntities( title ) );\n\t}\n\n\tif ( isInstalling ) {\n\t\t/* translators: %1$s: block title */\n\t\treturn sprintf( 'Installing %s.', decodeEntities( title ) );\n\t}\n\n\t// No ratings yet, just use the title.\n\tif ( ratingCount < 1 ) {\n\t\t/* translators: %1$s: block title */\n\t\treturn sprintf( 'Install %s.', decodeEntities( title ) );\n\t}\n\n\treturn sprintf(\n\t\t/* translators: %1$s: block title, %2$s: average rating, %3$s: total ratings count. */\n\t\t_n(\n\t\t\t'Install %1$s. %2$s stars with %3$s review.',\n\t\t\t'Install %1$s. %2$s stars with %3$s reviews.',\n\t\t\tratingCount\n\t\t),\n\t\tdecodeEntities( title ),\n\t\tstars,\n\t\tratingCount\n\t);\n}\n\nfunction DownloadableBlockListItem( { composite, item, onClick } ) {\n\tconst { author, description, icon, rating, title } = item;\n\t// getBlockType returns a block object if this block exists, or null if not.\n\tconst isInstalled = !! getBlockType( item.name );\n\n\tconst { hasNotice, isInstalling, isInstallable } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getErrorNoticeForBlock, isInstalling: isBlockInstalling } =\n\t\t\t\tselect( blockDirectoryStore );\n\t\t\tconst notice = getErrorNoticeForBlock( item.id );\n\t\t\tconst hasFatal = notice && notice.isFatal;\n\t\t\treturn {\n\t\t\t\thasNotice: !! notice,\n\t\t\t\tisInstalling: isBlockInstalling( item.id ),\n\t\t\t\tisInstallable: ! hasFatal,\n\t\t\t};\n\t\t},\n\t\t[ item ]\n\t);\n\n\tlet statusText = '';\n\tif ( isInstalled ) {\n\t\tstatusText = __( 'Installed!' );\n\t} else if ( isInstalling ) {\n\t\tstatusText = __( 'Installing…' );\n\t}\n\n\treturn (\n\t\t<CompositeItem\n\t\t\t__experimentalIsFocusable\n\t\t\trole=\"option\"\n\t\t\tas={ Button }\n\t\t\t{ ...composite }\n\t\t\tclassName=\"block-directory-downloadable-block-list-item\"\n\t\t\tonClick={ ( event ) => {\n\t\t\t\tevent.preventDefault();\n\t\t\t\tonClick();\n\t\t\t} }\n\t\t\tisBusy={ isInstalling }\n\t\t\tdisabled={ isInstalling || ! isInstallable }\n\t\t\tlabel={ getDownloadableBlockLabel( item, {\n\t\t\t\thasNotice,\n\t\t\t\tisInstalled,\n\t\t\t\tisInstalling,\n\t\t\t} ) }\n\t\t\tshowTooltip={ true }\n\t\t\ttooltipPosition=\"top center\"\n\t\t>\n\t\t\t<div className=\"block-directory-downloadable-block-list-item__icon\">\n\t\t\t\t<DownloadableBlockIcon icon={ icon } title={ title } />\n\t\t\t\t{ isInstalling ? (\n\t\t\t\t\t<span className=\"block-directory-downloadable-block-list-item__spinner\">\n\t\t\t\t\t\t<Spinner />\n\t\t\t\t\t</span>\n\t\t\t\t) : (\n\t\t\t\t\t<BlockRatings rating={ rating } />\n\t\t\t\t) }\n\t\t\t</div>\n\t\t\t<span className=\"block-directory-downloadable-block-list-item__details\">\n\t\t\t\t<span className=\"block-directory-downloadable-block-list-item__title\">\n\t\t\t\t\t{ createInterpolateElement(\n\t\t\t\t\t\tsprintf(\n\t\t\t\t\t\t\t/* translators: %1$s: block title, %2$s: author name. */\n\t\t\t\t\t\t\t__( '%1$s <span>by %2$s</span>' ),\n\t\t\t\t\t\t\tdecodeEntities( title ),\n\t\t\t\t\t\t\tauthor\n\t\t\t\t\t\t),\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tspan: (\n\t\t\t\t\t\t\t\t<span className=\"block-directory-downloadable-block-list-item__author\" />\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t}\n\t\t\t\t\t) }\n\t\t\t\t</span>\n\t\t\t\t{ hasNotice ? (\n\t\t\t\t\t<DownloadableBlockNotice block={ item } />\n\t\t\t\t) : (\n\t\t\t\t\t<>\n\t\t\t\t\t\t<span className=\"block-directory-downloadable-block-list-item__desc\">\n\t\t\t\t\t\t\t{ !! statusText\n\t\t\t\t\t\t\t\t? statusText\n\t\t\t\t\t\t\t\t: decodeEntities( description ) }\n\t\t\t\t\t\t</span>\n\t\t\t\t\t\t{ isInstallable &&\n\t\t\t\t\t\t\t! ( isInstalled || isInstalling ) && (\n\t\t\t\t\t\t\t\t<VisuallyHidden>\n\t\t\t\t\t\t\t\t\t{ __( 'Install block' ) }\n\t\t\t\t\t\t\t\t</VisuallyHidden>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t</>\n\t\t\t\t) }\n\t\t\t</span>\n\t\t</CompositeItem>\n\t);\n}\n\nexport default DownloadableBlockListItem;\n"]}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
1
|
import { createElement } from "@wordpress/element";
|
|
3
2
|
|
|
4
3
|
/**
|
|
@@ -31,11 +30,11 @@ function DownloadableBlocksList({
|
|
|
31
30
|
return null;
|
|
32
31
|
}
|
|
33
32
|
|
|
34
|
-
return createElement(Composite,
|
|
33
|
+
return createElement(Composite, { ...composite,
|
|
35
34
|
role: "listbox",
|
|
36
35
|
className: "block-directory-downloadable-blocks-list",
|
|
37
36
|
"aria-label": __('Blocks available for install')
|
|
38
|
-
}
|
|
37
|
+
}, items.map(item => {
|
|
39
38
|
return createElement(DownloadableBlockListItem, {
|
|
40
39
|
key: item.id,
|
|
41
40
|
composite: composite,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-directory/src/components/downloadable-blocks-list/index.js"],"names":["__","__unstableComposite","Composite","__unstableUseCompositeState","useCompositeState","getBlockType","useDispatch","DownloadableBlockListItem","store","blockDirectoryStore","noop","DownloadableBlocksList","items","onHover","onSelect","composite","installBlockType","length","map","item","id","name","then","success"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-directory/src/components/downloadable-blocks-list/index.js"],"names":["__","__unstableComposite","Composite","__unstableUseCompositeState","useCompositeState","getBlockType","useDispatch","DownloadableBlockListItem","store","blockDirectoryStore","noop","DownloadableBlocksList","items","onHover","onSelect","composite","installBlockType","length","map","item","id","name","then","success"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,EAAT,QAAmB,iBAAnB;AACA,SACCC,mBAAmB,IAAIC,SADxB,EAECC,2BAA2B,IAAIC,iBAFhC,QAGO,uBAHP;AAIA,SAASC,YAAT,QAA6B,mBAA7B;AACA,SAASC,WAAT,QAA4B,iBAA5B;AAEA;AACA;AACA;;AACA,OAAOC,yBAAP,MAAsC,iCAAtC;AACA,SAASC,KAAK,IAAIC,mBAAlB,QAA6C,aAA7C;;AAEA,MAAMC,IAAI,GAAG,MAAM,CAAE,CAArB;;AAEA,SAASC,sBAAT,CAAiC;AAAEC,EAAAA,KAAF;AAASC,EAAAA,OAAO,GAAGH,IAAnB;AAAyBI,EAAAA;AAAzB,CAAjC,EAAuE;AACtE,QAAMC,SAAS,GAAGX,iBAAiB,EAAnC;AACA,QAAM;AAAEY,IAAAA;AAAF,MAAuBV,WAAW,CAAEG,mBAAF,CAAxC;;AAEA,MAAK,CAAEG,KAAK,CAACK,MAAb,EAAsB;AACrB,WAAO,IAAP;AACA;;AAED,SACC,cAAC,SAAD,OACMF,SADN;AAEC,IAAA,IAAI,EAAC,SAFN;AAGC,IAAA,SAAS,EAAC,0CAHX;AAIC,kBAAaf,EAAE,CAAE,8BAAF;AAJhB,KAMGY,KAAK,CAACM,GAAN,CAAaC,IAAF,IAAY;AACxB,WACC,cAAC,yBAAD;AACC,MAAA,GAAG,EAAGA,IAAI,CAACC,EADZ;AAEC,MAAA,SAAS,EAAGL,SAFb;AAGC,MAAA,OAAO,EAAG,MAAM;AACf;AACA;AACA;AACA,YAAKV,YAAY,CAAEc,IAAI,CAACE,IAAP,CAAjB,EAAiC;AAChCP,UAAAA,QAAQ,CAAEK,IAAF,CAAR;AACA,SAFD,MAEO;AACNH,UAAAA,gBAAgB,CAAEG,IAAF,CAAhB,CAAyBG,IAAzB,CAAiCC,OAAF,IAAe;AAC7C,gBAAKA,OAAL,EAAe;AACdT,cAAAA,QAAQ,CAAEK,IAAF,CAAR;AACA;AACD,WAJD;AAKA;;AACDN,QAAAA,OAAO,CAAE,IAAF,CAAP;AACA,OAjBF;AAkBC,MAAA,OAAO,EAAGA,OAlBX;AAmBC,MAAA,IAAI,EAAGM;AAnBR,MADD;AAuBA,GAxBC,CANH,CADD;AAkCA;;AAED,eAAeR,sBAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport {\n\t__unstableComposite as Composite,\n\t__unstableUseCompositeState as useCompositeState,\n} from '@wordpress/components';\nimport { getBlockType } from '@wordpress/blocks';\nimport { useDispatch } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport DownloadableBlockListItem from '../downloadable-block-list-item';\nimport { store as blockDirectoryStore } from '../../store';\n\nconst noop = () => {};\n\nfunction DownloadableBlocksList( { items, onHover = noop, onSelect } ) {\n\tconst composite = useCompositeState();\n\tconst { installBlockType } = useDispatch( blockDirectoryStore );\n\n\tif ( ! items.length ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<Composite\n\t\t\t{ ...composite }\n\t\t\trole=\"listbox\"\n\t\t\tclassName=\"block-directory-downloadable-blocks-list\"\n\t\t\taria-label={ __( 'Blocks available for install' ) }\n\t\t>\n\t\t\t{ items.map( ( item ) => {\n\t\t\t\treturn (\n\t\t\t\t\t<DownloadableBlockListItem\n\t\t\t\t\t\tkey={ item.id }\n\t\t\t\t\t\tcomposite={ composite }\n\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t// Check if the block is registered (`getBlockType`\n\t\t\t\t\t\t\t// will return an object). If so, insert the block.\n\t\t\t\t\t\t\t// This prevents installing existing plugins.\n\t\t\t\t\t\t\tif ( getBlockType( item.name ) ) {\n\t\t\t\t\t\t\t\tonSelect( item );\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tinstallBlockType( item ).then( ( success ) => {\n\t\t\t\t\t\t\t\t\tif ( success ) {\n\t\t\t\t\t\t\t\t\t\tonSelect( item );\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tonHover( null );\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tonHover={ onHover }\n\t\t\t\t\t\titem={ item }\n\t\t\t\t\t/>\n\t\t\t\t);\n\t\t\t} ) }\n\t\t</Composite>\n\t);\n}\n\nexport default DownloadableBlocksList;\n"]}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
1
|
import { createElement } from "@wordpress/element";
|
|
3
2
|
|
|
4
3
|
/**
|
|
@@ -41,12 +40,13 @@ const getInstallMissing = OriginalComponent => props => {
|
|
|
41
40
|
}, [originalName]); // The user can't install blocks, or the block isn't available for download.
|
|
42
41
|
|
|
43
42
|
if (!hasPermission || !block) {
|
|
44
|
-
return createElement(OriginalComponent, props
|
|
43
|
+
return createElement(OriginalComponent, { ...props
|
|
44
|
+
});
|
|
45
45
|
}
|
|
46
46
|
|
|
47
|
-
return createElement(ModifiedWarning,
|
|
47
|
+
return createElement(ModifiedWarning, { ...props,
|
|
48
48
|
originalBlock: block
|
|
49
|
-
})
|
|
49
|
+
});
|
|
50
50
|
};
|
|
51
51
|
|
|
52
52
|
const ModifiedWarning = ({
|
|
@@ -97,7 +97,8 @@ const ModifiedWarning = ({
|
|
|
97
97
|
}, __('Keep as HTML')));
|
|
98
98
|
}
|
|
99
99
|
|
|
100
|
-
return createElement("div", useBlockProps()
|
|
100
|
+
return createElement("div", { ...useBlockProps()
|
|
101
|
+
}, createElement(Warning, {
|
|
101
102
|
actions: actions
|
|
102
103
|
}, messageHTML), createElement(RawHTML, null, originalUndelimitedContent));
|
|
103
104
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-directory/src/plugins/get-install-missing/index.js"],"names":["__","sprintf","Button","createBlock","RawHTML","useDispatch","useSelect","store","coreStore","Warning","useBlockProps","blockEditorStore","InstallButton","blockDirectoryStore","getInstallMissing","OriginalComponent","props","originalName","attributes","block","hasPermission","select","getDownloadableBlocks","blocks","filter","name","canUser","length","ModifiedWarning","originalBlock","originalUndelimitedContent","clientId","replaceBlock","convertToHTML","content","hasContent","hasHTMLBlock","canInsertBlockType","getBlockRootClientId","messageHTML","title","actions","push"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-directory/src/plugins/get-install-missing/index.js"],"names":["__","sprintf","Button","createBlock","RawHTML","useDispatch","useSelect","store","coreStore","Warning","useBlockProps","blockEditorStore","InstallButton","blockDirectoryStore","getInstallMissing","OriginalComponent","props","originalName","attributes","block","hasPermission","select","getDownloadableBlocks","blocks","filter","name","canUser","length","ModifiedWarning","originalBlock","originalUndelimitedContent","clientId","replaceBlock","convertToHTML","content","hasContent","hasHTMLBlock","canInsertBlockType","getBlockRootClientId","messageHTML","title","actions","push"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,EAAT,EAAaC,OAAb,QAA4B,iBAA5B;AACA,SAASC,MAAT,QAAuB,uBAAvB;AACA,SAASC,WAAT,QAA4B,mBAA5B;AACA,SAASC,OAAT,QAAwB,oBAAxB;AACA,SAASC,WAAT,EAAsBC,SAAtB,QAAuC,iBAAvC;AACA,SAASC,KAAK,IAAIC,SAAlB,QAAmC,sBAAnC;AACA,SACCC,OADD,EAECC,aAFD,EAGCH,KAAK,IAAII,gBAHV,QAIO,yBAJP;AAMA;AACA;AACA;;AACA,OAAOC,aAAP,MAA0B,kBAA1B;AACA,SAASL,KAAK,IAAIM,mBAAlB,QAA6C,aAA7C;;AAEA,MAAMC,iBAAiB,GAAKC,iBAAF,IAA2BC,KAAF,IAAa;AAC/D,QAAM;AAAEC,IAAAA;AAAF,MAAmBD,KAAK,CAACE,UAA/B,CAD+D,CAE/D;AACA;;AACA,QAAM;AAAEC,IAAAA,KAAF;AAASC,IAAAA;AAAT,M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AAc;AACb,UAAM;AAAEgB,MAAAA,kBAAF;AAAsBC,MAAAA;AAAtB,QACLjB,MAAM,CAAEV,gBAAF,CADP;AAGA,WAAO0B,kBAAkB,CACxB,WADwB,EAExBC,oBAAoB,CAAEP,QAAF,CAFI,CAAzB;AAIA,GAT4B,EAU7B,CAAEA,QAAF,CAV6B,CAA9B;AAaA,MAAIQ,WAAW,GAAGtC,OAAO;AACxB;AACAD,EAAAA,EAAE,CACD,6GADC,CAFsB,EAKxB6B,aAAa,CAACW,KAAd,IAAuBvB,YALC,CAAzB;AAOA,QAAMwB,OAAO,GAAG,CACf,cAAC,aAAD;AACC,IAAA,GAAG,EAAC,SADL;AAEC,IAAA,KAAK,EAAGZ,aAFT;AAGC,IAAA,UAAU,EAAGb,KAAK,CAACE,UAHpB;AAIC,IAAA,QAAQ,EAAGF,KAAK,CAACe;AAJlB,IADe,CAAhB;;AASA,MAAKI,UAAU,IAAIC,YAAnB,EAAkC;AACjCG,IAAAA,WAAW,GAAGtC,OAAO;AACpB;AACAD,IAAAA,EAAE,CACD,iJADC,CAFkB,EAKpB6B,aAAa,CAACW,KAAd,IAAuBvB,YALH,CAArB;AAOAwB,IAAAA,OAAO,CAACC,IAAR,CACC,cAAC,MAAD;AAAQ,MAAA,GAAG,EAAC,SAAZ;AAAsB,MAAA,OAAO,EAAGT,aAAhC;AAAgD,MAAA,OAAO,EAAC;AAAxD,OACGjC,EAAE,CAAE,cAAF,CADL,CADD;AAKA;;AAED,SACC,0BAAUU,aAAa;AAAvB,KACC,cAAC,OAAD;AAAS,IAAA,OAAO,EAAG+B;AAAnB,KAA+BF,WAA/B,CADD,EAEC,cAAC,OAAD,QAAWT,0BAAX,CAFD,CADD;AAMA,CAhED;;AAkEA,eAAehB,iBAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, sprintf } from '@wordpress/i18n';\nimport { Button } from '@wordpress/components';\nimport { createBlock } from '@wordpress/blocks';\nimport { RawHTML } from '@wordpress/element';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport {\n\tWarning,\n\tuseBlockProps,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport InstallButton from './install-button';\nimport { store as blockDirectoryStore } from '../../store';\n\nconst getInstallMissing = ( OriginalComponent ) => ( props ) => {\n\tconst { originalName } = props.attributes;\n\t// Disable reason: This is a valid component, but it's mistaken for a callback.\n\t// eslint-disable-next-line react-hooks/rules-of-hooks\n\tconst { block, hasPermission } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getDownloadableBlocks } = select( blockDirectoryStore );\n\t\t\tconst blocks = getDownloadableBlocks(\n\t\t\t\t'block:' + originalName\n\t\t\t).filter( ( { name } ) => originalName === name );\n\t\t\treturn {\n\t\t\t\thasPermission: select( coreStore ).canUser(\n\t\t\t\t\t'read',\n\t\t\t\t\t'block-directory/search'\n\t\t\t\t),\n\t\t\t\tblock: blocks.length && blocks[ 0 ],\n\t\t\t};\n\t\t},\n\t\t[ originalName ]\n\t);\n\n\t// The user can't install blocks, or the block isn't available for download.\n\tif ( ! hasPermission || ! block ) {\n\t\treturn <OriginalComponent { ...props } />;\n\t}\n\n\treturn <ModifiedWarning { ...props } originalBlock={ block } />;\n};\n\nconst ModifiedWarning = ( { originalBlock, ...props } ) => {\n\tconst { originalName, originalUndelimitedContent, clientId } =\n\t\tprops.attributes;\n\tconst { replaceBlock } = useDispatch( blockEditorStore );\n\tconst convertToHTML = () => {\n\t\treplaceBlock(\n\t\t\tprops.clientId,\n\t\t\tcreateBlock( 'core/html', {\n\t\t\t\tcontent: originalUndelimitedContent,\n\t\t\t} )\n\t\t);\n\t};\n\n\tconst hasContent = !! originalUndelimitedContent;\n\tconst hasHTMLBlock = useSelect(\n\t\t( select ) => {\n\t\t\tconst { canInsertBlockType, getBlockRootClientId } =\n\t\t\t\tselect( blockEditorStore );\n\n\t\t\treturn canInsertBlockType(\n\t\t\t\t'core/html',\n\t\t\t\tgetBlockRootClientId( clientId )\n\t\t\t);\n\t\t},\n\t\t[ clientId ]\n\t);\n\n\tlet messageHTML = sprintf(\n\t\t/* translators: %s: block name */\n\t\t__(\n\t\t\t'Your site doesn’t include support for the %s block. You can try installing the block or remove it entirely.'\n\t\t),\n\t\toriginalBlock.title || originalName\n\t);\n\tconst actions = [\n\t\t<InstallButton\n\t\t\tkey=\"install\"\n\t\t\tblock={ originalBlock }\n\t\t\tattributes={ props.attributes }\n\t\t\tclientId={ props.clientId }\n\t\t/>,\n\t];\n\n\tif ( hasContent && hasHTMLBlock ) {\n\t\tmessageHTML = sprintf(\n\t\t\t/* translators: %s: block name */\n\t\t\t__(\n\t\t\t\t'Your site doesn’t include support for the %s block. You can try installing the block, convert it to a Custom HTML block, or remove it entirely.'\n\t\t\t),\n\t\t\toriginalBlock.title || originalName\n\t\t);\n\t\tactions.push(\n\t\t\t<Button key=\"convert\" onClick={ convertToHTML } variant=\"tertiary\">\n\t\t\t\t{ __( 'Keep as HTML' ) }\n\t\t\t</Button>\n\t\t);\n\t}\n\n\treturn (\n\t\t<div { ...useBlockProps() }>\n\t\t\t<Warning actions={ actions }>{ messageHTML }</Warning>\n\t\t\t<RawHTML>{ originalUndelimitedContent }</RawHTML>\n\t\t</div>\n\t);\n};\n\nexport default getInstallMissing;\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wordpress/block-directory",
|
|
3
|
-
"version": "4.12.
|
|
3
|
+
"version": "4.12.1",
|
|
4
4
|
"description": "Extend editor with block directory features to search, download and install blocks.",
|
|
5
5
|
"author": "The WordPress Contributors",
|
|
6
6
|
"license": "GPL-2.0-or-later",
|
|
@@ -26,24 +26,24 @@
|
|
|
26
26
|
"react-native": "src/index",
|
|
27
27
|
"dependencies": {
|
|
28
28
|
"@babel/runtime": "^7.16.0",
|
|
29
|
-
"@wordpress/a11y": "^3.35.
|
|
30
|
-
"@wordpress/api-fetch": "^6.32.
|
|
31
|
-
"@wordpress/block-editor": "^12.3.
|
|
32
|
-
"@wordpress/blocks": "^12.12.
|
|
33
|
-
"@wordpress/components": "^25.1.
|
|
34
|
-
"@wordpress/compose": "^6.12.
|
|
35
|
-
"@wordpress/core-data": "^6.12.
|
|
36
|
-
"@wordpress/data": "^9.5.
|
|
37
|
-
"@wordpress/edit-post": "^7.12.
|
|
38
|
-
"@wordpress/editor": "^13.12.
|
|
39
|
-
"@wordpress/element": "^5.12.
|
|
40
|
-
"@wordpress/hooks": "^3.35.
|
|
41
|
-
"@wordpress/html-entities": "^3.35.
|
|
42
|
-
"@wordpress/i18n": "^4.35.
|
|
43
|
-
"@wordpress/icons": "^9.26.
|
|
44
|
-
"@wordpress/notices": "^4.3.
|
|
45
|
-
"@wordpress/plugins": "^6.3.
|
|
46
|
-
"@wordpress/url": "^3.36.
|
|
29
|
+
"@wordpress/a11y": "^3.35.1",
|
|
30
|
+
"@wordpress/api-fetch": "^6.32.1",
|
|
31
|
+
"@wordpress/block-editor": "^12.3.1",
|
|
32
|
+
"@wordpress/blocks": "^12.12.1",
|
|
33
|
+
"@wordpress/components": "^25.1.1",
|
|
34
|
+
"@wordpress/compose": "^6.12.1",
|
|
35
|
+
"@wordpress/core-data": "^6.12.1",
|
|
36
|
+
"@wordpress/data": "^9.5.1",
|
|
37
|
+
"@wordpress/edit-post": "^7.12.1",
|
|
38
|
+
"@wordpress/editor": "^13.12.1",
|
|
39
|
+
"@wordpress/element": "^5.12.1",
|
|
40
|
+
"@wordpress/hooks": "^3.35.1",
|
|
41
|
+
"@wordpress/html-entities": "^3.35.1",
|
|
42
|
+
"@wordpress/i18n": "^4.35.1",
|
|
43
|
+
"@wordpress/icons": "^9.26.1",
|
|
44
|
+
"@wordpress/notices": "^4.3.1",
|
|
45
|
+
"@wordpress/plugins": "^6.3.1",
|
|
46
|
+
"@wordpress/url": "^3.36.1",
|
|
47
47
|
"change-case": "^4.1.2"
|
|
48
48
|
},
|
|
49
49
|
"peerDependencies": {
|
|
@@ -53,5 +53,5 @@
|
|
|
53
53
|
"publishConfig": {
|
|
54
54
|
"access": "public"
|
|
55
55
|
},
|
|
56
|
-
"gitHead": "
|
|
56
|
+
"gitHead": "ce5639111c30763dbdf07f40eeb136ea6030ecf1"
|
|
57
57
|
}
|