Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add custom block to editor #258

Open
SILITRA-Mihai-Andrei opened this issue Apr 17, 2024 · 2 comments
Open

Add custom block to editor #258

SILITRA-Mihai-Andrei opened this issue Apr 17, 2024 · 2 comments

Comments

@SILITRA-Mihai-Andrei
Copy link

SILITRA-Mihai-Andrei commented Apr 17, 2024

Hi,

I read the docs, but I didn't figured out how to add a custom block to editor, like a simple Google Maps iframe.
Is there a way to do this using Plain Text Editor?

Thank you!

@johngodley
Copy link
Member

There's nothing specific here as its just the same in Gutenberg - you need to load and register the block.

@SILITRA-Mihai-Andrei
Copy link
Author

SILITRA-Mihai-Andrei commented Apr 25, 2024

Thank you for the answer!

The problem is that after I load and register the block, I get the following error in console, saying that the @wordpress/block-edit is not found.

Uncaught (in promise) TypeError: _wordpress_block_editor__WEBPACK_IMPORTED_MODULE_1__ is undefined save save.js:20

save.js
import { useBlockProps } from '@wordpress/block-editor'; export default function save() { return ( <p { ...useBlockProps.save() }> // <=== error here { 'Quote – hello from the saved content!' } </p> ); }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants