-
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.
* Always allow switching from Transitional to Native on sites that are defined with `add_theme_support('amp', ['paired' => true])`. Fixes #2312. * Restore suppression of validation error warnings appearing in Reader mode. Fixes #2311 * Add functionality for users to chose AMP + Stories, AMP-only, Stories-only. Fixes #2470 * Phase out “Native” terminology in favor of “AMP-first”. Fixes #2507.
- Loading branch information
1 parent
875c6ee
commit bbecffc
Showing
32 changed files
with
1,041 additions
and
447 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.