@wordpress/block-editor 15.8.0 → 15.8.1-next.dc3f6d3c1.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-inspector/edit-contents.js +19 -23
- package/build/components/block-inspector/edit-contents.js.map +3 -3
- package/build/components/block-inspector/index.js +7 -1
- package/build/components/block-inspector/index.js.map +2 -2
- package/build/components/block-list/block.js +4 -0
- package/build/components/block-list/block.js.map +2 -2
- package/build/components/block-list/use-block-props/index.js +3 -1
- package/build/components/block-list/use-block-props/index.js.map +2 -2
- package/build/components/block-list/use-block-props/use-is-hovered.js +16 -10
- package/build/components/block-list/use-block-props/use-is-hovered.js.map +2 -2
- package/build/components/block-settings-menu-controls/edit-section-menu-item.js +64 -0
- package/build/components/block-settings-menu-controls/edit-section-menu-item.js.map +7 -0
- package/build/components/block-settings-menu-controls/index.js +8 -0
- package/build/components/block-settings-menu-controls/index.js.map +2 -2
- package/build/components/block-toolbar/block-toolbar-icon.js +9 -9
- package/build/components/block-toolbar/block-toolbar-icon.js.map +2 -2
- package/build/components/block-variation-transforms/index.js +32 -5
- package/build/components/block-variation-transforms/index.js.map +2 -2
- package/build/components/border-radius-control/single-input-control.js +1 -0
- package/build/components/border-radius-control/single-input-control.js.map +2 -2
- package/build/components/content-only-controls/index.js +263 -0
- package/build/components/content-only-controls/index.js.map +7 -0
- package/build/components/content-only-controls/link/index.js +204 -0
- package/build/components/content-only-controls/link/index.js.map +7 -0
- package/build/components/content-only-controls/media/index.js +264 -0
- package/build/components/content-only-controls/media/index.js.map +7 -0
- package/build/components/content-only-controls/plain-text/index.js +68 -0
- package/build/components/content-only-controls/plain-text/index.js.map +7 -0
- package/build/components/content-only-controls/rich-text/index.js +197 -0
- package/build/components/content-only-controls/rich-text/index.js.map +7 -0
- package/build/components/content-only-controls/use-inspector-popover-placement.js +41 -0
- package/build/components/content-only-controls/use-inspector-popover-placement.js.map +7 -0
- package/build/components/global-styles/typography-panel.js +16 -10
- package/build/components/global-styles/typography-panel.js.map +2 -2
- package/build/components/inserter/media-tab/media-tab.js +1 -33
- package/build/components/inserter/media-tab/media-tab.js.map +3 -3
- package/build/components/inspector-controls-tabs/content-tab.js +6 -2
- package/build/components/inspector-controls-tabs/content-tab.js.map +3 -3
- package/build/components/inspector-controls-tabs/index.js +7 -1
- package/build/components/inspector-controls-tabs/index.js.map +2 -2
- package/build/components/list-view/block-select-button.js +11 -4
- package/build/components/list-view/block-select-button.js.map +2 -2
- package/build/components/media-placeholder/index.js +1 -31
- package/build/components/media-placeholder/index.js.map +3 -3
- package/build/components/media-replace-flow/index.js +4 -30
- package/build/components/media-replace-flow/index.js.map +3 -3
- package/build/components/rich-text/format-edit.js +9 -1
- package/build/components/rich-text/format-edit.js.map +2 -2
- package/build/components/use-block-display-information/index.js +21 -1
- package/build/components/use-block-display-information/index.js.map +3 -3
- package/build/hooks/block-bindings.js +52 -61
- package/build/hooks/block-bindings.js.map +3 -3
- package/build/hooks/use-content-only-section-edit.js +67 -0
- package/build/hooks/use-content-only-section-edit.js.map +7 -0
- package/build/layouts/constrained.js +2 -2
- package/build/layouts/constrained.js.map +2 -2
- package/build/private-apis.js +2 -3
- package/build/private-apis.js.map +3 -3
- package/build/store/private-keys.js +3 -0
- package/build/store/private-keys.js.map +2 -2
- package/build/store/private-selectors.js +1 -2
- package/build/store/private-selectors.js.map +2 -2
- package/build/store/reducer.js +1 -2
- package/build/store/reducer.js.map +2 -2
- package/build/store/selectors.js +3 -0
- package/build/store/selectors.js.map +2 -2
- package/build/utils/fit-text-utils.js +9 -1
- package/build/utils/fit-text-utils.js.map +2 -2
- package/build-module/components/block-inspector/edit-contents.js +9 -23
- package/build-module/components/block-inspector/edit-contents.js.map +2 -2
- package/build-module/components/block-inspector/index.js +7 -1
- package/build-module/components/block-inspector/index.js.map +2 -2
- package/build-module/components/block-list/block.js +4 -0
- package/build-module/components/block-list/block.js.map +2 -2
- package/build-module/components/block-list/use-block-props/index.js +3 -1
- package/build-module/components/block-list/use-block-props/index.js.map +2 -2
- package/build-module/components/block-list/use-block-props/use-is-hovered.js +16 -10
- package/build-module/components/block-list/use-block-props/use-is-hovered.js.map +2 -2
- package/build-module/components/block-settings-menu-controls/edit-section-menu-item.js +29 -0
- package/build-module/components/block-settings-menu-controls/edit-section-menu-item.js.map +7 -0
- package/build-module/components/block-settings-menu-controls/index.js +8 -0
- package/build-module/components/block-settings-menu-controls/index.js.map +2 -2
- package/build-module/components/block-toolbar/block-toolbar-icon.js +10 -10
- package/build-module/components/block-toolbar/block-toolbar-icon.js.map +2 -2
- package/build-module/components/block-variation-transforms/index.js +32 -5
- package/build-module/components/block-variation-transforms/index.js.map +2 -2
- package/build-module/components/border-radius-control/single-input-control.js +1 -0
- package/build-module/components/border-radius-control/single-input-control.js.map +2 -2
- package/build-module/components/content-only-controls/index.js +237 -0
- package/build-module/components/content-only-controls/index.js.map +7 -0
- package/build-module/components/content-only-controls/link/index.js +172 -0
- package/build-module/components/content-only-controls/link/index.js.map +7 -0
- package/build-module/components/content-only-controls/media/index.js +243 -0
- package/build-module/components/content-only-controls/media/index.js.map +7 -0
- package/build-module/components/content-only-controls/plain-text/index.js +50 -0
- package/build-module/components/content-only-controls/plain-text/index.js.map +7 -0
- package/build-module/components/content-only-controls/rich-text/index.js +174 -0
- package/build-module/components/content-only-controls/rich-text/index.js.map +7 -0
- package/build-module/components/content-only-controls/use-inspector-popover-placement.js +16 -0
- package/build-module/components/content-only-controls/use-inspector-popover-placement.js.map +7 -0
- package/build-module/components/global-styles/typography-panel.js +18 -11
- package/build-module/components/global-styles/typography-panel.js.map +2 -2
- package/build-module/components/inserter/media-tab/media-tab.js +2 -34
- package/build-module/components/inserter/media-tab/media-tab.js.map +2 -2
- package/build-module/components/inspector-controls-tabs/content-tab.js +7 -3
- package/build-module/components/inspector-controls-tabs/content-tab.js.map +2 -2
- package/build-module/components/inspector-controls-tabs/index.js +7 -1
- package/build-module/components/inspector-controls-tabs/index.js.map +2 -2
- package/build-module/components/list-view/block-select-button.js +18 -5
- package/build-module/components/list-view/block-select-button.js.map +2 -2
- package/build-module/components/media-placeholder/index.js +1 -31
- package/build-module/components/media-placeholder/index.js.map +2 -2
- package/build-module/components/media-replace-flow/index.js +4 -30
- package/build-module/components/media-replace-flow/index.js.map +2 -2
- package/build-module/components/rich-text/format-edit.js +9 -1
- package/build-module/components/rich-text/format-edit.js.map +2 -2
- package/build-module/components/use-block-display-information/index.js +21 -1
- package/build-module/components/use-block-display-information/index.js.map +3 -3
- package/build-module/hooks/block-bindings.js +57 -62
- package/build-module/hooks/block-bindings.js.map +2 -2
- package/build-module/hooks/use-content-only-section-edit.js +46 -0
- package/build-module/hooks/use-content-only-section-edit.js.map +7 -0
- package/build-module/layouts/constrained.js +2 -2
- package/build-module/layouts/constrained.js.map +2 -2
- package/build-module/private-apis.js +3 -3
- package/build-module/private-apis.js.map +2 -2
- package/build-module/store/private-keys.js +2 -0
- package/build-module/store/private-keys.js.map +2 -2
- package/build-module/store/private-selectors.js +1 -2
- package/build-module/store/private-selectors.js.map +2 -2
- package/build-module/store/reducer.js +1 -2
- package/build-module/store/reducer.js.map +2 -2
- package/build-module/store/selectors.js +3 -0
- package/build-module/store/selectors.js.map +2 -2
- package/build-module/utils/fit-text-utils.js +9 -1
- package/build-module/utils/fit-text-utils.js.map +2 -2
- package/build-style/style-rtl.css +132 -0
- package/build-style/style.css +132 -0
- package/package.json +37 -37
- package/src/components/block-inspector/edit-contents.js +10 -29
- package/src/components/block-inspector/index.js +4 -2
- package/src/components/block-list/block.js +6 -0
- package/src/components/block-list/use-block-props/index.js +3 -1
- package/src/components/block-list/use-block-props/use-is-hovered.js +24 -12
- package/src/components/block-settings-menu-controls/edit-section-menu-item.js +39 -0
- package/src/components/block-settings-menu-controls/index.js +7 -0
- package/src/components/block-switcher/block-transformations-menu.native.js +0 -1
- package/src/components/block-toolbar/block-toolbar-icon.js +14 -10
- package/src/components/block-toolbar/test/__snapshots__/block-toolbar-menu.native.js.snap +6 -4
- package/src/components/block-toolbar/test/block-toolbar-menu.native.js +2 -2
- package/src/components/block-variation-transforms/index.js +96 -35
- package/src/components/border-radius-control/single-input-control.js +1 -0
- package/src/components/content-only-controls/index.js +296 -0
- package/src/components/content-only-controls/link/index.js +195 -0
- package/src/components/content-only-controls/link/styles.scss +23 -0
- package/src/components/content-only-controls/media/index.js +285 -0
- package/src/components/content-only-controls/media/styles.scss +47 -0
- package/src/components/content-only-controls/plain-text/index.js +49 -0
- package/src/components/content-only-controls/rich-text/index.js +193 -0
- package/src/components/content-only-controls/rich-text/styles.scss +24 -0
- package/src/components/content-only-controls/styles.scss +35 -0
- package/src/components/content-only-controls/use-inspector-popover-placement.js +19 -0
- package/src/components/global-styles/typography-panel.js +12 -0
- package/src/components/inserter/media-tab/media-tab.js +2 -44
- package/src/components/inspector-controls-tabs/content-tab.js +12 -4
- package/src/components/inspector-controls-tabs/index.js +4 -1
- package/src/components/list-view/block-select-button.js +37 -24
- package/src/components/media-placeholder/index.js +1 -41
- package/src/components/media-replace-flow/index.js +3 -39
- package/src/components/rich-text/format-edit.js +9 -1
- package/src/components/use-block-display-information/index.js +30 -2
- package/src/hooks/block-bindings.js +71 -82
- package/src/hooks/use-content-only-section-edit.js +63 -0
- package/src/layouts/constrained.js +8 -2
- package/src/private-apis.js +2 -2
- package/src/store/private-keys.js +1 -0
- package/src/store/private-selectors.js +1 -2
- package/src/store/reducer.js +0 -3
- package/src/store/selectors.js +7 -0
- package/src/store/test/reducer.js +7 -17
- package/src/style.scss +1 -0
- package/src/utils/fit-text-utils.js +19 -1
- package/build/components/media-upload-modal/index.js +0 -29
- package/build/components/media-upload-modal/index.js.map +0 -7
- package/build-module/components/media-upload-modal/index.js +0 -8
- package/build-module/components/media-upload-modal/index.js.map +0 -7
- package/src/components/media-upload-modal/index.js +0 -18
|
@@ -4,10 +4,17 @@ function findOptimalFontSize(textElement, applyFontSize) {
|
|
|
4
4
|
let minSize = 5;
|
|
5
5
|
let maxSize = 2400;
|
|
6
6
|
let bestSize = minSize;
|
|
7
|
+
const computedStyle = window.getComputedStyle(textElement);
|
|
8
|
+
const paddingLeft = parseFloat(computedStyle.paddingLeft) || 0;
|
|
9
|
+
const paddingRight = parseFloat(computedStyle.paddingRight) || 0;
|
|
10
|
+
const range = document.createRange();
|
|
11
|
+
range.selectNodeContents(textElement);
|
|
7
12
|
while (minSize <= maxSize) {
|
|
8
13
|
const midSize = Math.floor((minSize + maxSize) / 2);
|
|
9
14
|
applyFontSize(midSize);
|
|
10
|
-
const
|
|
15
|
+
const rect = range.getBoundingClientRect();
|
|
16
|
+
const textWidth = rect.width;
|
|
17
|
+
const fitsWidth = textElement.scrollWidth <= textElement.clientWidth && textWidth <= textElement.clientWidth - paddingLeft - paddingRight;
|
|
11
18
|
const fitsHeight = alreadyHasScrollableHeight || textElement.scrollHeight <= textElement.clientHeight;
|
|
12
19
|
if (fitsWidth && fitsHeight) {
|
|
13
20
|
bestSize = midSize;
|
|
@@ -16,6 +23,7 @@ function findOptimalFontSize(textElement, applyFontSize) {
|
|
|
16
23
|
maxSize = midSize - 1;
|
|
17
24
|
}
|
|
18
25
|
}
|
|
26
|
+
range.detach();
|
|
19
27
|
return bestSize;
|
|
20
28
|
}
|
|
21
29
|
function optimizeFitText(textElement, applyFontSize) {
|
|
@@ -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 5-600px.\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 = 5;\n\tlet maxSize = 2400;\n\tlet bestSize = minSize;\n\n\twhile ( minSize <= maxSize ) {\n\t\tconst midSize = Math.floor( ( minSize + maxSize ) / 2 );\n\t\tapplyFontSize( midSize );\n\n\t\tconst
|
|
5
|
-
"mappings": ";AAYA,SAAS,oBAAqB,aAAa,eAAgB;AAC1D,QAAM,6BACL,YAAY,eAAe,YAAY;AACxC,MAAI,UAAU;AACd,MAAI,UAAU;AACd,MAAI,WAAW;AAEf,SAAQ,WAAW,SAAU;AAC5B,UAAM,UAAU,KAAK,OAAS,UAAU,WAAY,CAAE;AACtD,kBAAe,OAAQ;
|
|
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 5-600px.\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 = 5;\n\tlet maxSize = 2400;\n\tlet bestSize = minSize;\n\n\tconst computedStyle = window.getComputedStyle( textElement );\n\tconst paddingLeft = parseFloat( computedStyle.paddingLeft ) || 0;\n\tconst paddingRight = parseFloat( computedStyle.paddingRight ) || 0;\n\tconst range = document.createRange();\n\trange.selectNodeContents( textElement );\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 <= textElement.clientWidth &&\n\t\t\ttextWidth <= textElement.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 <= textElement.clientHeight;\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,QAAM,cAAc,WAAY,cAAc,WAAY,KAAK;AAC/D,QAAM,eAAe,WAAY,cAAc,YAAa,KAAK;AACjE,QAAM,QAAQ,SAAS,YAAY;AACnC,QAAM,mBAAoB,WAAY;AAEtC,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,YAAY,eACvC,aAAa,YAAY,cAAc,cAAc;AAEtD,UAAM,aACL,8BACA,YAAY,gBAAgB,YAAY;AAEzC,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
|
}
|
|
@@ -1623,6 +1623,138 @@ iframe[name=editor-canvas] {
|
|
|
1623
1623
|
}
|
|
1624
1624
|
}
|
|
1625
1625
|
|
|
1626
|
+
.block-editor-content-only-controls__link {
|
|
1627
|
+
width: 100%;
|
|
1628
|
+
box-shadow: inset 0 0 0 1px #ccc;
|
|
1629
|
+
}
|
|
1630
|
+
.block-editor-content-only-controls__link:focus:not(:disabled) {
|
|
1631
|
+
box-shadow: 0 0 0 currentColor inset, 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color);
|
|
1632
|
+
}
|
|
1633
|
+
|
|
1634
|
+
.block-editor-content-only-controls__link-row {
|
|
1635
|
+
align-items: center;
|
|
1636
|
+
}
|
|
1637
|
+
|
|
1638
|
+
.block-editor-content-only-controls__link-title {
|
|
1639
|
+
width: 100%;
|
|
1640
|
+
white-space: nowrap;
|
|
1641
|
+
text-overflow: ellipsis;
|
|
1642
|
+
overflow: hidden;
|
|
1643
|
+
}
|
|
1644
|
+
|
|
1645
|
+
.block-editor-content-only-controls__media {
|
|
1646
|
+
width: 100%;
|
|
1647
|
+
box-shadow: inset 0 0 0 1px #ccc;
|
|
1648
|
+
}
|
|
1649
|
+
.block-editor-content-only-controls__media:focus:not(:disabled) {
|
|
1650
|
+
box-shadow: 0 0 0 currentColor inset, 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color);
|
|
1651
|
+
}
|
|
1652
|
+
|
|
1653
|
+
.block-editor-content-only-controls__media-replace-flow {
|
|
1654
|
+
display: block;
|
|
1655
|
+
}
|
|
1656
|
+
|
|
1657
|
+
.block-editor-content-only-controls__media-row {
|
|
1658
|
+
align-items: center;
|
|
1659
|
+
}
|
|
1660
|
+
|
|
1661
|
+
.block-editor-content-only-controls__media-placeholder {
|
|
1662
|
+
width: 24px;
|
|
1663
|
+
height: 24px;
|
|
1664
|
+
border-radius: 2px;
|
|
1665
|
+
box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.2);
|
|
1666
|
+
display: inline-block;
|
|
1667
|
+
padding: 0;
|
|
1668
|
+
background: #fff linear-gradient(45deg, transparent 48%, #ddd 48%, #ddd 52%, transparent 52%);
|
|
1669
|
+
}
|
|
1670
|
+
|
|
1671
|
+
.block-editor-content-only-controls__media-title {
|
|
1672
|
+
width: 100%;
|
|
1673
|
+
white-space: nowrap;
|
|
1674
|
+
text-overflow: ellipsis;
|
|
1675
|
+
overflow: hidden;
|
|
1676
|
+
}
|
|
1677
|
+
|
|
1678
|
+
block-editor-content-only-controls__media-thumbnail {
|
|
1679
|
+
width: 100%;
|
|
1680
|
+
height: 100%;
|
|
1681
|
+
border-radius: 2px;
|
|
1682
|
+
align-self: center;
|
|
1683
|
+
}
|
|
1684
|
+
|
|
1685
|
+
.block-editor-content-only-controls__rich-text {
|
|
1686
|
+
width: 100%;
|
|
1687
|
+
margin: 0;
|
|
1688
|
+
background: #fff;
|
|
1689
|
+
color: #1e1e1e;
|
|
1690
|
+
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
|
|
1691
|
+
padding: 6px 8px;
|
|
1692
|
+
/* Fonts smaller than 16px causes mobile safari to zoom. */
|
|
1693
|
+
font-size: 16px;
|
|
1694
|
+
/* Override core line-height. To be reviewed. */
|
|
1695
|
+
line-height: normal;
|
|
1696
|
+
box-shadow: 0 0 0 transparent;
|
|
1697
|
+
border-radius: 2px;
|
|
1698
|
+
border: 1px solid #949494;
|
|
1699
|
+
}
|
|
1700
|
+
@media not (prefers-reduced-motion) {
|
|
1701
|
+
.block-editor-content-only-controls__rich-text {
|
|
1702
|
+
transition: box-shadow 0.1s linear;
|
|
1703
|
+
}
|
|
1704
|
+
}
|
|
1705
|
+
@media (min-width: 600px) {
|
|
1706
|
+
.block-editor-content-only-controls__rich-text {
|
|
1707
|
+
font-size: 13px;
|
|
1708
|
+
/* Override core line-height. To be reviewed. */
|
|
1709
|
+
line-height: normal;
|
|
1710
|
+
}
|
|
1711
|
+
}
|
|
1712
|
+
.block-editor-content-only-controls__rich-text:focus {
|
|
1713
|
+
border-color: var(--wp-admin-theme-color, #3858e9);
|
|
1714
|
+
box-shadow: 0 0 0 0.5px var(--wp-admin-theme-color, #3858e9);
|
|
1715
|
+
outline: 2px solid transparent;
|
|
1716
|
+
}
|
|
1717
|
+
.block-editor-content-only-controls__rich-text::-webkit-input-placeholder {
|
|
1718
|
+
color: rgba(30, 30, 30, 0.62);
|
|
1719
|
+
}
|
|
1720
|
+
.block-editor-content-only-controls__rich-text::-moz-placeholder {
|
|
1721
|
+
color: rgba(30, 30, 30, 0.62);
|
|
1722
|
+
}
|
|
1723
|
+
.block-editor-content-only-controls__rich-text:-ms-input-placeholder {
|
|
1724
|
+
color: rgba(30, 30, 30, 0.62);
|
|
1725
|
+
}
|
|
1726
|
+
.block-editor-content-only-controls__rich-text {
|
|
1727
|
+
border-color: #949494;
|
|
1728
|
+
}
|
|
1729
|
+
.block-editor-content-only-controls__rich-text::placeholder {
|
|
1730
|
+
color: color-mix(in srgb, #1e1e1e, transparent 38%);
|
|
1731
|
+
}
|
|
1732
|
+
.block-editor-content-only-controls__rich-text {
|
|
1733
|
+
min-height: 40px;
|
|
1734
|
+
padding: 12px;
|
|
1735
|
+
}
|
|
1736
|
+
|
|
1737
|
+
.block-editor-content-only-controls__screen.components-navigator-screen {
|
|
1738
|
+
padding: 8px 0 0 0;
|
|
1739
|
+
}
|
|
1740
|
+
.block-editor-content-only-controls__screen {
|
|
1741
|
+
border-top: 1px solid #e0e0e0;
|
|
1742
|
+
}
|
|
1743
|
+
.block-editor-content-only-controls__screen .components-tools-panel {
|
|
1744
|
+
border-top: none;
|
|
1745
|
+
padding-top: 8px;
|
|
1746
|
+
}
|
|
1747
|
+
|
|
1748
|
+
.block-editor-content-only-controls__button-panel {
|
|
1749
|
+
padding: 4px;
|
|
1750
|
+
font-weight: 500 !important;
|
|
1751
|
+
}
|
|
1752
|
+
|
|
1753
|
+
.block-editor-content-only-controls__back-button,
|
|
1754
|
+
.block-editor-content-only-controls__drill-down-button {
|
|
1755
|
+
width: 100%;
|
|
1756
|
+
}
|
|
1757
|
+
|
|
1626
1758
|
.block-editor-date-format-picker {
|
|
1627
1759
|
margin: 0 0 16px;
|
|
1628
1760
|
padding: 0;
|
package/build-style/style.css
CHANGED
|
@@ -1623,6 +1623,138 @@ iframe[name=editor-canvas] {
|
|
|
1623
1623
|
}
|
|
1624
1624
|
}
|
|
1625
1625
|
|
|
1626
|
+
.block-editor-content-only-controls__link {
|
|
1627
|
+
width: 100%;
|
|
1628
|
+
box-shadow: inset 0 0 0 1px #ccc;
|
|
1629
|
+
}
|
|
1630
|
+
.block-editor-content-only-controls__link:focus:not(:disabled) {
|
|
1631
|
+
box-shadow: 0 0 0 currentColor inset, 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color);
|
|
1632
|
+
}
|
|
1633
|
+
|
|
1634
|
+
.block-editor-content-only-controls__link-row {
|
|
1635
|
+
align-items: center;
|
|
1636
|
+
}
|
|
1637
|
+
|
|
1638
|
+
.block-editor-content-only-controls__link-title {
|
|
1639
|
+
width: 100%;
|
|
1640
|
+
white-space: nowrap;
|
|
1641
|
+
text-overflow: ellipsis;
|
|
1642
|
+
overflow: hidden;
|
|
1643
|
+
}
|
|
1644
|
+
|
|
1645
|
+
.block-editor-content-only-controls__media {
|
|
1646
|
+
width: 100%;
|
|
1647
|
+
box-shadow: inset 0 0 0 1px #ccc;
|
|
1648
|
+
}
|
|
1649
|
+
.block-editor-content-only-controls__media:focus:not(:disabled) {
|
|
1650
|
+
box-shadow: 0 0 0 currentColor inset, 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color);
|
|
1651
|
+
}
|
|
1652
|
+
|
|
1653
|
+
.block-editor-content-only-controls__media-replace-flow {
|
|
1654
|
+
display: block;
|
|
1655
|
+
}
|
|
1656
|
+
|
|
1657
|
+
.block-editor-content-only-controls__media-row {
|
|
1658
|
+
align-items: center;
|
|
1659
|
+
}
|
|
1660
|
+
|
|
1661
|
+
.block-editor-content-only-controls__media-placeholder {
|
|
1662
|
+
width: 24px;
|
|
1663
|
+
height: 24px;
|
|
1664
|
+
border-radius: 2px;
|
|
1665
|
+
box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.2);
|
|
1666
|
+
display: inline-block;
|
|
1667
|
+
padding: 0;
|
|
1668
|
+
background: #fff linear-gradient(-45deg, transparent 48%, #ddd 48%, #ddd 52%, transparent 52%);
|
|
1669
|
+
}
|
|
1670
|
+
|
|
1671
|
+
.block-editor-content-only-controls__media-title {
|
|
1672
|
+
width: 100%;
|
|
1673
|
+
white-space: nowrap;
|
|
1674
|
+
text-overflow: ellipsis;
|
|
1675
|
+
overflow: hidden;
|
|
1676
|
+
}
|
|
1677
|
+
|
|
1678
|
+
block-editor-content-only-controls__media-thumbnail {
|
|
1679
|
+
width: 100%;
|
|
1680
|
+
height: 100%;
|
|
1681
|
+
border-radius: 2px;
|
|
1682
|
+
align-self: center;
|
|
1683
|
+
}
|
|
1684
|
+
|
|
1685
|
+
.block-editor-content-only-controls__rich-text {
|
|
1686
|
+
width: 100%;
|
|
1687
|
+
margin: 0;
|
|
1688
|
+
background: #fff;
|
|
1689
|
+
color: #1e1e1e;
|
|
1690
|
+
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
|
|
1691
|
+
padding: 6px 8px;
|
|
1692
|
+
/* Fonts smaller than 16px causes mobile safari to zoom. */
|
|
1693
|
+
font-size: 16px;
|
|
1694
|
+
/* Override core line-height. To be reviewed. */
|
|
1695
|
+
line-height: normal;
|
|
1696
|
+
box-shadow: 0 0 0 transparent;
|
|
1697
|
+
border-radius: 2px;
|
|
1698
|
+
border: 1px solid #949494;
|
|
1699
|
+
}
|
|
1700
|
+
@media not (prefers-reduced-motion) {
|
|
1701
|
+
.block-editor-content-only-controls__rich-text {
|
|
1702
|
+
transition: box-shadow 0.1s linear;
|
|
1703
|
+
}
|
|
1704
|
+
}
|
|
1705
|
+
@media (min-width: 600px) {
|
|
1706
|
+
.block-editor-content-only-controls__rich-text {
|
|
1707
|
+
font-size: 13px;
|
|
1708
|
+
/* Override core line-height. To be reviewed. */
|
|
1709
|
+
line-height: normal;
|
|
1710
|
+
}
|
|
1711
|
+
}
|
|
1712
|
+
.block-editor-content-only-controls__rich-text:focus {
|
|
1713
|
+
border-color: var(--wp-admin-theme-color, #3858e9);
|
|
1714
|
+
box-shadow: 0 0 0 0.5px var(--wp-admin-theme-color, #3858e9);
|
|
1715
|
+
outline: 2px solid transparent;
|
|
1716
|
+
}
|
|
1717
|
+
.block-editor-content-only-controls__rich-text::-webkit-input-placeholder {
|
|
1718
|
+
color: rgba(30, 30, 30, 0.62);
|
|
1719
|
+
}
|
|
1720
|
+
.block-editor-content-only-controls__rich-text::-moz-placeholder {
|
|
1721
|
+
color: rgba(30, 30, 30, 0.62);
|
|
1722
|
+
}
|
|
1723
|
+
.block-editor-content-only-controls__rich-text:-ms-input-placeholder {
|
|
1724
|
+
color: rgba(30, 30, 30, 0.62);
|
|
1725
|
+
}
|
|
1726
|
+
.block-editor-content-only-controls__rich-text {
|
|
1727
|
+
border-color: #949494;
|
|
1728
|
+
}
|
|
1729
|
+
.block-editor-content-only-controls__rich-text::placeholder {
|
|
1730
|
+
color: color-mix(in srgb, #1e1e1e, transparent 38%);
|
|
1731
|
+
}
|
|
1732
|
+
.block-editor-content-only-controls__rich-text {
|
|
1733
|
+
min-height: 40px;
|
|
1734
|
+
padding: 12px;
|
|
1735
|
+
}
|
|
1736
|
+
|
|
1737
|
+
.block-editor-content-only-controls__screen.components-navigator-screen {
|
|
1738
|
+
padding: 8px 0 0 0;
|
|
1739
|
+
}
|
|
1740
|
+
.block-editor-content-only-controls__screen {
|
|
1741
|
+
border-top: 1px solid #e0e0e0;
|
|
1742
|
+
}
|
|
1743
|
+
.block-editor-content-only-controls__screen .components-tools-panel {
|
|
1744
|
+
border-top: none;
|
|
1745
|
+
padding-top: 8px;
|
|
1746
|
+
}
|
|
1747
|
+
|
|
1748
|
+
.block-editor-content-only-controls__button-panel {
|
|
1749
|
+
padding: 4px;
|
|
1750
|
+
font-weight: 500 !important;
|
|
1751
|
+
}
|
|
1752
|
+
|
|
1753
|
+
.block-editor-content-only-controls__back-button,
|
|
1754
|
+
.block-editor-content-only-controls__drill-down-button {
|
|
1755
|
+
width: 100%;
|
|
1756
|
+
}
|
|
1757
|
+
|
|
1626
1758
|
.block-editor-date-format-picker {
|
|
1627
1759
|
margin: 0 0 16px;
|
|
1628
1760
|
padding: 0;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wordpress/block-editor",
|
|
3
|
-
"version": "15.8.0",
|
|
3
|
+
"version": "15.8.1-next.dc3f6d3c1.0",
|
|
4
4
|
"description": "Generic block editor.",
|
|
5
5
|
"author": "The WordPress Contributors",
|
|
6
6
|
"license": "GPL-2.0-or-later",
|
|
@@ -55,41 +55,41 @@
|
|
|
55
55
|
"@emotion/react": "^11.7.1",
|
|
56
56
|
"@emotion/styled": "^11.6.0",
|
|
57
57
|
"@react-spring/web": "^9.4.5",
|
|
58
|
-
"@wordpress/a11y": "^4.35.0",
|
|
59
|
-
"@wordpress/api-fetch": "^7.35.0",
|
|
60
|
-
"@wordpress/base-styles": "^6.11.0",
|
|
61
|
-
"@wordpress/blob": "^4.35.0",
|
|
62
|
-
"@wordpress/block-serialization-default-parser": "^5.35.0",
|
|
63
|
-
"@wordpress/blocks": "^15.8.0",
|
|
64
|
-
"@wordpress/commands": "^1.35.0",
|
|
65
|
-
"@wordpress/components": "^30.8.0",
|
|
66
|
-
"@wordpress/compose": "^7.35.0",
|
|
67
|
-
"@wordpress/data": "^10.35.0",
|
|
68
|
-
"@wordpress/date": "^5.35.0",
|
|
69
|
-
"@wordpress/deprecated": "^4.35.0",
|
|
70
|
-
"@wordpress/dom": "^4.35.0",
|
|
71
|
-
"@wordpress/element": "^6.35.0",
|
|
72
|
-
"@wordpress/escape-html": "^3.35.0",
|
|
73
|
-
"@wordpress/global-styles-engine": "^1.2.0",
|
|
74
|
-
"@wordpress/hooks": "^4.35.0",
|
|
75
|
-
"@wordpress/html-entities": "^4.35.0",
|
|
76
|
-
"@wordpress/i18n": "^6.8.0",
|
|
77
|
-
"@wordpress/icons": "^11.2.0",
|
|
78
|
-
"@wordpress/interactivity": "^6.35.0",
|
|
79
|
-
"@wordpress/is-shallow-equal": "^5.35.0",
|
|
80
|
-
"@wordpress/keyboard-shortcuts": "^5.35.0",
|
|
81
|
-
"@wordpress/keycodes": "^4.35.0",
|
|
82
|
-
"@wordpress/notices": "^5.35.0",
|
|
83
|
-
"@wordpress/preferences": "^4.35.0",
|
|
84
|
-
"@wordpress/priority-queue": "^3.35.0",
|
|
85
|
-
"@wordpress/private-apis": "^1.35.0",
|
|
86
|
-
"@wordpress/rich-text": "^7.35.0",
|
|
87
|
-
"@wordpress/style-engine": "^2.35.0",
|
|
88
|
-
"@wordpress/token-list": "^3.35.0",
|
|
89
|
-
"@wordpress/upload-media": "^0.20.0",
|
|
90
|
-
"@wordpress/url": "^4.35.0",
|
|
91
|
-
"@wordpress/warning": "^3.35.0",
|
|
92
|
-
"@wordpress/wordcount": "^4.35.0",
|
|
58
|
+
"@wordpress/a11y": "^4.35.1-next.dc3f6d3c1.0",
|
|
59
|
+
"@wordpress/api-fetch": "^7.35.1-next.dc3f6d3c1.0",
|
|
60
|
+
"@wordpress/base-styles": "^6.11.1-next.dc3f6d3c1.0",
|
|
61
|
+
"@wordpress/blob": "^4.35.1-next.dc3f6d3c1.0",
|
|
62
|
+
"@wordpress/block-serialization-default-parser": "^5.35.1-next.dc3f6d3c1.0",
|
|
63
|
+
"@wordpress/blocks": "^15.8.1-next.dc3f6d3c1.0",
|
|
64
|
+
"@wordpress/commands": "^1.35.1-next.dc3f6d3c1.0",
|
|
65
|
+
"@wordpress/components": "^30.8.2-next.dc3f6d3c1.0",
|
|
66
|
+
"@wordpress/compose": "^7.35.1-next.dc3f6d3c1.0",
|
|
67
|
+
"@wordpress/data": "^10.35.1-next.dc3f6d3c1.0",
|
|
68
|
+
"@wordpress/date": "^5.35.1-next.dc3f6d3c1.0",
|
|
69
|
+
"@wordpress/deprecated": "^4.35.1-next.dc3f6d3c1.0",
|
|
70
|
+
"@wordpress/dom": "^4.35.1-next.dc3f6d3c1.0",
|
|
71
|
+
"@wordpress/element": "^6.35.1-next.dc3f6d3c1.0",
|
|
72
|
+
"@wordpress/escape-html": "^3.35.1-next.dc3f6d3c1.0",
|
|
73
|
+
"@wordpress/global-styles-engine": "^1.2.1-next.dc3f6d3c1.0",
|
|
74
|
+
"@wordpress/hooks": "^4.35.1-next.dc3f6d3c1.0",
|
|
75
|
+
"@wordpress/html-entities": "^4.35.1-next.dc3f6d3c1.0",
|
|
76
|
+
"@wordpress/i18n": "^6.8.1-next.dc3f6d3c1.0",
|
|
77
|
+
"@wordpress/icons": "^11.2.1-next.dc3f6d3c1.0",
|
|
78
|
+
"@wordpress/interactivity": "^6.35.1-next.dc3f6d3c1.0",
|
|
79
|
+
"@wordpress/is-shallow-equal": "^5.35.1-next.dc3f6d3c1.0",
|
|
80
|
+
"@wordpress/keyboard-shortcuts": "^5.35.1-next.dc3f6d3c1.0",
|
|
81
|
+
"@wordpress/keycodes": "^4.35.1-next.dc3f6d3c1.0",
|
|
82
|
+
"@wordpress/notices": "^5.35.1-next.dc3f6d3c1.0",
|
|
83
|
+
"@wordpress/preferences": "^4.35.1-next.dc3f6d3c1.0",
|
|
84
|
+
"@wordpress/priority-queue": "^3.35.1-next.dc3f6d3c1.0",
|
|
85
|
+
"@wordpress/private-apis": "^1.35.1-next.dc3f6d3c1.0",
|
|
86
|
+
"@wordpress/rich-text": "^7.35.1-next.dc3f6d3c1.0",
|
|
87
|
+
"@wordpress/style-engine": "^2.35.1-next.dc3f6d3c1.0",
|
|
88
|
+
"@wordpress/token-list": "^3.35.1-next.dc3f6d3c1.0",
|
|
89
|
+
"@wordpress/upload-media": "^0.20.1-next.dc3f6d3c1.0",
|
|
90
|
+
"@wordpress/url": "^4.35.1-next.dc3f6d3c1.0",
|
|
91
|
+
"@wordpress/warning": "^3.35.1-next.dc3f6d3c1.0",
|
|
92
|
+
"@wordpress/wordcount": "^4.35.1-next.dc3f6d3c1.0",
|
|
93
93
|
"change-case": "^4.1.2",
|
|
94
94
|
"clsx": "^2.1.1",
|
|
95
95
|
"colord": "^2.7.0",
|
|
@@ -112,5 +112,5 @@
|
|
|
112
112
|
"publishConfig": {
|
|
113
113
|
"access": "public"
|
|
114
114
|
},
|
|
115
|
-
"gitHead": "
|
|
115
|
+
"gitHead": "f73b5e69b34fbaccfb8c47783f4f993059ff1a41"
|
|
116
116
|
}
|
|
@@ -2,40 +2,21 @@
|
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
4
|
import { Button, __experimentalVStack as VStack } from '@wordpress/components';
|
|
5
|
-
import { useDispatch, useSelect } from '@wordpress/data';
|
|
6
5
|
import { __ } from '@wordpress/i18n';
|
|
7
6
|
|
|
8
7
|
/**
|
|
9
8
|
* Internal dependencies
|
|
10
9
|
*/
|
|
11
|
-
import
|
|
12
|
-
import { unlock } from '../../lock-unlock';
|
|
10
|
+
import useContentOnlySectionEdit from '../../hooks/use-content-only-section-edit';
|
|
13
11
|
|
|
14
12
|
export default function EditContents( { clientId } ) {
|
|
15
|
-
const {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
isSectionBlock,
|
|
23
|
-
getParentSectionBlock,
|
|
24
|
-
getEditedContentOnlySection,
|
|
25
|
-
isWithinEditedContentOnlySection,
|
|
26
|
-
} = unlock( select( blockEditorStore ) );
|
|
27
|
-
|
|
28
|
-
return {
|
|
29
|
-
isWithinSection:
|
|
30
|
-
isSectionBlock( clientId ) ||
|
|
31
|
-
!! getParentSectionBlock( clientId ),
|
|
32
|
-
isWithinEditedSection:
|
|
33
|
-
isWithinEditedContentOnlySection( clientId ),
|
|
34
|
-
editedContentOnlySection: getEditedContentOnlySection(),
|
|
35
|
-
};
|
|
36
|
-
},
|
|
37
|
-
[ clientId ]
|
|
38
|
-
);
|
|
13
|
+
const {
|
|
14
|
+
isWithinSection,
|
|
15
|
+
isWithinEditedSection,
|
|
16
|
+
editedContentOnlySection,
|
|
17
|
+
editContentOnlySection,
|
|
18
|
+
stopEditingContentOnlySection,
|
|
19
|
+
} = useContentOnlySectionEdit( clientId );
|
|
39
20
|
|
|
40
21
|
if ( ! isWithinSection && ! isWithinEditedSection ) {
|
|
41
22
|
return null;
|
|
@@ -56,8 +37,8 @@ export default function EditContents( { clientId } ) {
|
|
|
56
37
|
} }
|
|
57
38
|
>
|
|
58
39
|
{ editedContentOnlySection
|
|
59
|
-
? __( '
|
|
60
|
-
: __( '
|
|
40
|
+
? __( 'Exit section' )
|
|
41
|
+
: __( 'Edit section' ) }
|
|
61
42
|
</Button>
|
|
62
43
|
</VStack>
|
|
63
44
|
);
|
|
@@ -29,7 +29,6 @@ import PositionControls from '../inspector-controls-tabs/position-controls-panel
|
|
|
29
29
|
import useBlockInspectorAnimationSettings from './useBlockInspectorAnimationSettings';
|
|
30
30
|
import { useBorderPanelLabel } from '../../hooks/border';
|
|
31
31
|
import ContentTab from '../inspector-controls-tabs/content-tab';
|
|
32
|
-
|
|
33
32
|
import { unlock } from '../../lock-unlock';
|
|
34
33
|
|
|
35
34
|
function BlockStylesPanel( { clientId } ) {
|
|
@@ -368,7 +367,10 @@ const BlockInspectorSingleBlock = ( {
|
|
|
368
367
|
{ hasBlockStyles && (
|
|
369
368
|
<BlockStylesPanel clientId={ clientId } />
|
|
370
369
|
) }
|
|
371
|
-
<ContentTab
|
|
370
|
+
<ContentTab
|
|
371
|
+
rootClientId={ clientId }
|
|
372
|
+
contentClientIds={ contentClientIds }
|
|
373
|
+
/>
|
|
372
374
|
{ ! isSectionBlock && (
|
|
373
375
|
<StyleInspectorSlots
|
|
374
376
|
blockName={ blockName }
|
|
@@ -563,6 +563,7 @@ function BlockListBlockProvider( props ) {
|
|
|
563
563
|
isSelectionEnabled,
|
|
564
564
|
getTemplateLock,
|
|
565
565
|
isSectionBlock: _isSectionBlock,
|
|
566
|
+
getParentSectionBlock,
|
|
566
567
|
getBlockWithoutAttributes,
|
|
567
568
|
getBlockAttributes,
|
|
568
569
|
canRemoveBlock,
|
|
@@ -674,6 +675,9 @@ function BlockListBlockProvider( props ) {
|
|
|
674
675
|
isSelectionEnabled: isSelectionEnabled(),
|
|
675
676
|
isLocked: !! getTemplateLock( rootClientId ),
|
|
676
677
|
isSectionBlock: _isSectionBlock( clientId ),
|
|
678
|
+
isWithinSectionBlock:
|
|
679
|
+
_isSectionBlock( clientId ) ||
|
|
680
|
+
!! getParentSectionBlock( clientId ),
|
|
677
681
|
canRemove,
|
|
678
682
|
canMove,
|
|
679
683
|
isSelected: _isSelected,
|
|
@@ -756,6 +760,7 @@ function BlockListBlockProvider( props ) {
|
|
|
756
760
|
isDragging,
|
|
757
761
|
hasChildSelected,
|
|
758
762
|
isSectionBlock,
|
|
763
|
+
isWithinSectionBlock,
|
|
759
764
|
isEditingDisabled,
|
|
760
765
|
hasEditableOutline,
|
|
761
766
|
className,
|
|
@@ -802,6 +807,7 @@ function BlockListBlockProvider( props ) {
|
|
|
802
807
|
isDragging,
|
|
803
808
|
hasChildSelected,
|
|
804
809
|
isSectionBlock,
|
|
810
|
+
isWithinSectionBlock,
|
|
805
811
|
isEditingDisabled,
|
|
806
812
|
hasEditableOutline,
|
|
807
813
|
isEditingContentOnlySection,
|
|
@@ -100,6 +100,7 @@ export function useBlockProps( props = {}, { __unstableIsHtml } = {} ) {
|
|
|
100
100
|
isEditingContentOnlySection,
|
|
101
101
|
defaultClassName,
|
|
102
102
|
isSectionBlock,
|
|
103
|
+
isWithinSectionBlock,
|
|
103
104
|
canMove,
|
|
104
105
|
isBlockHidden,
|
|
105
106
|
} = useContext( PrivateBlockContext );
|
|
@@ -108,13 +109,14 @@ export function useBlockProps( props = {}, { __unstableIsHtml } = {} ) {
|
|
|
108
109
|
const blockLabel = sprintf( __( 'Block: %s' ), blockTitle );
|
|
109
110
|
const htmlSuffix = mode === 'html' && ! __unstableIsHtml ? '-visual' : '';
|
|
110
111
|
const ffDragRef = useFirefoxDraggableCompatibility();
|
|
112
|
+
const isHoverEnabled = ! isWithinSectionBlock;
|
|
111
113
|
const mergedRefs = useMergeRefs( [
|
|
112
114
|
props.ref,
|
|
113
115
|
useFocusFirstElement( { clientId, initialPosition } ),
|
|
114
116
|
useBlockRefProvider( clientId ),
|
|
115
117
|
useFocusHandler( clientId ),
|
|
116
118
|
useEventHandlers( { clientId, isSelected } ),
|
|
117
|
-
useIsHovered(),
|
|
119
|
+
useIsHovered( { isEnabled: isHoverEnabled } ),
|
|
118
120
|
useIntersectionObserver(),
|
|
119
121
|
useMovingAnimation( { triggerAnimationOnChange: index, clientId } ),
|
|
120
122
|
useDisabled( { isDisabled: ! hasOverlay } ),
|
|
@@ -15,21 +15,33 @@ function listener( event ) {
|
|
|
15
15
|
);
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
-
|
|
18
|
+
/**
|
|
19
19
|
* Adds `is-hovered` class when the block is hovered and in navigation or
|
|
20
20
|
* outline mode.
|
|
21
|
+
*
|
|
22
|
+
* @param {Object} options Options object.
|
|
23
|
+
* @param {boolean} [options.isEnabled=true] Whether to enable hover detection.
|
|
24
|
+
*
|
|
25
|
+
* @return {Function} Ref callback.
|
|
21
26
|
*/
|
|
22
|
-
export function useIsHovered() {
|
|
23
|
-
return useRefEffect(
|
|
24
|
-
|
|
25
|
-
|
|
27
|
+
export function useIsHovered( { isEnabled = true } = {} ) {
|
|
28
|
+
return useRefEffect(
|
|
29
|
+
( node ) => {
|
|
30
|
+
if ( ! isEnabled ) {
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
node.addEventListener( 'mouseout', listener );
|
|
35
|
+
node.addEventListener( 'mouseover', listener );
|
|
26
36
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
37
|
+
return () => {
|
|
38
|
+
node.removeEventListener( 'mouseout', listener );
|
|
39
|
+
node.removeEventListener( 'mouseover', listener );
|
|
30
40
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
41
|
+
// Remove class in case it lingers.
|
|
42
|
+
node.classList.remove( 'is-hovered' );
|
|
43
|
+
};
|
|
44
|
+
},
|
|
45
|
+
[ isEnabled ]
|
|
46
|
+
);
|
|
35
47
|
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { MenuItem } from '@wordpress/components';
|
|
5
|
+
import { _x } from '@wordpress/i18n';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Internal dependencies
|
|
9
|
+
*/
|
|
10
|
+
import useContentOnlySectionEdit from '../../hooks/use-content-only-section-edit';
|
|
11
|
+
|
|
12
|
+
export function EditSectionMenuItem( { clientId, onClose } ) {
|
|
13
|
+
const {
|
|
14
|
+
isSectionBlock,
|
|
15
|
+
isEditingContentOnlySection,
|
|
16
|
+
editContentOnlySection,
|
|
17
|
+
} = useContentOnlySectionEdit( clientId );
|
|
18
|
+
|
|
19
|
+
// Only show when the experiment is enabled, the block is a section block,
|
|
20
|
+
// and we're not already editing it
|
|
21
|
+
if (
|
|
22
|
+
! window?.__experimentalContentOnlyPatternInsertion ||
|
|
23
|
+
! isSectionBlock ||
|
|
24
|
+
isEditingContentOnlySection
|
|
25
|
+
) {
|
|
26
|
+
return null;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
return (
|
|
30
|
+
<MenuItem
|
|
31
|
+
onClick={ () => {
|
|
32
|
+
editContentOnlySection( clientId );
|
|
33
|
+
onClose();
|
|
34
|
+
} }
|
|
35
|
+
>
|
|
36
|
+
{ _x( 'Edit section', 'Editing a section in the Editor' ) }
|
|
37
|
+
</MenuItem>
|
|
38
|
+
);
|
|
39
|
+
}
|
|
@@ -22,6 +22,7 @@ import BlockModeToggle from '../block-settings-menu/block-mode-toggle';
|
|
|
22
22
|
import { ModifyContentOnlySectionMenuItem } from '../content-lock';
|
|
23
23
|
import { BlockRenameControl, useBlockRename } from '../block-rename';
|
|
24
24
|
import { BlockVisibilityMenuItem } from '../block-visibility';
|
|
25
|
+
import { EditSectionMenuItem } from './edit-section-menu-item';
|
|
25
26
|
|
|
26
27
|
const { Fill, Slot } = createSlotFill( 'BlockSettingsMenuControls' );
|
|
27
28
|
|
|
@@ -98,6 +99,12 @@ const BlockSettingsMenuControlsSlot = ( { fillProps, clientIds = null } ) => {
|
|
|
98
99
|
onClose={ fillProps?.onClose }
|
|
99
100
|
/>
|
|
100
101
|
) }
|
|
102
|
+
{ selectedClientIds.length === 1 && (
|
|
103
|
+
<EditSectionMenuItem
|
|
104
|
+
clientId={ selectedClientIds[ 0 ] }
|
|
105
|
+
onClose={ fillProps?.onClose }
|
|
106
|
+
/>
|
|
107
|
+
) }
|
|
101
108
|
{ showLockButton && (
|
|
102
109
|
<BlockLockMenuItem
|
|
103
110
|
clientId={ selectedClientIds[ 0 ] }
|
|
@@ -33,7 +33,6 @@ const BlockTransformationsMenu = ( {
|
|
|
33
33
|
const blocksThatSplitWhenTransformed = {
|
|
34
34
|
'core/list': [ 'core/paragraph', 'core/heading' ],
|
|
35
35
|
'core/quote': [ 'core/paragraph' ],
|
|
36
|
-
'core/pullquote': [ 'core/paragraph' ],
|
|
37
36
|
};
|
|
38
37
|
|
|
39
38
|
return possibleTransformations.map( ( item ) => {
|