Skip to content

Conversation

@ZebulanStanphill
Copy link
Member

@ZebulanStanphill ZebulanStanphill commented Sep 6, 2018

Description

This PR changes the media placeholders of the following blocks to use the new block icons:

  • Audio
  • Cover Image
  • File
  • Gallery
  • Image
  • Video

This PR changes the placeholders to source the icons from the same place as the main block property, meaning that future icon updates will only have to be applied to one place rather than two.

Closes #9642.

Screenshot

image

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Out of curiosity, did you try leaving this in the attributes and importing like this:

import { settings } from './index.js';

const {
  icon,
} = settings;

Alternately I think you could do something like export const icon = settings.icon;.

Definitely not 100% necessary but it feels a little cleaner to keep the icon in the settings object.

Copy link
Contributor

@caxco93 caxco93 Sep 6, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds like the best way to me as settings is already being exported

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@chrisvanpatten I was trying to follow the pattern that other blocks do for defining stuff outside of the settings object, e.g. the supports and schema objects in the Paragraph index.js.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But that's a good point, @caxco93. In the Paragraph case, the things being defined outside of the settings object are not being exported. I think I will go ahead and change it according to @chrisvanpatten's suggestion.

@ZebulanStanphill
Copy link
Member Author

Addressed feedback and fixed tests.

@ZebulanStanphill
Copy link
Member Author

@chrisvanpatten It looks like that first method you suggested does not work... I think I will try the second method now.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ZebulanStanphill I think you missed flipping this one back :)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@chrisvanpatten No, that was intentional, because since cover-image does not have a separate edit.js, I was not sure if I could export settings.icon and then reference it from within the definition of settings itself. Actually, cover-image was part of the reason why I did my initial approach.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I considered splitting the edit function of cover-image into a separate file, but I decided that was out-of-scope for this PR. What do you think I should do?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ZebulanStanphill Ah, I see now. I think it makes sense to split it out but it might be worth another reviewer jumping in to give this a sanity check before going too far down that path.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@chrisvanpatten This PR has some merge conflicts currently. I have created a PR to split the Cover Image edit function into its file: #10582. Once that is merged, I'll rebase or replace this PR.

@ZebulanStanphill
Copy link
Member Author

Rebased and squashed into 2 commits (to show the difference between my initial method and the current one). I would like some more opinions on which approach is best.

@ZebulanStanphill
Copy link
Member Author

This PR has been replaced by #11788.

@ZebulanStanphill ZebulanStanphill deleted the update/use-new-icons-in-media-placeholders branch November 13, 2018 01:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants