Closed xpalko closed 1 year ago
Are you loading the WordPress media library? You will need to do that to use that code, otherwise you will need to supply your own media library.
No, I'm not uploading any WP component, I'm literally lost in the wordpress code and I can't find any similar solution to this problem on the net :(
Can you point me in right direction how to upload this component?
A thousand thanks!
You either use the WordPress media library (example https://github.com/Automattic/isolated-block-editor/blob/trunk/examples/wordpress-php/iso-gutenberg.php) or you supply your own media library (https://github.com/Automattic/isolated-block-editor#media-uploader)
@johngodley I don't want to use any Wordpess components, so I want to write a MediaLibrary myself, but somehow I can't create a media Library button and bind a callback to it. I tried
but no success (probably not the whole code, just an idea).
There seems to be a working example here:
Media library replacements are not in the scope of this project so if that doesn't help then you might want to ask your question in Gutenberg itself.
@johngodley Looks good now, thanks!
@johngodley Great, working!
Hi,
I have already solved the localization and pattern inserting problem, but I can't figure out how to integrate the image selection via the Media Library (MediaFrame).
The code logically ends with the non-existence of the wp.media function
node_modules/@wordpress/media-utils/src/components/media-upload/index.js:250
this.frame = wp.media( frameConfig );
I am going through the wordpress codes, gutenbergForDrupal but still stuck.
Some idea? Any examples or demos or anything?
Thanks
Pavel Kaspar