Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Annotations: Replace store name string with exposed store definition #28156

Merged
merged 2 commits into from
Jan 13, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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