@wordpress/block-editor 15.16.0 → 15.17.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/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/copy-handler/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/link-preview.cjs +3 -1
- package/build/components/link-control/link-preview.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/preset-input-control/index.cjs +7 -4
- package/build/components/preset-input-control/index.cjs.map +2 -2
- package/build/components/rich-text/event-listeners/index.cjs.map +2 -2
- 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/spacing-sizes-control/utils.cjs +1 -1
- package/build/components/spacing-sizes-control/utils.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/components/writing-flow/use-selection-observer.cjs +23 -1
- package/build/components/writing-flow/use-selection-observer.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/hooks/style.cjs +54 -52
- package/build/hooks/style.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/copy-handler/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/link-preview.mjs +3 -1
- package/build-module/components/link-control/link-preview.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/preset-input-control/index.mjs +7 -4
- package/build-module/components/preset-input-control/index.mjs.map +2 -2
- package/build-module/components/rich-text/event-listeners/index.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/spacing-sizes-control/utils.mjs +1 -1
- package/build-module/components/spacing-sizes-control/utils.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/components/writing-flow/use-selection-observer.mjs +23 -1
- package/build-module/components/writing-flow/use-selection-observer.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/hooks/style.mjs +54 -52
- package/build-module/hooks/style.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/copy-handler/index.js +1 -0
- 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/link-preview.js +3 -1
- package/src/components/link-control/search-input.js +1 -1
- package/src/components/link-picker/link-preview.js +2 -1
- package/src/components/preset-input-control/index.js +10 -4
- package/src/components/preset-input-control/test/index.js +70 -0
- package/src/components/rich-text/event-listeners/index.js +1 -0
- 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/spacing-sizes-control/utils.js +1 -1
- package/src/components/use-on-block-drop/index.js +1 -1
- package/src/components/use-paste-styles/index.js +2 -2
- package/src/components/writing-flow/use-selection-observer.js +39 -1
- package/src/hooks/block-style-variation.js +3 -4
- package/src/hooks/index.js +1 -1
- package/src/hooks/style.js +75 -61
- 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
|
@@ -109,7 +109,7 @@ function updateParentInnerBlocksInTree(state, updatedClientIds, updateChildrenOf
|
|
|
109
109
|
for (const clientId of updatedClientIds) {
|
|
110
110
|
let current = updateChildrenOfUpdatedClientIds ? clientId : state.parents.get(clientId);
|
|
111
111
|
do {
|
|
112
|
-
if (state.controlledInnerBlocks
|
|
112
|
+
if (state.controlledInnerBlocks.has(current)) {
|
|
113
113
|
controlledParents.add(current);
|
|
114
114
|
break;
|
|
115
115
|
} else {
|
|
@@ -353,18 +353,13 @@ var withBlockReset = (reducer) => (state, action) => {
|
|
|
353
353
|
rootClientId: "",
|
|
354
354
|
blocks: action.blocks
|
|
355
355
|
});
|
|
356
|
-
const preservedControlledInnerBlocks = state?.controlledInnerBlocks ??
|
|
356
|
+
const preservedControlledInnerBlocks = state?.controlledInnerBlocks ?? /* @__PURE__ */ new Set();
|
|
357
357
|
if (state?.order) {
|
|
358
|
-
for (const clientId of
|
|
359
|
-
preservedControlledInnerBlocks
|
|
360
|
-
)) {
|
|
361
|
-
if (!preservedControlledInnerBlocks[clientId]) {
|
|
362
|
-
continue;
|
|
363
|
-
}
|
|
358
|
+
for (const clientId of preservedControlledInnerBlocks) {
|
|
364
359
|
if (!newState.byClientId.has(clientId)) {
|
|
365
360
|
continue;
|
|
366
361
|
}
|
|
367
|
-
newState.controlledInnerBlocks
|
|
362
|
+
newState.controlledInnerBlocks.add(clientId);
|
|
368
363
|
const oldOrder = state.order.get(clientId);
|
|
369
364
|
if (!oldOrder?.length) {
|
|
370
365
|
continue;
|
|
@@ -390,9 +385,7 @@ var withBlockReset = (reducer) => (state, action) => {
|
|
|
390
385
|
oldOrder.forEach((id) => preserveBlock(id, clientId));
|
|
391
386
|
}
|
|
392
387
|
}
|
|
393
|
-
for (const clientId of
|
|
394
|
-
newState.controlledInnerBlocks
|
|
395
|
-
)) {
|
|
388
|
+
for (const clientId of newState.controlledInnerBlocks) {
|
|
396
389
|
const controlledOrder = newState.order.get(clientId);
|
|
397
390
|
if (!controlledOrder?.length) {
|
|
398
391
|
continue;
|
|
@@ -432,12 +425,12 @@ var withReplaceInnerBlocks = (reducer) => (state, action) => {
|
|
|
432
425
|
return reducer(state, action);
|
|
433
426
|
}
|
|
434
427
|
const nestedControllers = {};
|
|
435
|
-
if (
|
|
428
|
+
if (state.controlledInnerBlocks.size) {
|
|
436
429
|
const stack = [...action.blocks];
|
|
437
430
|
while (stack.length) {
|
|
438
431
|
const { innerBlocks, ...block } = stack.shift();
|
|
439
432
|
stack.push(...innerBlocks);
|
|
440
|
-
if (
|
|
433
|
+
if (state.controlledInnerBlocks.has(block.clientId)) {
|
|
441
434
|
nestedControllers[block.clientId] = true;
|
|
442
435
|
}
|
|
443
436
|
}
|
|
@@ -861,12 +854,20 @@ var blocks = pipe(
|
|
|
861
854
|
}
|
|
862
855
|
return state;
|
|
863
856
|
},
|
|
864
|
-
controlledInnerBlocks(state =
|
|
857
|
+
controlledInnerBlocks(state = /* @__PURE__ */ new Set(), { type, clientId, hasControlledInnerBlocks }) {
|
|
865
858
|
if (type === "SET_HAS_CONTROLLED_INNER_BLOCKS") {
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
859
|
+
if (hasControlledInnerBlocks) {
|
|
860
|
+
if (state.has(clientId)) {
|
|
861
|
+
return state;
|
|
862
|
+
}
|
|
863
|
+
return new Set(state).add(clientId);
|
|
864
|
+
}
|
|
865
|
+
if (!state.has(clientId)) {
|
|
866
|
+
return state;
|
|
867
|
+
}
|
|
868
|
+
const newState = new Set(state);
|
|
869
|
+
newState.delete(clientId);
|
|
870
|
+
return newState;
|
|
870
871
|
}
|
|
871
872
|
return state;
|
|
872
873
|
},
|
|
@@ -1208,7 +1209,7 @@ function preferences(state = PREFERENCES_DEFAULTS, action) {
|
|
|
1208
1209
|
}
|
|
1209
1210
|
return state;
|
|
1210
1211
|
}
|
|
1211
|
-
var blockListSettings = (state =
|
|
1212
|
+
var blockListSettings = (state = /* @__PURE__ */ new Map(), action) => {
|
|
1212
1213
|
switch (action.type) {
|
|
1213
1214
|
case "REPLACE_BLOCKS": {
|
|
1214
1215
|
const replacementIds = /* @__PURE__ */ new Set();
|
|
@@ -1218,40 +1219,38 @@ var blockListSettings = (state = {}, action) => {
|
|
|
1218
1219
|
replacementIds.add(block.clientId);
|
|
1219
1220
|
stack.push(...block.innerBlocks);
|
|
1220
1221
|
}
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1222
|
+
const newState = new Map(state);
|
|
1223
|
+
for (const clientId of action.clientIds) {
|
|
1224
|
+
if (!replacementIds.has(clientId)) {
|
|
1225
|
+
newState.delete(clientId);
|
|
1226
|
+
}
|
|
1227
|
+
}
|
|
1228
|
+
return newState;
|
|
1226
1229
|
}
|
|
1227
1230
|
case "REMOVE_BLOCKS": {
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1231
|
+
const newState = new Map(state);
|
|
1232
|
+
for (const clientId of action.clientIds) {
|
|
1233
|
+
newState.delete(clientId);
|
|
1234
|
+
}
|
|
1235
|
+
return newState;
|
|
1233
1236
|
}
|
|
1234
1237
|
case "UPDATE_BLOCK_LIST_SETTINGS": {
|
|
1235
|
-
const updates = typeof action.clientId === "string" ?
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
}
|
|
1241
|
-
} else if (fastDeepEqual(state[clientId], updates[clientId])) {
|
|
1242
|
-
delete updates[clientId];
|
|
1243
|
-
}
|
|
1244
|
-
}
|
|
1245
|
-
if (Object.keys(updates).length === 0) {
|
|
1238
|
+
const updates = typeof action.clientId === "string" ? [[action.clientId, action.settings]] : Object.entries(action.clientId);
|
|
1239
|
+
const relevantUpdates = updates.filter(
|
|
1240
|
+
([clientId, nextSettings]) => !nextSettings ? state.has(clientId) : !fastDeepEqual(state.get(clientId), nextSettings)
|
|
1241
|
+
);
|
|
1242
|
+
if (!relevantUpdates.length) {
|
|
1246
1243
|
return state;
|
|
1247
1244
|
}
|
|
1248
|
-
const
|
|
1249
|
-
for (const clientId
|
|
1250
|
-
if (!
|
|
1251
|
-
delete
|
|
1245
|
+
const newState = new Map(state);
|
|
1246
|
+
for (const [clientId, nextSettings] of relevantUpdates) {
|
|
1247
|
+
if (!nextSettings) {
|
|
1248
|
+
newState.delete(clientId);
|
|
1249
|
+
} else {
|
|
1250
|
+
newState.set(clientId, nextSettings);
|
|
1252
1251
|
}
|
|
1253
1252
|
}
|
|
1254
|
-
return
|
|
1253
|
+
return newState;
|
|
1255
1254
|
}
|
|
1256
1255
|
}
|
|
1257
1256
|
return state;
|
|
@@ -1523,7 +1522,7 @@ function getBlockTreeBlock(state, clientId) {
|
|
|
1523
1522
|
...rootBlock
|
|
1524
1523
|
};
|
|
1525
1524
|
}
|
|
1526
|
-
if (!state.blocks.controlledInnerBlocks
|
|
1525
|
+
if (!state.blocks.controlledInnerBlocks.has(clientId)) {
|
|
1527
1526
|
return state.blocks.tree.get(clientId);
|
|
1528
1527
|
}
|
|
1529
1528
|
const controlledTree = state.blocks.tree.get(`controlled||${clientId}`);
|
|
@@ -1571,7 +1570,7 @@ function getDerivedBlockEditingModesForTree(state, treeClientId = "") {
|
|
|
1571
1570
|
);
|
|
1572
1571
|
const templatePartClientIds = [];
|
|
1573
1572
|
const syncedPatternClientIds = [];
|
|
1574
|
-
|
|
1573
|
+
state.blocks.controlledInnerBlocks.forEach((clientId) => {
|
|
1575
1574
|
const block = state.blocks.byClientId?.get(clientId);
|
|
1576
1575
|
if (block?.name === "core/template-part") {
|
|
1577
1576
|
templatePartClientIds.push(clientId);
|
|
@@ -1580,10 +1579,10 @@ function getDerivedBlockEditingModesForTree(state, treeClientId = "") {
|
|
|
1580
1579
|
syncedPatternClientIds.push(clientId);
|
|
1581
1580
|
}
|
|
1582
1581
|
});
|
|
1583
|
-
const contentOnlyTemplateLockedClientIds =
|
|
1582
|
+
const contentOnlyTemplateLockedClientIds = Array.from(
|
|
1584
1583
|
state.blockListSettings
|
|
1585
|
-
).
|
|
1586
|
-
(clientId) =>
|
|
1584
|
+
).flatMap(
|
|
1585
|
+
([clientId, listSettings]) => listSettings?.templateLock === "contentOnly" ? [clientId] : []
|
|
1587
1586
|
);
|
|
1588
1587
|
const isIsolatedEditor = state.settings?.[isIsolatedEditorKey];
|
|
1589
1588
|
const disableContentOnlyForUnsyncedPatterns = state.settings?.disableContentOnlyForUnsyncedPatterns;
|
|
@@ -1830,8 +1829,8 @@ function withDerivedBlockEditingModes(reducer) {
|
|
|
1830
1829
|
const removedClientIds = [];
|
|
1831
1830
|
const updates = typeof action.clientId === "string" ? { [action.clientId]: action.settings } : action.clientId;
|
|
1832
1831
|
for (const clientId in updates) {
|
|
1833
|
-
const isNewContentOnlyBlock = state.blockListSettings
|
|
1834
|
-
const wasContentOnlyBlock = state.blockListSettings
|
|
1832
|
+
const isNewContentOnlyBlock = state.blockListSettings.get(clientId)?.templateLock !== "contentOnly" && nextState.blockListSettings.get(clientId)?.templateLock === "contentOnly";
|
|
1833
|
+
const wasContentOnlyBlock = state.blockListSettings.get(clientId)?.templateLock === "contentOnly" && nextState.blockListSettings.get(clientId)?.templateLock !== "contentOnly";
|
|
1835
1834
|
if (isNewContentOnlyBlock) {
|
|
1836
1835
|
addedBlocks.push(
|
|
1837
1836
|
nextState.blocks.tree.get(clientId)
|