@wordpress/block-editor 15.16.0 → 15.16.1-next.v.202604091042.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/autocomplete/index.cjs +1 -2
- package/build/components/autocomplete/index.cjs.map +3 -3
- package/build/components/block-list/block-crash-warning.cjs +4 -2
- package/build/components/block-list/block-crash-warning.cjs.map +2 -2
- package/build/components/block-list/block-html.cjs +6 -2
- package/build/components/block-list/block-html.cjs.map +2 -2
- package/build/components/block-mover/button.cjs +4 -3
- package/build/components/block-mover/button.cjs.map +2 -2
- package/build/components/block-mover/index.cjs +1 -8
- package/build/components/block-mover/index.cjs.map +2 -2
- package/build/components/iframe/get-compatibility-styles.cjs +1 -1
- package/build/components/iframe/get-compatibility-styles.cjs.map +2 -2
- package/build/components/inserter/media-tab/hooks.cjs +1 -1
- package/build/components/inserter/media-tab/hooks.cjs.map +2 -2
- package/build/components/link-control/search-input.cjs +1 -1
- package/build/components/link-control/search-input.cjs.map +2 -2
- package/build/components/link-picker/link-preview.cjs +2 -1
- package/build/components/link-picker/link-preview.cjs.map +3 -3
- package/build/components/rich-text/index.cjs +1 -1
- package/build/components/rich-text/index.cjs.map +2 -2
- package/build/components/rich-text/input-event.cjs +3 -3
- package/build/components/rich-text/input-event.cjs.map +2 -2
- package/build/components/use-on-block-drop/index.cjs +1 -1
- package/build/components/use-on-block-drop/index.cjs.map +2 -2
- package/build/components/use-paste-styles/index.cjs +2 -2
- package/build/components/use-paste-styles/index.cjs.map +2 -2
- package/build/hooks/block-style-variation.cjs +5 -6
- package/build/hooks/block-style-variation.cjs.map +3 -3
- package/build/hooks/index.cjs +2 -2
- package/build/hooks/index.cjs.map +2 -2
- package/build/private-apis.cjs +1 -1
- package/build/private-apis.cjs.map +1 -1
- package/build/store/actions.cjs +0 -8
- package/build/store/actions.cjs.map +2 -2
- package/build/store/reducer.cjs +52 -53
- package/build/store/reducer.cjs.map +2 -2
- package/build/store/selectors.cjs +12 -13
- package/build/store/selectors.cjs.map +2 -2
- package/build/store/utils.cjs +1 -1
- package/build/store/utils.cjs.map +2 -2
- package/build/utils/pasting.cjs +1 -1
- package/build/utils/pasting.cjs.map +2 -2
- package/build-module/components/autocomplete/index.mjs +1 -2
- package/build-module/components/autocomplete/index.mjs.map +2 -2
- package/build-module/components/block-list/block-crash-warning.mjs +4 -2
- package/build-module/components/block-list/block-crash-warning.mjs.map +2 -2
- package/build-module/components/block-list/block-html.mjs +7 -3
- package/build-module/components/block-list/block-html.mjs.map +2 -2
- package/build-module/components/block-mover/button.mjs +4 -3
- package/build-module/components/block-mover/button.mjs.map +2 -2
- package/build-module/components/block-mover/index.mjs +1 -8
- package/build-module/components/block-mover/index.mjs.map +2 -2
- package/build-module/components/iframe/get-compatibility-styles.mjs +1 -1
- package/build-module/components/iframe/get-compatibility-styles.mjs.map +2 -2
- package/build-module/components/inserter/media-tab/hooks.mjs +1 -1
- package/build-module/components/inserter/media-tab/hooks.mjs.map +2 -2
- package/build-module/components/link-control/search-input.mjs +1 -1
- package/build-module/components/link-control/search-input.mjs.map +2 -2
- package/build-module/components/link-picker/link-preview.mjs +2 -1
- package/build-module/components/link-picker/link-preview.mjs.map +2 -2
- package/build-module/components/rich-text/index.mjs +2 -2
- package/build-module/components/rich-text/index.mjs.map +2 -2
- package/build-module/components/rich-text/input-event.mjs +2 -2
- package/build-module/components/rich-text/input-event.mjs.map +2 -2
- package/build-module/components/use-on-block-drop/index.mjs +1 -1
- package/build-module/components/use-on-block-drop/index.mjs.map +2 -2
- package/build-module/components/use-paste-styles/index.mjs +2 -2
- package/build-module/components/use-paste-styles/index.mjs.map +2 -2
- package/build-module/hooks/block-style-variation.mjs +4 -5
- package/build-module/hooks/block-style-variation.mjs.map +2 -2
- package/build-module/hooks/index.mjs +2 -2
- package/build-module/hooks/index.mjs.map +2 -2
- package/build-module/private-apis.mjs +2 -2
- package/build-module/private-apis.mjs.map +1 -1
- package/build-module/store/actions.mjs +0 -8
- package/build-module/store/actions.mjs.map +2 -2
- package/build-module/store/reducer.mjs +52 -53
- package/build-module/store/reducer.mjs.map +2 -2
- package/build-module/store/selectors.mjs +12 -13
- package/build-module/store/selectors.mjs.map +2 -2
- package/build-module/store/utils.mjs +1 -1
- package/build-module/store/utils.mjs.map +2 -2
- package/build-module/utils/pasting.mjs +1 -1
- package/build-module/utils/pasting.mjs.map +2 -2
- package/build-style/style-rtl.css +0 -7
- package/build-style/style.css +0 -7
- package/package.json +38 -39
- package/src/autocompleters/style.scss +0 -8
- package/src/components/autocomplete/index.js +1 -2
- package/src/components/block-draggable/test/helpers.native.js +1 -1
- package/src/components/block-list/block-crash-warning.js +3 -1
- package/src/components/block-list/block-crash-warning.native.js +3 -1
- package/src/components/block-list/block-html.js +13 -3
- package/src/components/block-mover/button.js +7 -4
- package/src/components/block-mover/index.js +1 -8
- package/src/components/iframe/get-compatibility-styles.js +1 -1
- package/src/components/inserter/media-tab/hooks.js +1 -1
- package/src/components/link-control/README.md +2 -2
- package/src/components/link-control/search-input.js +1 -1
- package/src/components/link-picker/link-preview.js +2 -1
- package/src/components/rich-text/index.js +1 -1
- package/src/components/rich-text/index.native.js +1 -1
- package/src/components/rich-text/input-event.js +1 -1
- package/src/components/rich-text/input-event.native.js +1 -1
- package/src/components/rich-text/native/index.native.js +18 -17
- package/src/components/use-on-block-drop/index.js +1 -1
- package/src/components/use-paste-styles/index.js +2 -2
- package/src/hooks/block-style-variation.js +3 -4
- package/src/hooks/index.js +1 -1
- package/src/private-apis.js +2 -2
- package/src/store/actions.js +0 -8
- package/src/store/reducer.js +62 -67
- package/src/store/selectors.js +31 -21
- package/src/store/test/private-selectors.js +44 -41
- package/src/store/test/reducer.js +159 -88
- package/src/store/test/registry-selectors.js +1 -1
- package/src/store/test/selectors.js +265 -200
- package/src/store/utils.js +1 -1
- package/src/utils/pasting.js +1 -1
- package/build/autocompleters/link.cjs +0 -81
- package/build/autocompleters/link.cjs.map +0 -7
- package/build-module/autocompleters/link.mjs +0 -50
- package/build-module/autocompleters/link.mjs.map +0 -7
- package/src/autocompleters/link.js +0 -63
package/build/store/reducer.cjs
CHANGED
|
@@ -173,7 +173,7 @@ function updateParentInnerBlocksInTree(state, updatedClientIds, updateChildrenOf
|
|
|
173
173
|
for (const clientId of updatedClientIds) {
|
|
174
174
|
let current = updateChildrenOfUpdatedClientIds ? clientId : state.parents.get(clientId);
|
|
175
175
|
do {
|
|
176
|
-
if (state.controlledInnerBlocks
|
|
176
|
+
if (state.controlledInnerBlocks.has(current)) {
|
|
177
177
|
controlledParents.add(current);
|
|
178
178
|
break;
|
|
179
179
|
} else {
|
|
@@ -417,18 +417,13 @@ var withBlockReset = (reducer) => (state, action) => {
|
|
|
417
417
|
rootClientId: "",
|
|
418
418
|
blocks: action.blocks
|
|
419
419
|
});
|
|
420
|
-
const preservedControlledInnerBlocks = state?.controlledInnerBlocks ??
|
|
420
|
+
const preservedControlledInnerBlocks = state?.controlledInnerBlocks ?? /* @__PURE__ */ new Set();
|
|
421
421
|
if (state?.order) {
|
|
422
|
-
for (const clientId of
|
|
423
|
-
preservedControlledInnerBlocks
|
|
424
|
-
)) {
|
|
425
|
-
if (!preservedControlledInnerBlocks[clientId]) {
|
|
426
|
-
continue;
|
|
427
|
-
}
|
|
422
|
+
for (const clientId of preservedControlledInnerBlocks) {
|
|
428
423
|
if (!newState.byClientId.has(clientId)) {
|
|
429
424
|
continue;
|
|
430
425
|
}
|
|
431
|
-
newState.controlledInnerBlocks
|
|
426
|
+
newState.controlledInnerBlocks.add(clientId);
|
|
432
427
|
const oldOrder = state.order.get(clientId);
|
|
433
428
|
if (!oldOrder?.length) {
|
|
434
429
|
continue;
|
|
@@ -454,9 +449,7 @@ var withBlockReset = (reducer) => (state, action) => {
|
|
|
454
449
|
oldOrder.forEach((id) => preserveBlock(id, clientId));
|
|
455
450
|
}
|
|
456
451
|
}
|
|
457
|
-
for (const clientId of
|
|
458
|
-
newState.controlledInnerBlocks
|
|
459
|
-
)) {
|
|
452
|
+
for (const clientId of newState.controlledInnerBlocks) {
|
|
460
453
|
const controlledOrder = newState.order.get(clientId);
|
|
461
454
|
if (!controlledOrder?.length) {
|
|
462
455
|
continue;
|
|
@@ -496,12 +489,12 @@ var withReplaceInnerBlocks = (reducer) => (state, action) => {
|
|
|
496
489
|
return reducer(state, action);
|
|
497
490
|
}
|
|
498
491
|
const nestedControllers = {};
|
|
499
|
-
if (
|
|
492
|
+
if (state.controlledInnerBlocks.size) {
|
|
500
493
|
const stack = [...action.blocks];
|
|
501
494
|
while (stack.length) {
|
|
502
495
|
const { innerBlocks, ...block } = stack.shift();
|
|
503
496
|
stack.push(...innerBlocks);
|
|
504
|
-
if (
|
|
497
|
+
if (state.controlledInnerBlocks.has(block.clientId)) {
|
|
505
498
|
nestedControllers[block.clientId] = true;
|
|
506
499
|
}
|
|
507
500
|
}
|
|
@@ -925,12 +918,20 @@ var blocks = (0, import_compose.pipe)(
|
|
|
925
918
|
}
|
|
926
919
|
return state;
|
|
927
920
|
},
|
|
928
|
-
controlledInnerBlocks(state =
|
|
921
|
+
controlledInnerBlocks(state = /* @__PURE__ */ new Set(), { type, clientId, hasControlledInnerBlocks }) {
|
|
929
922
|
if (type === "SET_HAS_CONTROLLED_INNER_BLOCKS") {
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
923
|
+
if (hasControlledInnerBlocks) {
|
|
924
|
+
if (state.has(clientId)) {
|
|
925
|
+
return state;
|
|
926
|
+
}
|
|
927
|
+
return new Set(state).add(clientId);
|
|
928
|
+
}
|
|
929
|
+
if (!state.has(clientId)) {
|
|
930
|
+
return state;
|
|
931
|
+
}
|
|
932
|
+
const newState = new Set(state);
|
|
933
|
+
newState.delete(clientId);
|
|
934
|
+
return newState;
|
|
934
935
|
}
|
|
935
936
|
return state;
|
|
936
937
|
},
|
|
@@ -1272,7 +1273,7 @@ function preferences(state = import_defaults.PREFERENCES_DEFAULTS, action) {
|
|
|
1272
1273
|
}
|
|
1273
1274
|
return state;
|
|
1274
1275
|
}
|
|
1275
|
-
var blockListSettings = (state =
|
|
1276
|
+
var blockListSettings = (state = /* @__PURE__ */ new Map(), action) => {
|
|
1276
1277
|
switch (action.type) {
|
|
1277
1278
|
case "REPLACE_BLOCKS": {
|
|
1278
1279
|
const replacementIds = /* @__PURE__ */ new Set();
|
|
@@ -1282,40 +1283,38 @@ var blockListSettings = (state = {}, action) => {
|
|
|
1282
1283
|
replacementIds.add(block.clientId);
|
|
1283
1284
|
stack.push(...block.innerBlocks);
|
|
1284
1285
|
}
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1286
|
+
const newState = new Map(state);
|
|
1287
|
+
for (const clientId of action.clientIds) {
|
|
1288
|
+
if (!replacementIds.has(clientId)) {
|
|
1289
|
+
newState.delete(clientId);
|
|
1290
|
+
}
|
|
1291
|
+
}
|
|
1292
|
+
return newState;
|
|
1290
1293
|
}
|
|
1291
1294
|
case "REMOVE_BLOCKS": {
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1295
|
+
const newState = new Map(state);
|
|
1296
|
+
for (const clientId of action.clientIds) {
|
|
1297
|
+
newState.delete(clientId);
|
|
1298
|
+
}
|
|
1299
|
+
return newState;
|
|
1297
1300
|
}
|
|
1298
1301
|
case "UPDATE_BLOCK_LIST_SETTINGS": {
|
|
1299
|
-
const updates = typeof action.clientId === "string" ?
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
}
|
|
1305
|
-
} else if ((0, import_es6.default)(state[clientId], updates[clientId])) {
|
|
1306
|
-
delete updates[clientId];
|
|
1307
|
-
}
|
|
1308
|
-
}
|
|
1309
|
-
if (Object.keys(updates).length === 0) {
|
|
1302
|
+
const updates = typeof action.clientId === "string" ? [[action.clientId, action.settings]] : Object.entries(action.clientId);
|
|
1303
|
+
const relevantUpdates = updates.filter(
|
|
1304
|
+
([clientId, nextSettings]) => !nextSettings ? state.has(clientId) : !(0, import_es6.default)(state.get(clientId), nextSettings)
|
|
1305
|
+
);
|
|
1306
|
+
if (!relevantUpdates.length) {
|
|
1310
1307
|
return state;
|
|
1311
1308
|
}
|
|
1312
|
-
const
|
|
1313
|
-
for (const clientId
|
|
1314
|
-
if (!
|
|
1315
|
-
delete
|
|
1309
|
+
const newState = new Map(state);
|
|
1310
|
+
for (const [clientId, nextSettings] of relevantUpdates) {
|
|
1311
|
+
if (!nextSettings) {
|
|
1312
|
+
newState.delete(clientId);
|
|
1313
|
+
} else {
|
|
1314
|
+
newState.set(clientId, nextSettings);
|
|
1316
1315
|
}
|
|
1317
1316
|
}
|
|
1318
|
-
return
|
|
1317
|
+
return newState;
|
|
1319
1318
|
}
|
|
1320
1319
|
}
|
|
1321
1320
|
return state;
|
|
@@ -1587,7 +1586,7 @@ function getBlockTreeBlock(state, clientId) {
|
|
|
1587
1586
|
...rootBlock
|
|
1588
1587
|
};
|
|
1589
1588
|
}
|
|
1590
|
-
if (!state.blocks.controlledInnerBlocks
|
|
1589
|
+
if (!state.blocks.controlledInnerBlocks.has(clientId)) {
|
|
1591
1590
|
return state.blocks.tree.get(clientId);
|
|
1592
1591
|
}
|
|
1593
1592
|
const controlledTree = state.blocks.tree.get(`controlled||${clientId}`);
|
|
@@ -1635,7 +1634,7 @@ function getDerivedBlockEditingModesForTree(state, treeClientId = "") {
|
|
|
1635
1634
|
);
|
|
1636
1635
|
const templatePartClientIds = [];
|
|
1637
1636
|
const syncedPatternClientIds = [];
|
|
1638
|
-
|
|
1637
|
+
state.blocks.controlledInnerBlocks.forEach((clientId) => {
|
|
1639
1638
|
const block = state.blocks.byClientId?.get(clientId);
|
|
1640
1639
|
if (block?.name === "core/template-part") {
|
|
1641
1640
|
templatePartClientIds.push(clientId);
|
|
@@ -1644,10 +1643,10 @@ function getDerivedBlockEditingModesForTree(state, treeClientId = "") {
|
|
|
1644
1643
|
syncedPatternClientIds.push(clientId);
|
|
1645
1644
|
}
|
|
1646
1645
|
});
|
|
1647
|
-
const contentOnlyTemplateLockedClientIds =
|
|
1646
|
+
const contentOnlyTemplateLockedClientIds = Array.from(
|
|
1648
1647
|
state.blockListSettings
|
|
1649
|
-
).
|
|
1650
|
-
(clientId) =>
|
|
1648
|
+
).flatMap(
|
|
1649
|
+
([clientId, listSettings]) => listSettings?.templateLock === "contentOnly" ? [clientId] : []
|
|
1651
1650
|
);
|
|
1652
1651
|
const isIsolatedEditor = state.settings?.[import_private_keys.isIsolatedEditorKey];
|
|
1653
1652
|
const disableContentOnlyForUnsyncedPatterns = state.settings?.disableContentOnlyForUnsyncedPatterns;
|
|
@@ -1894,8 +1893,8 @@ function withDerivedBlockEditingModes(reducer) {
|
|
|
1894
1893
|
const removedClientIds = [];
|
|
1895
1894
|
const updates = typeof action.clientId === "string" ? { [action.clientId]: action.settings } : action.clientId;
|
|
1896
1895
|
for (const clientId in updates) {
|
|
1897
|
-
const isNewContentOnlyBlock = state.blockListSettings
|
|
1898
|
-
const wasContentOnlyBlock = state.blockListSettings
|
|
1896
|
+
const isNewContentOnlyBlock = state.blockListSettings.get(clientId)?.templateLock !== "contentOnly" && nextState.blockListSettings.get(clientId)?.templateLock === "contentOnly";
|
|
1897
|
+
const wasContentOnlyBlock = state.blockListSettings.get(clientId)?.templateLock === "contentOnly" && nextState.blockListSettings.get(clientId)?.templateLock !== "contentOnly";
|
|
1899
1898
|
if (isNewContentOnlyBlock) {
|
|
1900
1899
|
addedBlocks.push(
|
|
1901
1900
|
nextState.blocks.tree.get(clientId)
|