@wordpress/block-library 8.15.0 → 8.16.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +2 -0
- package/build/avatar/index.js +3 -0
- package/build/avatar/index.js.map +1 -1
- package/build/block/edit.js +2 -30
- package/build/block/edit.js.map +1 -1
- package/build/cover/index.js +2 -1
- package/build/cover/index.js.map +1 -1
- package/build/footnotes/edit.js +11 -0
- package/build/footnotes/edit.js.map +1 -1
- package/build/footnotes/format.js +101 -8
- package/build/footnotes/format.js.map +1 -1
- package/build/footnotes/index.js +45 -3
- package/build/footnotes/index.js.map +1 -1
- package/build/gallery/edit.js +7 -5
- package/build/gallery/edit.js.map +1 -1
- package/build/image/deprecated.js +106 -2
- package/build/image/deprecated.js.map +1 -1
- package/build/image/image.js +2 -2
- package/build/image/image.js.map +1 -1
- package/build/image/index.js +2 -1
- package/build/image/index.js.map +1 -1
- package/build/index.js +3 -1
- package/build/index.js.map +1 -1
- package/build/list-item/hooks/use-merge.js +10 -1
- package/build/list-item/hooks/use-merge.js.map +1 -1
- package/build/navigation/edit/menu-inspector-controls.js +1 -1
- package/build/navigation/edit/menu-inspector-controls.js.map +1 -1
- package/build/navigation/edit/navigation-menu-selector.js +4 -4
- package/build/navigation/edit/navigation-menu-selector.js.map +1 -1
- package/build/navigation/view-modal.js +93 -32
- package/build/navigation/view-modal.js.map +1 -1
- package/build/navigation/view.js +63 -31
- package/build/navigation/view.js.map +1 -1
- package/build/pattern/edit.js +28 -4
- package/build/pattern/edit.js.map +1 -1
- package/build/preformatted/index.js +4 -0
- package/build/preformatted/index.js.map +1 -1
- package/build/search/view.js +166 -62
- package/build/search/view.js.map +1 -1
- package/build/social-link/icons/index.js +13 -0
- package/build/social-link/icons/index.js.map +1 -1
- package/build/social-link/icons/threads.js +25 -0
- package/build/social-link/icons/threads.js.map +1 -0
- package/build/social-link/variations.js +7 -0
- package/build/social-link/variations.js.map +1 -1
- package/build/template-part/edit/import-controls.js +1 -1
- package/build/template-part/edit/import-controls.js.map +1 -1
- package/build-module/avatar/index.js +3 -0
- package/build-module/avatar/index.js.map +1 -1
- package/build-module/block/edit.js +4 -29
- package/build-module/block/edit.js.map +1 -1
- package/build-module/cover/index.js +2 -1
- package/build-module/cover/index.js.map +1 -1
- package/build-module/footnotes/edit.js +11 -0
- package/build-module/footnotes/edit.js.map +1 -1
- package/build-module/footnotes/format.js +102 -10
- package/build-module/footnotes/format.js.map +1 -1
- package/build-module/footnotes/index.js +45 -3
- package/build-module/footnotes/index.js.map +1 -1
- package/build-module/gallery/edit.js +7 -5
- package/build-module/gallery/edit.js.map +1 -1
- package/build-module/image/deprecated.js +107 -3
- package/build-module/image/deprecated.js.map +1 -1
- package/build-module/image/image.js +2 -2
- package/build-module/image/image.js.map +1 -1
- package/build-module/image/index.js +2 -1
- package/build-module/image/index.js.map +1 -1
- package/build-module/index.js +3 -1
- package/build-module/index.js.map +1 -1
- package/build-module/list-item/hooks/use-merge.js +10 -1
- package/build-module/list-item/hooks/use-merge.js.map +1 -1
- package/build-module/navigation/edit/menu-inspector-controls.js +1 -1
- package/build-module/navigation/edit/menu-inspector-controls.js.map +1 -1
- package/build-module/navigation/edit/navigation-menu-selector.js +4 -4
- package/build-module/navigation/edit/navigation-menu-selector.js.map +1 -1
- package/build-module/navigation/view-modal.js +93 -31
- package/build-module/navigation/view-modal.js.map +1 -1
- package/build-module/navigation/view.js +63 -31
- package/build-module/navigation/view.js.map +1 -1
- package/build-module/pattern/edit.js +27 -4
- package/build-module/pattern/edit.js.map +1 -1
- package/build-module/preformatted/index.js +4 -0
- package/build-module/preformatted/index.js.map +1 -1
- package/build-module/search/view.js +166 -62
- package/build-module/search/view.js.map +1 -1
- package/build-module/social-link/icons/index.js +1 -0
- package/build-module/social-link/icons/index.js.map +1 -1
- package/build-module/social-link/icons/threads.js +15 -0
- package/build-module/social-link/icons/threads.js.map +1 -0
- package/build-module/social-link/variations.js +8 -1
- package/build-module/social-link/variations.js.map +1 -1
- package/build-module/template-part/edit/import-controls.js +2 -2
- package/build-module/template-part/edit/import-controls.js.map +1 -1
- package/build-style/preformatted/style-rtl.css +2 -1
- package/build-style/preformatted/style.css +2 -1
- package/build-style/social-links/style-rtl.css +7 -0
- package/build-style/social-links/style.css +7 -0
- package/build-style/style-rtl.css +10 -1
- package/build-style/style.css +10 -1
- package/build-style/video/style-rtl.css +1 -0
- package/build-style/video/style.css +1 -0
- package/package.json +32 -32
- package/src/audio/test/__snapshots__/edit.native.js.snap +60 -0
- package/src/avatar/block.json +3 -0
- package/src/block/edit.js +1 -39
- package/src/buttons/test/edit.native.js +4 -0
- package/src/columns/test/edit.native.js +5 -0
- package/src/comment-template/index.php +2 -0
- package/src/cover/block.json +2 -1
- package/src/cover/test/edit.native.js +8 -0
- package/src/embed/test/index.native.js +8 -0
- package/src/file/index.php +1 -1
- package/src/file/test/__snapshots__/edit.native.js.snap +61 -0
- package/src/footnotes/block.json +44 -1
- package/src/footnotes/edit.js +12 -0
- package/src/footnotes/format.js +70 -7
- package/src/footnotes/index.js +0 -1
- package/src/footnotes/index.php +207 -0
- package/src/gallery/edit.js +41 -37
- package/src/gallery/test/index.native.js +15 -3
- package/src/heading/test/index.native.js +4 -0
- package/src/image/block.json +2 -1
- package/src/image/deprecated.js +109 -3
- package/src/image/image.js +2 -2
- package/src/image/index.php +1 -3
- package/src/image/test/edit.native.js +0 -1
- package/src/index.js +5 -1
- package/src/list/test/edit.native.js +5 -0
- package/src/list-item/hooks/use-merge.js +12 -5
- package/src/missing/test/__snapshots__/edit.native.js.snap +21 -0
- package/src/navigation/edit/menu-inspector-controls.js +1 -1
- package/src/navigation/edit/navigation-menu-selector.js +8 -4
- package/src/navigation/index.php +27 -13
- package/src/navigation/view-modal.js +88 -39
- package/src/navigation/view.js +69 -36
- package/src/paragraph/test/edit.native.js +55 -35
- package/src/pattern/edit.js +21 -0
- package/src/pattern/index.php +13 -1
- package/src/post-template/index.php +2 -0
- package/src/post-title/index.php +2 -0
- package/src/preformatted/block.json +4 -0
- package/src/preformatted/style.scss +4 -1
- package/src/pullquote/test/edit.native.js +12 -4
- package/src/quote/test/edit.native.js +12 -4
- package/src/search/index.php +4 -0
- package/src/search/test/__snapshots__/edit.native.js.snap +63 -0
- package/src/search/view.js +171 -67
- package/src/social-link/icons/index.js +1 -0
- package/src/social-link/icons/threads.js +10 -0
- package/src/social-link/index.php +4 -0
- package/src/social-link/socials-with-bg.scss +5 -0
- package/src/social-link/socials-without-bg.scss +4 -0
- package/src/social-link/variations.js +7 -0
- package/src/template-part/edit/import-controls.js +2 -2
- package/src/template-part/index.php +6 -9
- package/src/video/style.scss +1 -0
package/CHANGELOG.md
CHANGED
package/build/avatar/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-library/src/avatar/index.js"],"names":["name","metadata","settings","icon","edit","init"],"mappings":";;;;;;;;;AAGA;;AAKA;;AAEA;;AAVA;AACA;AACA;;AAGA;AACA;AACA
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-library/src/avatar/index.js"],"names":["name","metadata","settings","icon","edit","init"],"mappings":";;;;;;;;;AAGA;;AAKA;;AAEA;;AAVA;AACA;AACA;;AAGA;AACA;AACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAKA,MAAM;AAAEA,EAAAA;AAAF,IAAWC,QAAjB;;AAGO,MAAMC,QAAQ,GAAG;AACvBC,EAAAA,IAAI,EAAJA,0BADuB;AAEvBC,EAAAA,IAAI,EAAJA;AAFuB,CAAjB;;;AAKA,MAAMC,IAAI,GAAG,MAAM,wBAAW;AAAEL,EAAAA,IAAF;AAAQC,EAAAA,QAAR;AAAkBC,EAAAA;AAAlB,CAAX,CAAnB","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { commentAuthorAvatar as icon } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport initBlock from '../utils/init-block';\nimport metadata from './block.json';\nimport edit from './edit';\n\nconst { name } = metadata;\nexport { metadata, name };\n\nexport const settings = {\n\ticon,\n\tedit,\n};\n\nexport const init = () => initBlock( { name, metadata, settings } );\n"]}
|
package/build/block/edit.js
CHANGED
|
@@ -7,8 +7,6 @@ exports.default = ReusableBlockEdit;
|
|
|
7
7
|
|
|
8
8
|
var _element = require("@wordpress/element");
|
|
9
9
|
|
|
10
|
-
var _data = require("@wordpress/data");
|
|
11
|
-
|
|
12
10
|
var _coreData = require("@wordpress/core-data");
|
|
13
11
|
|
|
14
12
|
var _components = require("@wordpress/components");
|
|
@@ -17,18 +15,13 @@ var _i18n = require("@wordpress/i18n");
|
|
|
17
15
|
|
|
18
16
|
var _blockEditor = require("@wordpress/block-editor");
|
|
19
17
|
|
|
20
|
-
var _reusableBlocks = require("@wordpress/reusable-blocks");
|
|
21
|
-
|
|
22
|
-
var _icons = require("@wordpress/icons");
|
|
23
|
-
|
|
24
18
|
/**
|
|
25
19
|
* WordPress dependencies
|
|
26
20
|
*/
|
|
27
21
|
function ReusableBlockEdit({
|
|
28
22
|
attributes: {
|
|
29
23
|
ref
|
|
30
|
-
}
|
|
31
|
-
clientId
|
|
24
|
+
}
|
|
32
25
|
}) {
|
|
33
26
|
const hasAlreadyRendered = (0, _blockEditor.__experimentalUseHasRecursion)(ref);
|
|
34
27
|
const {
|
|
@@ -36,22 +29,6 @@ function ReusableBlockEdit({
|
|
|
36
29
|
hasResolved
|
|
37
30
|
} = (0, _coreData.useEntityRecord)('postType', 'wp_block', ref);
|
|
38
31
|
const isMissing = hasResolved && !record;
|
|
39
|
-
const {
|
|
40
|
-
canRemove,
|
|
41
|
-
innerBlockCount
|
|
42
|
-
} = (0, _data.useSelect)(select => {
|
|
43
|
-
const {
|
|
44
|
-
canRemoveBlock,
|
|
45
|
-
getBlockCount
|
|
46
|
-
} = select(_blockEditor.store);
|
|
47
|
-
return {
|
|
48
|
-
canRemove: canRemoveBlock(clientId),
|
|
49
|
-
innerBlockCount: getBlockCount(clientId)
|
|
50
|
-
};
|
|
51
|
-
}, [clientId]);
|
|
52
|
-
const {
|
|
53
|
-
__experimentalConvertBlockToStatic: convertBlockToStatic
|
|
54
|
-
} = (0, _data.useDispatch)(_reusableBlocks.store);
|
|
55
32
|
const [blocks, onInput, onChange] = (0, _coreData.useEntityBlockEditor)('postType', 'wp_block', {
|
|
56
33
|
id: ref
|
|
57
34
|
});
|
|
@@ -83,12 +60,7 @@ function ReusableBlockEdit({
|
|
|
83
60
|
|
|
84
61
|
return (0, _element.createElement)(_blockEditor.__experimentalRecursionProvider, {
|
|
85
62
|
uniqueId: ref
|
|
86
|
-
},
|
|
87
|
-
onClick: () => convertBlockToStatic(clientId),
|
|
88
|
-
label: innerBlockCount > 1 ? (0, _i18n.__)('Detach patterns') : (0, _i18n.__)('Detach pattern'),
|
|
89
|
-
icon: _icons.ungroup,
|
|
90
|
-
showTooltip: true
|
|
91
|
-
}))), (0, _element.createElement)(_blockEditor.InspectorControls, null, (0, _element.createElement)(_components.PanelBody, null, (0, _element.createElement)(_components.TextControl, {
|
|
63
|
+
}, (0, _element.createElement)(_blockEditor.InspectorControls, null, (0, _element.createElement)(_components.PanelBody, null, (0, _element.createElement)(_components.TextControl, {
|
|
92
64
|
__nextHasNoMarginBottom: true,
|
|
93
65
|
label: (0, _i18n.__)('Name'),
|
|
94
66
|
value: title,
|
package/build/block/edit.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-library/src/block/edit.js"],"names":["ReusableBlockEdit","attributes","ref","
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-library/src/block/edit.js"],"names":["ReusableBlockEdit","attributes","ref","hasAlreadyRendered","record","hasResolved","isMissing","blocks","onInput","onChange","id","title","setTitle","blockProps","className","innerBlocksProps","value","renderAppender","length","undefined","InnerBlocks","ButtonBlockAppender"],"mappings":";;;;;;;;;AAGA;;AAKA;;AAMA;;AACA;;AAfA;AACA;AACA;AAuBe,SA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IAAA,QAAQ,EAAGX;AAA9B,KACC,4BAAC,8BAAD,QACC,4BAAC,qBAAD,QACC,4BAAC,uBAAD;AACC,IAAA,uBAAuB,MADxB;AAEC,IAAA,KAAK,EAAG,cAAI,MAAJ,CAFT;AAGC,IAAA,KAAK,EAAGS,KAHT;AAIC,IAAA,QAAQ,EAAGC;AAJZ,IADD,CADD,CADD,EAWC,wCAAUG;AAAV,IAXD,CADD;AAeA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tuseEntityBlockEditor,\n\tuseEntityProp,\n\tuseEntityRecord,\n} from '@wordpress/core-data';\nimport {\n\tPlaceholder,\n\tSpinner,\n\tTextControl,\n\tPanelBody,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport {\n\tuseInnerBlocksProps,\n\t__experimentalRecursionProvider as RecursionProvider,\n\t__experimentalUseHasRecursion as useHasRecursion,\n\tInnerBlocks,\n\tInspectorControls,\n\tuseBlockProps,\n\tWarning,\n} from '@wordpress/block-editor';\n\nexport default function ReusableBlockEdit( { attributes: { ref } } ) {\n\tconst hasAlreadyRendered = useHasRecursion( ref );\n\tconst { record, hasResolved } = useEntityRecord(\n\t\t'postType',\n\t\t'wp_block',\n\t\tref\n\t);\n\tconst isMissing = hasResolved && ! record;\n\n\tconst [ blocks, onInput, onChange ] = useEntityBlockEditor(\n\t\t'postType',\n\t\t'wp_block',\n\t\t{ id: ref }\n\t);\n\n\tconst [ title, setTitle ] = useEntityProp(\n\t\t'postType',\n\t\t'wp_block',\n\t\t'title',\n\t\tref\n\t);\n\n\tconst blockProps = useBlockProps( {\n\t\tclassName: 'block-library-block__reusable-block-container',\n\t} );\n\n\tconst innerBlocksProps = useInnerBlocksProps( blockProps, {\n\t\tvalue: blocks,\n\t\tonInput,\n\t\tonChange,\n\t\trenderAppender: blocks?.length\n\t\t\t? undefined\n\t\t\t: InnerBlocks.ButtonBlockAppender,\n\t} );\n\n\tif ( hasAlreadyRendered ) {\n\t\treturn (\n\t\t\t<div { ...blockProps }>\n\t\t\t\t<Warning>\n\t\t\t\t\t{ __( 'Block cannot be rendered inside itself.' ) }\n\t\t\t\t</Warning>\n\t\t\t</div>\n\t\t);\n\t}\n\n\tif ( isMissing ) {\n\t\treturn (\n\t\t\t<div { ...blockProps }>\n\t\t\t\t<Warning>\n\t\t\t\t\t{ __( 'Block has been deleted or is unavailable.' ) }\n\t\t\t\t</Warning>\n\t\t\t</div>\n\t\t);\n\t}\n\n\tif ( ! hasResolved ) {\n\t\treturn (\n\t\t\t<div { ...blockProps }>\n\t\t\t\t<Placeholder>\n\t\t\t\t\t<Spinner />\n\t\t\t\t</Placeholder>\n\t\t\t</div>\n\t\t);\n\t}\n\n\treturn (\n\t\t<RecursionProvider uniqueId={ ref }>\n\t\t\t<InspectorControls>\n\t\t\t\t<PanelBody>\n\t\t\t\t\t<TextControl\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\tlabel={ __( 'Name' ) }\n\t\t\t\t\t\tvalue={ title }\n\t\t\t\t\t\tonChange={ setTitle }\n\t\t\t\t\t/>\n\t\t\t\t</PanelBody>\n\t\t\t</InspectorControls>\n\t\t\t<div { ...innerBlocksProps } />\n\t\t</RecursionProvider>\n\t);\n}\n"]}
|
package/build/cover/index.js
CHANGED
|
@@ -143,7 +143,8 @@ const metadata = {
|
|
|
143
143
|
heading: true,
|
|
144
144
|
text: true,
|
|
145
145
|
background: false,
|
|
146
|
-
__experimentalSkipSerialization: ["gradients"]
|
|
146
|
+
__experimentalSkipSerialization: ["gradients"],
|
|
147
|
+
enableContrastChecker: false
|
|
147
148
|
},
|
|
148
149
|
typography: {
|
|
149
150
|
fontSize: true,
|
package/build/cover/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-library/src/cover/index.js"],"names":["name","metadata","settings","icon","example","attributes","customOverlayColor","dimRatio","url","innerBlocks","content","align","style","typography","fontSize","color","text","transforms","save","edit","deprecated","variations","init"],"mappings":";;;;;;;;;AAGA;;AACA;;AAKA;;AACA;;AACA;;AAEA;;AACA;;AACA;;AAfA;AACA;AACA;;AAIA;AACA;AACA
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-library/src/cover/index.js"],"names":["name","metadata","settings","icon","example","attributes","customOverlayColor","dimRatio","url","innerBlocks","content","align","style","typography","fontSize","color","text","transforms","save","edit","deprecated","variations","init"],"mappings":";;;;;;;;;AAGA;;AACA;;AAKA;;AACA;;AACA;;AAEA;;AACA;;AACA;;AAfA;AACA;AACA;;AAIA;AACA;AACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AASA,MAAM;AAAEA,EAAAA;AAAF,IAAWC,QAAjB;;AAIO,MAAMC,QAAQ,GAAG;AACvBC,EAAAA,IAAI,EAAJA,YADuB;AAEvBC,EAAAA,OAAO,EAAE;AACRC,IAAAA,UAAU,EAAE;AACXC,MAAAA,kBAAkB,EAAE,SADT;AAEXC,MAAAA,QAAQ,EAAE,EAFC;AAGXC,MAAAA,GAAG,EAAE;AAHM,KADJ;AAMRC,IAAAA,WAAW,EAAE,CACZ;AACCT,MAAAA,IAAI,EAAE,gBADP;AAECK,MAAAA,UAAU,EAAE;AACXK,QAAAA,OAAO,EAAE,cAAI,8BAAJ,CADE;AAEXC,QAAAA,KAAK,EAAE,QAFI;AAGXC,QAAAA,KAAK,EAAE;AACNC,UAAAA,UAAU,EAAE;AACXC,YAAAA,QAAQ,EAAE;AADC,WADN;AAINC,UAAAA,KAAK,EAAE;AACNC,YAAAA,IAAI,EAAE;AADA;AAJD;AAHI;AAFb,KADY;AANL,GAFc;AA0BvBC,EAAAA,UAAU,EAAVA,mBA1BuB;AA2BvBC,EAAAA,IAAI,EAAJA,aA3BuB;AA4BvBC,EAAAA,IAAI,EAAJA,aA5BuB;AA6BvBC,EAAAA,UAAU,EAAVA,mBA7BuB;AA8BvBC,EAAAA,UAAU,EAAVA;AA9BuB,CAAjB;;;AAiCA,MAAMC,IAAI,GAAG,MAAM,wBAAW;AAAEtB,EAAAA,IAAF;AAAQC,EAAAA,QAAR;AAAkBC,EAAAA;AAAlB,CAAX,CAAnB","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { cover as icon } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport initBlock from '../utils/init-block';\nimport deprecated from './deprecated';\nimport edit from './edit';\nimport metadata from './block.json';\nimport save from './save';\nimport transforms from './transforms';\nimport variations from './variations';\n\nconst { name } = metadata;\n\nexport { metadata, name };\n\nexport const settings = {\n\ticon,\n\texample: {\n\t\tattributes: {\n\t\t\tcustomOverlayColor: '#065174',\n\t\t\tdimRatio: 40,\n\t\t\turl: 'https://s.w.org/images/core/5.3/Windbuchencom.jpg',\n\t\t},\n\t\tinnerBlocks: [\n\t\t\t{\n\t\t\t\tname: 'core/paragraph',\n\t\t\t\tattributes: {\n\t\t\t\t\tcontent: __( '<strong>Snow Patrol</strong>' ),\n\t\t\t\t\talign: 'center',\n\t\t\t\t\tstyle: {\n\t\t\t\t\t\ttypography: {\n\t\t\t\t\t\t\tfontSize: 48,\n\t\t\t\t\t\t},\n\t\t\t\t\t\tcolor: {\n\t\t\t\t\t\t\ttext: 'white',\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t],\n\t},\n\ttransforms,\n\tsave,\n\tedit,\n\tdeprecated,\n\tvariations,\n};\n\nexport const init = () => initBlock( { name, metadata, settings } );\n"]}
|
package/build/footnotes/edit.js
CHANGED
|
@@ -30,6 +30,17 @@ function FootnotesEdit({
|
|
|
30
30
|
const footnotes = meta?.footnotes ? JSON.parse(meta.footnotes) : [];
|
|
31
31
|
const blockProps = (0, _blockEditor.useBlockProps)();
|
|
32
32
|
|
|
33
|
+
if (postType !== 'post' && postType !== 'page') {
|
|
34
|
+
return (0, _element.createElement)("div", { ...blockProps
|
|
35
|
+
}, (0, _element.createElement)(_components.Placeholder, {
|
|
36
|
+
icon: (0, _element.createElement)(_blockEditor.BlockIcon, {
|
|
37
|
+
icon: _icons.formatListNumbered
|
|
38
|
+
}),
|
|
39
|
+
label: (0, _i18n.__)('Footnotes') // To do: add instructions. We can't add new string in RC.
|
|
40
|
+
|
|
41
|
+
}));
|
|
42
|
+
}
|
|
43
|
+
|
|
33
44
|
if (!footnotes.length) {
|
|
34
45
|
return (0, _element.createElement)("div", { ...blockProps
|
|
35
46
|
}, (0, _element.createElement)(_components.Placeholder, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-library/src/footnotes/edit.js"],"names":["FootnotesEdit","context","postType","postId","meta","updateMeta","footnotes","JSON","parse","blockProps","
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-library/src/footnotes/edit.js"],"names":["FootnotesEdit","context","postType","postId","meta","updateMeta","footnotes","JSON","parse","blockProps","icon","length","map","id","content","event","target","textContent","trim","scrollIntoView","nextFootnote","stringify","footnote"],"mappings":";;;;;;;;;AAGA;;AACA;;AACA;;AACA;;AACA;;AAPA;AACA;AACA;AAOe,SAASA,aAAT,CAAwB;AAAEC,EAAAA,OAAO,EAAE;AAAEC,IAAAA,QAAF;AAAYC,IAAAA;AAAZ;AAAX,CAAxB,EAA4D;AAC1E,QAAM,CAAEC,IAAF,EAAQC,UAAR,IAAuB,6BAC5B,UAD4B,EAE5BH,QAF4B,EAG5B,MAH4B,EAI5BC,MAJ4B,CAA7B;AAMA,QAAMG,SAAS,GAAGF,IAAI,EAAEE,SAAN,GAAkBC,IAAI,CAACC,KAAL,CAAYJ,IAAI,CAACE,SAAjB,CAAlB,GAAiD,EAAnE;AACA,QAAMG,UAAU,GAAG,iCAAnB;;AAEA,MAAKP,QAAQ,KAAK,MAAb,IAAuBA,QAAQ,KAAK,MAAzC,EAAkD;A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,QALH;AAMA,SAPD,CADU;AAFA,OAAF,CAAV;AAaA;AA1BF,IADD,EA4BK,GA5BL,EA6BC;AAAG,IAAA,IAAI,EAAI,IAAIT,EAAI;AAAnB,oBA7BD,CADC,CADH,CADD;AAqCA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { BlockIcon, RichText, useBlockProps } from '@wordpress/block-editor';\nimport { useEntityProp } from '@wordpress/core-data';\nimport { __ } from '@wordpress/i18n';\nimport { Placeholder } from '@wordpress/components';\nimport { formatListNumbered as icon } from '@wordpress/icons';\n\nexport default function FootnotesEdit( { context: { postType, postId } } ) {\n\tconst [ meta, updateMeta ] = useEntityProp(\n\t\t'postType',\n\t\tpostType,\n\t\t'meta',\n\t\tpostId\n\t);\n\tconst footnotes = meta?.footnotes ? JSON.parse( meta.footnotes ) : [];\n\tconst blockProps = useBlockProps();\n\n\tif ( postType !== 'post' && postType !== 'page' ) {\n\t\treturn (\n\t\t\t<div { ...blockProps }>\n\t\t\t\t<Placeholder\n\t\t\t\t\ticon={ <BlockIcon icon={ icon } /> }\n\t\t\t\t\tlabel={ __( 'Footnotes' ) }\n\t\t\t\t\t// To do: add instructions. We can't add new string in RC.\n\t\t\t\t/>\n\t\t\t</div>\n\t\t);\n\t}\n\n\tif ( ! footnotes.length ) {\n\t\treturn (\n\t\t\t<div { ...blockProps }>\n\t\t\t\t<Placeholder\n\t\t\t\t\ticon={ <BlockIcon icon={ icon } /> }\n\t\t\t\t\tlabel={ __( 'Footnotes' ) }\n\t\t\t\t\tinstructions={ __(\n\t\t\t\t\t\t'Footnotes found in blocks within this document will be displayed here.'\n\t\t\t\t\t) }\n\t\t\t\t/>\n\t\t\t</div>\n\t\t);\n\t}\n\n\treturn (\n\t\t<ol { ...blockProps }>\n\t\t\t{ footnotes.map( ( { id, content } ) => (\n\t\t\t\t<li key={ id }>\n\t\t\t\t\t<RichText\n\t\t\t\t\t\tid={ id }\n\t\t\t\t\t\ttagName=\"span\"\n\t\t\t\t\t\tvalue={ content }\n\t\t\t\t\t\tidentifier={ id }\n\t\t\t\t\t\t// To do: figure out why the browser is not scrolling\n\t\t\t\t\t\t// into view when it receives focus.\n\t\t\t\t\t\tonFocus={ ( event ) => {\n\t\t\t\t\t\t\tif ( ! event.target.textContent.trim() ) {\n\t\t\t\t\t\t\t\tevent.target.scrollIntoView();\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tonChange={ ( nextFootnote ) => {\n\t\t\t\t\t\t\tupdateMeta( {\n\t\t\t\t\t\t\t\t...meta,\n\t\t\t\t\t\t\t\tfootnotes: JSON.stringify(\n\t\t\t\t\t\t\t\t\tfootnotes.map( ( footnote ) => {\n\t\t\t\t\t\t\t\t\t\treturn footnote.id === id\n\t\t\t\t\t\t\t\t\t\t\t? {\n\t\t\t\t\t\t\t\t\t\t\t\t\tcontent: nextFootnote,\n\t\t\t\t\t\t\t\t\t\t\t\t\tid,\n\t\t\t\t\t\t\t\t\t\t\t }\n\t\t\t\t\t\t\t\t\t\t\t: footnote;\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} }\n\t\t\t\t\t/>{ ' ' }\n\t\t\t\t\t<a href={ `#${ id }-link` }>↩︎</a>\n\t\t\t\t</li>\n\t\t\t) ) }\n\t\t</ol>\n\t);\n}\n"]}
|
|
@@ -21,6 +21,8 @@ var _data = require("@wordpress/data");
|
|
|
21
21
|
|
|
22
22
|
var _blocks = require("@wordpress/blocks");
|
|
23
23
|
|
|
24
|
+
var _lockUnlock = require("../lock-unlock");
|
|
25
|
+
|
|
24
26
|
/**
|
|
25
27
|
* External dependencies
|
|
26
28
|
*/
|
|
@@ -45,14 +47,62 @@ const {
|
|
|
45
47
|
textdomain: "default",
|
|
46
48
|
usesContext: ["postId", "postType"],
|
|
47
49
|
supports: {
|
|
50
|
+
__experimentalBorder: {
|
|
51
|
+
radius: true,
|
|
52
|
+
color: true,
|
|
53
|
+
width: true,
|
|
54
|
+
style: true,
|
|
55
|
+
__experimentalDefaultControls: {
|
|
56
|
+
radius: false,
|
|
57
|
+
color: false,
|
|
58
|
+
width: false,
|
|
59
|
+
style: false
|
|
60
|
+
}
|
|
61
|
+
},
|
|
62
|
+
color: {
|
|
63
|
+
background: true,
|
|
64
|
+
link: true,
|
|
65
|
+
text: true,
|
|
66
|
+
__experimentalDefaultControls: {
|
|
67
|
+
link: true,
|
|
68
|
+
text: true
|
|
69
|
+
}
|
|
70
|
+
},
|
|
48
71
|
html: false,
|
|
49
72
|
multiple: false,
|
|
50
|
-
reusable: false
|
|
73
|
+
reusable: false,
|
|
74
|
+
spacing: {
|
|
75
|
+
margin: true,
|
|
76
|
+
padding: true,
|
|
77
|
+
__experimentalDefaultControls: {
|
|
78
|
+
margin: false,
|
|
79
|
+
padding: false
|
|
80
|
+
}
|
|
81
|
+
},
|
|
82
|
+
typography: {
|
|
83
|
+
fontSize: true,
|
|
84
|
+
lineHeight: true,
|
|
85
|
+
__experimentalFontFamily: true,
|
|
86
|
+
__experimentalTextDecoration: true,
|
|
87
|
+
__experimentalFontStyle: true,
|
|
88
|
+
__experimentalFontWeight: true,
|
|
89
|
+
__experimentalLetterSpacing: true,
|
|
90
|
+
__experimentalTextTransform: true,
|
|
91
|
+
__experimentalWritingMode: true,
|
|
92
|
+
__experimentalDefaultControls: {
|
|
93
|
+
fontSize: true
|
|
94
|
+
}
|
|
95
|
+
}
|
|
51
96
|
},
|
|
52
97
|
style: "wp-block-footnotes"
|
|
53
98
|
};
|
|
99
|
+
const {
|
|
100
|
+
usesContextKey
|
|
101
|
+
} = (0, _lockUnlock.unlock)(_blockEditor.privateApis);
|
|
54
102
|
const formatName = 'core/footnote';
|
|
55
103
|
exports.formatName = formatName;
|
|
104
|
+
const POST_CONTENT_BLOCK_NAME = 'core/post-content';
|
|
105
|
+
const SYNCED_PATTERN_BLOCK_NAME = 'core/block';
|
|
56
106
|
const format = {
|
|
57
107
|
title: (0, _i18n.__)('Footnote'),
|
|
58
108
|
tagName: 'sup',
|
|
@@ -61,23 +111,57 @@ const format = {
|
|
|
61
111
|
'data-fn': 'data-fn'
|
|
62
112
|
},
|
|
63
113
|
contentEditable: false,
|
|
114
|
+
[usesContextKey]: ['postType'],
|
|
64
115
|
edit: function Edit({
|
|
65
116
|
value,
|
|
66
117
|
onChange,
|
|
67
|
-
isObjectActive
|
|
118
|
+
isObjectActive,
|
|
119
|
+
context: {
|
|
120
|
+
postType
|
|
121
|
+
}
|
|
68
122
|
}) {
|
|
69
123
|
const registry = (0, _data.useRegistry)();
|
|
70
124
|
const {
|
|
71
125
|
getSelectedBlockClientId,
|
|
126
|
+
getBlocks,
|
|
72
127
|
getBlockRootClientId,
|
|
73
128
|
getBlockName,
|
|
74
|
-
|
|
129
|
+
getBlockParentsByBlockName
|
|
75
130
|
} = (0, _data.useSelect)(_blockEditor.store);
|
|
131
|
+
const footnotesBlockType = (0, _data.useSelect)(select => select(_blocks.store).getBlockType(name));
|
|
132
|
+
/*
|
|
133
|
+
* This useSelect exists because we need to use its return value
|
|
134
|
+
* outside the event callback.
|
|
135
|
+
*/
|
|
136
|
+
|
|
137
|
+
const isBlockWithinPattern = (0, _data.useSelect)(select => {
|
|
138
|
+
const {
|
|
139
|
+
getBlockParentsByBlockName: _getBlockParentsByBlockName,
|
|
140
|
+
getSelectedBlockClientId: _getSelectedBlockClientId
|
|
141
|
+
} = select(_blockEditor.store);
|
|
142
|
+
|
|
143
|
+
const parentCoreBlocks = _getBlockParentsByBlockName(_getSelectedBlockClientId(), SYNCED_PATTERN_BLOCK_NAME);
|
|
144
|
+
|
|
145
|
+
return parentCoreBlocks && parentCoreBlocks.length > 0;
|
|
146
|
+
}, []);
|
|
76
147
|
const {
|
|
77
148
|
selectionChange,
|
|
78
149
|
insertBlock
|
|
79
150
|
} = (0, _data.useDispatch)(_blockEditor.store);
|
|
80
151
|
|
|
152
|
+
if (!footnotesBlockType) {
|
|
153
|
+
return null;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
if (postType !== 'post' && postType !== 'page') {
|
|
157
|
+
return null;
|
|
158
|
+
} // Checks if the selected block lives within a pattern.
|
|
159
|
+
|
|
160
|
+
|
|
161
|
+
if (isBlockWithinPattern) {
|
|
162
|
+
return null;
|
|
163
|
+
}
|
|
164
|
+
|
|
81
165
|
function onClick() {
|
|
82
166
|
registry.batch(() => {
|
|
83
167
|
let id;
|
|
@@ -96,12 +180,22 @@ const format = {
|
|
|
96
180
|
}, value.end, value.end);
|
|
97
181
|
newValue.start = newValue.end - 1;
|
|
98
182
|
onChange(newValue);
|
|
99
|
-
}
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
const selectedClientId = getSelectedBlockClientId();
|
|
186
|
+
/*
|
|
187
|
+
* Attempts to find a common parent post content block.
|
|
188
|
+
* This allows for locating blocks within a page edited in the site editor.
|
|
189
|
+
*/
|
|
190
|
+
|
|
191
|
+
const parentPostContent = getBlockParentsByBlockName(selectedClientId, POST_CONTENT_BLOCK_NAME); // When called with a post content block, getBlocks will return
|
|
192
|
+
// the block with controlled inner blocks included.
|
|
100
193
|
|
|
194
|
+
const blocks = parentPostContent.length ? getBlocks(parentPostContent[0]) : getBlocks(); // BFS search to find the first footnote block.
|
|
101
195
|
|
|
102
196
|
let fnBlock = null;
|
|
103
197
|
{
|
|
104
|
-
const queue = [...
|
|
198
|
+
const queue = [...blocks];
|
|
105
199
|
|
|
106
200
|
while (queue.length) {
|
|
107
201
|
const block = queue.shift();
|
|
@@ -118,10 +212,9 @@ const format = {
|
|
|
118
212
|
// insert it at the bottom.
|
|
119
213
|
|
|
120
214
|
if (!fnBlock) {
|
|
121
|
-
|
|
122
|
-
let rootClientId = getBlockRootClientId(clientId);
|
|
215
|
+
let rootClientId = getBlockRootClientId(selectedClientId);
|
|
123
216
|
|
|
124
|
-
while (rootClientId && getBlockName(rootClientId) !==
|
|
217
|
+
while (rootClientId && getBlockName(rootClientId) !== POST_CONTENT_BLOCK_NAME) {
|
|
125
218
|
rootClientId = getBlockRootClientId(rootClientId);
|
|
126
219
|
}
|
|
127
220
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-library/src/footnotes/format.js"],"names":["formatName","format","title","tagName","className","attributes","contentEditable","edit","Edit","value","onChange","isObjectActive","registry","getSelectedBlockClientId","getBlockRootClientId","getBlockName","
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-library/src/footnotes/format.js"],"names":["usesContextKey","privateApis","formatName","POST_CONTENT_BLOCK_NAME","SYNCED_PATTERN_BLOCK_NAME","format","title","tagName","className","attributes","contentEditable","edit","Edit","value","onChange","isObjectActive","context","postType","registry","getSelectedBlockClientId","getBlocks","getBlockRootClientId","getBlockName","getBlockParentsByBlockName","blockEditorStore","footnotesBlockType","select","blocksStore","getBlockType","name","isBlockWithinPattern","_getBlockParentsByBlockName","_getSelectedBlockClientId","parentCoreBlocks","length","selectionChange","insertBlock","onClick","batch","id","object","replacements","start","newValue","type","innerHTML","end","selectedClientId","parentPostContent","blocks","fnBlock","queue","block","shift","push","innerBlocks","rootClientId","undefined","clientId","icon"],"mappings":";;;;;;;;;AAGA;;AAKA;;AACA;;AACA;;AACA;;AAKA;;AACA;;AAMA;;AAvBA;AACA;AACA;;AAGA;AACA;AACA;;AAYA;AACA;AACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIA,MAAM;AAAEA,EAAAA;AAAF,IAAqB,wBAAQC,wBAAR,CAA3B;AAEO,MAAMC,UAAU,GAAG,eAAnB;;AAEP,MAAMC,uBAAuB,GAAG,mBAAhC;AACA,MAAMC,yBAAyB,GAAG,YAAlC;AAEO,MAAMC,MAAM,GAAG;AACrBC,EAAAA,KAAK,EAAE,cAAI,UAAJ,CADc;AAErBC,EAAAA,OAAO,EAAE,KAFY;AAGrBC,EAAAA,SAAS,EAAE,IAHU;AAIrBC,EAAAA,UAAU,EAAE;AACX,eA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AAN,KAAeA,IAApB,EAA2B;AAC1BqB,cAAAA,OAAO,GAAGE,KAAV;AACA;AACA;;AACDD,YAAAA,KAAK,CAACG,IAAN,CAAY,GAAGF,KAAK,CAACG,WAArB;AACA;AACD,SApDoB,CAsDrB;AACA;AACA;;AACA,YAAK,CAAEL,OAAP,EAAiB;AAChB,cAAIM,YAAY,GAAGnC,oBAAoB,CAAE0B,gBAAF,CAAvC;;AAEA,iBACCS,YAAY,IACZlC,YAAY,CAAEkC,YAAF,CAAZ,KAAiCrD,uBAFlC,EAGE;AACDqD,YAAAA,YAAY,GAAGnC,oBAAoB,CAAEmC,YAAF,CAAnC;AACA;;AAEDN,UAAAA,OAAO,GAAG,yBAAarB,IAAb,CAAV;AAEAO,UAAAA,WAAW,CAAEc,OAAF,EAAWO,SAAX,EAAsBD,YAAtB,CAAX;AACA;;AAEDrB,QAAAA,eAAe,CAAEe,OAAO,CAACQ,QAAV,EAAoBnB,EAApB,EAAwB,CAAxB,EAA2B,CAA3B,CAAf;AACA,OAzED;AA0EA;;AAED,WACC,4BAAC,kCAAD;AACC,MAAA,IAAI,EAAGoB,yBADR;AAEC,MAAA,KAAK,EAAG,cAAI,UAAJ,CAFT;AAGC,MAAA,OAAO,EAAGtB,OAHX;AAIC,MAAA,QAAQ,EAAGtB;AAJZ,MADD;AAQA;AA/IoB,CAAf","sourcesContent":["/**\n * External dependencies\n */\nimport { v4 as createId } from 'uuid';\n\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { formatListNumbered as icon } from '@wordpress/icons';\nimport { insertObject } from '@wordpress/rich-text';\nimport {\n\tRichTextToolbarButton,\n\tstore as blockEditorStore,\n\tprivateApis,\n} from '@wordpress/block-editor';\nimport { useSelect, useDispatch, useRegistry } from '@wordpress/data';\nimport { createBlock, store as blocksStore } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport { name } from './block.json';\nimport { unlock } from '../lock-unlock';\n\nconst { usesContextKey } = unlock( privateApis );\n\nexport const formatName = 'core/footnote';\n\nconst POST_CONTENT_BLOCK_NAME = 'core/post-content';\nconst SYNCED_PATTERN_BLOCK_NAME = 'core/block';\n\nexport const format = {\n\ttitle: __( 'Footnote' ),\n\ttagName: 'sup',\n\tclassName: 'fn',\n\tattributes: {\n\t\t'data-fn': 'data-fn',\n\t},\n\tcontentEditable: false,\n\t[ usesContextKey ]: [ 'postType' ],\n\tedit: function Edit( {\n\t\tvalue,\n\t\tonChange,\n\t\tisObjectActive,\n\t\tcontext: { postType },\n\t} ) {\n\t\tconst registry = useRegistry();\n\t\tconst {\n\t\t\tgetSelectedBlockClientId,\n\t\t\tgetBlocks,\n\t\t\tgetBlockRootClientId,\n\t\t\tgetBlockName,\n\t\t\tgetBlockParentsByBlockName,\n\t\t} = useSelect( blockEditorStore );\n\t\tconst footnotesBlockType = useSelect( ( select ) =>\n\t\t\tselect( blocksStore ).getBlockType( name )\n\t\t);\n\t\t/*\n\t\t * This useSelect exists because we need to use its return value\n\t\t * outside the event callback.\n\t\t */\n\t\tconst isBlockWithinPattern = useSelect( ( select ) => {\n\t\t\tconst {\n\t\t\t\tgetBlockParentsByBlockName: _getBlockParentsByBlockName,\n\t\t\t\tgetSelectedBlockClientId: _getSelectedBlockClientId,\n\t\t\t} = select( blockEditorStore );\n\t\t\tconst parentCoreBlocks = _getBlockParentsByBlockName(\n\t\t\t\t_getSelectedBlockClientId(),\n\t\t\t\tSYNCED_PATTERN_BLOCK_NAME\n\t\t\t);\n\t\t\treturn parentCoreBlocks && parentCoreBlocks.length > 0;\n\t\t}, [] );\n\n\t\tconst { selectionChange, insertBlock } =\n\t\t\tuseDispatch( blockEditorStore );\n\n\t\tif ( ! footnotesBlockType ) {\n\t\t\treturn null;\n\t\t}\n\n\t\tif ( postType !== 'post' && postType !== 'page' ) {\n\t\t\treturn null;\n\t\t}\n\n\t\t// Checks if the selected block lives within a pattern.\n\t\tif ( isBlockWithinPattern ) {\n\t\t\treturn null;\n\t\t}\n\n\t\tfunction onClick() {\n\t\t\tregistry.batch( () => {\n\t\t\t\tlet id;\n\t\t\t\tif ( isObjectActive ) {\n\t\t\t\t\tconst object = value.replacements[ value.start ];\n\t\t\t\t\tid = object?.attributes?.[ 'data-fn' ];\n\t\t\t\t} else {\n\t\t\t\t\tid = createId();\n\t\t\t\t\tconst newValue = insertObject(\n\t\t\t\t\t\tvalue,\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\ttype: formatName,\n\t\t\t\t\t\t\tattributes: {\n\t\t\t\t\t\t\t\t'data-fn': id,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tinnerHTML: `<a href=\"#${ id }\" id=\"${ id }-link\">*</a>`,\n\t\t\t\t\t\t},\n\t\t\t\t\t\tvalue.end,\n\t\t\t\t\t\tvalue.end\n\t\t\t\t\t);\n\t\t\t\t\tnewValue.start = newValue.end - 1;\n\t\t\t\t\tonChange( newValue );\n\t\t\t\t}\n\n\t\t\t\tconst selectedClientId = getSelectedBlockClientId();\n\n\t\t\t\t/*\n\t\t\t\t * Attempts to find a common parent post content block.\n\t\t\t\t * This allows for locating blocks within a page edited in the site editor.\n\t\t\t\t */\n\t\t\t\tconst parentPostContent = getBlockParentsByBlockName(\n\t\t\t\t\tselectedClientId,\n\t\t\t\t\tPOST_CONTENT_BLOCK_NAME\n\t\t\t\t);\n\n\t\t\t\t// When called with a post content block, getBlocks will return\n\t\t\t\t// the block with controlled inner blocks included.\n\t\t\t\tconst blocks = parentPostContent.length\n\t\t\t\t\t? getBlocks( parentPostContent[ 0 ] )\n\t\t\t\t\t: getBlocks();\n\n\t\t\t\t// BFS search to find the first footnote block.\n\t\t\t\tlet fnBlock = null;\n\t\t\t\t{\n\t\t\t\t\tconst queue = [ ...blocks ];\n\t\t\t\t\twhile ( queue.length ) {\n\t\t\t\t\t\tconst block = queue.shift();\n\t\t\t\t\t\tif ( block.name === name ) {\n\t\t\t\t\t\t\tfnBlock = block;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tqueue.push( ...block.innerBlocks );\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t// Maybe this should all also be moved to the entity provider.\n\t\t\t\t// When there is no footnotes block in the post, create one and\n\t\t\t\t// insert it at the bottom.\n\t\t\t\tif ( ! fnBlock ) {\n\t\t\t\t\tlet rootClientId = getBlockRootClientId( selectedClientId );\n\n\t\t\t\t\twhile (\n\t\t\t\t\t\trootClientId &&\n\t\t\t\t\t\tgetBlockName( rootClientId ) !== POST_CONTENT_BLOCK_NAME\n\t\t\t\t\t) {\n\t\t\t\t\t\trootClientId = getBlockRootClientId( rootClientId );\n\t\t\t\t\t}\n\n\t\t\t\t\tfnBlock = createBlock( name );\n\n\t\t\t\t\tinsertBlock( fnBlock, undefined, rootClientId );\n\t\t\t\t}\n\n\t\t\t\tselectionChange( fnBlock.clientId, id, 0, 0 );\n\t\t\t} );\n\t\t}\n\n\t\treturn (\n\t\t\t<RichTextToolbarButton\n\t\t\t\ticon={ icon }\n\t\t\t\ttitle={ __( 'Footnote' ) }\n\t\t\t\tonClick={ onClick }\n\t\t\t\tisActive={ isObjectActive }\n\t\t\t/>\n\t\t);\n\t},\n};\n"]}
|
package/build/footnotes/index.js
CHANGED
|
@@ -35,9 +35,52 @@ const metadata = {
|
|
|
35
35
|
textdomain: "default",
|
|
36
36
|
usesContext: ["postId", "postType"],
|
|
37
37
|
supports: {
|
|
38
|
+
__experimentalBorder: {
|
|
39
|
+
radius: true,
|
|
40
|
+
color: true,
|
|
41
|
+
width: true,
|
|
42
|
+
style: true,
|
|
43
|
+
__experimentalDefaultControls: {
|
|
44
|
+
radius: false,
|
|
45
|
+
color: false,
|
|
46
|
+
width: false,
|
|
47
|
+
style: false
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
color: {
|
|
51
|
+
background: true,
|
|
52
|
+
link: true,
|
|
53
|
+
text: true,
|
|
54
|
+
__experimentalDefaultControls: {
|
|
55
|
+
link: true,
|
|
56
|
+
text: true
|
|
57
|
+
}
|
|
58
|
+
},
|
|
38
59
|
html: false,
|
|
39
60
|
multiple: false,
|
|
40
|
-
reusable: false
|
|
61
|
+
reusable: false,
|
|
62
|
+
spacing: {
|
|
63
|
+
margin: true,
|
|
64
|
+
padding: true,
|
|
65
|
+
__experimentalDefaultControls: {
|
|
66
|
+
margin: false,
|
|
67
|
+
padding: false
|
|
68
|
+
}
|
|
69
|
+
},
|
|
70
|
+
typography: {
|
|
71
|
+
fontSize: true,
|
|
72
|
+
lineHeight: true,
|
|
73
|
+
__experimentalFontFamily: true,
|
|
74
|
+
__experimentalTextDecoration: true,
|
|
75
|
+
__experimentalFontStyle: true,
|
|
76
|
+
__experimentalFontWeight: true,
|
|
77
|
+
__experimentalLetterSpacing: true,
|
|
78
|
+
__experimentalTextTransform: true,
|
|
79
|
+
__experimentalWritingMode: true,
|
|
80
|
+
__experimentalDefaultControls: {
|
|
81
|
+
fontSize: true
|
|
82
|
+
}
|
|
83
|
+
}
|
|
41
84
|
},
|
|
42
85
|
style: "wp-block-footnotes"
|
|
43
86
|
};
|
|
@@ -49,8 +92,7 @@ exports.name = name;
|
|
|
49
92
|
const settings = {
|
|
50
93
|
icon: _icons.formatListNumbered,
|
|
51
94
|
edit: _edit.default
|
|
52
|
-
};
|
|
53
|
-
|
|
95
|
+
};
|
|
54
96
|
exports.settings = settings;
|
|
55
97
|
(0, _richText.registerFormatType)(_format.formatName, _format.format);
|
|
56
98
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-library/src/footnotes/index.js"],"names":["name","metadata","settings","icon","edit","formatName","format","init"],"mappings":";;;;;;;;;AAGA;;AACA;;AAKA;;AACA;;AAEA;;AAZA;AACA;AACA;;AAIA;AACA;AACA
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-library/src/footnotes/index.js"],"names":["name","metadata","settings","icon","edit","formatName","format","init"],"mappings":";;;;;;;;;AAGA;;AACA;;AAKA;;AACA;;AAEA;;AAZA;AACA;AACA;;AAIA;AACA;AACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAMA,MAAM;AAAEA,EAAAA;AAAF,IAAWC,QAAjB;;AAIO,MAAMC,QAAQ,GAAG;AACvBC,EAAAA,IAAI,EAAJA,yBADuB;AAEvBC,EAAAA,IAAI,EAAJA;AAFuB,CAAjB;;AAKP,kCAAoBC,kBAApB,EAAgCC,cAAhC;;AAEO,MAAMC,IAAI,GAAG,MAAM;AACzB,0BAAW;AAAEP,IAAAA,IAAF;AAAQC,IAAAA,QAAR;AAAkBC,IAAAA;AAAlB,GAAX;AACA,CAFM","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { formatListNumbered as icon } from '@wordpress/icons';\nimport { registerFormatType } from '@wordpress/rich-text';\n\n/**\n * Internal dependencies\n */\nimport initBlock from '../utils/init-block';\nimport edit from './edit';\nimport metadata from './block.json';\nimport { formatName, format } from './format';\n\nconst { name } = metadata;\n\nexport { metadata, name };\n\nexport const settings = {\n\ticon,\n\tedit,\n};\n\nregisterFormatType( formatName, format );\n\nexport const init = () => {\n\tinitBlock( { name, metadata, settings } );\n};\n"]}
|
package/build/gallery/edit.js
CHANGED
|
@@ -90,7 +90,8 @@ function GalleryEdit(props) {
|
|
|
90
90
|
clientId,
|
|
91
91
|
isSelected,
|
|
92
92
|
insertBlocksAfter,
|
|
93
|
-
isContentLocked
|
|
93
|
+
isContentLocked,
|
|
94
|
+
onFocus
|
|
94
95
|
} = props;
|
|
95
96
|
const {
|
|
96
97
|
columns,
|
|
@@ -391,7 +392,8 @@ function GalleryEdit(props) {
|
|
|
391
392
|
isAppender: hasImages,
|
|
392
393
|
disableMediaButtons: hasImages && !isSelected || imagesUploading,
|
|
393
394
|
value: hasImageIds ? images : {},
|
|
394
|
-
autoOpenMediaUpload: !hasImages && isSelected && wasBlockJustInserted
|
|
395
|
+
autoOpenMediaUpload: !hasImages && isSelected && wasBlockJustInserted,
|
|
396
|
+
onFocus
|
|
395
397
|
}
|
|
396
398
|
});
|
|
397
399
|
|
|
@@ -473,7 +475,7 @@ function GalleryEdit(props) {
|
|
|
473
475
|
className: 'gallery-image-sizes'
|
|
474
476
|
}, (0, _element.createElement)(_components.BaseControl.VisualLabel, null, (0, _i18n.__)('Resolution')), (0, _element.createElement)(_primitives.View, {
|
|
475
477
|
className: 'gallery-image-sizes__loading'
|
|
476
|
-
}, (0, _element.createElement)(_components.Spinner, null), (0, _i18n.__)('Loading options…'))))), (0, _element.createElement)(_blockEditor.BlockControls, {
|
|
478
|
+
}, (0, _element.createElement)(_components.Spinner, null), (0, _i18n.__)('Loading options…'))))), _element.Platform.isWeb && (0, _element.createElement)(_element.Fragment, null, (0, _element.createElement)(_blockEditor.BlockControls, {
|
|
477
479
|
group: "block"
|
|
478
480
|
}, !isContentLocked && (0, _element.createElement)(_components.ToolbarButton, {
|
|
479
481
|
onClick: () => {
|
|
@@ -499,10 +501,10 @@ function GalleryEdit(props) {
|
|
|
499
501
|
multiple: true,
|
|
500
502
|
mediaIds: images.filter(image => image.id).map(image => image.id),
|
|
501
503
|
addToGallery: hasImageIds
|
|
502
|
-
})),
|
|
504
|
+
})), (0, _element.createElement)(_gapStyles.default, {
|
|
503
505
|
blockGap: attributes.style?.spacing?.blockGap,
|
|
504
506
|
clientId: clientId
|
|
505
|
-
}), (0, _element.createElement)(_gallery.default, { ...props,
|
|
507
|
+
})), (0, _element.createElement)(_gallery.default, { ...props,
|
|
506
508
|
showCaption: showCaption,
|
|
507
509
|
ref: _element.Platform.isWeb ? captionRef : undefined,
|
|
508
510
|
images: images,
|