From 147760fec8654d6fb22ff611c82ab6bf0790b5db Mon Sep 17 00:00:00 2001 From: Ella Date: Fri, 7 Jul 2023 15:10:08 +0200 Subject: [PATCH 1/9] Footnotes: save numbering through the entity provider --- .../block-library/src/footnotes/format.js | 2 +- .../block-library/src/footnotes/style.scss | 15 ------ packages/core-data/src/entity-provider.js | 46 ++++++++++++++++++- 3 files changed, 45 insertions(+), 18 deletions(-) diff --git a/packages/block-library/src/footnotes/format.js b/packages/block-library/src/footnotes/format.js index 7c1b190fc42af..36608b7620308 100644 --- a/packages/block-library/src/footnotes/format.js +++ b/packages/block-library/src/footnotes/format.js @@ -54,7 +54,7 @@ export const format = { id: `${ id }-link`, 'data-fn': id, }, - innerHTML: '*', + innerHTML: '', }, value.end, value.end diff --git a/packages/block-library/src/footnotes/style.scss b/packages/block-library/src/footnotes/style.scss index ad49bc1cf2911..c177caa9d2137 100644 --- a/packages/block-library/src/footnotes/style.scss +++ b/packages/block-library/src/footnotes/style.scss @@ -1,19 +1,4 @@ -.editor-styles-wrapper, -.entry-content { - counter-reset: footnotes; -} - [data-fn].fn { vertical-align: super; font-size: smaller; - counter-increment: footnotes; - display: inline-flex; - text-decoration: none; - text-indent: -9999999px; -} - -[data-fn].fn::after { - content: "[" counter(footnotes) "]"; - text-indent: 0; - float: left; } diff --git a/packages/core-data/src/entity-provider.js b/packages/core-data/src/entity-provider.js index da048944f1498..9d0e8505dfa78 100644 --- a/packages/core-data/src/entity-provider.js +++ b/packages/core-data/src/entity-provider.js @@ -226,6 +226,48 @@ export function useEntityBlockEditor( kind, name, { id: _id } = {} ) { } ); + function updateBlocksAttributes( __blocks ) { + return __blocks.map( ( block ) => { + const attributes = { ...block.attributes }; + for ( const key in attributes ) { + const value = attributes[ key ]; + + if ( typeof value !== 'string' ) { + continue; + } + + if ( value.indexOf( 'data-fn' ) === -1 ) { + continue; + } + + // When we store rich text values, this would no longer + // require a regex. + const regex = + /(]+data-fn="([^"]+)"[^>]*>)\d*<\/a>/g; + + attributes[ key ] = value.replace( + regex, + ( match, opening, fnId ) => { + const index = newOrder.indexOf( fnId ); + return `${ opening }${ index + 1 }`; + } + ); + } + + return { + ...block, + attributes, + innerBlocks: updateBlocksAttributes( + block.innerBlocks + ), + }; + } ); + } + + // We need to go through all block attributs deeply and update the + // footnote anchor numbering (textContent) to match the new order. + const newBlocks = updateBlocksAttributes( _blocks ); + oldFootnotes = { ...oldFootnotes, ...footnotes.reduce( ( acc, fn ) => { @@ -241,6 +283,7 @@ export function useEntityBlockEditor( kind, name, { id: _id } = {} ) { ...meta, footnotes: JSON.stringify( newFootnotes ), }, + blocks: newBlocks, }; }, [ meta ] @@ -258,7 +301,6 @@ export function useEntityBlockEditor( kind, name, { id: _id } = {} ) { // to make sure the edit makes the post dirty and creates // a new undo level. const edits = { - blocks: newBlocks, selection, content: ( { blocks: blocksForSerialization = [] } ) => __unstableSerializeAndClean( blocksForSerialization ), @@ -282,7 +324,7 @@ export function useEntityBlockEditor( kind, name, { id: _id } = {} ) { ( newBlocks, options ) => { const { selection } = options; const footnotesChanges = updateFootnotes( newBlocks ); - const edits = { blocks: newBlocks, selection, ...footnotesChanges }; + const edits = { selection, ...footnotesChanges }; editEntityRecord( kind, name, id, edits, { isCached: true } ); }, From d86b6fbd4a5cd5400a2967f674e456db3d4b24e7 Mon Sep 17 00:00:00 2001 From: Ella Date: Fri, 7 Jul 2023 15:41:02 +0200 Subject: [PATCH 2/9] Add sup so no styling is needed at all --- packages/block-library/src/footnotes/format.js | 8 ++------ packages/block-library/src/footnotes/style.scss | 4 ---- packages/block-library/src/style.scss | 1 - packages/core-data/src/entity-provider.js | 4 ++-- packages/rich-text/src/to-dom.js | 4 ++++ packages/rich-text/src/to-tree.js | 6 +++++- 6 files changed, 13 insertions(+), 14 deletions(-) delete mode 100644 packages/block-library/src/footnotes/style.scss diff --git a/packages/block-library/src/footnotes/format.js b/packages/block-library/src/footnotes/format.js index 36608b7620308..f8215a460c713 100644 --- a/packages/block-library/src/footnotes/format.js +++ b/packages/block-library/src/footnotes/format.js @@ -24,11 +24,9 @@ import { name } from './block.json'; export const formatName = 'core/footnote'; export const format = { title: __( 'Footnote' ), - tagName: 'a', + tagName: 'sup', className: 'fn', attributes: { - id: 'id', - href: 'href', 'data-fn': 'data-fn', }, contentEditable: false, @@ -50,11 +48,9 @@ export const format = { { type: formatName, attributes: { - href: '#' + id, - id: `${ id }-link`, 'data-fn': id, }, - innerHTML: '', + innerHTML: ``, }, value.end, value.end diff --git a/packages/block-library/src/footnotes/style.scss b/packages/block-library/src/footnotes/style.scss deleted file mode 100644 index c177caa9d2137..0000000000000 --- a/packages/block-library/src/footnotes/style.scss +++ /dev/null @@ -1,4 +0,0 @@ -[data-fn].fn { - vertical-align: super; - font-size: smaller; -} diff --git a/packages/block-library/src/style.scss b/packages/block-library/src/style.scss index c4b0a37e6354d..c5277995d10da 100644 --- a/packages/block-library/src/style.scss +++ b/packages/block-library/src/style.scss @@ -55,6 +55,5 @@ @import "./text-columns/style.scss"; @import "./verse/style.scss"; @import "./video/style.scss"; -@import "./footnotes/style.scss"; @import "common.scss"; diff --git a/packages/core-data/src/entity-provider.js b/packages/core-data/src/entity-provider.js index 9d0e8505dfa78..ecc16c07ca151 100644 --- a/packages/core-data/src/entity-provider.js +++ b/packages/core-data/src/entity-provider.js @@ -243,13 +243,13 @@ export function useEntityBlockEditor( kind, name, { id: _id } = {} ) { // When we store rich text values, this would no longer // require a regex. const regex = - /(]+data-fn="([^"]+)"[^>]*>)\d*<\/a>/g; + /(]+data-fn="([^"]+)"[^>]*>]*>)\d*<\/a><\/sup>/g; attributes[ key ] = value.replace( regex, ( match, opening, fnId ) => { const index = newOrder.indexOf( fnId ); - return `${ opening }${ index + 1 }`; + return `${ opening }${ index + 1 }`; } ); } diff --git a/packages/rich-text/src/to-dom.js b/packages/rich-text/src/to-dom.js index 828e3a4e3f6cb..33df1ca293c90 100644 --- a/packages/rich-text/src/to-dom.js +++ b/packages/rich-text/src/to-dom.js @@ -61,6 +61,10 @@ function append( element, child ) { child = element.ownerDocument.createTextNode( child ); } + if ( child.html !== undefined ) { + return ( element.innerHTML += child.html ); + } + const { type, attributes } = child; if ( type ) { diff --git a/packages/rich-text/src/to-tree.js b/packages/rich-text/src/to-tree.js index b390954b79672..645beb86f3d6b 100644 --- a/packages/rich-text/src/to-tree.js +++ b/packages/rich-text/src/to-tree.js @@ -326,7 +326,11 @@ export function toTree( { } ) ); - if ( innerHTML ) append( pointer, innerHTML ); + if ( innerHTML ) { + append( pointer, { + html: innerHTML, + } ); + } } else { pointer = append( getParent( pointer ), From dad21a7b76d142b13b8540515c5af815010d86d1 Mon Sep 17 00:00:00 2001 From: Ella Date: Fri, 7 Jul 2023 17:14:46 +0200 Subject: [PATCH 3/9] Migrate old format --- .../block-library/src/footnotes/format.js | 2 +- packages/core-data/src/entity-provider.js | 10 +++++---- packages/rich-text/src/create.js | 21 +++++++++++++------ 3 files changed, 22 insertions(+), 11 deletions(-) diff --git a/packages/block-library/src/footnotes/format.js b/packages/block-library/src/footnotes/format.js index f8215a460c713..40de6a132ea99 100644 --- a/packages/block-library/src/footnotes/format.js +++ b/packages/block-library/src/footnotes/format.js @@ -50,7 +50,7 @@ export const format = { attributes: { 'data-fn': id, }, - innerHTML: ``, + innerHTML: `*`, }, value.end, value.end diff --git a/packages/core-data/src/entity-provider.js b/packages/core-data/src/entity-provider.js index ecc16c07ca151..acc6e65947488 100644 --- a/packages/core-data/src/entity-provider.js +++ b/packages/core-data/src/entity-provider.js @@ -191,9 +191,10 @@ export function useEntityBlockEditor( kind, name, { id: _id } = {} ) { const updateFootnotes = useCallback( ( _blocks ) => { - if ( ! meta ) return; + const output = { blocks: _blocks, meta }; + if ( ! meta ) return output; // If meta.footnotes is empty, it means the meta is not registered. - if ( meta.footnotes === undefined ) return {}; + if ( meta.footnotes === undefined ) return output; const { getRichTextValues } = unlock( blockEditorPrivateApis ); const _content = getRichTextValues( _blocks ).join( '' ) || ''; @@ -215,7 +216,8 @@ export function useEntityBlockEditor( kind, name, { id: _id } = {} ) { : []; const currentOrder = footnotes.map( ( fn ) => fn.id ); - if ( currentOrder.join( '' ) === newOrder.join( '' ) ) return; + if ( currentOrder.join( '' ) === newOrder.join( '' ) ) + return output; const newFootnotes = newOrder.map( ( fnId ) => @@ -243,7 +245,7 @@ export function useEntityBlockEditor( kind, name, { id: _id } = {} ) { // When we store rich text values, this would no longer // require a regex. const regex = - /(]+data-fn="([^"]+)"[^>]*>]*>)\d*<\/a><\/sup>/g; + /(]+data-fn="([^"]+)"[^>]*>]*>)[\d*]*<\/a><\/sup>/g; attributes[ key ] = value.replace( regex, diff --git a/packages/rich-text/src/create.js b/packages/rich-text/src/create.js index fa2befc603b7e..45e8c260d171f 100644 --- a/packages/rich-text/src/create.js +++ b/packages/rich-text/src/create.js @@ -427,16 +427,25 @@ function createFromElement( { // When a format type is declared as not editable, replace it with an // object replacement character and preserve the inner HTML. if ( format?.formatType?.contentEditable === false ) { + // To do: remove this migration at some point. + if ( format.type === 'core/footnote' && tagName === 'a' ) { + const anchorAttrs = Object.entries( + format.unregisteredAttributes + ) + .map( ( [ key, value ] ) => `${ key }="${ value }"` ) + .join( ' ' ); + format.tagName = 'sup'; + format.innerHTML = `*`; + format.unregisteredAttributes = {}; + } else { + format.innerHTML = node.innerHTML; + } + delete format.formatType; accumulateSelection( accumulator, node, range, createEmptyValue() ); mergePair( accumulator, { formats: [ , ], - replacements: [ - { - ...format, - innerHTML: node.innerHTML, - }, - ], + replacements: [ format ], text: OBJECT_REPLACEMENT_CHARACTER, } ); continue; From 9b3f1b9fc38c9c94aea87db89daa17fab8cd24d7 Mon Sep 17 00:00:00 2001 From: Ella Date: Fri, 7 Jul 2023 19:16:53 +0200 Subject: [PATCH 4/9] Restore old styles, fix nested attribute queries --- .../block-library/src/footnotes/style.scss | 20 +++++++ packages/block-library/src/style.scss | 1 + packages/core-data/src/entity-provider.js | 60 +++++++++++-------- .../specs/editor/various/footnotes.spec.js | 16 ++--- 4 files changed, 64 insertions(+), 33 deletions(-) create mode 100644 packages/block-library/src/footnotes/style.scss diff --git a/packages/block-library/src/footnotes/style.scss b/packages/block-library/src/footnotes/style.scss new file mode 100644 index 0000000000000..d7aaca76d636b --- /dev/null +++ b/packages/block-library/src/footnotes/style.scss @@ -0,0 +1,20 @@ +// These styles are for backwards compatibility with the old footnotes anchors. +// Can be removed in the future. +.editor-styles-wrapper, +.entry-content { + counter-reset: footnotes; +} + +a[data-fn].fn { + vertical-align: super; + font-size: smaller; + counter-increment: footnotes; + display: inline-block; + text-indent: -9999999px; +} + +a[data-fn].fn::after { + content: "[" counter(footnotes) "]"; + text-indent: 0; + float: left; +} diff --git a/packages/block-library/src/style.scss b/packages/block-library/src/style.scss index c5277995d10da..c4b0a37e6354d 100644 --- a/packages/block-library/src/style.scss +++ b/packages/block-library/src/style.scss @@ -55,5 +55,6 @@ @import "./text-columns/style.scss"; @import "./verse/style.scss"; @import "./video/style.scss"; +@import "./footnotes/style.scss"; @import "common.scss"; diff --git a/packages/core-data/src/entity-provider.js b/packages/core-data/src/entity-provider.js index acc6e65947488..7a51454e1346d 100644 --- a/packages/core-data/src/entity-provider.js +++ b/packages/core-data/src/entity-provider.js @@ -191,7 +191,7 @@ export function useEntityBlockEditor( kind, name, { id: _id } = {} ) { const updateFootnotes = useCallback( ( _blocks ) => { - const output = { blocks: _blocks, meta }; + const output = { blocks: _blocks }; if ( ! meta ) return output; // If meta.footnotes is empty, it means the meta is not registered. if ( meta.footnotes === undefined ) return output; @@ -228,37 +228,47 @@ export function useEntityBlockEditor( kind, name, { id: _id } = {} ) { } ); - function updateBlocksAttributes( __blocks ) { - return __blocks.map( ( block ) => { - const attributes = { ...block.attributes }; - for ( const key in attributes ) { - const value = attributes[ key ]; + function updateAttributes( attributes ) { + attributes = { ...attributes }; - if ( typeof value !== 'string' ) { - continue; - } + for ( const key in attributes ) { + const value = attributes[ key ]; - if ( value.indexOf( 'data-fn' ) === -1 ) { - continue; - } + if ( Array.isArray( value ) ) { + attributes[ key ] = value.map( updateAttributes ); + continue; + } + + if ( typeof value !== 'string' ) { + continue; + } - // When we store rich text values, this would no longer - // require a regex. - const regex = - /(]+data-fn="([^"]+)"[^>]*>]*>)[\d*]*<\/a><\/sup>/g; - - attributes[ key ] = value.replace( - regex, - ( match, opening, fnId ) => { - const index = newOrder.indexOf( fnId ); - return `${ opening }${ index + 1 }`; - } - ); + if ( value.indexOf( 'data-fn' ) === -1 ) { + continue; } + // When we store rich text values, this would no longer + // require a regex. + const regex = + /(]+data-fn="([^"]+)"[^>]*>]*>)[\d*]*<\/a><\/sup>/g; + + attributes[ key ] = value.replace( + regex, + ( match, opening, fnId ) => { + const index = newOrder.indexOf( fnId ); + return `${ opening }${ index + 1 }`; + } + ); + } + + return attributes; + } + + function updateBlocksAttributes( __blocks ) { + return __blocks.map( ( block ) => { return { ...block, - attributes, + attributes: updateAttributes( block.attributes ), innerBlocks: updateBlocksAttributes( block.innerBlocks ), diff --git a/test/e2e/specs/editor/various/footnotes.spec.js b/test/e2e/specs/editor/various/footnotes.spec.js index 1f2fd33f23f73..376962b5c99ba 100644 --- a/test/e2e/specs/editor/various/footnotes.spec.js +++ b/test/e2e/specs/editor/various/footnotes.spec.js @@ -48,7 +48,7 @@ test.describe( 'Footnotes', () => { { name: 'core/paragraph', attributes: { - content: `second paragraph*`, + content: `second paragraph1`, }, }, { @@ -72,13 +72,13 @@ test.describe( 'Footnotes', () => { { name: 'core/paragraph', attributes: { - content: `first paragraph*`, + content: `first paragraph1`, }, }, { name: 'core/paragraph', attributes: { - content: `second paragraph*`, + content: `second paragraph2`, }, }, { @@ -106,13 +106,13 @@ test.describe( 'Footnotes', () => { { name: 'core/paragraph', attributes: { - content: `second paragraph*`, + content: `second paragraph1`, }, }, { name: 'core/paragraph', attributes: { - content: `first paragraph*`, + content: `first paragraph2`, }, }, { @@ -138,7 +138,7 @@ test.describe( 'Footnotes', () => { { name: 'core/paragraph', attributes: { - content: `second paragraph*`, + content: `second paragraph1`, }, }, { @@ -202,7 +202,7 @@ test.describe( 'Footnotes', () => { { name: 'core/list-item', attributes: { - content: `1*`, + content: `11`, }, }, ], @@ -242,7 +242,7 @@ test.describe( 'Footnotes', () => { { cells: [ { - content: `1*`, + content: `11`, tag: 'td', }, { From 78d8c4a7681457b31f7e0984e51c9e4b9c321526 Mon Sep 17 00:00:00 2001 From: Ella Date: Fri, 7 Jul 2023 20:13:10 +0200 Subject: [PATCH 5/9] Fix anchor selection --- packages/rich-text/src/component/use-select-object.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/packages/rich-text/src/component/use-select-object.js b/packages/rich-text/src/component/use-select-object.js index 9ecc7ed9f147c..632c2b26d64f9 100644 --- a/packages/rich-text/src/component/use-select-object.js +++ b/packages/rich-text/src/component/use-select-object.js @@ -25,8 +25,13 @@ export function useSelectObject() { if ( selection.containsNode( target ) ) return; const range = ownerDocument.createRange(); + // If the target in within a non editable element, select the non + // editable element. + const nodeToSelect = target.isContentEditable + ? target + : target.closest( '[contenteditable]' ); - range.selectNode( target ); + range.selectNode( nodeToSelect ); selection.removeAllRanges(); selection.addRange( range ); From 6e544b13aa3368b5fe4be43d7a5eaf65537a6c07 Mon Sep 17 00:00:00 2001 From: Ella Date: Fri, 7 Jul 2023 20:52:58 +0200 Subject: [PATCH 6/9] Migrate markup in entity provider instead --- .../block-library/src/footnotes/style.scss | 3 ++- packages/core-data/src/entity-provider.js | 13 ++++++++++++ packages/rich-text/src/create.js | 21 ++++++------------- packages/rich-text/src/to-tree.js | 2 +- 4 files changed, 22 insertions(+), 17 deletions(-) diff --git a/packages/block-library/src/footnotes/style.scss b/packages/block-library/src/footnotes/style.scss index d7aaca76d636b..aa7ab8b6951dd 100644 --- a/packages/block-library/src/footnotes/style.scss +++ b/packages/block-library/src/footnotes/style.scss @@ -9,7 +9,8 @@ a[data-fn].fn { vertical-align: super; font-size: smaller; counter-increment: footnotes; - display: inline-block; + display: inline-flex; + text-decoration: none; text-indent: -9999999px; } diff --git a/packages/core-data/src/entity-provider.js b/packages/core-data/src/entity-provider.js index 7a51454e1346d..f9aaaef20dde0 100644 --- a/packages/core-data/src/entity-provider.js +++ b/packages/core-data/src/entity-provider.js @@ -259,6 +259,19 @@ export function useEntityBlockEditor( kind, name, { id: _id } = {} ) { return `${ opening }${ index + 1 }`; } ); + + const compatRegex = + /]+data-fn="([^"]+)"[^>]*>\*<\/a>/g; + + attributes[ key ] = value.replace( + compatRegex, + ( match, fnId ) => { + const index = newOrder.indexOf( fnId ); + return `${ + index + 1 + }`; + } + ); } return attributes; diff --git a/packages/rich-text/src/create.js b/packages/rich-text/src/create.js index 45e8c260d171f..fa2befc603b7e 100644 --- a/packages/rich-text/src/create.js +++ b/packages/rich-text/src/create.js @@ -427,25 +427,16 @@ function createFromElement( { // When a format type is declared as not editable, replace it with an // object replacement character and preserve the inner HTML. if ( format?.formatType?.contentEditable === false ) { - // To do: remove this migration at some point. - if ( format.type === 'core/footnote' && tagName === 'a' ) { - const anchorAttrs = Object.entries( - format.unregisteredAttributes - ) - .map( ( [ key, value ] ) => `${ key }="${ value }"` ) - .join( ' ' ); - format.tagName = 'sup'; - format.innerHTML = `*`; - format.unregisteredAttributes = {}; - } else { - format.innerHTML = node.innerHTML; - } - delete format.formatType; accumulateSelection( accumulator, node, range, createEmptyValue() ); mergePair( accumulator, { formats: [ , ], - replacements: [ format ], + replacements: [ + { + ...format, + innerHTML: node.innerHTML, + }, + ], text: OBJECT_REPLACEMENT_CHARACTER, } ); continue; diff --git a/packages/rich-text/src/to-tree.js b/packages/rich-text/src/to-tree.js index 645beb86f3d6b..2608edba51771 100644 --- a/packages/rich-text/src/to-tree.js +++ b/packages/rich-text/src/to-tree.js @@ -108,7 +108,7 @@ function fromFormat( { } return { - type: formatType.tagName === '*' ? tagName : formatType.tagName, + type: tagName, object: formatType.object, attributes: restoreOnAttributes( elementAttributes, isEditableTree ), }; From bbea09438ca6180dca4f9ec91477fe41389e8999 Mon Sep 17 00:00:00 2001 From: Ella Date: Fri, 7 Jul 2023 21:34:16 +0200 Subject: [PATCH 7/9] Fix tests --- packages/rich-text/src/to-dom.js | 8 ++++---- packages/rich-text/src/to-tree.js | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/rich-text/src/to-dom.js b/packages/rich-text/src/to-dom.js index 33df1ca293c90..305eebaf3e4a6 100644 --- a/packages/rich-text/src/to-dom.js +++ b/packages/rich-text/src/to-dom.js @@ -57,14 +57,14 @@ function getNodeByPath( node, path ) { } function append( element, child ) { - if ( typeof child === 'string' ) { - child = element.ownerDocument.createTextNode( child ); - } - if ( child.html !== undefined ) { return ( element.innerHTML += child.html ); } + if ( typeof child === 'string' ) { + child = element.ownerDocument.createTextNode( child ); + } + const { type, attributes } = child; if ( type ) { diff --git a/packages/rich-text/src/to-tree.js b/packages/rich-text/src/to-tree.js index 2608edba51771..8a1c3ff074a55 100644 --- a/packages/rich-text/src/to-tree.js +++ b/packages/rich-text/src/to-tree.js @@ -108,7 +108,7 @@ function fromFormat( { } return { - type: tagName, + type: tagName || formatType.tagName, object: formatType.object, attributes: restoreOnAttributes( elementAttributes, isEditableTree ), }; From a0165e251d4509693158a5077adf1ad8b3f4ff25 Mon Sep 17 00:00:00 2001 From: Ella Date: Fri, 7 Jul 2023 22:29:31 +0200 Subject: [PATCH 8/9] Fix typo --- 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 f9aaaef20dde0..6cc1e021841b4 100644 --- a/packages/core-data/src/entity-provider.js +++ b/packages/core-data/src/entity-provider.js @@ -263,7 +263,7 @@ export function useEntityBlockEditor( kind, name, { id: _id } = {} ) { const compatRegex = /]+data-fn="([^"]+)"[^>]*>\*<\/a>/g; - attributes[ key ] = value.replace( + attributes[ key ] = attributes[ key ].replace( compatRegex, ( match, fnId ) => { const index = newOrder.indexOf( fnId ); From 7e78283e47b61b77b59e0ec25b9fd9033b82fb8a Mon Sep 17 00:00:00 2001 From: Miguel Fonseca <150562+mcsf@users.noreply.github.com> Date: Mon, 10 Jul 2023 10:45:28 +0100 Subject: [PATCH 9/9] Fix comment --- packages/rich-text/src/component/use-select-object.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/rich-text/src/component/use-select-object.js b/packages/rich-text/src/component/use-select-object.js index 632c2b26d64f9..e5db313494f48 100644 --- a/packages/rich-text/src/component/use-select-object.js +++ b/packages/rich-text/src/component/use-select-object.js @@ -25,7 +25,7 @@ export function useSelectObject() { if ( selection.containsNode( target ) ) return; const range = ownerDocument.createRange(); - // If the target in within a non editable element, select the non + // If the target is within a non editable element, select the non // editable element. const nodeToSelect = target.isContentEditable ? target