How to override a method of editor.js within custom block?
-
Hello,
I have built an custom gutenberg block and using the URLInput class from wp.editor for searching posts.But in my custom block I need the id instead the url of the selected post.
Ok, my first thought was to override the method selectLink in this way:const { PlainText, URLInput } = wp.editor; URLInput.selectLink = function( post ) { this.props.onChange( post.id, post ); this.setState( { selectedSuggestion: null, showSuggestions: false, } ); }
Unfortunately still the url is taken ??
For testing the rest of my code I have modified the file wp-includes/js/dist/editor.min.js and replaced post.url with post.id within the orginal method and everything works fine.Can anyone give me some hint?
Best regards,
BenThe page I need help with: [log in to see the link]
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘How to override a method of editor.js within custom block?’ is closed to new replies.