-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Add reusable blocks #2659
Add reusable blocks #2659
Commits on Oct 12, 2017
-
Add 'core/reusable-block' block type
This lets us parse reusable blocks from the HTML, and not much else.
Configuration menu - View commit details
-
Copy full SHA for 6e3431f - Browse repository at this point
Copy the full SHA 6e3431fView commit details -
Stub out Reusable Block UI, implement fetching and local editing
Stubs out some of the editor UI so that we have a base to work from. Also adds the reducers and effects necessary to support fetching and local editing.
Configuration menu - View commit details
-
Copy full SHA for 6721b27 - Browse repository at this point
Copy the full SHA 6721b27View commit details -
Implement reusable block persisting
Adds an effect that responds to the PERSIST_REUSABLE_BLOCK action, and some UI for the confirmation dialog that appears when a reusable block is first modified.
Configuration menu - View commit details
-
Copy full SHA for 7f6dd91 - Browse repository at this point
Copy the full SHA 7f6dd91View commit details -
Implement ATTACH_REUSABLE_BLOCK
Adds an effect which lets us turn reusable blocks into regular blocks.
Configuration menu - View commit details
-
Copy full SHA for ade0f06 - Browse repository at this point
Copy the full SHA ade0f06View commit details -
Implement DETACH_REUSABLE_BLOCK
Adds an effect which lets us turn regular blocks into reusable blocks, and stubs out some Advanced Options UI which triggers this effect.
Configuration menu - View commit details
-
Copy full SHA for 16588b8 - Browse repository at this point
Copy the full SHA 16588b8View commit details -
Fetch and persist reusable blocks using the WP API Backbone client
Adds the `gutenberg/v1/` endpoint to the WPI API Backbone client so that we can use `wp.api.models.ReusableBlocks` to fetch and save reusable blocks instead of our own (ugly) implementation.
Configuration menu - View commit details
-
Copy full SHA for e9b4701 - Browse repository at this point
Copy the full SHA e9b4701View commit details -
Clean up reusable block update actions
Collapse SET_REUSABLE_BLOCK_NAME and UDPATE_REUSABLE_BLOCK_ATTRIBUTES into one UPDATE_REUSABLE_BLOCK action. This makes things read a little nicer.
Configuration menu - View commit details
-
Copy full SHA for 23162e3 - Browse repository at this point
Copy the full SHA 23162e3View commit details -
Rename persistReusableBlock -> saveReusableBlock
'persist' is a little verbose, and we already use the term 'save' when saving the Backbone model.
Configuration menu - View commit details
-
Copy full SHA for fee015f - Browse repository at this point
Copy the full SHA fee015fView commit details -
Prefer 'id' instead of 'ref' when dealing with reusable blocks
This keeps our variables names in sync with how things look in the API, and disambiguates between the ID stored in the post and the ID stored in redux.
Configuration menu - View commit details
-
Copy full SHA for 51f8a38 - Browse repository at this point
Copy the full SHA 51f8a38View commit details -
Renames ATTACH_REUSABLE_BLOCK -> ATTACH_BLOCK and DETACH_REUSABLE_BLOCK -> DETACH_BLOCK. This makes it clearer that these actions take block UIDs, not reusable block IDs.
Configuration menu - View commit details
-
Copy full SHA for d5c0c49 - Browse repository at this point
Copy the full SHA d5c0c49View commit details -
Configuration menu - View commit details
-
Copy full SHA for a6cd1dd - Browse repository at this point
Copy the full SHA a6cd1ddView commit details -
Write tests for reusable block client API
Write tests for reuasble block actions, selectors, reducer and factory methods.
Configuration menu - View commit details
-
Copy full SHA for 80ee61f - Browse repository at this point
Copy the full SHA 80ee61fView commit details -
Configuration menu - View commit details
-
Copy full SHA for 9fdcb50 - Browse repository at this point
Copy the full SHA 9fdcb50View commit details -
Style 'Convert to Reusable Block' button
Introduce a button new inspector control and use it for the 'Convert to Reusable Block' and 'Detach from Reusable Block' buttons.
Configuration menu - View commit details
-
Copy full SHA for 67d0ec6 - Browse repository at this point
Copy the full SHA 67d0ec6View commit details -
Style reusable block dialogs and display them modally
- Introduces a new Modal component, which presents its children modally - Changes ReusableBlockEdit to present NewReusableBlockDialog and SaveConfirmationDialog modally - Styles the reusable block dialogs to look like the design
Configuration menu - View commit details
-
Copy full SHA for 2eb4f96 - Browse repository at this point
Copy the full SHA 2eb4f96View commit details -
Add reusable blocks to the inserter
Show reusable blocks that are available in the redux state tree in the inserter UI.
Configuration menu - View commit details
-
Copy full SHA for 6e5876e - Browse repository at this point
Copy the full SHA 6e5876eView commit details -
Configuration menu - View commit details
-
Copy full SHA for 256ddbb - Browse repository at this point
Copy the full SHA 256ddbbView commit details -
Configuration menu - View commit details
-
Copy full SHA for 2f89fea - Browse repository at this point
Copy the full SHA 2f89feaView commit details -
Configuration menu - View commit details
-
Copy full SHA for 2822984 - Browse repository at this point
Copy the full SHA 2822984View commit details -
Implement
render_callback
for reusable blocksAllow reusable blocks to be rendered by the server for posts and pages by registering them in PHP and defininig a `render_callback`.
Configuration menu - View commit details
-
Copy full SHA for 38887bb - Browse repository at this point
Copy the full SHA 38887bbView commit details -
Replace reusable block modals with inline edit panel
Replaces SaveConfirmationDialog, NewReusableBlockDialog, and Modal with ReusableBlockEditPanel. This panel sits at the bottom of a reusable block when selected and allows the user to explicitly edit and save the reusable block. The end result is a less ambiguous and more explicit UX.
Configuration menu - View commit details
-
Copy full SHA for 735e2c0 - Browse repository at this point
Copy the full SHA 735e2c0View commit details -
Give the
<button>
in<ButtonControl>
anid
This makes the `<label>` in the control behave correctly. According to the spec, `<button>` is a labelable element: https://developer.mozilla.org/en-US/docs/Web/Guide/HTML/Content_categories#Form_labelable
Configuration menu - View commit details
-
Copy full SHA for 3d3affb - Browse repository at this point
Copy the full SHA 3d3affbView commit details -
Use an explicit
isPrivate
flag to hide block types from the inserterWe don't wish to show the 'core/reusable-block' block type in the inserter. We were doing this by taking advantage of the fact that the inserter would ignore block types with a null category. This change makes this behaviour more explicit.
Configuration menu - View commit details
-
Copy full SHA for 4448ea2 - Browse repository at this point
Copy the full SHA 4448ea2View commit details -
Configuration menu - View commit details
-
Copy full SHA for f587eed - Browse repository at this point
Copy the full SHA f587eedView commit details -
DRY up
do_blocks
andgutenberg_render_block_core_reusable_block
Refactor the common logic in `do_blocks` and `gutenberg_render_block_core_reusable_block` into a new `gutenberg_render_block` function.
Configuration menu - View commit details
-
Copy full SHA for 4b7f597 - Browse repository at this point
Copy the full SHA 4b7f597View commit details -
Combine FETCH_REUSABLE_BLOCK and FETCH_REUSABLE_BLOCKS
Simplify fetching logic a little by DRYing up these two mostly-similar effects.
Configuration menu - View commit details
-
Copy full SHA for 9f0afb9 - Browse repository at this point
Copy the full SHA 9f0afb9View commit details -
Remove ADD_REUSABLE_BLOCKS action, add ability to track saving
Collapses the ADD_REUSABLE_BLOCKS action into UPDATE_REUSABLE_BLOCK and FETCH_REUSABLE_BLOCKS_SUCCESS. Also makes it so that the Redux store keeps track of whether or not a reusable block is being saved or has had an error while saving.
Configuration menu - View commit details
-
Copy full SHA for baf43b3 - Browse repository at this point
Copy the full SHA baf43b3View commit details -
Add reusable block 'saving' and 'save failure' UI
Adds a spinner that indicates whether or not a reusable block is saving, and some UI that allows the user to retry the save if it fails.
Configuration menu - View commit details
-
Copy full SHA for 6cf3950 - Browse repository at this point
Copy the full SHA 6cf3950View commit details -
Rename {ATTACH,DETACH}_BLOCK to MAKE_BLOCK_{STATIC,REUSABLE}
Avoid ambiguity around what 'attach' and 'detach' means by avoiding the its use in code alltogether.
Configuration menu - View commit details
-
Copy full SHA for cd03ad3 - Browse repository at this point
Copy the full SHA cd03ad3View commit details -
Improve tests for actions, selectors and effects
Slightly clean up the tests for reusable block actions and selectors, and change our effects tests to reduce our dependency on mocking selectors by taking advantage of the fact that MAKE_BLOCK_STATIC and MAKE_BLOCK_REUSABLE are relatively pure functions.
Configuration menu - View commit details
-
Copy full SHA for 49ec18c - Browse repository at this point
Copy the full SHA 49ec18cView commit details -
Configuration menu - View commit details
-
Copy full SHA for fcdf318 - Browse repository at this point
Copy the full SHA fcdf318View commit details -
Remove unnecessary {}s, split up long line, and collapse SCSS selectors into one line.
Configuration menu - View commit details
-
Copy full SHA for e8c33c1 - Browse repository at this point
Copy the full SHA e8c33c1View commit details -
Clarify how we're using pickBy
Add a comment which clarifies this weird way we're using _.pickBy.
Configuration menu - View commit details
-
Copy full SHA for 69e5705 - Browse repository at this point
Copy the full SHA 69e5705View commit details -
Call
blockType.save
, notblockType.create
Fix this typo. There's no such thing as `blockType.create`!
Configuration menu - View commit details
-
Copy full SHA for 7fdb1d8 - Browse repository at this point
Copy the full SHA 7fdb1d8View commit details -
Use convertBlockTo{Static,Reusable} instead of makeBlock{Static,Reusa…
…ble} It's a clearer action name since 'convert' is a less ambigious verb.
Configuration menu - View commit details
-
Copy full SHA for 003c900 - Browse repository at this point
Copy the full SHA 003c900View commit details -
Configuration menu - View commit details
-
Copy full SHA for 1254e97 - Browse repository at this point
Copy the full SHA 1254e97View commit details -
Configuration menu - View commit details
-
Copy full SHA for 6faec68 - Browse repository at this point
Copy the full SHA 6faec68View commit details -
Use animation and notices to indicate the reusable block save state
- Makes the 'Save' button animate when a reusable block is saving - Makes a 'Reusable block updated' notice appear when the save is successful - Makes a 'Reusable block update failed' notice appear when the save fails
Configuration menu - View commit details
-
Copy full SHA for 5637827 - Browse repository at this point
Copy the full SHA 5637827View commit details