Open ikiweb-it opened 1 month ago
wp
is only exported if you are using WP. You will need to bundle your block so it uses the library files directly.
Thanks for the suggestions.
I followed the advice to bundle the Gutenberg libraries directly using @wordpress/blocks and @wordpress/block-editor since I’m not using WordPress.
However, my custom block still doesn't work (custom block doesn't appear in the editor).
Here’s the code I’m working with:
`import { registerBlockType } from '@wordpress/blocks'; import { RichText } from '@wordpress/block-editor';
// Registra un blocco semplice
registerBlockType('myplugin/ikiweb-blocks', {
title: 'IKIweb Blocks',
icon: 'smiley',
category: 'widgets',
edit: (props) => {
const { attributes: { content }, setAttributes } = props;
return (
<RichText
tagName="p"
value={content}
onChange={(newContent) => setAttributes({ content: newContent })}
placeholder="Inserisci testo..."
/>
);
},
save: (props) => {
const { attributes: { content } } = props;
return
I am using Isolated Block Editor and I have manually imported the necessary Gutenberg libraries as suggested.
Could someone help me understand where I am going wrong?
To complete: I repeat that the isolated editor works correctly, I am having serious problems exclusively in extending it with custom blocks. There are many tutorials on the Internet for those who use WP but for those who use the isolated editor there is no documentation!
I'm trying to implement a custom block for the Isolated Block Editor outside of WordPress (I want to use Gutenberg for a web app that is NOT based on WP).
The editor works fine, but I'm unable to create custom blocks. I followed the usual procedure, but the block doesn't work, and I get this console error: window.wp.blocks.registerBlockType is undefined.
It seems "wp.blocks" is not exported, so I'm unsure how to extend it.
Can anyone help?