WordPress / gutenberg

The Block Editor project for WordPress and beyond. Plugin is available from the official repository.
https://wordpress.org/gutenberg/
Other
10.36k stars 4.13k forks source link

[Documentation] Edit function properties #23283

Open zzap opened 4 years ago

zzap commented 4 years ago

Documentation for edit() function list only 4 properties: attributes, className, isSelected and setAttributes.

Console-logging all properties we find following:

attributes: {} 
className: ""
clientId: ""
insertBlocksAfter: ƒ ()
isSelected: false
isSelectionEnabled: true
mergeBlocks: ƒ ()
name: ""
onReplace: ƒ ()
setAttributes: ƒ ()
toggleSelection: ƒ ()

I'd be happy to create pull request for those but my knowledge for their usage is very limited. If someone can provide code examples and explanations that would be of huge help for updating docs.

gziolo commented 4 years ago

@youknowriad or @ellatrix, I’m surprised seeing those additional props, should they be documented?

@zzap where exactly did you run debugging method?

youknowriad commented 4 years ago

Most of them are for advanced use-cases but yeah worth documenting.

zzap commented 4 years ago

@zzap where exactly did you run debugging method?

I ran console.log(props) inside edit function for custom block.

navxio commented 3 years ago

is props.toggleSelection supposed to toggle props.isSelected (and cause the entailing effects)? I've tried issuing it but to no avail..