Skip to content

Commit

Permalink
Full Site Editing: Add a Site Logo block (#18811)
Browse files Browse the repository at this point in the history
* Add a site logo block

This uses some filters to non-destructively override the theme mod value
when the experiment is enabled and the site logo setting has a value.

* show a preview while the image uploads

* change the block icon

* show an inline error message in the site logo block

* hide the error when a file is successful

* use mediaflow to replace the image in the logo block

* fix typo in dismissible prop

* update the entity fetching mechanism

* use lightBlockWrapper flag

* fix image resizing

* match the front/back end markup

* fix alignment in the BlockControls

* fix alignment in the BlockControls

* uopdate icon

* simplify code

* Hide the spinner when the site logo has loaded

* Use the real url for the site logo

* remove dead code

* remove unused CSS

* combine the useSelect calls

* pass an empty array to useSelect to stop it firing on every render

* Linter fixes

* add fixtures for the site-logo block

* remove unused code

* fix for linter
  • Loading branch information
scruffian authored Jul 9, 2020
1 parent 3eecf7c commit e8daf61
Show file tree
Hide file tree
Showing 15 changed files with 607 additions and 0 deletions.
1 change: 1 addition & 0 deletions lib/blocks.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ function gutenberg_reregister_core_block_types() {
'query.php' => 'core/query',
'query-loop.php' => 'core/query-loop',
'query-pagination.php' => 'core/query-pagination',
'site-logo.php' => 'core/site-logo',
'site-title.php' => 'core/site-title',
'template-part.php' => 'core/template-part',
)
Expand Down
1 change: 1 addition & 0 deletions packages/block-library/src/editor.scss
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
@import "./search/editor.scss";
@import "./separator/editor.scss";
@import "./shortcode/editor.scss";
@import "./site-logo/editor.scss";
@import "./social-link/editor.scss";
@import "./social-links/editor.scss";
@import "./spacer/editor.scss";
Expand Down
2 changes: 2 additions & 0 deletions packages/block-library/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ import * as socialLink from './social-link';
import * as widgetArea from './widget-area';

// Full Site Editing Blocks
import * as siteLogo from './site-logo';
import * as siteTitle from './site-title';
import * as templatePart from './template-part';
import * as query from './query';
Expand Down Expand Up @@ -199,6 +200,7 @@ export const __experimentalRegisterExperimentalCoreBlocks =
...( __experimentalEnableFullSiteEditing
? [
siteTitle,
siteLogo,
templatePart,
query,
queryLoop,
Expand Down
16 changes: 16 additions & 0 deletions packages/block-library/src/site-logo/block.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"name": "core/site-logo",
"category": "layout",
"attributes": {
"align": {
"type": "string"
},
"width": {
"type": "number"
}
},
"supports": {
"html": false,
"lightBlockWrapper": true
}
}
Loading

0 comments on commit e8daf61

Please sign in to comment.