@wordpress/block-editor 15.11.1-next.v.0 → 15.12.1-next.v.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-breadcrumb/index.cjs +10 -2
- package/build/components/block-breadcrumb/index.cjs.map +2 -2
- package/build/components/block-inspector/index.cjs +11 -11
- package/build/components/block-inspector/index.cjs.map +3 -3
- package/build/components/block-list/block.cjs +6 -3
- package/build/components/block-list/block.cjs.map +3 -3
- package/build/components/block-list/index.cjs +26 -18
- package/build/components/block-list/index.cjs.map +2 -2
- package/build/components/block-list/use-block-props/use-selected-block-event-handlers.cjs +2 -6
- package/build/components/block-list/use-block-props/use-selected-block-event-handlers.cjs.map +2 -2
- package/build/components/block-list/use-in-between-inserter.cjs +4 -4
- package/build/components/block-list/use-in-between-inserter.cjs.map +2 -2
- package/build/components/block-settings-menu/block-settings-dropdown.cjs +10 -7
- package/build/components/block-settings-menu/block-settings-dropdown.cjs.map +2 -2
- package/build/components/block-settings-menu-controls/edit-section-menu-item.cjs +1 -1
- package/build/components/block-settings-menu-controls/edit-section-menu-item.cjs.map +2 -2
- package/build/components/block-settings-menu-controls/index.cjs +10 -15
- package/build/components/block-settings-menu-controls/index.cjs.map +2 -2
- package/build/components/block-toolbar/block-toolbar-icon.cjs +6 -4
- package/build/components/block-toolbar/block-toolbar-icon.cjs.map +2 -2
- package/build/components/block-toolbar/index.cjs +1 -1
- package/build/components/block-toolbar/index.cjs.map +2 -2
- package/build/components/block-variation-transforms/index.cjs +1 -2
- package/build/components/block-variation-transforms/index.cjs.map +2 -2
- package/build/components/block-visibility/modal.cjs +5 -92
- package/build/components/block-visibility/modal.cjs.map +2 -2
- package/build/components/inserter/index.cjs +1 -0
- package/build/components/inserter/index.cjs.map +2 -2
- package/build/components/inspector-controls/last-item.cjs +41 -0
- package/build/components/inspector-controls/last-item.cjs.map +7 -0
- package/build/components/inspector-controls-tabs/index.cjs +2 -2
- package/build/components/inspector-controls-tabs/index.cjs.map +3 -3
- package/build/components/inspector-controls-tabs/styles-tab.cjs +4 -4
- package/build/components/inspector-controls-tabs/styles-tab.cjs.map +2 -2
- package/build/components/media-replace-flow/index.cjs +2 -2
- package/build/components/media-replace-flow/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/use-block-display-information/index.cjs +1 -1
- package/build/components/use-block-display-information/index.cjs.map +2 -2
- package/build/components/writing-flow/index.cjs +2 -0
- package/build/components/writing-flow/index.cjs.map +2 -2
- package/build/components/writing-flow/use-arrow-nav.cjs +3 -0
- package/build/components/writing-flow/use-arrow-nav.cjs.map +2 -2
- package/build/components/writing-flow/use-drag-selection.cjs +2 -1
- package/build/components/writing-flow/use-drag-selection.cjs.map +2 -2
- package/build/components/writing-flow/use-preview-mode-nav.cjs +92 -0
- package/build/components/writing-flow/use-preview-mode-nav.cjs.map +7 -0
- package/build/hooks/anchor.cjs +1 -1
- package/build/hooks/anchor.cjs.map +1 -1
- package/build/hooks/block-renaming.cjs +1 -1
- package/build/hooks/block-renaming.cjs.map +2 -2
- package/build/hooks/custom-css.cjs +1 -1
- package/build/hooks/custom-css.cjs.map +2 -2
- package/build/hooks/grid-visualizer.cjs +42 -5
- package/build/hooks/grid-visualizer.cjs.map +3 -3
- package/build/hooks/index.cjs +0 -2
- package/build/hooks/index.cjs.map +3 -3
- package/build/hooks/layout-child.cjs +41 -5
- package/build/hooks/layout-child.cjs.map +3 -3
- package/build/private-apis.cjs +2 -0
- package/build/private-apis.cjs.map +3 -3
- package/build/store/actions.cjs +5 -0
- package/build/store/actions.cjs.map +2 -2
- package/build/store/private-selectors.cjs +1 -1
- package/build/store/private-selectors.cjs.map +2 -2
- package/build/store/reducer.cjs +5 -7
- package/build/store/reducer.cjs.map +2 -2
- package/build/store/selectors.cjs +15 -0
- package/build/store/selectors.cjs.map +2 -2
- package/build/utils/fit-text-utils.cjs +17 -7
- package/build/utils/fit-text-utils.cjs.map +2 -2
- package/build-module/components/block-breadcrumb/index.mjs +10 -2
- package/build-module/components/block-breadcrumb/index.mjs.map +2 -2
- package/build-module/components/block-inspector/index.mjs +12 -11
- package/build-module/components/block-inspector/index.mjs.map +2 -2
- package/build-module/components/block-list/block.mjs +6 -3
- package/build-module/components/block-list/block.mjs.map +3 -3
- package/build-module/components/block-list/index.mjs +26 -18
- package/build-module/components/block-list/index.mjs.map +2 -2
- package/build-module/components/block-list/use-block-props/use-selected-block-event-handlers.mjs +2 -6
- package/build-module/components/block-list/use-block-props/use-selected-block-event-handlers.mjs.map +2 -2
- package/build-module/components/block-list/use-in-between-inserter.mjs +4 -4
- package/build-module/components/block-list/use-in-between-inserter.mjs.map +2 -2
- package/build-module/components/block-settings-menu/block-settings-dropdown.mjs +10 -7
- package/build-module/components/block-settings-menu/block-settings-dropdown.mjs.map +2 -2
- package/build-module/components/block-settings-menu-controls/edit-section-menu-item.mjs +1 -1
- package/build-module/components/block-settings-menu-controls/edit-section-menu-item.mjs.map +2 -2
- package/build-module/components/block-settings-menu-controls/index.mjs +10 -15
- package/build-module/components/block-settings-menu-controls/index.mjs.map +2 -2
- package/build-module/components/block-toolbar/block-toolbar-icon.mjs +6 -4
- package/build-module/components/block-toolbar/block-toolbar-icon.mjs.map +2 -2
- package/build-module/components/block-toolbar/index.mjs +1 -1
- package/build-module/components/block-toolbar/index.mjs.map +2 -2
- package/build-module/components/block-variation-transforms/index.mjs +1 -2
- package/build-module/components/block-variation-transforms/index.mjs.map +2 -2
- package/build-module/components/block-visibility/modal.mjs +5 -92
- package/build-module/components/block-visibility/modal.mjs.map +2 -2
- package/build-module/components/inserter/index.mjs +1 -0
- package/build-module/components/inserter/index.mjs.map +2 -2
- package/build-module/components/inspector-controls/last-item.mjs +23 -0
- package/build-module/components/inspector-controls/last-item.mjs.map +7 -0
- package/build-module/components/inspector-controls-tabs/index.mjs +2 -2
- package/build-module/components/inspector-controls-tabs/index.mjs.map +2 -2
- package/build-module/components/inspector-controls-tabs/styles-tab.mjs +4 -4
- package/build-module/components/inspector-controls-tabs/styles-tab.mjs.map +2 -2
- package/build-module/components/media-replace-flow/index.mjs +2 -2
- package/build-module/components/media-replace-flow/index.mjs.map +2 -2
- package/build-module/components/rich-text/index.mjs +1 -1
- package/build-module/components/rich-text/index.mjs.map +2 -2
- package/build-module/components/use-block-display-information/index.mjs +1 -1
- package/build-module/components/use-block-display-information/index.mjs.map +2 -2
- package/build-module/components/writing-flow/index.mjs +2 -0
- package/build-module/components/writing-flow/index.mjs.map +2 -2
- package/build-module/components/writing-flow/use-arrow-nav.mjs +3 -0
- package/build-module/components/writing-flow/use-arrow-nav.mjs.map +2 -2
- package/build-module/components/writing-flow/use-drag-selection.mjs +2 -1
- package/build-module/components/writing-flow/use-drag-selection.mjs.map +2 -2
- package/build-module/components/writing-flow/use-preview-mode-nav.mjs +67 -0
- package/build-module/components/writing-flow/use-preview-mode-nav.mjs.map +7 -0
- package/build-module/hooks/anchor.mjs +1 -1
- package/build-module/hooks/anchor.mjs.map +1 -1
- package/build-module/hooks/block-renaming.mjs +1 -1
- package/build-module/hooks/block-renaming.mjs.map +2 -2
- package/build-module/hooks/custom-css.mjs +1 -1
- package/build-module/hooks/custom-css.mjs.map +2 -2
- package/build-module/hooks/grid-visualizer.mjs +20 -5
- package/build-module/hooks/grid-visualizer.mjs.map +2 -2
- package/build-module/hooks/index.mjs +0 -2
- package/build-module/hooks/index.mjs.map +2 -2
- package/build-module/hooks/layout-child.mjs +31 -5
- package/build-module/hooks/layout-child.mjs.map +2 -2
- package/build-module/private-apis.mjs +2 -0
- package/build-module/private-apis.mjs.map +2 -2
- package/build-module/store/actions.mjs +5 -0
- package/build-module/store/actions.mjs.map +2 -2
- package/build-module/store/private-selectors.mjs +1 -1
- package/build-module/store/private-selectors.mjs.map +2 -2
- package/build-module/store/reducer.mjs +5 -7
- package/build-module/store/reducer.mjs.map +2 -2
- package/build-module/store/selectors.mjs +15 -0
- package/build-module/store/selectors.mjs.map +2 -2
- package/build-module/utils/fit-text-utils.mjs +17 -7
- package/build-module/utils/fit-text-utils.mjs.map +2 -2
- package/build-style/content-rtl.css +10 -0
- package/build-style/content.css +10 -0
- package/package.json +39 -39
- package/src/components/block-breadcrumb/index.js +6 -1
- package/src/components/block-inspector/index.js +20 -21
- package/src/components/block-list/block.js +5 -2
- package/src/components/block-list/content.scss +11 -0
- package/src/components/block-list/index.js +25 -17
- package/src/components/block-list/use-block-props/use-selected-block-event-handlers.js +2 -7
- package/src/components/block-list/use-in-between-inserter.js +8 -6
- package/src/components/block-settings-menu/block-settings-dropdown.js +11 -6
- package/src/components/block-settings-menu-controls/edit-section-menu-item.js +1 -7
- package/src/components/block-settings-menu-controls/index.js +14 -16
- package/src/components/block-toolbar/block-toolbar-icon.js +6 -10
- package/src/components/block-toolbar/index.js +1 -7
- package/src/components/block-variation-transforms/index.js +1 -4
- package/src/components/inserter/index.js +1 -0
- package/src/components/inserter/stories/index.story.jsx +31 -24
- package/src/components/inspector-controls/last-item.js +29 -0
- package/src/components/inspector-controls-tabs/index.js +1 -1
- package/src/components/inspector-controls-tabs/styles-tab.js +10 -11
- package/src/components/media-replace-flow/index.js +3 -3
- package/src/components/rich-text/index.js +1 -1
- package/src/components/use-block-display-information/index.js +1 -5
- package/src/components/writing-flow/index.js +2 -0
- package/src/components/writing-flow/use-arrow-nav.js +5 -0
- package/src/components/writing-flow/use-drag-selection.js +7 -1
- package/src/components/writing-flow/use-preview-mode-nav.js +102 -0
- package/src/hooks/anchor.js +1 -1
- package/src/hooks/block-renaming.js +5 -2
- package/src/hooks/custom-css.js +1 -1
- package/src/hooks/grid-visualizer.js +23 -4
- package/src/hooks/index.js +0 -2
- package/src/hooks/layout-child.js +39 -3
- package/src/private-apis.js +2 -0
- package/src/store/actions.js +7 -0
- package/src/store/private-selectors.js +0 -1
- package/src/store/reducer.js +11 -18
- package/src/store/selectors.js +25 -0
- package/src/store/test/reducer.js +258 -266
- package/src/utils/fit-text-utils.js +24 -8
- package/build/components/content-lock/index.cjs +0 -31
- package/build/components/content-lock/index.cjs.map +0 -7
- package/build/components/content-lock/modify-content-lock-menu-item.cjs +0 -70
- package/build/components/content-lock/modify-content-lock-menu-item.cjs.map +0 -7
- package/build/hooks/content-lock-ui.cjs +0 -68
- package/build/hooks/content-lock-ui.cjs.map +0 -7
- package/build-module/components/content-lock/index.mjs +0 -6
- package/build-module/components/content-lock/index.mjs.map +0 -7
- package/build-module/components/content-lock/modify-content-lock-menu-item.mjs +0 -45
- package/build-module/components/content-lock/modify-content-lock-menu-item.mjs.map +0 -7
- package/build-module/hooks/content-lock-ui.mjs +0 -47
- package/build-module/hooks/content-lock-ui.mjs.map +0 -7
- package/src/components/content-lock/index.js +0 -1
- package/src/components/content-lock/modify-content-lock-menu-item.js +0 -67
- package/src/hooks/content-lock-ui.js +0 -76
|
@@ -5,20 +5,30 @@ function findOptimalFontSize(textElement, applyFontSize) {
|
|
|
5
5
|
let maxSize = 2400;
|
|
6
6
|
let bestSize = minSize;
|
|
7
7
|
const computedStyle = window.getComputedStyle(textElement);
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
let paddingLeft = parseFloat(computedStyle.paddingLeft) || 0;
|
|
9
|
+
let paddingRight = parseFloat(computedStyle.paddingRight) || 0;
|
|
10
10
|
const range = document.createRange();
|
|
11
11
|
range.selectNodeContents(textElement);
|
|
12
|
-
let
|
|
12
|
+
let referenceElement = textElement;
|
|
13
|
+
const parentElement = textElement.parentElement;
|
|
14
|
+
if (parentElement) {
|
|
15
|
+
const parentElementComputedStyle = window.getComputedStyle(parentElement);
|
|
16
|
+
if (parentElementComputedStyle?.display === "flex") {
|
|
17
|
+
referenceElement = parentElement;
|
|
18
|
+
paddingLeft += parseFloat(parentElementComputedStyle.paddingLeft) || 0;
|
|
19
|
+
paddingRight += parseFloat(parentElementComputedStyle.paddingRight) || 0;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
let maxclientHeight = referenceElement.clientHeight;
|
|
13
23
|
while (minSize <= maxSize) {
|
|
14
24
|
const midSize = Math.floor((minSize + maxSize) / 2);
|
|
15
25
|
applyFontSize(midSize);
|
|
16
26
|
const rect = range.getBoundingClientRect();
|
|
17
27
|
const textWidth = rect.width;
|
|
18
|
-
const fitsWidth = textElement.scrollWidth <=
|
|
19
|
-
const fitsHeight = alreadyHasScrollableHeight || textElement.scrollHeight <=
|
|
20
|
-
if (
|
|
21
|
-
maxclientHeight =
|
|
28
|
+
const fitsWidth = textElement.scrollWidth <= referenceElement.clientWidth && textWidth <= referenceElement.clientWidth - paddingLeft - paddingRight;
|
|
29
|
+
const fitsHeight = alreadyHasScrollableHeight || textElement.scrollHeight <= referenceElement.clientHeight || textElement.scrollHeight <= maxclientHeight;
|
|
30
|
+
if (referenceElement.clientHeight > maxclientHeight) {
|
|
31
|
+
maxclientHeight = referenceElement.clientHeight;
|
|
22
32
|
}
|
|
23
33
|
if (fitsWidth && fitsHeight) {
|
|
24
34
|
bestSize = midSize;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/utils/fit-text-utils.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * Shared utility functions for fit text functionality.\n * Uses callback-based approach for maximum code reuse between editor and frontend.\n */\n\n/**\n * Find optimal font size using simple binary search between 0-2400px.\n *\n * @param {HTMLElement} textElement The text element\n * @param {Function} applyFontSize Function that receives font size in pixels\n * @return {number} Optimal font size\n */\nfunction findOptimalFontSize( textElement, applyFontSize ) {\n\tconst alreadyHasScrollableHeight =\n\t\ttextElement.scrollHeight > textElement.clientHeight;\n\tlet minSize = 0;\n\tlet maxSize = 2400;\n\tlet bestSize = minSize;\n\n\tconst computedStyle = window.getComputedStyle( textElement );\n\
|
|
5
|
-
"mappings": ";AAYA,SAAS,oBAAqB,aAAa,eAAgB;AAC1D,QAAM,6BACL,YAAY,eAAe,YAAY;AACxC,MAAI,UAAU;AACd,MAAI,UAAU;AACd,MAAI,WAAW;AAEf,QAAM,gBAAgB,OAAO,iBAAkB,WAAY;AAC3D,
|
|
4
|
+
"sourcesContent": ["/**\n * Shared utility functions for fit text functionality.\n * Uses callback-based approach for maximum code reuse between editor and frontend.\n */\n\n/**\n * Find optimal font size using simple binary search between 0-2400px.\n *\n * @param {HTMLElement} textElement The text element\n * @param {Function} applyFontSize Function that receives font size in pixels\n * @return {number} Optimal font size\n */\nfunction findOptimalFontSize( textElement, applyFontSize ) {\n\tconst alreadyHasScrollableHeight =\n\t\ttextElement.scrollHeight > textElement.clientHeight;\n\tlet minSize = 0;\n\tlet maxSize = 2400;\n\tlet bestSize = minSize;\n\n\tconst computedStyle = window.getComputedStyle( textElement );\n\tlet paddingLeft = parseFloat( computedStyle.paddingLeft ) || 0;\n\tlet paddingRight = parseFloat( computedStyle.paddingRight ) || 0;\n\tconst range = document.createRange();\n\trange.selectNodeContents( textElement );\n\n\tlet referenceElement = textElement;\n\tconst parentElement = textElement.parentElement;\n\tif ( parentElement ) {\n\t\tconst parentElementComputedStyle =\n\t\t\twindow.getComputedStyle( parentElement );\n\t\tif ( parentElementComputedStyle?.display === 'flex' ) {\n\t\t\treferenceElement = parentElement;\n\t\t\tpaddingLeft +=\n\t\t\t\tparseFloat( parentElementComputedStyle.paddingLeft ) || 0;\n\t\t\tpaddingRight +=\n\t\t\t\tparseFloat( parentElementComputedStyle.paddingRight ) || 0;\n\t\t}\n\t}\n\tlet maxclientHeight = referenceElement.clientHeight;\n\n\twhile ( minSize <= maxSize ) {\n\t\tconst midSize = Math.floor( ( minSize + maxSize ) / 2 );\n\t\tapplyFontSize( midSize );\n\n\t\t// When there is padding if the text overflows to the\n\t\t// padding area, it should be considered overflowing.\n\t\t// Use Range API to measure actual text content dimensions.\n\t\tconst rect = range.getBoundingClientRect();\n\t\tconst textWidth = rect.width;\n\n\t\t// Check if text fits within the element's width and is not\n\t\t// overflowing into the padding area.\n\t\tconst fitsWidth =\n\t\t\ttextElement.scrollWidth <= referenceElement.clientWidth &&\n\t\t\ttextWidth <=\n\t\t\t\treferenceElement.clientWidth - paddingLeft - paddingRight;\n\t\t// Check if text fits within the element's height.\n\t\tconst fitsHeight =\n\t\t\talreadyHasScrollableHeight ||\n\t\t\ttextElement.scrollHeight <= referenceElement.clientHeight ||\n\t\t\ttextElement.scrollHeight <= maxclientHeight;\n\n\t\t// When there are calculated line heights, text may jump in height\n\t\t// the available space may decrease while the font size decreases,\n\t\t// making text not fit.\n\t\t// We store a maximum reference height: the maximum reference element height that was observed\n\t\t// during the loop to avoid issues with such jumps.\n\t\tif ( referenceElement.clientHeight > maxclientHeight ) {\n\t\t\tmaxclientHeight = referenceElement.clientHeight;\n\t\t}\n\n\t\tif ( fitsWidth && fitsHeight ) {\n\t\t\tbestSize = midSize;\n\t\t\tminSize = midSize + 1;\n\t\t} else {\n\t\t\tmaxSize = midSize - 1;\n\t\t}\n\t}\n\trange.detach();\n\n\treturn bestSize;\n}\n\n/**\n * Complete fit text optimization for a single text element.\n * Handles the full flow using callbacks for font size application.\n *\n * @param {HTMLElement} textElement The text element (paragraph, heading, etc.)\n * @param {Function} applyFontSize Function that receives font size in pixels (0 to clear, >0 to apply)\n */\nexport function optimizeFitText( textElement, applyFontSize ) {\n\tif ( ! textElement ) {\n\t\treturn;\n\t}\n\n\tapplyFontSize( 0 );\n\n\tconst optimalSize = findOptimalFontSize( textElement, applyFontSize );\n\n\tapplyFontSize( optimalSize );\n\treturn optimalSize;\n}\n"],
|
|
5
|
+
"mappings": ";AAYA,SAAS,oBAAqB,aAAa,eAAgB;AAC1D,QAAM,6BACL,YAAY,eAAe,YAAY;AACxC,MAAI,UAAU;AACd,MAAI,UAAU;AACd,MAAI,WAAW;AAEf,QAAM,gBAAgB,OAAO,iBAAkB,WAAY;AAC3D,MAAI,cAAc,WAAY,cAAc,WAAY,KAAK;AAC7D,MAAI,eAAe,WAAY,cAAc,YAAa,KAAK;AAC/D,QAAM,QAAQ,SAAS,YAAY;AACnC,QAAM,mBAAoB,WAAY;AAEtC,MAAI,mBAAmB;AACvB,QAAM,gBAAgB,YAAY;AAClC,MAAK,eAAgB;AACpB,UAAM,6BACL,OAAO,iBAAkB,aAAc;AACxC,QAAK,4BAA4B,YAAY,QAAS;AACrD,yBAAmB;AACnB,qBACC,WAAY,2BAA2B,WAAY,KAAK;AACzD,sBACC,WAAY,2BAA2B,YAAa,KAAK;AAAA,IAC3D;AAAA,EACD;AACA,MAAI,kBAAkB,iBAAiB;AAEvC,SAAQ,WAAW,SAAU;AAC5B,UAAM,UAAU,KAAK,OAAS,UAAU,WAAY,CAAE;AACtD,kBAAe,OAAQ;AAKvB,UAAM,OAAO,MAAM,sBAAsB;AACzC,UAAM,YAAY,KAAK;AAIvB,UAAM,YACL,YAAY,eAAe,iBAAiB,eAC5C,aACC,iBAAiB,cAAc,cAAc;AAE/C,UAAM,aACL,8BACA,YAAY,gBAAgB,iBAAiB,gBAC7C,YAAY,gBAAgB;AAO7B,QAAK,iBAAiB,eAAe,iBAAkB;AACtD,wBAAkB,iBAAiB;AAAA,IACpC;AAEA,QAAK,aAAa,YAAa;AAC9B,iBAAW;AACX,gBAAU,UAAU;AAAA,IACrB,OAAO;AACN,gBAAU,UAAU;AAAA,IACrB;AAAA,EACD;AACA,QAAM,OAAO;AAEb,SAAO;AACR;AASO,SAAS,gBAAiB,aAAa,eAAgB;AAC7D,MAAK,CAAE,aAAc;AACpB;AAAA,EACD;AAEA,gBAAe,CAAE;AAEjB,QAAM,cAAc,oBAAqB,aAAa,aAAc;AAEpE,gBAAe,WAAY;AAC3B,SAAO;AACR;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -503,6 +503,16 @@ _::-webkit-full-page-media, _:future, :root [data-has-multi-selection=true] .blo
|
|
|
503
503
|
cursor: grabbing;
|
|
504
504
|
}
|
|
505
505
|
|
|
506
|
+
.is-preview-mode {
|
|
507
|
+
pointer-events: none;
|
|
508
|
+
}
|
|
509
|
+
.is-preview-mode .block-editor-block-list__block {
|
|
510
|
+
pointer-events: auto;
|
|
511
|
+
}
|
|
512
|
+
.is-preview-mode .block-editor-block-list__block > *:not(.block-editor-block-list__block) {
|
|
513
|
+
pointer-events: none;
|
|
514
|
+
}
|
|
515
|
+
|
|
506
516
|
.is-vertical .block-list-appender {
|
|
507
517
|
width: 24px;
|
|
508
518
|
margin-left: auto;
|
package/build-style/content.css
CHANGED
|
@@ -503,6 +503,16 @@ _::-webkit-full-page-media, _:future, :root [data-has-multi-selection=true] .blo
|
|
|
503
503
|
cursor: grabbing;
|
|
504
504
|
}
|
|
505
505
|
|
|
506
|
+
.is-preview-mode {
|
|
507
|
+
pointer-events: none;
|
|
508
|
+
}
|
|
509
|
+
.is-preview-mode .block-editor-block-list__block {
|
|
510
|
+
pointer-events: auto;
|
|
511
|
+
}
|
|
512
|
+
.is-preview-mode .block-editor-block-list__block > *:not(.block-editor-block-list__block) {
|
|
513
|
+
pointer-events: none;
|
|
514
|
+
}
|
|
515
|
+
|
|
506
516
|
.is-vertical .block-list-appender {
|
|
507
517
|
width: 24px;
|
|
508
518
|
margin-right: auto;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wordpress/block-editor",
|
|
3
|
-
"version": "15.
|
|
3
|
+
"version": "15.12.1-next.v.0+5aba098fc",
|
|
4
4
|
"description": "Generic block editor.",
|
|
5
5
|
"author": "The WordPress Contributors",
|
|
6
6
|
"license": "GPL-2.0-or-later",
|
|
@@ -61,43 +61,43 @@
|
|
|
61
61
|
],
|
|
62
62
|
"dependencies": {
|
|
63
63
|
"@react-spring/web": "^9.4.5",
|
|
64
|
-
"@wordpress/a11y": "^4.
|
|
65
|
-
"@wordpress/api-fetch": "^7.
|
|
66
|
-
"@wordpress/base-styles": "^6.
|
|
67
|
-
"@wordpress/blob": "^4.
|
|
68
|
-
"@wordpress/block-serialization-default-parser": "^5.
|
|
69
|
-
"@wordpress/blocks": "^15.
|
|
70
|
-
"@wordpress/commands": "^1.
|
|
71
|
-
"@wordpress/components": "^32.
|
|
72
|
-
"@wordpress/compose": "^7.
|
|
73
|
-
"@wordpress/data": "^10.
|
|
74
|
-
"@wordpress/dataviews": "^11.
|
|
75
|
-
"@wordpress/date": "^5.
|
|
76
|
-
"@wordpress/deprecated": "^4.
|
|
77
|
-
"@wordpress/dom": "^4.
|
|
78
|
-
"@wordpress/element": "^6.
|
|
79
|
-
"@wordpress/escape-html": "^3.
|
|
80
|
-
"@wordpress/global-styles-engine": "^1.
|
|
81
|
-
"@wordpress/hooks": "^4.
|
|
82
|
-
"@wordpress/html-entities": "^4.
|
|
83
|
-
"@wordpress/i18n": "^6.
|
|
84
|
-
"@wordpress/icons": "^11.
|
|
85
|
-
"@wordpress/image-cropper": "^1.
|
|
86
|
-
"@wordpress/interactivity": "^6.
|
|
87
|
-
"@wordpress/is-shallow-equal": "^5.
|
|
88
|
-
"@wordpress/keyboard-shortcuts": "^5.
|
|
89
|
-
"@wordpress/keycodes": "^4.
|
|
90
|
-
"@wordpress/notices": "^5.
|
|
91
|
-
"@wordpress/preferences": "^4.
|
|
92
|
-
"@wordpress/priority-queue": "^3.
|
|
93
|
-
"@wordpress/private-apis": "^1.
|
|
94
|
-
"@wordpress/rich-text": "^7.
|
|
95
|
-
"@wordpress/style-engine": "^2.
|
|
96
|
-
"@wordpress/token-list": "^3.
|
|
97
|
-
"@wordpress/upload-media": "^0.
|
|
98
|
-
"@wordpress/url": "^4.
|
|
99
|
-
"@wordpress/warning": "^3.
|
|
100
|
-
"@wordpress/wordcount": "^4.
|
|
64
|
+
"@wordpress/a11y": "^4.39.1-next.v.0+5aba098fc",
|
|
65
|
+
"@wordpress/api-fetch": "^7.39.1-next.v.0+5aba098fc",
|
|
66
|
+
"@wordpress/base-styles": "^6.15.1-next.v.0+5aba098fc",
|
|
67
|
+
"@wordpress/blob": "^4.39.1-next.v.0+5aba098fc",
|
|
68
|
+
"@wordpress/block-serialization-default-parser": "^5.39.1-next.v.0+5aba098fc",
|
|
69
|
+
"@wordpress/blocks": "^15.12.1-next.v.0+5aba098fc",
|
|
70
|
+
"@wordpress/commands": "^1.39.1-next.v.0+5aba098fc",
|
|
71
|
+
"@wordpress/components": "^32.1.1-next.v.0+5aba098fc",
|
|
72
|
+
"@wordpress/compose": "^7.39.1-next.v.0+5aba098fc",
|
|
73
|
+
"@wordpress/data": "^10.39.1-next.v.0+5aba098fc",
|
|
74
|
+
"@wordpress/dataviews": "^11.4.1-next.v.0+5aba098fc",
|
|
75
|
+
"@wordpress/date": "^5.39.1-next.v.0+5aba098fc",
|
|
76
|
+
"@wordpress/deprecated": "^4.39.1-next.v.0+5aba098fc",
|
|
77
|
+
"@wordpress/dom": "^4.39.1-next.v.0+5aba098fc",
|
|
78
|
+
"@wordpress/element": "^6.39.1-next.v.0+5aba098fc",
|
|
79
|
+
"@wordpress/escape-html": "^3.39.1-next.v.0+5aba098fc",
|
|
80
|
+
"@wordpress/global-styles-engine": "^1.6.1-next.v.0+5aba098fc",
|
|
81
|
+
"@wordpress/hooks": "^4.39.1-next.v.0+5aba098fc",
|
|
82
|
+
"@wordpress/html-entities": "^4.39.1-next.v.0+5aba098fc",
|
|
83
|
+
"@wordpress/i18n": "^6.12.1-next.v.0+5aba098fc",
|
|
84
|
+
"@wordpress/icons": "^11.6.1-next.v.0+5aba098fc",
|
|
85
|
+
"@wordpress/image-cropper": "^1.3.1-next.v.0+5aba098fc",
|
|
86
|
+
"@wordpress/interactivity": "^6.39.1-next.v.0+5aba098fc",
|
|
87
|
+
"@wordpress/is-shallow-equal": "^5.39.1-next.v.0+5aba098fc",
|
|
88
|
+
"@wordpress/keyboard-shortcuts": "^5.39.1-next.v.0+5aba098fc",
|
|
89
|
+
"@wordpress/keycodes": "^4.39.1-next.v.0+5aba098fc",
|
|
90
|
+
"@wordpress/notices": "^5.39.1-next.v.0+5aba098fc",
|
|
91
|
+
"@wordpress/preferences": "^4.39.1-next.v.0+5aba098fc",
|
|
92
|
+
"@wordpress/priority-queue": "^3.39.1-next.v.0+5aba098fc",
|
|
93
|
+
"@wordpress/private-apis": "^1.39.1-next.v.0+5aba098fc",
|
|
94
|
+
"@wordpress/rich-text": "^7.39.1-next.v.0+5aba098fc",
|
|
95
|
+
"@wordpress/style-engine": "^2.39.1-next.v.0+5aba098fc",
|
|
96
|
+
"@wordpress/token-list": "^3.39.1-next.v.0+5aba098fc",
|
|
97
|
+
"@wordpress/upload-media": "^0.24.1-next.v.0+5aba098fc",
|
|
98
|
+
"@wordpress/url": "^4.39.1-next.v.0+5aba098fc",
|
|
99
|
+
"@wordpress/warning": "^3.39.1-next.v.0+5aba098fc",
|
|
100
|
+
"@wordpress/wordcount": "^4.39.1-next.v.0+5aba098fc",
|
|
101
101
|
"change-case": "^4.1.2",
|
|
102
102
|
"clsx": "^2.1.1",
|
|
103
103
|
"colord": "^2.7.0",
|
|
@@ -124,5 +124,5 @@
|
|
|
124
124
|
"publishConfig": {
|
|
125
125
|
"access": "public"
|
|
126
126
|
},
|
|
127
|
-
"gitHead": "
|
|
127
|
+
"gitHead": "d730f9e00f5462d1b9d2660632850f5f43ccff44"
|
|
128
128
|
}
|
|
@@ -103,6 +103,7 @@ function BlockBreadcrumb( { rootLabelText } ) {
|
|
|
103
103
|
<BlockTitle
|
|
104
104
|
clientId={ parentClientId }
|
|
105
105
|
maximumLength={ 35 }
|
|
106
|
+
context="breadcrumb"
|
|
106
107
|
/>
|
|
107
108
|
</Button>
|
|
108
109
|
<Icon
|
|
@@ -116,7 +117,11 @@ function BlockBreadcrumb( { rootLabelText } ) {
|
|
|
116
117
|
className="block-editor-block-breadcrumb__current"
|
|
117
118
|
aria-current="true"
|
|
118
119
|
>
|
|
119
|
-
<BlockTitle
|
|
120
|
+
<BlockTitle
|
|
121
|
+
clientId={ clientId }
|
|
122
|
+
maximumLength={ 35 }
|
|
123
|
+
context="breadcrumb"
|
|
124
|
+
/>
|
|
120
125
|
</li>
|
|
121
126
|
) }
|
|
122
127
|
</ul>
|
|
@@ -5,6 +5,7 @@ import { __ } from '@wordpress/i18n';
|
|
|
5
5
|
import {
|
|
6
6
|
getBlockType,
|
|
7
7
|
getUnregisteredTypeHandlerName,
|
|
8
|
+
hasBlockSupport,
|
|
8
9
|
store as blocksStore,
|
|
9
10
|
} from '@wordpress/blocks';
|
|
10
11
|
import { __unstableMotion as motion } from '@wordpress/components';
|
|
@@ -24,6 +25,7 @@ import BlockStyles from '../block-styles';
|
|
|
24
25
|
import { default as InspectorControls } from '../inspector-controls';
|
|
25
26
|
import { default as InspectorControlsTabs } from '../inspector-controls-tabs';
|
|
26
27
|
import useInspectorControlsTabs from '../inspector-controls-tabs/use-inspector-controls-tabs';
|
|
28
|
+
import InspectorControlsLastItem from '../inspector-controls/last-item';
|
|
27
29
|
import AdvancedControls from '../inspector-controls-tabs/advanced-controls-panel';
|
|
28
30
|
import PositionControls from '../inspector-controls-tabs/position-controls-panel';
|
|
29
31
|
import useBlockInspectorAnimationSettings from './useBlockInspectorAnimationSettings';
|
|
@@ -145,30 +147,29 @@ function BlockInspector() {
|
|
|
145
147
|
renderedBlockClientId
|
|
146
148
|
);
|
|
147
149
|
|
|
148
|
-
//
|
|
149
|
-
//
|
|
150
|
-
|
|
151
|
-
// This prevents a poor UX where all Nav block sub-items are shown
|
|
152
|
-
// when the parent block is in contentOnly mode.
|
|
153
|
-
// Build a Set of all navigation block descendants for efficient lookup
|
|
154
|
-
const navigationDescendants = new Set();
|
|
150
|
+
// Exclude items from the content tab that are already present in the
|
|
151
|
+
// List View tab.
|
|
152
|
+
const listViewDescendants = new Set();
|
|
155
153
|
descendants.forEach( ( clientId ) => {
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
154
|
+
const blockName = getBlockName( clientId );
|
|
155
|
+
// Navigation block doesn't have List View block support, but
|
|
156
|
+
// it does have a custom implementation that is shown within
|
|
157
|
+
// patterns, so it's included in this condition.
|
|
158
|
+
if (
|
|
159
|
+
blockName === 'core/navigation' ||
|
|
160
|
+
hasBlockSupport( blockName, 'listView' )
|
|
161
|
+
) {
|
|
162
|
+
const listViewChildren =
|
|
163
|
+
getClientIdsOfDescendants( clientId );
|
|
164
|
+
listViewChildren.forEach( ( childId ) =>
|
|
165
|
+
listViewDescendants.add( childId )
|
|
160
166
|
);
|
|
161
167
|
}
|
|
162
168
|
} );
|
|
163
169
|
|
|
164
170
|
return descendants.filter( ( current ) => {
|
|
165
|
-
// Exclude navigation block children
|
|
166
|
-
if ( navigationDescendants.has( current ) ) {
|
|
167
|
-
return false;
|
|
168
|
-
}
|
|
169
|
-
|
|
170
171
|
return (
|
|
171
|
-
|
|
172
|
+
! listViewDescendants.has( current ) &&
|
|
172
173
|
getBlockEditingMode( current ) === 'contentOnly'
|
|
173
174
|
);
|
|
174
175
|
} );
|
|
@@ -315,7 +316,6 @@ const BlockInspectorSingleBlock = ( {
|
|
|
315
316
|
} ) => {
|
|
316
317
|
const hasMultipleTabs = availableTabs?.length > 1;
|
|
317
318
|
const hasParentChildBlockCards =
|
|
318
|
-
window?.__experimentalContentOnlyPatternInsertion &&
|
|
319
319
|
editedContentOnlySection &&
|
|
320
320
|
editedContentOnlySection !== renderedBlockClientId;
|
|
321
321
|
const parentBlockInformation = useBlockDisplayInformation(
|
|
@@ -343,9 +343,7 @@ const BlockInspectorSingleBlock = ( {
|
|
|
343
343
|
clientId={ renderedBlockClientId }
|
|
344
344
|
/>
|
|
345
345
|
<ViewportVisibilityInfo clientId={ renderedBlockClientId } />
|
|
346
|
-
{
|
|
347
|
-
<EditContents clientId={ renderedBlockClientId } />
|
|
348
|
-
) }
|
|
346
|
+
<EditContents clientId={ renderedBlockClientId } />
|
|
349
347
|
<BlockVariationTransforms blockClientId={ renderedBlockClientId } />
|
|
350
348
|
{ hasMultipleTabs && (
|
|
351
349
|
<>
|
|
@@ -372,6 +370,7 @@ const BlockInspectorSingleBlock = ( {
|
|
|
372
370
|
) }
|
|
373
371
|
</>
|
|
374
372
|
) }
|
|
373
|
+
<InspectorControlsLastItem.Slot />
|
|
375
374
|
<SkipToSelectedBlock key="back" />
|
|
376
375
|
</div>
|
|
377
376
|
);
|
|
@@ -624,6 +624,8 @@ function BlockListBlockProvider( props ) {
|
|
|
624
624
|
settings?.[ deviceTypeKey ]?.toLowerCase() || 'desktop';
|
|
625
625
|
|
|
626
626
|
const hasLightBlockWrapper = blockType?.apiVersion > 1;
|
|
627
|
+
const isMultiSelected = isBlockMultiSelected( clientId );
|
|
628
|
+
const blockEditingMode = getBlockEditingMode( clientId );
|
|
627
629
|
const previewContext = {
|
|
628
630
|
isPreviewMode,
|
|
629
631
|
blockWithoutAttributes,
|
|
@@ -643,6 +645,9 @@ function BlockListBlockProvider( props ) {
|
|
|
643
645
|
bindableAttributes,
|
|
644
646
|
blockVisibility,
|
|
645
647
|
deviceType,
|
|
648
|
+
isMultiSelected,
|
|
649
|
+
blockEditingMode,
|
|
650
|
+
isEditingDisabled: blockEditingMode === 'disabled',
|
|
646
651
|
};
|
|
647
652
|
|
|
648
653
|
// When in preview mode, we can avoid a lot of selection and
|
|
@@ -654,13 +659,11 @@ function BlockListBlockProvider( props ) {
|
|
|
654
659
|
const canRemove = canRemoveBlock( clientId );
|
|
655
660
|
const canMove = canMoveBlock( clientId );
|
|
656
661
|
const match = getActiveBlockVariation( blockName, attributes );
|
|
657
|
-
const isMultiSelected = isBlockMultiSelected( clientId );
|
|
658
662
|
const checkDeep = true;
|
|
659
663
|
const isAncestorOfSelectedBlock = hasSelectedInnerBlock(
|
|
660
664
|
clientId,
|
|
661
665
|
checkDeep
|
|
662
666
|
);
|
|
663
|
-
const blockEditingMode = getBlockEditingMode( clientId );
|
|
664
667
|
const sectionBlockClientId = _isSectionBlock( clientId )
|
|
665
668
|
? clientId
|
|
666
669
|
: getParentSectionBlock( clientId );
|
|
@@ -476,3 +476,14 @@ _::-webkit-full-page-media, _:future, :root [data-has-multi-selection="true"] .b
|
|
|
476
476
|
cursor: grabbing;
|
|
477
477
|
}
|
|
478
478
|
|
|
479
|
+
.is-preview-mode {
|
|
480
|
+
pointer-events: none;
|
|
481
|
+
|
|
482
|
+
.block-editor-block-list__block {
|
|
483
|
+
pointer-events: auto;
|
|
484
|
+
|
|
485
|
+
> *:not(.block-editor-block-list__block) {
|
|
486
|
+
pointer-events: none;
|
|
487
|
+
}
|
|
488
|
+
}
|
|
489
|
+
}
|
|
@@ -48,23 +48,30 @@ const delayedBlockVisibilityDebounceOptions = {
|
|
|
48
48
|
};
|
|
49
49
|
|
|
50
50
|
function Root( { className, ...settings } ) {
|
|
51
|
-
const {
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
51
|
+
const {
|
|
52
|
+
isOutlineMode,
|
|
53
|
+
isFocusMode,
|
|
54
|
+
isPreviewMode,
|
|
55
|
+
editedContentOnlySection,
|
|
56
|
+
} = useSelect( ( select ) => {
|
|
57
|
+
const {
|
|
58
|
+
getSettings,
|
|
59
|
+
isTyping,
|
|
60
|
+
hasBlockSpotlight,
|
|
61
|
+
getEditedContentOnlySection,
|
|
62
|
+
} = unlock( select( blockEditorStore ) );
|
|
63
|
+
const {
|
|
64
|
+
outlineMode,
|
|
65
|
+
focusMode,
|
|
66
|
+
isPreviewMode: _isPreviewMode,
|
|
67
|
+
} = getSettings();
|
|
68
|
+
return {
|
|
69
|
+
isOutlineMode: outlineMode && ! isTyping(),
|
|
70
|
+
isFocusMode: focusMode || hasBlockSpotlight(),
|
|
71
|
+
isPreviewMode: _isPreviewMode,
|
|
72
|
+
editedContentOnlySection: getEditedContentOnlySection(),
|
|
73
|
+
};
|
|
74
|
+
}, [] );
|
|
68
75
|
const registry = useRegistry();
|
|
69
76
|
const { setBlockVisibility } = useDispatch( blockEditorStore );
|
|
70
77
|
|
|
@@ -111,6 +118,7 @@ function Root( { className, ...settings } ) {
|
|
|
111
118
|
className: clsx( 'is-root-container', className, {
|
|
112
119
|
'is-outline-mode': isOutlineMode,
|
|
113
120
|
'is-focus-mode': isFocusMode,
|
|
121
|
+
'is-preview-mode': isPreviewMode,
|
|
114
122
|
} ),
|
|
115
123
|
},
|
|
116
124
|
settings
|
|
@@ -319,17 +319,12 @@ export function useEventHandlers( { clientId, isSelected } ) {
|
|
|
319
319
|
editContentOnlySection( clientId );
|
|
320
320
|
}
|
|
321
321
|
|
|
322
|
-
|
|
323
|
-
if ( window?.__experimentalContentOnlyPatternInsertion ) {
|
|
324
|
-
node.addEventListener( 'dblclick', onDoubleClick );
|
|
325
|
-
}
|
|
322
|
+
node.addEventListener( 'dblclick', onDoubleClick );
|
|
326
323
|
|
|
327
324
|
return () => {
|
|
328
325
|
node.removeEventListener( 'keydown', onKeyDown );
|
|
329
326
|
node.removeEventListener( 'dragstart', onDragStart );
|
|
330
|
-
|
|
331
|
-
node.removeEventListener( 'dblclick', onDoubleClick );
|
|
332
|
-
}
|
|
327
|
+
node.removeEventListener( 'dblclick', onDoubleClick );
|
|
333
328
|
};
|
|
334
329
|
},
|
|
335
330
|
[
|
|
@@ -15,12 +15,14 @@ import { unlock } from '../../lock-unlock';
|
|
|
15
15
|
|
|
16
16
|
export function useInBetweenInserter() {
|
|
17
17
|
const openRef = useContext( InsertionPointOpenRef );
|
|
18
|
-
const isInBetweenInserterDisabled = useSelect(
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
18
|
+
const isInBetweenInserterDisabled = useSelect( ( select ) => {
|
|
19
|
+
const settings = select( blockEditorStore ).getSettings();
|
|
20
|
+
return (
|
|
21
|
+
settings.isDistractionFree ||
|
|
22
|
+
settings.isPreviewMode ||
|
|
23
|
+
unlock( select( blockEditorStore ) ).isZoomOut()
|
|
24
|
+
);
|
|
25
|
+
}, [] );
|
|
24
26
|
const {
|
|
25
27
|
getBlockListSettings,
|
|
26
28
|
getBlockIndex,
|
|
@@ -87,6 +87,7 @@ export function BlockSettingsDropdown( {
|
|
|
87
87
|
selectedBlockClientIds,
|
|
88
88
|
isContentOnly,
|
|
89
89
|
isZoomOut,
|
|
90
|
+
canEdit,
|
|
90
91
|
} = useSelect(
|
|
91
92
|
( select ) => {
|
|
92
93
|
const {
|
|
@@ -97,6 +98,7 @@ export function BlockSettingsDropdown( {
|
|
|
97
98
|
getBlockAttributes,
|
|
98
99
|
getBlockEditingMode,
|
|
99
100
|
isZoomOut: _isZoomOut,
|
|
101
|
+
canEditBlock,
|
|
100
102
|
} = unlock( select( blockEditorStore ) );
|
|
101
103
|
|
|
102
104
|
const { getActiveBlockVariation } = select( blocksStore );
|
|
@@ -121,6 +123,7 @@ export function BlockSettingsDropdown( {
|
|
|
121
123
|
isContentOnly:
|
|
122
124
|
getBlockEditingMode( firstBlockClientId ) === 'contentOnly',
|
|
123
125
|
isZoomOut: _isZoomOut(),
|
|
126
|
+
canEdit: canEditBlock( firstBlockClientId ),
|
|
124
127
|
};
|
|
125
128
|
},
|
|
126
129
|
[ firstBlockClientId ]
|
|
@@ -240,7 +243,7 @@ export function BlockSettingsDropdown( {
|
|
|
240
243
|
parentBlockType={ parentBlockType }
|
|
241
244
|
/>
|
|
242
245
|
) }
|
|
243
|
-
{ count === 1 && (
|
|
246
|
+
{ canEdit && count === 1 && (
|
|
244
247
|
<BlockHTMLConvertButton
|
|
245
248
|
clientId={ firstBlockClientId }
|
|
246
249
|
/>
|
|
@@ -252,7 +255,7 @@ export function BlockSettingsDropdown( {
|
|
|
252
255
|
shortcut={ shortcuts.copy }
|
|
253
256
|
/>
|
|
254
257
|
) }
|
|
255
|
-
{ ! isContentOnly && (
|
|
258
|
+
{ canRemove && ! isContentOnly && (
|
|
256
259
|
<CopyMenuItem
|
|
257
260
|
clientIds={ clientIds }
|
|
258
261
|
label={ __( 'Cut' ) }
|
|
@@ -301,7 +304,7 @@ export function BlockSettingsDropdown( {
|
|
|
301
304
|
</MenuItem>
|
|
302
305
|
</>
|
|
303
306
|
) }
|
|
304
|
-
{ count === 1 && (
|
|
307
|
+
{ canEdit && count === 1 && (
|
|
305
308
|
<CommentIconSlotFill.Slot
|
|
306
309
|
fillProps={ {
|
|
307
310
|
clientId: firstBlockClientId,
|
|
@@ -318,9 +321,11 @@ export function BlockSettingsDropdown( {
|
|
|
318
321
|
label={ __( 'Copy styles' ) }
|
|
319
322
|
eventType="copyStyles"
|
|
320
323
|
/>
|
|
321
|
-
|
|
322
|
-
{
|
|
323
|
-
|
|
324
|
+
{ canEdit && (
|
|
325
|
+
<MenuItem onClick={ onPasteStyles }>
|
|
326
|
+
{ __( 'Paste styles' ) }
|
|
327
|
+
</MenuItem>
|
|
328
|
+
) }
|
|
324
329
|
</MenuGroup>
|
|
325
330
|
) }
|
|
326
331
|
{ ! isContentOnly && (
|
|
@@ -31,13 +31,7 @@ export function EditSectionMenuItem( { clientId, onClose } ) {
|
|
|
31
31
|
[ clientId ]
|
|
32
32
|
);
|
|
33
33
|
|
|
34
|
-
|
|
35
|
-
// and we're not already editing it
|
|
36
|
-
if (
|
|
37
|
-
! window?.__experimentalContentOnlyPatternInsertion ||
|
|
38
|
-
! isSectionBlock ||
|
|
39
|
-
isEditingContentOnlySection
|
|
40
|
-
) {
|
|
34
|
+
if ( ! isSectionBlock || isEditingContentOnlySection ) {
|
|
41
35
|
return null;
|
|
42
36
|
}
|
|
43
37
|
|
|
@@ -19,7 +19,6 @@ import {
|
|
|
19
19
|
import { BlockLockMenuItem, useBlockLock } from '../block-lock';
|
|
20
20
|
import { store as blockEditorStore } from '../../store';
|
|
21
21
|
import BlockModeToggle from '../block-settings-menu/block-mode-toggle';
|
|
22
|
-
import { ModifyContentOnlySectionMenuItem } from '../content-lock';
|
|
23
22
|
import { BlockRenameControl, useBlockRename } from '../block-rename';
|
|
24
23
|
import { BlockVisibilityViewportMenuItem } from '../block-visibility';
|
|
25
24
|
import { EditSectionMenuItem } from './edit-section-menu-item';
|
|
@@ -32,6 +31,7 @@ const BlockSettingsMenuControlsSlot = ( { fillProps, clientIds = null } ) => {
|
|
|
32
31
|
selectedClientIds,
|
|
33
32
|
isContentOnly,
|
|
34
33
|
canToggleSelectedBlocksVisibility,
|
|
34
|
+
canEdit,
|
|
35
35
|
} = useSelect(
|
|
36
36
|
( select ) => {
|
|
37
37
|
const {
|
|
@@ -39,6 +39,7 @@ const BlockSettingsMenuControlsSlot = ( { fillProps, clientIds = null } ) => {
|
|
|
39
39
|
getBlockNamesByClientId,
|
|
40
40
|
getSelectedBlockClientIds,
|
|
41
41
|
getBlockEditingMode,
|
|
42
|
+
canEditBlock,
|
|
42
43
|
} = select( blockEditorStore );
|
|
43
44
|
const ids =
|
|
44
45
|
clientIds !== null ? clientIds : getSelectedBlockClientIds();
|
|
@@ -52,6 +53,7 @@ const BlockSettingsMenuControlsSlot = ( { fillProps, clientIds = null } ) => {
|
|
|
52
53
|
).every( ( block ) =>
|
|
53
54
|
hasBlockSupport( block.name, 'visibility', true )
|
|
54
55
|
),
|
|
56
|
+
canEdit: canEditBlock( ids[ 0 ] ),
|
|
55
57
|
};
|
|
56
58
|
},
|
|
57
59
|
[ clientIds ]
|
|
@@ -105,34 +107,30 @@ const BlockSettingsMenuControlsSlot = ( { fillProps, clientIds = null } ) => {
|
|
|
105
107
|
onClose={ fillProps?.onClose }
|
|
106
108
|
/>
|
|
107
109
|
) }
|
|
108
|
-
{ showLockButton && (
|
|
110
|
+
{ canEdit && showLockButton && (
|
|
109
111
|
<BlockLockMenuItem
|
|
110
112
|
clientId={ selectedClientIds[ 0 ] }
|
|
111
113
|
/>
|
|
112
114
|
) }
|
|
113
|
-
{ showRenameButton && (
|
|
115
|
+
{ canEdit && showRenameButton && (
|
|
114
116
|
<BlockRenameControl
|
|
115
117
|
clientId={ selectedClientIds[ 0 ] }
|
|
116
118
|
/>
|
|
117
119
|
) }
|
|
118
|
-
{ showVisibilityButton && (
|
|
120
|
+
{ canEdit && showVisibilityButton && (
|
|
119
121
|
<BlockVisibilityViewportMenuItem
|
|
120
122
|
clientIds={ selectedClientIds }
|
|
121
123
|
/>
|
|
122
124
|
) }
|
|
123
125
|
{ fills }
|
|
124
|
-
{
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
clientId={ fillProps?.firstBlockClientId }
|
|
133
|
-
onToggle={ fillProps?.onClose }
|
|
134
|
-
/>
|
|
135
|
-
) }
|
|
126
|
+
{ canEdit &&
|
|
127
|
+
fillProps?.count === 1 &&
|
|
128
|
+
! isContentOnly && (
|
|
129
|
+
<BlockModeToggle
|
|
130
|
+
clientId={ fillProps?.firstBlockClientId }
|
|
131
|
+
onToggle={ fillProps?.onClose }
|
|
132
|
+
/>
|
|
133
|
+
) }
|
|
136
134
|
</MenuGroup>
|
|
137
135
|
);
|
|
138
136
|
} }
|