@wordpress/block-editor 14.3.6 → 14.3.8
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/README.md +2 -2
- package/build/components/block-list/use-block-props/use-selected-block-event-handlers.js +14 -6
- package/build/components/block-list/use-block-props/use-selected-block-event-handlers.js.map +1 -1
- package/build/components/block-list/zoom-out-separator.js +10 -7
- package/build/components/block-list/zoom-out-separator.js.map +1 -1
- package/build/components/block-popover/index.js +1 -1
- package/build/components/block-popover/index.js.map +1 -1
- package/build/components/block-toolbar/index.js +28 -16
- package/build/components/block-toolbar/index.js.map +1 -1
- package/build/components/block-toolbar/use-has-block-toolbar.js +3 -3
- package/build/components/block-toolbar/use-has-block-toolbar.js.map +1 -1
- package/build/components/block-tools/index.js +1 -6
- package/build/components/block-tools/index.js.map +1 -1
- package/build/components/block-tools/use-show-block-tools.js +4 -6
- package/build/components/block-tools/use-show-block-tools.js.map +1 -1
- package/build/components/block-tools/zoom-out-mode-inserters.js +22 -36
- package/build/components/block-tools/zoom-out-mode-inserters.js.map +1 -1
- package/build/components/iframe/index.js +40 -10
- package/build/components/iframe/index.js.map +1 -1
- package/build/components/inserter/block-patterns-tab/index.js +4 -0
- package/build/components/inserter/block-patterns-tab/index.js.map +1 -1
- package/build/components/inserter/hooks/use-insertion-point.js +16 -4
- package/build/components/inserter/hooks/use-insertion-point.js.map +1 -1
- package/build/components/inserter/media-tab/media-tab.js +4 -0
- package/build/components/inserter/media-tab/media-tab.js.map +1 -1
- package/build/components/inserter/menu.js +5 -2
- package/build/components/inserter/menu.js.map +1 -1
- package/build/hooks/block-bindings.js +12 -1
- package/build/hooks/block-bindings.js.map +1 -1
- package/build/hooks/use-zoom-out.js +24 -16
- package/build/hooks/use-zoom-out.js.map +1 -1
- package/build/store/private-selectors.js +37 -2
- package/build/store/private-selectors.js.map +1 -1
- package/build/store/selectors.js +15 -8
- package/build/store/selectors.js.map +1 -1
- package/build/utils/dom.js +16 -1
- package/build/utils/dom.js.map +1 -1
- package/build-module/components/block-list/use-block-props/use-selected-block-event-handlers.js +14 -6
- package/build-module/components/block-list/use-block-props/use-selected-block-event-handlers.js.map +1 -1
- package/build-module/components/block-list/zoom-out-separator.js +10 -7
- package/build-module/components/block-list/zoom-out-separator.js.map +1 -1
- package/build-module/components/block-popover/index.js +1 -1
- package/build-module/components/block-popover/index.js.map +1 -1
- package/build-module/components/block-toolbar/index.js +30 -18
- package/build-module/components/block-toolbar/index.js.map +1 -1
- package/build-module/components/block-toolbar/use-has-block-toolbar.js +3 -3
- package/build-module/components/block-toolbar/use-has-block-toolbar.js.map +1 -1
- package/build-module/components/block-tools/index.js +1 -6
- package/build-module/components/block-tools/index.js.map +1 -1
- package/build-module/components/block-tools/use-show-block-tools.js +4 -6
- package/build-module/components/block-tools/use-show-block-tools.js.map +1 -1
- package/build-module/components/block-tools/zoom-out-mode-inserters.js +22 -36
- package/build-module/components/block-tools/zoom-out-mode-inserters.js.map +1 -1
- package/build-module/components/iframe/index.js +40 -10
- package/build-module/components/iframe/index.js.map +1 -1
- package/build-module/components/inserter/block-patterns-tab/index.js +5 -1
- package/build-module/components/inserter/block-patterns-tab/index.js.map +1 -1
- package/build-module/components/inserter/hooks/use-insertion-point.js +16 -4
- package/build-module/components/inserter/hooks/use-insertion-point.js.map +1 -1
- package/build-module/components/inserter/media-tab/media-tab.js +5 -1
- package/build-module/components/inserter/media-tab/media-tab.js.map +1 -1
- package/build-module/components/inserter/menu.js +5 -2
- package/build-module/components/inserter/menu.js.map +1 -1
- package/build-module/hooks/block-bindings.js +13 -2
- package/build-module/hooks/block-bindings.js.map +1 -1
- package/build-module/hooks/use-zoom-out.js +24 -17
- package/build-module/hooks/use-zoom-out.js.map +1 -1
- package/build-module/store/private-selectors.js +35 -2
- package/build-module/store/private-selectors.js.map +1 -1
- package/build-module/store/selectors.js +15 -8
- package/build-module/store/selectors.js.map +1 -1
- package/build-module/utils/dom.js +16 -1
- package/build-module/utils/dom.js.map +1 -1
- package/build-style/content-rtl.css +14 -20
- package/build-style/content.css +14 -20
- package/build-style/style-rtl.css +28 -21
- package/build-style/style.css +28 -21
- package/build-types/utils/dom.d.ts.map +1 -1
- package/package.json +6 -6
- package/src/components/block-canvas/style.scss +1 -0
- package/src/components/block-list/content.scss +3 -2
- package/src/components/block-list/use-block-props/use-selected-block-event-handlers.js +25 -4
- package/src/components/block-list/zoom-out-separator.js +8 -6
- package/src/components/block-popover/index.js +2 -2
- package/src/components/block-toolbar/index.js +37 -24
- package/src/components/block-toolbar/style.scss +10 -1
- package/src/components/block-toolbar/use-has-block-toolbar.js +19 -28
- package/src/components/block-tools/index.js +0 -9
- package/src/components/block-tools/style.scss +2 -26
- package/src/components/block-tools/use-show-block-tools.js +2 -10
- package/src/components/block-tools/zoom-out-mode-inserters.js +26 -50
- package/src/components/iframe/content.scss +16 -24
- package/src/components/iframe/index.js +53 -12
- package/src/components/iframe/style.scss +6 -5
- package/src/components/inserter/block-patterns-tab/index.js +6 -1
- package/src/components/inserter/hooks/use-insertion-point.js +23 -5
- package/src/components/inserter/media-tab/media-tab.js +6 -1
- package/src/components/inserter/menu.js +7 -1
- package/src/components/inserter/style.scss +6 -0
- package/src/components/rich-text/style.scss +5 -0
- package/src/hooks/block-bindings.js +40 -23
- package/src/hooks/use-zoom-out.js +36 -20
- package/src/store/private-selectors.js +40 -1
- package/src/store/selectors.js +16 -8
- package/src/style.scss +1 -0
- package/src/utils/dom.js +22 -2
- package/tsconfig.tsbuildinfo +1 -1
- package/build/components/block-tools/zoom-out-popover.js +0 -57
- package/build/components/block-tools/zoom-out-popover.js.map +0 -1
- package/build/components/block-tools/zoom-out-toolbar.js +0 -159
- package/build/components/block-tools/zoom-out-toolbar.js.map +0 -1
- package/build-module/components/block-tools/zoom-out-popover.js +0 -48
- package/build-module/components/block-tools/zoom-out-popover.js.map +0 -1
- package/build-module/components/block-tools/zoom-out-toolbar.js +0 -152
- package/build-module/components/block-tools/zoom-out-toolbar.js.map +0 -1
- package/src/components/block-tools/zoom-out-popover.js +0 -46
- package/src/components/block-tools/zoom-out-toolbar.js +0 -167
|
@@ -103,6 +103,17 @@ function isElementVisible(element) {
|
|
|
103
103
|
return true;
|
|
104
104
|
}
|
|
105
105
|
|
|
106
|
+
/**
|
|
107
|
+
* Checks if the element is scrollable.
|
|
108
|
+
*
|
|
109
|
+
* @param {Element} element Element.
|
|
110
|
+
* @return {boolean} True if the element is scrollable.
|
|
111
|
+
*/
|
|
112
|
+
function isScrollable(element) {
|
|
113
|
+
const style = window.getComputedStyle(element);
|
|
114
|
+
return style.overflowX === 'auto' || style.overflowX === 'scroll' || style.overflowY === 'auto' || style.overflowY === 'scroll';
|
|
115
|
+
}
|
|
116
|
+
|
|
106
117
|
/**
|
|
107
118
|
* Returns the rect of the element including all visible nested elements.
|
|
108
119
|
*
|
|
@@ -130,7 +141,11 @@ export function getVisibleElementBounds(element) {
|
|
|
130
141
|
while (currentElement = stack.pop()) {
|
|
131
142
|
for (const child of currentElement.children) {
|
|
132
143
|
if (isElementVisible(child)) {
|
|
133
|
-
|
|
144
|
+
let childBounds = child.getBoundingClientRect();
|
|
145
|
+
// If the parent is scrollable, use parent's scrollable bounds.
|
|
146
|
+
if (isScrollable(currentElement)) {
|
|
147
|
+
childBounds = currentElement.getBoundingClientRect();
|
|
148
|
+
}
|
|
134
149
|
bounds = rectUnion(bounds, childBounds);
|
|
135
150
|
stack.push(child);
|
|
136
151
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["BLOCK_SELECTOR","APPENDER_SELECTOR","BLOCK_APPENDER_CLASS","isInSameBlock","a","b","closest","isInsideRootBlock","blockElement","element","parentBlock","join","getBlockClientId","node","nodeType","ELEMENT_NODE","parentNode","elementNode","blockNode","id","slice","length","rectUnion","rect1","rect2","left","Math","min","right","max","bottom","top","window","DOMRectReadOnly","isElementVisible","viewport","ownerDocument","defaultView","classList","contains","bounds","getBoundingClientRect","width","height","checkVisibility","opacityProperty","contentVisibilityAuto","visibilityProperty","style","getComputedStyle","display","visibility","opacity","getVisibleElementBounds","stack","currentElement","pop","child","children","childBounds","push","innerWidth"],"sources":["@wordpress/block-editor/src/utils/dom.js"],"sourcesContent":["const BLOCK_SELECTOR = '.block-editor-block-list__block';\nconst APPENDER_SELECTOR = '.block-list-appender';\nconst BLOCK_APPENDER_CLASS = '.block-editor-button-block-appender';\n\n/**\n * Returns true if two elements are contained within the same block.\n *\n * @param {Element} a First element.\n * @param {Element} b Second element.\n *\n * @return {boolean} Whether elements are in the same block.\n */\nexport function isInSameBlock( a, b ) {\n\treturn a.closest( BLOCK_SELECTOR ) === b.closest( BLOCK_SELECTOR );\n}\n\n/**\n * Returns true if an element is considered part of the block and not its inner\n * blocks or appender.\n *\n * @param {Element} blockElement Block container element.\n * @param {Element} element Element.\n *\n * @return {boolean} Whether an element is considered part of the block and not\n * its inner blocks or appender.\n */\nexport function isInsideRootBlock( blockElement, element ) {\n\tconst parentBlock = element.closest(\n\t\t[ BLOCK_SELECTOR, APPENDER_SELECTOR, BLOCK_APPENDER_CLASS ].join( ',' )\n\t);\n\treturn parentBlock === blockElement;\n}\n\n/**\n * Finds the block client ID given any DOM node inside the block.\n *\n * @param {Node?} node DOM node.\n *\n * @return {string|undefined} Client ID or undefined if the node is not part of\n * a block.\n */\nexport function getBlockClientId( node ) {\n\twhile ( node && node.nodeType !== node.ELEMENT_NODE ) {\n\t\tnode = node.parentNode;\n\t}\n\n\tif ( ! node ) {\n\t\treturn;\n\t}\n\n\tconst elementNode = /** @type {Element} */ ( node );\n\tconst blockNode = elementNode.closest( BLOCK_SELECTOR );\n\n\tif ( ! blockNode ) {\n\t\treturn;\n\t}\n\n\treturn blockNode.id.slice( 'block-'.length );\n}\n\n/**\n * Calculates the union of two rectangles.\n *\n * @param {DOMRect} rect1 First rectangle.\n * @param {DOMRect} rect2 Second rectangle.\n * @return {DOMRect} Union of the two rectangles.\n */\nexport function rectUnion( rect1, rect2 ) {\n\tconst left = Math.min( rect1.left, rect2.left );\n\tconst right = Math.max( rect1.right, rect2.right );\n\tconst bottom = Math.max( rect1.bottom, rect2.bottom );\n\tconst top = Math.min( rect1.top, rect2.top );\n\n\treturn new window.DOMRectReadOnly( left, top, right - left, bottom - top );\n}\n\n/**\n * Returns whether an element is visible.\n *\n * @param {Element} element Element.\n * @return {boolean} Whether the element is visible.\n */\nfunction isElementVisible( element ) {\n\tconst viewport = element.ownerDocument.defaultView;\n\tif ( ! viewport ) {\n\t\treturn false;\n\t}\n\n\t// Check for <VisuallyHidden> component.\n\tif ( element.classList.contains( 'components-visually-hidden' ) ) {\n\t\treturn false;\n\t}\n\n\tconst bounds = element.getBoundingClientRect();\n\tif ( bounds.width === 0 || bounds.height === 0 ) {\n\t\treturn false;\n\t}\n\n\t// Older browsers, e.g. Safari < 17.4 may not support the `checkVisibility` method.\n\tif ( element.checkVisibility ) {\n\t\treturn element.checkVisibility?.( {\n\t\t\topacityProperty: true,\n\t\t\tcontentVisibilityAuto: true,\n\t\t\tvisibilityProperty: true,\n\t\t} );\n\t}\n\n\tconst style = viewport.getComputedStyle( element );\n\n\tif (\n\t\tstyle.display === 'none' ||\n\t\tstyle.visibility === 'hidden' ||\n\t\tstyle.opacity === '0'\n\t) {\n\t\treturn false;\n\t}\n\n\treturn true;\n}\n\n/**\n * Returns the rect of the element including all visible nested elements.\n *\n * Visible nested elements, including elements that overflow the parent, are\n * taken into account.\n *\n * This function is useful for calculating the visible area of a block that\n * contains nested elements that overflow the block, e.g. the Navigation block,\n * which can contain overflowing Submenu blocks.\n *\n * The returned rect represents the full extent of the element and its visible\n * children, which may extend beyond the viewport.\n *\n * @param {Element} element Element.\n * @return {DOMRect} Bounding client rect of the element and its visible children.\n */\nexport function getVisibleElementBounds( element ) {\n\tconst viewport = element.ownerDocument.defaultView;\n\tif ( ! viewport ) {\n\t\treturn new window.DOMRectReadOnly();\n\t}\n\n\tlet bounds = element.getBoundingClientRect();\n\n\tconst stack = [ element ];\n\tlet currentElement;\n\n\twhile ( ( currentElement = stack.pop() ) ) {\n\t\tfor ( const child of currentElement.children ) {\n\t\t\tif ( isElementVisible( child ) ) {\n\t\t\t\tconst childBounds = child.getBoundingClientRect();\n\t\t\t\tbounds = rectUnion( bounds, childBounds );\n\t\t\t\tstack.push( child );\n\t\t\t}\n\t\t}\n\t}\n\n\t/*\n\t * Take into account the outer horizontal limits of the container in which\n\t * an element is supposed to be \"visible\". For example, if an element is\n\t * positioned -10px to the left of the window x value (0), this function\n\t * discounts the negative overhang because it's not visible and therefore\n\t * not to be counted in the visibility calculations. Top and bottom values\n\t * are not accounted for to accommodate vertical scroll.\n\t */\n\tconst left = Math.max( bounds.left, 0 );\n\tconst right = Math.min( bounds.right, viewport.innerWidth );\n\tbounds = new window.DOMRectReadOnly(\n\t\tleft,\n\t\tbounds.top,\n\t\tright - left,\n\t\tbounds.height\n\t);\n\n\treturn bounds;\n}\n"],"mappings":"AAAA,MAAMA,cAAc,GAAG,iCAAiC;AACxD,MAAMC,iBAAiB,GAAG,sBAAsB;AAChD,MAAMC,oBAAoB,GAAG,qCAAqC;;AAElE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,aAAaA,CAAEC,CAAC,EAAEC,CAAC,EAAG;EACrC,OAAOD,CAAC,CAACE,OAAO,CAAEN,cAAe,CAAC,KAAKK,CAAC,CAACC,OAAO,CAAEN,cAAe,CAAC;AACnE;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASO,iBAAiBA,CAAEC,YAAY,EAAEC,OAAO,EAAG;EAC1D,MAAMC,WAAW,GAAGD,OAAO,CAACH,OAAO,CAClC,CAAEN,cAAc,EAAEC,iBAAiB,EAAEC,oBAAoB,CAAE,CAACS,IAAI,CAAE,GAAI,CACvE,CAAC;EACD,OAAOD,WAAW,KAAKF,YAAY;AACpC;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASI,gBAAgBA,CAAEC,I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AAKxB,gBAAgB,CAAEuB,KAAM,CAAC,EAAG;QAChC,MAAME,WAAW,GAAGF,KAAK,CAAChB,qBAAqB,CAAC,CAAC;QACjDD,MAAM,GAAGlB,SAAS,CAAEkB,MAAM,EAAEmB,WAAY,CAAC;QACzCL,KAAK,CAACM,IAAI,CAAEH,KAAM,CAAC;MACpB;IACD;EACD;;EAEA;AACD;AACA;AACA;AACA;AACA;AACA;AACA;EACC,MAAMhC,IAAI,GAAGC,IAAI,CAACG,GAAG,CAAEW,MAAM,CAACf,IAAI,EAAE,CAAE,CAAC;EACvC,MAAMG,KAAK,GAAGF,IAAI,CAACC,GAAG,CAAEa,MAAM,CAACZ,KAAK,EAAEO,QAAQ,CAAC0B,UAAW,CAAC;EAC3DrB,MAAM,GAAG,IAAIR,MAAM,CAACC,eAAe,CAClCR,IAAI,EACJe,MAAM,CAACT,GAAG,EACVH,KAAK,GAAGH,IAAI,EACZe,MAAM,CAACG,MACR,CAAC;EAED,OAAOH,MAAM;AACd","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["BLOCK_SELECTOR","APPENDER_SELECTOR","BLOCK_APPENDER_CLASS","isInSameBlock","a","b","closest","isInsideRootBlock","blockElement","element","parentBlock","join","getBlockClientId","node","nodeType","ELEMENT_NODE","parentNode","elementNode","blockNode","id","slice","length","rectUnion","rect1","rect2","left","Math","min","right","max","bottom","top","window","DOMRectReadOnly","isElementVisible","viewport","ownerDocument","defaultView","classList","contains","bounds","getBoundingClientRect","width","height","checkVisibility","opacityProperty","contentVisibilityAuto","visibilityProperty","style","getComputedStyle","display","visibility","opacity","isScrollable","overflowX","overflowY","getVisibleElementBounds","stack","currentElement","pop","child","children","childBounds","push","innerWidth"],"sources":["@wordpress/block-editor/src/utils/dom.js"],"sourcesContent":["const BLOCK_SELECTOR = '.block-editor-block-list__block';\nconst APPENDER_SELECTOR = '.block-list-appender';\nconst BLOCK_APPENDER_CLASS = '.block-editor-button-block-appender';\n\n/**\n * Returns true if two elements are contained within the same block.\n *\n * @param {Element} a First element.\n * @param {Element} b Second element.\n *\n * @return {boolean} Whether elements are in the same block.\n */\nexport function isInSameBlock( a, b ) {\n\treturn a.closest( BLOCK_SELECTOR ) === b.closest( BLOCK_SELECTOR );\n}\n\n/**\n * Returns true if an element is considered part of the block and not its inner\n * blocks or appender.\n *\n * @param {Element} blockElement Block container element.\n * @param {Element} element Element.\n *\n * @return {boolean} Whether an element is considered part of the block and not\n * its inner blocks or appender.\n */\nexport function isInsideRootBlock( blockElement, element ) {\n\tconst parentBlock = element.closest(\n\t\t[ BLOCK_SELECTOR, APPENDER_SELECTOR, BLOCK_APPENDER_CLASS ].join( ',' )\n\t);\n\treturn parentBlock === blockElement;\n}\n\n/**\n * Finds the block client ID given any DOM node inside the block.\n *\n * @param {Node?} node DOM node.\n *\n * @return {string|undefined} Client ID or undefined if the node is not part of\n * a block.\n */\nexport function getBlockClientId( node ) {\n\twhile ( node && node.nodeType !== node.ELEMENT_NODE ) {\n\t\tnode = node.parentNode;\n\t}\n\n\tif ( ! node ) {\n\t\treturn;\n\t}\n\n\tconst elementNode = /** @type {Element} */ ( node );\n\tconst blockNode = elementNode.closest( BLOCK_SELECTOR );\n\n\tif ( ! blockNode ) {\n\t\treturn;\n\t}\n\n\treturn blockNode.id.slice( 'block-'.length );\n}\n\n/**\n * Calculates the union of two rectangles.\n *\n * @param {DOMRect} rect1 First rectangle.\n * @param {DOMRect} rect2 Second rectangle.\n * @return {DOMRect} Union of the two rectangles.\n */\nexport function rectUnion( rect1, rect2 ) {\n\tconst left = Math.min( rect1.left, rect2.left );\n\tconst right = Math.max( rect1.right, rect2.right );\n\tconst bottom = Math.max( rect1.bottom, rect2.bottom );\n\tconst top = Math.min( rect1.top, rect2.top );\n\n\treturn new window.DOMRectReadOnly( left, top, right - left, bottom - top );\n}\n\n/**\n * Returns whether an element is visible.\n *\n * @param {Element} element Element.\n * @return {boolean} Whether the element is visible.\n */\nfunction isElementVisible( element ) {\n\tconst viewport = element.ownerDocument.defaultView;\n\tif ( ! viewport ) {\n\t\treturn false;\n\t}\n\n\t// Check for <VisuallyHidden> component.\n\tif ( element.classList.contains( 'components-visually-hidden' ) ) {\n\t\treturn false;\n\t}\n\n\tconst bounds = element.getBoundingClientRect();\n\tif ( bounds.width === 0 || bounds.height === 0 ) {\n\t\treturn false;\n\t}\n\n\t// Older browsers, e.g. Safari < 17.4 may not support the `checkVisibility` method.\n\tif ( element.checkVisibility ) {\n\t\treturn element.checkVisibility?.( {\n\t\t\topacityProperty: true,\n\t\t\tcontentVisibilityAuto: true,\n\t\t\tvisibilityProperty: true,\n\t\t} );\n\t}\n\n\tconst style = viewport.getComputedStyle( element );\n\n\tif (\n\t\tstyle.display === 'none' ||\n\t\tstyle.visibility === 'hidden' ||\n\t\tstyle.opacity === '0'\n\t) {\n\t\treturn false;\n\t}\n\n\treturn true;\n}\n\n/**\n * Checks if the element is scrollable.\n *\n * @param {Element} element Element.\n * @return {boolean} True if the element is scrollable.\n */\nfunction isScrollable( element ) {\n\tconst style = window.getComputedStyle( element );\n\treturn (\n\t\tstyle.overflowX === 'auto' ||\n\t\tstyle.overflowX === 'scroll' ||\n\t\tstyle.overflowY === 'auto' ||\n\t\tstyle.overflowY === 'scroll'\n\t);\n}\n\n/**\n * Returns the rect of the element including all visible nested elements.\n *\n * Visible nested elements, including elements that overflow the parent, are\n * taken into account.\n *\n * This function is useful for calculating the visible area of a block that\n * contains nested elements that overflow the block, e.g. the Navigation block,\n * which can contain overflowing Submenu blocks.\n *\n * The returned rect represents the full extent of the element and its visible\n * children, which may extend beyond the viewport.\n *\n * @param {Element} element Element.\n * @return {DOMRect} Bounding client rect of the element and its visible children.\n */\nexport function getVisibleElementBounds( element ) {\n\tconst viewport = element.ownerDocument.defaultView;\n\n\tif ( ! viewport ) {\n\t\treturn new window.DOMRectReadOnly();\n\t}\n\n\tlet bounds = element.getBoundingClientRect();\n\tconst stack = [ element ];\n\tlet currentElement;\n\n\twhile ( ( currentElement = stack.pop() ) ) {\n\t\tfor ( const child of currentElement.children ) {\n\t\t\tif ( isElementVisible( child ) ) {\n\t\t\t\tlet childBounds = child.getBoundingClientRect();\n\t\t\t\t// If the parent is scrollable, use parent's scrollable bounds.\n\t\t\t\tif ( isScrollable( currentElement ) ) {\n\t\t\t\t\tchildBounds = currentElement.getBoundingClientRect();\n\t\t\t\t}\n\t\t\t\tbounds = rectUnion( bounds, childBounds );\n\t\t\t\tstack.push( child );\n\t\t\t}\n\t\t}\n\t}\n\n\t/*\n\t * Take into account the outer horizontal limits of the container in which\n\t * an element is supposed to be \"visible\". For example, if an element is\n\t * positioned -10px to the left of the window x value (0), this function\n\t * discounts the negative overhang because it's not visible and therefore\n\t * not to be counted in the visibility calculations. Top and bottom values\n\t * are not accounted for to accommodate vertical scroll.\n\t */\n\tconst left = Math.max( bounds.left, 0 );\n\tconst right = Math.min( bounds.right, viewport.innerWidth );\n\tbounds = new window.DOMRectReadOnly(\n\t\tleft,\n\t\tbounds.top,\n\t\tright - left,\n\t\tbounds.height\n\t);\n\n\treturn bounds;\n}\n"],"mappings":"AAAA,MAAMA,cAAc,GAAG,iCAAiC;AACxD,MAAMC,iBAAiB,GAAG,sBAAsB;AAChD,MAAMC,oBAAoB,GAAG,qCAAqC;;AAElE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,aAAaA,CAAEC,CAAC,EAAEC,CAAC,EAAG;EACrC,OAAOD,CAAC,CAACE,OAAO,CAAEN,cAAe,CAAC,KAAKK,CAAC,CAACC,OAAO,CAAEN,cAAe,CAAC;AACnE;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASO,iBAAiBA,CAAEC,YAAY,EAAEC,OAAO,EAAG;EAC1D,MAAMC,WAAW,GAAGD,OAAO,CAACH,OAAO,CAClC,CAAEN,cAAc,EAAEC,iBAAiB,EAAEC,oBAAoB,CAAE,CAACS,IAAI,CAAE,GAAI,CACvE,CAAC;EACD,OAAOD,WAAW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D,MAAM0B,QAAQ,GAAG1B,OAAO,CAAC2B,aAAa,CAACC,WAAW;EAElD,IAAK,CAAEF,QAAQ,EAAG;IACjB,OAAO,IAAIH,MAAM,CAACC,eAAe,CAAC,CAAC;EACpC;EAEA,IAAIO,MAAM,GAAG/B,OAAO,CAACgC,qBAAqB,CAAC,CAAC;EAC5C,MAAMgB,KAAK,GAAG,CAAEhD,OAAO,CAAE;EACzB,IAAIiD,cAAc;EAElB,OAAUA,cAAc,GAAGD,KAAK,CAACE,GAAG,CAAC,CAAC,EAAK;IAC1C,KAAM,MAAMC,KAAK,IAAIF,cAAc,CAACG,QAAQ,EAAG;MAC9C,IAAK3B,gBAAgB,CAAE0B,KAAM,CAAC,EAAG;QAChC,IAAIE,WAAW,GAAGF,KAAK,CAACnB,qBAAqB,CAAC,CAAC;QAC/C;QACA,IAAKY,YAAY,CAAEK,cAAe,CAAC,EAAG;UACrCI,WAAW,GAAGJ,cAAc,CAACjB,qBAAqB,CAAC,CAAC;QACrD;QACAD,MAAM,GAAGlB,SAAS,CAAEkB,MAAM,EAAEsB,WAAY,CAAC;QACzCL,KAAK,CAACM,IAAI,CAAEH,KAAM,CAAC;MACpB;IACD;EACD;;EAEA;AACD;AACA;AACA;AACA;AACA;AACA;AACA;EACC,MAAMnC,IAAI,GAAGC,IAAI,CAACG,GAAG,CAAEW,MAAM,CAACf,IAAI,EAAE,CAAE,CAAC;EACvC,MAAMG,KAAK,GAAGF,IAAI,CAACC,GAAG,CAAEa,MAAM,CAACZ,KAAK,EAAEO,QAAQ,CAAC6B,UAAW,CAAC;EAC3DxB,MAAM,GAAG,IAAIR,MAAM,CAACC,eAAe,CAClCR,IAAI,EACJe,MAAM,CAACT,GAAG,EACVH,KAAK,GAAGH,IAAI,EACZe,MAAM,CAACG,MACR,CAAC;EAED,OAAOH,MAAM;AACd","ignoreList":[]}
|
|
@@ -500,13 +500,14 @@ _::-webkit-full-page-media, _:future, :root .has-multi-selection .block-editor-b
|
|
|
500
500
|
display: flex;
|
|
501
501
|
align-items: center;
|
|
502
502
|
justify-content: center;
|
|
503
|
+
overflow: hidden;
|
|
503
504
|
font-size: 13px;
|
|
504
505
|
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
|
|
505
506
|
color: #000;
|
|
506
507
|
font-weight: normal;
|
|
507
508
|
}
|
|
508
509
|
.is-zoomed-out .block-editor-block-list__zoom-out-separator {
|
|
509
|
-
font-size: calc(13px
|
|
510
|
+
font-size: calc(13px / var(--wp-block-editor-iframe-zoom-out-scale));
|
|
510
511
|
}
|
|
511
512
|
.block-editor-block-list__zoom-out-separator.is-dragged-over {
|
|
512
513
|
background: #ccc;
|
|
@@ -803,26 +804,9 @@ _::-webkit-full-page-media, _:future, :root .has-multi-selection .block-editor-b
|
|
|
803
804
|
border: 0.01px solid transparent;
|
|
804
805
|
}
|
|
805
806
|
|
|
806
|
-
.block-editor-iframe__container {
|
|
807
|
-
width: 100%;
|
|
808
|
-
height: 100%;
|
|
809
|
-
overflow-x: hidden;
|
|
810
|
-
}
|
|
811
|
-
|
|
812
|
-
.block-editor-iframe__scale-container {
|
|
813
|
-
width: 100%;
|
|
814
|
-
height: 100%;
|
|
815
|
-
display: flex;
|
|
816
|
-
}
|
|
817
|
-
|
|
818
|
-
.block-editor-iframe__scale-container.is-zoomed-out {
|
|
819
|
-
width: var(--wp-block-editor-iframe-zoom-out-prev-container-width, 100vw);
|
|
820
|
-
margin-right: calc(-1 * (var(--wp-block-editor-iframe-zoom-out-prev-container-width, 100vw) - var(--wp-block-editor-iframe-zoom-out-container-width, 100vw)) / 2);
|
|
821
|
-
}
|
|
822
|
-
|
|
823
807
|
.block-editor-iframe__html {
|
|
824
808
|
transform-origin: top center;
|
|
825
|
-
transition: all
|
|
809
|
+
transition: all 400ms cubic-bezier(0.46, 0.03, 0.52, 0.96), transform 0s, scale 0s, padding 0s;
|
|
826
810
|
}
|
|
827
811
|
@media (prefers-reduced-motion: reduce) {
|
|
828
812
|
.block-editor-iframe__html {
|
|
@@ -830,9 +814,19 @@ _::-webkit-full-page-media, _:future, :root .has-multi-selection .block-editor-b
|
|
|
830
814
|
transition-delay: 0s;
|
|
831
815
|
}
|
|
832
816
|
}
|
|
817
|
+
.block-editor-iframe__html.zoom-out-animation {
|
|
818
|
+
transition: all 400ms cubic-bezier(0.46, 0.03, 0.52, 0.96), transform 0s;
|
|
819
|
+
}
|
|
820
|
+
@media (prefers-reduced-motion: reduce) {
|
|
821
|
+
.block-editor-iframe__html.zoom-out-animation {
|
|
822
|
+
transition-duration: 0s;
|
|
823
|
+
transition-delay: 0s;
|
|
824
|
+
}
|
|
825
|
+
}
|
|
833
826
|
|
|
834
827
|
.block-editor-iframe__html.is-zoomed-out {
|
|
835
|
-
transform: scale(var(--wp-block-editor-iframe-zoom-out-scale));
|
|
828
|
+
transform: translateX(calc(-1*((var(--wp-block-editor-iframe-zoom-out-scale-container-width) - var(--wp-block-editor-iframe-zoom-out-container-width, 100vw)) / 2 / var(--wp-block-editor-iframe-zoom-out-scale))));
|
|
829
|
+
scale: var(--wp-block-editor-iframe-zoom-out-scale);
|
|
836
830
|
background-color: #ddd;
|
|
837
831
|
margin-bottom: calc(-1 * calc(calc(var(--wp-block-editor-iframe-zoom-out-content-height) * (1 - var(--wp-block-editor-iframe-zoom-out-scale))) + calc(2 * var(--wp-block-editor-iframe-zoom-out-frame-size) / var(--wp-block-editor-iframe-zoom-out-scale)) + 2px));
|
|
838
832
|
padding-top: calc(var(--wp-block-editor-iframe-zoom-out-frame-size) / var(--wp-block-editor-iframe-zoom-out-scale));
|
package/build-style/content.css
CHANGED
|
@@ -500,13 +500,14 @@ _::-webkit-full-page-media, _:future, :root .has-multi-selection .block-editor-b
|
|
|
500
500
|
display: flex;
|
|
501
501
|
align-items: center;
|
|
502
502
|
justify-content: center;
|
|
503
|
+
overflow: hidden;
|
|
503
504
|
font-size: 13px;
|
|
504
505
|
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
|
|
505
506
|
color: #000;
|
|
506
507
|
font-weight: normal;
|
|
507
508
|
}
|
|
508
509
|
.is-zoomed-out .block-editor-block-list__zoom-out-separator {
|
|
509
|
-
font-size: calc(13px
|
|
510
|
+
font-size: calc(13px / var(--wp-block-editor-iframe-zoom-out-scale));
|
|
510
511
|
}
|
|
511
512
|
.block-editor-block-list__zoom-out-separator.is-dragged-over {
|
|
512
513
|
background: #ccc;
|
|
@@ -803,26 +804,9 @@ _::-webkit-full-page-media, _:future, :root .has-multi-selection .block-editor-b
|
|
|
803
804
|
border: 0.01px solid transparent;
|
|
804
805
|
}
|
|
805
806
|
|
|
806
|
-
.block-editor-iframe__container {
|
|
807
|
-
width: 100%;
|
|
808
|
-
height: 100%;
|
|
809
|
-
overflow-x: hidden;
|
|
810
|
-
}
|
|
811
|
-
|
|
812
|
-
.block-editor-iframe__scale-container {
|
|
813
|
-
width: 100%;
|
|
814
|
-
height: 100%;
|
|
815
|
-
display: flex;
|
|
816
|
-
}
|
|
817
|
-
|
|
818
|
-
.block-editor-iframe__scale-container.is-zoomed-out {
|
|
819
|
-
width: var(--wp-block-editor-iframe-zoom-out-prev-container-width, 100vw);
|
|
820
|
-
margin-left: calc(-1 * (var(--wp-block-editor-iframe-zoom-out-prev-container-width, 100vw) - var(--wp-block-editor-iframe-zoom-out-container-width, 100vw)) / 2);
|
|
821
|
-
}
|
|
822
|
-
|
|
823
807
|
.block-editor-iframe__html {
|
|
824
808
|
transform-origin: top center;
|
|
825
|
-
transition: all
|
|
809
|
+
transition: all 400ms cubic-bezier(0.46, 0.03, 0.52, 0.96), transform 0s, scale 0s, padding 0s;
|
|
826
810
|
}
|
|
827
811
|
@media (prefers-reduced-motion: reduce) {
|
|
828
812
|
.block-editor-iframe__html {
|
|
@@ -830,9 +814,19 @@ _::-webkit-full-page-media, _:future, :root .has-multi-selection .block-editor-b
|
|
|
830
814
|
transition-delay: 0s;
|
|
831
815
|
}
|
|
832
816
|
}
|
|
817
|
+
.block-editor-iframe__html.zoom-out-animation {
|
|
818
|
+
transition: all 400ms cubic-bezier(0.46, 0.03, 0.52, 0.96), transform 0s;
|
|
819
|
+
}
|
|
820
|
+
@media (prefers-reduced-motion: reduce) {
|
|
821
|
+
.block-editor-iframe__html.zoom-out-animation {
|
|
822
|
+
transition-duration: 0s;
|
|
823
|
+
transition-delay: 0s;
|
|
824
|
+
}
|
|
825
|
+
}
|
|
833
826
|
|
|
834
827
|
.block-editor-iframe__html.is-zoomed-out {
|
|
835
|
-
transform: scale(var(--wp-block-editor-iframe-zoom-out-scale));
|
|
828
|
+
transform: translateX(calc((var(--wp-block-editor-iframe-zoom-out-scale-container-width) - var(--wp-block-editor-iframe-zoom-out-container-width, 100vw)) / 2 / var(--wp-block-editor-iframe-zoom-out-scale)));
|
|
829
|
+
scale: var(--wp-block-editor-iframe-zoom-out-scale);
|
|
836
830
|
background-color: #ddd;
|
|
837
831
|
margin-bottom: calc(-1 * calc(calc(var(--wp-block-editor-iframe-zoom-out-content-height) * (1 - var(--wp-block-editor-iframe-zoom-out-scale))) + calc(2 * var(--wp-block-editor-iframe-zoom-out-frame-size) / var(--wp-block-editor-iframe-zoom-out-scale)) + 2px));
|
|
838
832
|
padding-top: calc(var(--wp-block-editor-iframe-zoom-out-frame-size) / var(--wp-block-editor-iframe-zoom-out-scale));
|
|
@@ -270,7 +270,7 @@ iframe[name=editor-canvas] {
|
|
|
270
270
|
height: 100%;
|
|
271
271
|
display: block;
|
|
272
272
|
background-color: transparent;
|
|
273
|
-
transition: all
|
|
273
|
+
transition: all 400ms cubic-bezier(0.46, 0.03, 0.52, 0.96);
|
|
274
274
|
}
|
|
275
275
|
@media (prefers-reduced-motion: reduce) {
|
|
276
276
|
iframe[name=editor-canvas] {
|
|
@@ -554,25 +554,8 @@ iframe[name=editor-canvas] {
|
|
|
554
554
|
right: 50%;
|
|
555
555
|
}
|
|
556
556
|
|
|
557
|
-
.
|
|
558
|
-
|
|
559
|
-
.zoom-out-toolbar .block-editor-block-toolbar-shuffle:focus::before,
|
|
560
|
-
.zoom-out-toolbar .block-selection-button_drag-handle:focus::before {
|
|
561
|
-
box-shadow: 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color);
|
|
562
|
-
}
|
|
563
|
-
.zoom-out-toolbar .block-editor-block-mover {
|
|
564
|
-
background: none;
|
|
565
|
-
border: none;
|
|
566
|
-
}
|
|
567
|
-
.zoom-out-toolbar .zoom-out-toolbar-button {
|
|
568
|
-
height: 40px;
|
|
569
|
-
}
|
|
570
|
-
|
|
571
|
-
.block-editor-block-tools__zoom-out-mode-inserter-button {
|
|
572
|
-
visibility: hidden;
|
|
573
|
-
}
|
|
574
|
-
.block-editor-block-tools__zoom-out-mode-inserter-button.is-visible {
|
|
575
|
-
visibility: visible;
|
|
557
|
+
.components-button.block-editor-button-pattern-inserter__button.block-editor-block-tools__zoom-out-mode-inserter-button {
|
|
558
|
+
top: -1px;
|
|
576
559
|
}
|
|
577
560
|
|
|
578
561
|
.block-editor-block-lock-modal {
|
|
@@ -1919,6 +1902,22 @@ iframe[name=editor-canvas] {
|
|
|
1919
1902
|
padding: 0;
|
|
1920
1903
|
}
|
|
1921
1904
|
|
|
1905
|
+
.block-editor-iframe__container {
|
|
1906
|
+
width: 100%;
|
|
1907
|
+
height: 100%;
|
|
1908
|
+
overflow-x: hidden;
|
|
1909
|
+
}
|
|
1910
|
+
|
|
1911
|
+
.block-editor-iframe__scale-container {
|
|
1912
|
+
height: 100%;
|
|
1913
|
+
}
|
|
1914
|
+
|
|
1915
|
+
.block-editor-iframe__scale-container.is-zoomed-out {
|
|
1916
|
+
width: var(--wp-block-editor-iframe-zoom-out-scale-container-width, 100vw);
|
|
1917
|
+
position: absolute;
|
|
1918
|
+
left: 0;
|
|
1919
|
+
}
|
|
1920
|
+
|
|
1922
1921
|
.block-editor-image-size-control {
|
|
1923
1922
|
margin-bottom: 1em;
|
|
1924
1923
|
}
|
|
@@ -3061,10 +3060,14 @@ iframe[name=editor-canvas] {
|
|
|
3061
3060
|
margin-bottom: 8px;
|
|
3062
3061
|
box-shadow: none;
|
|
3063
3062
|
outline: none;
|
|
3063
|
+
border-radius: 2px;
|
|
3064
3064
|
}
|
|
3065
3065
|
.components-popover.block-editor-rich-text__inline-format-toolbar .components-toolbar {
|
|
3066
3066
|
border-radius: 2px;
|
|
3067
3067
|
}
|
|
3068
|
+
.components-popover.block-editor-rich-text__inline-format-toolbar .components-toolbar-group {
|
|
3069
|
+
background: none;
|
|
3070
|
+
}
|
|
3068
3071
|
.components-popover.block-editor-rich-text__inline-format-toolbar .components-toolbar__control,
|
|
3069
3072
|
.components-popover.block-editor-rich-text__inline-format-toolbar .components-dropdown-menu__toggle {
|
|
3070
3073
|
min-width: 48px;
|
|
@@ -3478,9 +3481,12 @@ div.block-editor-bindings__panel button:hover .block-editor-bindings__item span
|
|
|
3478
3481
|
}
|
|
3479
3482
|
.block-editor-block-toolbar > :last-child,
|
|
3480
3483
|
.block-editor-block-toolbar > :last-child .components-toolbar-group,
|
|
3481
|
-
.block-editor-block-toolbar > :last-child .components-toolbar {
|
|
3484
|
+
.block-editor-block-toolbar > :last-child .components-toolbar, .block-editor-block-toolbar:has(> :last-child:empty) > :nth-last-child(2), .block-editor-block-toolbar:has(> :last-child:empty) > :nth-last-child(2) .components-toolbar-group, .block-editor-block-toolbar:has(> :last-child:empty) > :nth-last-child(2) .components-toolbar {
|
|
3482
3485
|
border-left: none;
|
|
3483
3486
|
}
|
|
3487
|
+
.block-editor-block-toolbar .components-toolbar-group:empty {
|
|
3488
|
+
display: none;
|
|
3489
|
+
}
|
|
3484
3490
|
|
|
3485
3491
|
.block-editor-block-contextual-toolbar {
|
|
3486
3492
|
position: sticky;
|
|
@@ -3775,6 +3781,7 @@ div.block-editor-bindings__panel button:hover .block-editor-bindings__item span
|
|
|
3775
3781
|
}
|
|
3776
3782
|
|
|
3777
3783
|
.block-editor-inserter__panel-header {
|
|
3784
|
+
position: relative;
|
|
3778
3785
|
display: inline-flex;
|
|
3779
3786
|
align-items: center;
|
|
3780
3787
|
padding: 16px 16px 0;
|
package/build-style/style.css
CHANGED
|
@@ -270,7 +270,7 @@ iframe[name=editor-canvas] {
|
|
|
270
270
|
height: 100%;
|
|
271
271
|
display: block;
|
|
272
272
|
background-color: transparent;
|
|
273
|
-
transition: all
|
|
273
|
+
transition: all 400ms cubic-bezier(0.46, 0.03, 0.52, 0.96);
|
|
274
274
|
}
|
|
275
275
|
@media (prefers-reduced-motion: reduce) {
|
|
276
276
|
iframe[name=editor-canvas] {
|
|
@@ -554,25 +554,8 @@ iframe[name=editor-canvas] {
|
|
|
554
554
|
left: 50%;
|
|
555
555
|
}
|
|
556
556
|
|
|
557
|
-
.
|
|
558
|
-
|
|
559
|
-
.zoom-out-toolbar .block-editor-block-toolbar-shuffle:focus::before,
|
|
560
|
-
.zoom-out-toolbar .block-selection-button_drag-handle:focus::before {
|
|
561
|
-
box-shadow: 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color);
|
|
562
|
-
}
|
|
563
|
-
.zoom-out-toolbar .block-editor-block-mover {
|
|
564
|
-
background: none;
|
|
565
|
-
border: none;
|
|
566
|
-
}
|
|
567
|
-
.zoom-out-toolbar .zoom-out-toolbar-button {
|
|
568
|
-
height: 40px;
|
|
569
|
-
}
|
|
570
|
-
|
|
571
|
-
.block-editor-block-tools__zoom-out-mode-inserter-button {
|
|
572
|
-
visibility: hidden;
|
|
573
|
-
}
|
|
574
|
-
.block-editor-block-tools__zoom-out-mode-inserter-button.is-visible {
|
|
575
|
-
visibility: visible;
|
|
557
|
+
.components-button.block-editor-button-pattern-inserter__button.block-editor-block-tools__zoom-out-mode-inserter-button {
|
|
558
|
+
top: -1px;
|
|
576
559
|
}
|
|
577
560
|
|
|
578
561
|
.block-editor-block-lock-modal {
|
|
@@ -1920,6 +1903,22 @@ iframe[name=editor-canvas] {
|
|
|
1920
1903
|
padding: 0;
|
|
1921
1904
|
}
|
|
1922
1905
|
|
|
1906
|
+
.block-editor-iframe__container {
|
|
1907
|
+
width: 100%;
|
|
1908
|
+
height: 100%;
|
|
1909
|
+
overflow-x: hidden;
|
|
1910
|
+
}
|
|
1911
|
+
|
|
1912
|
+
.block-editor-iframe__scale-container {
|
|
1913
|
+
height: 100%;
|
|
1914
|
+
}
|
|
1915
|
+
|
|
1916
|
+
.block-editor-iframe__scale-container.is-zoomed-out {
|
|
1917
|
+
width: var(--wp-block-editor-iframe-zoom-out-scale-container-width, 100vw);
|
|
1918
|
+
position: absolute;
|
|
1919
|
+
right: 0;
|
|
1920
|
+
}
|
|
1921
|
+
|
|
1923
1922
|
.block-editor-image-size-control {
|
|
1924
1923
|
margin-bottom: 1em;
|
|
1925
1924
|
}
|
|
@@ -3062,10 +3061,14 @@ iframe[name=editor-canvas] {
|
|
|
3062
3061
|
margin-bottom: 8px;
|
|
3063
3062
|
box-shadow: none;
|
|
3064
3063
|
outline: none;
|
|
3064
|
+
border-radius: 2px;
|
|
3065
3065
|
}
|
|
3066
3066
|
.components-popover.block-editor-rich-text__inline-format-toolbar .components-toolbar {
|
|
3067
3067
|
border-radius: 2px;
|
|
3068
3068
|
}
|
|
3069
|
+
.components-popover.block-editor-rich-text__inline-format-toolbar .components-toolbar-group {
|
|
3070
|
+
background: none;
|
|
3071
|
+
}
|
|
3069
3072
|
.components-popover.block-editor-rich-text__inline-format-toolbar .components-toolbar__control,
|
|
3070
3073
|
.components-popover.block-editor-rich-text__inline-format-toolbar .components-dropdown-menu__toggle {
|
|
3071
3074
|
min-width: 48px;
|
|
@@ -3479,9 +3482,12 @@ div.block-editor-bindings__panel button:hover .block-editor-bindings__item span
|
|
|
3479
3482
|
}
|
|
3480
3483
|
.block-editor-block-toolbar > :last-child,
|
|
3481
3484
|
.block-editor-block-toolbar > :last-child .components-toolbar-group,
|
|
3482
|
-
.block-editor-block-toolbar > :last-child .components-toolbar {
|
|
3485
|
+
.block-editor-block-toolbar > :last-child .components-toolbar, .block-editor-block-toolbar:has(> :last-child:empty) > :nth-last-child(2), .block-editor-block-toolbar:has(> :last-child:empty) > :nth-last-child(2) .components-toolbar-group, .block-editor-block-toolbar:has(> :last-child:empty) > :nth-last-child(2) .components-toolbar {
|
|
3483
3486
|
border-right: none;
|
|
3484
3487
|
}
|
|
3488
|
+
.block-editor-block-toolbar .components-toolbar-group:empty {
|
|
3489
|
+
display: none;
|
|
3490
|
+
}
|
|
3485
3491
|
|
|
3486
3492
|
.block-editor-block-contextual-toolbar {
|
|
3487
3493
|
position: sticky;
|
|
@@ -3776,6 +3782,7 @@ div.block-editor-bindings__panel button:hover .block-editor-bindings__item span
|
|
|
3776
3782
|
}
|
|
3777
3783
|
|
|
3778
3784
|
.block-editor-inserter__panel-header {
|
|
3785
|
+
position: relative;
|
|
3779
3786
|
display: inline-flex;
|
|
3780
3787
|
align-items: center;
|
|
3781
3788
|
padding: 16px 16px 0;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dom.d.ts","sourceRoot":"","sources":["../../src/utils/dom.js"],"names":[],"mappings":"AAIA;;;;;;;GAOG;AACH,iCALW,OAAO,KACP,OAAO,GAEN,OAAO,CAIlB;AAED;;;;;;;;;GASG;AACH,gDANW,OAAO,WACP,OAAO,GAEN,OAAO,CAQlB;AAED;;;;;;;GAOG;AACH,uCALW,IAAI,OAAC,GAEJ,MAAM,GAAC,SAAS,CAoB3B;AAED;;;;;;GAMG;AACH,iCAJW,OAAO,SACP,OAAO,GACN,OAAO,CASlB;
|
|
1
|
+
{"version":3,"file":"dom.d.ts","sourceRoot":"","sources":["../../src/utils/dom.js"],"names":[],"mappings":"AAIA;;;;;;;GAOG;AACH,iCALW,OAAO,KACP,OAAO,GAEN,OAAO,CAIlB;AAED;;;;;;;;;GASG;AACH,gDANW,OAAO,WACP,OAAO,GAEN,OAAO,CAQlB;AAED;;;;;;;GAOG;AACH,uCALW,IAAI,OAAC,GAEJ,MAAM,GAAC,SAAS,CAoB3B;AAED;;;;;;GAMG;AACH,iCAJW,OAAO,SACP,OAAO,GACN,OAAO,CASlB;AA8DD;;;;;;;;;;;;;;;GAeG;AACH,iDAHW,OAAO,GACN,OAAO,CA6ClB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wordpress/block-editor",
|
|
3
|
-
"version": "14.3.
|
|
3
|
+
"version": "14.3.8",
|
|
4
4
|
"description": "Generic block editor.",
|
|
5
5
|
"author": "The WordPress Contributors",
|
|
6
6
|
"license": "GPL-2.0-or-later",
|
|
@@ -40,9 +40,9 @@
|
|
|
40
40
|
"@wordpress/api-fetch": "^7.8.2",
|
|
41
41
|
"@wordpress/blob": "^4.8.1",
|
|
42
42
|
"@wordpress/block-serialization-default-parser": "^5.8.1",
|
|
43
|
-
"@wordpress/blocks": "^13.8.
|
|
44
|
-
"@wordpress/commands": "^1.8.
|
|
45
|
-
"@wordpress/components": "^28.8.
|
|
43
|
+
"@wordpress/blocks": "^13.8.5",
|
|
44
|
+
"@wordpress/commands": "^1.8.7",
|
|
45
|
+
"@wordpress/components": "^28.8.7",
|
|
46
46
|
"@wordpress/compose": "^7.8.3",
|
|
47
47
|
"@wordpress/data": "^10.8.3",
|
|
48
48
|
"@wordpress/date": "^5.8.2",
|
|
@@ -58,7 +58,7 @@
|
|
|
58
58
|
"@wordpress/keyboard-shortcuts": "^5.8.3",
|
|
59
59
|
"@wordpress/keycodes": "^4.8.2",
|
|
60
60
|
"@wordpress/notices": "^5.8.3",
|
|
61
|
-
"@wordpress/preferences": "^4.8.
|
|
61
|
+
"@wordpress/preferences": "^4.8.7",
|
|
62
62
|
"@wordpress/private-apis": "^1.8.1",
|
|
63
63
|
"@wordpress/rich-text": "^7.8.3",
|
|
64
64
|
"@wordpress/style-engine": "^2.8.1",
|
|
@@ -88,5 +88,5 @@
|
|
|
88
88
|
"publishConfig": {
|
|
89
89
|
"access": "public"
|
|
90
90
|
},
|
|
91
|
-
"gitHead": "
|
|
91
|
+
"gitHead": "2453690ba117f1c1634e078f3a0b6a9ac47820ba"
|
|
92
92
|
}
|
|
@@ -464,14 +464,15 @@ _::-webkit-full-page-media, _:future, :root .has-multi-selection .block-editor-b
|
|
|
464
464
|
display: flex;
|
|
465
465
|
align-items: center;
|
|
466
466
|
justify-content: center;
|
|
467
|
+
overflow: hidden;
|
|
467
468
|
font-size: $default-font-size;
|
|
468
469
|
font-family: $default-font;
|
|
469
470
|
color: $black;
|
|
470
471
|
font-weight: normal;
|
|
471
472
|
|
|
472
473
|
.is-zoomed-out & {
|
|
473
|
-
//
|
|
474
|
-
font-size: calc(#{$default-font-size}
|
|
474
|
+
// Maintains an absolute font-size by counter-scaling based on the zoom level.
|
|
475
|
+
font-size: calc(#{$default-font-size} / var(--wp-block-editor-iframe-zoom-out-scale));
|
|
475
476
|
}
|
|
476
477
|
|
|
477
478
|
&.is-dragged-over {
|
|
@@ -10,6 +10,7 @@ import { useRefEffect } from '@wordpress/compose';
|
|
|
10
10
|
* Internal dependencies
|
|
11
11
|
*/
|
|
12
12
|
import { store as blockEditorStore } from '../../../store';
|
|
13
|
+
import { unlock } from '../../../lock-unlock';
|
|
13
14
|
|
|
14
15
|
/**
|
|
15
16
|
* Adds block behaviour:
|
|
@@ -20,9 +21,18 @@ import { store as blockEditorStore } from '../../../store';
|
|
|
20
21
|
* @param {string} clientId Block client ID.
|
|
21
22
|
*/
|
|
22
23
|
export function useEventHandlers( { clientId, isSelected } ) {
|
|
23
|
-
const {
|
|
24
|
-
|
|
25
|
-
|
|
24
|
+
const {
|
|
25
|
+
getBlockRootClientId,
|
|
26
|
+
getBlockIndex,
|
|
27
|
+
isZoomOut,
|
|
28
|
+
__unstableGetEditorMode,
|
|
29
|
+
} = unlock( useSelect( blockEditorStore ) );
|
|
30
|
+
const {
|
|
31
|
+
insertAfterBlock,
|
|
32
|
+
removeBlock,
|
|
33
|
+
__unstableSetEditorMode,
|
|
34
|
+
resetZoomLevel,
|
|
35
|
+
} = unlock( useDispatch( blockEditorStore ) );
|
|
26
36
|
|
|
27
37
|
return useRefEffect(
|
|
28
38
|
( node ) => {
|
|
@@ -56,7 +66,14 @@ export function useEventHandlers( { clientId, isSelected } ) {
|
|
|
56
66
|
|
|
57
67
|
event.preventDefault();
|
|
58
68
|
|
|
59
|
-
if (
|
|
69
|
+
if (
|
|
70
|
+
keyCode === ENTER &&
|
|
71
|
+
__unstableGetEditorMode() === 'zoom-out' &&
|
|
72
|
+
isZoomOut()
|
|
73
|
+
) {
|
|
74
|
+
__unstableSetEditorMode( 'edit' );
|
|
75
|
+
resetZoomLevel();
|
|
76
|
+
} else if ( keyCode === ENTER ) {
|
|
60
77
|
insertAfterBlock( clientId );
|
|
61
78
|
} else {
|
|
62
79
|
removeBlock( clientId );
|
|
@@ -88,6 +105,10 @@ export function useEventHandlers( { clientId, isSelected } ) {
|
|
|
88
105
|
getBlockIndex,
|
|
89
106
|
insertAfterBlock,
|
|
90
107
|
removeBlock,
|
|
108
|
+
__unstableGetEditorMode,
|
|
109
|
+
__unstableSetEditorMode,
|
|
110
|
+
isZoomOut,
|
|
111
|
+
resetZoomLevel,
|
|
91
112
|
]
|
|
92
113
|
);
|
|
93
114
|
}
|
|
@@ -85,14 +85,15 @@ export function ZoomOutSeparator( {
|
|
|
85
85
|
<AnimatePresence>
|
|
86
86
|
{ isVisible && (
|
|
87
87
|
<motion.div
|
|
88
|
-
as="button"
|
|
89
|
-
layout={ ! isReducedMotion }
|
|
90
88
|
initial={ { height: 0 } }
|
|
91
|
-
animate={ {
|
|
89
|
+
animate={ {
|
|
90
|
+
// Use a height equal to that of the zoom out frame size.
|
|
91
|
+
height: 'calc(1.5 * var(--wp-block-editor-iframe-zoom-out-frame-size) / var(--wp-block-editor-iframe-zoom-out-scale)',
|
|
92
|
+
} }
|
|
92
93
|
exit={ { height: 0 } }
|
|
93
94
|
transition={ {
|
|
94
95
|
type: 'tween',
|
|
95
|
-
duration: 0.2,
|
|
96
|
+
duration: isReducedMotion ? 0 : 0.2,
|
|
96
97
|
ease: [ 0.6, 0, 0.4, 1 ],
|
|
97
98
|
} }
|
|
98
99
|
className={ clsx(
|
|
@@ -108,10 +109,11 @@ export function ZoomOutSeparator( {
|
|
|
108
109
|
<motion.div
|
|
109
110
|
initial={ { opacity: 0 } }
|
|
110
111
|
animate={ { opacity: 1 } }
|
|
111
|
-
exit={ { opacity: 0 } }
|
|
112
|
+
exit={ { opacity: 0, transition: { delay: -0.125 } } }
|
|
112
113
|
transition={ {
|
|
113
|
-
|
|
114
|
+
ease: 'linear',
|
|
114
115
|
duration: 0.1,
|
|
116
|
+
delay: 0.125,
|
|
115
117
|
} }
|
|
116
118
|
>
|
|
117
119
|
{ __( 'Drop pattern.' ) }
|
|
@@ -98,10 +98,10 @@ function BlockPopover(
|
|
|
98
98
|
contextElement: selectedElement,
|
|
99
99
|
};
|
|
100
100
|
}, [
|
|
101
|
+
popoverDimensionsRecomputeCounter,
|
|
102
|
+
selectedElement,
|
|
101
103
|
bottomClientId,
|
|
102
104
|
lastSelectedElement,
|
|
103
|
-
selectedElement,
|
|
104
|
-
popoverDimensionsRecomputeCounter,
|
|
105
105
|
] );
|
|
106
106
|
|
|
107
107
|
if ( ! selectedElement || ( bottomClientId && ! lastSelectedElement ) ) {
|