From 99600d35ea48ca5fe84eee583280c87e4ab46249 Mon Sep 17 00:00:00 2001 From: Ella Date: Mon, 4 Dec 2023 09:58:24 +0200 Subject: [PATCH] Fix annotation tests --- packages/rich-text/src/component/index.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/rich-text/src/component/index.js b/packages/rich-text/src/component/index.js index a04406e5a1f6c..a2b5734d5c204 100644 --- a/packages/rich-text/src/component/index.js +++ b/packages/rich-text/src/component/index.js @@ -124,10 +124,10 @@ export function useRichText( { if ( disableFormats ) { _value.current = newRecord.text; } else { - const newFormas = __unstableBeforeSerialize + const newFormats = __unstableBeforeSerialize ? __unstableBeforeSerialize( newRecord ) : newRecord.formats; - newRecord = { ...newRecord, formats: newFormas }; + newRecord = { ...newRecord, formats: newFormats }; if ( typeof value === 'string' ) { _value.current = toHTMLString( { value: newRecord } ); } else { @@ -135,7 +135,7 @@ export function useRichText( { } } - const { start, end, formats, text } = newRecord; + const { start, end, formats, text } = record.current; // Selection must be updated first, so it is recorded in history when // the content change happens.