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

Refactor core blocks to have save and transforms in their own files (part 2) #14899

Merged
merged 2 commits into from
Apr 18, 2019

Conversation

gziolo
Copy link
Member

@gziolo gziolo commented Apr 10, 2019

Description

Part of aligning block library to Block Registration API RFC #13693.

It's all about moving save and transforms to their own file to follow the proposal drafted in RFC. There might be some additional fields moved to their own files if I noticed that they were missed or introduced recently.

Updated blocks:

  • Gallery
  • Heading
  • HTML
  • Image
  • Latest Comments
  • Latest Posts
  • Legacy Widget
  • List

How has this been tested?

npm test
npm run test-e2e

Manually tested whether all blocks load as before.

@gziolo gziolo force-pushed the update/block-library-file-extraction-2 branch from 77879c2 to ad4bc14 Compare April 10, 2019 10:18
@gziolo gziolo added [Feature] Block Directory Related to the Block Directory, a repository of block plugins [Package] Block library /packages/block-library labels Apr 10, 2019
@gziolo gziolo self-assigned this Apr 10, 2019
@gziolo gziolo force-pushed the update/block-library-file-extraction-2 branch from ad4bc14 to 738fcc3 Compare April 14, 2019 13:29
import { defaultColumnsNumber } from './shared';

export default function save( { attributes } ) {
const { images, columns = defaultColumnsNumber( attributes ), imageCrop, linkTo } = attributes;
Copy link
Member

Choose a reason for hiding this comment

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

If this function is only used once, why not place it in this file?

Copy link
Member Author

Choose a reason for hiding this comment

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

defaultColumnsNumber is used also in edit.js and index.js at the moment.

@gziolo gziolo force-pushed the update/block-library-file-extraction-2 branch from 738fcc3 to d2202ff Compare April 18, 2019 10:20
@gziolo gziolo added this to the 5.6 (Gutenberg) milestone Apr 18, 2019
@gziolo gziolo merged commit 8a8fe0d into master Apr 18, 2019
@gziolo gziolo deleted the update/block-library-file-extraction-2 branch April 18, 2019 11:15
daniloercoli added a commit that referenced this pull request Apr 18, 2019
…rnmobile/887-History-stack-is-not-empty-on-a-fresh-start-of-the-editor

* 'master' of https://github.com/WordPress/gutenberg:
  Reset embed mocks on every request, stop request to instagram (#15046)
  Refactor core blocks to have save and transforms in their own files (part 2) (#14899)
  Fix pullquote import (#15036)
  Refactor core blocks to have save and transforms in their own files (part 4) (#14903)
  Refactor core blocks to have save and transforms in their own files (part 3) (#14902)
  Refactor core blocks to have deprecated extracted to their ownf files (p.1) (#14979)
  Test transform from media to embed blocks (#13997)
  If a more recent revision/autosave exists, store its state on editor setup (#7945)
  chore(release): publish
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Block Directory Related to the Block Directory, a repository of block plugins [Package] Block library /packages/block-library
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants