@wordpress/block-library 8.17.0 → 8.18.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/README.md +19 -0
- package/build/cover/edit/index.js +3 -1
- package/build/cover/edit/index.js.map +1 -1
- package/build/cover/shared.js +26 -21
- package/build/cover/shared.js.map +1 -1
- package/build/embed/embed-link-settings.native.js +0 -1
- package/build/embed/embed-link-settings.native.js.map +1 -1
- package/build/footnotes/init.js +13 -0
- package/build/footnotes/init.js.map +1 -0
- package/build/list/edit.js +2 -1
- package/build/list/edit.js.map +1 -1
- package/build/navigation/edit/inner-blocks.js +2 -1
- package/build/navigation/edit/inner-blocks.js.map +1 -1
- package/build/post-content/edit.js +1 -1
- package/build/post-content/edit.js.map +1 -1
- package/build/post-template/index.js +1 -1
- package/build/query/edit/inspector-controls/index.js +28 -3
- package/build/query/edit/inspector-controls/index.js.map +1 -1
- package/build/query/edit/query-content.js +2 -1
- package/build/query/edit/query-content.js.map +1 -1
- package/build/query/index.js +9 -2
- package/build/query/index.js.map +1 -1
- package/build/query/view.js +75 -0
- package/build/query/view.js.map +1 -0
- package/build/query-pagination-next/index.js +1 -1
- package/build/query-pagination-numbers/edit.js +50 -5
- package/build/query-pagination-numbers/edit.js.map +1 -1
- package/build/query-pagination-numbers/index.js +7 -1
- package/build/query-pagination-numbers/index.js.map +1 -1
- package/build/query-pagination-previous/index.js +1 -1
- package/build/quote/edit.js +2 -1
- package/build/quote/edit.js.map +1 -1
- package/build/search/edit.js +3 -1
- package/build/search/edit.js.map +1 -1
- package/build/search/utils.js +2 -4
- package/build/search/utils.js.map +1 -1
- package/build/social-link/edit.native.js +1 -3
- package/build/social-link/edit.native.js.map +1 -1
- package/build/template-part/edit/index.js +22 -15
- package/build/template-part/edit/index.js.map +1 -1
- package/build-module/cover/edit/index.js +3 -1
- package/build-module/cover/edit/index.js.map +1 -1
- package/build-module/cover/shared.js +26 -21
- package/build-module/cover/shared.js.map +1 -1
- package/build-module/embed/embed-link-settings.native.js +0 -1
- package/build-module/embed/embed-link-settings.native.js.map +1 -1
- package/build-module/footnotes/init.js +6 -0
- package/build-module/footnotes/init.js.map +1 -0
- package/build-module/list/edit.js +2 -1
- package/build-module/list/edit.js.map +1 -1
- package/build-module/navigation/edit/inner-blocks.js +2 -1
- package/build-module/navigation/edit/inner-blocks.js.map +1 -1
- package/build-module/post-content/edit.js +1 -1
- package/build-module/post-content/edit.js.map +1 -1
- package/build-module/post-template/index.js +1 -1
- package/build-module/query/edit/inspector-controls/index.js +29 -4
- package/build-module/query/edit/inspector-controls/index.js.map +1 -1
- package/build-module/query/edit/query-content.js +2 -1
- package/build-module/query/edit/query-content.js.map +1 -1
- package/build-module/query/index.js +9 -2
- package/build-module/query/index.js.map +1 -1
- package/build-module/query/view.js +72 -0
- package/build-module/query/view.js.map +1 -0
- package/build-module/query-pagination-next/index.js +1 -1
- package/build-module/query-pagination-numbers/edit.js +51 -6
- package/build-module/query-pagination-numbers/edit.js.map +1 -1
- package/build-module/query-pagination-numbers/index.js +7 -1
- package/build-module/query-pagination-numbers/index.js.map +1 -1
- package/build-module/query-pagination-previous/index.js +1 -1
- package/build-module/quote/edit.js +2 -1
- package/build-module/quote/edit.js.map +1 -1
- package/build-module/search/edit.js +4 -2
- package/build-module/search/edit.js.map +1 -1
- package/build-module/search/utils.js +0 -1
- package/build-module/search/utils.js.map +1 -1
- package/build-module/social-link/edit.native.js +1 -3
- package/build-module/social-link/edit.native.js.map +1 -1
- package/build-module/template-part/edit/index.js +22 -15
- package/build-module/template-part/edit/index.js.map +1 -1
- package/build-style/editor-rtl.css +2 -1
- package/build-style/editor.css +2 -1
- package/build-style/query/style-rtl.css +140 -0
- package/build-style/query/style.css +140 -0
- package/build-style/site-logo/style-rtl.css +1 -0
- package/build-style/site-logo/style.css +1 -0
- package/build-style/social-links/editor-rtl.css +2 -1
- package/build-style/social-links/editor.css +2 -1
- package/build-style/style-rtl.css +1 -0
- package/build-style/style.css +1 -0
- package/package.json +32 -32
- package/src/audio/test/__snapshots__/edit.native.js.snap +106 -78
- package/src/cover/edit/index.js +3 -1
- package/src/cover/shared.js +25 -20
- package/src/cover/test/edit.native.js +1 -5
- package/src/embed/embed-link-settings.native.js +0 -1
- package/src/embed/test/index.native.js +9 -9
- package/src/file/test/__snapshots__/edit.native.js.snap +218 -162
- package/src/footnotes/init.js +6 -0
- package/src/image/index.php +5 -0
- package/src/list/edit.js +1 -0
- package/src/navigation/edit/inner-blocks.js +1 -0
- package/src/post-content/edit.js +2 -2
- package/src/post-content/index.php +0 -6
- package/src/post-featured-image/index.php +0 -6
- package/src/post-navigation-link/index.php +2 -2
- package/src/post-template/block.json +2 -1
- package/src/post-template/index.php +19 -4
- package/src/query/block.json +9 -2
- package/src/query/edit/inspector-controls/index.js +46 -3
- package/src/query/edit/query-content.js +1 -0
- package/src/query/index.php +94 -1
- package/src/query/style.scss +63 -0
- package/src/query/view.js +82 -0
- package/src/query-no-results/index.php +1 -5
- package/src/query-pagination-next/block.json +7 -1
- package/src/query-pagination-next/index.php +20 -3
- package/src/query-pagination-numbers/block.json +7 -1
- package/src/query-pagination-numbers/edit.js +64 -16
- package/src/query-pagination-numbers/index.php +27 -4
- package/src/query-pagination-previous/block.json +7 -1
- package/src/query-pagination-previous/index.php +19 -2
- package/src/quote/edit.js +1 -0
- package/src/search/edit.js +8 -2
- package/src/search/test/__snapshots__/edit.native.js.snap +363 -265
- package/src/search/utils.js +0 -1
- package/src/site-logo/style.scss +1 -0
- package/src/social-link/edit.native.js +1 -1
- package/src/social-link/editor.native.scss +0 -4
- package/src/social-links/editor.scss +2 -1
- package/src/social-links/test/edit.native.js +30 -0
- package/src/template-part/edit/index.js +35 -22
- package/tsconfig.tsbuildinfo +1 -1
- package/src/social-link/test/index.native.js +0 -132
|
@@ -43,19 +43,26 @@ const metadata = {
|
|
|
43
43
|
},
|
|
44
44
|
namespace: {
|
|
45
45
|
type: "string"
|
|
46
|
+
},
|
|
47
|
+
enhancedPagination: {
|
|
48
|
+
type: "boolean",
|
|
49
|
+
"default": false
|
|
46
50
|
}
|
|
47
51
|
},
|
|
48
52
|
providesContext: {
|
|
49
53
|
queryId: "queryId",
|
|
50
54
|
query: "query",
|
|
51
|
-
displayLayout: "displayLayout"
|
|
55
|
+
displayLayout: "displayLayout",
|
|
56
|
+
enhancedPagination: "enhancedPagination"
|
|
52
57
|
},
|
|
53
58
|
supports: {
|
|
54
59
|
align: ["wide", "full"],
|
|
55
60
|
html: false,
|
|
56
61
|
layout: true
|
|
57
62
|
},
|
|
58
|
-
editorStyle: "wp-block-query-editor"
|
|
63
|
+
editorStyle: "wp-block-query-editor",
|
|
64
|
+
style: "wp-block-query",
|
|
65
|
+
viewScript: "file:./view.min.js"
|
|
59
66
|
};
|
|
60
67
|
import edit from './edit';
|
|
61
68
|
import save from './save';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["loop","icon","initBlock","metadata","$schema","apiVersion","name","title","category","description","textdomain","attributes","queryId","type","query","perPage","pages","offset","postType","order","orderBy","author","search","exclude","sticky","inherit","taxQuery","parents","tagName","namespace","providesContext","displayLayout","supports","align","html","layout","editorStyle","edit","save","variations","deprecated","settings","init"],"sources":["@wordpress/block-library/src/query/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { loop 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';\nimport save from './save';\nimport variations from './variations';\nimport deprecated from './deprecated';\n\nconst { name } = metadata;\nexport { metadata, name };\n\nexport const settings = {\n\ticon,\n\tedit,\n\tsave,\n\tvariations,\n\tdeprecated,\n};\n\nexport const init = () => initBlock( { name, metadata, settings } );\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,IAAI,IAAIC,IAAI,QAAQ,kBAAkB;;AAE/C;AACA;AACA;AACA,OAAOC,SAAS,MAAM,qBAAqB;AAAC,MAAAC,QAAA;EAAAC,OAAA;EAAAC,UAAA;EAAAC,IAAA;EAAAC,KAAA;EAAAC,QAAA;EAAAC,WAAA;EAAAC,UAAA;EAAAC,UAAA;IAAAC,OAAA;MAAAC,IAAA;IAAA;IAAAC,KAAA;MAAAD,IAAA;MAAA;QAAAE,OAAA;QAAAC,KAAA;QAAAC,MAAA;QAAAC,QAAA;QAAAC,KAAA;QAAAC,OAAA;QAAAC,MAAA;QAAAC,MAAA;QAAAC,OAAA;QAAAC,MAAA;QAAAC,OAAA;QAAAC,QAAA;QAAAC,OAAA;MAAA;IAAA;IAAAC,OAAA;MAAAf,IAAA;MAAA;IAAA;IAAAgB,SAAA;MAAAhB,IAAA;IAAA;EAAA;
|
|
1
|
+
{"version":3,"names":["loop","icon","initBlock","metadata","$schema","apiVersion","name","title","category","description","textdomain","attributes","queryId","type","query","perPage","pages","offset","postType","order","orderBy","author","search","exclude","sticky","inherit","taxQuery","parents","tagName","namespace","enhancedPagination","providesContext","displayLayout","supports","align","html","layout","editorStyle","style","viewScript","edit","save","variations","deprecated","settings","init"],"sources":["@wordpress/block-library/src/query/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { loop 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';\nimport save from './save';\nimport variations from './variations';\nimport deprecated from './deprecated';\n\nconst { name } = metadata;\nexport { metadata, name };\n\nexport const settings = {\n\ticon,\n\tedit,\n\tsave,\n\tvariations,\n\tdeprecated,\n};\n\nexport const init = () => initBlock( { name, metadata, settings } );\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,IAAI,IAAIC,IAAI,QAAQ,kBAAkB;;AAE/C;AACA;AACA;AACA,OAAOC,SAAS,MAAM,qBAAqB;AAAC,MAAAC,QAAA;EAAAC,OAAA;EAAAC,UAAA;EAAAC,IAAA;EAAAC,KAAA;EAAAC,QAAA;EAAAC,WAAA;EAAAC,UAAA;EAAAC,UAAA;IAAAC,OAAA;MAAAC,IAAA;IAAA;IAAAC,KAAA;MAAAD,IAAA;MAAA;QAAAE,OAAA;QAAAC,KAAA;QAAAC,MAAA;QAAAC,QAAA;QAAAC,KAAA;QAAAC,OAAA;QAAAC,MAAA;QAAAC,MAAA;QAAAC,OAAA;QAAAC,MAAA;QAAAC,OAAA;QAAAC,QAAA;QAAAC,OAAA;MAAA;IAAA;IAAAC,OAAA;MAAAf,IAAA;MAAA;IAAA;IAAAgB,SAAA;MAAAhB,IAAA;IAAA;IAAAiB,kBAAA;MAAAjB,IAAA;MAAA;IAAA;EAAA;EAAAkB,eAAA;IAAAnB,OAAA;IAAAE,KAAA;IAAAkB,aAAA;IAAAF,kBAAA;EAAA;EAAAG,QAAA;IAAAC,KAAA;IAAAC,IAAA;IAAAC,MAAA;EAAA;EAAAC,WAAA;EAAAC,KAAA;EAAAC,UAAA;AAAA;AAE5C,OAAOC,IAAI,MAAM,QAAQ;AACzB,OAAOC,IAAI,MAAM,QAAQ;AACzB,OAAOC,UAAU,MAAM,cAAc;AACrC,OAAOC,UAAU,MAAM,cAAc;AAErC,MAAM;EAAErC;AAAK,CAAC,GAAGH,QAAQ;AACzB,SAASA,QAAQ,EAAEG,IAAI;AAEvB,OAAO,MAAMsC,QAAQ,GAAG;EACvB3C,IAAI;EACJuC,IAAI;EACJC,IAAI;EACJC,UAAU;EACVC;AACD,CAAC;AAED,OAAO,MAAME,IAAI,GAAGA,CAAA,KAAM3C,SAAS,CAAE;EAAEI,IAAI;EAAEH,QAAQ;EAAEyC;AAAS,CAAE,CAAC"}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { store, navigate, prefetch } from '@wordpress/interactivity';
|
|
5
|
+
const isValidLink = ref => ref && ref instanceof window.HTMLAnchorElement && ref.href && (!ref.target || ref.target === '_self') && ref.origin === window.location.origin;
|
|
6
|
+
const isValidEvent = event => event.button === 0 &&
|
|
7
|
+
// left clicks only
|
|
8
|
+
!event.metaKey &&
|
|
9
|
+
// open in new tab (mac)
|
|
10
|
+
!event.ctrlKey &&
|
|
11
|
+
// open in new tab (windows)
|
|
12
|
+
!event.altKey &&
|
|
13
|
+
// download
|
|
14
|
+
!event.shiftKey && !event.defaultPrevented;
|
|
15
|
+
store({
|
|
16
|
+
selectors: {
|
|
17
|
+
core: {
|
|
18
|
+
query: {
|
|
19
|
+
startAnimation: ({
|
|
20
|
+
context
|
|
21
|
+
}) => context.core.query.animation === 'start',
|
|
22
|
+
finishAnimation: ({
|
|
23
|
+
context
|
|
24
|
+
}) => context.core.query.animation === 'finish'
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
actions: {
|
|
29
|
+
core: {
|
|
30
|
+
query: {
|
|
31
|
+
navigate: async ({
|
|
32
|
+
event,
|
|
33
|
+
ref,
|
|
34
|
+
context,
|
|
35
|
+
state
|
|
36
|
+
}) => {
|
|
37
|
+
if (isValidLink(ref) && isValidEvent(event)) {
|
|
38
|
+
event.preventDefault();
|
|
39
|
+
const id = ref.closest('[data-wp-navigation-id]').dataset.wpNavigationId;
|
|
40
|
+
|
|
41
|
+
// Don't announce the navigation immediately, wait 300 ms.
|
|
42
|
+
const timeout = setTimeout(() => {
|
|
43
|
+
context.core.query.message = state.core.query.loadingText;
|
|
44
|
+
context.core.query.animation = 'start';
|
|
45
|
+
}, 300);
|
|
46
|
+
await navigate(ref.href);
|
|
47
|
+
|
|
48
|
+
// Dismiss loading message if it hasn't been added yet.
|
|
49
|
+
clearTimeout(timeout);
|
|
50
|
+
|
|
51
|
+
// Announce that the page has been loaded. If the message is the
|
|
52
|
+
// same, we use a no-break space similar to the @wordpress/a11y
|
|
53
|
+
// package: https://github.com/WordPress/gutenberg/blob/c395242b8e6ee20f8b06c199e4fc2920d7018af1/packages/a11y/src/filter-message.js#L20-L26
|
|
54
|
+
context.core.query.message = state.core.query.loadedText + (context.core.query.message === state.core.query.loadedText ? '\u00A0' : '');
|
|
55
|
+
context.core.query.animation = 'finish';
|
|
56
|
+
|
|
57
|
+
// Focus the first anchor of the Query block.
|
|
58
|
+
document.querySelector(`[data-wp-navigation-id=${id}] a[href]`)?.focus();
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
prefetch: async ({
|
|
62
|
+
ref
|
|
63
|
+
}) => {
|
|
64
|
+
if (isValidLink(ref)) {
|
|
65
|
+
await prefetch(ref.href);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
//# sourceMappingURL=view.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["store","navigate","prefetch","isValidLink","ref","window","HTMLAnchorElement","href","target","origin","location","isValidEvent","event","button","metaKey","ctrlKey","altKey","shiftKey","defaultPrevented","selectors","core","query","startAnimation","context","animation","finishAnimation","actions","state","preventDefault","id","closest","dataset","wpNavigationId","timeout","setTimeout","message","loadingText","clearTimeout","loadedText","document","querySelector","focus"],"sources":["@wordpress/block-library/src/query/view.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { store, navigate, prefetch } from '@wordpress/interactivity';\n\nconst isValidLink = ( ref ) =>\n\tref &&\n\tref instanceof window.HTMLAnchorElement &&\n\tref.href &&\n\t( ! ref.target || ref.target === '_self' ) &&\n\tref.origin === window.location.origin;\n\nconst isValidEvent = ( event ) =>\n\tevent.button === 0 && // left clicks only\n\t! event.metaKey && // open in new tab (mac)\n\t! event.ctrlKey && // open in new tab (windows)\n\t! event.altKey && // download\n\t! event.shiftKey &&\n\t! event.defaultPrevented;\n\nstore( {\n\tselectors: {\n\t\tcore: {\n\t\t\tquery: {\n\t\t\t\tstartAnimation: ( { context } ) =>\n\t\t\t\t\tcontext.core.query.animation === 'start',\n\t\t\t\tfinishAnimation: ( { context } ) =>\n\t\t\t\t\tcontext.core.query.animation === 'finish',\n\t\t\t},\n\t\t},\n\t},\n\tactions: {\n\t\tcore: {\n\t\t\tquery: {\n\t\t\t\tnavigate: async ( { event, ref, context, state } ) => {\n\t\t\t\t\tif ( isValidLink( ref ) && isValidEvent( event ) ) {\n\t\t\t\t\t\tevent.preventDefault();\n\n\t\t\t\t\t\tconst id = ref.closest( '[data-wp-navigation-id]' )\n\t\t\t\t\t\t\t.dataset.wpNavigationId;\n\n\t\t\t\t\t\t// Don't announce the navigation immediately, wait 300 ms.\n\t\t\t\t\t\tconst timeout = setTimeout( () => {\n\t\t\t\t\t\t\tcontext.core.query.message =\n\t\t\t\t\t\t\t\tstate.core.query.loadingText;\n\t\t\t\t\t\t\tcontext.core.query.animation = 'start';\n\t\t\t\t\t\t}, 300 );\n\n\t\t\t\t\t\tawait navigate( ref.href );\n\n\t\t\t\t\t\t// Dismiss loading message if it hasn't been added yet.\n\t\t\t\t\t\tclearTimeout( timeout );\n\n\t\t\t\t\t\t// Announce that the page has been loaded. If the message is the\n\t\t\t\t\t\t// same, we use a no-break space similar to the @wordpress/a11y\n\t\t\t\t\t\t// package: https://github.com/WordPress/gutenberg/blob/c395242b8e6ee20f8b06c199e4fc2920d7018af1/packages/a11y/src/filter-message.js#L20-L26\n\t\t\t\t\t\tcontext.core.query.message =\n\t\t\t\t\t\t\tstate.core.query.loadedText +\n\t\t\t\t\t\t\t( context.core.query.message ===\n\t\t\t\t\t\t\tstate.core.query.loadedText\n\t\t\t\t\t\t\t\t? '\\u00A0'\n\t\t\t\t\t\t\t\t: '' );\n\n\t\t\t\t\t\tcontext.core.query.animation = 'finish';\n\n\t\t\t\t\t\t// Focus the first anchor of the Query block.\n\t\t\t\t\t\tdocument\n\t\t\t\t\t\t\t.querySelector(\n\t\t\t\t\t\t\t\t`[data-wp-navigation-id=${ id }] a[href]`\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t?.focus();\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t\tprefetch: async ( { ref } ) => {\n\t\t\t\t\tif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AAM,CAAC,EAAG;YAClDA,KAAK,CAACgB,cAAc,CAAC,CAAC;YAEtB,MAAMC,EAAE,GAAGzB,GAAG,CAAC0B,OAAO,CAAE,yBAA0B,CAAC,CACjDC,OAAO,CAACC,cAAc;;YAExB;YACA,MAAMC,OAAO,GAAGC,UAAU,CAAE,MAAM;cACjCX,OAAO,CAACH,IAAI,CAACC,KAAK,CAACc,OAAO,GACzBR,KAAK,CAACP,IAAI,CAACC,KAAK,CAACe,WAAW;cAC7Bb,OAAO,CAACH,IAAI,CAACC,KAAK,CAACG,SAAS,GAAG,OAAO;YACvC,CAAC,EAAE,GAAI,CAAC;YAER,MAAMvB,QAAQ,CAAEG,GAAG,CAACG,IAAK,CAAC;;YAE1B;YACA8B,YAAY,CAAEJ,OAAQ,CAAC;;YAEvB;YACA;YACA;YACAV,OAAO,CAACH,IAAI,CAACC,KAAK,CAACc,OAAO,GACzBR,KAAK,CAACP,IAAI,CAACC,KAAK,CAACiB,UAAU,IACzBf,OAAO,CAACH,IAAI,CAACC,KAAK,CAACc,OAAO,KAC5BR,KAAK,CAACP,IAAI,CAACC,KAAK,CAACiB,UAAU,GACxB,QAAQ,GACR,EAAE,CAAE;YAERf,OAAO,CAACH,IAAI,CAACC,KAAK,CAACG,SAAS,GAAG,QAAQ;;YAEvC;YACAe,QAAQ,CACNC,aAAa,CACZ,0BAA0BX,EAAI,WAChC,CAAC,EACCY,KAAK,CAAC,CAAC;UACX;QACD,CAAC;QACDvC,QAAQ,EAAE,MAAAA,CAAQ;UAAEE;QAAI,CAAC,KAAM;UAC9B,IAAKD,WAAW,CAAEC,GAAI,CAAC,EAAG;YACzB,MAAMF,QAAQ,CAAEE,GAAG,CAACG,IAAK,CAAC;UAC3B;QACD;MACD;IACD;EACD;AACD,CAAE,CAAC"}
|
|
@@ -21,7 +21,7 @@ const metadata = {
|
|
|
21
21
|
type: "string"
|
|
22
22
|
}
|
|
23
23
|
},
|
|
24
|
-
usesContext: ["queryId", "query", "paginationArrow", "showLabel"],
|
|
24
|
+
usesContext: ["queryId", "query", "paginationArrow", "showLabel", "enhancedPagination"],
|
|
25
25
|
supports: {
|
|
26
26
|
reusable: false,
|
|
27
27
|
html: false,
|
|
@@ -2,15 +2,60 @@ import { createElement, Fragment } from "@wordpress/element";
|
|
|
2
2
|
/**
|
|
3
3
|
* WordPress dependencies
|
|
4
4
|
*/
|
|
5
|
-
import {
|
|
5
|
+
import { __ } from '@wordpress/i18n';
|
|
6
|
+
import { InspectorControls, useBlockProps } from '@wordpress/block-editor';
|
|
7
|
+
import { PanelBody, RangeControl } from '@wordpress/components';
|
|
6
8
|
const createPaginationItem = (content, Tag = 'a', extraClass = '') => createElement(Tag, {
|
|
9
|
+
key: content,
|
|
7
10
|
className: `page-numbers ${extraClass}`
|
|
8
11
|
}, content);
|
|
9
|
-
const previewPaginationNumbers =
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
12
|
+
const previewPaginationNumbers = midSize => {
|
|
13
|
+
const paginationItems = [];
|
|
14
|
+
|
|
15
|
+
// First set of pagination items.
|
|
16
|
+
for (let i = 1; i <= midSize; i++) {
|
|
17
|
+
paginationItems.push(createPaginationItem(i));
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
// Current pagination item.
|
|
21
|
+
paginationItems.push(createPaginationItem(midSize + 1, 'span', 'current'));
|
|
22
|
+
|
|
23
|
+
// Second set of pagination items.
|
|
24
|
+
for (let i = 1; i <= midSize; i++) {
|
|
25
|
+
paginationItems.push(createPaginationItem(midSize + 1 + i));
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
// Dots.
|
|
29
|
+
paginationItems.push(createPaginationItem('...', 'span', 'dots'));
|
|
30
|
+
|
|
31
|
+
// Last pagination item.
|
|
32
|
+
paginationItems.push(createPaginationItem(midSize * 2 + 3));
|
|
33
|
+
return createElement(Fragment, null, paginationItems);
|
|
34
|
+
};
|
|
35
|
+
export default function QueryPaginationNumbersEdit({
|
|
36
|
+
attributes,
|
|
37
|
+
setAttributes
|
|
38
|
+
}) {
|
|
39
|
+
const {
|
|
40
|
+
midSize
|
|
41
|
+
} = attributes;
|
|
42
|
+
const paginationNumbers = previewPaginationNumbers(parseInt(midSize, 10));
|
|
43
|
+
return createElement(Fragment, null, createElement(InspectorControls, null, createElement(PanelBody, {
|
|
44
|
+
title: __('Settings')
|
|
45
|
+
}, createElement(RangeControl, {
|
|
46
|
+
label: __('Number of links'),
|
|
47
|
+
help: __('Specify how many links can appear before and after the current page number. Links to the first, current and last page are always visible.'),
|
|
48
|
+
value: midSize,
|
|
49
|
+
onChange: value => {
|
|
50
|
+
setAttributes({
|
|
51
|
+
midSize: parseInt(value, 10)
|
|
52
|
+
});
|
|
53
|
+
},
|
|
54
|
+
min: 0,
|
|
55
|
+
max: 5,
|
|
56
|
+
withInputField: false
|
|
57
|
+
}))), createElement("div", {
|
|
13
58
|
...useBlockProps()
|
|
14
|
-
}, paginationNumbers);
|
|
59
|
+
}, paginationNumbers));
|
|
15
60
|
}
|
|
16
61
|
//# sourceMappingURL=edit.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useBlockProps","createPaginationItem","content","Tag","extraClass","createElement","className","previewPaginationNumbers","Fragment","QueryPaginationNumbersEdit","paginationNumbers"],"sources":["@wordpress/block-library/src/query-pagination-numbers/edit.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useBlockProps } from '@wordpress/block-editor';\n\nconst createPaginationItem = ( content, Tag = 'a', extraClass = '' ) => (\n\t<Tag className={ `page-numbers ${ extraClass }` }
|
|
1
|
+
{"version":3,"names":["__","InspectorControls","useBlockProps","PanelBody","RangeControl","createPaginationItem","content","Tag","extraClass","createElement","key","className","previewPaginationNumbers","midSize","paginationItems","i","push","Fragment","QueryPaginationNumbersEdit","attributes","setAttributes","paginationNumbers","parseInt","title","label","help","value","onChange","min","max","withInputField"],"sources":["@wordpress/block-library/src/query-pagination-numbers/edit.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { InspectorControls, useBlockProps } from '@wordpress/block-editor';\nimport { PanelBody, RangeControl } from '@wordpress/components';\n\nconst createPaginationItem = ( content, Tag = 'a', extraClass = '' ) => (\n\t<Tag key={ content } className={ `page-numbers ${ extraClass }` }>\n\t\t{ content }\n\t</Tag>\n);\n\nconst previewPaginationNumbers = ( midSize ) => {\n\tconst paginationItems = [];\n\n\t// First set of pagination items.\n\tfor ( let i = 1; i <= midSize; i++ ) {\n\t\tpaginationItems.push( createPaginationItem( i ) );\n\t}\n\n\t// Current pagination item.\n\tpaginationItems.push(\n\t\tcreatePaginationItem( midSize + 1, 'span', 'current' )\n\t);\n\n\t// Second set of pagination items.\n\tfor ( let i = 1; i <= midSize; i++ ) {\n\t\tpaginationItems.push( createPaginationItem( midSize + 1 + i ) );\n\t}\n\n\t// Dots.\n\tpaginationItems.push( createPaginationItem( '...', 'span', 'dots' ) );\n\n\t// Last pagination item.\n\tpaginationItems.push( createPaginationItem( midSize * 2 + 3 ) );\n\n\treturn <>{ paginationItems }</>;\n};\n\nexport default function QueryPaginationNumbersEdit( {\n\tattributes,\n\tsetAttributes,\n} ) {\n\tconst { midSize } = attributes;\n\tconst paginationNumbers = previewPaginationNumbers(\n\t\tparseInt( midSize, 10 )\n\t);\n\treturn (\n\t\t<>\n\t\t\t<InspectorControls>\n\t\t\t\t<PanelBody title={ __( 'Settings' ) }>\n\t\t\t\t\t<RangeControl\n\t\t\t\t\t\tlabel={ __( 'Number of links' ) }\n\t\t\t\t\t\thelp={ __(\n\t\t\t\t\t\t\t'Specify how many links can appear before and after the current page number. Links to the first, current and last page are always visible.'\n\t\t\t\t\t\t) }\n\t\t\t\t\t\tvalue={ midSize }\n\t\t\t\t\t\tonChange={ ( value ) => {\n\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\tmidSize: parseInt( value, 10 ),\n\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tmin={ 0 }\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AG,CAAC,GAAG,CAAE,CAAE,CAAC;EAE/D,OAAOJ,aAAA,CAAAQ,QAAA,QAAIH,eAAmB,CAAC;AAChC,CAAC;AAED,eAAe,SAASI,0BAA0BA,CAAE;EACnDC,UAAU;EACVC;AACD,CAAC,EAAG;EACH,MAAM;IAAEP;EAAQ,CAAC,GAAGM,UAAU;EAC9B,MAAME,iBAAiB,GAAGT,wBAAwB,CACjDU,QAAQ,CAAET,OAAO,EAAE,EAAG,CACvB,CAAC;EACD,OACCJ,aAAA,CAAAQ,QAAA,QACCR,aAAA,CAACR,iBAAiB,QACjBQ,aAAA,CAACN,SAAS;IAACoB,KAAK,EAAGvB,EAAE,CAAE,UAAW;EAAG,GACpCS,aAAA,CAACL,YAAY;IACZoB,KAAK,EAAGxB,EAAE,CAAE,iBAAkB,CAAG;IACjCyB,IAAI,EAAGzB,EAAE,CACR,2IACD,CAAG;IACH0B,KAAK,EAAGb,OAAS;IACjBc,QAAQ,EAAKD,KAAK,IAAM;MACvBN,aAAa,CAAE;QACdP,OAAO,EAAES,QAAQ,CAAEI,KAAK,EAAE,EAAG;MAC9B,CAAE,CAAC;IACJ,CAAG;IACHE,GAAG,EAAG,CAAG;IACTC,GAAG,EAAG,CAAG;IACTC,cAAc,EAAG;EAAO,CACxB,CACS,CACO,CAAC,EACpBrB,aAAA;IAAA,GAAUP,aAAa,CAAC;EAAC,GAAKmB,iBAAwB,CACrD,CAAC;AAEL"}
|
|
@@ -16,7 +16,13 @@ const metadata = {
|
|
|
16
16
|
parent: ["core/query-pagination"],
|
|
17
17
|
description: "Displays a list of page numbers for pagination",
|
|
18
18
|
textdomain: "default",
|
|
19
|
-
|
|
19
|
+
attributes: {
|
|
20
|
+
midSize: {
|
|
21
|
+
type: "number",
|
|
22
|
+
"default": 2
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
usesContext: ["queryId", "query", "enhancedPagination"],
|
|
20
26
|
supports: {
|
|
21
27
|
reusable: false,
|
|
22
28
|
html: false,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["queryPaginationNumbers","icon","initBlock","metadata","$schema","apiVersion","name","title","category","parent","description","textdomain","usesContext","supports","reusable","html","color","gradients","text","__experimentalDefaultControls","background","typography","fontSize","lineHeight","__experimentalFontFamily","__experimentalFontWeight","__experimentalFontStyle","__experimentalTextTransform","__experimentalTextDecoration","__experimentalLetterSpacing","editorStyle","edit","settings","init"],"sources":["@wordpress/block-library/src/query-pagination-numbers/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { queryPaginationNumbers 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"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,sBAAsB,IAAIC,IAAI,QAAQ,kBAAkB;;AAEjE;AACA;AACA;AACA,OAAOC,SAAS,MAAM,qBAAqB;AAAC,MAAAC,QAAA;EAAAC,OAAA;EAAAC,UAAA;EAAAC,IAAA;EAAAC,KAAA;EAAAC,QAAA;EAAAC,MAAA;EAAAC,WAAA;EAAAC,UAAA;EAAAC,WAAA;EAAAC,QAAA;IAAAC,QAAA;IAAAC,IAAA;IAAAC,KAAA;MAAAC,SAAA;MAAAC,IAAA;MAAAC,6BAAA;QAAAC,UAAA;MAAA;IAAA;IAAAC,UAAA;MAAAC,QAAA;MAAAC,UAAA;MAAAC,wBAAA;MAAAC,wBAAA;MAAAC,uBAAA;MAAAC,2BAAA;MAAAC,4BAAA;MAAAC,2BAAA;MAAAV,6BAAA;QAAAG,QAAA;MAAA;IAAA;EAAA;EAAAQ,WAAA;AAAA;AAE5C,OAAOC,IAAI,MAAM,QAAQ;AAEzB,MAAM;
|
|
1
|
+
{"version":3,"names":["queryPaginationNumbers","icon","initBlock","metadata","$schema","apiVersion","name","title","category","parent","description","textdomain","attributes","midSize","type","usesContext","supports","reusable","html","color","gradients","text","__experimentalDefaultControls","background","typography","fontSize","lineHeight","__experimentalFontFamily","__experimentalFontWeight","__experimentalFontStyle","__experimentalTextTransform","__experimentalTextDecoration","__experimentalLetterSpacing","editorStyle","edit","settings","init"],"sources":["@wordpress/block-library/src/query-pagination-numbers/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { queryPaginationNumbers 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"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,sBAAsB,IAAIC,IAAI,QAAQ,kBAAkB;;AAEjE;AACA;AACA;AACA,OAAOC,SAAS,MAAM,qBAAqB;AAAC,MAAAC,QAAA;EAAAC,OAAA;EAAAC,UAAA;EAAAC,IAAA;EAAAC,KAAA;EAAAC,QAAA;EAAAC,MAAA;EAAAC,WAAA;EAAAC,UAAA;EAAAC,UAAA;IAAAC,OAAA;MAAAC,IAAA;MAAA;IAAA;EAAA;EAAAC,WAAA;EAAAC,QAAA;IAAAC,QAAA;IAAAC,IAAA;IAAAC,KAAA;MAAAC,SAAA;MAAAC,IAAA;MAAAC,6BAAA;QAAAC,UAAA;MAAA;IAAA;IAAAC,UAAA;MAAAC,QAAA;MAAAC,UAAA;MAAAC,wBAAA;MAAAC,wBAAA;MAAAC,uBAAA;MAAAC,2BAAA;MAAAC,4BAAA;MAAAC,2BAAA;MAAAV,6BAAA;QAAAG,QAAA;MAAA;IAAA;EAAA;EAAAQ,WAAA;AAAA;AAE5C,OAAOC,IAAI,MAAM,QAAQ;AAEzB,MAAM;EAAE5B;AAAK,CAAC,GAAGH,QAAQ;AACzB,SAASA,QAAQ,EAAEG,IAAI;AAEvB,OAAO,MAAM6B,QAAQ,GAAG;EACvBlC,IAAI;EACJiC;AACD,CAAC;AAED,OAAO,MAAME,IAAI,GAAGA,CAAA,KAAMlC,SAAS,CAAE;EAAEI,IAAI;EAAEH,QAAQ;EAAEgC;AAAS,CAAE,CAAC"}
|
|
@@ -21,7 +21,7 @@ const metadata = {
|
|
|
21
21
|
type: "string"
|
|
22
22
|
}
|
|
23
23
|
},
|
|
24
|
-
usesContext: ["queryId", "query", "paginationArrow", "showLabel"],
|
|
24
|
+
usesContext: ["queryId", "query", "paginationArrow", "showLabel", "enhancedPagination"],
|
|
25
25
|
supports: {
|
|
26
26
|
reusable: false,
|
|
27
27
|
html: false,
|
|
@@ -85,7 +85,8 @@ export default function QuoteEdit({
|
|
|
85
85
|
});
|
|
86
86
|
const innerBlocksProps = useInnerBlocksProps(blockProps, {
|
|
87
87
|
template: TEMPLATE,
|
|
88
|
-
templateInsertUpdatesSelection: true
|
|
88
|
+
templateInsertUpdatesSelection: true,
|
|
89
|
+
__experimentalCaptureToolbars: true
|
|
89
90
|
});
|
|
90
91
|
return createElement(Fragment, null, createElement(BlockControls, {
|
|
91
92
|
group: "block"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["classNames","__","AlignmentControl","BlockControls","RichText","useBlockProps","useInnerBlocksProps","store","blockEditorStore","BlockQuotation","useDispatch","useSelect","useRegistry","createBlock","getDefaultBlockName","Platform","useEffect","deprecated","migrateToQuoteV2","isWebPlatform","OS","TEMPLATE","useMigrateOnLoad","attributes","clientId","registry","updateBlockAttributes","replaceInnerBlocks","value","newAttributes","newInnerBlocks","since","version","alternative","batch","QuoteEdit","setAttributes","insertBlocksAfter","className","style","align","citation","hasSelection","select","isBlockSelected","hasSelectedInnerBlock","blockProps","innerBlocksProps","template","templateInsertUpdatesSelection","createElement","Fragment","group","onChange","nextAlign","children","isEmpty","identifier","tagName","undefined","display","nextCitation","__unstableMobileNoFocusOnMount","placeholder","__unstableOnSplitAtEnd","textAlign"],"sources":["@wordpress/block-library/src/quote/edit.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classNames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport {\n\tAlignmentControl,\n\tBlockControls,\n\tRichText,\n\tuseBlockProps,\n\tuseInnerBlocksProps,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport { BlockQuotation } from '@wordpress/components';\nimport { useDispatch, useSelect, useRegistry } from '@wordpress/data';\nimport { createBlock, getDefaultBlockName } from '@wordpress/blocks';\nimport { Platform, useEffect } from '@wordpress/element';\nimport deprecated from '@wordpress/deprecated';\n\n/**\n * Internal dependencies\n */\nimport { migrateToQuoteV2 } from './deprecated';\n\nconst isWebPlatform = Platform.OS === 'web';\n\nconst TEMPLATE = [ [ 'core/paragraph', {} ] ];\n\n/**\n * At the moment, deprecations don't handle create blocks from attributes\n * (like when using CPT templates). For this reason, this hook is necessary\n * to avoid breaking templates using the old quote block format.\n *\n * @param {Object} attributes Block attributes.\n * @param {string} clientId Block client ID.\n */\nconst useMigrateOnLoad = ( attributes, clientId ) => {\n\tconst registry = useRegistry();\n\tconst { updateBlockAttributes, replaceInnerBlocks } =\n\t\tuseDispatch( blockEditorStore );\n\tuseEffect( () => {\n\t\t// As soon as the block is loaded, migrate it to the new version.\n\n\t\tif ( ! attributes.value ) {\n\t\t\t// No need to migrate if it doesn't have the value attribute.\n\t\t\treturn;\n\t\t}\n\n\t\tconst [ newAttributes, newInnerBlocks ] =\n\t\t\tmigrateToQuoteV2( attributes );\n\n\t\tdeprecated( 'Value attribute on the quote block', {\n\t\t\tsince: '6.0',\n\t\t\tversion: '6.5',\n\t\t\talternative: 'inner blocks',\n\t\t} );\n\n\t\tregistry.batch( () => {\n\t\t\tupdateBlockAttributes( clientId, newAttributes );\n\t\t\treplaceInnerBlocks( clientId, newInnerBlocks );\n\t\t} );\n\t}, [ attributes.value ] );\n};\n\nexport default function QuoteEdit( {\n\tattributes,\n\tsetAttributes,\n\tinsertBlocksAfter,\n\tclientId,\n\tclassName,\n\tstyle,\n} ) {\n\tconst { align, citation } = attributes;\n\n\tuseMigrateOnLoad( attributes, clientId );\n\n\tconst hasSelection = useSelect( ( select ) => {\n\t\tconst { isBlockSelected, hasSelectedInnerBlock } =\n\t\t\tselect( blockEditorStore );\n\t\treturn hasSelectedInnerBlock( clientId ) || isBlockSelected( clientId );\n\t}, [] );\n\n\tconst blockProps = useBlockProps( {\n\t\tclassName: classNames( className, {\n\t\t\t[ `has-text-align-${ align }` ]: align,\n\t\t} ),\n\t\t...( ! isWebPlatform && { style } ),\n\t} );\n\tconst innerBlocksProps = useInnerBlocksProps( blockProps, {\n\t\ttemplate: TEMPLATE,\n\t\ttemplateInsertUpdatesSelection: true,\n\t} );\n\n\treturn (\n\t\t<>\n\t\t\t<BlockControls group=\"block\">\n\t\t\t\t<AlignmentControl\n\t\t\t\t\tvalue={ align }\n\t\t\t\t\tonChange={ ( nextAlign ) => {\n\t\t\t\t\t\tsetAttributes( { align: nextAlign } );\n\t\t\t\t\t} }\n\t\t\t\t/>\n\t\t\t</BlockControls>\n\t\t\t<BlockQuotation { ...innerBlocksProps }>\n\t\t\t\t{ innerBlocksProps.children }\n\t\t\t\t{ ( ! RichText.isEmpty( citation ) || hasSelection ) && (\n\t\t\t\t\t<RichText\n\t\t\t\t\t\tidentifier=\"citation\"\n\t\t\t\t\t\ttagName={ isWebPlatform ? 'cite' : undefined }\n\t\t\t\t\t\tstyle={ { display: 'block' } }\n\t\t\t\t\t\tvalue={ citation }\n\t\t\t\t\t\tonChange={ ( nextCitation ) => {\n\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\tcitation: nextCitation,\n\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t} }\n\t\t\t\t\t\t__unstableMobileNoFocusOnMount\n\t\t\t\t\t\taria-label={ __( 'Quote citation' ) }\n\t\t\t\t\t\tplaceholder={\n\t\t\t\t\t\t\t// translators: placeholder text used for the\n\t\t\t\t\t\t\t// citation\n\t\t\t\t\t\t\t__( 'Add citation' )\n\t\t\t\t\t\t}\n\t\t\t\t\t\tclassName=\"wp-block-quote__citation\"\n\t\t\t\t\t\t__unstableOnSplitAtEnd={ () =>\n\t\t\t\t\t\t\tinsertBlocksAfter(\n\t\t\t\t\t\t\t\tcreateBlock( getDefaultBlockName() )\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t}\n\t\t\t\t\t\t{ ...( ! isWebPlatform ? { textAlign: align } : {} ) }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t</BlockQuotation>\n\t\t</>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,OAAOA,UAAU,MAAM,YAAY;;AAEnC;AACA;AACA;AACA,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SACCC,gBAAgB,EAChBC,aAAa,EACbC,QAAQ,EACRC,aAAa,EACbC,mBAAmB,EACnBC,KAAK,IAAIC,gBAAgB,QACnB,yBAAyB;AAChC,SAASC,cAAc,QAAQ,uBAAuB;AACtD,SAASC,WAAW,EAAEC,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;AACrE,SAASC,WAAW,EAAEC,mBAAmB,QAAQ,mBAAmB;AACpE,SAASC,QAAQ,EAAEC,SAAS,QAAQ,oBAAoB;AACxD,OAAOC,UAAU,MAAM,uBAAuB;;AAE9C;AACA;AACA;AACA,SAASC,gBAAgB,QAAQ,cAAc;AAE/C,MAAMC,aAAa,GAAGJ,QAAQ,CAACK,EAAE,KAAK,KAAK;AAE3C,MAAMC,QAAQ,GAAG,CAAE,CAAE,gBAAgB,EAAE,CAAC,CAAC,CAAE,CAAE;;AAE7C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMC,gBAAgB,GAAGA,CAAEC,UAAU,EAAEC,QAAQ,KAAM;EACpD,MAAMC,QAAQ,GAAGb,WAAW,CAAC,CAAC;EAC9B,MAAM;IAAEc,qBAAqB;IAAEC;EAAmB,CAAC,GAClDjB,WAAW,CAAEF,gB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,gBAAgB,GAAGzC,mBAAmB,CAAEwC,UAAU,EAAE;IACzDE,QAAQ,EAAE3B,QAAQ;IAClB4B,8BAA8B,EAAE;
|
|
1
|
+
{"version":3,"names":["classNames","__","AlignmentControl","BlockControls","RichText","useBlockProps","useInnerBlocksProps","store","blockEditorStore","BlockQuotation","useDispatch","useSelect","useRegistry","createBlock","getDefaultBlockName","Platform","useEffect","deprecated","migrateToQuoteV2","isWebPlatform","OS","TEMPLATE","useMigrateOnLoad","attributes","clientId","registry","updateBlockAttributes","replaceInnerBlocks","value","newAttributes","newInnerBlocks","since","version","alternative","batch","QuoteEdit","setAttributes","insertBlocksAfter","className","style","align","citation","hasSelection","select","isBlockSelected","hasSelectedInnerBlock","blockProps","innerBlocksProps","template","templateInsertUpdatesSelection","__experimentalCaptureToolbars","createElement","Fragment","group","onChange","nextAlign","children","isEmpty","identifier","tagName","undefined","display","nextCitation","__unstableMobileNoFocusOnMount","placeholder","__unstableOnSplitAtEnd","textAlign"],"sources":["@wordpress/block-library/src/quote/edit.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classNames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport {\n\tAlignmentControl,\n\tBlockControls,\n\tRichText,\n\tuseBlockProps,\n\tuseInnerBlocksProps,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport { BlockQuotation } from '@wordpress/components';\nimport { useDispatch, useSelect, useRegistry } from '@wordpress/data';\nimport { createBlock, getDefaultBlockName } from '@wordpress/blocks';\nimport { Platform, useEffect } from '@wordpress/element';\nimport deprecated from '@wordpress/deprecated';\n\n/**\n * Internal dependencies\n */\nimport { migrateToQuoteV2 } from './deprecated';\n\nconst isWebPlatform = Platform.OS === 'web';\n\nconst TEMPLATE = [ [ 'core/paragraph', {} ] ];\n\n/**\n * At the moment, deprecations don't handle create blocks from attributes\n * (like when using CPT templates). For this reason, this hook is necessary\n * to avoid breaking templates using the old quote block format.\n *\n * @param {Object} attributes Block attributes.\n * @param {string} clientId Block client ID.\n */\nconst useMigrateOnLoad = ( attributes, clientId ) => {\n\tconst registry = useRegistry();\n\tconst { updateBlockAttributes, replaceInnerBlocks } =\n\t\tuseDispatch( blockEditorStore );\n\tuseEffect( () => {\n\t\t// As soon as the block is loaded, migrate it to the new version.\n\n\t\tif ( ! attributes.value ) {\n\t\t\t// No need to migrate if it doesn't have the value attribute.\n\t\t\treturn;\n\t\t}\n\n\t\tconst [ newAttributes, newInnerBlocks ] =\n\t\t\tmigrateToQuoteV2( attributes );\n\n\t\tdeprecated( 'Value attribute on the quote block', {\n\t\t\tsince: '6.0',\n\t\t\tversion: '6.5',\n\t\t\talternative: 'inner blocks',\n\t\t} );\n\n\t\tregistry.batch( () => {\n\t\t\tupdateBlockAttributes( clientId, newAttributes );\n\t\t\treplaceInnerBlocks( clientId, newInnerBlocks );\n\t\t} );\n\t}, [ attributes.value ] );\n};\n\nexport default function QuoteEdit( {\n\tattributes,\n\tsetAttributes,\n\tinsertBlocksAfter,\n\tclientId,\n\tclassName,\n\tstyle,\n} ) {\n\tconst { align, citation } = attributes;\n\n\tuseMigrateOnLoad( attributes, clientId );\n\n\tconst hasSelection = useSelect( ( select ) => {\n\t\tconst { isBlockSelected, hasSelectedInnerBlock } =\n\t\t\tselect( blockEditorStore );\n\t\treturn hasSelectedInnerBlock( clientId ) || isBlockSelected( clientId );\n\t}, [] );\n\n\tconst blockProps = useBlockProps( {\n\t\tclassName: classNames( className, {\n\t\t\t[ `has-text-align-${ align }` ]: align,\n\t\t} ),\n\t\t...( ! isWebPlatform && { style } ),\n\t} );\n\tconst innerBlocksProps = useInnerBlocksProps( blockProps, {\n\t\ttemplate: TEMPLATE,\n\t\ttemplateInsertUpdatesSelection: true,\n\t\t__experimentalCaptureToolbars: true,\n\t} );\n\n\treturn (\n\t\t<>\n\t\t\t<BlockControls group=\"block\">\n\t\t\t\t<AlignmentControl\n\t\t\t\t\tvalue={ align }\n\t\t\t\t\tonChange={ ( nextAlign ) => {\n\t\t\t\t\t\tsetAttributes( { align: nextAlign } );\n\t\t\t\t\t} }\n\t\t\t\t/>\n\t\t\t</BlockControls>\n\t\t\t<BlockQuotation { ...innerBlocksProps }>\n\t\t\t\t{ innerBlocksProps.children }\n\t\t\t\t{ ( ! RichText.isEmpty( citation ) || hasSelection ) && (\n\t\t\t\t\t<RichText\n\t\t\t\t\t\tidentifier=\"citation\"\n\t\t\t\t\t\ttagName={ isWebPlatform ? 'cite' : undefined }\n\t\t\t\t\t\tstyle={ { display: 'block' } }\n\t\t\t\t\t\tvalue={ citation }\n\t\t\t\t\t\tonChange={ ( nextCitation ) => {\n\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\tcitation: nextCitation,\n\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t} }\n\t\t\t\t\t\t__unstableMobileNoFocusOnMount\n\t\t\t\t\t\taria-label={ __( 'Quote citation' ) }\n\t\t\t\t\t\tplaceholder={\n\t\t\t\t\t\t\t// translators: placeholder text used for the\n\t\t\t\t\t\t\t// citation\n\t\t\t\t\t\t\t__( 'Add citation' )\n\t\t\t\t\t\t}\n\t\t\t\t\t\tclassName=\"wp-block-quote__citation\"\n\t\t\t\t\t\t__unstableOnSplitAtEnd={ () =>\n\t\t\t\t\t\t\tinsertBlocksAfter(\n\t\t\t\t\t\t\t\tcreateBlock( getDefaultBlockName() )\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t}\n\t\t\t\t\t\t{ ...( ! isWebPlatform ? { textAlign: align } : {} ) }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t</BlockQuotation>\n\t\t</>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,OAAOA,UAAU,MAAM,YAAY;;AAEnC;AACA;AACA;AACA,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SACCC,gBAAgB,EAChBC,aAAa,EACbC,QAAQ,EACRC,aAAa,EACbC,mBAAmB,EACnBC,KAAK,IAAIC,gBAA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C/C,QAAQ;IACRsD,UAAU,EAAC,UAAU;IACrBC,OAAO,EAAGxC,aAAa,GAAG,MAAM,GAAGyC,SAAW;IAC9CrB,KAAK,EAAG;MAAEsB,OAAO,EAAE;IAAQ,CAAG;IAC9BjC,KAAK,EAAGa,QAAU;IAClBa,QAAQ,EAAKQ,YAAY,IAAM;MAC9B1B,aAAa,CAAE;QACdK,QAAQ,EAAEqB;MACX,CAAE,CAAC;IACJ,CAAG;IACHC,8BAA8B;IAC9B,cAAa9D,EAAE,CAAE,gBAAiB,CAAG;IACrC+D,WAAW;IACV;IACA;IACA/D,EAAE,CAAE,cAAe,CACnB;IACDqC,SAAS,EAAC,0BAA0B;IACpC2B,sBAAsB,EAAGA,CAAA,KACxB5B,iBAAiB,CAChBxB,WAAW,CAAEC,mBAAmB,CAAC,CAAE,CACpC,CACA;IAAA,IACM,CAAEK,aAAa,GAAG;MAAE+C,SAAS,EAAE1B;IAAM,CAAC,GAAG,CAAC,CAAC;EAAA,CAClD,CAEa,CACf,CAAC;AAEL"}
|
|
@@ -20,7 +20,7 @@ import { __unstableStripHTML as stripHTML } from '@wordpress/dom';
|
|
|
20
20
|
* Internal dependencies
|
|
21
21
|
*/
|
|
22
22
|
import { buttonOnly, buttonOutside, buttonInside, noButton, buttonWithIcon, toggleLabel } from './icons';
|
|
23
|
-
import { PC_WIDTH_DEFAULT, PX_WIDTH_DEFAULT, MIN_WIDTH,
|
|
23
|
+
import { PC_WIDTH_DEFAULT, PX_WIDTH_DEFAULT, MIN_WIDTH, isPercentageUnit } from './utils.js';
|
|
24
24
|
|
|
25
25
|
// Used to calculate border radius adjustment to avoid "fat" corners when
|
|
26
26
|
// button is placed inside wrapper.
|
|
@@ -283,7 +283,9 @@ export default function SearchEdit({
|
|
|
283
283
|
id: unitControlInputId
|
|
284
284
|
}, createElement(UnitControl, {
|
|
285
285
|
id: unitControlInputId,
|
|
286
|
-
min:
|
|
286
|
+
min: isPercentageUnit(widthUnit) ? 0 : MIN_WIDTH,
|
|
287
|
+
max: isPercentageUnit(widthUnit) ? 100 : undefined,
|
|
288
|
+
step: 1,
|
|
287
289
|
onChange: newWidth => {
|
|
288
290
|
const filteredWidth = widthUnit === '%' && parseInt(newWidth, 10) > 100 ? 100 : newWidth;
|
|
289
291
|
setAttributes({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["classnames","useBlockProps","BlockControls","InspectorControls","RichText","__experimentalUseBorderProps","useBorderProps","__experimentalUseColorProps","useColorProps","getTypographyClassesAndStyles","useTypographyProps","store","blockEditorStore","__experimentalGetElementClassName","useSetting","useDispatch","useSelect","useEffect","useRef","ToolbarDropdownMenu","ToolbarGroup","Button","ButtonGroup","ToolbarButton","ResizableBox","PanelBody","BaseControl","__experimentalUseCustomUnits","useCustomUnits","__experimentalUnitControl","UnitControl","useInstanceId","Icon","search","__","__unstableStripHTML","stripHTML","buttonOnly","buttonOutside","buttonInside","noButton","buttonWithIcon","toggleLabel","PC_WIDTH_DEFAULT","PX_WIDTH_DEFAULT","MIN_WIDTH","MIN_WIDTH_UNIT","DEFAULT_INNER_PADDING","BUTTON_BEHAVIOR_EXPAND","SearchEdit","className","attributes","setAttributes","toggleSelection","isSelected","clientId","label","showLabel","placeholder","width","widthUnit","align","buttonText","buttonPosition","buttonUseIcon","buttonBehavior","isSearchFieldHidden","style","insertedInNavigationBlock","select","getBlockParentsByBlockName","wasBlockJustInserted","length","__unstableMarkNextChangeAsNotPersistent","borderRadius","border","radius","borderProps","colorProps","fluidTypographySettings","layout","typographyProps","typography","fluid","wideSize","unitControlInstanceId","unitControlInputId","isButtonPositionInside","isButtonPositionOutside","hasNoButton","hasOnlyButton","searchFieldRef","buttonRef","units","availableUnits","defaultValues","px","getBlockClassNames","undefined","buttonPositionControls","role","title","isActive","icon","onClick","getButtonPositionIcon","getResizableSides","right","left","renderTextField","textFieldClasses","textFieldStyles","textDecoration","createElement","type","value","onChange","event","target","ref","renderButton","buttonClasses","buttonStyles","handleButtonClick","Fragment","withoutInteractiveFormatting","html","controls","id","min","newWidth","filteredWidth","parseInt","onUnitChange","newUnit","__unstableInputWidth","map","widthValue","key","isSmall","variant","padBorderRadius","getWrapperStyles","styles","borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius","isNonZeroBorderRadius","topLeft","topRight","bottomLeft","bottomRight","Number","isInteger","blockProps","labelClassnames","size","minWidth","enable","onResizeStart","direction","elt","offsetWidth","onResizeStop","delta","showHandle"],"sources":["@wordpress/block-library/src/search/edit.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tuseBlockProps,\n\tBlockControls,\n\tInspectorControls,\n\tRichText,\n\t__experimentalUseBorderProps as useBorderProps,\n\t__experimentalUseColorProps as useColorProps,\n\tgetTypographyClassesAndStyles as useTypographyProps,\n\tstore as blockEditorStore,\n\t__experimentalGetElementClassName,\n\tuseSetting,\n} from '@wordpress/block-editor';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { useEffect, useRef } from '@wordpress/element';\nimport {\n\tToolbarDropdownMenu,\n\tToolbarGroup,\n\tButton,\n\tButtonGroup,\n\tToolbarButton,\n\tResizableBox,\n\tPanelBody,\n\tBaseControl,\n\t__experimentalUseCustomUnits as useCustomUnits,\n\t__experimentalUnitControl as UnitControl,\n} from '@wordpress/components';\nimport { useInstanceId } from '@wordpress/compose';\nimport { Icon, search } from '@wordpress/icons';\nimport { __ } from '@wordpress/i18n';\nimport { __unstableStripHTML as stripHTML } from '@wordpress/dom';\n\n/**\n * Internal dependencies\n */\nimport {\n\tbuttonOnly,\n\tbuttonOutside,\n\tbuttonInside,\n\tnoButton,\n\tbuttonWithIcon,\n\ttoggleLabel,\n} from './icons';\nimport {\n\tPC_WIDTH_DEFAULT,\n\tPX_WIDTH_DEFAULT,\n\tMIN_WIDTH,\n\tMIN_WIDTH_UNIT,\n} from './utils.js';\n\n// Used to calculate border radius adjustment to avoid \"fat\" corners when\n// button is placed inside wrapper.\nconst DEFAULT_INNER_PADDING = '4px';\n\nconst BUTTON_BEHAVIOR_EXPAND = 'expand-searchfield';\n\nexport default function SearchEdit( {\n\tclassName,\n\tattributes,\n\tsetAttributes,\n\ttoggleSelection,\n\tisSelected,\n\tclientId,\n} ) {\n\tconst {\n\t\tlabel,\n\t\tshowLabel,\n\t\tplaceholder,\n\t\twidth,\n\t\twidthUnit,\n\t\talign,\n\t\tbuttonText,\n\t\tbuttonPosition,\n\t\tbuttonUseIcon,\n\t\tbuttonBehavior,\n\t\tisSearchFieldHidden,\n\t\tstyle,\n\t} = attributes;\n\n\tconst insertedInNavigationBlock = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getBlockParentsByBlockName, wasBlockJustInserted } =\n\t\t\t\tselect( blockEditorStore );\n\t\t\treturn (\n\t\t\t\t!! getBlockParentsByBlockName( clientId, 'core/navigation' )\n\t\t\t\t\t?.length && wasBlockJustInserted( clientId )\n\t\t\t);\n\t\t},\n\t\t[ clientId ]\n\t);\n\tconst { __unstableMarkNextChangeAsNotPersistent } =\n\t\tuseDispatch( blockEditorStore );\n\n\tif ( insertedInNavigationBlock ) {\n\t\t// This side-effect should not create an undo level.\n\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\tsetAttributes( {\n\t\t\tshowLabel: false,\n\t\t\tbuttonUseIcon: true,\n\t\t\tbuttonPosition: 'button-inside',\n\t\t} );\n\t}\n\n\tconst borderRadius = style?.border?.radius;\n\tconst borderProps = useBorderProps( attributes );\n\n\t// Check for old deprecated numerical border radius. Done as a separate\n\t// check so that a borderRadius style won't overwrite the longhand\n\t// per-corner styles.\n\tif ( typeof borderRadius === 'number' ) {\n\t\tborderProps.style.borderRadius = `${ borderRadius }px`;\n\t}\n\n\tconst colorProps = useColorProps( attributes );\n\tconst fluidTypographySettings = useSetting( 'typography.fluid' );\n\tconst layout = useSetting( 'layout' );\n\tconst typographyProps = useTypographyProps( attributes, {\n\t\ttypography: {\n\t\t\tfluid: fluidTypographySettings,\n\t\t},\n\t\tlayout: {\n\t\t\twideSize: layout?.wideSize,\n\t\t},\n\t} );\n\tconst unitControlInstanceId = useInstanceId( UnitControl );\n\tconst unitControlInputId = `wp-block-search__width-${ unitControlInstanceId }`;\n\tconst isButtonPositionInside = 'button-inside' === buttonPosition;\n\tconst isButtonPositionOutside = 'button-outside' === buttonPosition;\n\tconst hasNoButton = 'no-button' === buttonPosition;\n\tconst hasOnlyButton = 'button-only' === buttonPosition;\n\tconst searchFieldRef = useRef();\n\tconst buttonRef = useRef();\n\n\tconst units = useCustomUnits( {\n\t\tavailableUnits: [ '%', 'px' ],\n\t\tdefaultValues: { '%': PC_WIDTH_DEFAULT, px: PX_WIDTH_DEFAULT },\n\t} );\n\n\tuseEffect( () => {\n\t\tif ( hasOnlyButton && ! isSelected ) {\n\t\t\tsetAttributes( {\n\t\t\t\tisSearchFieldHidden: true,\n\t\t\t} );\n\t\t}\n\t}, [ hasOnlyButton, isSelected, setAttributes ] );\n\n\t// Show the search field when width changes.\n\tuseEffect( () => {\n\t\tif ( ! hasOnlyButton || ! isSelected ) {\n\t\t\treturn;\n\t\t}\n\n\t\tsetAttributes( {\n\t\t\tisSearchFieldHidden: false,\n\t\t} );\n\t}, [ hasOnlyButton, isSelected, setAttributes, width ] );\n\n\tconst getBlockClassNames = () => {\n\t\treturn classnames(\n\t\t\tclassName,\n\t\t\tisButtonPositionInside\n\t\t\t\t? 'wp-block-search__button-inside'\n\t\t\t\t: undefined,\n\t\t\tisButtonPositionOutside\n\t\t\t\t? 'wp-block-search__button-outside'\n\t\t\t\t: undefined,\n\t\t\thasNoButton ? 'wp-block-search__no-button' : undefined,\n\t\t\thasOnlyButton ? 'wp-block-search__button-only' : undefined,\n\t\t\t! buttonUseIcon && ! hasNoButton\n\t\t\t\t? 'wp-block-search__text-button'\n\t\t\t\t: undefined,\n\t\t\tbuttonUseIcon && ! hasNoButton\n\t\t\t\t? 'wp-block-search__icon-button'\n\t\t\t\t: undefined,\n\t\t\thasOnlyButton && BUTTON_BEHAVIOR_EXPAND === buttonBehavior\n\t\t\t\t? 'wp-block-search__button-behavior-expand'\n\t\t\t\t: undefined,\n\t\t\thasOnlyButton && isSearchFieldHidden\n\t\t\t\t? 'wp-block-search__searchfield-hidden'\n\t\t\t\t: undefined\n\t\t);\n\t};\n\n\tconst buttonPositionControls = [\n\t\t{\n\t\t\trole: 'menuitemradio',\n\t\t\ttitle: __( 'Button outside' ),\n\t\t\tisActive: buttonPosition === 'button-outside',\n\t\t\ticon: buttonOutside,\n\t\t\tonClick: () => {\n\t\t\t\tsetAttributes( {\n\t\t\t\t\tbuttonPosition: 'button-outside',\n\t\t\t\t\tisSearchFieldHidden: false,\n\t\t\t\t} );\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\trole: 'menuitemradio',\n\t\t\ttitle: __( 'Button inside' ),\n\t\t\tisActive: buttonPosition === 'button-inside',\n\t\t\ticon: buttonInside,\n\t\t\tonClick: () => {\n\t\t\t\tsetAttributes( {\n\t\t\t\t\tbuttonPosition: 'button-inside',\n\t\t\t\t\tisSearchFieldHidden: false,\n\t\t\t\t} );\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\trole: 'menuitemradio',\n\t\t\ttitle: __( 'No button' ),\n\t\t\tisActive: buttonPosition === 'no-button',\n\t\t\ticon: noButton,\n\t\t\tonClick: () => {\n\t\t\t\tsetAttributes( {\n\t\t\t\t\tbuttonPosition: 'no-button',\n\t\t\t\t\tisSearchFieldHidden: false,\n\t\t\t\t} );\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\trole: 'menuitemradio',\n\t\t\ttitle: __( 'Button only' ),\n\t\t\tisActive: buttonPosition === 'button-only',\n\t\t\ticon: buttonOnly,\n\t\t\tonClick: () => {\n\t\t\t\tsetAttributes( {\n\t\t\t\t\tbuttonPosition: 'button-only',\n\t\t\t\t\tisSearchFieldHidden: true,\n\t\t\t\t} );\n\t\t\t},\n\t\t},\n\t];\n\n\tconst getButtonPositionIcon = () => {\n\t\tswitch ( buttonPosition ) {\n\t\t\tcase 'button-inside':\n\t\t\t\treturn buttonInside;\n\t\t\tcase 'button-outside':\n\t\t\t\treturn buttonOutside;\n\t\t\tcase 'no-button':\n\t\t\t\treturn noButton;\n\t\t\tcase 'button-only':\n\t\t\t\treturn buttonOnly;\n\t\t}\n\t};\n\n\tconst getResizableSides = () => {\n\t\tif ( hasOnlyButton ) {\n\t\t\treturn {};\n\t\t}\n\n\t\treturn {\n\t\t\tright: align !== 'right',\n\t\t\tleft: align === 'right',\n\t\t};\n\t};\n\n\tconst renderTextField = () => {\n\t\t// If the input is inside the wrapper, the wrapper gets the border color styles/classes, not the input control.\n\t\tconst textFieldClasses = classnames(\n\t\t\t'wp-block-search__input',\n\t\t\tisButtonPositionInside ? undefined : borderProps.className,\n\t\t\ttypographyProps.className\n\t\t);\n\t\tconst textFieldStyles = {\n\t\t\t...( isButtonPositionInside\n\t\t\t\t? { borderRadius }\n\t\t\t\t: borderProps.style ),\n\t\t\t...typographyProps.style,\n\t\t\ttextDecoration: undefined,\n\t\t};\n\n\t\treturn (\n\t\t\t<input\n\t\t\t\ttype=\"search\"\n\t\t\t\tclassName={ textFieldClasses }\n\t\t\t\tstyle={ textFieldStyles }\n\t\t\t\taria-label={ __( 'Optional placeholder text' ) }\n\t\t\t\t// We hide the placeholder field's placeholder when there is a value. This\n\t\t\t\t// stops screen readers from reading the placeholder field's placeholder\n\t\t\t\t// which is confusing.\n\t\t\t\tplaceholder={\n\t\t\t\t\tplaceholder ? undefined : __( 'Optional placeholder…' )\n\t\t\t\t}\n\t\t\t\tvalue={ placeholder }\n\t\t\t\tonChange={ ( event ) =>\n\t\t\t\t\tsetAttributes( { placeholder: event.target.value } )\n\t\t\t\t}\n\t\t\t\tref={ searchFieldRef }\n\t\t\t/>\n\t\t);\n\t};\n\n\tconst renderButton = () => {\n\t\t// If the button is inside the wrapper, the wrapper gets the border color styles/classes, not the button.\n\t\tconst buttonClasses = classnames(\n\t\t\t'wp-block-search__button',\n\t\t\tcolorProps.className,\n\t\t\ttypographyProps.className,\n\t\t\tisButtonPositionInside ? undefined : borderProps.className,\n\t\t\tbuttonUseIcon ? 'has-icon' : undefined,\n\t\t\t__experimentalGetElementClassName( 'button' )\n\t\t);\n\t\tconst buttonStyles = {\n\t\t\t...colorProps.style,\n\t\t\t...typographyProps.style,\n\t\t\t...( isButtonPositionInside\n\t\t\t\t? { borderRadius }\n\t\t\t\t: borderProps.style ),\n\t\t};\n\t\tconst handleButtonClick = () => {\n\t\t\tif ( hasOnlyButton && BUTTON_BEHAVIOR_EXPAND === buttonBehavior ) {\n\t\t\t\tsetAttributes( {\n\t\t\t\t\tisSearchFieldHidden: ! isSearchFieldHidden,\n\t\t\t\t} );\n\t\t\t}\n\t\t};\n\n\t\treturn (\n\t\t\t<>\n\t\t\t\t{ buttonUseIcon && (\n\t\t\t\t\t<button\n\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\tclassName={ buttonClasses }\n\t\t\t\t\t\tstyle={ buttonStyles }\n\t\t\t\t\t\taria-label={\n\t\t\t\t\t\t\tbuttonText\n\t\t\t\t\t\t\t\t? stripHTML( buttonText )\n\t\t\t\t\t\t\t\t: __( 'Search' )\n\t\t\t\t\t\t}\n\t\t\t\t\t\tonClick={ handleButtonClick }\n\t\t\t\t\t\tref={ buttonRef }\n\t\t\t\t\t>\n\t\t\t\t\t\t<Icon icon={ search } />\n\t\t\t\t\t</button>\n\t\t\t\t) }\n\n\t\t\t\t{ ! buttonUseIcon && (\n\t\t\t\t\t<RichText\n\t\t\t\t\t\tclassName={ buttonClasses }\n\t\t\t\t\t\tstyle={ buttonStyles }\n\t\t\t\t\t\taria-label={ __( 'Button text' ) }\n\t\t\t\t\t\tplaceholder={ __( 'Add button text…' ) }\n\t\t\t\t\t\twithoutInteractiveFormatting\n\t\t\t\t\t\tvalue={ buttonText }\n\t\t\t\t\t\tonChange={ ( html ) =>\n\t\t\t\t\t\t\tsetAttributes( { buttonText: html } )\n\t\t\t\t\t\t}\n\t\t\t\t\t\tonClick={ handleButtonClick }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t</>\n\t\t);\n\t};\n\n\tconst controls = (\n\t\t<>\n\t\t\t<BlockControls>\n\t\t\t\t<ToolbarGroup>\n\t\t\t\t\t<ToolbarButton\n\t\t\t\t\t\ttitle={ __( 'Toggle search label' ) }\n\t\t\t\t\t\ticon={ toggleLabel }\n\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\tshowLabel: ! showLabel,\n\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tclassName={ showLabel ? 'is-pressed' : undefined }\n\t\t\t\t\t/>\n\t\t\t\t\t<ToolbarDropdownMenu\n\t\t\t\t\t\ticon={ getButtonPositionIcon() }\n\t\t\t\t\t\tlabel={ __( 'Change button position' ) }\n\t\t\t\t\t\tcontrols={ buttonPositionControls }\n\t\t\t\t\t/>\n\t\t\t\t\t{ ! hasNoButton && (\n\t\t\t\t\t\t<ToolbarButton\n\t\t\t\t\t\t\ttitle={ __( 'Use button with icon' ) }\n\t\t\t\t\t\t\ticon={ buttonWithIcon }\n\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\tbuttonUseIcon: ! buttonUseIcon,\n\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tclassName={\n\t\t\t\t\t\t\t\tbuttonUseIcon ? 'is-pressed' : undefined\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</ToolbarGroup>\n\t\t\t</BlockControls>\n\n\t\t\t<InspectorControls>\n\t\t\t\t<PanelBody title={ __( 'Display Settings' ) }>\n\t\t\t\t\t<BaseControl\n\t\t\t\t\t\tlabel={ __( 'Width' ) }\n\t\t\t\t\t\tid={ unitControlInputId }\n\t\t\t\t\t>\n\t\t\t\t\t\t<UnitControl\n\t\t\t\t\t\t\tid={ unitControlInputId }\n\t\t\t\t\t\t\tmin={ `${ MIN_WIDTH }${ MIN_WIDTH_UNIT }` }\n\t\t\t\t\t\t\tonChange={ ( newWidth ) => {\n\t\t\t\t\t\t\t\tconst filteredWidth =\n\t\t\t\t\t\t\t\t\twidthUnit === '%' &&\n\t\t\t\t\t\t\t\t\tparseInt( newWidth, 10 ) > 100\n\t\t\t\t\t\t\t\t\t\t? 100\n\t\t\t\t\t\t\t\t\t\t: newWidth;\n\n\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\twidth: parseInt( filteredWidth, 10 ),\n\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tonUnitChange={ ( newUnit ) => {\n\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\twidth:\n\t\t\t\t\t\t\t\t\t\t'%' === newUnit\n\t\t\t\t\t\t\t\t\t\t\t? PC_WIDTH_DEFAULT\n\t\t\t\t\t\t\t\t\t\t\t: PX_WIDTH_DEFAULT,\n\t\t\t\t\t\t\t\t\twidthUnit: newUnit,\n\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t__unstableInputWidth={ '80px' }\n\t\t\t\t\t\t\tvalue={ `${ width }${ widthUnit }` }\n\t\t\t\t\t\t\tunits={ units }\n\t\t\t\t\t\t/>\n\n\t\t\t\t\t\t<ButtonGroup\n\t\t\t\t\t\t\tclassName=\"wp-block-search__components-button-group\"\n\t\t\t\t\t\t\taria-label={ __( 'Percentage Width' ) }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ [ 25, 50, 75, 100 ].map( ( widthValue ) => {\n\t\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\t\tkey={ widthValue }\n\t\t\t\t\t\t\t\t\t\tisSmall\n\t\t\t\t\t\t\t\t\t\tvariant={\n\t\t\t\t\t\t\t\t\t\t\twidthValue === width &&\n\t\t\t\t\t\t\t\t\t\t\twidthUnit === '%'\n\t\t\t\t\t\t\t\t\t\t\t\t? 'primary'\n\t\t\t\t\t\t\t\t\t\t\t\t: undefined\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tonClick={ () =>\n\t\t\t\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\t\t\t\twidth: widthValue,\n\t\t\t\t\t\t\t\t\t\t\t\twidthUnit: '%',\n\t\t\t\t\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t{ widthValue }%\n\t\t\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t} ) }\n\t\t\t\t\t\t</ButtonGroup>\n\t\t\t\t\t</BaseControl>\n\t\t\t\t</PanelBody>\n\t\t\t</InspectorControls>\n\t\t</>\n\t);\n\n\tconst padBorderRadius = ( radius ) =>\n\t\tradius ? `calc(${ radius } + ${ DEFAULT_INNER_PADDING })` : undefined;\n\n\tconst getWrapperStyles = () => {\n\t\tconst styles = isButtonPositionInside\n\t\t\t? borderProps.style\n\t\t\t: {\n\t\t\t\t\tborderRadius: borderProps.style?.borderRadius,\n\t\t\t\t\tborderTopLeftRadius: borderProps.style?.borderTopLeftRadius,\n\t\t\t\t\tborderTopRightRadius:\n\t\t\t\t\t\tborderProps.style?.borderTopRightRadius,\n\t\t\t\t\tborderBottomLeftRadius:\n\t\t\t\t\t\tborderProps.style?.borderBottomLeftRadius,\n\t\t\t\t\tborderBottomRightRadius:\n\t\t\t\t\t\tborderProps.style?.borderBottomRightRadius,\n\t\t\t };\n\n\t\tconst isNonZeroBorderRadius =\n\t\t\tborderRadius !== undefined && parseInt( borderRadius, 10 ) !== 0;\n\n\t\tif ( isButtonPositionInside && isNonZeroBorderRadius ) {\n\t\t\t// We have button inside wrapper and a border radius value to apply.\n\t\t\t// Add default padding so we don't get \"fat\" corners.\n\t\t\t//\n\t\t\t// CSS calc() is used here to support non-pixel units. The inline\n\t\t\t// style using calc() will only apply if both values have units.\n\n\t\t\tif ( typeof borderRadius === 'object' ) {\n\t\t\t\t// Individual corner border radii present.\n\t\t\t\tconst { topLeft, topRight, bottomLeft, bottomRight } =\n\t\t\t\t\tborderRadius;\n\n\t\t\t\treturn {\n\t\t\t\t\t...styles,\n\t\t\t\t\tborderTopLeftRadius: padBorderRadius( topLeft ),\n\t\t\t\t\tborderTopRightRadius: padBorderRadius( topRight ),\n\t\t\t\t\tborderBottomLeftRadius: padBorderRadius( bottomLeft ),\n\t\t\t\t\tborderBottomRightRadius: padBorderRadius( bottomRight ),\n\t\t\t\t};\n\t\t\t}\n\n\t\t\t// The inline style using calc() will only apply if both values\n\t\t\t// supplied to calc() have units. Deprecated block's may have\n\t\t\t// unitless integer.\n\t\t\tconst radius = Number.isInteger( borderRadius )\n\t\t\t\t? `${ borderRadius }px`\n\t\t\t\t: borderRadius;\n\n\t\t\tstyles.borderRadius = `calc(${ radius } + ${ DEFAULT_INNER_PADDING })`;\n\t\t}\n\n\t\treturn styles;\n\t};\n\n\tconst blockProps = useBlockProps( {\n\t\tclassName: getBlockClassNames(),\n\t\tstyle: {\n\t\t\t...typographyProps.style,\n\t\t\t// Input opts out of text decoration.\n\t\t\ttextDecoration: undefined,\n\t\t},\n\t} );\n\n\tconst labelClassnames = classnames(\n\t\t'wp-block-search__label',\n\t\ttypographyProps.className\n\t);\n\n\treturn (\n\t\t<div { ...blockProps }>\n\t\t\t{ controls }\n\n\t\t\t{ showLabel && (\n\t\t\t\t<RichText\n\t\t\t\t\tclassName={ labelClassnames }\n\t\t\t\t\taria-label={ __( 'Label text' ) }\n\t\t\t\t\tplaceholder={ __( 'Add label…' ) }\n\t\t\t\t\twithoutInteractiveFormatting\n\t\t\t\t\tvalue={ label }\n\t\t\t\t\tonChange={ ( html ) => setAttributes( { label: html } ) }\n\t\t\t\t\tstyle={ typographyProps.style }\n\t\t\t\t/>\n\t\t\t) }\n\n\t\t\t<ResizableBox\n\t\t\t\tsize={ {\n\t\t\t\t\twidth: `${ width }${ widthUnit }`,\n\t\t\t\t} }\n\t\t\t\tclassName={ classnames(\n\t\t\t\t\t'wp-block-search__inside-wrapper',\n\t\t\t\t\tisButtonPositionInside ? borderProps.className : undefined\n\t\t\t\t) }\n\t\t\t\tstyle={ getWrapperStyles() }\n\t\t\t\tminWidth={ MIN_WIDTH }\n\t\t\t\tenable={ getResizableSides() }\n\t\t\t\tonResizeStart={ ( event, direction, elt ) => {\n\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\twidth: parseInt( elt.offsetWidth, 10 ),\n\t\t\t\t\t\twidthUnit: 'px',\n\t\t\t\t\t} );\n\t\t\t\t\ttoggleSelection( false );\n\t\t\t\t} }\n\t\t\t\tonResizeStop={ ( event, direction, elt, delta ) => {\n\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\twidth: parseInt( width + delta.width, 10 ),\n\t\t\t\t\t} );\n\t\t\t\t\ttoggleSelection( true );\n\t\t\t\t} }\n\t\t\t\tshowHandle={ isSelected }\n\t\t\t>\n\t\t\t\t{ ( isButtonPositionInside ||\n\t\t\t\t\tisButtonPositionOutside ||\n\t\t\t\t\thasOnlyButton ) && (\n\t\t\t\t\t<>\n\t\t\t\t\t\t{ renderTextField() }\n\t\t\t\t\t\t{ renderButton() }\n\t\t\t\t\t</>\n\t\t\t\t) }\n\n\t\t\t\t{ hasNoButton && renderTextField() }\n\t\t\t</ResizableBox>\n\t\t</div>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,OAAOA,UAAU,MAAM,YAAY;;AAEnC;AACA;AACA;AACA,SACCC,aAAa,EACbC,aAAa,EACbC,iBAAiB,EACjBC,QAAQ,EACRC,4BAA4B,IAAIC,cAAc,EAC9CC,2BAA2B,IAAIC,aAAa,EAC5CC,6BA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AE,EAAG,CAAC;QACtCvG,SAAS,EAAE;MACZ,CAAE,CAAC;MACHP,eAAe,CAAE,KAAM,CAAC;IACzB,CAAG;IACH+G,YAAY,EAAGA,CAAE/C,KAAK,EAAE4C,SAAS,EAAEC,GAAG,EAAEG,KAAK,KAAM;MAClDjH,aAAa,CAAE;QACdO,KAAK,EAAEyE,QAAQ,CAAEzE,KAAK,GAAG0G,KAAK,CAAC1G,KAAK,EAAE,EAAG;MAC1C,CAAE,CAAC;MACHN,eAAe,CAAE,IAAK,CAAC;IACxB,CAAG;IACHiH,UAAU,EAAGhH;EAAY,GAEvB,CAAEiC,sBAAsB,IACzBC,uBAAuB,IACvBE,aAAa,KACbuB,aAAA,CAAAW,QAAA,QACGf,eAAe,CAAC,CAAC,EACjBW,YAAY,CAAC,CACd,CACF,EAEC/B,WAAW,IAAIoB,eAAe,CAAC,CACpB,CACV,CAAC;AAER"}
|
|
1
|
+
{"version":3,"names":["classnames","useBlockProps","BlockControls","InspectorControls","RichText","__experimentalUseBorderProps","useBorderProps","__experimentalUseColorProps","useColorProps","getTypographyClassesAndStyles","useTypographyProps","store","blockEditorStore","__experimentalGetElementClassName","useSetting","useDispatch","useSelect","useEffect","useRef","ToolbarDropdownMenu","ToolbarGroup","Button","ButtonGroup","ToolbarButton","ResizableBox","PanelBody","BaseControl","__experimentalUseCustomUnits","useCustomUnits","__experimentalUnitControl","UnitControl","useInstanceId","Icon","search","__","__unstableStripHTML","stripHTML","buttonOnly","buttonOutside","buttonInside","noButton","buttonWithIcon","toggleLabel","PC_WIDTH_DEFAULT","PX_WIDTH_DEFAULT","MIN_WIDTH","isPercentageUnit","DEFAULT_INNER_PADDING","BUTTON_BEHAVIOR_EXPAND","SearchEdit","className","attributes","setAttributes","toggleSelection","isSelected","clientId","label","showLabel","placeholder","width","widthUnit","align","buttonText","buttonPosition","buttonUseIcon","buttonBehavior","isSearchFieldHidden","style","insertedInNavigationBlock","select","getBlockParentsByBlockName","wasBlockJustInserted","length","__unstableMarkNextChangeAsNotPersistent","borderRadius","border","radius","borderProps","colorProps","fluidTypographySettings","layout","typographyProps","typography","fluid","wideSize","unitControlInstanceId","unitControlInputId","isButtonPositionInside","isButtonPositionOutside","hasNoButton","hasOnlyButton","searchFieldRef","buttonRef","units","availableUnits","defaultValues","px","getBlockClassNames","undefined","buttonPositionControls","role","title","isActive","icon","onClick","getButtonPositionIcon","getResizableSides","right","left","renderTextField","textFieldClasses","textFieldStyles","textDecoration","createElement","type","value","onChange","event","target","ref","renderButton","buttonClasses","buttonStyles","handleButtonClick","Fragment","withoutInteractiveFormatting","html","controls","id","min","max","step","newWidth","filteredWidth","parseInt","onUnitChange","newUnit","__unstableInputWidth","map","widthValue","key","isSmall","variant","padBorderRadius","getWrapperStyles","styles","borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius","isNonZeroBorderRadius","topLeft","topRight","bottomLeft","bottomRight","Number","isInteger","blockProps","labelClassnames","size","minWidth","enable","onResizeStart","direction","elt","offsetWidth","onResizeStop","delta","showHandle"],"sources":["@wordpress/block-library/src/search/edit.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tuseBlockProps,\n\tBlockControls,\n\tInspectorControls,\n\tRichText,\n\t__experimentalUseBorderProps as useBorderProps,\n\t__experimentalUseColorProps as useColorProps,\n\tgetTypographyClassesAndStyles as useTypographyProps,\n\tstore as blockEditorStore,\n\t__experimentalGetElementClassName,\n\tuseSetting,\n} from '@wordpress/block-editor';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { useEffect, useRef } from '@wordpress/element';\nimport {\n\tToolbarDropdownMenu,\n\tToolbarGroup,\n\tButton,\n\tButtonGroup,\n\tToolbarButton,\n\tResizableBox,\n\tPanelBody,\n\tBaseControl,\n\t__experimentalUseCustomUnits as useCustomUnits,\n\t__experimentalUnitControl as UnitControl,\n} from '@wordpress/components';\nimport { useInstanceId } from '@wordpress/compose';\nimport { Icon, search } from '@wordpress/icons';\nimport { __ } from '@wordpress/i18n';\nimport { __unstableStripHTML as stripHTML } from '@wordpress/dom';\n\n/**\n * Internal dependencies\n */\nimport {\n\tbuttonOnly,\n\tbuttonOutside,\n\tbuttonInside,\n\tnoButton,\n\tbuttonWithIcon,\n\ttoggleLabel,\n} from './icons';\nimport {\n\tPC_WIDTH_DEFAULT,\n\tPX_WIDTH_DEFAULT,\n\tMIN_WIDTH,\n\tisPercentageUnit,\n} from './utils.js';\n\n// Used to calculate border radius adjustment to avoid \"fat\" corners when\n// button is placed inside wrapper.\nconst DEFAULT_INNER_PADDING = '4px';\n\nconst BUTTON_BEHAVIOR_EXPAND = 'expand-searchfield';\n\nexport default function SearchEdit( {\n\tclassName,\n\tattributes,\n\tsetAttributes,\n\ttoggleSelection,\n\tisSelected,\n\tclientId,\n} ) {\n\tconst {\n\t\tlabel,\n\t\tshowLabel,\n\t\tplaceholder,\n\t\twidth,\n\t\twidthUnit,\n\t\talign,\n\t\tbuttonText,\n\t\tbuttonPosition,\n\t\tbuttonUseIcon,\n\t\tbuttonBehavior,\n\t\tisSearchFieldHidden,\n\t\tstyle,\n\t} = attributes;\n\n\tconst insertedInNavigationBlock = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getBlockParentsByBlockName, wasBlockJustInserted } =\n\t\t\t\tselect( blockEditorStore );\n\t\t\treturn (\n\t\t\t\t!! getBlockParentsByBlockName( clientId, 'core/navigation' )\n\t\t\t\t\t?.length && wasBlockJustInserted( clientId )\n\t\t\t);\n\t\t},\n\t\t[ clientId ]\n\t);\n\tconst { __unstableMarkNextChangeAsNotPersistent } =\n\t\tuseDispatch( blockEditorStore );\n\n\tif ( insertedInNavigationBlock ) {\n\t\t// This side-effect should not create an undo level.\n\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\tsetAttributes( {\n\t\t\tshowLabel: false,\n\t\t\tbuttonUseIcon: true,\n\t\t\tbuttonPosition: 'button-inside',\n\t\t} );\n\t}\n\n\tconst borderRadius = style?.border?.radius;\n\tconst borderProps = useBorderProps( attributes );\n\n\t// Check for old deprecated numerical border radius. Done as a separate\n\t// check so that a borderRadius style won't overwrite the longhand\n\t// per-corner styles.\n\tif ( typeof borderRadius === 'number' ) {\n\t\tborderProps.style.borderRadius = `${ borderRadius }px`;\n\t}\n\n\tconst colorProps = useColorProps( attributes );\n\tconst fluidTypographySettings = useSetting( 'typography.fluid' );\n\tconst layout = useSetting( 'layout' );\n\tconst typographyProps = useTypographyProps( attributes, {\n\t\ttypography: {\n\t\t\tfluid: fluidTypographySettings,\n\t\t},\n\t\tlayout: {\n\t\t\twideSize: layout?.wideSize,\n\t\t},\n\t} );\n\tconst unitControlInstanceId = useInstanceId( UnitControl );\n\tconst unitControlInputId = `wp-block-search__width-${ unitControlInstanceId }`;\n\tconst isButtonPositionInside = 'button-inside' === buttonPosition;\n\tconst isButtonPositionOutside = 'button-outside' === buttonPosition;\n\tconst hasNoButton = 'no-button' === buttonPosition;\n\tconst hasOnlyButton = 'button-only' === buttonPosition;\n\tconst searchFieldRef = useRef();\n\tconst buttonRef = useRef();\n\n\tconst units = useCustomUnits( {\n\t\tavailableUnits: [ '%', 'px' ],\n\t\tdefaultValues: { '%': PC_WIDTH_DEFAULT, px: PX_WIDTH_DEFAULT },\n\t} );\n\n\tuseEffect( () => {\n\t\tif ( hasOnlyButton && ! isSelected ) {\n\t\t\tsetAttributes( {\n\t\t\t\tisSearchFieldHidden: true,\n\t\t\t} );\n\t\t}\n\t}, [ hasOnlyButton, isSelected, setAttributes ] );\n\n\t// Show the search field when width changes.\n\tuseEffect( () => {\n\t\tif ( ! hasOnlyButton || ! isSelected ) {\n\t\t\treturn;\n\t\t}\n\n\t\tsetAttributes( {\n\t\t\tisSearchFieldHidden: false,\n\t\t} );\n\t}, [ hasOnlyButton, isSelected, setAttributes, width ] );\n\n\tconst getBlockClassNames = () => {\n\t\treturn classnames(\n\t\t\tclassName,\n\t\t\tisButtonPositionInside\n\t\t\t\t? 'wp-block-search__button-inside'\n\t\t\t\t: undefined,\n\t\t\tisButtonPositionOutside\n\t\t\t\t? 'wp-block-search__button-outside'\n\t\t\t\t: undefined,\n\t\t\thasNoButton ? 'wp-block-search__no-button' : undefined,\n\t\t\thasOnlyButton ? 'wp-block-search__button-only' : undefined,\n\t\t\t! buttonUseIcon && ! hasNoButton\n\t\t\t\t? 'wp-block-search__text-button'\n\t\t\t\t: undefined,\n\t\t\tbuttonUseIcon && ! hasNoButton\n\t\t\t\t? 'wp-block-search__icon-button'\n\t\t\t\t: undefined,\n\t\t\thasOnlyButton && BUTTON_BEHAVIOR_EXPAND === buttonBehavior\n\t\t\t\t? 'wp-block-search__button-behavior-expand'\n\t\t\t\t: undefined,\n\t\t\thasOnlyButton && isSearchFieldHidden\n\t\t\t\t? 'wp-block-search__searchfield-hidden'\n\t\t\t\t: undefined\n\t\t);\n\t};\n\n\tconst buttonPositionControls = [\n\t\t{\n\t\t\trole: 'menuitemradio',\n\t\t\ttitle: __( 'Button outside' ),\n\t\t\tisActive: buttonPosition === 'button-outside',\n\t\t\ticon: buttonOutside,\n\t\t\tonClick: () => {\n\t\t\t\tsetAttributes( {\n\t\t\t\t\tbuttonPosition: 'button-outside',\n\t\t\t\t\tisSearchFieldHidden: false,\n\t\t\t\t} );\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\trole: 'menuitemradio',\n\t\t\ttitle: __( 'Button inside' ),\n\t\t\tisActive: buttonPosition === 'button-inside',\n\t\t\ticon: buttonInside,\n\t\t\tonClick: () => {\n\t\t\t\tsetAttributes( {\n\t\t\t\t\tbuttonPosition: 'button-inside',\n\t\t\t\t\tisSearchFieldHidden: false,\n\t\t\t\t} );\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\trole: 'menuitemradio',\n\t\t\ttitle: __( 'No button' ),\n\t\t\tisActive: buttonPosition === 'no-button',\n\t\t\ticon: noButton,\n\t\t\tonClick: () => {\n\t\t\t\tsetAttributes( {\n\t\t\t\t\tbuttonPosition: 'no-button',\n\t\t\t\t\tisSearchFieldHidden: false,\n\t\t\t\t} );\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\trole: 'menuitemradio',\n\t\t\ttitle: __( 'Button only' ),\n\t\t\tisActive: buttonPosition === 'button-only',\n\t\t\ticon: buttonOnly,\n\t\t\tonClick: () => {\n\t\t\t\tsetAttributes( {\n\t\t\t\t\tbuttonPosition: 'button-only',\n\t\t\t\t\tisSearchFieldHidden: true,\n\t\t\t\t} );\n\t\t\t},\n\t\t},\n\t];\n\n\tconst getButtonPositionIcon = () => {\n\t\tswitch ( buttonPosition ) {\n\t\t\tcase 'button-inside':\n\t\t\t\treturn buttonInside;\n\t\t\tcase 'button-outside':\n\t\t\t\treturn buttonOutside;\n\t\t\tcase 'no-button':\n\t\t\t\treturn noButton;\n\t\t\tcase 'button-only':\n\t\t\t\treturn buttonOnly;\n\t\t}\n\t};\n\n\tconst getResizableSides = () => {\n\t\tif ( hasOnlyButton ) {\n\t\t\treturn {};\n\t\t}\n\n\t\treturn {\n\t\t\tright: align !== 'right',\n\t\t\tleft: align === 'right',\n\t\t};\n\t};\n\n\tconst renderTextField = () => {\n\t\t// If the input is inside the wrapper, the wrapper gets the border color styles/classes, not the input control.\n\t\tconst textFieldClasses = classnames(\n\t\t\t'wp-block-search__input',\n\t\t\tisButtonPositionInside ? undefined : borderProps.className,\n\t\t\ttypographyProps.className\n\t\t);\n\t\tconst textFieldStyles = {\n\t\t\t...( isButtonPositionInside\n\t\t\t\t? { borderRadius }\n\t\t\t\t: borderProps.style ),\n\t\t\t...typographyProps.style,\n\t\t\ttextDecoration: undefined,\n\t\t};\n\n\t\treturn (\n\t\t\t<input\n\t\t\t\ttype=\"search\"\n\t\t\t\tclassName={ textFieldClasses }\n\t\t\t\tstyle={ textFieldStyles }\n\t\t\t\taria-label={ __( 'Optional placeholder text' ) }\n\t\t\t\t// We hide the placeholder field's placeholder when there is a value. This\n\t\t\t\t// stops screen readers from reading the placeholder field's placeholder\n\t\t\t\t// which is confusing.\n\t\t\t\tplaceholder={\n\t\t\t\t\tplaceholder ? undefined : __( 'Optional placeholder…' )\n\t\t\t\t}\n\t\t\t\tvalue={ placeholder }\n\t\t\t\tonChange={ ( event ) =>\n\t\t\t\t\tsetAttributes( { placeholder: event.target.value } )\n\t\t\t\t}\n\t\t\t\tref={ searchFieldRef }\n\t\t\t/>\n\t\t);\n\t};\n\n\tconst renderButton = () => {\n\t\t// If the button is inside the wrapper, the wrapper gets the border color styles/classes, not the button.\n\t\tconst buttonClasses = classnames(\n\t\t\t'wp-block-search__button',\n\t\t\tcolorProps.className,\n\t\t\ttypographyProps.className,\n\t\t\tisButtonPositionInside ? undefined : borderProps.className,\n\t\t\tbuttonUseIcon ? 'has-icon' : undefined,\n\t\t\t__experimentalGetElementClassName( 'button' )\n\t\t);\n\t\tconst buttonStyles = {\n\t\t\t...colorProps.style,\n\t\t\t...typographyProps.style,\n\t\t\t...( isButtonPositionInside\n\t\t\t\t? { borderRadius }\n\t\t\t\t: borderProps.style ),\n\t\t};\n\t\tconst handleButtonClick = () => {\n\t\t\tif ( hasOnlyButton && BUTTON_BEHAVIOR_EXPAND === buttonBehavior ) {\n\t\t\t\tsetAttributes( {\n\t\t\t\t\tisSearchFieldHidden: ! isSearchFieldHidden,\n\t\t\t\t} );\n\t\t\t}\n\t\t};\n\n\t\treturn (\n\t\t\t<>\n\t\t\t\t{ buttonUseIcon && (\n\t\t\t\t\t<button\n\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\tclassName={ buttonClasses }\n\t\t\t\t\t\tstyle={ buttonStyles }\n\t\t\t\t\t\taria-label={\n\t\t\t\t\t\t\tbuttonText\n\t\t\t\t\t\t\t\t? stripHTML( buttonText )\n\t\t\t\t\t\t\t\t: __( 'Search' )\n\t\t\t\t\t\t}\n\t\t\t\t\t\tonClick={ handleButtonClick }\n\t\t\t\t\t\tref={ buttonRef }\n\t\t\t\t\t>\n\t\t\t\t\t\t<Icon icon={ search } />\n\t\t\t\t\t</button>\n\t\t\t\t) }\n\n\t\t\t\t{ ! buttonUseIcon && (\n\t\t\t\t\t<RichText\n\t\t\t\t\t\tclassName={ buttonClasses }\n\t\t\t\t\t\tstyle={ buttonStyles }\n\t\t\t\t\t\taria-label={ __( 'Button text' ) }\n\t\t\t\t\t\tplaceholder={ __( 'Add button text…' ) }\n\t\t\t\t\t\twithoutInteractiveFormatting\n\t\t\t\t\t\tvalue={ buttonText }\n\t\t\t\t\t\tonChange={ ( html ) =>\n\t\t\t\t\t\t\tsetAttributes( { buttonText: html } )\n\t\t\t\t\t\t}\n\t\t\t\t\t\tonClick={ handleButtonClick }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t</>\n\t\t);\n\t};\n\n\tconst controls = (\n\t\t<>\n\t\t\t<BlockControls>\n\t\t\t\t<ToolbarGroup>\n\t\t\t\t\t<ToolbarButton\n\t\t\t\t\t\ttitle={ __( 'Toggle search label' ) }\n\t\t\t\t\t\ticon={ toggleLabel }\n\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\tshowLabel: ! showLabel,\n\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tclassName={ showLabel ? 'is-pressed' : undefined }\n\t\t\t\t\t/>\n\t\t\t\t\t<ToolbarDropdownMenu\n\t\t\t\t\t\ticon={ getButtonPositionIcon() }\n\t\t\t\t\t\tlabel={ __( 'Change button position' ) }\n\t\t\t\t\t\tcontrols={ buttonPositionControls }\n\t\t\t\t\t/>\n\t\t\t\t\t{ ! hasNoButton && (\n\t\t\t\t\t\t<ToolbarButton\n\t\t\t\t\t\t\ttitle={ __( 'Use button with icon' ) }\n\t\t\t\t\t\t\ticon={ buttonWithIcon }\n\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\tbuttonUseIcon: ! buttonUseIcon,\n\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tclassName={\n\t\t\t\t\t\t\t\tbuttonUseIcon ? 'is-pressed' : undefined\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</ToolbarGroup>\n\t\t\t</BlockControls>\n\n\t\t\t<InspectorControls>\n\t\t\t\t<PanelBody title={ __( 'Display Settings' ) }>\n\t\t\t\t\t<BaseControl\n\t\t\t\t\t\tlabel={ __( 'Width' ) }\n\t\t\t\t\t\tid={ unitControlInputId }\n\t\t\t\t\t>\n\t\t\t\t\t\t<UnitControl\n\t\t\t\t\t\t\tid={ unitControlInputId }\n\t\t\t\t\t\t\tmin={\n\t\t\t\t\t\t\t\tisPercentageUnit( widthUnit ) ? 0 : MIN_WIDTH\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tmax={\n\t\t\t\t\t\t\t\tisPercentageUnit( widthUnit ) ? 100 : undefined\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tstep={ 1 }\n\t\t\t\t\t\t\tonChange={ ( newWidth ) => {\n\t\t\t\t\t\t\t\tconst filteredWidth =\n\t\t\t\t\t\t\t\t\twidthUnit === '%' &&\n\t\t\t\t\t\t\t\t\tparseInt( newWidth, 10 ) > 100\n\t\t\t\t\t\t\t\t\t\t? 100\n\t\t\t\t\t\t\t\t\t\t: newWidth;\n\n\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\twidth: parseInt( filteredWidth, 10 ),\n\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tonUnitChange={ ( newUnit ) => {\n\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\twidth:\n\t\t\t\t\t\t\t\t\t\t'%' === newUnit\n\t\t\t\t\t\t\t\t\t\t\t? PC_WIDTH_DEFAULT\n\t\t\t\t\t\t\t\t\t\t\t: PX_WIDTH_DEFAULT,\n\t\t\t\t\t\t\t\t\twidthUnit: newUnit,\n\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t__unstableInputWidth={ '80px' }\n\t\t\t\t\t\t\tvalue={ `${ width }${ widthUnit }` }\n\t\t\t\t\t\t\tunits={ units }\n\t\t\t\t\t\t/>\n\n\t\t\t\t\t\t<ButtonGroup\n\t\t\t\t\t\t\tclassName=\"wp-block-search__components-button-group\"\n\t\t\t\t\t\t\taria-label={ __( 'Percentage Width' ) }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ [ 25, 50, 75, 100 ].map( ( widthValue ) => {\n\t\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\t\tkey={ widthValue }\n\t\t\t\t\t\t\t\t\t\tisSmall\n\t\t\t\t\t\t\t\t\t\tvariant={\n\t\t\t\t\t\t\t\t\t\t\twidthValue === width &&\n\t\t\t\t\t\t\t\t\t\t\twidthUnit === '%'\n\t\t\t\t\t\t\t\t\t\t\t\t? 'primary'\n\t\t\t\t\t\t\t\t\t\t\t\t: undefined\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tonClick={ () =>\n\t\t\t\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\t\t\t\twidth: widthValue,\n\t\t\t\t\t\t\t\t\t\t\t\twidthUnit: '%',\n\t\t\t\t\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t{ widthValue }%\n\t\t\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t} ) }\n\t\t\t\t\t\t</ButtonGroup>\n\t\t\t\t\t</BaseControl>\n\t\t\t\t</PanelBody>\n\t\t\t</InspectorControls>\n\t\t</>\n\t);\n\n\tconst padBorderRadius = ( radius ) =>\n\t\tradius ? `calc(${ radius } + ${ DEFAULT_INNER_PADDING })` : undefined;\n\n\tconst getWrapperStyles = () => {\n\t\tconst styles = isButtonPositionInside\n\t\t\t? borderProps.style\n\t\t\t: {\n\t\t\t\t\tborderRadius: borderProps.style?.borderRadius,\n\t\t\t\t\tborderTopLeftRadius: borderProps.style?.borderTopLeftRadius,\n\t\t\t\t\tborderTopRightRadius:\n\t\t\t\t\t\tborderProps.style?.borderTopRightRadius,\n\t\t\t\t\tborderBottomLeftRadius:\n\t\t\t\t\t\tborderProps.style?.borderBottomLeftRadius,\n\t\t\t\t\tborderBottomRightRadius:\n\t\t\t\t\t\tborderProps.style?.borderBottomRightRadius,\n\t\t\t };\n\n\t\tconst isNonZeroBorderRadius =\n\t\t\tborderRadius !== undefined && parseInt( borderRadius, 10 ) !== 0;\n\n\t\tif ( isButtonPositionInside && isNonZeroBorderRadius ) {\n\t\t\t// We have button inside wrapper and a border radius value to apply.\n\t\t\t// Add default padding so we don't get \"fat\" corners.\n\t\t\t//\n\t\t\t// CSS calc() is used here to support non-pixel units. The inline\n\t\t\t// style using calc() will only apply if both values have units.\n\n\t\t\tif ( typeof borderRadius === 'object' ) {\n\t\t\t\t// Individual corner border radii present.\n\t\t\t\tconst { topLeft, topRight, bottomLeft, bottomRight } =\n\t\t\t\t\tborderRadius;\n\n\t\t\t\treturn {\n\t\t\t\t\t...styles,\n\t\t\t\t\tborderTopLeftRadius: padBorderRadius( topLeft ),\n\t\t\t\t\tborderTopRightRadius: padBorderRadius( topRight ),\n\t\t\t\t\tborderBottomLeftRadius: padBorderRadius( bottomLeft ),\n\t\t\t\t\tborderBottomRightRadius: padBorderRadius( bottomRight ),\n\t\t\t\t};\n\t\t\t}\n\n\t\t\t// The inline style using calc() will only apply if both values\n\t\t\t// supplied to calc() have units. Deprecated block's may have\n\t\t\t// unitless integer.\n\t\t\tconst radius = Number.isInteger( borderRadius )\n\t\t\t\t? `${ borderRadius }px`\n\t\t\t\t: borderRadius;\n\n\t\t\tstyles.borderRadius = `calc(${ radius } + ${ DEFAULT_INNER_PADDING })`;\n\t\t}\n\n\t\treturn styles;\n\t};\n\n\tconst blockProps = useBlockProps( {\n\t\tclassName: getBlockClassNames(),\n\t\tstyle: {\n\t\t\t...typographyProps.style,\n\t\t\t// Input opts out of text decoration.\n\t\t\ttextDecoration: undefined,\n\t\t},\n\t} );\n\n\tconst labelClassnames = classnames(\n\t\t'wp-block-search__label',\n\t\ttypographyProps.className\n\t);\n\n\treturn (\n\t\t<div { ...blockProps }>\n\t\t\t{ controls }\n\n\t\t\t{ showLabel && (\n\t\t\t\t<RichText\n\t\t\t\t\tclassName={ labelClassnames }\n\t\t\t\t\taria-label={ __( 'Label text' ) }\n\t\t\t\t\tplaceholder={ __( 'Add label…' ) }\n\t\t\t\t\twithoutInteractiveFormatting\n\t\t\t\t\tvalue={ label }\n\t\t\t\t\tonChange={ ( html ) => setAttributes( { label: html } ) }\n\t\t\t\t\tstyle={ typographyProps.style }\n\t\t\t\t/>\n\t\t\t) }\n\n\t\t\t<ResizableBox\n\t\t\t\tsize={ {\n\t\t\t\t\twidth: `${ width }${ widthUnit }`,\n\t\t\t\t} }\n\t\t\t\tclassName={ classnames(\n\t\t\t\t\t'wp-block-search__inside-wrapper',\n\t\t\t\t\tisButtonPositionInside ? borderProps.className : undefined\n\t\t\t\t) }\n\t\t\t\tstyle={ getWrapperStyles() }\n\t\t\t\tminWidth={ MIN_WIDTH }\n\t\t\t\tenable={ getResizableSides() }\n\t\t\t\tonResizeStart={ ( event, direction, elt ) => {\n\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\twidth: parseInt( elt.offsetWidth, 10 ),\n\t\t\t\t\t\twidthUnit: 'px',\n\t\t\t\t\t} );\n\t\t\t\t\ttoggleSelection( false );\n\t\t\t\t} }\n\t\t\t\tonResizeStop={ ( event, direction, elt, delta ) => {\n\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\twidth: parseInt( width + delta.width, 10 ),\n\t\t\t\t\t} );\n\t\t\t\t\ttoggleSelection( true );\n\t\t\t\t} }\n\t\t\t\tshowHandle={ isSelected }\n\t\t\t>\n\t\t\t\t{ ( isButtonPositionInside ||\n\t\t\t\t\tisButtonPositionOutside ||\n\t\t\t\t\thasOnlyButton ) && (\n\t\t\t\t\t<>\n\t\t\t\t\t\t{ renderTextField() }\n\t\t\t\t\t\t{ renderButton() }\n\t\t\t\t\t</>\n\t\t\t\t) }\n\n\t\t\t\t{ hasNoButton && renderTextField() }\n\t\t\t</ResizableBox>\n\t\t</div>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,OAAOA,UAAU,MAAM,YAAY;;AAEnC;AACA;AACA;AACA,SACCC,aAAa,EACbC,aAAa,EACbC,iBAAiB,EACjBC,QAAQ,EACRC,4BAA4B,IAAIC,cAAc,EAC9CC,2BAA2B,IAAIC,aAAa,EAC5CC,6BAA6B,IAAIC,kBAAkB,EACnDC,KAAK,IAAIC,gBAAgB,EACzBC,iCAAiC,EACjCC,UAAU,QACJ,yBAAyB;AAChC,SAASC,WAAW,EAAEC,SAAS,QAAQ,iBAAiB;AACxD,SAASC,SAAS,EAAEC,MAAM,QAAQ,oBAAoB;AACtD,SACCC,mBAAmB,EACnBC,YAAY,EACZC,MAAM,EACNC,WAAW,EACXC,aAAa,EACbC,YAAY,EACZC,SAAS,EACTC,WAAW,EACXC,4BAA4B,IAAIC,cAAc,EAC9CC,yBAAyB,IAAIC,WAAW,QAClC,uBAAuB;AAC9B,SAASC,aAAa,QAAQ,oBAAoB;AAClD,SAASC,IAAI,EAAEC,MAAM,QAAQ,kBAAkB;AAC/C,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SAASC,mBAAmB,IAAIC,SAAS,QAAQ,gBAAgB;;AAEjE;AACA;AACA;AACA,SACCC,UAAU,EACVC,aAAa,EACbC,YAAY,EACZC,QAAQ,EACRC,cAAc,EACdC,WAAW,QACL,SAAS;AAChB,SACCC,gBAAgB,EAChBC,gBAAgB,EAChBC,SAAS,EACTC,gBAAgB,QACV,YAAY;;AAEnB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names":["PC_WIDTH_DEFAULT","PX_WIDTH_DEFAULT","MIN_WIDTH","
|
|
1
|
+
{"version":3,"names":["PC_WIDTH_DEFAULT","PX_WIDTH_DEFAULT","MIN_WIDTH","isPercentageUnit","unit"],"sources":["@wordpress/block-library/src/search/utils.js"],"sourcesContent":["/**\n * Constants\n */\nexport const PC_WIDTH_DEFAULT = 50;\nexport const PX_WIDTH_DEFAULT = 350;\nexport const MIN_WIDTH = 220;\n\n/**\n * Returns a boolean whether passed unit is percentage\n *\n * @param {string} unit Block width unit.\n *\n * @return {boolean} \tWhether unit is '%'.\n */\nexport function isPercentageUnit( unit ) {\n\treturn unit === '%';\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAO,MAAMA,gBAAgB,GAAG,EAAE;AAClC,OAAO,MAAMC,gBAAgB,GAAG,GAAG;AACnC,OAAO,MAAMC,SAAS,GAAG,GAAG;;AAE5B;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,gBAAgBA,CAAEC,IAAI,EAAG;EACxC,OAAOA,IAAI,KAAK,GAAG;AACpB"}
|
|
@@ -122,9 +122,7 @@ const SocialLinkEdit = ({
|
|
|
122
122
|
__('%s has URL set'), socialLinkName) : sprintf(
|
|
123
123
|
// translators: %s: social link name e.g: "Instagram".
|
|
124
124
|
__('%s has no URL set'), socialLinkName);
|
|
125
|
-
return createElement(View, {
|
|
126
|
-
style: styles.container
|
|
127
|
-
}, isSelected && createElement(Fragment, null, createElement(BlockControls, null, createElement(ToolbarGroup, null, createElement(ToolbarButton, {
|
|
125
|
+
return createElement(View, null, isSelected && createElement(Fragment, null, createElement(BlockControls, null, createElement(ToolbarGroup, null, createElement(ToolbarButton, {
|
|
128
126
|
title: sprintf(
|
|
129
127
|
// translators: %s: social link name e.g: "Instagram".
|
|
130
128
|
__('Add link to %s'), socialLinkName),
|