Skip to content

Commit

Permalink
feat(theworld): more editor config and styles
Browse files Browse the repository at this point in the history
- add styles for separator
- update aligncenter styling to use max-width
- disable editor welcome popup
- default to feature image meta box being open
- remove supports from audio block: align, anchor, spacing
  • Loading branch information
rpeterman-gp committed Jan 30, 2024
1 parent 1dadccd commit 3ac1d2c
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 4 deletions.
13 changes: 9 additions & 4 deletions wp-content/themes/the-world/css/editor.css
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,12 @@ body {
}
.block-editor-block-list__layout.is-root-container
> .wp-block:is(.aligncenter) {
padding-inline: var(--_editor--content--gutter);
max-width: calc(100% - (var(--_editor--content--gutter) * 2));
text-align: left;
}
.block-editor-block-list__layout.is-root-container > .wp-block figcaption {
display: block;
}

.block-editor-block-list__layout.is-root-container > .wp-block figcaption {
display: block;
color: var(--_editor--color--muted);
font-size: 0.9rem;
}
Expand Down Expand Up @@ -108,6 +106,13 @@ body {
margin-inline: auto;
}

.block-editor-block-list__block.wp-block-separator {
padding: 0;
}
.block-editor-block-list__block.wp-block-separator.is-style-wide {
border-width: 2px;
}

@container editor-content (min-width: 960px) {
.wp-block-post-content {
--_editor--content--width: 960px;
Expand Down
38 changes: 38 additions & 0 deletions wp-content/themes/the-world/js/blockembed.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,16 @@
wp.domReady(function () {
//Disable Gutenberg Tour Guide popup.
wp.data.select("core/edit-post").isFeatureActive("welcomeGuide") &&
wp.data.dispatch("core/edit-post").toggleFeature("welcomeGuide");

// Make Featured Image opened initially.
if (!wp.data.select("core/edit-post").isEditorPanelOpened("featured-image")) {
wp.data
.dispatch("core/edit-post")
.toggleEditorPanelOpened("featured-image");
}

// Allow only certain embed variants.
const allowedEmbedBlocks = ["twitter", "youtube", "vimeo"];

wp.blocks.getBlockVariations("core/embed").forEach(function (blockVariation) {
Expand All @@ -7,9 +19,35 @@ wp.domReady(function () {
}
});

// Remove image style options.
wp.blocks.unregisterBlockStyle("core/image", ["default", "rounded"]);

// Remove text format options.
wp.richText.unregisterFormatType("core/footnote");
wp.richText.unregisterFormatType("core/text-color");
wp.richText.unregisterFormatType("core/image");
});

// Adjust block settings not configurable in `theme.json`.
wp.hooks.addFilter(
"blocks.registerBlockType",
"the-world/the-world/log-block-settings",
(settings, name) => {
switch (name) {
case "core/audio":
// Disable supports for audio block.
return {
...settings,
supports: {
align: false,
anchor: false,
spacing: {},
},
};

default:
return settings;
}
},
100
);

0 comments on commit 3ac1d2c

Please sign in to comment.