@wordpress/block-editor 14.17.0 → 14.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/build/components/block-canvas/index.js +6 -3
- package/build/components/block-canvas/index.js.map +1 -1
- package/build/components/block-settings-menu/block-mode-toggle.js +3 -3
- package/build/components/block-settings-menu/block-mode-toggle.js.map +1 -1
- package/build/components/block-toolbar/use-has-block-toolbar.js +3 -12
- package/build/components/block-toolbar/use-has-block-toolbar.js.map +1 -1
- package/build/components/child-layout-control/index.js +1 -0
- package/build/components/child-layout-control/index.js.map +1 -1
- package/build/components/html-element-control/index.js +107 -0
- package/build/components/html-element-control/index.js.map +1 -0
- package/build/components/html-element-control/messages.js +25 -0
- package/build/components/html-element-control/messages.js.map +1 -0
- package/build/components/keyboard-shortcuts/index.js +2 -2
- package/build/components/keyboard-shortcuts/index.js.map +1 -1
- package/build/components/media-placeholder/index.js +2 -1
- package/build/components/media-placeholder/index.js.map +1 -1
- package/build/components/rich-text/event-listeners/delete.js +1 -9
- package/build/components/rich-text/event-listeners/delete.js.map +1 -1
- package/build/components/use-resize-canvas/index.js +1 -1
- package/build/components/use-resize-canvas/index.js.map +1 -1
- package/build/hooks/duotone.js +1 -1
- package/build/hooks/duotone.js.map +1 -1
- package/build/hooks/typography.js +1 -1
- package/build/hooks/typography.js.map +1 -1
- package/build/private-apis.js +2 -0
- package/build/private-apis.js.map +1 -1
- package/build/private-apis.native.js +4 -1
- package/build/private-apis.native.js.map +1 -1
- package/build/store/actions.js +1 -1
- package/build/store/actions.js.map +1 -1
- package/build-module/components/block-canvas/index.js +6 -3
- package/build-module/components/block-canvas/index.js.map +1 -1
- package/build-module/components/block-settings-menu/block-mode-toggle.js +3 -3
- package/build-module/components/block-settings-menu/block-mode-toggle.js.map +1 -1
- package/build-module/components/block-toolbar/use-has-block-toolbar.js +3 -12
- package/build-module/components/block-toolbar/use-has-block-toolbar.js.map +1 -1
- package/build-module/components/child-layout-control/index.js +1 -0
- package/build-module/components/child-layout-control/index.js.map +1 -1
- package/build-module/components/html-element-control/index.js +102 -0
- package/build-module/components/html-element-control/index.js.map +1 -0
- package/build-module/components/html-element-control/messages.js +19 -0
- package/build-module/components/html-element-control/messages.js.map +1 -0
- package/build-module/components/keyboard-shortcuts/index.js +2 -2
- package/build-module/components/keyboard-shortcuts/index.js.map +1 -1
- package/build-module/components/media-placeholder/index.js +2 -1
- package/build-module/components/media-placeholder/index.js.map +1 -1
- package/build-module/components/rich-text/event-listeners/delete.js +1 -9
- package/build-module/components/rich-text/event-listeners/delete.js.map +1 -1
- package/build-module/components/use-resize-canvas/index.js +1 -1
- package/build-module/components/use-resize-canvas/index.js.map +1 -1
- package/build-module/hooks/duotone.js +1 -1
- package/build-module/hooks/duotone.js.map +1 -1
- package/build-module/hooks/typography.js +1 -1
- package/build-module/hooks/typography.js.map +1 -1
- package/build-module/private-apis.js +2 -0
- package/build-module/private-apis.js.map +1 -1
- package/build-module/private-apis.native.js +3 -1
- package/build-module/private-apis.native.js.map +1 -1
- package/build-module/store/actions.js +1 -1
- package/build-module/store/actions.js.map +1 -1
- package/build-style/content-rtl.css +1 -0
- package/build-style/content.css +1 -0
- package/build-style/style-rtl.css +7 -2
- package/build-style/style.css +8 -2
- package/package.json +34 -34
- package/src/components/block-canvas/index.js +5 -3
- package/src/components/block-inspector/style.scss +4 -2
- package/src/components/block-list/content.scss +1 -0
- package/src/components/block-settings-menu/block-mode-toggle.js +3 -3
- package/src/components/block-settings-menu/test/block-mode-toggle.js +1 -1
- package/src/components/block-toolbar/use-has-block-toolbar.js +7 -13
- package/src/components/child-layout-control/index.js +1 -0
- package/src/components/html-element-control/index.js +109 -0
- package/src/components/html-element-control/messages.js +34 -0
- package/src/components/keyboard-shortcuts/index.js +2 -2
- package/src/components/media-placeholder/index.js +1 -1
- package/src/components/media-placeholder/style.scss +6 -0
- package/src/components/rich-text/event-listeners/delete.js +1 -6
- package/src/components/use-resize-canvas/index.js +1 -1
- package/src/hooks/duotone.js +4 -3
- package/src/hooks/typography.js +5 -3
- package/src/private-apis.js +2 -0
- package/src/private-apis.native.js +2 -0
- package/src/store/actions.js +5 -1
- package/src/store/test/actions.js +122 -0
package/CHANGELOG.md
CHANGED
|
@@ -56,9 +56,9 @@ function ExperimentalBlockCanvas({
|
|
|
56
56
|
if (!shouldIframe) {
|
|
57
57
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_blockTools.default, {
|
|
58
58
|
__unstableContentRef: localRef,
|
|
59
|
-
className: "block-editor-block-canvas",
|
|
60
59
|
style: {
|
|
61
|
-
height
|
|
60
|
+
height,
|
|
61
|
+
display: 'flex'
|
|
62
62
|
},
|
|
63
63
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_editorStyles.default, {
|
|
64
64
|
styles: styles,
|
|
@@ -68,13 +68,16 @@ function ExperimentalBlockCanvas({
|
|
|
68
68
|
ref: contentRef,
|
|
69
69
|
className: "editor-styles-wrapper",
|
|
70
70
|
tabIndex: -1,
|
|
71
|
+
style: {
|
|
72
|
+
height: '100%',
|
|
73
|
+
width: '100%'
|
|
74
|
+
},
|
|
71
75
|
children: children
|
|
72
76
|
})]
|
|
73
77
|
});
|
|
74
78
|
}
|
|
75
79
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_blockTools.default, {
|
|
76
80
|
__unstableContentRef: localRef,
|
|
77
|
-
className: "block-editor-block-canvas",
|
|
78
81
|
style: {
|
|
79
82
|
height,
|
|
80
83
|
display: 'flex'
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_compose","require","_element","_data","_blockList","_interopRequireDefault","_blockTools","_editorStyles","_iframe","_writingFlow","_observeTyping","_blockSelectionClearer","_useBlockCommands","_store","_lockUnlock","_jsxRuntime","EDITOR_STYLE_TRANSFORM_OPTIONS","ignoredSelectors","ExperimentalBlockCanvas","shouldIframe","height","children","jsx","default","styles","contentRef","contentRefProp","iframeProps","useBlockCommands","isTabletViewport","useViewportMatch","resetTypingRef","useMouseMoveTypingReset","clearerRef","useBlockSelectionClearer","localRef","useRef","useMergeRefs","zoomLevel","useSelect","select","unlock","blockEditorStore","getZoomLevel","zoomOutIframeProps","scale","frameSize","jsxs","__unstableContentRef","
|
|
1
|
+
{"version":3,"names":["_compose","require","_element","_data","_blockList","_interopRequireDefault","_blockTools","_editorStyles","_iframe","_writingFlow","_observeTyping","_blockSelectionClearer","_useBlockCommands","_store","_lockUnlock","_jsxRuntime","EDITOR_STYLE_TRANSFORM_OPTIONS","ignoredSelectors","ExperimentalBlockCanvas","shouldIframe","height","children","jsx","default","styles","contentRef","contentRefProp","iframeProps","useBlockCommands","isTabletViewport","useViewportMatch","resetTypingRef","useMouseMoveTypingReset","clearerRef","useBlockSelectionClearer","localRef","useRef","useMergeRefs","zoomLevel","useSelect","select","unlock","blockEditorStore","getZoomLevel","zoomOutIframeProps","scale","frameSize","jsxs","__unstableContentRef","style","display","scope","transformOptions","ref","className","tabIndex","width","name","BlockCanvas","_default","exports"],"sources":["@wordpress/block-editor/src/components/block-canvas/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useMergeRefs, useViewportMatch } from '@wordpress/compose';\nimport { useRef } from '@wordpress/element';\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport BlockList from '../block-list';\nimport BlockTools from '../block-tools';\nimport EditorStyles from '../editor-styles';\nimport Iframe from '../iframe';\nimport WritingFlow from '../writing-flow';\nimport { useMouseMoveTypingReset } from '../observe-typing';\nimport { useBlockSelectionClearer } from '../block-selection-clearer';\nimport { useBlockCommands } from '../use-block-commands';\nimport { store as blockEditorStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\n\n// EditorStyles is a memoized component, so avoid passing a new\n// object reference on each render.\nconst EDITOR_STYLE_TRANSFORM_OPTIONS = {\n\t// Don't transform selectors that already specify `.editor-styles-wrapper`.\n\tignoredSelectors: [ /\\.editor-styles-wrapper/gi ],\n};\n\nexport function ExperimentalBlockCanvas( {\n\tshouldIframe = true,\n\theight = '300px',\n\tchildren = <BlockList />,\n\tstyles,\n\tcontentRef: contentRefProp,\n\tiframeProps,\n} ) {\n\tuseBlockCommands();\n\tconst isTabletViewport = useViewportMatch( 'medium', '<' );\n\tconst resetTypingRef = useMouseMoveTypingReset();\n\tconst clearerRef = useBlockSelectionClearer();\n\tconst localRef = useRef();\n\tconst contentRef = useMergeRefs( [ contentRefProp, clearerRef, localRef ] );\n\tconst zoomLevel = useSelect(\n\t\t( select ) => unlock( select( blockEditorStore ) ).getZoomLevel(),\n\t\t[]\n\t);\n\tconst zoomOutIframeProps =\n\t\tzoomLevel !== 100 && ! isTabletViewport\n\t\t\t? {\n\t\t\t\t\tscale: zoomLevel,\n\t\t\t\t\tframeSize: '40px',\n\t\t\t }\n\t\t\t: {};\n\n\tif ( ! shouldIframe ) {\n\t\treturn (\n\t\t\t<BlockTools\n\t\t\t\t__unstableContentRef={ localRef }\n\t\t\t\tstyle={ { height, display: 'flex' } }\n\t\t\t>\n\t\t\t\t<EditorStyles\n\t\t\t\t\tstyles={ styles }\n\t\t\t\t\tscope=\":where(.editor-styles-wrapper)\"\n\t\t\t\t\ttransformOptions={ EDITOR_STYLE_TRANSFORM_OPTIONS }\n\t\t\t\t/>\n\t\t\t\t<WritingFlow\n\t\t\t\t\tref={ contentRef }\n\t\t\t\t\tclassName=\"editor-styles-wrapper\"\n\t\t\t\t\ttabIndex={ -1 }\n\t\t\t\t\tstyle={ {\n\t\t\t\t\t\theight: '100%',\n\t\t\t\t\t\twidth: '100%',\n\t\t\t\t\t} }\n\t\t\t\t>\n\t\t\t\t\t{ children }\n\t\t\t\t</WritingFlow>\n\t\t\t</BlockTools>\n\t\t);\n\t}\n\n\treturn (\n\t\t<BlockTools\n\t\t\t__unstableContentRef={ localRef }\n\t\t\tstyle={ { height, display: 'flex' } }\n\t\t>\n\t\t\t<Iframe\n\t\t\t\t{ ...iframeProps }\n\t\t\t\t{ ...zoomOutIframeProps }\n\t\t\t\tref={ resetTypingRef }\n\t\t\t\tcontentRef={ contentRef }\n\t\t\t\tstyle={ {\n\t\t\t\t\t...iframeProps?.style,\n\t\t\t\t} }\n\t\t\t\tname=\"editor-canvas\"\n\t\t\t>\n\t\t\t\t<EditorStyles styles={ styles } />\n\t\t\t\t{ children }\n\t\t\t</Iframe>\n\t\t</BlockTools>\n\t);\n}\n\n/**\n * BlockCanvas component is a component used to display the canvas of the block editor.\n * What we call the canvas is an iframe containing the block list that you can manipulate.\n * The component is also responsible of wiring up all the necessary hooks to enable\n * the keyboard navigation across blocks in the editor and inject content styles into the iframe.\n *\n * @example\n *\n * ```jsx\n * function MyBlockEditor() {\n * const [ blocks, updateBlocks ] = useState([]);\n * return (\n * <BlockEditorProvider\n * value={ blocks }\n * onInput={ updateBlocks }\n * onChange={ persistBlocks }\n * >\n * <BlockCanvas height=\"400px\" />\n * </BlockEditorProvider>\n * );\n * }\n * ```\n *\n * @param {Object} props Component props.\n * @param {string} props.height Canvas height, defaults to 300px.\n * @param {Array} props.styles Content styles to inject into the iframe.\n * @param {Element} props.children Content of the canvas, defaults to the BlockList component.\n * @return {Element} Block Breadcrumb.\n */\nfunction BlockCanvas( { children, height, styles } ) {\n\treturn (\n\t\t<ExperimentalBlockCanvas height={ height } styles={ styles }>\n\t\t\t{ children }\n\t\t</ExperimentalBlockCanvas>\n\t);\n}\n\nexport default BlockCanvas;\n"],"mappings":";;;;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AAKA,IAAAG,UAAA,GAAAC,sBAAA,CAAAJ,OAAA;AACA,IAAAK,WAAA,GAAAD,sBAAA,CAAAJ,OAAA;AACA,IAAAM,aAAA,GAAAF,sBAAA,CAAAJ,OAAA;AACA,IAAAO,OAAA,GAAAH,sBAAA,CAAAJ,OAAA;AACA,IAAAQ,YAAA,GAAAJ,sBAAA,CAAAJ,OAAA;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;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASqC,WAAWA,CAAE;EAAErC,QAAQ;EAAED,MAAM;EAAEI;AAAO,CAAC,EAAG;EACpD,oBACC,IAAAT,WAAA,CAAAO,GAAA,EAACJ,uBAAuB;IAACE,MAAM,EAAGA,MAAQ;IAACI,MAAM,EAAGA,MAAQ;IAAAH,QAAA,EACzDA;EAAQ,CACc,CAAC;AAE5B;AAAC,IAAAsC,QAAA,GAAAC,OAAA,CAAArC,OAAA,GAEcmC,WAAW","ignoreList":[]}
|
|
@@ -26,7 +26,7 @@ function BlockModeToggle({
|
|
|
26
26
|
const {
|
|
27
27
|
blockType,
|
|
28
28
|
mode,
|
|
29
|
-
|
|
29
|
+
enabled
|
|
30
30
|
} = (0, _data.useSelect)(select => {
|
|
31
31
|
const {
|
|
32
32
|
getBlock,
|
|
@@ -37,13 +37,13 @@ function BlockModeToggle({
|
|
|
37
37
|
return {
|
|
38
38
|
mode: getBlockMode(clientId),
|
|
39
39
|
blockType: block ? (0, _blocks.getBlockType)(block.name) : null,
|
|
40
|
-
|
|
40
|
+
enabled: getSettings().codeEditingEnabled && !!block?.isValid
|
|
41
41
|
};
|
|
42
42
|
}, [clientId]);
|
|
43
43
|
const {
|
|
44
44
|
toggleBlockMode
|
|
45
45
|
} = (0, _data.useDispatch)(_store.store);
|
|
46
|
-
if (!blockType || !(0, _blocks.hasBlockSupport)(blockType, 'html', true) || !
|
|
46
|
+
if (!blockType || !(0, _blocks.hasBlockSupport)(blockType, 'html', true) || !enabled) {
|
|
47
47
|
return null;
|
|
48
48
|
}
|
|
49
49
|
const label = mode === 'visual' ? (0, _i18n.__)('Edit as HTML') : (0, _i18n.__)('Edit visually');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_i18n","require","_components","_blocks","_data","_store","_jsxRuntime","noop","BlockModeToggle","clientId","onToggle","blockType","mode","
|
|
1
|
+
{"version":3,"names":["_i18n","require","_components","_blocks","_data","_store","_jsxRuntime","noop","BlockModeToggle","clientId","onToggle","blockType","mode","enabled","useSelect","select","getBlock","getBlockMode","getSettings","blockEditorStore","block","getBlockType","name","codeEditingEnabled","isValid","toggleBlockMode","useDispatch","hasBlockSupport","label","__","jsx","MenuItem","onClick","children"],"sources":["@wordpress/block-editor/src/components/block-settings-menu/block-mode-toggle.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { MenuItem } from '@wordpress/components';\nimport { getBlockType, hasBlockSupport } from '@wordpress/blocks';\nimport { useDispatch, useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../../store';\n\nconst noop = () => {};\n\nexport default function BlockModeToggle( { clientId, onToggle = noop } ) {\n\tconst { blockType, mode, enabled } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getBlock, getBlockMode, getSettings } =\n\t\t\t\tselect( blockEditorStore );\n\t\t\tconst block = getBlock( clientId );\n\n\t\t\treturn {\n\t\t\t\tmode: getBlockMode( clientId ),\n\t\t\t\tblockType: block ? getBlockType( block.name ) : null,\n\t\t\t\tenabled: getSettings().codeEditingEnabled && !! block?.isValid,\n\t\t\t};\n\t\t},\n\t\t[ clientId ]\n\t);\n\tconst { toggleBlockMode } = useDispatch( blockEditorStore );\n\n\tif (\n\t\t! blockType ||\n\t\t! hasBlockSupport( blockType, 'html', true ) ||\n\t\t! enabled\n\t) {\n\t\treturn null;\n\t}\n\n\tconst label =\n\t\tmode === 'visual' ? __( 'Edit as HTML' ) : __( 'Edit visually' );\n\n\treturn (\n\t\t<MenuItem\n\t\t\tonClick={ () => {\n\t\t\t\ttoggleBlockMode( clientId );\n\t\t\t\tonToggle();\n\t\t\t} }\n\t\t>\n\t\t\t{ label }\n\t\t</MenuItem>\n\t);\n}\n"],"mappings":";;;;;;AAGA,IAAAA,KAA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WAAA,CAAAwB,GAAA,EAAC5B,WAAA,CAAA6B,QAAQ;IACRC,OAAO,EAAGA,CAAA,KAAM;MACfP,eAAe,CAAEhB,QAAS,CAAC;MAC3BC,QAAQ,CAAC,CAAC;IACX,CAAG;IAAAuB,QAAA,EAEDL;EAAK,CACE,CAAC;AAEb","ignoreList":[]}
|
|
@@ -21,10 +21,7 @@ var _store = require("../../store");
|
|
|
21
21
|
* @return {boolean} Whether the block toolbar component will be rendered.
|
|
22
22
|
*/
|
|
23
23
|
function useHasBlockToolbar() {
|
|
24
|
-
const {
|
|
25
|
-
isToolbarEnabled,
|
|
26
|
-
isBlockDisabled
|
|
27
|
-
} = (0, _data.useSelect)(select => {
|
|
24
|
+
const enabled = (0, _data.useSelect)(select => {
|
|
28
25
|
const {
|
|
29
26
|
getBlockEditingMode,
|
|
30
27
|
getBlockName,
|
|
@@ -36,14 +33,8 @@ function useHasBlockToolbar() {
|
|
|
36
33
|
// instead of getSelectedBlockClientIds
|
|
37
34
|
const selectedBlockClientId = getBlockSelectionStart();
|
|
38
35
|
const blockType = selectedBlockClientId && (0, _blocks.getBlockType)(getBlockName(selectedBlockClientId));
|
|
39
|
-
return
|
|
40
|
-
isToolbarEnabled: blockType && (0, _blocks.hasBlockSupport)(blockType, '__experimentalToolbar', true),
|
|
41
|
-
isBlockDisabled: getBlockEditingMode(selectedBlockClientId) === 'disabled'
|
|
42
|
-
};
|
|
36
|
+
return blockType && (0, _blocks.hasBlockSupport)(blockType, '__experimentalToolbar', true) && getBlockEditingMode(selectedBlockClientId) !== 'disabled';
|
|
43
37
|
}, []);
|
|
44
|
-
|
|
45
|
-
return false;
|
|
46
|
-
}
|
|
47
|
-
return true;
|
|
38
|
+
return enabled;
|
|
48
39
|
}
|
|
49
40
|
//# sourceMappingURL=use-has-block-toolbar.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_data","require","_blocks","_store","useHasBlockToolbar","
|
|
1
|
+
{"version":3,"names":["_data","require","_blocks","_store","useHasBlockToolbar","enabled","useSelect","select","getBlockEditingMode","getBlockName","getBlockSelectionStart","blockEditorStore","selectedBlockClientId","blockType","getBlockType","hasBlockSupport"],"sources":["@wordpress/block-editor/src/components/block-toolbar/use-has-block-toolbar.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { getBlockType, hasBlockSupport } from '@wordpress/blocks';\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../../store';\n\n/**\n * Returns true if the block toolbar should be shown.\n *\n * @return {boolean} Whether the block toolbar component will be rendered.\n */\nexport function useHasBlockToolbar() {\n\tconst enabled = useSelect( ( select ) => {\n\t\tconst { getBlockEditingMode, getBlockName, getBlockSelectionStart } =\n\t\t\tselect( blockEditorStore );\n\n\t\t// we only care about the 1st selected block\n\t\t// for the toolbar, so we use getBlockSelectionStart\n\t\t// instead of getSelectedBlockClientIds\n\t\tconst selectedBlockClientId = getBlockSelectionStart();\n\n\t\tconst blockType =\n\t\t\tselectedBlockClientId &&\n\t\t\tgetBlockType( getBlockName( selectedBlockClientId ) );\n\n\t\treturn (\n\t\t\tblockType &&\n\t\t\thasBlockSupport( blockType, '__experimentalToolbar', true ) &&\n\t\t\tgetBlockEditingMode( selectedBlockClientId ) !== 'disabled'\n\t\t);\n\t}, [] );\n\n\treturn enabled;\n}\n"],"mappings":";;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AAIA,IAAAE,MAAA,GAAAF,OAAA;AARA;AACA;AACA;;AAGA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACO,SAASG,kBAAkBA,CAAA,EAAG;EACpC,MAAMC,OAAO,GAAG,IAAAC,eAAS,EAAIC,MAAM,IAAM;IACxC,MAAM;MAAEC,mBAAmB;MAAEC,YAAY;MAAEC;IAAuB,CAAC,GAClEH,MAAM,CAAEI,YAAiB,CAAC;;IAE3B;IACA;IACA;IACA,MAAMC,qBAAqB,GAAGF,sBAAsB,CAAC,CAAC;IAEtD,MAAMG,SAAS,GACdD,qBAAqB,IACrB,IAAAE,oBAAY,EAAEL,YAAY,CAAEG,qBAAsB,CAAE,CAAC;IAEtD,OACCC,SAAS,IACT,IAAAE,uBAAe,EAAEF,SAAS,EAAE,uBAAuB,EAAE,IAAK,CAAC,IAC3DL,mBAAmB,CAAEI,qBAAsB,CAAC,KAAK,UAAU;EAE7D,CAAC,EAAE,EAAG,CAAC;EAEP,OAAOP,OAAO;AACf","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_components","require","_i18n","_element","_data","_useGetNumberOfBlocksBeforeCell","_store","_useSettings","_jsxRuntime","helpText","selfStretch","parentLayout","orientation","__","ChildLayoutControl","value","childLayout","onChange","isShownByDefault","panelId","type","parentType","default","defaultParentType","parentLayoutType","jsx","FlexControls","GridControls","flexSize","hasFlexValue","flexResetLabel","availableUnits","useSettings","units","useCustomUnits","resetFlex","undefined","useEffect","jsxs","__experimentalVStack","as","ToolsPanelItem","spacing","hasValue","label","onDeselect","children","__experimentalToggleGroupControl","__nextHasNoMarginBottom","size","childLayoutOrientation","help","newFlexSize","isBlock","__experimentalToggleGroupControlOption","_x","__experimentalUnitControl","hideLabelFromVision","columnStart","rowStart","columnSpan","rowSpan","columnCount","rowCount","rootClientId","useSelect","select","blockEditorStore","getBlockRootClientId","moveBlocksToPosition","__unstableMarkNextChangeAsNotPersistent","useDispatch","getNumberOfBlocksBeforeCell","useGetNumberOfBlocksBeforeCell","hasStartValue","hasSpanValue","resetGridStarts","resetGridSpans","Fragment","__experimentalHStack","__experimentalInputControl","newColumnSpan","parseInt","min","newRowSpan","window","__experimentalEnableGridInteractivity","Flex","FlexItem","style","width","newColumnStart","max","newRowStart"],"sources":["@wordpress/block-editor/src/components/child-layout-control/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalToggleGroupControl as ToggleGroupControl,\n\t__experimentalToggleGroupControlOption as ToggleGroupControlOption,\n\t__experimentalUnitControl as UnitControl,\n\t__experimentalInputControl as InputControl,\n\t__experimentalHStack as HStack,\n\t__experimentalVStack as VStack,\n\t__experimentalToolsPanelItem as ToolsPanelItem,\n\t__experimentalUseCustomUnits as useCustomUnits,\n\tFlex,\n\tFlexItem,\n} from '@wordpress/components';\nimport { __, _x } from '@wordpress/i18n';\nimport { useEffect } from '@wordpress/element';\nimport { useSelect, useDispatch } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { useGetNumberOfBlocksBeforeCell } from '../grid/use-get-number-of-blocks-before-cell';\nimport { store as blockEditorStore } from '../../store';\nimport { useSettings } from '../use-settings';\n\nfunction helpText( selfStretch, parentLayout ) {\n\tconst { orientation = 'horizontal' } = parentLayout;\n\n\tif ( selfStretch === 'fill' ) {\n\t\treturn __( 'Stretch to fill available space.' );\n\t}\n\tif ( selfStretch === 'fixed' && orientation === 'horizontal' ) {\n\t\treturn __( 'Specify a fixed width.' );\n\t} else if ( selfStretch === 'fixed' ) {\n\t\treturn __( 'Specify a fixed height.' );\n\t}\n\treturn __( 'Fit contents.' );\n}\n\n/**\n * Form to edit the child layout value.\n *\n * @param {Object} props Props.\n * @param {Object} props.value The child layout value.\n * @param {Function} props.onChange Function to update the child layout value.\n * @param {Object} props.parentLayout The parent layout value.\n *\n * @param {boolean} props.isShownByDefault\n * @param {string} props.panelId\n * @return {Element} child layout edit element.\n */\nexport default function ChildLayoutControl( {\n\tvalue: childLayout = {},\n\tonChange,\n\tparentLayout,\n\tisShownByDefault,\n\tpanelId,\n} ) {\n\tconst {\n\t\ttype: parentType,\n\t\tdefault: { type: defaultParentType = 'default' } = {},\n\t} = parentLayout ?? {};\n\tconst parentLayoutType = parentType || defaultParentType;\n\n\tif ( parentLayoutType === 'flex' ) {\n\t\treturn (\n\t\t\t<FlexControls\n\t\t\t\tchildLayout={ childLayout }\n\t\t\t\tonChange={ onChange }\n\t\t\t\tparentLayout={ parentLayout }\n\t\t\t\tisShownByDefault={ isShownByDefault }\n\t\t\t\tpanelId={ panelId }\n\t\t\t/>\n\t\t);\n\t} else if ( parentLayoutType === 'grid' ) {\n\t\treturn (\n\t\t\t<GridControls\n\t\t\t\tchildLayout={ childLayout }\n\t\t\t\tonChange={ onChange }\n\t\t\t\tparentLayout={ parentLayout }\n\t\t\t\tisShownByDefault={ isShownByDefault }\n\t\t\t\tpanelId={ panelId }\n\t\t\t/>\n\t\t);\n\t}\n\n\treturn null;\n}\n\nfunction FlexControls( {\n\tchildLayout,\n\tonChange,\n\tparentLayout,\n\tisShownByDefault,\n\tpanelId,\n} ) {\n\tconst { selfStretch, flexSize } = childLayout;\n\tconst { orientation = 'horizontal' } = parentLayout ?? {};\n\tconst hasFlexValue = () => !! selfStretch;\n\tconst flexResetLabel =\n\t\torientation === 'horizontal' ? __( 'Width' ) : __( 'Height' );\n\tconst [ availableUnits ] = useSettings( 'spacing.units' );\n\tconst units = useCustomUnits( {\n\t\tavailableUnits: availableUnits || [\n\t\t\t'%',\n\t\t\t'px',\n\t\t\t'em',\n\t\t\t'rem',\n\t\t\t'vh',\n\t\t\t'vw',\n\t\t],\n\t} );\n\tconst resetFlex = () => {\n\t\tonChange( {\n\t\t\tselfStretch: undefined,\n\t\t\tflexSize: undefined,\n\t\t} );\n\t};\n\n\tuseEffect( () => {\n\t\tif ( selfStretch === 'fixed' && ! flexSize ) {\n\t\t\tonChange( {\n\t\t\t\t...childLayout,\n\t\t\t\tselfStretch: 'fit',\n\t\t\t} );\n\t\t}\n\t}, [] );\n\n\treturn (\n\t\t<VStack\n\t\t\tas={ ToolsPanelItem }\n\t\t\tspacing={ 2 }\n\t\t\thasValue={ hasFlexValue }\n\t\t\tlabel={ flexResetLabel }\n\t\t\tonDeselect={ resetFlex }\n\t\t\tisShownByDefault={ isShownByDefault }\n\t\t\tpanelId={ panelId }\n\t\t>\n\t\t\t<ToggleGroupControl\n\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\tsize=\"__unstable-large\"\n\t\t\t\tlabel={ childLayoutOrientation( parentLayout ) }\n\t\t\t\tvalue={ selfStretch || 'fit' }\n\t\t\t\thelp={ helpText( selfStretch, parentLayout ) }\n\t\t\t\tonChange={ ( value ) => {\n\t\t\t\t\tconst newFlexSize = value !== 'fixed' ? null : flexSize;\n\t\t\t\t\tonChange( {\n\t\t\t\t\t\tselfStretch: value,\n\t\t\t\t\t\tflexSize: newFlexSize,\n\t\t\t\t\t} );\n\t\t\t\t} }\n\t\t\t\tisBlock\n\t\t\t>\n\t\t\t\t<ToggleGroupControlOption\n\t\t\t\t\tkey=\"fit\"\n\t\t\t\t\tvalue=\"fit\"\n\t\t\t\t\tlabel={ _x(\n\t\t\t\t\t\t'Fit',\n\t\t\t\t\t\t'Intrinsic block width in flex layout'\n\t\t\t\t\t) }\n\t\t\t\t/>\n\t\t\t\t<ToggleGroupControlOption\n\t\t\t\t\tkey=\"fill\"\n\t\t\t\t\tvalue=\"fill\"\n\t\t\t\t\tlabel={ _x(\n\t\t\t\t\t\t'Grow',\n\t\t\t\t\t\t'Block with expanding width in flex layout'\n\t\t\t\t\t) }\n\t\t\t\t/>\n\t\t\t\t<ToggleGroupControlOption\n\t\t\t\t\tkey=\"fixed\"\n\t\t\t\t\tvalue=\"fixed\"\n\t\t\t\t\tlabel={ _x(\n\t\t\t\t\t\t'Fixed',\n\t\t\t\t\t\t'Block with fixed width in flex layout'\n\t\t\t\t\t) }\n\t\t\t\t/>\n\t\t\t</ToggleGroupControl>\n\t\t\t{ selfStretch === 'fixed' && (\n\t\t\t\t<UnitControl\n\t\t\t\t\tsize=\"__unstable-large\"\n\t\t\t\t\tunits={ units }\n\t\t\t\t\tonChange={ ( value ) => {\n\t\t\t\t\t\tonChange( {\n\t\t\t\t\t\t\tselfStretch,\n\t\t\t\t\t\t\tflexSize: value,\n\t\t\t\t\t\t} );\n\t\t\t\t\t} }\n\t\t\t\t\tvalue={ flexSize }\n\t\t\t\t\tlabel={ flexResetLabel }\n\t\t\t\t\thideLabelFromVision\n\t\t\t\t/>\n\t\t\t) }\n\t\t</VStack>\n\t);\n}\n\nexport function childLayoutOrientation( parentLayout ) {\n\tconst { orientation = 'horizontal' } = parentLayout;\n\treturn orientation === 'horizontal' ? __( 'Width' ) : __( 'Height' );\n}\n\nfunction GridControls( {\n\tchildLayout,\n\tonChange,\n\tparentLayout,\n\tisShownByDefault,\n\tpanelId,\n} ) {\n\tconst { columnStart, rowStart, columnSpan, rowSpan } = childLayout;\n\tconst { columnCount = 3, rowCount } = parentLayout ?? {};\n\tconst rootClientId = useSelect( ( select ) =>\n\t\tselect( blockEditorStore ).getBlockRootClientId( panelId )\n\t);\n\tconst { moveBlocksToPosition, __unstableMarkNextChangeAsNotPersistent } =\n\t\tuseDispatch( blockEditorStore );\n\tconst getNumberOfBlocksBeforeCell = useGetNumberOfBlocksBeforeCell(\n\t\trootClientId,\n\t\tcolumnCount\n\t);\n\tconst hasStartValue = () => !! columnStart || !! rowStart;\n\tconst hasSpanValue = () => !! columnSpan || !! rowSpan;\n\tconst resetGridStarts = () => {\n\t\tonChange( {\n\t\t\tcolumnStart: undefined,\n\t\t\trowStart: undefined,\n\t\t} );\n\t};\n\tconst resetGridSpans = () => {\n\t\tonChange( {\n\t\t\tcolumnSpan: undefined,\n\t\t\trowSpan: undefined,\n\t\t} );\n\t};\n\n\treturn (\n\t\t<>\n\t\t\t<HStack\n\t\t\t\tas={ ToolsPanelItem }\n\t\t\t\thasValue={ hasSpanValue }\n\t\t\t\tlabel={ __( 'Grid span' ) }\n\t\t\t\tonDeselect={ resetGridSpans }\n\t\t\t\tisShownByDefault={ isShownByDefault }\n\t\t\t\tpanelId={ panelId }\n\t\t\t>\n\t\t\t\t<InputControl\n\t\t\t\t\tsize=\"__unstable-large\"\n\t\t\t\t\tlabel={ __( 'Column span' ) }\n\t\t\t\t\ttype=\"number\"\n\t\t\t\t\tonChange={ ( value ) => {\n\t\t\t\t\t\t// Don't allow unsetting.\n\t\t\t\t\t\tconst newColumnSpan =\n\t\t\t\t\t\t\tvalue === '' ? 1 : parseInt( value, 10 );\n\t\t\t\t\t\tonChange( {\n\t\t\t\t\t\t\tcolumnStart,\n\t\t\t\t\t\t\trowStart,\n\t\t\t\t\t\t\trowSpan,\n\t\t\t\t\t\t\tcolumnSpan: newColumnSpan,\n\t\t\t\t\t\t} );\n\t\t\t\t\t} }\n\t\t\t\t\tvalue={ columnSpan ?? 1 }\n\t\t\t\t\tmin={ 1 }\n\t\t\t\t/>\n\t\t\t\t<InputControl\n\t\t\t\t\tsize=\"__unstable-large\"\n\t\t\t\t\tlabel={ __( 'Row span' ) }\n\t\t\t\t\ttype=\"number\"\n\t\t\t\t\tonChange={ ( value ) => {\n\t\t\t\t\t\t// Don't allow unsetting.\n\t\t\t\t\t\tconst newRowSpan =\n\t\t\t\t\t\t\tvalue === '' ? 1 : parseInt( value, 10 );\n\t\t\t\t\t\tonChange( {\n\t\t\t\t\t\t\tcolumnStart,\n\t\t\t\t\t\t\trowStart,\n\t\t\t\t\t\t\tcolumnSpan,\n\t\t\t\t\t\t\trowSpan: newRowSpan,\n\t\t\t\t\t\t} );\n\t\t\t\t\t} }\n\t\t\t\t\tvalue={ rowSpan ?? 1 }\n\t\t\t\t\tmin={ 1 }\n\t\t\t\t/>\n\t\t\t</HStack>\n\t\t\t{ window.__experimentalEnableGridInteractivity && columnCount && (\n\t\t\t\t// Use Flex with an explicit width on the FlexItem instead of HStack to\n\t\t\t\t// work around an issue in webkit where inputs with a max attribute are\n\t\t\t\t// sized incorrectly.\n\t\t\t\t<Flex\n\t\t\t\t\tas={ ToolsPanelItem }\n\t\t\t\t\thasValue={ hasStartValue }\n\t\t\t\t\tlabel={ __( 'Grid placement' ) }\n\t\t\t\t\tonDeselect={ resetGridStarts }\n\t\t\t\t\tisShownByDefault={ false }\n\t\t\t\t\tpanelId={ panelId }\n\t\t\t\t>\n\t\t\t\t\t<FlexItem style={ { width: '50%' } }>\n\t\t\t\t\t\t<InputControl\n\t\t\t\t\t\t\tsize=\"__unstable-large\"\n\t\t\t\t\t\t\tlabel={ __( 'Column' ) }\n\t\t\t\t\t\t\ttype=\"number\"\n\t\t\t\t\t\t\tonChange={ ( value ) => {\n\t\t\t\t\t\t\t\t// Don't allow unsetting.\n\t\t\t\t\t\t\t\tconst newColumnStart =\n\t\t\t\t\t\t\t\t\tvalue === '' ? 1 : parseInt( value, 10 );\n\t\t\t\t\t\t\t\tonChange( {\n\t\t\t\t\t\t\t\t\tcolumnStart: newColumnStart,\n\t\t\t\t\t\t\t\t\trowStart,\n\t\t\t\t\t\t\t\t\tcolumnSpan,\n\t\t\t\t\t\t\t\t\trowSpan,\n\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\t\t\t\t\t\t\tmoveBlocksToPosition(\n\t\t\t\t\t\t\t\t\t[ panelId ],\n\t\t\t\t\t\t\t\t\trootClientId,\n\t\t\t\t\t\t\t\t\trootClientId,\n\t\t\t\t\t\t\t\t\tgetNumberOfBlocksBeforeCell(\n\t\t\t\t\t\t\t\t\t\tnewColumnStart,\n\t\t\t\t\t\t\t\t\t\trowStart\n\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tvalue={ columnStart ?? 1 }\n\t\t\t\t\t\t\tmin={ 1 }\n\t\t\t\t\t\t\tmax={\n\t\t\t\t\t\t\t\tcolumnCount\n\t\t\t\t\t\t\t\t\t? columnCount - ( columnSpan ?? 1 ) + 1\n\t\t\t\t\t\t\t\t\t: undefined\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</FlexItem>\n\t\t\t\t\t<FlexItem style={ { width: '50%' } }>\n\t\t\t\t\t\t<InputControl\n\t\t\t\t\t\t\tsize=\"__unstable-large\"\n\t\t\t\t\t\t\tlabel={ __( 'Row' ) }\n\t\t\t\t\t\t\ttype=\"number\"\n\t\t\t\t\t\t\tonChange={ ( value ) => {\n\t\t\t\t\t\t\t\t// Don't allow unsetting.\n\t\t\t\t\t\t\t\tconst newRowStart =\n\t\t\t\t\t\t\t\t\tvalue === '' ? 1 : parseInt( value, 10 );\n\t\t\t\t\t\t\t\tonChange( {\n\t\t\t\t\t\t\t\t\tcolumnStart,\n\t\t\t\t\t\t\t\t\trowStart: newRowStart,\n\t\t\t\t\t\t\t\t\tcolumnSpan,\n\t\t\t\t\t\t\t\t\trowSpan,\n\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\t\t\t\t\t\t\tmoveBlocksToPosition(\n\t\t\t\t\t\t\t\t\t[ panelId ],\n\t\t\t\t\t\t\t\t\trootClientId,\n\t\t\t\t\t\t\t\t\trootClientId,\n\t\t\t\t\t\t\t\t\tgetNumberOfBlocksBeforeCell(\n\t\t\t\t\t\t\t\t\t\tcolumnStart,\n\t\t\t\t\t\t\t\t\t\tnewRowStart\n\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tvalue={ rowStart ?? 1 }\n\t\t\t\t\t\t\tmin={ 1 }\n\t\t\t\t\t\t\tmax={\n\t\t\t\t\t\t\t\trowCount\n\t\t\t\t\t\t\t\t\t? rowCount - ( rowSpan ?? 1 ) + 1\n\t\t\t\t\t\t\t\t\t: undefined\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</FlexItem>\n\t\t\t\t</Flex>\n\t\t\t) }\n\t\t</>\n\t);\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,WAAA,GAAAC,OAAA;AAYA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,KAAA,GAAAH,OAAA;AAKA,IAAAI,+BAAA,GAAAJ,OAAA;AACA,IAAAK,MAAA,GAAAL,OAAA;AACA,IAAAM,YAAA,GAAAN,OAAA;AAA8C,IAAAO,WAA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W;cACXC,QAAQ,EAAEkC,WAAW;cACrBjC,UAAU;cACVC;YACD,CAAE,CAAC;YACHS,uCAAuC,CAAC,CAAC;YACzCD,oBAAoB,CACnB,CAAElD,OAAO,CAAE,EACX6C,YAAY,EACZA,YAAY,EACZQ,2BAA2B,CAC1Bd,WAAW,EACXmC,WACD,CACD,CAAC;UACF,CAAG;UACH9E,KAAK,EAAG4C,QAAQ,aAARA,QAAQ,cAARA,QAAQ,GAAI,CAAG;UACvBwB,GAAG,EAAG,CAAG;UACTS,GAAG,EACF7B,QAAQ,GACLA,QAAQ,IAAKF,OAAO,aAAPA,OAAO,cAAPA,OAAO,GAAI,CAAC,CAAE,GAAG,CAAC,GAC/BzB;QACH,CACD;MAAC,CACO,CAAC;IAAA,CACN,CACN;EAAA,CACA,CAAC;AAEL","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_components","require","_i18n","_element","_data","_useGetNumberOfBlocksBeforeCell","_store","_useSettings","_jsxRuntime","helpText","selfStretch","parentLayout","orientation","__","ChildLayoutControl","value","childLayout","onChange","isShownByDefault","panelId","type","parentType","default","defaultParentType","parentLayoutType","jsx","FlexControls","GridControls","flexSize","hasFlexValue","flexResetLabel","availableUnits","useSettings","units","useCustomUnits","resetFlex","undefined","useEffect","jsxs","__experimentalVStack","as","ToolsPanelItem","spacing","hasValue","label","onDeselect","children","__experimentalToggleGroupControl","__nextHasNoMarginBottom","size","childLayoutOrientation","help","newFlexSize","isBlock","__experimentalToggleGroupControlOption","_x","__experimentalUnitControl","min","hideLabelFromVision","columnStart","rowStart","columnSpan","rowSpan","columnCount","rowCount","rootClientId","useSelect","select","blockEditorStore","getBlockRootClientId","moveBlocksToPosition","__unstableMarkNextChangeAsNotPersistent","useDispatch","getNumberOfBlocksBeforeCell","useGetNumberOfBlocksBeforeCell","hasStartValue","hasSpanValue","resetGridStarts","resetGridSpans","Fragment","__experimentalHStack","__experimentalInputControl","newColumnSpan","parseInt","newRowSpan","window","__experimentalEnableGridInteractivity","Flex","FlexItem","style","width","newColumnStart","max","newRowStart"],"sources":["@wordpress/block-editor/src/components/child-layout-control/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalToggleGroupControl as ToggleGroupControl,\n\t__experimentalToggleGroupControlOption as ToggleGroupControlOption,\n\t__experimentalUnitControl as UnitControl,\n\t__experimentalInputControl as InputControl,\n\t__experimentalHStack as HStack,\n\t__experimentalVStack as VStack,\n\t__experimentalToolsPanelItem as ToolsPanelItem,\n\t__experimentalUseCustomUnits as useCustomUnits,\n\tFlex,\n\tFlexItem,\n} from '@wordpress/components';\nimport { __, _x } from '@wordpress/i18n';\nimport { useEffect } from '@wordpress/element';\nimport { useSelect, useDispatch } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { useGetNumberOfBlocksBeforeCell } from '../grid/use-get-number-of-blocks-before-cell';\nimport { store as blockEditorStore } from '../../store';\nimport { useSettings } from '../use-settings';\n\nfunction helpText( selfStretch, parentLayout ) {\n\tconst { orientation = 'horizontal' } = parentLayout;\n\n\tif ( selfStretch === 'fill' ) {\n\t\treturn __( 'Stretch to fill available space.' );\n\t}\n\tif ( selfStretch === 'fixed' && orientation === 'horizontal' ) {\n\t\treturn __( 'Specify a fixed width.' );\n\t} else if ( selfStretch === 'fixed' ) {\n\t\treturn __( 'Specify a fixed height.' );\n\t}\n\treturn __( 'Fit contents.' );\n}\n\n/**\n * Form to edit the child layout value.\n *\n * @param {Object} props Props.\n * @param {Object} props.value The child layout value.\n * @param {Function} props.onChange Function to update the child layout value.\n * @param {Object} props.parentLayout The parent layout value.\n *\n * @param {boolean} props.isShownByDefault\n * @param {string} props.panelId\n * @return {Element} child layout edit element.\n */\nexport default function ChildLayoutControl( {\n\tvalue: childLayout = {},\n\tonChange,\n\tparentLayout,\n\tisShownByDefault,\n\tpanelId,\n} ) {\n\tconst {\n\t\ttype: parentType,\n\t\tdefault: { type: defaultParentType = 'default' } = {},\n\t} = parentLayout ?? {};\n\tconst parentLayoutType = parentType || defaultParentType;\n\n\tif ( parentLayoutType === 'flex' ) {\n\t\treturn (\n\t\t\t<FlexControls\n\t\t\t\tchildLayout={ childLayout }\n\t\t\t\tonChange={ onChange }\n\t\t\t\tparentLayout={ parentLayout }\n\t\t\t\tisShownByDefault={ isShownByDefault }\n\t\t\t\tpanelId={ panelId }\n\t\t\t/>\n\t\t);\n\t} else if ( parentLayoutType === 'grid' ) {\n\t\treturn (\n\t\t\t<GridControls\n\t\t\t\tchildLayout={ childLayout }\n\t\t\t\tonChange={ onChange }\n\t\t\t\tparentLayout={ parentLayout }\n\t\t\t\tisShownByDefault={ isShownByDefault }\n\t\t\t\tpanelId={ panelId }\n\t\t\t/>\n\t\t);\n\t}\n\n\treturn null;\n}\n\nfunction FlexControls( {\n\tchildLayout,\n\tonChange,\n\tparentLayout,\n\tisShownByDefault,\n\tpanelId,\n} ) {\n\tconst { selfStretch, flexSize } = childLayout;\n\tconst { orientation = 'horizontal' } = parentLayout ?? {};\n\tconst hasFlexValue = () => !! selfStretch;\n\tconst flexResetLabel =\n\t\torientation === 'horizontal' ? __( 'Width' ) : __( 'Height' );\n\tconst [ availableUnits ] = useSettings( 'spacing.units' );\n\tconst units = useCustomUnits( {\n\t\tavailableUnits: availableUnits || [\n\t\t\t'%',\n\t\t\t'px',\n\t\t\t'em',\n\t\t\t'rem',\n\t\t\t'vh',\n\t\t\t'vw',\n\t\t],\n\t} );\n\tconst resetFlex = () => {\n\t\tonChange( {\n\t\t\tselfStretch: undefined,\n\t\t\tflexSize: undefined,\n\t\t} );\n\t};\n\n\tuseEffect( () => {\n\t\tif ( selfStretch === 'fixed' && ! flexSize ) {\n\t\t\tonChange( {\n\t\t\t\t...childLayout,\n\t\t\t\tselfStretch: 'fit',\n\t\t\t} );\n\t\t}\n\t}, [] );\n\n\treturn (\n\t\t<VStack\n\t\t\tas={ ToolsPanelItem }\n\t\t\tspacing={ 2 }\n\t\t\thasValue={ hasFlexValue }\n\t\t\tlabel={ flexResetLabel }\n\t\t\tonDeselect={ resetFlex }\n\t\t\tisShownByDefault={ isShownByDefault }\n\t\t\tpanelId={ panelId }\n\t\t>\n\t\t\t<ToggleGroupControl\n\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\tsize=\"__unstable-large\"\n\t\t\t\tlabel={ childLayoutOrientation( parentLayout ) }\n\t\t\t\tvalue={ selfStretch || 'fit' }\n\t\t\t\thelp={ helpText( selfStretch, parentLayout ) }\n\t\t\t\tonChange={ ( value ) => {\n\t\t\t\t\tconst newFlexSize = value !== 'fixed' ? null : flexSize;\n\t\t\t\t\tonChange( {\n\t\t\t\t\t\tselfStretch: value,\n\t\t\t\t\t\tflexSize: newFlexSize,\n\t\t\t\t\t} );\n\t\t\t\t} }\n\t\t\t\tisBlock\n\t\t\t>\n\t\t\t\t<ToggleGroupControlOption\n\t\t\t\t\tkey=\"fit\"\n\t\t\t\t\tvalue=\"fit\"\n\t\t\t\t\tlabel={ _x(\n\t\t\t\t\t\t'Fit',\n\t\t\t\t\t\t'Intrinsic block width in flex layout'\n\t\t\t\t\t) }\n\t\t\t\t/>\n\t\t\t\t<ToggleGroupControlOption\n\t\t\t\t\tkey=\"fill\"\n\t\t\t\t\tvalue=\"fill\"\n\t\t\t\t\tlabel={ _x(\n\t\t\t\t\t\t'Grow',\n\t\t\t\t\t\t'Block with expanding width in flex layout'\n\t\t\t\t\t) }\n\t\t\t\t/>\n\t\t\t\t<ToggleGroupControlOption\n\t\t\t\t\tkey=\"fixed\"\n\t\t\t\t\tvalue=\"fixed\"\n\t\t\t\t\tlabel={ _x(\n\t\t\t\t\t\t'Fixed',\n\t\t\t\t\t\t'Block with fixed width in flex layout'\n\t\t\t\t\t) }\n\t\t\t\t/>\n\t\t\t</ToggleGroupControl>\n\t\t\t{ selfStretch === 'fixed' && (\n\t\t\t\t<UnitControl\n\t\t\t\t\tsize=\"__unstable-large\"\n\t\t\t\t\tunits={ units }\n\t\t\t\t\tonChange={ ( value ) => {\n\t\t\t\t\t\tonChange( {\n\t\t\t\t\t\t\tselfStretch,\n\t\t\t\t\t\t\tflexSize: value,\n\t\t\t\t\t\t} );\n\t\t\t\t\t} }\n\t\t\t\t\tvalue={ flexSize }\n\t\t\t\t\tmin={ 0 }\n\t\t\t\t\tlabel={ flexResetLabel }\n\t\t\t\t\thideLabelFromVision\n\t\t\t\t/>\n\t\t\t) }\n\t\t</VStack>\n\t);\n}\n\nexport function childLayoutOrientation( parentLayout ) {\n\tconst { orientation = 'horizontal' } = parentLayout;\n\treturn orientation === 'horizontal' ? __( 'Width' ) : __( 'Height' );\n}\n\nfunction GridControls( {\n\tchildLayout,\n\tonChange,\n\tparentLayout,\n\tisShownByDefault,\n\tpanelId,\n} ) {\n\tconst { columnStart, rowStart, columnSpan, rowSpan } = childLayout;\n\tconst { columnCount = 3, rowCount } = parentLayout ?? {};\n\tconst rootClientId = useSelect( ( select ) =>\n\t\tselect( blockEditorStore ).getBlockRootClientId( panelId )\n\t);\n\tconst { moveBlocksToPosition, __unstableMarkNextChangeAsNotPersistent } =\n\t\tuseDispatch( blockEditorStore );\n\tconst getNumberOfBlocksBeforeCell = useGetNumberOfBlocksBeforeCell(\n\t\trootClientId,\n\t\tcolumnCount\n\t);\n\tconst hasStartValue = () => !! columnStart || !! rowStart;\n\tconst hasSpanValue = () => !! columnSpan || !! rowSpan;\n\tconst resetGridStarts = () => {\n\t\tonChange( {\n\t\t\tcolumnStart: undefined,\n\t\t\trowStart: undefined,\n\t\t} );\n\t};\n\tconst resetGridSpans = () => {\n\t\tonChange( {\n\t\t\tcolumnSpan: undefined,\n\t\t\trowSpan: undefined,\n\t\t} );\n\t};\n\n\treturn (\n\t\t<>\n\t\t\t<HStack\n\t\t\t\tas={ ToolsPanelItem }\n\t\t\t\thasValue={ hasSpanValue }\n\t\t\t\tlabel={ __( 'Grid span' ) }\n\t\t\t\tonDeselect={ resetGridSpans }\n\t\t\t\tisShownByDefault={ isShownByDefault }\n\t\t\t\tpanelId={ panelId }\n\t\t\t>\n\t\t\t\t<InputControl\n\t\t\t\t\tsize=\"__unstable-large\"\n\t\t\t\t\tlabel={ __( 'Column span' ) }\n\t\t\t\t\ttype=\"number\"\n\t\t\t\t\tonChange={ ( value ) => {\n\t\t\t\t\t\t// Don't allow unsetting.\n\t\t\t\t\t\tconst newColumnSpan =\n\t\t\t\t\t\t\tvalue === '' ? 1 : parseInt( value, 10 );\n\t\t\t\t\t\tonChange( {\n\t\t\t\t\t\t\tcolumnStart,\n\t\t\t\t\t\t\trowStart,\n\t\t\t\t\t\t\trowSpan,\n\t\t\t\t\t\t\tcolumnSpan: newColumnSpan,\n\t\t\t\t\t\t} );\n\t\t\t\t\t} }\n\t\t\t\t\tvalue={ columnSpan ?? 1 }\n\t\t\t\t\tmin={ 1 }\n\t\t\t\t/>\n\t\t\t\t<InputControl\n\t\t\t\t\tsize=\"__unstable-large\"\n\t\t\t\t\tlabel={ __( 'Row span' ) }\n\t\t\t\t\ttype=\"number\"\n\t\t\t\t\tonChange={ ( value ) => {\n\t\t\t\t\t\t// Don't allow unsetting.\n\t\t\t\t\t\tconst newRowSpan =\n\t\t\t\t\t\t\tvalue === '' ? 1 : parseInt( value, 10 );\n\t\t\t\t\t\tonChange( {\n\t\t\t\t\t\t\tcolumnStart,\n\t\t\t\t\t\t\trowStart,\n\t\t\t\t\t\t\tcolumnSpan,\n\t\t\t\t\t\t\trowSpan: newRowSpan,\n\t\t\t\t\t\t} );\n\t\t\t\t\t} }\n\t\t\t\t\tvalue={ rowSpan ?? 1 }\n\t\t\t\t\tmin={ 1 }\n\t\t\t\t/>\n\t\t\t</HStack>\n\t\t\t{ window.__experimentalEnableGridInteractivity && columnCount && (\n\t\t\t\t// Use Flex with an explicit width on the FlexItem instead of HStack to\n\t\t\t\t// work around an issue in webkit where inputs with a max attribute are\n\t\t\t\t// sized incorrectly.\n\t\t\t\t<Flex\n\t\t\t\t\tas={ ToolsPanelItem }\n\t\t\t\t\thasValue={ hasStartValue }\n\t\t\t\t\tlabel={ __( 'Grid placement' ) }\n\t\t\t\t\tonDeselect={ resetGridStarts }\n\t\t\t\t\tisShownByDefault={ false }\n\t\t\t\t\tpanelId={ panelId }\n\t\t\t\t>\n\t\t\t\t\t<FlexItem style={ { width: '50%' } }>\n\t\t\t\t\t\t<InputControl\n\t\t\t\t\t\t\tsize=\"__unstable-large\"\n\t\t\t\t\t\t\tlabel={ __( 'Column' ) }\n\t\t\t\t\t\t\ttype=\"number\"\n\t\t\t\t\t\t\tonChange={ ( value ) => {\n\t\t\t\t\t\t\t\t// Don't allow unsetting.\n\t\t\t\t\t\t\t\tconst newColumnStart =\n\t\t\t\t\t\t\t\t\tvalue === '' ? 1 : parseInt( value, 10 );\n\t\t\t\t\t\t\t\tonChange( {\n\t\t\t\t\t\t\t\t\tcolumnStart: newColumnStart,\n\t\t\t\t\t\t\t\t\trowStart,\n\t\t\t\t\t\t\t\t\tcolumnSpan,\n\t\t\t\t\t\t\t\t\trowSpan,\n\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\t\t\t\t\t\t\tmoveBlocksToPosition(\n\t\t\t\t\t\t\t\t\t[ panelId ],\n\t\t\t\t\t\t\t\t\trootClientId,\n\t\t\t\t\t\t\t\t\trootClientId,\n\t\t\t\t\t\t\t\t\tgetNumberOfBlocksBeforeCell(\n\t\t\t\t\t\t\t\t\t\tnewColumnStart,\n\t\t\t\t\t\t\t\t\t\trowStart\n\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tvalue={ columnStart ?? 1 }\n\t\t\t\t\t\t\tmin={ 1 }\n\t\t\t\t\t\t\tmax={\n\t\t\t\t\t\t\t\tcolumnCount\n\t\t\t\t\t\t\t\t\t? columnCount - ( columnSpan ?? 1 ) + 1\n\t\t\t\t\t\t\t\t\t: undefined\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</FlexItem>\n\t\t\t\t\t<FlexItem style={ { width: '50%' } }>\n\t\t\t\t\t\t<InputControl\n\t\t\t\t\t\t\tsize=\"__unstable-large\"\n\t\t\t\t\t\t\tlabel={ __( 'Row' ) }\n\t\t\t\t\t\t\ttype=\"number\"\n\t\t\t\t\t\t\tonChange={ ( value ) => {\n\t\t\t\t\t\t\t\t// Don't allow unsetting.\n\t\t\t\t\t\t\t\tconst newRowStart =\n\t\t\t\t\t\t\t\t\tvalue === '' ? 1 : parseInt( value, 10 );\n\t\t\t\t\t\t\t\tonChange( {\n\t\t\t\t\t\t\t\t\tcolumnStart,\n\t\t\t\t\t\t\t\t\trowStart: newRowStart,\n\t\t\t\t\t\t\t\t\tcolumnSpan,\n\t\t\t\t\t\t\t\t\trowSpan,\n\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\t\t\t\t\t\t\tmoveBlocksToPosition(\n\t\t\t\t\t\t\t\t\t[ panelId ],\n\t\t\t\t\t\t\t\t\trootClientId,\n\t\t\t\t\t\t\t\t\trootClientId,\n\t\t\t\t\t\t\t\t\tgetNumberOfBlocksBeforeCell(\n\t\t\t\t\t\t\t\t\t\tcolumnStart,\n\t\t\t\t\t\t\t\t\t\tnewRowStart\n\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tvalue={ rowStart ?? 1 }\n\t\t\t\t\t\t\tmin={ 1 }\n\t\t\t\t\t\t\tmax={\n\t\t\t\t\t\t\t\trowCount\n\t\t\t\t\t\t\t\t\t? rowCount - ( rowSpan ?? 1 ) + 1\n\t\t\t\t\t\t\t\t\t: undefined\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</FlexItem>\n\t\t\t\t</Flex>\n\t\t\t) }\n\t\t</>\n\t);\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,WAAA,GAAAC,OAAA;AAYA,IAAAC,KAAA,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AM,CAAG;UACrBO,IAAI,EAAC,QAAQ;UACbH,QAAQ,EAAKF,KAAK,IAAM;YACvB;YACA,MAAM8E,WAAW,GAChB9E,KAAK,KAAK,EAAE,GAAG,CAAC,GAAGoE,QAAQ,CAAEpE,KAAK,EAAE,EAAG,CAAC;YACzCE,QAAQ,CAAE;cACT0C,WAAW;cACXC,QAAQ,EAAEiC,WAAW;cACrBhC,UAAU;cACVC;YACD,CAAE,CAAC;YACHS,uCAAuC,CAAC,CAAC;YACzCD,oBAAoB,CACnB,CAAEnD,OAAO,CAAE,EACX8C,YAAY,EACZA,YAAY,EACZQ,2BAA2B,CAC1Bd,WAAW,EACXkC,WACD,CACD,CAAC;UACF,CAAG;UACH9E,KAAK,EAAG6C,QAAQ,aAARA,QAAQ,cAARA,QAAQ,GAAI,CAAG;UACvBH,GAAG,EAAG,CAAG;UACTmC,GAAG,EACF5B,QAAQ,GACLA,QAAQ,IAAKF,OAAO,aAAPA,OAAO,cAAPA,OAAO,GAAI,CAAC,CAAE,GAAG,CAAC,GAC/B1B;QACH,CACD;MAAC,CACO,CAAC;IAAA,CACN,CACN;EAAA,CACA,CAAC;AAEL","ignoreList":[]}
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = HTMLElementControl;
|
|
7
|
+
var _i18n = require("@wordpress/i18n");
|
|
8
|
+
var _components = require("@wordpress/components");
|
|
9
|
+
var _data = require("@wordpress/data");
|
|
10
|
+
var _store = require("../../store");
|
|
11
|
+
var _messages = require("./messages");
|
|
12
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
13
|
+
/**
|
|
14
|
+
* WordPress dependencies
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Internal dependencies
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Renders a SelectControl for choosing HTML elements with validation
|
|
23
|
+
* to prevent duplicate <main> elements.
|
|
24
|
+
*
|
|
25
|
+
* @param {Object} props Component props.
|
|
26
|
+
* @param {string} props.tagName The current HTML tag name.
|
|
27
|
+
* @param {Function} props.onChange Function to call when the tag is changed.
|
|
28
|
+
* @param {string} props.clientId The client ID of the current block.
|
|
29
|
+
* @param {Array} props.options SelectControl options (optional).
|
|
30
|
+
*
|
|
31
|
+
* @return {Component} The HTML element select control with validation.
|
|
32
|
+
*/function HTMLElementControl({
|
|
33
|
+
tagName,
|
|
34
|
+
onChange,
|
|
35
|
+
clientId,
|
|
36
|
+
options = [{
|
|
37
|
+
label: (0, _i18n.__)('Default (<div>)'),
|
|
38
|
+
value: 'div'
|
|
39
|
+
}, {
|
|
40
|
+
label: '<header>',
|
|
41
|
+
value: 'header'
|
|
42
|
+
}, {
|
|
43
|
+
label: '<main>',
|
|
44
|
+
value: 'main'
|
|
45
|
+
}, {
|
|
46
|
+
label: '<section>',
|
|
47
|
+
value: 'section'
|
|
48
|
+
}, {
|
|
49
|
+
label: '<article>',
|
|
50
|
+
value: 'article'
|
|
51
|
+
}, {
|
|
52
|
+
label: '<aside>',
|
|
53
|
+
value: 'aside'
|
|
54
|
+
}, {
|
|
55
|
+
label: '<footer>',
|
|
56
|
+
value: 'footer'
|
|
57
|
+
}]
|
|
58
|
+
}) {
|
|
59
|
+
const checkForMainTag = !!clientId && options.some(option => option.value === 'main');
|
|
60
|
+
const hasMainElementElsewhere = (0, _data.useSelect)(select => {
|
|
61
|
+
if (!checkForMainTag) {
|
|
62
|
+
return false;
|
|
63
|
+
}
|
|
64
|
+
const {
|
|
65
|
+
getClientIdsWithDescendants,
|
|
66
|
+
getBlockAttributes
|
|
67
|
+
} = select(_store.store);
|
|
68
|
+
return getClientIdsWithDescendants().some(id => {
|
|
69
|
+
// Skip the current block.
|
|
70
|
+
if (id === clientId) {
|
|
71
|
+
return false;
|
|
72
|
+
}
|
|
73
|
+
return getBlockAttributes(id)?.tagName === 'main';
|
|
74
|
+
});
|
|
75
|
+
}, [clientId, checkForMainTag]);
|
|
76
|
+
|
|
77
|
+
// Create a modified options array that disables the main option if needed.
|
|
78
|
+
const modifiedOptions = options.map(option => {
|
|
79
|
+
if (option.value === 'main' && hasMainElementElsewhere && tagName !== 'main') {
|
|
80
|
+
return {
|
|
81
|
+
...option,
|
|
82
|
+
disabled: true,
|
|
83
|
+
label: (0, _i18n.sprintf)(/* translators: %s: HTML element name */
|
|
84
|
+
(0, _i18n.__)('%s (Already in use)'), option.label)
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
return option;
|
|
88
|
+
});
|
|
89
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_components.__experimentalVStack, {
|
|
90
|
+
spacing: 2,
|
|
91
|
+
className: "block-editor-html-element-control",
|
|
92
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_components.SelectControl, {
|
|
93
|
+
__nextHasNoMarginBottom: true,
|
|
94
|
+
__next40pxDefaultSize: true,
|
|
95
|
+
label: (0, _i18n.__)('HTML element'),
|
|
96
|
+
options: modifiedOptions,
|
|
97
|
+
value: tagName,
|
|
98
|
+
onChange: onChange,
|
|
99
|
+
help: _messages.htmlElementMessages[tagName]
|
|
100
|
+
}), tagName === 'main' && hasMainElementElsewhere && /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Notice, {
|
|
101
|
+
status: "warning",
|
|
102
|
+
isDismissible: false,
|
|
103
|
+
children: (0, _i18n.__)('Multiple <main> elements detected. The duplicate may be in your content or template. This is not valid HTML and may cause accessibility issues. Please change this HTML element.')
|
|
104
|
+
})]
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_i18n","require","_components","_data","_store","_messages","_jsxRuntime","HTMLElementControl","tagName","onChange","clientId","options","label","__","value","checkForMainTag","some","option","hasMainElementElsewhere","useSelect","select","getClientIdsWithDescendants","getBlockAttributes","blockEditorStore","id","modifiedOptions","map","disabled","sprintf","jsxs","__experimentalVStack","spacing","className","children","jsx","SelectControl","__nextHasNoMarginBottom","__next40pxDefaultSize","help","htmlElementMessages","Notice","status","isDismissible"],"sources":["@wordpress/block-editor/src/components/html-element-control/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, sprintf } from '@wordpress/i18n';\nimport {\n\tSelectControl,\n\tNotice,\n\t__experimentalVStack as VStack,\n} from '@wordpress/components';\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../../store';\nimport { htmlElementMessages } from './messages';\n\n/**\n * Renders a SelectControl for choosing HTML elements with validation\n * to prevent duplicate <main> elements.\n *\n * @param {Object} props Component props.\n * @param {string} props.tagName The current HTML tag name.\n * @param {Function} props.onChange Function to call when the tag is changed.\n * @param {string} props.clientId The client ID of the current block.\n * @param {Array} props.options SelectControl options (optional).\n *\n * @return {Component} The HTML element select control with validation.\n */\nexport default function HTMLElementControl( {\n\ttagName,\n\tonChange,\n\tclientId,\n\toptions = [\n\t\t{ label: __( 'Default (<div>)' ), value: 'div' },\n\t\t{ label: '<header>', value: 'header' },\n\t\t{ label: '<main>', value: 'main' },\n\t\t{ label: '<section>', value: 'section' },\n\t\t{ label: '<article>', value: 'article' },\n\t\t{ label: '<aside>', value: 'aside' },\n\t\t{ label: '<footer>', value: 'footer' },\n\t],\n} ) {\n\tconst checkForMainTag =\n\t\t!! clientId && options.some( ( option ) => option.value === 'main' );\n\n\tconst hasMainElementElsewhere = useSelect(\n\t\t( select ) => {\n\t\t\tif ( ! checkForMainTag ) {\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\tconst { getClientIdsWithDescendants, getBlockAttributes } =\n\t\t\t\tselect( blockEditorStore );\n\n\t\t\treturn getClientIdsWithDescendants().some( ( id ) => {\n\t\t\t\t// Skip the current block.\n\t\t\t\tif ( id === clientId ) {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\n\t\t\t\treturn getBlockAttributes( id )?.tagName === 'main';\n\t\t\t} );\n\t\t},\n\t\t[ clientId, checkForMainTag ]\n\t);\n\n\t// Create a modified options array that disables the main option if needed.\n\tconst modifiedOptions = options.map( ( option ) => {\n\t\tif (\n\t\t\toption.value === 'main' &&\n\t\t\thasMainElementElsewhere &&\n\t\t\ttagName !== 'main'\n\t\t) {\n\t\t\treturn {\n\t\t\t\t...option,\n\t\t\t\tdisabled: true,\n\t\t\t\tlabel: sprintf(\n\t\t\t\t\t/* translators: %s: HTML element name */\n\t\t\t\t\t__( '%s (Already in use)' ),\n\t\t\t\t\toption.label\n\t\t\t\t),\n\t\t\t};\n\t\t}\n\t\treturn option;\n\t} );\n\n\treturn (\n\t\t<VStack spacing={ 2 } className=\"block-editor-html-element-control\">\n\t\t\t<SelectControl\n\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t__next40pxDefaultSize\n\t\t\t\tlabel={ __( 'HTML element' ) }\n\t\t\t\toptions={ modifiedOptions }\n\t\t\t\tvalue={ tagName }\n\t\t\t\tonChange={ onChange }\n\t\t\t\thelp={ htmlElementMessages[ tagName ] }\n\t\t\t/>\n\n\t\t\t{ tagName === 'main' && hasMainElementElsewhere && (\n\t\t\t\t<Notice status=\"warning\" isDismissible={ false }>\n\t\t\t\t\t{ __(\n\t\t\t\t\t\t'Multiple <main> elements detected. The duplicate may be in your content or template. This is not valid HTML and may cause accessibility issues. Please change this HTML element.'\n\t\t\t\t\t) }\n\t\t\t\t</Notice>\n\t\t\t) }\n\t\t</VStack>\n\t);\n}\n"],"mappings":";;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AAKA,IAAAE,KAAA,GAAAF,OAAA;AAKA,IAAAG,MAAA,GAAAH,OAAA;AACA,IAAAI,SAAA,GAAAJ,OAAA;AAAiD,IAAAK,WAAA,GAAAL,OAAA;AAfjD;AACA;AACA;;AASA;AAC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AAC;;EAED;EACA,MAAMU,eAAe,GAAGd,OAAO,CAACe,GAAG,CAAIT,MAAM,IAAM;IAClD,IACCA,MAAM,CAACH,KAAK,KAAK,MAAM,IACvBI,uBAAuB,IACvBV,OAAO,KAAK,MAAM,EACjB;MACD,OAAO;QACN,GAAGS,MAAM;QACTU,QAAQ,EAAE,IAAI;QACdf,KAAK,EAAE,IAAAgB,aAAO,EACb;QACA,IAAAf,QAAE,EAAE,qBAAsB,CAAC,EAC3BI,MAAM,CAACL,KACR;MACD,CAAC;IACF;IACA,OAAOK,MAAM;EACd,CAAE,CAAC;EAEH,oBACC,IAAAX,WAAA,CAAAuB,IAAA,EAAC3B,WAAA,CAAA4B,oBAAM;IAACC,OAAO,EAAG,CAAG;IAACC,SAAS,EAAC,mCAAmC;IAAAC,QAAA,gBAClE,IAAA3B,WAAA,CAAA4B,GAAA,EAAChC,WAAA,CAAAiC,aAAa;MACbC,uBAAuB;MACvBC,qBAAqB;MACrBzB,KAAK,EAAG,IAAAC,QAAE,EAAE,cAAe,CAAG;MAC9BF,OAAO,EAAGc,eAAiB;MAC3BX,KAAK,EAAGN,OAAS;MACjBC,QAAQ,EAAGA,QAAU;MACrB6B,IAAI,EAAGC,6BAAmB,CAAE/B,OAAO;IAAI,CACvC,CAAC,EAEAA,OAAO,KAAK,MAAM,IAAIU,uBAAuB,iBAC9C,IAAAZ,WAAA,CAAA4B,GAAA,EAAChC,WAAA,CAAAsC,MAAM;MAACC,MAAM,EAAC,SAAS;MAACC,aAAa,EAAG,KAAO;MAAAT,QAAA,EAC7C,IAAApB,QAAE,EACH,kLACD;IAAC,CACM,CACR;EAAA,CACM,CAAC;AAEX","ignoreList":[]}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.htmlElementMessages = void 0;
|
|
7
|
+
var _i18n = require("@wordpress/i18n");
|
|
8
|
+
/**
|
|
9
|
+
* WordPress dependencies
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Messages providing helpful descriptions for HTML elements.
|
|
14
|
+
*/
|
|
15
|
+
const htmlElementMessages = exports.htmlElementMessages = {
|
|
16
|
+
article: (0, _i18n.__)('The <article> element should represent a self-contained, syndicatable portion of the document.'),
|
|
17
|
+
aside: (0, _i18n.__)("The <aside> element should represent a portion of a document whose content is only indirectly related to the document's main content."),
|
|
18
|
+
div: (0, _i18n.__)('The <div> element should only be used if the block is a design element with no semantic meaning.'),
|
|
19
|
+
footer: (0, _i18n.__)('The <footer> element should represent a footer for its nearest sectioning element (e.g.: <section>, <article>, <main> etc.).'),
|
|
20
|
+
header: (0, _i18n.__)('The <header> element should represent introductory content, typically a group of introductory or navigational aids.'),
|
|
21
|
+
main: (0, _i18n.__)('The <main> element should be used for the primary content of your document only.'),
|
|
22
|
+
nav: (0, _i18n.__)('The <nav> element should be used to identify groups of links that are intended to be used for website or page content navigation.'),
|
|
23
|
+
section: (0, _i18n.__)("The <section> element should represent a standalone portion of the document that can't be better represented by another element.")
|
|
24
|
+
};
|
|
25
|
+
//# sourceMappingURL=messages.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_i18n","require","htmlElementMessages","exports","article","__","aside","div","footer","header","main","nav","section"],"sources":["@wordpress/block-editor/src/components/html-element-control/messages.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Messages providing helpful descriptions for HTML elements.\n */\nexport const htmlElementMessages = {\n\tarticle: __(\n\t\t'The <article> element should represent a self-contained, syndicatable portion of the document.'\n\t),\n\taside: __(\n\t\t\"The <aside> element should represent a portion of a document whose content is only indirectly related to the document's main content.\"\n\t),\n\tdiv: __(\n\t\t'The <div> element should only be used if the block is a design element with no semantic meaning.'\n\t),\n\tfooter: __(\n\t\t'The <footer> element should represent a footer for its nearest sectioning element (e.g.: <section>, <article>, <main> etc.).'\n\t),\n\theader: __(\n\t\t'The <header> element should represent introductory content, typically a group of introductory or navigational aids.'\n\t),\n\tmain: __(\n\t\t'The <main> element should be used for the primary content of your document only.'\n\t),\n\tnav: __(\n\t\t'The <nav> element should be used to identify groups of links that are intended to be used for website or page content navigation.'\n\t),\n\tsection: __(\n\t\t\"The <section> element should represent a standalone portion of the document that can't be better represented by another element.\"\n\t),\n};\n"],"mappings":";;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AAHA;AACA;AACA;;AAGA;AACA;AACA;AACO,MAAMC,mBAAmB,GAAAC,OAAA,CAAAD,mBAAA,GAAG;EAClCE,OAAO,EAAE,IAAAC,QAAE,EACV,gGACD,CAAC;EACDC,KAAK,EAAE,IAAAD,QAAE,EACR,uIACD,CAAC;EACDE,GAAG,EAAE,IAAAF,QAAE,EACN,kGACD,CAAC;EACDG,MAAM,EAAE,IAAAH,QAAE,EACT,8HACD,CAAC;EACDI,MAAM,EAAE,IAAAJ,QAAE,EACT,qHACD,CAAC;EACDK,IAAI,EAAE,IAAAL,QAAE,EACP,kFACD,CAAC;EACDM,GAAG,EAAE,IAAAN,QAAE,EACN,mIACD,CAAC;EACDO,OAAO,EAAE,IAAAP,QAAE,EACV,kIACD;AACD,CAAC","ignoreList":[]}
|
|
@@ -62,8 +62,8 @@ function KeyboardShortcutsRegister() {
|
|
|
62
62
|
category: 'block',
|
|
63
63
|
description: (0, _i18n.__)('Remove the selected block(s).'),
|
|
64
64
|
keyCombination: {
|
|
65
|
-
modifier: '
|
|
66
|
-
character: '
|
|
65
|
+
modifier: 'access',
|
|
66
|
+
character: 'z'
|
|
67
67
|
}
|
|
68
68
|
});
|
|
69
69
|
registerShortcut({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_element","require","_data","_keyboardShortcuts","_i18n","KeyboardShortcuts","KeyboardShortcutsRegister","registerShortcut","useDispatch","keyboardShortcutsStore","useEffect","name","category","description","__","keyCombination","modifier","character","aliases","Register","_default","exports","default"],"sources":["@wordpress/block-editor/src/components/keyboard-shortcuts/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useEffect } from '@wordpress/element';\nimport { useDispatch } from '@wordpress/data';\nimport { store as keyboardShortcutsStore } from '@wordpress/keyboard-shortcuts';\nimport { __ } from '@wordpress/i18n';\n\nfunction KeyboardShortcuts() {\n\treturn null;\n}\n\nfunction KeyboardShortcutsRegister() {\n\t// Registering the shortcuts.\n\tconst { registerShortcut } = useDispatch( keyboardShortcutsStore );\n\tuseEffect( () => {\n\t\tregisterShortcut( {\n\t\t\tname: 'core/block-editor/copy',\n\t\t\tcategory: 'block',\n\t\t\tdescription: __( 'Copy the selected block(s).' ),\n\t\t\tkeyCombination: {\n\t\t\t\tmodifier: 'primary',\n\t\t\t\tcharacter: 'c',\n\t\t\t},\n\t\t} );\n\n\t\tregisterShortcut( {\n\t\t\tname: 'core/block-editor/cut',\n\t\t\tcategory: 'block',\n\t\t\tdescription: __( 'Cut the selected block(s).' ),\n\t\t\tkeyCombination: {\n\t\t\t\tmodifier: 'primary',\n\t\t\t\tcharacter: 'x',\n\t\t\t},\n\t\t} );\n\n\t\tregisterShortcut( {\n\t\t\tname: 'core/block-editor/paste',\n\t\t\tcategory: 'block',\n\t\t\tdescription: __( 'Paste the selected block(s).' ),\n\t\t\tkeyCombination: {\n\t\t\t\tmodifier: 'primary',\n\t\t\t\tcharacter: 'v',\n\t\t\t},\n\t\t} );\n\n\t\tregisterShortcut( {\n\t\t\tname: 'core/block-editor/duplicate',\n\t\t\tcategory: 'block',\n\t\t\tdescription: __( 'Duplicate the selected block(s).' ),\n\t\t\tkeyCombination: {\n\t\t\t\tmodifier: 'primaryShift',\n\t\t\t\tcharacter: 'd',\n\t\t\t},\n\t\t} );\n\n\t\tregisterShortcut( {\n\t\t\tname: 'core/block-editor/remove',\n\t\t\tcategory: 'block',\n\t\t\tdescription: __( 'Remove the selected block(s).' ),\n\t\t\tkeyCombination: {\n\t\t\t\tmodifier: '
|
|
1
|
+
{"version":3,"names":["_element","require","_data","_keyboardShortcuts","_i18n","KeyboardShortcuts","KeyboardShortcutsRegister","registerShortcut","useDispatch","keyboardShortcutsStore","useEffect","name","category","description","__","keyCombination","modifier","character","aliases","Register","_default","exports","default"],"sources":["@wordpress/block-editor/src/components/keyboard-shortcuts/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useEffect } from '@wordpress/element';\nimport { useDispatch } from '@wordpress/data';\nimport { store as keyboardShortcutsStore } from '@wordpress/keyboard-shortcuts';\nimport { __ } from '@wordpress/i18n';\n\nfunction KeyboardShortcuts() {\n\treturn null;\n}\n\nfunction KeyboardShortcutsRegister() {\n\t// Registering the shortcuts.\n\tconst { registerShortcut } = useDispatch( keyboardShortcutsStore );\n\tuseEffect( () => {\n\t\tregisterShortcut( {\n\t\t\tname: 'core/block-editor/copy',\n\t\t\tcategory: 'block',\n\t\t\tdescription: __( 'Copy the selected block(s).' ),\n\t\t\tkeyCombination: {\n\t\t\t\tmodifier: 'primary',\n\t\t\t\tcharacter: 'c',\n\t\t\t},\n\t\t} );\n\n\t\tregisterShortcut( {\n\t\t\tname: 'core/block-editor/cut',\n\t\t\tcategory: 'block',\n\t\t\tdescription: __( 'Cut the selected block(s).' ),\n\t\t\tkeyCombination: {\n\t\t\t\tmodifier: 'primary',\n\t\t\t\tcharacter: 'x',\n\t\t\t},\n\t\t} );\n\n\t\tregisterShortcut( {\n\t\t\tname: 'core/block-editor/paste',\n\t\t\tcategory: 'block',\n\t\t\tdescription: __( 'Paste the selected block(s).' ),\n\t\t\tkeyCombination: {\n\t\t\t\tmodifier: 'primary',\n\t\t\t\tcharacter: 'v',\n\t\t\t},\n\t\t} );\n\n\t\tregisterShortcut( {\n\t\t\tname: 'core/block-editor/duplicate',\n\t\t\tcategory: 'block',\n\t\t\tdescription: __( 'Duplicate the selected block(s).' ),\n\t\t\tkeyCombination: {\n\t\t\t\tmodifier: 'primaryShift',\n\t\t\t\tcharacter: 'd',\n\t\t\t},\n\t\t} );\n\n\t\tregisterShortcut( {\n\t\t\tname: 'core/block-editor/remove',\n\t\t\tcategory: 'block',\n\t\t\tdescription: __( 'Remove the selected block(s).' ),\n\t\t\tkeyCombination: {\n\t\t\t\tmodifier: 'access',\n\t\t\t\tcharacter: 'z',\n\t\t\t},\n\t\t} );\n\n\t\tregisterShortcut( {\n\t\t\tname: 'core/block-editor/paste-styles',\n\t\t\tcategory: 'block',\n\t\t\tdescription: __(\n\t\t\t\t'Paste the copied style to the selected block(s).'\n\t\t\t),\n\t\t\tkeyCombination: {\n\t\t\t\tmodifier: 'primaryAlt',\n\t\t\t\tcharacter: 'v',\n\t\t\t},\n\t\t} );\n\n\t\tregisterShortcut( {\n\t\t\tname: 'core/block-editor/insert-before',\n\t\t\tcategory: 'block',\n\t\t\tdescription: __(\n\t\t\t\t'Insert a new block before the selected block(s).'\n\t\t\t),\n\t\t\tkeyCombination: {\n\t\t\t\tmodifier: 'primaryAlt',\n\t\t\t\tcharacter: 't',\n\t\t\t},\n\t\t} );\n\n\t\tregisterShortcut( {\n\t\t\tname: 'core/block-editor/insert-after',\n\t\t\tcategory: 'block',\n\t\t\tdescription: __(\n\t\t\t\t'Insert a new block after the selected block(s).'\n\t\t\t),\n\t\t\tkeyCombination: {\n\t\t\t\tmodifier: 'primaryAlt',\n\t\t\t\tcharacter: 'y',\n\t\t\t},\n\t\t} );\n\n\t\tregisterShortcut( {\n\t\t\tname: 'core/block-editor/delete-multi-selection',\n\t\t\tcategory: 'block',\n\t\t\tdescription: __( 'Delete selection.' ),\n\t\t\tkeyCombination: {\n\t\t\t\tcharacter: 'del',\n\t\t\t},\n\t\t\taliases: [\n\t\t\t\t{\n\t\t\t\t\tcharacter: 'backspace',\n\t\t\t\t},\n\t\t\t],\n\t\t} );\n\n\t\tregisterShortcut( {\n\t\t\tname: 'core/block-editor/select-all',\n\t\t\tcategory: 'selection',\n\t\t\tdescription: __(\n\t\t\t\t'Select all text when typing. Press again to select all blocks.'\n\t\t\t),\n\t\t\tkeyCombination: {\n\t\t\t\tmodifier: 'primary',\n\t\t\t\tcharacter: 'a',\n\t\t\t},\n\t\t} );\n\n\t\tregisterShortcut( {\n\t\t\tname: 'core/block-editor/unselect',\n\t\t\tcategory: 'selection',\n\t\t\tdescription: __( 'Clear selection.' ),\n\t\t\tkeyCombination: {\n\t\t\t\tcharacter: 'escape',\n\t\t\t},\n\t\t} );\n\n\t\tregisterShortcut( {\n\t\t\tname: 'core/block-editor/multi-text-selection',\n\t\t\tcategory: 'selection',\n\t\t\tdescription: __( 'Select text across multiple blocks.' ),\n\t\t\tkeyCombination: {\n\t\t\t\tmodifier: 'shift',\n\t\t\t\tcharacter: 'arrow',\n\t\t\t},\n\t\t} );\n\n\t\tregisterShortcut( {\n\t\t\tname: 'core/block-editor/focus-toolbar',\n\t\t\tcategory: 'global',\n\t\t\tdescription: __( 'Navigate to the nearest toolbar.' ),\n\t\t\tkeyCombination: {\n\t\t\t\tmodifier: 'alt',\n\t\t\t\tcharacter: 'F10',\n\t\t\t},\n\t\t} );\n\n\t\tregisterShortcut( {\n\t\t\tname: 'core/block-editor/move-up',\n\t\t\tcategory: 'block',\n\t\t\tdescription: __( 'Move the selected block(s) up.' ),\n\t\t\tkeyCombination: {\n\t\t\t\tmodifier: 'secondary',\n\t\t\t\tcharacter: 't',\n\t\t\t},\n\t\t} );\n\n\t\tregisterShortcut( {\n\t\t\tname: 'core/block-editor/move-down',\n\t\t\tcategory: 'block',\n\t\t\tdescription: __( 'Move the selected block(s) down.' ),\n\t\t\tkeyCombination: {\n\t\t\t\tmodifier: 'secondary',\n\t\t\t\tcharacter: 'y',\n\t\t\t},\n\t\t} );\n\n\t\t// List view shortcuts.\n\t\tregisterShortcut( {\n\t\t\tname: 'core/block-editor/collapse-list-view',\n\t\t\tcategory: 'list-view',\n\t\t\tdescription: __( 'Collapse all other items.' ),\n\t\t\tkeyCombination: {\n\t\t\t\tmodifier: 'alt',\n\t\t\t\tcharacter: 'l',\n\t\t\t},\n\t\t} );\n\n\t\tregisterShortcut( {\n\t\t\tname: 'core/block-editor/group',\n\t\t\tcategory: 'block',\n\t\t\tdescription: __(\n\t\t\t\t'Create a group block from the selected multiple blocks.'\n\t\t\t),\n\t\t\tkeyCombination: {\n\t\t\t\tmodifier: 'primary',\n\t\t\t\tcharacter: 'g',\n\t\t\t},\n\t\t} );\n\t}, [ registerShortcut ] );\n\n\treturn null;\n}\n\nKeyboardShortcuts.Register = KeyboardShortcutsRegister;\n\nexport default KeyboardShortcuts;\n"],"mappings":";;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,kBAAA,GAAAF,OAAA;AACA,IAAAG,KAAA,GAAAH,OAAA;AANA;AACA;AACA;;AAMA,SAASI,iBAAiBA,CAAA,EAAG;EAC5B,OAAO,IAAI;AACZ;AAEA,SAASC,yBAAyBA,CAAA,EAAG;EACpC;EACA,MAAM;IAAEC;EAAiB,CAAC,GAAG,IAAAC,iBAAW,EAAEC,wBAAuB,CAAC;EAClE,IAAAC,kBAAS,EAAE,MAAM;IAChBH,gBAAgB,CAAE;MACjBI,IAAI,EAAE,wBAAwB;MAC9BC,QAAQ,EAAE,OAAO;MACjBC,WAAW,EAAE,IAAAC,QAAE,EAAE,6BAA8B,CAAC;MAChDC,cAAc,EAAE;QACfC,QAAQ,EAAE,SAAS;QACnBC,SAAS,EAAE;MACZ;IACD,CAAE,CAAC;IAEHV,gBAAgB,CAAE;MACjBI,IAAI,EAAE,uBAAuB;MAC7BC,QAAQ,EAAE,OAAO;MACjBC,WAAW,EAAE,IAAAC,QAAE,EAAE,4BAA6B,CAAC;MAC/CC,cAAc,EAAE;QACfC,QAAQ,EAAE,SAAS;QACnBC,SAAS,EAAE;MACZ;IACD,CAAE,CAAC;IAEHV,gBAAgB,CAAE;MACjBI,IAAI,EAAE,yBAAyB;MAC/BC,QAAQ,EAAE,OAAO;MACjBC,WAA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;MACZ;IACD,CAAE,CAAC;IAEHV,gBAAgB,CAAE;MACjBI,IAAI,EAAE,6BAA6B;MACnCC,QAAQ,EAAE,OAAO;MACjBC,WAAW,EAAE,IAAAC,QAAE,EAAE,kCAAmC,CAAC;MACrDC,cAAc,EAAE;QACfC,QAAQ,EAAE,WAAW;QACrBC,SAAS,EAAE;MACZ;IACD,CAAE,CAAC;;IAEH;IACAV,gBAAgB,CAAE;MACjBI,IAAI,EAAE,sCAAsC;MAC5CC,QAAQ,EAAE,WAAW;MACrBC,WAAW,EAAE,IAAAC,QAAE,EAAE,2BAA4B,CAAC;MAC9CC,cAAc,EAAE;QACfC,QAAQ,EAAE,KAAK;QACfC,SAAS,EAAE;MACZ;IACD,CAAE,CAAC;IAEHV,gBAAgB,CAAE;MACjBI,IAAI,EAAE,yBAAyB;MAC/BC,QAAQ,EAAE,OAAO;MACjBC,WAAW,EAAE,IAAAC,QAAE,EACd,yDACD,CAAC;MACDC,cAAc,EAAE;QACfC,QAAQ,EAAE,SAAS;QACnBC,SAAS,EAAE;MACZ;IACD,CAAE,CAAC;EACJ,CAAC,EAAE,CAAEV,gBAAgB,CAAG,CAAC;EAEzB,OAAO,IAAI;AACZ;AAEAF,iBAAiB,CAACc,QAAQ,GAAGb,yBAAyB;AAAC,IAAAc,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAExCjB,iBAAiB","ignoreList":[]}
|
|
@@ -47,7 +47,8 @@ const InsertFromURLPopover = ({
|
|
|
47
47
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.__experimentalInputControl, {
|
|
48
48
|
__next40pxDefaultSize: true,
|
|
49
49
|
label: (0, _i18n.__)('URL'),
|
|
50
|
-
type: "
|
|
50
|
+
type: "text" // Use text instead of URL to allow relative paths (e.g., /image/image.jpg)
|
|
51
|
+
,
|
|
51
52
|
hideLabelFromVision: true,
|
|
52
53
|
placeholder: (0, _i18n.__)('Paste or type URL'),
|
|
53
54
|
onChange: onChange,
|