@wordpress/block-library 9.35.1-next.dc3f6d3c1.0 → 9.36.1-next.6deb34194.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/accordion/view.js +46 -4
- package/build/accordion/view.js.map +2 -2
- package/build/accordion-heading/block.json +1 -1
- package/build/accordion-heading/deprecated.js +1 -1
- package/build/accordion-heading/deprecated.js.map +2 -2
- package/build/accordion-panel/block.json +1 -1
- package/build/audio/index.js +13 -10
- package/build/audio/index.js.map +3 -3
- package/build/avatar/edit.js +13 -38
- package/build/avatar/edit.js.map +2 -2
- package/build/breadcrumbs/block.json +3 -2
- package/build/breadcrumbs/edit.js +18 -18
- package/build/breadcrumbs/edit.js.map +2 -2
- package/build/button/index.js +14 -11
- package/build/button/index.js.map +3 -3
- package/build/code/index.js +10 -7
- package/build/code/index.js.map +3 -3
- package/build/comments-pagination-numbers/block.json +7 -0
- package/build/cover/edit/block-controls.js +37 -3
- package/build/cover/edit/block-controls.js.map +3 -3
- package/build/cover/edit/cover-placeholder.js +0 -1
- package/build/cover/edit/cover-placeholder.js.map +2 -2
- package/build/cover/edit/embed-video-url-input.js +83 -0
- package/build/cover/edit/embed-video-url-input.js.map +7 -0
- package/build/cover/edit/index.js +60 -0
- package/build/cover/edit/index.js.map +2 -2
- package/build/cover/embed-video-utils.js +151 -0
- package/build/cover/embed-video-utils.js.map +7 -0
- package/build/cover/index.js +11 -5
- package/build/cover/index.js.map +3 -3
- package/build/cover/save.js +12 -0
- package/build/cover/save.js.map +2 -2
- package/build/cover/shared.js +3 -0
- package/build/cover/shared.js.map +2 -2
- package/build/details/index.js +10 -7
- package/build/details/index.js.map +3 -3
- package/build/file/index.js +15 -15
- package/build/file/index.js.map +3 -3
- package/build/freeform/block.json +1 -1
- package/build/gallery/edit.js +1 -3
- package/build/gallery/edit.js.map +2 -2
- package/build/gallery/transforms.js +7 -3
- package/build/gallery/transforms.js.map +2 -2
- package/build/heading/index.js +10 -7
- package/build/heading/index.js.map +3 -3
- package/build/html/modal.js +141 -121
- package/build/html/modal.js.map +3 -3
- package/build/image/edit.js +0 -1
- package/build/image/edit.js.map +2 -2
- package/build/image/image.js +0 -1
- package/build/image/image.js.map +2 -2
- package/build/image/index.js +19 -19
- package/build/image/index.js.map +3 -3
- package/build/index.js +9 -3
- package/build/index.js.map +2 -2
- package/build/list-item/index.js +9 -7
- package/build/list-item/index.js.map +3 -3
- package/build/math/block.json +28 -1
- package/build/math/edit.js +17 -2
- package/build/math/edit.js.map +2 -2
- package/build/media-text/index.js +16 -9
- package/build/media-text/index.js.map +3 -3
- package/build/media-text/media-container.js +0 -2
- package/build/media-text/media-container.js.map +2 -2
- package/build/missing/block.json +1 -1
- package/build/missing/edit.js +2 -2
- package/build/missing/edit.js.map +1 -1
- package/build/more/index.js +10 -7
- package/build/more/index.js.map +3 -3
- package/build/navigation-link/edit.js +36 -11
- package/build/navigation-link/edit.js.map +2 -2
- package/build/navigation-link/index.js +12 -9
- package/build/navigation-link/index.js.map +3 -3
- package/build/navigation-submenu/index.js +12 -9
- package/build/navigation-submenu/index.js.map +3 -3
- package/build/page-list-item/edit.js +4 -3
- package/build/page-list-item/edit.js.map +2 -2
- package/build/paragraph/deprecated-attributes.js +68 -0
- package/build/paragraph/deprecated-attributes.js.map +7 -0
- package/build/paragraph/edit.js +2 -0
- package/build/paragraph/edit.js.map +3 -3
- package/build/paragraph/index.js +10 -7
- package/build/paragraph/index.js.map +3 -3
- package/build/pattern/block.json +1 -1
- package/build/post-title/edit.js +6 -4
- package/build/post-title/edit.js.map +2 -2
- package/build/preformatted/index.js +10 -7
- package/build/preformatted/index.js.map +3 -3
- package/build/pullquote/index.js +12 -12
- package/build/pullquote/index.js.map +3 -3
- package/build/search/index.js +15 -17
- package/build/search/index.js.map +3 -3
- package/build/social-link/index.js +12 -9
- package/build/social-link/index.js.map +3 -3
- package/build/template-part/edit/index.js +37 -7
- package/build/template-part/edit/index.js.map +2 -2
- package/build/template-part/edit/utils/get-template-part-icon.js +9 -4
- package/build/template-part/edit/utils/get-template-part-icon.js.map +3 -3
- package/build/template-part/edit/utils/hooks.js +2 -3
- package/build/template-part/edit/utils/hooks.js.map +2 -2
- package/build/term-count/index.js +1 -0
- package/build/term-count/index.js.map +2 -2
- package/build/term-name/index.js +1 -0
- package/build/term-name/index.js.map +2 -2
- package/build/verse/index.js +10 -7
- package/build/verse/index.js.map +3 -3
- package/build/video/index.js +13 -10
- package/build/video/index.js.map +3 -3
- package/build-module/accordion/view.js +46 -4
- package/build-module/accordion/view.js.map +2 -2
- package/build-module/accordion-heading/block.json +1 -1
- package/build-module/accordion-heading/deprecated.js +1 -1
- package/build-module/accordion-heading/deprecated.js.map +2 -2
- package/build-module/accordion-panel/block.json +1 -1
- package/build-module/audio/index.js +13 -10
- package/build-module/audio/index.js.map +2 -2
- package/build-module/avatar/edit.js +13 -38
- package/build-module/avatar/edit.js.map +2 -2
- package/build-module/breadcrumbs/block.json +3 -2
- package/build-module/breadcrumbs/edit.js +18 -18
- package/build-module/breadcrumbs/edit.js.map +2 -2
- package/build-module/button/index.js +14 -11
- package/build-module/button/index.js.map +2 -2
- package/build-module/code/index.js +10 -7
- package/build-module/code/index.js.map +2 -2
- package/build-module/comments-pagination-numbers/block.json +7 -0
- package/build-module/cover/edit/block-controls.js +27 -3
- package/build-module/cover/edit/block-controls.js.map +2 -2
- package/build-module/cover/edit/cover-placeholder.js +0 -1
- package/build-module/cover/edit/cover-placeholder.js.map +2 -2
- package/build-module/cover/edit/embed-video-url-input.js +67 -0
- package/build-module/cover/edit/embed-video-url-input.js.map +7 -0
- package/build-module/cover/edit/index.js +61 -0
- package/build-module/cover/edit/index.js.map +2 -2
- package/build-module/cover/embed-video-utils.js +122 -0
- package/build-module/cover/embed-video-utils.js.map +7 -0
- package/build-module/cover/index.js +11 -5
- package/build-module/cover/index.js.map +2 -2
- package/build-module/cover/save.js +13 -0
- package/build-module/cover/save.js.map +2 -2
- package/build-module/cover/shared.js +2 -0
- package/build-module/cover/shared.js.map +2 -2
- package/build-module/details/index.js +10 -7
- package/build-module/details/index.js.map +2 -2
- package/build-module/file/index.js +15 -15
- package/build-module/file/index.js.map +2 -2
- package/build-module/freeform/block.json +1 -1
- package/build-module/gallery/edit.js +1 -3
- package/build-module/gallery/edit.js.map +2 -2
- package/build-module/gallery/transforms.js +7 -3
- package/build-module/gallery/transforms.js.map +2 -2
- package/build-module/heading/index.js +10 -7
- package/build-module/heading/index.js.map +2 -2
- package/build-module/html/modal.js +143 -122
- package/build-module/html/modal.js.map +2 -2
- package/build-module/image/edit.js +0 -1
- package/build-module/image/edit.js.map +2 -2
- package/build-module/image/image.js +0 -1
- package/build-module/image/image.js.map +2 -2
- package/build-module/image/index.js +19 -19
- package/build-module/image/index.js.map +2 -2
- package/build-module/index.js +9 -3
- package/build-module/index.js.map +2 -2
- package/build-module/list-item/index.js +9 -7
- package/build-module/list-item/index.js.map +2 -2
- package/build-module/math/block.json +28 -1
- package/build-module/math/edit.js +18 -3
- package/build-module/math/edit.js.map +2 -2
- package/build-module/media-text/index.js +16 -9
- package/build-module/media-text/index.js.map +2 -2
- package/build-module/media-text/media-container.js +0 -2
- package/build-module/media-text/media-container.js.map +2 -2
- package/build-module/missing/block.json +1 -1
- package/build-module/missing/edit.js +2 -2
- package/build-module/missing/edit.js.map +1 -1
- package/build-module/more/index.js +10 -7
- package/build-module/more/index.js.map +2 -2
- package/build-module/navigation-link/edit.js +37 -12
- package/build-module/navigation-link/edit.js.map +2 -2
- package/build-module/navigation-link/index.js +12 -9
- package/build-module/navigation-link/index.js.map +2 -2
- package/build-module/navigation-submenu/index.js +12 -9
- package/build-module/navigation-submenu/index.js.map +2 -2
- package/build-module/page-list-item/edit.js +4 -3
- package/build-module/page-list-item/edit.js.map +2 -2
- package/build-module/paragraph/deprecated-attributes.js +37 -0
- package/build-module/paragraph/deprecated-attributes.js.map +7 -0
- package/build-module/paragraph/edit.js +2 -0
- package/build-module/paragraph/edit.js.map +2 -2
- package/build-module/paragraph/index.js +10 -7
- package/build-module/paragraph/index.js.map +2 -2
- package/build-module/pattern/block.json +1 -1
- package/build-module/post-title/edit.js +6 -4
- package/build-module/post-title/edit.js.map +2 -2
- package/build-module/preformatted/index.js +10 -7
- package/build-module/preformatted/index.js.map +2 -2
- package/build-module/pullquote/index.js +12 -12
- package/build-module/pullquote/index.js.map +2 -2
- package/build-module/search/index.js +15 -17
- package/build-module/search/index.js.map +2 -2
- package/build-module/social-link/index.js +12 -9
- package/build-module/social-link/index.js.map +2 -2
- package/build-module/template-part/edit/index.js +37 -7
- package/build-module/template-part/edit/index.js.map +2 -2
- package/build-module/template-part/edit/utils/get-template-part-icon.js +10 -4
- package/build-module/template-part/edit/utils/get-template-part-icon.js.map +2 -2
- package/build-module/template-part/edit/utils/hooks.js +2 -3
- package/build-module/template-part/edit/utils/hooks.js.map +2 -2
- package/build-module/term-count/index.js +1 -0
- package/build-module/term-count/index.js.map +2 -2
- package/build-module/term-name/index.js +1 -0
- package/build-module/term-name/index.js.map +2 -2
- package/build-module/verse/index.js +10 -7
- package/build-module/verse/index.js.map +2 -2
- package/build-module/video/index.js +13 -10
- package/build-module/video/index.js.map +2 -2
- package/build-style/accordion/style-rtl.css +3 -0
- package/build-style/accordion/style.css +3 -0
- package/build-style/accordion-heading/style-rtl.css +2 -19
- package/build-style/accordion-heading/style.css +2 -19
- package/build-style/accordion-item/style-rtl.css +0 -7
- package/build-style/accordion-item/style.css +0 -7
- package/build-style/accordion-panel/style-rtl.css +1 -4
- package/build-style/accordion-panel/style.css +1 -4
- package/build-style/classic-rtl.css +24 -0
- package/build-style/classic.css +24 -0
- package/build-style/common-rtl.css +4 -4
- package/build-style/common.css +4 -0
- package/build-style/cover/style-rtl.css +47 -0
- package/build-style/cover/style.css +47 -0
- package/build-style/editor-rtl.css +11 -13
- package/build-style/editor.css +11 -13
- package/build-style/html/editor-rtl.css +11 -13
- package/build-style/html/editor.css +11 -13
- package/build-style/style-rtl.css +59 -33
- package/build-style/style.css +59 -29
- package/build-style/verse/style-rtl.css +2 -0
- package/build-style/verse/style.css +2 -0
- package/package.json +40 -38
- package/src/accordion/style.scss +4 -0
- package/src/accordion/view.js +60 -3
- package/src/accordion-heading/block.json +1 -1
- package/src/accordion-heading/deprecated.js +1 -1
- package/src/accordion-heading/style.scss +2 -38
- package/src/accordion-item/index.php +1 -0
- package/src/accordion-item/style.scss +2 -9
- package/src/accordion-panel/block.json +1 -1
- package/src/accordion-panel/style.scss +1 -5
- package/src/audio/index.js +14 -10
- package/src/avatar/edit.js +68 -83
- package/src/breadcrumbs/block.json +3 -2
- package/src/breadcrumbs/edit.js +18 -18
- package/src/breadcrumbs/index.php +103 -93
- package/src/button/index.js +15 -11
- package/src/classic.scss +38 -0
- package/src/code/index.js +11 -7
- package/src/comments-pagination-numbers/block.json +7 -0
- package/src/common.scss +4 -0
- package/src/cover/edit/block-controls.js +26 -2
- package/src/cover/edit/cover-placeholder.js +0 -1
- package/src/cover/edit/embed-video-url-input.js +74 -0
- package/src/cover/edit/index.js +81 -0
- package/src/cover/embed-video-utils.js +196 -0
- package/src/cover/index.js +12 -5
- package/src/cover/index.php +106 -0
- package/src/cover/save.js +14 -0
- package/src/cover/shared.js +1 -0
- package/src/cover/style.scss +47 -0
- package/src/details/index.js +11 -7
- package/src/file/index.js +16 -15
- package/src/freeform/block.json +1 -1
- package/src/gallery/edit.js +4 -3
- package/src/gallery/transforms.js +6 -2
- package/src/heading/index.js +11 -7
- package/src/html/editor.scss +10 -15
- package/src/html/modal.js +54 -30
- package/src/image/edit.js +0 -1
- package/src/image/image.js +0 -1
- package/src/image/index.js +20 -19
- package/src/image/index.php +1 -0
- package/src/index.js +9 -3
- package/src/list-item/index.js +10 -7
- package/src/math/block.json +28 -1
- package/src/math/edit.js +18 -3
- package/src/media-text/index.js +17 -9
- package/src/media-text/media-container.js +0 -2
- package/src/missing/block.json +1 -1
- package/src/missing/edit.js +2 -2
- package/src/more/index.js +11 -7
- package/src/navigation-link/edit.js +72 -26
- package/src/navigation-link/index.js +13 -9
- package/src/navigation-submenu/index.js +13 -9
- package/src/page-list/index.php +3 -4
- package/src/page-list-item/edit.js +4 -3
- package/src/paragraph/deprecated-attributes.js +45 -0
- package/src/paragraph/edit.js +2 -0
- package/src/paragraph/index.js +11 -7
- package/src/pattern/block.json +1 -1
- package/src/post-title/edit.js +8 -4
- package/src/post-title/index.php +1 -1
- package/src/preformatted/index.js +11 -7
- package/src/pullquote/index.js +13 -12
- package/src/search/index.js +15 -16
- package/src/social-link/index.js +13 -9
- package/src/style.scss +1 -0
- package/src/template-part/edit/index.js +44 -6
- package/src/template-part/edit/utils/get-template-part-icon.js +23 -4
- package/src/template-part/edit/utils/hooks.js +2 -4
- package/src/term-count/index.js +1 -0
- package/src/term-name/index.js +1 -0
- package/src/verse/index.js +11 -7
- package/src/verse/style.scss +4 -0
- package/src/video/index.js +14 -10
- package/tsconfig.tsbuildinfo +1 -1
package/build/math/edit.js
CHANGED
|
@@ -38,6 +38,7 @@ var import_block_editor = require("@wordpress/block-editor");
|
|
|
38
38
|
var import_components = require("@wordpress/components");
|
|
39
39
|
var import_element = require("@wordpress/element");
|
|
40
40
|
var import_data = require("@wordpress/data");
|
|
41
|
+
var import_a11y = require("@wordpress/a11y");
|
|
41
42
|
var import_lock_unlock = require("../lock-unlock");
|
|
42
43
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
43
44
|
var { Badge } = (0, import_lock_unlock.unlock)(import_components.privateApis);
|
|
@@ -83,7 +84,8 @@ function MathEdit({ attributes, setAttributes, isSelected }) {
|
|
|
83
84
|
placement: "bottom-start",
|
|
84
85
|
offset: 8,
|
|
85
86
|
anchor: blockRef,
|
|
86
|
-
focusOnMount:
|
|
87
|
+
focusOnMount: false,
|
|
88
|
+
__unstableSlotName: "__unstable-block-tools-after",
|
|
87
89
|
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { style: { padding: "4px", minWidth: "300px" }, children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_components.__experimentalVStack, { spacing: 1, children: [
|
|
88
90
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
89
91
|
import_components.TextareaControl,
|
|
@@ -107,6 +109,15 @@ function MathEdit({ attributes, setAttributes, isSelected }) {
|
|
|
107
109
|
setError(null);
|
|
108
110
|
} catch (err) {
|
|
109
111
|
setError(err.message);
|
|
112
|
+
(0, import_a11y.speak)(
|
|
113
|
+
(0, import_i18n.sprintf)(
|
|
114
|
+
/* translators: %s: error message returned when parsing LaTeX. */
|
|
115
|
+
(0, import_i18n.__)(
|
|
116
|
+
"Error parsing mathematical expression: %s"
|
|
117
|
+
),
|
|
118
|
+
err.message
|
|
119
|
+
)
|
|
120
|
+
);
|
|
110
121
|
}
|
|
111
122
|
setAttributes({
|
|
112
123
|
mathML: newMathML,
|
|
@@ -122,7 +133,11 @@ function MathEdit({ attributes, setAttributes, isSelected }) {
|
|
|
122
133
|
{
|
|
123
134
|
intent: "error",
|
|
124
135
|
className: "wp-block-math__error",
|
|
125
|
-
children:
|
|
136
|
+
children: (0, import_i18n.sprintf)(
|
|
137
|
+
/* translators: %s: error message returned when parsing LaTeX. */
|
|
138
|
+
(0, import_i18n.__)("Error: %s"),
|
|
139
|
+
error
|
|
140
|
+
)
|
|
126
141
|
}
|
|
127
142
|
),
|
|
128
143
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("style", { children: ".wp-block-math__error .components-badge__content{white-space:normal}" })
|
package/build/math/edit.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/math/edit.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport {\n\tuseBlockProps,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport {\n\tTextareaControl,\n\tPopover,\n\t__experimentalVStack as VStack,\n\tprivateApis as componentsPrivateApis,\n} from '@wordpress/components';\nimport { useState, useEffect, useRef } from '@wordpress/element';\nimport { useDispatch } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../lock-unlock';\n\nconst { Badge } = unlock( componentsPrivateApis );\n\nexport default function MathEdit( { attributes, setAttributes, isSelected } ) {\n\tconst { latex, mathML } = attributes;\n\tconst [ blockRef, setBlockRef ] = useState();\n\tconst [ error, setError ] = useState( null );\n\tconst [ latexToMathML, setLatexToMathML ] = useState();\n\tconst initialLatex = useRef( latex );\n\tconst { __unstableMarkNextChangeAsNotPersistent } =\n\t\tuseDispatch( blockEditorStore );\n\n\tuseEffect( () => {\n\t\timport( '@wordpress/latex-to-mathml' ).then( ( module ) => {\n\t\t\tsetLatexToMathML( () => module.default );\n\t\t\tif ( initialLatex.current ) {\n\t\t\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\t\t\tsetAttributes( {\n\t\t\t\t\tmathML: module.default( initialLatex.current, {\n\t\t\t\t\t\tdisplayMode: true,\n\t\t\t\t\t} ),\n\t\t\t\t} );\n\t\t\t}\n\t\t} );\n\t}, [\n\t\tinitialLatex,\n\t\tsetAttributes,\n\t\t__unstableMarkNextChangeAsNotPersistent,\n\t] );\n\n\tconst blockProps = useBlockProps( {\n\t\tref: setBlockRef,\n\t\tposition: 'relative',\n\t} );\n\n\treturn (\n\t\t<div { ...blockProps }>\n\t\t\t{ mathML ? (\n\t\t\t\t<math\n\t\t\t\t\t// We can't spread block props on the math element because\n\t\t\t\t\t// it only supports a limited amount of global attributes.\n\t\t\t\t\t// For example, draggable will have no effect.\n\t\t\t\t\tdisplay=\"block\"\n\t\t\t\t\tdangerouslySetInnerHTML={ { __html: mathML } }\n\t\t\t\t/>\n\t\t\t) : (\n\t\t\t\t'\\u200B'\n\t\t\t) }\n\t\t\t{ isSelected && (\n\t\t\t\t<Popover\n\t\t\t\t\tplacement=\"bottom-start\"\n\t\t\t\t\toffset={ 8 }\n\t\t\t\t\tanchor={ blockRef }\n\t\t\t\t\tfocusOnMount=\"
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __, sprintf } from '@wordpress/i18n';\nimport {\n\tuseBlockProps,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport {\n\tTextareaControl,\n\tPopover,\n\t__experimentalVStack as VStack,\n\tprivateApis as componentsPrivateApis,\n} from '@wordpress/components';\nimport { useState, useEffect, useRef } from '@wordpress/element';\nimport { useDispatch } from '@wordpress/data';\nimport { speak } from '@wordpress/a11y';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../lock-unlock';\n\nconst { Badge } = unlock( componentsPrivateApis );\n\nexport default function MathEdit( { attributes, setAttributes, isSelected } ) {\n\tconst { latex, mathML } = attributes;\n\tconst [ blockRef, setBlockRef ] = useState();\n\tconst [ error, setError ] = useState( null );\n\tconst [ latexToMathML, setLatexToMathML ] = useState();\n\tconst initialLatex = useRef( latex );\n\tconst { __unstableMarkNextChangeAsNotPersistent } =\n\t\tuseDispatch( blockEditorStore );\n\n\tuseEffect( () => {\n\t\timport( '@wordpress/latex-to-mathml' ).then( ( module ) => {\n\t\t\tsetLatexToMathML( () => module.default );\n\t\t\tif ( initialLatex.current ) {\n\t\t\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\t\t\tsetAttributes( {\n\t\t\t\t\tmathML: module.default( initialLatex.current, {\n\t\t\t\t\t\tdisplayMode: true,\n\t\t\t\t\t} ),\n\t\t\t\t} );\n\t\t\t}\n\t\t} );\n\t}, [\n\t\tinitialLatex,\n\t\tsetAttributes,\n\t\t__unstableMarkNextChangeAsNotPersistent,\n\t] );\n\n\tconst blockProps = useBlockProps( {\n\t\tref: setBlockRef,\n\t\tposition: 'relative',\n\t} );\n\n\treturn (\n\t\t<div { ...blockProps }>\n\t\t\t{ mathML ? (\n\t\t\t\t<math\n\t\t\t\t\t// We can't spread block props on the math element because\n\t\t\t\t\t// it only supports a limited amount of global attributes.\n\t\t\t\t\t// For example, draggable will have no effect.\n\t\t\t\t\tdisplay=\"block\"\n\t\t\t\t\tdangerouslySetInnerHTML={ { __html: mathML } }\n\t\t\t\t/>\n\t\t\t) : (\n\t\t\t\t'\\u200B'\n\t\t\t) }\n\t\t\t{ isSelected && (\n\t\t\t\t<Popover\n\t\t\t\t\tplacement=\"bottom-start\"\n\t\t\t\t\toffset={ 8 }\n\t\t\t\t\tanchor={ blockRef }\n\t\t\t\t\tfocusOnMount={ false }\n\t\t\t\t\t__unstableSlotName=\"__unstable-block-tools-after\"\n\t\t\t\t>\n\t\t\t\t\t<div style={ { padding: '4px', minWidth: '300px' } }>\n\t\t\t\t\t\t<VStack spacing={ 1 }>\n\t\t\t\t\t\t\t<TextareaControl\n\t\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\t\tlabel={ __( 'LaTeX math syntax' ) }\n\t\t\t\t\t\t\t\thideLabelFromVision\n\t\t\t\t\t\t\t\tvalue={ latex }\n\t\t\t\t\t\t\t\tclassName=\"wp-block-math__textarea-control\"\n\t\t\t\t\t\t\t\tonChange={ ( newLatex ) => {\n\t\t\t\t\t\t\t\t\tif ( ! latexToMathML ) {\n\t\t\t\t\t\t\t\t\t\tsetAttributes( { latex: newLatex } );\n\t\t\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tlet newMathML = '';\n\t\t\t\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t\t\t\tnewMathML = latexToMathML( newLatex, {\n\t\t\t\t\t\t\t\t\t\t\tdisplayMode: true,\n\t\t\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t\t\t\tsetError( null );\n\t\t\t\t\t\t\t\t\t} catch ( err ) {\n\t\t\t\t\t\t\t\t\t\tsetError( err.message );\n\t\t\t\t\t\t\t\t\t\tspeak(\n\t\t\t\t\t\t\t\t\t\t\tsprintf(\n\t\t\t\t\t\t\t\t\t\t\t\t/* translators: %s: error message returned when parsing LaTeX. */\n\t\t\t\t\t\t\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t\t\t\t\t\t\t'Error parsing mathematical expression: %s'\n\t\t\t\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\t\t\t\terr.message\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\tsetAttributes( {\n\t\t\t\t\t\t\t\t\t\tmathML: newMathML,\n\t\t\t\t\t\t\t\t\t\tlatex: newLatex,\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\tplaceholder={ __( 'e.g., x^2, \\\\frac{a}{b}' ) }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t{ error && (\n\t\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t\t<Badge\n\t\t\t\t\t\t\t\t\t\tintent=\"error\"\n\t\t\t\t\t\t\t\t\t\tclassName=\"wp-block-math__error\"\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t{ sprintf(\n\t\t\t\t\t\t\t\t\t\t\t/* translators: %s: error message returned when parsing LaTeX. */\n\t\t\t\t\t\t\t\t\t\t\t__( 'Error: %s' ),\n\t\t\t\t\t\t\t\t\t\t\terror\n\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t</Badge>\n\t\t\t\t\t\t\t\t\t<style children=\".wp-block-math__error .components-badge__content{white-space:normal}\" />\n\t\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</VStack>\n\t\t\t\t\t</div>\n\t\t\t\t</Popover>\n\t\t\t) }\n\t\t</div>\n\t);\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAA4B;AAC5B,0BAGO;AACP,wBAKO;AACP,qBAA4C;AAC5C,kBAA4B;AAC5B,kBAAsB;AAKtB,yBAAuB;AAuCnB;AArCJ,IAAM,EAAE,MAAM,QAAI,2BAAQ,kBAAAA,WAAsB;AAEjC,SAAR,SAA2B,EAAE,YAAY,eAAe,WAAW,GAAI;AAC7E,QAAM,EAAE,OAAO,OAAO,IAAI;AAC1B,QAAM,CAAE,UAAU,WAAY,QAAI,yBAAS;AAC3C,QAAM,CAAE,OAAO,QAAS,QAAI,yBAAU,IAAK;AAC3C,QAAM,CAAE,eAAe,gBAAiB,QAAI,yBAAS;AACrD,QAAM,mBAAe,uBAAQ,KAAM;AACnC,QAAM,EAAE,wCAAwC,QAC/C,yBAAa,oBAAAC,KAAiB;AAE/B,gCAAW,MAAM;AAChB,WAAQ,4BAA6B,EAAE,KAAM,CAAEC,YAAY;AAC1D,uBAAkB,MAAMA,QAAO,OAAQ;AACvC,UAAK,aAAa,SAAU;AAC3B,gDAAwC;AACxC,sBAAe;AAAA,UACd,QAAQA,QAAO,QAAS,aAAa,SAAS;AAAA,YAC7C,aAAa;AAAA,UACd,CAAE;AAAA,QACH,CAAE;AAAA,MACH;AAAA,IACD,CAAE;AAAA,EACH,GAAG;AAAA,IACF;AAAA,IACA;AAAA,IACA;AAAA,EACD,CAAE;AAEF,QAAM,iBAAa,mCAAe;AAAA,IACjC,KAAK;AAAA,IACL,UAAU;AAAA,EACX,CAAE;AAEF,SACC,6CAAC,SAAM,GAAG,YACP;AAAA,aACD;AAAA,MAAC;AAAA;AAAA,QAIA,SAAQ;AAAA,QACR,yBAA0B,EAAE,QAAQ,OAAO;AAAA;AAAA,IAC5C,IAEA;AAAA,IAEC,cACD;AAAA,MAAC;AAAA;AAAA,QACA,WAAU;AAAA,QACV,QAAS;AAAA,QACT,QAAS;AAAA,QACT,cAAe;AAAA,QACf,oBAAmB;AAAA,QAEnB,sDAAC,SAAI,OAAQ,EAAE,SAAS,OAAO,UAAU,QAAQ,GAChD,uDAAC,kBAAAC,sBAAA,EAAO,SAAU,GACjB;AAAA;AAAA,YAAC;AAAA;AAAA,cACA,yBAAuB;AAAA,cACvB,uBAAqB;AAAA,cACrB,WAAQ,gBAAI,mBAAoB;AAAA,cAChC,qBAAmB;AAAA,cACnB,OAAQ;AAAA,cACR,WAAU;AAAA,cACV,UAAW,CAAE,aAAc;AAC1B,oBAAK,CAAE,eAAgB;AACtB,gCAAe,EAAE,OAAO,SAAS,CAAE;AACnC;AAAA,gBACD;AACA,oBAAI,YAAY;AAChB,oBAAI;AACH,8BAAY,cAAe,UAAU;AAAA,oBACpC,aAAa;AAAA,kBACd,CAAE;AACF,2BAAU,IAAK;AAAA,gBAChB,SAAU,KAAM;AACf,2BAAU,IAAI,OAAQ;AACtB;AAAA,wBACC;AAAA;AAAA,0BAEC;AAAA,wBACC;AAAA,sBACD;AAAA,sBACA,IAAI;AAAA,oBACL;AAAA,kBACD;AAAA,gBACD;AACA,8BAAe;AAAA,kBACd,QAAQ;AAAA,kBACR,OAAO;AAAA,gBACR,CAAE;AAAA,cACH;AAAA,cACA,iBAAc,gBAAI,yBAA0B;AAAA;AAAA,UAC7C;AAAA,UACE,SACD,4EACC;AAAA;AAAA,cAAC;AAAA;AAAA,gBACA,QAAO;AAAA,gBACP,WAAU;AAAA,gBAER;AAAA;AAAA,sBAED,gBAAI,WAAY;AAAA,kBAChB;AAAA,gBACD;AAAA;AAAA,YACD;AAAA,YACA,4CAAC,WAAM,UAAS,wEAAuE;AAAA,aACxF;AAAA,WAEF,GACD;AAAA;AAAA,IACD;AAAA,KAEF;AAEF;",
|
|
6
6
|
"names": ["componentsPrivateApis", "blockEditorStore", "module", "VStack"]
|
|
7
7
|
}
|
|
@@ -38,12 +38,15 @@ __export(media_text_exports, {
|
|
|
38
38
|
module.exports = __toCommonJS(media_text_exports);
|
|
39
39
|
var import_i18n = require("@wordpress/i18n");
|
|
40
40
|
var import_icons = require("@wordpress/icons");
|
|
41
|
+
var import_blocks = require("@wordpress/blocks");
|
|
41
42
|
var import_init_block = __toESM(require("../utils/init-block"));
|
|
42
43
|
var import_deprecated = __toESM(require("./deprecated"));
|
|
43
44
|
var import_edit = __toESM(require("./edit"));
|
|
44
45
|
var import_block = __toESM(require("./block.json"));
|
|
45
46
|
var import_save = __toESM(require("./save"));
|
|
46
47
|
var import_transforms = __toESM(require("./transforms"));
|
|
48
|
+
var import_lock_unlock = require("../lock-unlock");
|
|
49
|
+
var { fieldsKey, formKey } = (0, import_lock_unlock.unlock)(import_blocks.privateApis);
|
|
47
50
|
var { name } = import_block.default;
|
|
48
51
|
var settings = {
|
|
49
52
|
icon: import_icons.mediaAndText,
|
|
@@ -76,16 +79,17 @@ var settings = {
|
|
|
76
79
|
save: import_save.default,
|
|
77
80
|
deprecated: import_deprecated.default
|
|
78
81
|
};
|
|
79
|
-
if (window.
|
|
80
|
-
settings
|
|
82
|
+
if (window.__experimentalContentOnlyInspectorFields) {
|
|
83
|
+
settings[fieldsKey] = [
|
|
81
84
|
{
|
|
85
|
+
id: "media",
|
|
82
86
|
label: (0, import_i18n.__)("Media"),
|
|
83
|
-
type: "
|
|
84
|
-
shownByDefault: true,
|
|
87
|
+
type: "media",
|
|
85
88
|
mapping: {
|
|
86
89
|
id: "mediaId",
|
|
87
90
|
type: "mediaType",
|
|
88
|
-
|
|
91
|
+
url: "mediaUrl",
|
|
92
|
+
link: "mediaLink"
|
|
89
93
|
},
|
|
90
94
|
args: {
|
|
91
95
|
allowedTypes: ["image", "video"],
|
|
@@ -93,16 +97,19 @@ if (window.__experimentalContentOnlyPatternInsertion) {
|
|
|
93
97
|
}
|
|
94
98
|
},
|
|
95
99
|
{
|
|
100
|
+
id: "link",
|
|
96
101
|
label: (0, import_i18n.__)("Link"),
|
|
97
|
-
type: "
|
|
98
|
-
shownByDefault: false,
|
|
102
|
+
type: "link",
|
|
99
103
|
mapping: {
|
|
100
|
-
|
|
104
|
+
url: "href",
|
|
101
105
|
rel: "rel",
|
|
102
|
-
|
|
106
|
+
linkTarget: "linkTarget"
|
|
103
107
|
}
|
|
104
108
|
}
|
|
105
109
|
];
|
|
110
|
+
settings[formKey] = {
|
|
111
|
+
fields: ["media"]
|
|
112
|
+
};
|
|
106
113
|
}
|
|
107
114
|
var init = () => (0, import_init_block.default)({ name, metadata: import_block.default, settings });
|
|
108
115
|
// Annotate the CommonJS export names for ESM import in node:
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/media-text/index.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { mediaAndText 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';\n\nconst { name } = metadata;\n\nexport { metadata, name };\n\nexport const settings = {\n\ticon,\n\texample: {\n\t\tviewportWidth: 601, // Columns collapse \"@media (max-width: 600px)\".\n\t\tattributes: {\n\t\t\tmediaType: 'image',\n\t\t\tmediaUrl:\n\t\t\t\t'https://s.w.org/images/core/5.3/Biologia_Centrali-Americana_-_Cantorchilus_semibadius_1902.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: __(\n\t\t\t\t\t\t'The wren<br>Earns his living<br>Noiselessly.'\n\t\t\t\t\t),\n\t\t\t\t},\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: 'core/paragraph',\n\t\t\t\tattributes: {\n\t\t\t\t\tcontent: __( '\u2014 Kobayashi Issa (\u4E00\u8336)' ),\n\t\t\t\t},\n\t\t\t},\n\t\t],\n\t},\n\ttransforms,\n\tedit,\n\tsave,\n\tdeprecated,\n};\n\nif ( window.
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA,+BAAAA;AAAA,EAAA;AAAA;AAAA;AAAA;AAGA,kBAAmB;AACnB,mBAAqC;
|
|
6
|
-
"names": ["metadata", "icon", "transforms", "edit", "save", "deprecated", "initBlock", "metadata"]
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { mediaAndText as icon } from '@wordpress/icons';\nimport { privateApis as blocksPrivateApis } from '@wordpress/blocks';\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 { unlock } from '../lock-unlock';\n\nconst { fieldsKey, formKey } = unlock( blocksPrivateApis );\n\nconst { name } = metadata;\n\nexport { metadata, name };\n\nexport const settings = {\n\ticon,\n\texample: {\n\t\tviewportWidth: 601, // Columns collapse \"@media (max-width: 600px)\".\n\t\tattributes: {\n\t\t\tmediaType: 'image',\n\t\t\tmediaUrl:\n\t\t\t\t'https://s.w.org/images/core/5.3/Biologia_Centrali-Americana_-_Cantorchilus_semibadius_1902.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: __(\n\t\t\t\t\t\t'The wren<br>Earns his living<br>Noiselessly.'\n\t\t\t\t\t),\n\t\t\t\t},\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: 'core/paragraph',\n\t\t\t\tattributes: {\n\t\t\t\t\tcontent: __( '\u2014 Kobayashi Issa (\u4E00\u8336)' ),\n\t\t\t\t},\n\t\t\t},\n\t\t],\n\t},\n\ttransforms,\n\tedit,\n\tsave,\n\tdeprecated,\n};\n\nif ( window.__experimentalContentOnlyInspectorFields ) {\n\tsettings[ fieldsKey ] = [\n\t\t{\n\t\t\tid: 'media',\n\t\t\tlabel: __( 'Media' ),\n\t\t\ttype: 'media',\n\t\t\tmapping: {\n\t\t\t\tid: 'mediaId',\n\t\t\t\ttype: 'mediaType',\n\t\t\t\turl: 'mediaUrl',\n\t\t\t\tlink: 'mediaLink',\n\t\t\t},\n\t\t\targs: {\n\t\t\t\tallowedTypes: [ 'image', 'video' ],\n\t\t\t\tmultiple: false,\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tid: 'link',\n\t\t\tlabel: __( 'Link' ),\n\t\t\ttype: 'link',\n\t\t\tmapping: {\n\t\t\t\turl: 'href',\n\t\t\t\trel: 'rel',\n\t\t\t\tlinkTarget: 'linkTarget',\n\t\t\t},\n\t\t},\n\t];\n\tsettings[ formKey ] = {\n\t\tfields: [ 'media' ],\n\t};\n}\n\nexport const init = () => initBlock( { name, metadata, settings } );\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA,+BAAAA;AAAA,EAAA;AAAA;AAAA;AAAA;AAGA,kBAAmB;AACnB,mBAAqC;AACrC,oBAAiD;AAKjD,wBAAsB;AACtB,wBAAuB;AACvB,kBAAiB;AACjB,mBAAqB;AACrB,kBAAiB;AACjB,wBAAuB;AACvB,yBAAuB;AAEvB,IAAM,EAAE,WAAW,QAAQ,QAAI,2BAAQ,cAAAC,WAAkB;AAEzD,IAAM,EAAE,KAAK,IAAI,aAAAD;AAIV,IAAM,WAAW;AAAA,EACvB,mBAAAE;AAAA,EACA,SAAS;AAAA,IACR,eAAe;AAAA;AAAA,IACf,YAAY;AAAA,MACX,WAAW;AAAA,MACX,UACC;AAAA,IACF;AAAA,IACA,aAAa;AAAA,MACZ;AAAA,QACC,MAAM;AAAA,QACN,YAAY;AAAA,UACX,aAAS;AAAA,YACR;AAAA,UACD;AAAA,QACD;AAAA,MACD;AAAA,MACA;AAAA,QACC,MAAM;AAAA,QACN,YAAY;AAAA,UACX,aAAS,gBAAI,sCAAwB;AAAA,QACtC;AAAA,MACD;AAAA,IACD;AAAA,EACD;AAAA,EACA,8BAAAC;AAAA,EACA,kBAAAC;AAAA,EACA,kBAAAC;AAAA,EACA,8BAAAC;AACD;AAEA,IAAK,OAAO,0CAA2C;AACtD,WAAU,SAAU,IAAI;AAAA,IACvB;AAAA,MACC,IAAI;AAAA,MACJ,WAAO,gBAAI,OAAQ;AAAA,MACnB,MAAM;AAAA,MACN,SAAS;AAAA,QACR,IAAI;AAAA,QACJ,MAAM;AAAA,QACN,KAAK;AAAA,QACL,MAAM;AAAA,MACP;AAAA,MACA,MAAM;AAAA,QACL,cAAc,CAAE,SAAS,OAAQ;AAAA,QACjC,UAAU;AAAA,MACX;AAAA,IACD;AAAA,IACA;AAAA,MACC,IAAI;AAAA,MACJ,WAAO,gBAAI,MAAO;AAAA,MAClB,MAAM;AAAA,MACN,SAAS;AAAA,QACR,KAAK;AAAA,QACL,KAAK;AAAA,QACL,YAAY;AAAA,MACb;AAAA,IACD;AAAA,EACD;AACA,WAAU,OAAQ,IAAI;AAAA,IACrB,QAAQ,CAAE,OAAQ;AAAA,EACnB;AACD;AAEO,IAAM,OAAO,UAAM,kBAAAC,SAAW,EAAE,MAAM,uBAAAC,SAAU,SAAS,CAAE;",
|
|
6
|
+
"names": ["metadata", "blocksPrivateApis", "icon", "transforms", "edit", "save", "deprecated", "initBlock", "metadata"]
|
|
7
7
|
}
|
|
@@ -74,7 +74,6 @@ function ToolbarEditButton({
|
|
|
74
74
|
mediaId,
|
|
75
75
|
mediaURL: mediaUrl,
|
|
76
76
|
allowedTypes: ALLOWED_MEDIA_TYPES,
|
|
77
|
-
accept: "image/*,video/*",
|
|
78
77
|
onSelect: onSelectMedia,
|
|
79
78
|
onToggleFeaturedImage: toggleUseFeaturedImage,
|
|
80
79
|
useFeaturedImage,
|
|
@@ -101,7 +100,6 @@ function PlaceholderContainer({
|
|
|
101
100
|
},
|
|
102
101
|
className,
|
|
103
102
|
onSelect: onSelectMedia,
|
|
104
|
-
accept: "image/*,video/*",
|
|
105
103
|
onToggleFeaturedImage: toggleUseFeaturedImage,
|
|
106
104
|
allowedTypes: ALLOWED_MEDIA_TYPES,
|
|
107
105
|
onError: onUploadError,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/media-text/media-container.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { ResizableBox, Spinner, Placeholder } from '@wordpress/components';\nimport {\n\tBlockControls,\n\tBlockIcon,\n\tMediaPlaceholder,\n\tMediaReplaceFlow,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport { __ } from '@wordpress/i18n';\nimport { useViewportMatch } from '@wordpress/compose';\nimport { useDispatch } from '@wordpress/data';\nimport { forwardRef } from '@wordpress/element';\nimport { isBlobURL } from '@wordpress/blob';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { media as icon } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport { imageFillStyles } from './image-fill';\n\n/**\n * Constants\n */\nconst ALLOWED_MEDIA_TYPES = [ 'image', 'video' ];\nconst noop = () => {};\n\nconst ResizableBoxContainer = forwardRef(\n\t( { isSelected, isStackedOnMobile, ...props }, ref ) => {\n\t\tconst isMobile = useViewportMatch( 'small', '<' );\n\t\treturn (\n\t\t\t<ResizableBox\n\t\t\t\tref={ ref }\n\t\t\t\tshowHandle={\n\t\t\t\t\tisSelected && ( ! isMobile || ! isStackedOnMobile )\n\t\t\t\t}\n\t\t\t\t{ ...props }\n\t\t\t/>\n\t\t);\n\t}\n);\n\nfunction ToolbarEditButton( {\n\tmediaId,\n\tmediaUrl,\n\tonSelectMedia,\n\ttoggleUseFeaturedImage,\n\tuseFeaturedImage,\n} ) {\n\treturn (\n\t\t<BlockControls group=\"other\">\n\t\t\t<MediaReplaceFlow\n\t\t\t\tmediaId={ mediaId }\n\t\t\t\tmediaURL={ mediaUrl }\n\t\t\t\tallowedTypes={ ALLOWED_MEDIA_TYPES }\n\t\t\t\
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAAiB;AAKjB,wBAAmD;AACnD,0BAMO;AACP,kBAAmB;AACnB,qBAAiC;AACjC,kBAA4B;AAC5B,qBAA2B;AAC3B,kBAA0B;AAC1B,qBAAsC;AACtC,mBAA8B;AAK9B,wBAAgC;AAY7B;AAPH,IAAM,sBAAsB,CAAE,SAAS,OAAQ;AAC/C,IAAM,OAAO,MAAM;AAAC;AAEpB,IAAM,4BAAwB;AAAA,EAC7B,CAAE,EAAE,YAAY,mBAAmB,GAAG,MAAM,GAAG,QAAS;AACvD,UAAM,eAAW,iCAAkB,SAAS,GAAI;AAChD,WACC;AAAA,MAAC;AAAA;AAAA,QACA;AAAA,QACA,YACC,eAAgB,CAAE,YAAY,CAAE;AAAA,QAE/B,GAAG;AAAA;AAAA,IACN;AAAA,EAEF;AACD;AAEA,SAAS,kBAAmB;AAAA,EAC3B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACD,GAAI;AACH,SACC,4CAAC,qCAAc,OAAM,SACpB;AAAA,IAAC;AAAA;AAAA,MACA;AAAA,MACA,UAAW;AAAA,MACX,cAAe;AAAA,MACf,
|
|
4
|
+
"sourcesContent": ["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { ResizableBox, Spinner, Placeholder } from '@wordpress/components';\nimport {\n\tBlockControls,\n\tBlockIcon,\n\tMediaPlaceholder,\n\tMediaReplaceFlow,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport { __ } from '@wordpress/i18n';\nimport { useViewportMatch } from '@wordpress/compose';\nimport { useDispatch } from '@wordpress/data';\nimport { forwardRef } from '@wordpress/element';\nimport { isBlobURL } from '@wordpress/blob';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { media as icon } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport { imageFillStyles } from './image-fill';\n\n/**\n * Constants\n */\nconst ALLOWED_MEDIA_TYPES = [ 'image', 'video' ];\nconst noop = () => {};\n\nconst ResizableBoxContainer = forwardRef(\n\t( { isSelected, isStackedOnMobile, ...props }, ref ) => {\n\t\tconst isMobile = useViewportMatch( 'small', '<' );\n\t\treturn (\n\t\t\t<ResizableBox\n\t\t\t\tref={ ref }\n\t\t\t\tshowHandle={\n\t\t\t\t\tisSelected && ( ! isMobile || ! isStackedOnMobile )\n\t\t\t\t}\n\t\t\t\t{ ...props }\n\t\t\t/>\n\t\t);\n\t}\n);\n\nfunction ToolbarEditButton( {\n\tmediaId,\n\tmediaUrl,\n\tonSelectMedia,\n\ttoggleUseFeaturedImage,\n\tuseFeaturedImage,\n} ) {\n\treturn (\n\t\t<BlockControls group=\"other\">\n\t\t\t<MediaReplaceFlow\n\t\t\t\tmediaId={ mediaId }\n\t\t\t\tmediaURL={ mediaUrl }\n\t\t\t\tallowedTypes={ ALLOWED_MEDIA_TYPES }\n\t\t\t\tonSelect={ onSelectMedia }\n\t\t\t\tonToggleFeaturedImage={ toggleUseFeaturedImage }\n\t\t\t\tuseFeaturedImage={ useFeaturedImage }\n\t\t\t\tonReset={ () => onSelectMedia( undefined ) }\n\t\t\t/>\n\t\t</BlockControls>\n\t);\n}\n\nfunction PlaceholderContainer( {\n\tclassName,\n\tmediaUrl,\n\tonSelectMedia,\n\ttoggleUseFeaturedImage,\n} ) {\n\tconst { createErrorNotice } = useDispatch( noticesStore );\n\n\tconst onUploadError = ( message ) => {\n\t\tcreateErrorNotice( message, { type: 'snackbar' } );\n\t};\n\n\treturn (\n\t\t<MediaPlaceholder\n\t\t\ticon={ <BlockIcon icon={ icon } /> }\n\t\t\tlabels={ {\n\t\t\t\ttitle: __( 'Media area' ),\n\t\t\t} }\n\t\t\tclassName={ className }\n\t\t\tonSelect={ onSelectMedia }\n\t\t\tonToggleFeaturedImage={ toggleUseFeaturedImage }\n\t\t\tallowedTypes={ ALLOWED_MEDIA_TYPES }\n\t\t\tonError={ onUploadError }\n\t\t\tdisableMediaButtons={ mediaUrl }\n\t\t/>\n\t);\n}\n\nfunction MediaContainer( props, ref ) {\n\tconst {\n\t\tclassName,\n\t\tcommitWidthChange,\n\t\tfocalPoint,\n\t\timageFill,\n\t\tisSelected,\n\t\tisStackedOnMobile,\n\t\tmediaAlt,\n\t\tmediaId,\n\t\tmediaPosition,\n\t\tmediaType,\n\t\tmediaUrl,\n\t\tmediaWidth,\n\t\tonSelectMedia,\n\t\tonWidthChange,\n\t\tenableResize,\n\t\ttoggleUseFeaturedImage,\n\t\tuseFeaturedImage,\n\t\tfeaturedImageURL,\n\t\tfeaturedImageAlt,\n\t\trefMedia,\n\t} = props;\n\n\tconst isTemporaryMedia = ! mediaId && isBlobURL( mediaUrl );\n\n\tconst { toggleSelection } = useDispatch( blockEditorStore );\n\n\tif ( mediaUrl || featuredImageURL || useFeaturedImage ) {\n\t\tconst onResizeStart = () => {\n\t\t\ttoggleSelection( false );\n\t\t};\n\t\tconst onResize = ( event, direction, elt ) => {\n\t\t\tonWidthChange( parseInt( elt.style.width ) );\n\t\t};\n\t\tconst onResizeStop = ( event, direction, elt ) => {\n\t\t\ttoggleSelection( true );\n\t\t\tcommitWidthChange( parseInt( elt.style.width ) );\n\t\t};\n\t\tconst enablePositions = {\n\t\t\tright: enableResize && mediaPosition === 'left',\n\t\t\tleft: enableResize && mediaPosition === 'right',\n\t\t};\n\n\t\tconst positionStyles =\n\t\t\tmediaType === 'image' && imageFill\n\t\t\t\t? imageFillStyles( mediaUrl || featuredImageURL, focalPoint )\n\t\t\t\t: {};\n\n\t\tconst mediaTypeRenderers = {\n\t\t\timage: () =>\n\t\t\t\tuseFeaturedImage && featuredImageURL ? (\n\t\t\t\t\t<img\n\t\t\t\t\t\tref={ refMedia }\n\t\t\t\t\t\tsrc={ featuredImageURL }\n\t\t\t\t\t\talt={ featuredImageAlt }\n\t\t\t\t\t\tstyle={ positionStyles }\n\t\t\t\t\t/>\n\t\t\t\t) : (\n\t\t\t\t\tmediaUrl && (\n\t\t\t\t\t\t<img\n\t\t\t\t\t\t\tref={ refMedia }\n\t\t\t\t\t\t\tsrc={ mediaUrl }\n\t\t\t\t\t\t\talt={ mediaAlt }\n\t\t\t\t\t\t\tstyle={ positionStyles }\n\t\t\t\t\t\t/>\n\t\t\t\t\t)\n\t\t\t\t),\n\t\t\tvideo: () => <video controls ref={ refMedia } src={ mediaUrl } />,\n\t\t};\n\n\t\treturn (\n\t\t\t<ResizableBoxContainer\n\t\t\t\tas=\"figure\"\n\t\t\t\tclassName={ clsx(\n\t\t\t\t\tclassName,\n\t\t\t\t\t'editor-media-container__resizer',\n\t\t\t\t\t{ 'is-transient': isTemporaryMedia }\n\t\t\t\t) }\n\t\t\t\tsize={ { width: mediaWidth + '%' } }\n\t\t\t\tminWidth=\"10%\"\n\t\t\t\tmaxWidth=\"100%\"\n\t\t\t\tenable={ enablePositions }\n\t\t\t\tonResizeStart={ onResizeStart }\n\t\t\t\tonResize={ onResize }\n\t\t\t\tonResizeStop={ onResizeStop }\n\t\t\t\taxis=\"x\"\n\t\t\t\tisSelected={ isSelected }\n\t\t\t\tisStackedOnMobile={ isStackedOnMobile }\n\t\t\t\tref={ ref }\n\t\t\t>\n\t\t\t\t<ToolbarEditButton\n\t\t\t\t\tonSelectMedia={ onSelectMedia }\n\t\t\t\t\tmediaUrl={\n\t\t\t\t\t\tuseFeaturedImage && featuredImageURL\n\t\t\t\t\t\t\t? featuredImageURL\n\t\t\t\t\t\t\t: mediaUrl\n\t\t\t\t\t}\n\t\t\t\t\tmediaId={ mediaId }\n\t\t\t\t\ttoggleUseFeaturedImage={ toggleUseFeaturedImage }\n\t\t\t\t\tuseFeaturedImage={ useFeaturedImage }\n\t\t\t\t/>\n\t\t\t\t{ ( mediaTypeRenderers[ mediaType ] || noop )() }\n\t\t\t\t{ isTemporaryMedia && <Spinner /> }\n\t\t\t\t{ ! useFeaturedImage && <PlaceholderContainer { ...props } /> }\n\t\t\t\t{ ! featuredImageURL && useFeaturedImage && (\n\t\t\t\t\t<Placeholder\n\t\t\t\t\t\tclassName=\"wp-block-media-text--placeholder-image\"\n\t\t\t\t\t\tstyle={ positionStyles }\n\t\t\t\t\t\twithIllustration\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t</ResizableBoxContainer>\n\t\t);\n\t}\n\n\treturn <PlaceholderContainer { ...props } />;\n}\n\nexport default forwardRef( MediaContainer );\n"],
|
|
5
|
+
"mappings": "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",
|
|
6
6
|
"names": ["noticesStore", "icon", "blockEditorStore", "clsx"]
|
|
7
7
|
}
|
package/build/missing/block.json
CHANGED
package/build/missing/edit.js
CHANGED
|
@@ -74,12 +74,12 @@ function MissingEdit({ attributes, clientId }) {
|
|
|
74
74
|
if (hasContent && !hasFreeformBlock && (!originalName || originalName === "core/freeform")) {
|
|
75
75
|
if (hasHTMLBlock) {
|
|
76
76
|
messageHTML = (0, import_i18n.__)(
|
|
77
|
-
"It appears you are trying to use the deprecated Classic block. You can leave this block intact, convert its content to a Custom HTML block, or remove it entirely. Alternatively, you can
|
|
77
|
+
"It appears you are trying to use the deprecated Classic block. You can leave this block intact, convert its content to a Custom HTML block, or remove it entirely. Alternatively, if you have unsaved changes, you can save them and refresh to use the Classic block."
|
|
78
78
|
);
|
|
79
79
|
actions.push(convertToHtmlButton);
|
|
80
80
|
} else {
|
|
81
81
|
messageHTML = (0, import_i18n.__)(
|
|
82
|
-
"It appears you are trying to use the deprecated Classic block. You can leave this block intact, or remove it entirely. Alternatively, you can
|
|
82
|
+
"It appears you are trying to use the deprecated Classic block. You can leave this block intact, or remove it entirely. Alternatively, if you have unsaved changes, you can save them and refresh to use the Classic block."
|
|
83
83
|
);
|
|
84
84
|
}
|
|
85
85
|
} else if (hasContent && hasHTMLBlock) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/missing/edit.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __, sprintf } from '@wordpress/i18n';\nimport { RawHTML } from '@wordpress/element';\nimport { Button } from '@wordpress/components';\nimport { createBlock } from '@wordpress/blocks';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport {\n\tWarning,\n\tuseBlockProps,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport { safeHTML } from '@wordpress/dom';\n\nexport default function MissingEdit( { attributes, clientId } ) {\n\tconst { originalName, originalUndelimitedContent } = attributes;\n\tconst hasContent = !! originalUndelimitedContent;\n\tconst { hasFreeformBlock, hasHTMLBlock } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { canInsertBlockType, getBlockRootClientId } =\n\t\t\t\tselect( blockEditorStore );\n\n\t\t\treturn {\n\t\t\t\thasFreeformBlock: canInsertBlockType(\n\t\t\t\t\t'core/freeform',\n\t\t\t\t\tgetBlockRootClientId( clientId )\n\t\t\t\t),\n\t\t\t\thasHTMLBlock: canInsertBlockType(\n\t\t\t\t\t'core/html',\n\t\t\t\t\tgetBlockRootClientId( clientId )\n\t\t\t\t),\n\t\t\t};\n\t\t},\n\t\t[ clientId ]\n\t);\n\tconst { replaceBlock } = useDispatch( blockEditorStore );\n\n\tfunction convertToHTML() {\n\t\treplaceBlock(\n\t\t\tclientId,\n\t\t\tcreateBlock( 'core/html', {\n\t\t\t\tcontent: originalUndelimitedContent,\n\t\t\t} )\n\t\t);\n\t}\n\n\tconst actions = [];\n\tlet messageHTML;\n\n\tconst convertToHtmlButton = (\n\t\t<Button\n\t\t\t__next40pxDefaultSize\n\t\t\tkey=\"convert\"\n\t\t\tonClick={ convertToHTML }\n\t\t\tvariant=\"primary\"\n\t\t>\n\t\t\t{ __( 'Keep as HTML' ) }\n\t\t</Button>\n\t);\n\n\tif (\n\t\thasContent &&\n\t\t! hasFreeformBlock &&\n\t\t( ! originalName || originalName === 'core/freeform' )\n\t) {\n\t\tif ( hasHTMLBlock ) {\n\t\t\tmessageHTML = __(\n\t\t\t\t'It appears you are trying to use the deprecated Classic block. You can leave this block intact, convert its content to a Custom HTML block, or remove it entirely. Alternatively, you can
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __, sprintf } from '@wordpress/i18n';\nimport { RawHTML } from '@wordpress/element';\nimport { Button } from '@wordpress/components';\nimport { createBlock } from '@wordpress/blocks';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport {\n\tWarning,\n\tuseBlockProps,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport { safeHTML } from '@wordpress/dom';\n\nexport default function MissingEdit( { attributes, clientId } ) {\n\tconst { originalName, originalUndelimitedContent } = attributes;\n\tconst hasContent = !! originalUndelimitedContent;\n\tconst { hasFreeformBlock, hasHTMLBlock } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { canInsertBlockType, getBlockRootClientId } =\n\t\t\t\tselect( blockEditorStore );\n\n\t\t\treturn {\n\t\t\t\thasFreeformBlock: canInsertBlockType(\n\t\t\t\t\t'core/freeform',\n\t\t\t\t\tgetBlockRootClientId( clientId )\n\t\t\t\t),\n\t\t\t\thasHTMLBlock: canInsertBlockType(\n\t\t\t\t\t'core/html',\n\t\t\t\t\tgetBlockRootClientId( clientId )\n\t\t\t\t),\n\t\t\t};\n\t\t},\n\t\t[ clientId ]\n\t);\n\tconst { replaceBlock } = useDispatch( blockEditorStore );\n\n\tfunction convertToHTML() {\n\t\treplaceBlock(\n\t\t\tclientId,\n\t\t\tcreateBlock( 'core/html', {\n\t\t\t\tcontent: originalUndelimitedContent,\n\t\t\t} )\n\t\t);\n\t}\n\n\tconst actions = [];\n\tlet messageHTML;\n\n\tconst convertToHtmlButton = (\n\t\t<Button\n\t\t\t__next40pxDefaultSize\n\t\t\tkey=\"convert\"\n\t\t\tonClick={ convertToHTML }\n\t\t\tvariant=\"primary\"\n\t\t>\n\t\t\t{ __( 'Keep as HTML' ) }\n\t\t</Button>\n\t);\n\n\tif (\n\t\thasContent &&\n\t\t! hasFreeformBlock &&\n\t\t( ! originalName || originalName === 'core/freeform' )\n\t) {\n\t\tif ( hasHTMLBlock ) {\n\t\t\tmessageHTML = __(\n\t\t\t\t'It appears you are trying to use the deprecated Classic block. You can leave this block intact, convert its content to a Custom HTML block, or remove it entirely. Alternatively, if you have unsaved changes, you can save them and refresh to use the Classic block.'\n\t\t\t);\n\t\t\tactions.push( convertToHtmlButton );\n\t\t} else {\n\t\t\tmessageHTML = __(\n\t\t\t\t'It appears you are trying to use the deprecated Classic block. You can leave this block intact, or remove it entirely. Alternatively, if you have unsaved changes, you can save them and refresh to use the Classic block.'\n\t\t\t);\n\t\t}\n\t} else if ( hasContent && hasHTMLBlock ) {\n\t\tmessageHTML = sprintf(\n\t\t\t/* translators: %s: block name */\n\t\t\t__(\n\t\t\t\t'Your site doesn\u2019t include support for the \"%s\" block. You can leave it as-is, convert it to custom HTML, or remove it.'\n\t\t\t),\n\t\t\toriginalName\n\t\t);\n\t\tactions.push( convertToHtmlButton );\n\t} else {\n\t\tmessageHTML = sprintf(\n\t\t\t/* translators: %s: block name */\n\t\t\t__(\n\t\t\t\t'Your site doesn\u2019t include support for the \"%s\" block. You can leave it as-is or remove it.'\n\t\t\t),\n\t\t\toriginalName\n\t\t);\n\t}\n\n\treturn (\n\t\t<div { ...useBlockProps( { className: 'has-warning' } ) }>\n\t\t\t<Warning actions={ actions }>{ messageHTML }</Warning>\n\t\t\t<RawHTML>{ safeHTML( originalUndelimitedContent ) }</RawHTML>\n\t\t</div>\n\t);\n}\n"],
|
|
5
5
|
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAA4B;AAC5B,qBAAwB;AACxB,wBAAuB;AACvB,oBAA4B;AAC5B,kBAAuC;AACvC,0BAIO;AACP,iBAAyB;AAsCvB;AApCa,SAAR,YAA8B,EAAE,YAAY,SAAS,GAAI;AAC/D,QAAM,EAAE,cAAc,2BAA2B,IAAI;AACrD,QAAM,aAAa,CAAC,CAAE;AACtB,QAAM,EAAE,kBAAkB,aAAa,QAAI;AAAA,IAC1C,CAAE,WAAY;AACb,YAAM,EAAE,oBAAoB,qBAAqB,IAChD,OAAQ,oBAAAA,KAAiB;AAE1B,aAAO;AAAA,QACN,kBAAkB;AAAA,UACjB;AAAA,UACA,qBAAsB,QAAS;AAAA,QAChC;AAAA,QACA,cAAc;AAAA,UACb;AAAA,UACA,qBAAsB,QAAS;AAAA,QAChC;AAAA,MACD;AAAA,IACD;AAAA,IACA,CAAE,QAAS;AAAA,EACZ;AACA,QAAM,EAAE,aAAa,QAAI,yBAAa,oBAAAA,KAAiB;AAEvD,WAAS,gBAAgB;AACxB;AAAA,MACC;AAAA,UACA,2BAAa,aAAa;AAAA,QACzB,SAAS;AAAA,MACV,CAAE;AAAA,IACH;AAAA,EACD;AAEA,QAAM,UAAU,CAAC;AACjB,MAAI;AAEJ,QAAM,sBACL;AAAA,IAAC;AAAA;AAAA,MACA,uBAAqB;AAAA,MAErB,SAAU;AAAA,MACV,SAAQ;AAAA,MAEN,8BAAI,cAAe;AAAA;AAAA,IAJjB;AAAA,EAKL;AAGD,MACC,cACA,CAAE,qBACA,CAAE,gBAAgB,iBAAiB,kBACpC;AACD,QAAK,cAAe;AACnB,wBAAc;AAAA,QACb;AAAA,MACD;AACA,cAAQ,KAAM,mBAAoB;AAAA,IACnC,OAAO;AACN,wBAAc;AAAA,QACb;AAAA,MACD;AAAA,IACD;AAAA,EACD,WAAY,cAAc,cAAe;AACxC,sBAAc;AAAA;AAAA,UAEb;AAAA,QACC;AAAA,MACD;AAAA,MACA;AAAA,IACD;AACA,YAAQ,KAAM,mBAAoB;AAAA,EACnC,OAAO;AACN,sBAAc;AAAA;AAAA,UAEb;AAAA,QACC;AAAA,MACD;AAAA,MACA;AAAA,IACD;AAAA,EACD;AAEA,SACC,6CAAC,SAAM,OAAG,mCAAe,EAAE,WAAW,cAAc,CAAE,GACrD;AAAA,gDAAC,+BAAQ,SAAsB,uBAAa;AAAA,IAC5C,4CAAC,0BAAU,mCAAU,0BAA2B,GAAG;AAAA,KACpD;AAEF;",
|
|
6
6
|
"names": ["blockEditorStore"]
|
|
7
7
|
}
|
package/build/more/index.js
CHANGED
|
@@ -38,11 +38,14 @@ __export(more_exports, {
|
|
|
38
38
|
module.exports = __toCommonJS(more_exports);
|
|
39
39
|
var import_icons = require("@wordpress/icons");
|
|
40
40
|
var import_i18n = require("@wordpress/i18n");
|
|
41
|
+
var import_blocks = require("@wordpress/blocks");
|
|
41
42
|
var import_init_block = __toESM(require("../utils/init-block"));
|
|
42
43
|
var import_edit = __toESM(require("./edit"));
|
|
43
44
|
var import_block = __toESM(require("./block.json"));
|
|
44
45
|
var import_save = __toESM(require("./save"));
|
|
45
46
|
var import_transforms = __toESM(require("./transforms"));
|
|
47
|
+
var import_lock_unlock = require("../lock-unlock");
|
|
48
|
+
var { fieldsKey, formKey } = (0, import_lock_unlock.unlock)(import_blocks.privateApis);
|
|
46
49
|
var { name } = import_block.default;
|
|
47
50
|
var settings = {
|
|
48
51
|
icon: import_icons.more,
|
|
@@ -60,17 +63,17 @@ var settings = {
|
|
|
60
63
|
edit: import_edit.default,
|
|
61
64
|
save: import_save.default
|
|
62
65
|
};
|
|
63
|
-
if (window.
|
|
64
|
-
settings
|
|
66
|
+
if (window.__experimentalContentOnlyInspectorFields) {
|
|
67
|
+
settings[fieldsKey] = [
|
|
65
68
|
{
|
|
69
|
+
id: "customText",
|
|
66
70
|
label: (0, import_i18n.__)("Content"),
|
|
67
|
-
type: "
|
|
68
|
-
shownByDefault: true,
|
|
69
|
-
mapping: {
|
|
70
|
-
value: "customText"
|
|
71
|
-
}
|
|
71
|
+
type: "richtext"
|
|
72
72
|
}
|
|
73
73
|
];
|
|
74
|
+
settings[formKey] = {
|
|
75
|
+
fields: ["customText"]
|
|
76
|
+
};
|
|
74
77
|
}
|
|
75
78
|
var init = () => (0, import_init_block.default)({ name, metadata: import_block.default, settings });
|
|
76
79
|
// Annotate the CommonJS export names for ESM import in node:
|
package/build/more/index.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/more/index.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { more as icon } from '@wordpress/icons';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport initBlock from '../utils/init-block';\nimport edit from './edit';\nimport metadata from './block.json';\nimport save from './save';\nimport transforms from './transforms';\n\nconst { name } = metadata;\n\nexport { metadata, name };\n\nexport const settings = {\n\ticon,\n\texample: {},\n\t__experimentalLabel( attributes, { context } ) {\n\t\tconst customName = attributes?.metadata?.name;\n\n\t\tif ( context === 'list-view' && customName ) {\n\t\t\treturn customName;\n\t\t}\n\n\t\tif ( context === 'accessibility' ) {\n\t\t\treturn attributes.customText;\n\t\t}\n\t},\n\ttransforms,\n\tedit,\n\tsave,\n};\n\nif ( window.
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA,+BAAAA;AAAA,EAAA;AAAA;AAAA;AAAA;AAGA,mBAA6B;AAC7B,kBAAmB;
|
|
6
|
-
"names": ["metadata", "icon", "transforms", "edit", "save", "initBlock", "metadata"]
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { more as icon } from '@wordpress/icons';\nimport { __ } from '@wordpress/i18n';\nimport { privateApis as blocksPrivateApis } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport initBlock from '../utils/init-block';\nimport edit from './edit';\nimport metadata from './block.json';\nimport save from './save';\nimport transforms from './transforms';\nimport { unlock } from '../lock-unlock';\n\nconst { fieldsKey, formKey } = unlock( blocksPrivateApis );\n\nconst { name } = metadata;\n\nexport { metadata, name };\n\nexport const settings = {\n\ticon,\n\texample: {},\n\t__experimentalLabel( attributes, { context } ) {\n\t\tconst customName = attributes?.metadata?.name;\n\n\t\tif ( context === 'list-view' && customName ) {\n\t\t\treturn customName;\n\t\t}\n\n\t\tif ( context === 'accessibility' ) {\n\t\t\treturn attributes.customText;\n\t\t}\n\t},\n\ttransforms,\n\tedit,\n\tsave,\n};\n\nif ( window.__experimentalContentOnlyInspectorFields ) {\n\tsettings[ fieldsKey ] = [\n\t\t{\n\t\t\tid: 'customText',\n\t\t\tlabel: __( 'Content' ),\n\t\t\ttype: 'richtext',\n\t\t},\n\t];\n\tsettings[ formKey ] = {\n\t\tfields: [ 'customText' ],\n\t};\n}\n\nexport const init = () => initBlock( { name, metadata, settings } );\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA,+BAAAA;AAAA,EAAA;AAAA;AAAA;AAAA;AAGA,mBAA6B;AAC7B,kBAAmB;AACnB,oBAAiD;AAKjD,wBAAsB;AACtB,kBAAiB;AACjB,mBAAqB;AACrB,kBAAiB;AACjB,wBAAuB;AACvB,yBAAuB;AAEvB,IAAM,EAAE,WAAW,QAAQ,QAAI,2BAAQ,cAAAC,WAAkB;AAEzD,IAAM,EAAE,KAAK,IAAI,aAAAD;AAIV,IAAM,WAAW;AAAA,EACvB,mBAAAE;AAAA,EACA,SAAS,CAAC;AAAA,EACV,oBAAqB,YAAY,EAAE,QAAQ,GAAI;AAC9C,UAAM,aAAa,YAAY,UAAU;AAEzC,QAAK,YAAY,eAAe,YAAa;AAC5C,aAAO;AAAA,IACR;AAEA,QAAK,YAAY,iBAAkB;AAClC,aAAO,WAAW;AAAA,IACnB;AAAA,EACD;AAAA,EACA,8BAAAC;AAAA,EACA,kBAAAC;AAAA,EACA,kBAAAC;AACD;AAEA,IAAK,OAAO,0CAA2C;AACtD,WAAU,SAAU,IAAI;AAAA,IACvB;AAAA,MACC,IAAI;AAAA,MACJ,WAAO,gBAAI,SAAU;AAAA,MACrB,MAAM;AAAA,IACP;AAAA,EACD;AACA,WAAU,OAAQ,IAAI;AAAA,IACrB,QAAQ,CAAE,YAAa;AAAA,EACxB;AACD;AAEO,IAAM,OAAO,UAAM,kBAAAC,SAAW,EAAE,MAAM,uBAAAC,SAAU,SAAS,CAAE;",
|
|
6
|
+
"names": ["metadata", "blocksPrivateApis", "icon", "transforms", "edit", "save", "initBlock", "metadata"]
|
|
7
7
|
}
|
|
@@ -157,15 +157,16 @@ function NavigationLinkEdit({
|
|
|
157
157
|
const itemLabelPlaceholder = (0, import_i18n.__)("Add label\u2026");
|
|
158
158
|
const ref = (0, import_element.useRef)();
|
|
159
159
|
const linkUIref = (0, import_element.useRef)();
|
|
160
|
-
const
|
|
161
|
-
const
|
|
160
|
+
const isNewLink = (0, import_element.useRef)(label === void 0);
|
|
161
|
+
const shouldSelectSubmenuAppenderOnClose = (0, import_element.useRef)(false);
|
|
162
162
|
const {
|
|
163
163
|
isAtMaxNesting,
|
|
164
164
|
isTopLevelLink,
|
|
165
165
|
isParentOfSelectedBlock,
|
|
166
166
|
hasChildren,
|
|
167
167
|
validateLinkStatus,
|
|
168
|
-
parentBlockClientId
|
|
168
|
+
parentBlockClientId,
|
|
169
|
+
isSubmenu
|
|
169
170
|
} = (0, import_data.useSelect)(
|
|
170
171
|
(select) => {
|
|
171
172
|
const {
|
|
@@ -195,7 +196,8 @@ function NavigationLinkEdit({
|
|
|
195
196
|
),
|
|
196
197
|
hasChildren: !!getBlockCount(clientId),
|
|
197
198
|
validateLinkStatus: enableLinkStatusValidation,
|
|
198
|
-
parentBlockClientId: parentBlockId
|
|
199
|
+
parentBlockClientId: parentBlockId,
|
|
200
|
+
isSubmenu: parentBlockName === "core/navigation-submenu"
|
|
199
201
|
};
|
|
200
202
|
},
|
|
201
203
|
[clientId, maxNestingLevel]
|
|
@@ -230,7 +232,7 @@ function NavigationLinkEdit({
|
|
|
230
232
|
replaceBlock(clientId, newSubmenu);
|
|
231
233
|
}, [getBlocks, clientId, selectBlock, replaceBlock, attributes]);
|
|
232
234
|
(0, import_element.useEffect)(() => {
|
|
233
|
-
if (isNewLink.current && isSelected
|
|
235
|
+
if (isNewLink.current && isSelected) {
|
|
234
236
|
selectBlock(parentBlockClientId);
|
|
235
237
|
}
|
|
236
238
|
}, []);
|
|
@@ -245,10 +247,22 @@ function NavigationLinkEdit({
|
|
|
245
247
|
transformToSubmenu
|
|
246
248
|
]);
|
|
247
249
|
(0, import_element.useEffect)(() => {
|
|
248
|
-
if (!
|
|
250
|
+
if (!isNewLink.current || !url || !isLinkOpen) {
|
|
251
|
+
return;
|
|
252
|
+
}
|
|
253
|
+
isNewLink.current = false;
|
|
254
|
+
if ((0, import_url.isURL)((0, import_url.prependHTTP)(label)) && /^.+\.[a-z]+/.test(label)) {
|
|
249
255
|
selectLabelText();
|
|
256
|
+
} else {
|
|
257
|
+
selectBlock(clientId, null);
|
|
258
|
+
if (isSubmenu) {
|
|
259
|
+
const parentBlocks = getBlocks(parentBlockClientId);
|
|
260
|
+
if (parentBlocks.length === 1 && parentBlocks[0].clientId === clientId) {
|
|
261
|
+
shouldSelectSubmenuAppenderOnClose.current = true;
|
|
262
|
+
}
|
|
263
|
+
}
|
|
250
264
|
}
|
|
251
|
-
}, [
|
|
265
|
+
}, [url, isLinkOpen, isNewLink, label]);
|
|
252
266
|
function selectLabelText() {
|
|
253
267
|
ref.current.focus();
|
|
254
268
|
const { ownerDocument } = ref.current;
|
|
@@ -318,13 +332,14 @@ function NavigationLinkEdit({
|
|
|
318
332
|
renderAppender: false
|
|
319
333
|
}
|
|
320
334
|
);
|
|
321
|
-
|
|
335
|
+
const needsValidLink = !url && !(hasUrlBinding && isBoundEntityAvailable) || isInvalid || isDraft || hasUrlBinding && !isBoundEntityAvailable;
|
|
336
|
+
if (needsValidLink) {
|
|
322
337
|
blockProps.onClick = () => {
|
|
323
338
|
setIsLinkOpen(true);
|
|
324
339
|
};
|
|
325
340
|
}
|
|
326
341
|
const classes = (0, import_clsx.default)("wp-block-navigation-item__content", {
|
|
327
|
-
"wp-block-navigation-link__placeholder":
|
|
342
|
+
"wp-block-navigation-link__placeholder": needsValidLink
|
|
328
343
|
});
|
|
329
344
|
const missingText = getMissingText(type);
|
|
330
345
|
const placeholderText = `(${isInvalid ? (0, import_i18n.__)("Invalid") : (0, import_i18n.__)("Draft")})`;
|
|
@@ -423,8 +438,18 @@ function NavigationLinkEdit({
|
|
|
423
438
|
setIsLinkOpen(false);
|
|
424
439
|
if (!url && !hasUrlBinding) {
|
|
425
440
|
onReplace([]);
|
|
426
|
-
|
|
427
|
-
|
|
441
|
+
return;
|
|
442
|
+
}
|
|
443
|
+
if (shouldSelectSubmenuAppenderOnClose.current) {
|
|
444
|
+
shouldSelectSubmenuAppenderOnClose.current = false;
|
|
445
|
+
if (listItemRef.current?.nextElementSibling) {
|
|
446
|
+
const appenderButton = listItemRef.current.nextElementSibling.querySelector(
|
|
447
|
+
".block-editor-button-block-appender"
|
|
448
|
+
);
|
|
449
|
+
if (appenderButton) {
|
|
450
|
+
appenderButton.focus();
|
|
451
|
+
}
|
|
452
|
+
}
|
|
428
453
|
}
|
|
429
454
|
},
|
|
430
455
|
anchor: popoverAnchor,
|