Comments (2)
I implemented something similar in the extended core/post-template block for my theme, but due to insufficient documentation, this plugin works poorly. I even lost the place in the documentation where the issue of creating a custom layout for the Post Template was covered, if anyone knows, please tell me. There was something there: about the attribute
layout: { default: { type: 'custom' } }
Here my results, plugin allow me to set Gap, also it allow to set Columns count for every breakpoint, like Mobile, Tablet or Desktop.
from gutenberg.
Just improved my block plugin a bit to be able to set the spacing between rows and columns independently. But I still need a suggestion on how to set my own attribute layout type, here is my implementation:
<ToolbarButton
icon={icon}
label={__(
'Responsive grid view',
'responsive-post-template'
)}
isActive={
layout &&
layout.default &&
layout.default.type === 'custom' &&
layout.type !== 'grid' &&
layout.type !== 'default'
}
onClick={() => {
setAttributes({
layout: { default: { type: 'custom' } },
});
}}
/>
With this code I still get the default layout classnames that come with WordPress like "is-layout-flow wp-block-post-template-is-layout-flow" etc and I found workaround to filter them using PHP filter on frontend. This solution is not perfect, and I would like to improve it.
from gutenberg.
Related Issues (20)
- Latest Post block: Post titles can overlap when the grid view is selected HOT 2
- getEntityRecords returns empty list for custom endpoint HOT 16
- Add Bluesky embed block variation HOT 1
- Password protected form: Add `wp-element-button` class to the submit input HOT 1
- Navigation block: browse all blocks auto closes without inserting anything HOT 4
- Distraction free: top toolbar broken in 18.2 HOT 2
- Refactor Interactivity Router API to TypeScript HOT 1
- Block Editor: Unable to paste text into text field inside block HOT 7
- Several Typo Correction in Inline doc
- Patterns: Unable to insert pattern in nested location
- Editor preferences are saved in database every time the Settings sidebar opens/closes HOT 1
- Nesting Social Icons under Navigation results in invalid HTML
- Block list appender no longer reachable with the keyboard from the settings panel HOT 10
- Inserter menu items are vertically centered in panel HOT 2
- Components: FormTokenField label renders even when no defined
- block-navigation responsive-container zero clamp calculation HOT 2
- Block Bindings: Add bindings panel in the block inspector controls HOT 11
- Block Bindings: Notify on save when users edit the value of a connected custom field instead of the post content
- Block Bindings: Add indicator that an attribute is connected instead of hiding the controls
- Box Control range slider doesn't set a unit initially HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from gutenberg.