-
Notifications
You must be signed in to change notification settings - Fork 385
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop' of github.com:ampproject/amp-wp into update/gu…
…ide-lighter-media * 'develop' of github.com:ampproject/amp-wp: Update dependency css-loader to v3 (#2563) Consistently import components from block-editor package (#2561) Refactor AMP modes (#2550) Update dependency webpack-cli to v3.3.4 (#2558)
- Loading branch information
Showing
41 changed files
with
1,092 additions
and
486 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,41 +1,65 @@ | ||
/** | ||
* Returns the block validation errors for a given clientId. | ||
* Returns whether the current theme has AMP support. | ||
* | ||
* @param {Object} state Editor state. | ||
* @param {string} clientId Block client ID. | ||
* @param {Object} state Editor state. | ||
* | ||
* @return {Array} Block validation errors. | ||
* @return {boolean} Whether the current theme has AMP support. | ||
*/ | ||
export function getBlockValidationErrors( state, clientId ) { | ||
return state.errorsByClientId[ clientId ] || []; | ||
export function hasThemeSupport( state ) { | ||
return Boolean( state.hasThemeSupport ); | ||
} | ||
|
||
/** | ||
* Returns whether the current theme has AMP support. | ||
* Returns whether the current site is in Standard mode (AMP-first) as opposed to Transitional (paired). | ||
* | ||
* @param {Object} state Editor state. | ||
* | ||
* @return {boolean} Whether the current theme has AMP support. | ||
* @return {boolean} Whether the current site is AMP-first. | ||
*/ | ||
export function hasThemeSupport( state ) { | ||
return Boolean( state.hasThemeSupport ); | ||
export function isStandardMode( state ) { | ||
return Boolean( state.isStandardMode ); | ||
} | ||
|
||
/** | ||
* Returns whether the website experience is enabled. | ||
* | ||
* @param {Object} state Editor state. | ||
* | ||
* @return {boolean} Whether website experienced enabled. | ||
*/ | ||
export function isWebsiteEnabled( state ) { | ||
return Boolean( state.isWebsiteEnabled ); | ||
} | ||
|
||
/** | ||
* Returns whether the current site uses native AMP. | ||
* Returns whether the stories experience is enabled. | ||
* | ||
* @param {Object} state Editor state. | ||
* | ||
* @return {boolean} Whether the current site uses native AMP. | ||
* @return {boolean} Whether stories experienced enabled. | ||
*/ | ||
export function isNativeAMP( state ) { | ||
return Boolean( state.isNativeAMP ); | ||
export function isStoriesEnabled( state ) { | ||
return Boolean( state.isStoriesEnabled ); | ||
} | ||
|
||
/** | ||
* Returns the default AMP status. | ||
* | ||
* @param {Object} state Editor state. | ||
* | ||
* @return {string} The default AMP status. | ||
*/ | ||
export function getDefaultStatus( state ) { | ||
return state.defaultStatus; | ||
} | ||
|
||
/** | ||
* Returns the possible AMP statuses. | ||
* | ||
* @param {Object} state Editor state. | ||
* | ||
* @return {string[]} The possible AMP statuses, 'enabled' and 'disabled'. | ||
*/ | ||
export function getPossibleStatuses( state ) { | ||
return state.possibleStatuses; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.