Skip to content

Commit

Permalink
Annotations: Replace store name string with exposed store definition (#…
Browse files Browse the repository at this point in the history
…28156)

* Removing 'annotations' references to the store name

* Revert change in the filter usage

Co-authored-by: Greg Ziółkowski <grzegorz@gziolo.pl>
  • Loading branch information
rafaelgallani and gziolo authored Jan 13, 2021
1 parent 2408100 commit 7a927ac
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 3 deletions.
6 changes: 5 additions & 1 deletion packages/annotations/src/block/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*
Expand All @@ -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 {
Expand Down
5 changes: 4 additions & 1 deletion packages/annotations/src/format/annotation.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
6 changes: 6 additions & 0 deletions packages/annotations/src/store/constants.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
/**
* The identifier for the data store.
*
* @type {string}
*/
export const STORE_NAME = 'core/annotations';
2 changes: 1 addition & 1 deletion packages/annotations/src/store/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 7a927ac

Please sign in to comment.