From f1bf1e9a66591364ef754dcb7fbddebf6e0716a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ella=20van=C2=A0Durpe?= Date: Wed, 21 Jun 2023 19:39:25 +0300 Subject: [PATCH 1/7] Ignore: just doing some performance testing --- packages/core-data/src/entity-provider.js | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/core-data/src/entity-provider.js b/packages/core-data/src/entity-provider.js index f9d61aa413fc23..35751f1b9b8aa8 100644 --- a/packages/core-data/src/entity-provider.js +++ b/packages/core-data/src/entity-provider.js @@ -150,6 +150,7 @@ export function useEntityProp( kind, name, prop, _id ) { * @return {[WPBlock[], Function, Function]} The block array and setters. */ export function useEntityBlockEditor( kind, name, { id: _id } = {} ) { + const [] = useEntityProp( kind, name, 'meta', _id ); const providerId = useEntityId( kind, name ); const id = _id ?? providerId; const { content, blocks } = useSelect( From 79d77b54f008a3c0ae66f3cfb52fcbce753f8906 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ella=20van=C2=A0Durpe?= Date: Thu, 22 Jun 2023 08:46:05 +0300 Subject: [PATCH 2/7] Try with unlock --- .../src/components/rich-text/content.js | 78 +++++++++++++++++++ .../src/components/rich-text/index.js | 37 +-------- .../src/components/rich-text/index.native.js | 36 +-------- packages/blocks/src/api/serializer.js | 9 +++ packages/core-data/package.json | 2 + packages/core-data/src/entity-provider.js | 49 ++++++++++-- packages/core-data/src/private-apis.js | 10 +++ packages/core-data/tsconfig.json | 2 + packages/private-apis/src/implementation.js | 1 + 9 files changed, 150 insertions(+), 74 deletions(-) create mode 100644 packages/block-editor/src/components/rich-text/content.js create mode 100644 packages/core-data/src/private-apis.js diff --git a/packages/block-editor/src/components/rich-text/content.js b/packages/block-editor/src/components/rich-text/content.js new file mode 100644 index 00000000000000..caded88d7e0bbd --- /dev/null +++ b/packages/block-editor/src/components/rich-text/content.js @@ -0,0 +1,78 @@ +/** + * WordPress dependencies + */ +import { RawHTML } from '@wordpress/element'; +import { children as childrenSource, getSaveElement } from '@wordpress/blocks'; +import deprecated from '@wordpress/deprecated'; + +/** + * Internal dependencies + */ +import { getMultilineTag } from './utils'; + +export const Content = ( { value, tagName: Tag, multiline, ...props } ) => { + // Handle deprecated `children` and `node` sources. + if ( Array.isArray( value ) ) { + deprecated( 'wp.blockEditor.RichText value prop as children type', { + since: '6.1', + version: '6.3', + alternative: 'value prop as string', + link: 'https://developer.wordpress.org/block-editor/how-to-guides/block-tutorial/introducing-attributes-and-editable-fields/', + } ); + + value = childrenSource.toHTML( value ); + } + + const MultilineTag = getMultilineTag( multiline ); + + if ( ! value && MultilineTag ) { + value = `<${ MultilineTag }>`; + } + + const content = { value }; + + if ( Tag ) { + const { format, ...restProps } = props; + return { content }; + } + + return content; +}; + +Content.__unstableIsRichTextContent = {}; + +function findContent( blocks, richTextValues = [] ) { + if ( ! Array.isArray( blocks ) ) { + blocks = [ blocks ]; + } + + for ( const block of blocks ) { + if ( + block?.type?.__unstableIsRichTextContent === + Content.__unstableIsRichTextContent + ) { + richTextValues.push( block.props.value ); + continue; + } + + if ( block?.props?.children ) { + findContent( block.props.children, richTextValues ); + } + } + + return richTextValues; +} + +function _getSaveElement( { name, attributes, innerBlocks } ) { + return getSaveElement( + name, + attributes, + innerBlocks.map( _getSaveElement ) + ); +} + +export function getRichTextValues( blocks = [] ) { + return findContent( + ( Array.isArray( blocks ) ? blocks : [ blocks ] ).map( _getSaveElement ) + ); +} diff --git a/packages/block-editor/src/components/rich-text/index.js b/packages/block-editor/src/components/rich-text/index.js index 0d61fc87f7fc7a..50d05e7eb4dde0 100644 --- a/packages/block-editor/src/components/rich-text/index.js +++ b/packages/block-editor/src/components/rich-text/index.js @@ -7,7 +7,6 @@ import classnames from 'classnames'; * WordPress dependencies */ import { - RawHTML, useRef, useCallback, forwardRef, @@ -46,6 +45,7 @@ import { useInsertReplacementText } from './use-insert-replacement-text'; import { useFirefoxCompat } from './use-firefox-compat'; import FormatEdit from './format-edit'; import { getMultilineTag, getAllowedFormats } from './utils'; +import { Content } from './content'; export const keyboardShortcutContext = createContext(); export const inputEventContext = createContext(); @@ -419,40 +419,7 @@ function RichTextWrapper( const ForwardedRichTextContainer = forwardRef( RichTextWrapper ); -ForwardedRichTextContainer.Content = ( { - value, - tagName: Tag, - multiline, - ...props -} ) => { - // Handle deprecated `children` and `node` sources. - if ( Array.isArray( value ) ) { - deprecated( 'wp.blockEditor.RichText value prop as children type', { - since: '6.1', - version: '6.3', - alternative: 'value prop as string', - link: 'https://developer.wordpress.org/block-editor/how-to-guides/block-tutorial/introducing-attributes-and-editable-fields/', - } ); - - value = childrenSource.toHTML( value ); - } - - const MultilineTag = getMultilineTag( multiline ); - - if ( ! value && MultilineTag ) { - value = `<${ MultilineTag }>`; - } - - const content = { value }; - - if ( Tag ) { - const { format, ...restProps } = props; - return { content }; - } - - return content; -}; - +ForwardedRichTextContainer.Content = Content; ForwardedRichTextContainer.isEmpty = ( value ) => { return ! value || value.length === 0; }; diff --git a/packages/block-editor/src/components/rich-text/index.native.js b/packages/block-editor/src/components/rich-text/index.native.js index 82e7a96ec8733a..b0c82848db6876 100644 --- a/packages/block-editor/src/components/rich-text/index.native.js +++ b/packages/block-editor/src/components/rich-text/index.native.js @@ -6,13 +6,7 @@ import classnames from 'classnames'; /** * WordPress dependencies */ -import { - RawHTML, - Platform, - useRef, - useCallback, - forwardRef, -} from '@wordpress/element'; +import { Platform, useRef, useCallback, forwardRef } from '@wordpress/element'; import { useDispatch, useSelect } from '@wordpress/data'; import { pasteHandler, @@ -55,6 +49,7 @@ import { createLinkInParagraph, } from './utils'; import EmbedHandlerPicker from './embed-handler-picker'; +import { Content } from './content'; const classes = 'block-editor-rich-text__editable'; @@ -707,32 +702,7 @@ function RichTextWrapper( const ForwardedRichTextContainer = forwardRef( RichTextWrapper ); -ForwardedRichTextContainer.Content = ( { - value, - tagName: Tag, - multiline, - ...props -} ) => { - // Handle deprecated `children` and `node` sources. - if ( Array.isArray( value ) ) { - value = childrenSource.toHTML( value ); - } - - const MultilineTag = getMultilineTag( multiline ); - - if ( ! value && MultilineTag ) { - value = `<${ MultilineTag }>`; - } - - const content = { value }; - - if ( Tag ) { - const { format, ...restProps } = props; - return { content }; - } - - return content; -}; +ForwardedRichTextContainer.Content = Content; ForwardedRichTextContainer.isEmpty = ( value ) => { return ! value || value.length === 0; diff --git a/packages/blocks/src/api/serializer.js b/packages/blocks/src/api/serializer.js index 3300e0893d2459..34922fd6508b01 100644 --- a/packages/blocks/src/api/serializer.js +++ b/packages/blocks/src/api/serializer.js @@ -96,6 +96,12 @@ export function getBlockProps( props = {} ) { */ export function getInnerBlocksProps( props = {} ) { const { innerBlocks } = innerBlocksPropsProvider; + const [ firstBlock ] = innerBlocks ?? []; + if ( ! firstBlock ) return props; + // If the innerBlocks passed to `getSaveElement` are not blocks but already + // components, return the props as is. This is the case for + // `getRichTextValues`. + if ( ! firstBlock.clientId ) return { ...props, children: innerBlocks }; // Value is an array of blocks, so defer to block serializer. const html = serialize( innerBlocks, { isInnerBlocks: true } ); // Use special-cased raw HTML tag to avoid default escaping. @@ -120,6 +126,9 @@ export function getSaveElement( innerBlocks = [] ) { const blockType = normalizeBlockType( blockTypeOrName ); + + if ( ! blockType?.save ) return null; + let { save } = blockType; // Component classes are unsupported for save since serialization must diff --git a/packages/core-data/package.json b/packages/core-data/package.json index 246d55cd14e7e4..05068541d23bb8 100644 --- a/packages/core-data/package.json +++ b/packages/core-data/package.json @@ -32,6 +32,7 @@ "dependencies": { "@babel/runtime": "^7.16.0", "@wordpress/api-fetch": "file:../api-fetch", + "@wordpress/block-editor": "file:../block-editor", "@wordpress/blocks": "file:../blocks", "@wordpress/compose": "file:../compose", "@wordpress/data": "file:../data", @@ -40,6 +41,7 @@ "@wordpress/html-entities": "file:../html-entities", "@wordpress/i18n": "file:../i18n", "@wordpress/is-shallow-equal": "file:../is-shallow-equal", + "@wordpress/private-apis": "file:../private-apis", "@wordpress/url": "file:../url", "change-case": "^4.1.2", "equivalent-key-map": "^0.2.2", diff --git a/packages/core-data/src/entity-provider.js b/packages/core-data/src/entity-provider.js index 35751f1b9b8aa8..89eec961008beb 100644 --- a/packages/core-data/src/entity-provider.js +++ b/packages/core-data/src/entity-provider.js @@ -7,13 +7,15 @@ import { useCallback, useEffect, } from '@wordpress/element'; -import { useSelect, useDispatch } from '@wordpress/data'; +import { useSelect, useDispatch, useRegistry } from '@wordpress/data'; import { parse, __unstableSerializeAndClean } from '@wordpress/blocks'; +import { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor'; /** * Internal dependencies */ import { STORE_NAME } from './name'; +import { unlock } from './private-apis'; /** @typedef {import('@wordpress/blocks').WPBlock} WPBlock */ @@ -150,7 +152,8 @@ export function useEntityProp( kind, name, prop, _id ) { * @return {[WPBlock[], Function, Function]} The block array and setters. */ export function useEntityBlockEditor( kind, name, { id: _id } = {} ) { - const [] = useEntityProp( kind, name, 'meta', _id ); + const [ meta, updateMeta ] = useEntityProp( kind, name, 'meta', _id ); + const registry = useRegistry(); const providerId = useEntityId( kind, name ); const id = _id ?? providerId; const { content, blocks } = useSelect( @@ -185,6 +188,34 @@ export function useEntityBlockEditor( kind, name, { id: _id } = {} ) { } }, [ content ] ); + const updateFootnotes = useCallback( + ( _blocks ) => { + if ( ! meta ) return; + // If meta.footnotes is empty, it means the meta is not registered. + if ( meta.footnotes === undefined ) return; + + const { getRichTextValues } = unlock( blockEditorPrivateApis ); + // const _content = getRichTextValues( _blocks ).join( '' ) || ''; + // const newOrder = []; + + // if ( _content.indexOf( 'data-fn' ) !== -1 ) { + // const regex = /data-fn="([^"]+)"/g; + // let match; + // while ( ( match = regex.exec( _content ) ) !== null ) { + // newOrder.push( match[ 1 ] ); + // } + // } + + // const footnotes = JSON.parse( meta.footnotes || '[]' ); + // const currentOrder = footnotes.map( ( fn ) => fn.id ); + + // if ( currentOrder.join( '' ) === newOrder.join( '' ) ) return; + + // + }, + [ meta, updateMeta ] + ); + const onChange = useCallback( ( newBlocks, options ) => { const { selection } = options; @@ -201,18 +232,24 @@ export function useEntityBlockEditor( kind, name, { id: _id } = {} ) { edits.content = ( { blocks: blocksForSerialization = [] } ) => __unstableSerializeAndClean( blocksForSerialization ); - editEntityRecord( kind, name, id, edits ); + registry.batch( () => { + updateFootnotes( edits.blocks ); + editEntityRecord( kind, name, id, edits ); + } ); }, - [ kind, name, id, blocks ] + [ kind, name, id, blocks, updateFootnotes ] ); const onInput = useCallback( ( newBlocks, options ) => { const { selection } = options; const edits = { blocks: newBlocks, selection }; - editEntityRecord( kind, name, id, edits ); + registry.batch( () => { + updateFootnotes( edits.blocks ); + editEntityRecord( kind, name, id, edits ); + } ); }, - [ kind, name, id ] + [ kind, name, id, updateFootnotes ] ); return [ blocks ?? EMPTY_ARRAY, onInput, onChange ]; diff --git a/packages/core-data/src/private-apis.js b/packages/core-data/src/private-apis.js new file mode 100644 index 00000000000000..a5b93a25dbf778 --- /dev/null +++ b/packages/core-data/src/private-apis.js @@ -0,0 +1,10 @@ +/** + * WordPress dependencies + */ +import { __dangerousOptInToUnstableAPIsOnlyForCoreModules } from '@wordpress/private-apis'; + +export const { lock, unlock } = + __dangerousOptInToUnstableAPIsOnlyForCoreModules( + 'I know using unstable features means my plugin or theme will inevitably break on the next WordPress release.', + '@wordpress/core-data' + ); diff --git a/packages/core-data/tsconfig.json b/packages/core-data/tsconfig.json index c712a2d1ad2d81..3ba9daad756019 100644 --- a/packages/core-data/tsconfig.json +++ b/packages/core-data/tsconfig.json @@ -10,12 +10,14 @@ "references": [ { "path": "../api-fetch" }, { "path": "../compose" }, + { "path": "../block-editor" }, { "path": "../data" }, { "path": "../deprecated" }, { "path": "../element" }, { "path": "../html-entities" }, { "path": "../i18n" }, { "path": "../is-shallow-equal" }, + { "path": "../private-apis" }, { "path": "../url" } ], "include": [ "src/**/*" ] diff --git a/packages/private-apis/src/implementation.js b/packages/private-apis/src/implementation.js index c12b431c4ceefe..31936fba5ad516 100644 --- a/packages/private-apis/src/implementation.js +++ b/packages/private-apis/src/implementation.js @@ -16,6 +16,7 @@ const CORE_MODULES_USING_PRIVATE_APIS = [ '@wordpress/commands', '@wordpress/components', '@wordpress/core-commands', + '@wordpress/core-data', '@wordpress/customize-widgets', '@wordpress/data', '@wordpress/edit-post', From 7de384bb63be7cd25ba01145d0ae6ef4ca1f1fd6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ella=20van=C2=A0Durpe?= Date: Thu, 22 Jun 2023 09:51:23 +0300 Subject: [PATCH 3/7] Try getRichTextValues --- packages/core-data/src/entity-provider.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/core-data/src/entity-provider.js b/packages/core-data/src/entity-provider.js index 89eec961008beb..cd8f69dfb6b110 100644 --- a/packages/core-data/src/entity-provider.js +++ b/packages/core-data/src/entity-provider.js @@ -195,7 +195,7 @@ export function useEntityBlockEditor( kind, name, { id: _id } = {} ) { if ( meta.footnotes === undefined ) return; const { getRichTextValues } = unlock( blockEditorPrivateApis ); - // const _content = getRichTextValues( _blocks ).join( '' ) || ''; + const _content = getRichTextValues( _blocks ).join( '' ) || ''; // const newOrder = []; // if ( _content.indexOf( 'data-fn' ) !== -1 ) { From 0b6ed8471c69eb1d83f319c64e0a3533a7ddaa91 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ella=20van=C2=A0Durpe?= Date: Thu, 22 Jun 2023 12:06:58 +0300 Subject: [PATCH 4/7] Check indexOf --- packages/core-data/src/entity-provider.js | 26 +++++++++++------------ 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/packages/core-data/src/entity-provider.js b/packages/core-data/src/entity-provider.js index cd8f69dfb6b110..284cb59faa1f3f 100644 --- a/packages/core-data/src/entity-provider.js +++ b/packages/core-data/src/entity-provider.js @@ -196,22 +196,20 @@ export function useEntityBlockEditor( kind, name, { id: _id } = {} ) { const { getRichTextValues } = unlock( blockEditorPrivateApis ); const _content = getRichTextValues( _blocks ).join( '' ) || ''; - // const newOrder = []; - - // if ( _content.indexOf( 'data-fn' ) !== -1 ) { - // const regex = /data-fn="([^"]+)"/g; - // let match; - // while ( ( match = regex.exec( _content ) ) !== null ) { - // newOrder.push( match[ 1 ] ); - // } - // } - - // const footnotes = JSON.parse( meta.footnotes || '[]' ); - // const currentOrder = footnotes.map( ( fn ) => fn.id ); + const newOrder = []; + + if ( _content.indexOf( 'data-fn' ) !== -1 ) { + const regex = /data-fn="([^"]+)"/g; + let match; + while ( ( match = regex.exec( _content ) ) !== null ) { + newOrder.push( match[ 1 ] ); + } + } - // if ( currentOrder.join( '' ) === newOrder.join( '' ) ) return; + const footnotes = JSON.parse( meta.footnotes || '[]' ); + const currentOrder = footnotes.map( ( fn ) => fn.id ); - // + if ( currentOrder.join( '' ) === newOrder.join( '' ) ) return; }, [ meta, updateMeta ] ); From 1f71d813acc538778a6418167e6142865d8e24cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ella=20van=C2=A0Durpe?= Date: Thu, 22 Jun 2023 15:11:06 +0300 Subject: [PATCH 5/7] With update meta --- packages/core-data/src/entity-provider.js | 33 ++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/packages/core-data/src/entity-provider.js b/packages/core-data/src/entity-provider.js index 284cb59faa1f3f..04bb4c21433e30 100644 --- a/packages/core-data/src/entity-provider.js +++ b/packages/core-data/src/entity-provider.js @@ -21,6 +21,8 @@ import { unlock } from './private-apis'; const EMPTY_ARRAY = []; +let oldFootnotes = {}; + /** * Internal dependencies */ @@ -198,6 +200,9 @@ export function useEntityBlockEditor( kind, name, { id: _id } = {} ) { const _content = getRichTextValues( _blocks ).join( '' ) || ''; const newOrder = []; + // This can be avoided when + // https://github.com/WordPress/gutenberg/pull/43204 lands. We can then + // get the order directly from the rich text values. if ( _content.indexOf( 'data-fn' ) !== -1 ) { const regex = /data-fn="([^"]+)"/g; let match; @@ -206,10 +211,36 @@ export function useEntityBlockEditor( kind, name, { id: _id } = {} ) { } } - const footnotes = JSON.parse( meta.footnotes || '[]' ); + const footnotes = meta.footnotes + ? JSON.parse( meta.footnotes ) + : []; const currentOrder = footnotes.map( ( fn ) => fn.id ); if ( currentOrder.join( '' ) === newOrder.join( '' ) ) return; + + const newFootnotes = newOrder.map( + ( fnId ) => + footnotes.find( ( fn ) => fn.id === fnId ) || + oldFootnotes[ fnId ] || { + id: fnId, + content: '', + } + ); + + oldFootnotes = { + ...oldFootnotes, + ...footnotes.reduce( ( acc, fn ) => { + if ( ! newOrder.includes( fn.id ) ) { + acc[ fn.id ] = fn; + } + return acc; + }, {} ), + }; + + updateMeta( { + ...meta, + footnotes: JSON.stringify( newFootnotes ), + } ); }, [ meta, updateMeta ] ); From f20c8478ee51f530f403adbcb78c52dca0865272 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ella=20van=C2=A0Durpe?= Date: Thu, 22 Jun 2023 19:34:06 +0300 Subject: [PATCH 6/7] Register meta --- lib/client-assets.php | 22 +++++++ packages/core-data/src/entity-provider.js | 76 +++++++++++------------ 2 files changed, 60 insertions(+), 38 deletions(-) diff --git a/lib/client-assets.php b/lib/client-assets.php index 9757e4b7ff24a8..57a762455558d8 100644 --- a/lib/client-assets.php +++ b/lib/client-assets.php @@ -569,3 +569,25 @@ function gutenberg_register_vendor_scripts( $scripts ) { // Enqueue stored styles. add_action( 'wp_enqueue_scripts', 'gutenberg_enqueue_stored_styles' ); add_action( 'wp_footer', 'gutenberg_enqueue_stored_styles', 1 ); + +/** + * Registers the `core/footnotes` block on the server. + */ +function register_block_core_footnotes() { + register_post_meta( + 'post', + 'footnotes', + array( + 'show_in_rest' => true, + 'single' => true, + 'type' => 'string', + ) + ); + register_block_type_from_metadata( + __DIR__ . '/footnotes', + array( + 'render_callback' => 'render_block_core_footnotes', + ) + ); +} +add_action( 'init', 'register_block_core_footnotes' ); diff --git a/packages/core-data/src/entity-provider.js b/packages/core-data/src/entity-provider.js index 04bb4c21433e30..96402a5dae57aa 100644 --- a/packages/core-data/src/entity-provider.js +++ b/packages/core-data/src/entity-provider.js @@ -21,7 +21,7 @@ import { unlock } from './private-apis'; const EMPTY_ARRAY = []; -let oldFootnotes = {}; +const oldFootnotes = {}; /** * Internal dependencies @@ -198,49 +198,49 @@ export function useEntityBlockEditor( kind, name, { id: _id } = {} ) { const { getRichTextValues } = unlock( blockEditorPrivateApis ); const _content = getRichTextValues( _blocks ).join( '' ) || ''; - const newOrder = []; + // const newOrder = []; - // This can be avoided when - // https://github.com/WordPress/gutenberg/pull/43204 lands. We can then - // get the order directly from the rich text values. - if ( _content.indexOf( 'data-fn' ) !== -1 ) { - const regex = /data-fn="([^"]+)"/g; - let match; - while ( ( match = regex.exec( _content ) ) !== null ) { - newOrder.push( match[ 1 ] ); - } - } + // // This can be avoided when + // // https://github.com/WordPress/gutenberg/pull/43204 lands. We can then + // // get the order directly from the rich text values. + // if ( _content.indexOf( 'data-fn' ) !== -1 ) { + // const regex = /data-fn="([^"]+)"/g; + // let match; + // while ( ( match = regex.exec( _content ) ) !== null ) { + // newOrder.push( match[ 1 ] ); + // } + // } - const footnotes = meta.footnotes - ? JSON.parse( meta.footnotes ) - : []; - const currentOrder = footnotes.map( ( fn ) => fn.id ); + // const footnotes = meta.footnotes + // ? JSON.parse( meta.footnotes ) + // : []; + // const currentOrder = footnotes.map( ( fn ) => fn.id ); - if ( currentOrder.join( '' ) === newOrder.join( '' ) ) return; + // if ( currentOrder.join( '' ) === newOrder.join( '' ) ) return; - const newFootnotes = newOrder.map( - ( fnId ) => - footnotes.find( ( fn ) => fn.id === fnId ) || - oldFootnotes[ fnId ] || { - id: fnId, - content: '', - } - ); + // const newFootnotes = newOrder.map( + // ( fnId ) => + // footnotes.find( ( fn ) => fn.id === fnId ) || + // oldFootnotes[ fnId ] || { + // id: fnId, + // content: '', + // } + // ); - oldFootnotes = { - ...oldFootnotes, - ...footnotes.reduce( ( acc, fn ) => { - if ( ! newOrder.includes( fn.id ) ) { - acc[ fn.id ] = fn; - } - return acc; - }, {} ), - }; + // oldFootnotes = { + // ...oldFootnotes, + // ...footnotes.reduce( ( acc, fn ) => { + // if ( ! newOrder.includes( fn.id ) ) { + // acc[ fn.id ] = fn; + // } + // return acc; + // }, {} ), + // }; - updateMeta( { - ...meta, - footnotes: JSON.stringify( newFootnotes ), - } ); + // updateMeta( { + // ...meta, + // footnotes: JSON.stringify( newFootnotes ), + // } ); }, [ meta, updateMeta ] ); From 0ca0f6c9aee11daaf91df3353af8810f6eeef165 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ella=20van=C2=A0Durpe?= Date: Thu, 22 Jun 2023 20:20:10 +0300 Subject: [PATCH 7/7] fix --- packages/block-editor/src/private-apis.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/packages/block-editor/src/private-apis.js b/packages/block-editor/src/private-apis.js index b9ec71fc1a786d..85f0e4a168781d 100644 --- a/packages/block-editor/src/private-apis.js +++ b/packages/block-editor/src/private-apis.js @@ -4,6 +4,7 @@ import * as globalStyles from './components/global-styles'; import { ExperimentalBlockEditorProvider } from './components/provider'; import { lock } from './lock-unlock'; +import { getRichTextValues } from './components/rich-text/content'; import ResizableBoxPopover from './components/resizable-box-popover'; import { ComposedPrivateInserter as PrivateInserter } from './components/inserter'; import { PrivateListView } from './components/list-view'; @@ -22,6 +23,7 @@ export const privateApis = {}; lock( privateApis, { ...globalStyles, ExperimentalBlockEditorProvider, + getRichTextValues, PrivateInserter, PrivateListView, ResizableBoxPopover,