@wordpress/block-editor 15.14.0 → 15.14.1-next.v.202603102151.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/build/components/block-tools/index.cjs +4 -3
- package/build/components/block-tools/index.cjs.map +2 -2
- package/build/components/iframe/index.cjs +14 -6
- package/build/components/iframe/index.cjs.map +2 -2
- package/build/components/observe-typing/index.cjs +9 -13
- package/build/components/observe-typing/index.cjs.map +2 -2
- package/build/components/provider/index.cjs +22 -6
- package/build/components/provider/index.cjs.map +2 -2
- package/build/hooks/block-fields/index.cjs +52 -31
- package/build/hooks/block-fields/index.cjs.map +2 -2
- package/build/hooks/cross-origin-isolation.cjs +7 -73
- package/build/hooks/cross-origin-isolation.cjs.map +2 -2
- package/build/private-apis.cjs +1 -0
- package/build/private-apis.cjs.map +2 -2
- package/build/store/private-keys.cjs +3 -0
- package/build/store/private-keys.cjs.map +2 -2
- package/build/store/selectors.cjs +9 -7
- package/build/store/selectors.cjs.map +2 -2
- package/build-module/components/block-tools/index.mjs +4 -3
- package/build-module/components/block-tools/index.mjs.map +2 -2
- package/build-module/components/iframe/index.mjs +14 -6
- package/build-module/components/iframe/index.mjs.map +2 -2
- package/build-module/components/observe-typing/index.mjs +9 -13
- package/build-module/components/observe-typing/index.mjs.map +2 -2
- package/build-module/components/provider/index.mjs +22 -6
- package/build-module/components/provider/index.mjs.map +2 -2
- package/build-module/hooks/block-fields/index.mjs +53 -32
- package/build-module/hooks/block-fields/index.mjs.map +2 -2
- package/build-module/hooks/cross-origin-isolation.mjs +7 -73
- package/build-module/hooks/cross-origin-isolation.mjs.map +2 -2
- package/build-module/private-apis.mjs +3 -1
- package/build-module/private-apis.mjs.map +2 -2
- package/build-module/store/private-keys.mjs +2 -0
- package/build-module/store/private-keys.mjs.map +2 -2
- package/build-module/store/selectors.mjs +9 -7
- package/build-module/store/selectors.mjs.map +2 -2
- package/build-style/style-rtl.css +8 -5
- package/build-style/style.css +8 -5
- package/package.json +39 -39
- package/src/components/block-tools/index.js +11 -4
- package/src/components/iframe/index.js +19 -6
- package/src/components/observe-typing/index.js +10 -14
- package/src/components/provider/index.js +47 -5
- package/src/components/responsive-block-control/style.scss +1 -0
- package/src/hooks/block-fields/index.js +44 -19
- package/src/hooks/block-fields/styles.scss +7 -9
- package/src/hooks/cross-origin-isolation.js +8 -107
- package/src/hooks/test/cross-origin-isolation.js +11 -42
- package/src/private-apis.js +2 -0
- package/src/store/private-keys.js +1 -0
- package/src/store/selectors.js +27 -9
- package/src/store/test/selectors.js +540 -0
|
@@ -35,6 +35,7 @@ __export(block_fields_exports, {
|
|
|
35
35
|
});
|
|
36
36
|
module.exports = __toCommonJS(block_fields_exports);
|
|
37
37
|
var import_blocks = require("@wordpress/blocks");
|
|
38
|
+
var import_compose = require("@wordpress/compose");
|
|
38
39
|
var import_components = require("@wordpress/components");
|
|
39
40
|
var import_data = require("@wordpress/data");
|
|
40
41
|
var import_dataviews = require("@wordpress/dataviews");
|
|
@@ -63,7 +64,7 @@ function BlockFields({
|
|
|
63
64
|
clientId,
|
|
64
65
|
blockType,
|
|
65
66
|
setAttributes,
|
|
66
|
-
|
|
67
|
+
isMultiBlock = false
|
|
67
68
|
}) {
|
|
68
69
|
const blockTitle = (0, import_use_block_display_title.default)({
|
|
69
70
|
clientId,
|
|
@@ -97,15 +98,20 @@ function BlockFields({
|
|
|
97
98
|
},
|
|
98
99
|
[blockContext, clientId]
|
|
99
100
|
);
|
|
101
|
+
const { selectBlock, toggleBlockHighlight } = (0, import_data.useDispatch)(import_store.store);
|
|
102
|
+
const debouncedToggleBlockHighlight = (0, import_compose.useDebounce)(
|
|
103
|
+
toggleBlockHighlight,
|
|
104
|
+
50
|
|
105
|
+
);
|
|
100
106
|
const computedForm = (0, import_element.useMemo)(() => {
|
|
101
|
-
if (!
|
|
107
|
+
if (!isMultiBlock) {
|
|
102
108
|
return blockType?.[formKey];
|
|
103
109
|
}
|
|
104
110
|
return {
|
|
105
111
|
...blockType?.[formKey],
|
|
106
112
|
fields: [blockType?.[formKey]?.fields?.[0]]
|
|
107
113
|
};
|
|
108
|
-
}, [blockType,
|
|
114
|
+
}, [blockType, isMultiBlock]);
|
|
109
115
|
const [form, setForm] = (0, import_element.useState)(computedForm);
|
|
110
116
|
const dataFormFields = (0, import_element.useMemo)(() => {
|
|
111
117
|
if (!blockTypeFields?.length) {
|
|
@@ -146,38 +152,53 @@ function BlockFields({
|
|
|
146
152
|
};
|
|
147
153
|
});
|
|
148
154
|
};
|
|
149
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
155
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
156
|
+
"div",
|
|
157
|
+
{
|
|
158
|
+
className: "block-editor-block-fields__container",
|
|
159
|
+
onMouseEnter: isMultiBlock ? () => debouncedToggleBlockHighlight(clientId, true) : void 0,
|
|
160
|
+
onMouseLeave: () => isMultiBlock ? debouncedToggleBlockHighlight(clientId, false) : void 0,
|
|
161
|
+
onFocus: isMultiBlock ? () => {
|
|
162
|
+
selectBlock(
|
|
163
|
+
clientId,
|
|
164
|
+
null
|
|
165
|
+
/* null to avoid focus on the block in the canvas */
|
|
166
|
+
);
|
|
167
|
+
} : void 0,
|
|
168
|
+
children: [
|
|
169
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "block-editor-block-fields__header", children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_components.__experimentalHStack, { spacing: 1, children: [
|
|
170
|
+
isMultiBlock && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
171
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
172
|
+
import_block_icon.default,
|
|
173
|
+
{
|
|
174
|
+
className: "block-editor-block-fields__header-icon",
|
|
175
|
+
icon: blockInformation?.icon
|
|
176
|
+
}
|
|
177
|
+
),
|
|
178
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("h2", { className: "block-editor-block-fields__header-title", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_components.__experimentalTruncate, { numberOfLines: 1, children: blockTitle }) }),
|
|
179
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
180
|
+
import_fields_dropdown_menu.default,
|
|
181
|
+
{
|
|
182
|
+
fields: dataFormFields,
|
|
183
|
+
visibleFields: form.fields,
|
|
184
|
+
onToggleField: handleToggleField
|
|
185
|
+
}
|
|
186
|
+
)
|
|
187
|
+
] }),
|
|
188
|
+
!isMultiBlock && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("h2", { className: "block-editor-block-fields__header-title", children: (0, import_i18n.__)("Content") })
|
|
189
|
+
] }) }),
|
|
160
190
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
161
|
-
|
|
191
|
+
import_dataviews.DataForm,
|
|
162
192
|
{
|
|
193
|
+
data: attributes,
|
|
163
194
|
fields: dataFormFields,
|
|
164
|
-
|
|
165
|
-
|
|
195
|
+
form,
|
|
196
|
+
onChange: setAttributes
|
|
166
197
|
}
|
|
167
198
|
)
|
|
168
|
-
]
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
172
|
-
import_dataviews.DataForm,
|
|
173
|
-
{
|
|
174
|
-
data: attributes,
|
|
175
|
-
fields: dataFormFields,
|
|
176
|
-
form,
|
|
177
|
-
onChange: setAttributes
|
|
178
|
-
}
|
|
179
|
-
)
|
|
180
|
-
] });
|
|
199
|
+
]
|
|
200
|
+
}
|
|
201
|
+
);
|
|
181
202
|
}
|
|
182
203
|
function hasBlockFieldsSupport(blockName) {
|
|
183
204
|
return !!(window?.__experimentalContentOnlyInspectorFields && (0, import_blocks.getBlockType)(blockName)?.[fieldsKey]);
|
|
@@ -189,7 +210,7 @@ function BlockFieldsPanel(props) {
|
|
|
189
210
|
{
|
|
190
211
|
...props,
|
|
191
212
|
blockType,
|
|
192
|
-
|
|
213
|
+
isMultiBlock: isSelectionWithinCurrentSection
|
|
193
214
|
}
|
|
194
215
|
) });
|
|
195
216
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/hooks/block-fields/index.js"],
|
|
4
|
-
"sourcesContent": ["
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;
|
|
4
|
+
"sourcesContent": ["import {\n\tprivateApis as blocksPrivateApis,\n\tgetBlockType,\n\tstore as blocksStore,\n} from '@wordpress/blocks';\nimport { useDebounce } from '@wordpress/compose';\nimport {\n\t__experimentalHStack as HStack,\n\t__experimentalTruncate as Truncate,\n} from '@wordpress/components';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { DataForm } from '@wordpress/dataviews';\nimport { useContext, useState, useMemo } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport { store as blockEditorStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\nimport BlockContext from '../../components/block-context';\nimport BlockIcon from '../../components/block-icon';\nimport useBlockDisplayTitle from '../../components/block-title/use-block-display-title';\nimport useBlockDisplayInformation from '../../components/use-block-display-information';\nconst { fieldsKey, formKey } = unlock( blocksPrivateApis );\nimport FieldsDropdownMenu from './fields-dropdown-menu';\nimport { PrivateBlockContext } from '../../components/block-list/private-block-context';\nimport InspectorControls from '../../components/inspector-controls/fill';\n\n// controls\nimport RichText from './rich-text';\nimport Media from './media';\nimport Link from './link';\n\n/**\n * Creates a configured control component that wraps a custom control\n * and passes configuration as props.\n *\n * @param {Component} ControlComponent The React component for the control.\n * @param {Object} config The control configuration passed as a prop.\n *\n * @return {Function} A wrapped control component\n */\nfunction createConfiguredControl( ControlComponent, config = {} ) {\n\treturn function ConfiguredControl( props ) {\n\t\treturn <ControlComponent { ...props } config={ config } />;\n\t};\n}\n\n/**\n * Component that renders a DataForm for a single block's attributes\n * @param {Object} props\n * @param {string} props.clientId The clientId of the block.\n * @param {Object} props.blockType The blockType definition.\n * @param {Function} props.setAttributes Action to set the block's attributes.\n * @param {boolean} props.isMultiBlock Whether forms for multiple blocks are shown at the same time.\n * This changes the behavior of the component:\n * - Only the first field is shown for each block.\n * - A dropdown is rendered allowing display of additional fields.\n * - Hovering the block fields highlights the block in the canvas\n * - Focusing a block field soft-selects the block in the canvas.\n */\nfunction BlockFields( {\n\tclientId,\n\tblockType,\n\tsetAttributes,\n\tisMultiBlock = false,\n} ) {\n\tconst blockTitle = useBlockDisplayTitle( {\n\t\tclientId,\n\t\tcontext: 'list-view',\n\t} );\n\tconst blockInformation = useBlockDisplayInformation( clientId );\n\n\tconst blockTypeFields = blockType?.[ fieldsKey ];\n\n\tconst blockContext = useContext( BlockContext );\n\n\tconst attributes = useSelect(\n\t\t( select ) => {\n\t\t\tconst _attributes =\n\t\t\t\tselect( blockEditorStore ).getBlockAttributes( clientId );\n\t\t\tif ( ! _attributes?.metadata?.bindings ) {\n\t\t\t\treturn _attributes;\n\t\t\t}\n\n\t\t\tconst { getBlockBindingsSource } = unlock( select( blocksStore ) );\n\t\t\treturn Object.entries( _attributes.metadata.bindings ).reduce(\n\t\t\t\t( acc, [ attribute, binding ] ) => {\n\t\t\t\t\tconst source = getBlockBindingsSource( binding.source );\n\t\t\t\t\tif ( ! source ) {\n\t\t\t\t\t\treturn acc;\n\t\t\t\t\t}\n\t\t\t\t\tconst values = source.getValues( {\n\t\t\t\t\t\tselect,\n\t\t\t\t\t\tcontext: blockContext,\n\t\t\t\t\t\tbindings: { [ attribute ]: binding },\n\t\t\t\t\t} );\n\t\t\t\t\treturn { ...acc, ...values };\n\t\t\t\t},\n\t\t\t\t_attributes\n\t\t\t);\n\t\t},\n\t\t[ blockContext, clientId ]\n\t);\n\tconst { selectBlock, toggleBlockHighlight } =\n\t\tuseDispatch( blockEditorStore );\n\n\tconst debouncedToggleBlockHighlight = useDebounce(\n\t\ttoggleBlockHighlight,\n\t\t50\n\t);\n\n\tconst computedForm = useMemo( () => {\n\t\tif ( ! isMultiBlock ) {\n\t\t\treturn blockType?.[ formKey ];\n\t\t}\n\n\t\t// For a collapsed form only show the first field by default.\n\t\treturn {\n\t\t\t...blockType?.[ formKey ],\n\t\t\tfields: [ blockType?.[ formKey ]?.fields?.[ 0 ] ],\n\t\t};\n\t}, [ blockType, isMultiBlock ] );\n\n\tconst [ form, setForm ] = useState( computedForm );\n\n\t// Build DataForm fields with proper structure\n\tconst dataFormFields = useMemo( () => {\n\t\tif ( ! blockTypeFields?.length ) {\n\t\t\treturn [];\n\t\t}\n\n\t\treturn blockTypeFields.map( ( fieldDef ) => {\n\t\t\tconst field = {\n\t\t\t\t...fieldDef,\n\t\t\t};\n\n\t\t\t// These should be custom Edit components, not replaced here.\n\t\t\t//\n\t\t\t// - rich-text control: it needs clientId\n\t\t\t// - link control: does not need anything extra\n\t\t\t// - media control: needs the Edit config\n\t\t\tif (\n\t\t\t\t'string' === typeof fieldDef.Edit &&\n\t\t\t\tfieldDef.Edit === 'rich-text'\n\t\t\t) {\n\t\t\t\tfield.Edit = createConfiguredControl( RichText, {\n\t\t\t\t\tclientId,\n\t\t\t\t} );\n\t\t\t} else if (\n\t\t\t\t'string' === typeof fieldDef.Edit &&\n\t\t\t\tfieldDef.Edit === 'link'\n\t\t\t) {\n\t\t\t\tfield.Edit = createConfiguredControl( Link );\n\t\t\t} else if (\n\t\t\t\t'object' === typeof fieldDef.Edit &&\n\t\t\t\tfieldDef.Edit.control === 'media'\n\t\t\t) {\n\t\t\t\tfield.Edit = createConfiguredControl( Media, {\n\t\t\t\t\t...fieldDef.Edit,\n\t\t\t\t} );\n\t\t\t}\n\n\t\t\treturn field;\n\t\t} );\n\t}, [ blockTypeFields, clientId ] );\n\n\tif ( ! blockTypeFields?.length ) {\n\t\t// TODO - we might still want to show a placeholder for blocks with no fields.\n\t\t// for example, a way to select the block.\n\t\treturn null;\n\t}\n\n\tconst handleToggleField = ( fieldId ) => {\n\t\tsetForm( ( prev ) => {\n\t\t\tif ( prev.fields?.includes( fieldId ) ) {\n\t\t\t\treturn {\n\t\t\t\t\t...prev,\n\t\t\t\t\tfields: prev.fields.filter( ( id ) => id !== fieldId ),\n\t\t\t\t};\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\t...prev,\n\t\t\t\tfields: [ ...( prev.fields || [] ), fieldId ],\n\t\t\t};\n\t\t} );\n\t};\n\n\treturn (\n\t\t<div\n\t\t\tclassName=\"block-editor-block-fields__container\"\n\t\t\tonMouseEnter={\n\t\t\t\tisMultiBlock\n\t\t\t\t\t? () => debouncedToggleBlockHighlight( clientId, true )\n\t\t\t\t\t: undefined\n\t\t\t}\n\t\t\tonMouseLeave={ () =>\n\t\t\t\tisMultiBlock\n\t\t\t\t\t? debouncedToggleBlockHighlight( clientId, false )\n\t\t\t\t\t: undefined\n\t\t\t}\n\t\t\tonFocus={\n\t\t\t\tisMultiBlock\n\t\t\t\t\t? () => {\n\t\t\t\t\t\t\tselectBlock(\n\t\t\t\t\t\t\t\tclientId,\n\t\t\t\t\t\t\t\tnull /* null to avoid focus on the block in the canvas */\n\t\t\t\t\t\t\t);\n\t\t\t\t\t }\n\t\t\t\t\t: undefined\n\t\t\t}\n\t\t>\n\t\t\t<div className=\"block-editor-block-fields__header\">\n\t\t\t\t<HStack spacing={ 1 }>\n\t\t\t\t\t{ isMultiBlock && (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t<BlockIcon\n\t\t\t\t\t\t\t\tclassName=\"block-editor-block-fields__header-icon\"\n\t\t\t\t\t\t\t\ticon={ blockInformation?.icon }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<h2 className=\"block-editor-block-fields__header-title\">\n\t\t\t\t\t\t\t\t<Truncate numberOfLines={ 1 }>\n\t\t\t\t\t\t\t\t\t{ blockTitle }\n\t\t\t\t\t\t\t\t</Truncate>\n\t\t\t\t\t\t\t</h2>\n\t\t\t\t\t\t\t<FieldsDropdownMenu\n\t\t\t\t\t\t\t\tfields={ dataFormFields }\n\t\t\t\t\t\t\t\tvisibleFields={ form.fields }\n\t\t\t\t\t\t\t\tonToggleField={ handleToggleField }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</>\n\t\t\t\t\t) }\n\t\t\t\t\t{ ! isMultiBlock && (\n\t\t\t\t\t\t<h2 className=\"block-editor-block-fields__header-title\">\n\t\t\t\t\t\t\t{ __( 'Content' ) }\n\t\t\t\t\t\t</h2>\n\t\t\t\t\t) }\n\t\t\t\t</HStack>\n\t\t\t</div>\n\t\t\t<DataForm\n\t\t\t\tdata={ attributes }\n\t\t\t\tfields={ dataFormFields }\n\t\t\t\tform={ form }\n\t\t\t\tonChange={ setAttributes }\n\t\t\t/>\n\t\t</div>\n\t);\n}\n\nfunction hasBlockFieldsSupport( blockName ) {\n\treturn !! (\n\t\twindow?.__experimentalContentOnlyInspectorFields &&\n\t\tgetBlockType( blockName )?.[ fieldsKey ]\n\t);\n}\n\nexport function BlockFieldsPanel( props ) {\n\tconst { blockType, isSelectionWithinCurrentSection } =\n\t\tuseContext( PrivateBlockContext );\n\n\treturn (\n\t\t<InspectorControls group=\"content\">\n\t\t\t<BlockFields\n\t\t\t\t{ ...props }\n\t\t\t\tblockType={ blockType }\n\t\t\t\tisMultiBlock={ isSelectionWithinCurrentSection }\n\t\t\t/>\n\t\t</InspectorControls>\n\t);\n}\n\n/**\n * Export block support definition.\n */\nexport default {\n\tedit: BlockFieldsPanel,\n\thasSupport: hasBlockFieldsSupport,\n\tattributeKeys: [],\n\tsupportsPatternEditing: true,\n};\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oBAIO;AACP,qB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S;AAAA,YACT;AAAA,YACA,UAAW;AAAA;AAAA,QACZ;AAAA;AAAA;AAAA,EACD;AAEF;AAEA,SAAS,sBAAuB,WAAY;AAC3C,SAAO,CAAC,EACP,QAAQ,gDACR,4BAAc,SAAU,IAAK,SAAU;AAEzC;AAEO,SAAS,iBAAkB,OAAQ;AACzC,QAAM,EAAE,WAAW,gCAAgC,QAClD,2BAAY,gDAAoB;AAEjC,SACC,4CAAC,YAAAC,SAAA,EAAkB,OAAM,WACxB;AAAA,IAAC;AAAA;AAAA,MACE,GAAG;AAAA,MACL;AAAA,MACA,cAAe;AAAA;AAAA,EAChB,GACD;AAEF;AAKA,IAAO,uBAAQ;AAAA,EACd,MAAM;AAAA,EACN,YAAY;AAAA,EACZ,eAAe,CAAC;AAAA,EAChB,wBAAwB;AACzB;",
|
|
6
6
|
"names": ["blocksPrivateApis", "useBlockDisplayTitle", "useBlockDisplayInformation", "BlockContext", "blockEditorStore", "blocksStore", "RichText", "Link", "Media", "HStack", "BlockIcon", "Truncate", "FieldsDropdownMenu", "InspectorControls"]
|
|
7
7
|
}
|
|
@@ -1,22 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
// packages/block-editor/src/hooks/cross-origin-isolation.js
|
|
4
|
-
|
|
5
|
-
var import_compose = require("@wordpress/compose");
|
|
6
|
-
var import_jsx_runtime = require("react/jsx-runtime");
|
|
7
|
-
function addCrossOriginAttributes(el) {
|
|
4
|
+
function addCrossOriginAttribute(el) {
|
|
8
5
|
if (!el.hasAttribute("crossorigin")) {
|
|
9
6
|
el.setAttribute("crossorigin", "anonymous");
|
|
10
7
|
}
|
|
11
|
-
if (el.nodeName === "IFRAME" && !el.hasAttribute("credentialless")) {
|
|
12
|
-
if (el.getAttribute("src")?.startsWith("blob:")) {
|
|
13
|
-
return;
|
|
14
|
-
}
|
|
15
|
-
el.setAttribute("credentialless", "");
|
|
16
|
-
const origSrc = el.getAttribute("src") || "";
|
|
17
|
-
el.setAttribute("src", "");
|
|
18
|
-
el.setAttribute("src", origSrc);
|
|
19
|
-
}
|
|
20
8
|
}
|
|
21
9
|
if (window.crossOriginIsolated) {
|
|
22
10
|
let startObservingBody = function() {
|
|
@@ -49,42 +37,14 @@ if (window.crossOriginIsolated) {
|
|
|
49
37
|
return;
|
|
50
38
|
}
|
|
51
39
|
el.querySelectorAll(
|
|
52
|
-
"img,source,script,video,link
|
|
40
|
+
"img,source,script,video,link"
|
|
53
41
|
).forEach((v) => {
|
|
54
|
-
|
|
42
|
+
addCrossOriginAttribute(v);
|
|
55
43
|
});
|
|
56
|
-
if (
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
);
|
|
61
|
-
if (!isEmbedSandboxIframe) {
|
|
62
|
-
iframeNode.addEventListener("load", () => {
|
|
63
|
-
try {
|
|
64
|
-
if (iframeNode.contentDocument && iframeNode.contentDocument.body) {
|
|
65
|
-
observer.observe(
|
|
66
|
-
iframeNode.contentDocument,
|
|
67
|
-
{
|
|
68
|
-
childList: true,
|
|
69
|
-
attributes: true,
|
|
70
|
-
subtree: true
|
|
71
|
-
}
|
|
72
|
-
);
|
|
73
|
-
}
|
|
74
|
-
} catch (e) {
|
|
75
|
-
}
|
|
76
|
-
});
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
if ([
|
|
80
|
-
"IMG",
|
|
81
|
-
"SOURCE",
|
|
82
|
-
"SCRIPT",
|
|
83
|
-
"VIDEO",
|
|
84
|
-
"LINK",
|
|
85
|
-
"IFRAME"
|
|
86
|
-
].includes(el.nodeName)) {
|
|
87
|
-
addCrossOriginAttributes(el);
|
|
44
|
+
if (["IMG", "SOURCE", "SCRIPT", "VIDEO", "LINK"].includes(
|
|
45
|
+
el.nodeName
|
|
46
|
+
)) {
|
|
47
|
+
addCrossOriginAttribute(el);
|
|
88
48
|
}
|
|
89
49
|
});
|
|
90
50
|
});
|
|
@@ -93,30 +53,4 @@ if (window.crossOriginIsolated) {
|
|
|
93
53
|
startObservingBody();
|
|
94
54
|
}
|
|
95
55
|
var startObservingBody2;
|
|
96
|
-
if (window.crossOriginIsolated) {
|
|
97
|
-
const supportsCredentialless = "credentialless" in window.HTMLIFrameElement.prototype;
|
|
98
|
-
const disableEmbedPreviews = (0, import_compose.createHigherOrderComponent)(
|
|
99
|
-
(BlockEdit) => function DisableEmbedPreviews(props) {
|
|
100
|
-
if ("core/embed" !== props.name) {
|
|
101
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(BlockEdit, { ...props });
|
|
102
|
-
}
|
|
103
|
-
const previewable = supportsCredentialless && !["facebook", "smugmug"].includes(
|
|
104
|
-
props.attributes.providerNameSlug
|
|
105
|
-
);
|
|
106
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
107
|
-
BlockEdit,
|
|
108
|
-
{
|
|
109
|
-
...props,
|
|
110
|
-
attributes: { ...props.attributes, previewable }
|
|
111
|
-
}
|
|
112
|
-
);
|
|
113
|
-
},
|
|
114
|
-
"withDisabledEmbedPreview"
|
|
115
|
-
);
|
|
116
|
-
(0, import_hooks.addFilter)(
|
|
117
|
-
"editor.BlockEdit",
|
|
118
|
-
"media-experiments/disable-embed-previews",
|
|
119
|
-
disableEmbedPreviews
|
|
120
|
-
);
|
|
121
|
-
}
|
|
122
56
|
//# sourceMappingURL=cross-origin-isolation.cjs.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/hooks/cross-origin-isolation.js"],
|
|
4
|
-
"sourcesContent": ["/**\n *
|
|
5
|
-
"mappings": ";;;
|
|
4
|
+
"sourcesContent": ["/**\n * Adds crossorigin=\"anonymous\" to an element if missing.\n *\n * @param {Element} el The element to modify.\n */\nfunction addCrossOriginAttribute( el ) {\n\tif ( ! el.hasAttribute( 'crossorigin' ) ) {\n\t\tel.setAttribute( 'crossorigin', 'anonymous' );\n\t}\n}\n\n// Only add the mutation observer if the site is cross-origin isolated.\nif ( window.crossOriginIsolated ) {\n\t/*\n\t * Detects dynamically added DOM nodes that are missing the `crossorigin` attribute.\n\t */\n\tconst observer = new window.MutationObserver( ( mutations ) => {\n\t\tmutations.forEach( ( mutation ) => {\n\t\t\t[ mutation.addedNodes, mutation.target ].forEach( ( value ) => {\n\t\t\t\tconst nodes =\n\t\t\t\t\tvalue instanceof window.NodeList ? value : [ value ];\n\t\t\t\tnodes.forEach( ( node ) => {\n\t\t\t\t\tconst el = node;\n\n\t\t\t\t\tif ( ! el.querySelectorAll ) {\n\t\t\t\t\t\t// Most likely a text node.\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\n\t\t\t\t\tel.querySelectorAll(\n\t\t\t\t\t\t'img,source,script,video,link'\n\t\t\t\t\t).forEach( ( v ) => {\n\t\t\t\t\t\taddCrossOriginAttribute( v );\n\t\t\t\t\t} );\n\n\t\t\t\t\tif (\n\t\t\t\t\t\t[ 'IMG', 'SOURCE', 'SCRIPT', 'VIDEO', 'LINK' ].includes(\n\t\t\t\t\t\t\tel.nodeName\n\t\t\t\t\t\t)\n\t\t\t\t\t) {\n\t\t\t\t\t\taddCrossOriginAttribute( el );\n\t\t\t\t\t}\n\t\t\t\t} );\n\t\t\t} );\n\t\t} );\n\t} );\n\n\t/**\n\t * Start observing the document body, waiting for it to be available if needed.\n\t */\n\tfunction startObservingBody() {\n\t\tif ( document.body ) {\n\t\t\tobserver.observe( document.body, {\n\t\t\t\tchildList: true,\n\t\t\t\tattributes: true,\n\t\t\t\tsubtree: true,\n\t\t\t} );\n\t\t} else if ( document.readyState === 'loading' ) {\n\t\t\t// Wait for DOM to be ready.\n\t\t\tdocument.addEventListener( 'DOMContentLoaded', () => {\n\t\t\t\tif ( document.body ) {\n\t\t\t\t\tobserver.observe( document.body, {\n\t\t\t\t\t\tchildList: true,\n\t\t\t\t\t\tattributes: true,\n\t\t\t\t\t\tsubtree: true,\n\t\t\t\t\t} );\n\t\t\t\t}\n\t\t\t} );\n\t\t}\n\t}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AAAA;",
|
|
6
6
|
"names": ["startObservingBody"]
|
|
7
7
|
}
|
package/build/private-apis.cjs
CHANGED
|
@@ -127,6 +127,7 @@ var privateApis = {};
|
|
|
127
127
|
deviceTypeKey: import_private_keys.deviceTypeKey,
|
|
128
128
|
isIsolatedEditorKey: import_private_keys.isIsolatedEditorKey,
|
|
129
129
|
isNavigationOverlayContextKey: import_private_keys.isNavigationOverlayContextKey,
|
|
130
|
+
mediaUploadOnSuccessKey: import_private_keys.mediaUploadOnSuccessKey,
|
|
130
131
|
useBlockElement: import_use_block_refs.useBlockElement,
|
|
131
132
|
useBlockElementRef: import_use_block_refs.useBlockElementRef,
|
|
132
133
|
LinkPicker: import_link_picker.LinkPicker,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/private-apis.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * Internal dependencies\n */\nimport * as globalStyles from './components/global-styles';\nimport { ExperimentalBlockEditorProvider } from './components/provider';\nimport { lock } from './lock-unlock';\nimport { getRichTextValues } from './components/rich-text/get-rich-text-values';\nimport ResizableBoxPopover from './components/resizable-box-popover';\nimport { default as PrivateQuickInserter } from './components/inserter/quick-inserter';\nimport {\n\textractWords,\n\tgetNormalizedSearchTerms,\n\tnormalizeString,\n} from './components/inserter/search-items';\nimport { PrivateListView } from './components/list-view';\nimport InspectorControlsLastItem from './components/inspector-controls/last-item';\nimport { useHasBlockToolbar } from './components/block-toolbar/use-has-block-toolbar';\nimport { cleanEmptyObject, usePrivateStyleOverride } from './hooks/utils';\nimport BlockQuickNavigation from './components/block-quick-navigation';\nimport { LayoutStyle } from './components/block-list/layout';\nimport BlockManager from './components/block-manager';\nimport { BlockRemovalWarningModal } from './components/block-removal-warning-modal';\nimport {\n\tsetBackgroundStyleDefaults,\n\tuseLayoutClasses,\n\tuseLayoutStyles,\n\t__unstableBlockStyleVariationOverridesWithConfig,\n\tuseZoomOut,\n} from './hooks';\nimport DimensionsTool from './components/dimensions-tool';\nimport ResolutionTool from './components/resolution-tool';\nimport TextAlignmentControl from './components/text-alignment-control';\nimport { usesContextKey } from './components/rich-text/format-edit';\nimport {\n\tExperimentalBlockCanvas,\n\tBlockCanvasCover,\n} from './components/block-canvas';\nimport { getDuotoneFilter } from './components/duotone/utils';\nimport { useFlashEditableBlocks } from './components/use-flash-editable-blocks';\nimport {\n\tselectBlockPatternsKey,\n\treusableBlocksSelectKey,\n\tglobalStylesDataKey,\n\tglobalStylesLinksDataKey,\n\tsectionRootClientIdKey,\n\tmediaEditKey,\n\tgetMediaSelectKey,\n\tdeviceTypeKey,\n\tisIsolatedEditorKey,\n\tisNavigationOverlayContextKey,\n} from './store/private-keys';\nimport { requiresWrapperOnCopy } from './components/writing-flow/utils';\nimport { PrivateRichText } from './components/rich-text/';\nimport { PrivateBlockPopover } from './components/block-popover';\nimport { PrivateInserterLibrary } from './components/inserter/library';\nimport { PrivatePublishDateTimePicker } from './components/publish-date-time-picker';\nimport useSpacingSizes from './components/spacing-sizes-control/hooks/use-spacing-sizes';\nimport useBlockDisplayTitle from './components/block-title/use-block-display-title';\nimport TabbedSidebar from './components/tabbed-sidebar';\nimport CommentIconSlotFill from './components/collab/block-comment-icon-slot';\nimport CommentIconToolbarSlotFill from './components/collab/block-comment-icon-toolbar-slot';\nimport HTMLElementControl from './components/html-element-control';\nimport {\n\tuseBlockElementRef,\n\tuseBlockElement,\n} from './components/block-list/use-block-props/use-block-refs';\nimport { LinkPicker } from './components/link-picker';\nimport useRemoteUrlData from './components/link-control/use-rich-url-data';\nimport { PrivateBlockContext } from './components/block-list/private-block-context';\nimport useListViewPanelState from './components/use-list-view-panel-state';\nimport {\n\tisHashLink,\n\tisRelativePath,\n} from './components/link-control/is-url-like';\n\n/**\n * Private @wordpress/block-editor APIs.\n */\nexport const privateApis = {};\nlock( privateApis, {\n\t...globalStyles,\n\tExperimentalBlockCanvas,\n\tBlockCanvasCover,\n\tExperimentalBlockEditorProvider,\n\tgetDuotoneFilter,\n\tgetRichTextValues,\n\tPrivateQuickInserter,\n\textractWords,\n\tgetNormalizedSearchTerms,\n\tnormalizeString,\n\tPrivateListView,\n\tResizableBoxPopover,\n\tInspectorControlsLastItem,\n\tuseHasBlockToolbar,\n\tcleanEmptyObject,\n\tusePrivateStyleOverride,\n\tBlockQuickNavigation,\n\tLayoutStyle,\n\tBlockManager,\n\tBlockRemovalWarningModal,\n\tuseLayoutClasses,\n\tuseLayoutStyles,\n\tDimensionsTool,\n\tResolutionTool,\n\tTabbedSidebar,\n\tTextAlignmentControl,\n\tusesContextKey,\n\tuseFlashEditableBlocks,\n\tHTMLElementControl,\n\tuseZoomOut,\n\tglobalStylesDataKey,\n\tglobalStylesLinksDataKey,\n\tselectBlockPatternsKey,\n\trequiresWrapperOnCopy,\n\tPrivateRichText,\n\tPrivateInserterLibrary,\n\treusableBlocksSelectKey,\n\tPrivateBlockPopover,\n\tPrivatePublishDateTimePicker,\n\tuseSpacingSizes,\n\tuseBlockDisplayTitle,\n\t__unstableBlockStyleVariationOverridesWithConfig,\n\tsetBackgroundStyleDefaults,\n\tsectionRootClientIdKey,\n\tCommentIconSlotFill,\n\tCommentIconToolbarSlotFill,\n\tmediaEditKey,\n\tgetMediaSelectKey,\n\tdeviceTypeKey,\n\tisIsolatedEditorKey,\n\tisNavigationOverlayContextKey,\n\tuseBlockElement,\n\tuseBlockElementRef,\n\tLinkPicker,\n\tuseRemoteUrlData,\n\tPrivateBlockContext,\n\tuseListViewPanelState,\n\tisHashLink,\n\tisRelativePath,\n} );\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,mBAA8B;AAC9B,sBAAgD;AAChD,yBAAqB;AACrB,kCAAkC;AAClC,mCAAgC;AAChC,4BAAgD;AAChD,0BAIO;AACP,uBAAgC;AAChC,uBAAsC;AACtC,mCAAmC;AACnC,mBAA0D;AAC1D,oCAAiC;AACjC,oBAA4B;AAC5B,2BAAyB;AACzB,yCAAyC;AACzC,mBAMO;AACP,6BAA2B;AAC3B,6BAA2B;AAC3B,oCAAiC;AACjC,yBAA+B;AAC/B,0BAGO;AACP,IAAAA,gBAAiC;AACjC,uCAAuC;AACvC,
|
|
4
|
+
"sourcesContent": ["/**\n * Internal dependencies\n */\nimport * as globalStyles from './components/global-styles';\nimport { ExperimentalBlockEditorProvider } from './components/provider';\nimport { lock } from './lock-unlock';\nimport { getRichTextValues } from './components/rich-text/get-rich-text-values';\nimport ResizableBoxPopover from './components/resizable-box-popover';\nimport { default as PrivateQuickInserter } from './components/inserter/quick-inserter';\nimport {\n\textractWords,\n\tgetNormalizedSearchTerms,\n\tnormalizeString,\n} from './components/inserter/search-items';\nimport { PrivateListView } from './components/list-view';\nimport InspectorControlsLastItem from './components/inspector-controls/last-item';\nimport { useHasBlockToolbar } from './components/block-toolbar/use-has-block-toolbar';\nimport { cleanEmptyObject, usePrivateStyleOverride } from './hooks/utils';\nimport BlockQuickNavigation from './components/block-quick-navigation';\nimport { LayoutStyle } from './components/block-list/layout';\nimport BlockManager from './components/block-manager';\nimport { BlockRemovalWarningModal } from './components/block-removal-warning-modal';\nimport {\n\tsetBackgroundStyleDefaults,\n\tuseLayoutClasses,\n\tuseLayoutStyles,\n\t__unstableBlockStyleVariationOverridesWithConfig,\n\tuseZoomOut,\n} from './hooks';\nimport DimensionsTool from './components/dimensions-tool';\nimport ResolutionTool from './components/resolution-tool';\nimport TextAlignmentControl from './components/text-alignment-control';\nimport { usesContextKey } from './components/rich-text/format-edit';\nimport {\n\tExperimentalBlockCanvas,\n\tBlockCanvasCover,\n} from './components/block-canvas';\nimport { getDuotoneFilter } from './components/duotone/utils';\nimport { useFlashEditableBlocks } from './components/use-flash-editable-blocks';\nimport {\n\tselectBlockPatternsKey,\n\treusableBlocksSelectKey,\n\tglobalStylesDataKey,\n\tglobalStylesLinksDataKey,\n\tsectionRootClientIdKey,\n\tmediaEditKey,\n\tgetMediaSelectKey,\n\tdeviceTypeKey,\n\tisIsolatedEditorKey,\n\tisNavigationOverlayContextKey,\n\tmediaUploadOnSuccessKey,\n} from './store/private-keys';\nimport { requiresWrapperOnCopy } from './components/writing-flow/utils';\nimport { PrivateRichText } from './components/rich-text/';\nimport { PrivateBlockPopover } from './components/block-popover';\nimport { PrivateInserterLibrary } from './components/inserter/library';\nimport { PrivatePublishDateTimePicker } from './components/publish-date-time-picker';\nimport useSpacingSizes from './components/spacing-sizes-control/hooks/use-spacing-sizes';\nimport useBlockDisplayTitle from './components/block-title/use-block-display-title';\nimport TabbedSidebar from './components/tabbed-sidebar';\nimport CommentIconSlotFill from './components/collab/block-comment-icon-slot';\nimport CommentIconToolbarSlotFill from './components/collab/block-comment-icon-toolbar-slot';\nimport HTMLElementControl from './components/html-element-control';\nimport {\n\tuseBlockElementRef,\n\tuseBlockElement,\n} from './components/block-list/use-block-props/use-block-refs';\nimport { LinkPicker } from './components/link-picker';\nimport useRemoteUrlData from './components/link-control/use-rich-url-data';\nimport { PrivateBlockContext } from './components/block-list/private-block-context';\nimport useListViewPanelState from './components/use-list-view-panel-state';\nimport {\n\tisHashLink,\n\tisRelativePath,\n} from './components/link-control/is-url-like';\n\n/**\n * Private @wordpress/block-editor APIs.\n */\nexport const privateApis = {};\nlock( privateApis, {\n\t...globalStyles,\n\tExperimentalBlockCanvas,\n\tBlockCanvasCover,\n\tExperimentalBlockEditorProvider,\n\tgetDuotoneFilter,\n\tgetRichTextValues,\n\tPrivateQuickInserter,\n\textractWords,\n\tgetNormalizedSearchTerms,\n\tnormalizeString,\n\tPrivateListView,\n\tResizableBoxPopover,\n\tInspectorControlsLastItem,\n\tuseHasBlockToolbar,\n\tcleanEmptyObject,\n\tusePrivateStyleOverride,\n\tBlockQuickNavigation,\n\tLayoutStyle,\n\tBlockManager,\n\tBlockRemovalWarningModal,\n\tuseLayoutClasses,\n\tuseLayoutStyles,\n\tDimensionsTool,\n\tResolutionTool,\n\tTabbedSidebar,\n\tTextAlignmentControl,\n\tusesContextKey,\n\tuseFlashEditableBlocks,\n\tHTMLElementControl,\n\tuseZoomOut,\n\tglobalStylesDataKey,\n\tglobalStylesLinksDataKey,\n\tselectBlockPatternsKey,\n\trequiresWrapperOnCopy,\n\tPrivateRichText,\n\tPrivateInserterLibrary,\n\treusableBlocksSelectKey,\n\tPrivateBlockPopover,\n\tPrivatePublishDateTimePicker,\n\tuseSpacingSizes,\n\tuseBlockDisplayTitle,\n\t__unstableBlockStyleVariationOverridesWithConfig,\n\tsetBackgroundStyleDefaults,\n\tsectionRootClientIdKey,\n\tCommentIconSlotFill,\n\tCommentIconToolbarSlotFill,\n\tmediaEditKey,\n\tgetMediaSelectKey,\n\tdeviceTypeKey,\n\tisIsolatedEditorKey,\n\tisNavigationOverlayContextKey,\n\tmediaUploadOnSuccessKey,\n\tuseBlockElement,\n\tuseBlockElementRef,\n\tLinkPicker,\n\tuseRemoteUrlData,\n\tPrivateBlockContext,\n\tuseListViewPanelState,\n\tisHashLink,\n\tisRelativePath,\n} );\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,mBAA8B;AAC9B,sBAAgD;AAChD,yBAAqB;AACrB,kCAAkC;AAClC,mCAAgC;AAChC,4BAAgD;AAChD,0BAIO;AACP,uBAAgC;AAChC,uBAAsC;AACtC,mCAAmC;AACnC,mBAA0D;AAC1D,oCAAiC;AACjC,oBAA4B;AAC5B,2BAAyB;AACzB,yCAAyC;AACzC,mBAMO;AACP,6BAA2B;AAC3B,6BAA2B;AAC3B,oCAAiC;AACjC,yBAA+B;AAC/B,0BAGO;AACP,IAAAA,gBAAiC;AACjC,uCAAuC;AACvC,0BAYO;AACP,IAAAA,gBAAsC;AACtC,uBAAgC;AAChC,2BAAoC;AACpC,qBAAuC;AACvC,sCAA6C;AAC7C,+BAA4B;AAC5B,qCAAiC;AACjC,4BAA0B;AAC1B,qCAAgC;AAChC,6CAAuC;AACvC,kCAA+B;AAC/B,4BAGO;AACP,yBAA2B;AAC3B,+BAA6B;AAC7B,mCAAoC;AACpC,uCAAkC;AAClC,yBAGO;AAKA,IAAM,cAAc,CAAC;AAAA,IAC5B,yBAAM,aAAa;AAAA,EAClB,GAAG;AAAA,EACH;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,4CAAAC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,kDAAAC;AAAA,EACA,4CAAAC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,oDAAAC;AAAA,EACA;AAAA,EACA,mCAAAC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,uCAAAC;AAAA,EACA,uCAAAC;AAAA,EACA,qCAAAC;AAAA,EACA,oDAAAC;AAAA,EACA;AAAA,EACA;AAAA,EACA,gDAAAC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,0CAAAC;AAAA,EACA,qDAAAC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,oDAAAC;AAAA,EACA,mEAAAC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,2CAAAC;AAAA,EACA;AAAA,EACA,wDAAAC;AAAA,EACA;AAAA,EACA;AACD,CAAE;",
|
|
6
6
|
"names": ["import_utils", "PrivateQuickInserter", "ResizableBoxPopover", "InspectorControlsLastItem", "BlockQuickNavigation", "BlockManager", "DimensionsTool", "ResolutionTool", "TabbedSidebar", "TextAlignmentControl", "HTMLElementControl", "useSpacingSizes", "useBlockDisplayTitle", "CommentIconSlotFill", "CommentIconToolbarSlotFill", "useRemoteUrlData", "useListViewPanelState"]
|
|
7
7
|
}
|
|
@@ -27,6 +27,7 @@ __export(private_keys_exports, {
|
|
|
27
27
|
isIsolatedEditorKey: () => isIsolatedEditorKey,
|
|
28
28
|
isNavigationOverlayContextKey: () => isNavigationOverlayContextKey,
|
|
29
29
|
mediaEditKey: () => mediaEditKey,
|
|
30
|
+
mediaUploadOnSuccessKey: () => mediaUploadOnSuccessKey,
|
|
30
31
|
reusableBlocksSelectKey: () => reusableBlocksSelectKey,
|
|
31
32
|
sectionRootClientIdKey: () => sectionRootClientIdKey,
|
|
32
33
|
selectBlockPatternsKey: () => selectBlockPatternsKey
|
|
@@ -44,6 +45,7 @@ var deviceTypeKey = /* @__PURE__ */ Symbol("deviceTypeKey");
|
|
|
44
45
|
var isNavigationOverlayContextKey = /* @__PURE__ */ Symbol(
|
|
45
46
|
"isNavigationOverlayContext"
|
|
46
47
|
);
|
|
48
|
+
var mediaUploadOnSuccessKey = /* @__PURE__ */ Symbol("mediaUploadOnSuccess");
|
|
47
49
|
// Annotate the CommonJS export names for ESM import in node:
|
|
48
50
|
0 && (module.exports = {
|
|
49
51
|
deviceTypeKey,
|
|
@@ -53,6 +55,7 @@ var isNavigationOverlayContextKey = /* @__PURE__ */ Symbol(
|
|
|
53
55
|
isIsolatedEditorKey,
|
|
54
56
|
isNavigationOverlayContextKey,
|
|
55
57
|
mediaEditKey,
|
|
58
|
+
mediaUploadOnSuccessKey,
|
|
56
59
|
reusableBlocksSelectKey,
|
|
57
60
|
sectionRootClientIdKey,
|
|
58
61
|
selectBlockPatternsKey
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/store/private-keys.js"],
|
|
4
|
-
"sourcesContent": ["export const globalStylesDataKey = Symbol( 'globalStylesDataKey' );\nexport const globalStylesLinksDataKey = Symbol( 'globalStylesLinks' );\nexport const selectBlockPatternsKey = Symbol( 'selectBlockPatternsKey' );\nexport const reusableBlocksSelectKey = Symbol( 'reusableBlocksSelect' );\nexport const sectionRootClientIdKey = Symbol( 'sectionRootClientIdKey' );\nexport const mediaEditKey = Symbol( 'mediaEditKey' );\nexport const getMediaSelectKey = Symbol( 'getMediaSelect' );\nexport const isIsolatedEditorKey = Symbol( 'isIsolatedEditor' );\nexport const deviceTypeKey = Symbol( 'deviceTypeKey' );\nexport const isNavigationOverlayContextKey = Symbol(\n\t'isNavigationOverlayContext'\n);\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAO,IAAM,sBAAsB,uBAAQ,qBAAsB;AAC1D,IAAM,2BAA2B,uBAAQ,mBAAoB;AAC7D,IAAM,yBAAyB,uBAAQ,wBAAyB;AAChE,IAAM,0BAA0B,uBAAQ,sBAAuB;AAC/D,IAAM,yBAAyB,uBAAQ,wBAAyB;AAChE,IAAM,eAAe,uBAAQ,cAAe;AAC5C,IAAM,oBAAoB,uBAAQ,gBAAiB;AACnD,IAAM,sBAAsB,uBAAQ,kBAAmB;AACvD,IAAM,gBAAgB,uBAAQ,eAAgB;AAC9C,IAAM,gCAAgC;AAAA,EAC5C;AACD;",
|
|
4
|
+
"sourcesContent": ["export const globalStylesDataKey = Symbol( 'globalStylesDataKey' );\nexport const globalStylesLinksDataKey = Symbol( 'globalStylesLinks' );\nexport const selectBlockPatternsKey = Symbol( 'selectBlockPatternsKey' );\nexport const reusableBlocksSelectKey = Symbol( 'reusableBlocksSelect' );\nexport const sectionRootClientIdKey = Symbol( 'sectionRootClientIdKey' );\nexport const mediaEditKey = Symbol( 'mediaEditKey' );\nexport const getMediaSelectKey = Symbol( 'getMediaSelect' );\nexport const isIsolatedEditorKey = Symbol( 'isIsolatedEditor' );\nexport const deviceTypeKey = Symbol( 'deviceTypeKey' );\nexport const isNavigationOverlayContextKey = Symbol(\n\t'isNavigationOverlayContext'\n);\nexport const mediaUploadOnSuccessKey = Symbol( 'mediaUploadOnSuccess' );\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAO,IAAM,sBAAsB,uBAAQ,qBAAsB;AAC1D,IAAM,2BAA2B,uBAAQ,mBAAoB;AAC7D,IAAM,yBAAyB,uBAAQ,wBAAyB;AAChE,IAAM,0BAA0B,uBAAQ,sBAAuB;AAC/D,IAAM,yBAAyB,uBAAQ,wBAAyB;AAChE,IAAM,eAAe,uBAAQ,cAAe;AAC5C,IAAM,oBAAoB,uBAAQ,gBAAiB;AACnD,IAAM,sBAAsB,uBAAQ,kBAAmB;AACvD,IAAM,gBAAgB,uBAAQ,eAAgB;AAC9C,IAAM,gCAAgC;AAAA,EAC5C;AACD;AACO,IAAM,0BAA0B,uBAAQ,sBAAuB;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -875,15 +875,16 @@ var canInsertBlockTypeUnmemoized = (state, blockName, rootClientId = null) => {
|
|
|
875
875
|
if (isWithinSection && getBlockName(state, sectionClientId) === "core/block") {
|
|
876
876
|
return false;
|
|
877
877
|
}
|
|
878
|
-
if ((isParentSectionBlock || blockEditingMode === "contentOnly") && !(0, import_private_selectors.isContainerInsertableToInContentOnlyMode)(
|
|
878
|
+
if (isWithinSection && (isParentSectionBlock || blockEditingMode === "contentOnly") && !(0, import_private_selectors.isContainerInsertableToInContentOnlyMode)(
|
|
879
879
|
state,
|
|
880
880
|
blockName,
|
|
881
881
|
rootClientId
|
|
882
882
|
)) {
|
|
883
|
-
|
|
883
|
+
const defaultBlockName = (0, import_blocks.getDefaultBlockName)();
|
|
884
|
+
if (blockName === defaultBlockName) {
|
|
884
885
|
const existingBlocks = getBlockOrder(state, rootClientId);
|
|
885
886
|
const hasDefaultBlock = existingBlocks.some(
|
|
886
|
-
(clientId) => getBlockName(state, clientId) ===
|
|
887
|
+
(clientId) => getBlockName(state, clientId) === defaultBlockName
|
|
887
888
|
);
|
|
888
889
|
if (!hasDefaultBlock) {
|
|
889
890
|
return false;
|
|
@@ -990,15 +991,16 @@ function canRemoveBlock(state, clientId) {
|
|
|
990
991
|
}
|
|
991
992
|
const rootBlockEditingMode = getBlockEditingMode(state, rootClientId);
|
|
992
993
|
const blockName = getBlockName(state, clientId);
|
|
993
|
-
|
|
994
|
+
const defaultBlockName = (0, import_blocks.getDefaultBlockName)();
|
|
995
|
+
if (isWithinSection && (isParentSectionBlock || blockName === defaultBlockName || rootBlockEditingMode === "contentOnly") && !(0, import_private_selectors.isContainerInsertableToInContentOnlyMode)(
|
|
994
996
|
state,
|
|
995
997
|
getBlockName(state, clientId),
|
|
996
998
|
rootClientId
|
|
997
999
|
)) {
|
|
998
|
-
if (blockName ===
|
|
1000
|
+
if (blockName === defaultBlockName) {
|
|
999
1001
|
const existingBlocks = getBlockOrder(state, rootClientId);
|
|
1000
1002
|
const defaultBlocks = existingBlocks.filter(
|
|
1001
|
-
(id) => getBlockName(state, id) ===
|
|
1003
|
+
(id) => getBlockName(state, id) === defaultBlockName
|
|
1002
1004
|
);
|
|
1003
1005
|
if (defaultBlocks.length > 1) {
|
|
1004
1006
|
return true;
|
|
@@ -1037,7 +1039,7 @@ function canMoveBlock(state, clientId) {
|
|
|
1037
1039
|
}
|
|
1038
1040
|
const isParentSectionBlock = !!(0, import_private_selectors.isSectionBlock)(state, rootClientId);
|
|
1039
1041
|
const rootBlockEditingMode = getBlockEditingMode(state, rootClientId);
|
|
1040
|
-
if ((isParentSectionBlock || rootBlockEditingMode === "contentOnly") && !(0, import_private_selectors.isContainerInsertableToInContentOnlyMode)(
|
|
1042
|
+
if (isBlockWithinSection && (isParentSectionBlock || rootBlockEditingMode === "contentOnly") && !(0, import_private_selectors.isContainerInsertableToInContentOnlyMode)(
|
|
1041
1043
|
state,
|
|
1042
1044
|
getBlockName(state, clientId),
|
|
1043
1045
|
rootClientId
|