From 8cee001c7fb6eb00245f9bc2988c016ec6fd45ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ella=20van=C2=A0Durpe?= Date: Sat, 3 Jun 2023 11:48:03 +0300 Subject: [PATCH] Fix unit tests --- docs/reference-guides/core-blocks.md | 2 +- packages/block-editor/src/private-apis.native.js | 2 ++ packages/block-library/src/footnotes/block.json | 6 ++++-- packages/core-data/tsconfig.json | 2 ++ packages/rich-text/src/create.js | 4 ++-- 5 files changed, 11 insertions(+), 5 deletions(-) diff --git a/docs/reference-guides/core-blocks.md b/docs/reference-guides/core-blocks.md index 0b9dc48e07f8fb..5fa0eaca73b32b 100644 --- a/docs/reference-guides/core-blocks.md +++ b/docs/reference-guides/core-blocks.md @@ -275,7 +275,7 @@ Add a link to a downloadable file. ([Source](https://github.com/WordPress/gutenb - **Name:** core/footnotes - **Category:** text -- **Supports:** ~~html~~, ~~multiple~~ +- **Supports:** ~~html~~, ~~inserter~~, ~~multiple~~, ~~reusable~~ - **Attributes:** ## Classic diff --git a/packages/block-editor/src/private-apis.native.js b/packages/block-editor/src/private-apis.native.js index 5555e00477e7b5..82900b0379d0ae 100644 --- a/packages/block-editor/src/private-apis.native.js +++ b/packages/block-editor/src/private-apis.native.js @@ -3,6 +3,7 @@ */ import * as globalStyles from './components/global-styles'; import { ExperimentalBlockEditorProvider } from './components/provider'; +import { getRichTextValues } from './components/rich-text'; import { lock } from './lock-unlock'; /** @@ -12,4 +13,5 @@ export const privateApis = {}; lock( privateApis, { ...globalStyles, ExperimentalBlockEditorProvider, + getRichTextValues, } ); diff --git a/packages/block-library/src/footnotes/block.json b/packages/block-library/src/footnotes/block.json index 597dd812ab0c21..0ab992009d123f 100644 --- a/packages/block-library/src/footnotes/block.json +++ b/packages/block-library/src/footnotes/block.json @@ -1,6 +1,6 @@ { "$schema": "https://schemas.wp.org/trunk/block.json", - "apiVersion": 2, + "apiVersion": 3, "name": "core/footnotes", "title": "Footnotes", "category": "text", @@ -10,7 +10,9 @@ "usesContext": [ "postId", "postType" ], "supports": { "html": false, - "multiple": false + "multiple": false, + "inserter": false, + "reusable": false }, "style": "wp-block-footnotes" } 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/rich-text/src/create.js b/packages/rich-text/src/create.js index 01e9d57f9f2283..7cb38b9295b09a 100644 --- a/packages/rich-text/src/create.js +++ b/packages/rich-text/src/create.js @@ -424,7 +424,7 @@ function createFromElement( { attributes: getAttributes( { element: node } ), } ); - if ( format.formatType?.contentEditable === false ) { + if ( format?.formatType?.contentEditable === false ) { delete format.formatType; accumulateSelection( accumulator, node, range, createEmptyValue() ); mergePair( accumulator, { @@ -440,7 +440,7 @@ function createFromElement( { continue; } - delete format.formatType; + if ( format ) delete format.formatType; if ( multilineWrapperTags &&