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

192 wc editor create two way sync for the post metadata #21398

Draft
wants to merge 12 commits into
base: feature/woo-new-editor
Choose a base branch
from
Prev Previous commit
Next Next commit
Add selector for the social image ids
* possibly the fallbacks for the IDs should be -1 instead
* fix the facebook url fallback to return an empty string
  • Loading branch information
igorschoester committed Apr 25, 2024
commit bfd8efea9b1e89ecc1bb8c760199d7fca2d0caf7
11 changes: 10 additions & 1 deletion packages/js/src/redux/selectors/facebookEditor.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,23 @@ export const getFacebookTitle = state => get( state, "facebookEditor.title", ""
*/
export const getFacebookDescription = state => get( state, "facebookEditor.description", "" );

/**
* Gets the facebook image ID from the state.
*
* @param {Object} state The state.
*
* @returns {?number} Facebook image ID.
*/
export const getFacebookImageId = state => get( state, "facebookEditor.image.id", null );

/**
* Gets the facebook image URL from the state.
*
* @param {Object} state The state.
*
* @returns {String} Facebook image URL.
*/
export const getFacebookImageUrl = state => get( state, "facebookEditor.image.url" );
export const getFacebookImageUrl = state => get( state, "facebookEditor.image.url", "" );

/**
* Gets the facebook image src from the state.
Expand Down
9 changes: 9 additions & 0 deletions packages/js/src/redux/selectors/twitterEditor.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,15 @@ export const getTwitterDescription = state => get( state, "twitterEditor.descrip
*/
export const getTwitterImageUrl = state => get( state, "twitterEditor.image.url", "" );

/**
* Gets the twitter image ID from the state.
*
* @param {Object} state The state.
*
* @returns {?number} Twitter image ID.
*/
export const getTwitterImageId = state => get( state, "twitterEditor.image.id", null );

/**
* Gets the twitter image type from the state.
*
Expand Down