From 9fdbe74150a7da6d4012dba813c0cb1a53b0e5e8 Mon Sep 17 00:00:00 2001 From: Rafael Galani Date: Tue, 12 Jan 2021 22:34:56 -0300 Subject: [PATCH 1/2] Removing 'annotations' references to the store name --- packages/annotations/src/block/index.js | 12 ++++++------ packages/annotations/src/format/annotation.js | 5 ++++- packages/annotations/src/store/constants.js | 6 ++++++ packages/annotations/src/store/index.js | 2 +- 4 files changed, 17 insertions(+), 8 deletions(-) create mode 100644 packages/annotations/src/store/constants.js diff --git a/packages/annotations/src/block/index.js b/packages/annotations/src/block/index.js index 3a5dee89607ab..7b582037d27cc 100644 --- a/packages/annotations/src/block/index.js +++ b/packages/annotations/src/block/index.js @@ -4,6 +4,10 @@ import { addFilter } from '@wordpress/hooks'; import { withSelect } from '@wordpress/data'; +/** + * Internal dependencies + */ +import { STORE_NAME } from '../store/constants'; /** * Adds annotation className to the block-list-block component. * @@ -13,7 +17,7 @@ import { withSelect } from '@wordpress/data'; const addAnnotationClassName = ( OriginalComponent ) => { return withSelect( ( select, { clientId, className } ) => { const annotations = select( - 'core/annotations' + STORE_NAME ).__experimentalGetAnnotationsForBlock( clientId ); return { @@ -28,8 +32,4 @@ const addAnnotationClassName = ( OriginalComponent ) => { } )( OriginalComponent ); }; -addFilter( - 'editor.BlockListBlock', - 'core/annotations', - addAnnotationClassName -); +addFilter( 'editor.BlockListBlock', STORE_NAME, addAnnotationClassName ); diff --git a/packages/annotations/src/format/annotation.js b/packages/annotations/src/format/annotation.js index f3ea7096a3782..dd0d618f9c678 100644 --- a/packages/annotations/src/format/annotation.js +++ b/packages/annotations/src/format/annotation.js @@ -7,7 +7,10 @@ import { applyFormat, removeFormat } from '@wordpress/rich-text'; const FORMAT_NAME = 'core/annotation'; const ANNOTATION_ATTRIBUTE_PREFIX = 'annotation-text-'; -const STORE_NAME = 'core/annotations'; +/** + * Internal dependencies + */ +import { STORE_NAME } from '../store/constants'; /** * Applies given annotations to the given record. diff --git a/packages/annotations/src/store/constants.js b/packages/annotations/src/store/constants.js new file mode 100644 index 0000000000000..4b8cf0416eb92 --- /dev/null +++ b/packages/annotations/src/store/constants.js @@ -0,0 +1,6 @@ +/** + * The identifier for the data store. + * + * @type {string} + */ +export const STORE_NAME = 'core/annotations'; diff --git a/packages/annotations/src/store/index.js b/packages/annotations/src/store/index.js index 81dee6efd82b4..50c3cab06a72e 100644 --- a/packages/annotations/src/store/index.js +++ b/packages/annotations/src/store/index.js @@ -13,7 +13,7 @@ import * as actions from './actions'; /** * Module Constants */ -const STORE_NAME = 'core/annotations'; +import { STORE_NAME } from './constants'; /** * Store definition for the annotations namespace. From e5629f3065ba22beb3281c7b1ec72f26df8dacc7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Greg=20Zi=C3=B3=C5=82kowski?= Date: Wed, 13 Jan 2021 11:09:56 +0100 Subject: [PATCH 2/2] Revert change in the filter usage --- packages/annotations/src/block/index.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/annotations/src/block/index.js b/packages/annotations/src/block/index.js index 7b582037d27cc..8342eb8e32609 100644 --- a/packages/annotations/src/block/index.js +++ b/packages/annotations/src/block/index.js @@ -32,4 +32,8 @@ const addAnnotationClassName = ( OriginalComponent ) => { } )( OriginalComponent ); }; -addFilter( 'editor.BlockListBlock', STORE_NAME, addAnnotationClassName ); +addFilter( + 'editor.BlockListBlock', + 'core/annotations', + addAnnotationClassName +);