-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Second round of bugfixes for 6.3 Beta 4 (#52493)
* Post and Comment Template blocks: Change render_block_context priority to 1 (#52364) * Footnotes: fix lingering format boundary attr (#52439) * Footnotes: Fix incorrect anchor position in Firefox (#52425) * Scope CSS rules for the wp admin reset to js support only. (#52376) * Fix: Patterns & template parts: remove "apply globally" option from block settings (#52160) * Advanced styles panel: add an early return * Update index.js * Minor styling changes * Use array of features --------- Co-authored-by: George Mamadashvili <[email protected]> * make the body of the editor minimmum viewport height so that smaller contents maintain clickability (#52406) * Patterns: Add renaming, duplication, and deletion options (#52270) * Patterns: Update manage pattern links to go to site editor if available (#52403) * [Patterns] Separate sync status into a filter control (#52303) Co-authored-by: Saxon Fletcher <[email protected]> Co-authored-by: Glen Davies <[email protected]> * Patterns: Add missing decoding entities processing in Patterns and Template/Parts pages (#52449) * Fix document title icon appearance (#52424) * Quote block: Add transform to paragraph (#51809) * Add ungroup transform as transform to p * Lint * Update test and snapshot. --------- Co-authored-by: Juan Aldasoro <[email protected]> * remove sidebar group descriptions (#52453) * Patterns: alternative grid layout to improve keyboard accessibility (#52357) * add sync tooltip (#52458) * Patterns: Update section heading levels (#52273) * Ensure that the unsaved title is not persisted when reopening the modal (#52473) * Iframe: avoid asset parsing & fix script localisation (#52405) * Iframe: avoid asset parsing & fix script localisation * Add e2e test for script localisation * Update descriptions (#52468) * Footnotes: show in inserter and placehold (#52445) * Footnotes: show in inserter and placehold * Fix placeholder block membrane; fix copy; add icon, label --------- Co-authored-by: Miguel Fonseca <[email protected]> * Fix: Focus loss on navigation link label editing on Firefox. (#52428) * Update tooltip (#52465) * Refactor, document, and fix image block deprecations (#52081) * Refactor, document, and fix image block deprecations * Fix v5 attributes & supports * Fix v1 & v2 deprecation tests * Rename deprecated test descriptions * Respect custom aspect ratio (#52286) * add image width and height via css inline style, update width and height attrs to be string * keep width and height as attributes too, keep the attributes as numbers * updates image fixtures * RichText/Footnotes: make getRichTextValues work with InnerBlocks.Content (#52241) * RichText/Footnotes: make getRichTextValues work with InnerBlocks.Content --------- Co-authored-by: Miguel Fonseca <[email protected]> * Footnotes: save numbering through the entity provider (#52423) * Footnotes: save numbering through the entity provider * Add sup so no styling is needed at all * Migrate old format * Restore old styles, fix nested attribute queries * Fix anchor selection * Migrate markup in entity provider instead * Fix tests * Fix typo * Fix comment --------- Co-authored-by: Miguel Fonseca <[email protected]> * Revert "Post editor: Require confirmation before removing Footnotes (#52277)" (#52486) This reverts commit e6426ea. * List block: Fix selected type option (#52472) * Library - make pattern title clickable (#51898) * Use button inside title * Remove href * Preserve roving tab index * Fix link colors to match trunk $gray-600 * Remove redundant var * Amend colors as per review * remove old files again --------- Co-authored-by: scruffian <[email protected]> * remove status icon (#52457) * Rename block theme activation nonce variable. (#52398) --------- Co-authored-by: Bernie Reiter <[email protected]> Co-authored-by: Ella <[email protected]> Co-authored-by: Aki Hamano <[email protected]> Co-authored-by: Andrea Fercia <[email protected]> Co-authored-by: Carolina Nymark <[email protected]> Co-authored-by: George Mamadashvili <[email protected]> Co-authored-by: Andrei Draganescu <[email protected]> Co-authored-by: Aaron Robertshaw <[email protected]> Co-authored-by: Kai Hao <[email protected]> Co-authored-by: Saxon Fletcher <[email protected]> Co-authored-by: Glen Davies <[email protected]> Co-authored-by: James Koster <[email protected]> Co-authored-by: Rich Tabor <[email protected]> Co-authored-by: Juan Aldasoro <[email protected]> Co-authored-by: Miguel Fonseca <[email protected]> Co-authored-by: Jorge Costa <[email protected]> Co-authored-by: Alex Lende <[email protected]> Co-authored-by: Héctor <[email protected]> Co-authored-by: Petter Walbø Johnsgård <[email protected]> Co-authored-by: Dave Smith <[email protected]> Co-authored-by: scruffian <[email protected]> Co-authored-by: Peter Wilson <[email protected]>
- Loading branch information
1 parent
3eeb607
commit 7bb6f87
Showing
75 changed files
with
2,065 additions
and
1,041 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
95 changes: 95 additions & 0 deletions
95
packages/block-editor/src/components/rich-text/get-rich-text-values.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
/** | ||
* WordPress dependencies | ||
*/ | ||
import { RawHTML, StrictMode, Fragment } from '@wordpress/element'; | ||
import { | ||
getSaveElement, | ||
__unstableGetBlockProps as getBlockProps, | ||
} from '@wordpress/blocks'; | ||
|
||
/** | ||
* Internal dependencies | ||
*/ | ||
import InnerBlocks from '../inner-blocks'; | ||
import { Content } from './content'; | ||
|
||
/* | ||
* This function is similar to `@wordpress/element`'s `renderToString` function, | ||
* except that it does not render the elements to a string, but instead collects | ||
* the values of all rich text `Content` elements. | ||
*/ | ||
function addValuesForElement( element, ...args ) { | ||
if ( null === element || undefined === element || false === element ) { | ||
return; | ||
} | ||
|
||
if ( Array.isArray( element ) ) { | ||
return addValuesForElements( element, ...args ); | ||
} | ||
|
||
switch ( typeof element ) { | ||
case 'string': | ||
case 'number': | ||
return; | ||
} | ||
|
||
const { type, props } = element; | ||
|
||
switch ( type ) { | ||
case StrictMode: | ||
case Fragment: | ||
return addValuesForElements( props.children, ...args ); | ||
case RawHTML: | ||
return; | ||
case InnerBlocks.Content: | ||
return addValuesForBlocks( ...args ); | ||
case Content: | ||
const [ values ] = args; | ||
values.push( props.value ); | ||
return; | ||
} | ||
|
||
switch ( typeof type ) { | ||
case 'string': | ||
if ( typeof props.children !== 'undefined' ) { | ||
return addValuesForElements( props.children, ...args ); | ||
} | ||
return; | ||
case 'function': | ||
if ( | ||
type.prototype && | ||
typeof type.prototype.render === 'function' | ||
) { | ||
return addValuesForElement( | ||
new type( props ).render(), | ||
...args | ||
); | ||
} | ||
|
||
return addValuesForElement( type( props ), ...args ); | ||
} | ||
} | ||
|
||
function addValuesForElements( children, ...args ) { | ||
children = Array.isArray( children ) ? children : [ children ]; | ||
|
||
for ( let i = 0; i < children.length; i++ ) { | ||
addValuesForElement( children[ i ], ...args ); | ||
} | ||
} | ||
|
||
function addValuesForBlocks( values, blocks ) { | ||
for ( let i = 0; i < blocks.length; i++ ) { | ||
const { name, attributes, innerBlocks } = blocks[ i ]; | ||
const saveElement = getSaveElement( name, attributes ); | ||
addValuesForElement( saveElement, values, innerBlocks ); | ||
} | ||
} | ||
|
||
export function getRichTextValues( blocks = [] ) { | ||
getBlockProps.skipFilters = true; | ||
const values = []; | ||
addValuesForBlocks( values, blocks ); | ||
getBlockProps.skipFilters = false; | ||
return values; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
7bb6f87
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Flaky tests detected in 7bb6f87.
Some tests passed with failed attempts. The failures may not be related to this commit but are still reported for visibility. See the documentation for more information.
🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/5516119365
📝 Reported issues:
/test/e2e/specs/editor/blocks/navigation.spec.js