Questions tagged [block-editor]

The Block Editor is the 'new publishing experience' slated for introduction in WordPress 5.0, replacing TinyMCE and other aspects of the default editing experience. Find out more at https://wordpress.org/gutenberg/

Filter by
Sorted by
Tagged with
0
votes
0answers
2 views

Displaying admin notices inside the block editor from rest_after_insert_{$this->post_type} hook

After saving my custom posttype 'openpub-press-item' I use the action 'rest_after_insert_openpub-press-item'. Within this hook I want to create an admin notice and display the notice in the block ...
0
votes
0answers
6 views

Passing settings from Reusable Block to it's children

I have a following situation: I'm using reusable blocks to easily manage data in tables that repeat couple of times around the page. I created a setting with 2 controls: Toggle to say if this element ...
0
votes
0answers
22 views

Change the default font used in Gutenberg

In a site I'm building, I'd like to change the default font set in Gutenberg by default for a Helvetica font stack. I've added the following to my child theme blocks.css file: .edit-post-visual-editor ...
1
vote
1answer
12 views

Option for removing block not appearing in custom gutenberg block

I'm developing a custom gutenberg block. I'm able to get the fields to appear and I'm able to interact with it when adding it to a page. But the menu that allows you to remove the block does not ...
0
votes
0answers
13 views

CSS for the Media + Text block

Looking for help writing CSS to customize the Media + Text block: I would like the header in this block to run the width so that it runs over the top of both the image and the text below it.
0
votes
0answers
12 views

A way to pre-fill block inserted in InnerBlocks

Is there a way (filter or some other means) to set default block content which is being inserted, depending on block context? I.e. I want for media-text block to show default content upon insertion in ...
0
votes
1answer
41 views

How can I check if the first block is an image aligned left or right?

I need to know if the first block is an image and if it's aligned right or left. I printed the $first_block_attrs variable and can see the output is Array ( [align] => center [id] => 450 [...
0
votes
1answer
36 views

Add multiple images to a custom block

I've written the following custom block that allows a user to create a simple slider and add an image that is then wrapped inside a slider item element. I've opted to make this a single block rather ...
0
votes
1answer
36 views

Whitelist a single SVG for use in post_content

I have a block built in Gutenberg - in it I use an Icon element from '@wordpress/components' I use a single arrow to create a dropdown which renders as an SVG. Of course when anyone who is not a super ...
1
vote
0answers
16 views

Add A Tag To A Post Through JavaScript In Gutenberg UI?

My creators have a large variety of tags (500+), and want a "tag grouping" button to click and add sets of related tags through the Gutenberg UI. I could easily add them through PHP hooks, ...
2
votes
1answer
22 views

How does the Gutenberg mobile/tablet/desktop preview work with media queries?

I am building a block which has different layouts for mobile and desktop. As far as I understand CSS media queries, they work when the viewport is resized. The preview feature in Gutenberg doesn't ...
0
votes
0answers
15 views

Including dependencies using @wordpress/dependency-extraction-webpack-plugin

I would like to add include additional script handles to the dependencies in assets.php using @wordpress/dependency-extraction-webpack-plugin. An example for this would be a script that extends ...
0
votes
0answers
10 views

Strings are not preserved when transforming a shortcode to a Block

In the way to provide a Block to my shortcode plugin, I'm trying to produce the code allowing to transform my shortcode to the Block when the plugin user activates the 'Convert to Block' feature to ...
0
votes
1answer
18 views

How to generate block ID for use in post_content JSON data

How does wordpress generate the block ID pointed out in the screen shot below?
0
votes
1answer
11 views

How do i get the link to a block?

It appears that the latest gutenberg editor supports direct links to blocks added to a post as mentioned here. How do I get the block link? I need to extract it programmatically but it's not saved in ...
2
votes
0answers
20 views

How to change the admin/password when using the E2E Test Utils for Gutenberg

I'm trying to set up a test suite for our Gutenberg blocks plugin using the e2e-test-utils. Our environment is a multi-site WP install and I pass the WP_BASE_URL, WP_USERNAME and WP_PASSWORD as ...
1
vote
0answers
12 views

Error defining a gutenberg block in a theme

I've previously (succesfully) made gutenberg block in a plugin, and am now doing so for a theme. However, I'm getting daft errors. I've created a block using npx @wordpress/create-block foldlayout ...
1
vote
0answers
26 views

Gutenberg element: How to usw Rangecontrol with two values to imitate a rangeslider?

For my open-source plugin SimpleTOC I want to add the option to let the user select the range for the TOC: H2 to H6 or H1 to H3 and so on. I remembered this jQuery UI element "Rangeslider": ...
0
votes
0answers
15 views

Block template not being included in pages created in the customizer

I have a block template set up so that my custom block (built using ACF) is automatically added to the top of each new page: function jmc_register_page_template() { $post_type_object = ...
0
votes
0answers
15 views

How to remove buttons from gutenberg toolbar

How do i remove some of the buttons in from a block toolbar in the gutenberg editor? I thought there was a similar api to removing blocks for the paragraph block, something like but there is 0 ...
0
votes
0answers
16 views

Can't access block editor (5.7) + [closed]

The Classic Editor plugin was used to disable Gutenberg on my site, by someone who was helping me. The site was copied to another server and the Classic editor plugin was removed without switching ...
0
votes
1answer
21 views

How to set a Post's default visibility to 'Private' in Gutenberg?

I am trying to set a Post's default visibility to 'Private' when a user first creates the post. They should then have the ability to manually select 'published' from the sidebar dropdown once they are ...
0
votes
0answers
10 views

I cant see Block Editor with v5.7

The Classic Editor plugin was used to disable Gutenberg on my site, by someone who was helping me. The site was copied to another server and the Classic editor plugin was removed without switching ...
0
votes
0answers
23 views

How to add an AJAX Link to the “Featured Image” meta box in Gutenberg? [closed]

I am new to React and Gutenberg. So, I don't have an idea how to do this: I've installed the YoImages Plugin in WP, which inserts a link into the Featured Image Box. A click on the link opens a ...
0
votes
1answer
23 views

Using 2 HTML blocks in Gutenberg to wrap content with div

I'm trying to wrap a Gutenberg block with a div with class x. The structure I'm using looks like this: HTML Block (<div class="x">) Other Block(s) HTML Block (</div>) In the ...
0
votes
1answer
20 views

WordPress Gutenberg core/heading block (wp-block-heading)

I am really not sure how to write the code. How do I get all the headings from the page? To be specific, core/heading. I wanted to make a sidebar so that the user can just jump from one section to ...
0
votes
1answer
16 views

Upgraded to wordpress 5.7 and now I can't select myself as a post author

I started creating a new post and noticed on the right side where it says author, I can select any admin or editor but I can not select myself. What could be the issue?
0
votes
0answers
16 views

Move Inspector Controls from edit method to a child React component

I have a Gutenberg block let's say B1 which renders a React component called <Posts />. B1 has the following attributes which are toggled using the ToggleControl: Display image Display title ...
1
vote
1answer
29 views

Specify exact parent child relationship between two blocks

I have built two blocks for displaying a list of feature cards. Block 1: Feature Cards (the container element) (function (blocks, element, blockEditor) { var el = element.createElement; var ...
0
votes
0answers
24 views

How do I signal to the editor that content needs saving?

Basically I want to enable the Save Draft button manually.. how do I go about this?
0
votes
0answers
17 views

Why does the paragraph block automatically add class?

I want to have this paragraph block: <p>Normal text <span class=""has-h-3-font-size">Big text</span> Normal text</p> However it always converts to: <p class=&...
1
vote
0answers
21 views

How to programmatically add Gallery Block to Existing Post Content

I need to insert a set of images already in the media library to the end of the content of each new post. Instead of inserting the html directly is there a way to add a Gallery block by using the ...
3
votes
1answer
159 views

Why is onChange={ ( content ) => setAttributes( { content } )} now used?

Looking through older tutorials or code for blocks built in 2018/2019 vs the more current blocks, I see two different ways attribute values are set. For example, the "old" way for an ...
0
votes
1answer
61 views

WP Blocks - Gutenberg - <ServerSideRender/> not rendering $content

I've got a WP Block with a <ServerSideRender /> component in the backend. It works fine with the attributes. But it does not return the $content used in the php callback for the frontend. <...
0
votes
1answer
38 views

Converting a Wordpress widget to a block

Is it possible to convert an existing Wordpress widget to a block, without having to write a custom block (javascript)?
1
vote
1answer
16 views

How to remove specific panels in the editor (Gutenberg) when editing a block (via right panel)?

In the editor (Gutenberg) is there a way to disable specific settings in the right panel of a specific block? For example each button in the buttons block has these settings I would like to disable: ...
0
votes
0answers
15 views

unfiltered_html issue with custom guttenberg block on multisite network

i have a custom guttenberg block that creates a grid of icon buttons using the package react-fa-icon-picker, it works fine if the user is a super-admin, but for editors and admins it doesn't work ...
0
votes
0answers
28 views

Can anyone explain why setting a block attributes source to a data-attribute doesn't work?

I created a block with a single attribute, formId. This was configured as follows: attributes: { formId: { type: "string", source: "attribute", selector:...
0
votes
1answer
117 views

How do I register multiple blocks with block.json and register_block_type_from_metadata?

I think I'm missing obvious here, but here's the issue: I used the current @wordpress/create-block to create a block plugin. I'm looking to create three blocks in this plugin, so I setup the first one ...
0
votes
2answers
54 views

Gutenberg block don't save rich text content

I could not get to work. When published the content the attribute innerContent didn't save. Here is what I tried. block.js // Import CSS. import './style.scss'; import './editor.scss'; const { __ } =...
0
votes
0answers
10 views

svg attributes not properly transformed

While svg attributes with dash in the middle are correctly transformed on edit function, they are incorrectly transformed in save. E.g. textAnchor is transformed in text-anchor in edit, but in ...
1
vote
0answers
17 views

component does not render in block save

I use the same custom 'Krug_broj' component both in edit and save functions, but it is rendered only in edit. How can I make it render in save? There are no errors on compile phase nor in the block ...
1
vote
0answers
27 views

How to Get a List of Formats of a Block?

StackExchange Community, I have created a custom format using the Format API. I need a way of retrieving a list of formats being used on the currently selected block. Basically it needs to behave ...
0
votes
0answers
28 views

How to add srcdoc attribute to YouTube oEmbed in Gutenberg oEmbed Block

First of all, let me mention that I have already looked at the following two similar questions: Is it possible to modify the default YouTube embed attributes string? Filter oembeds tags to modify ...
0
votes
0answers
14 views

How to re register core unregistered block ( i.e. core/embed ) in Gutenberg in WordPress

I have a situation that I have default Gutenberg Core/Embed block disabled from one of my mu-plugins. Now I need that block to be re registered from one my normal WordPress plugin but I do not want to ...
0
votes
1answer
14 views

How to hide/remove GhostKit component panel in gutenberg block inspector

is there a way how can I hide/remove components panel? There is one panel created by plugin GhostKit and I need to remove it, because it's not working properly and our users try to use it and it cause ...
0
votes
0answers
20 views

Custom block SelectControl works but equivalent ComboboxControl gives errors - where's my mistake?

I have a SelectControl in a custom block, to set a meta field. It works, but would be better if it were a ComboboxControl, as the list of options is likely to grow, but I get errors when I switch it ...
1
vote
0answers
24 views

How to update block attribute after format is applied?

StackExchange community, I have created a custom format using the rich-text package according to the Format API. We have a need to update the block attribute with the value of the custom format. To ...
0
votes
1answer
26 views

Set default value for “Additional CSS class(es)” for specific block types

For the columns block type, I'd like to add in a default value of wp-block-columns--padded in the "Additional CSS class(es)" field, the idea being that the user could remove or modify the ...
1
vote
0answers
21 views

Prevent Image Pasting in RichText Component

We have several blocks that are using the RichText component. We would like to be able to prevent some if not all of these blocks from allowing pasted images. Core is able to do this with their blocks....

1
2 3 4 5
23