What are blocks in Draftjs?
I go through the project documentation and in many places the word "block" is used interchangeably. For example:
Within the editor, some block types are provided with default CSS styles to limit the amount of basic configuration needed to get engineers up and running with custom editors.
I'm trying to figure out what exactly this block means at a granular level, is it a piece of text or the whole editor of State?
source to share
editorstate
contains selectionstate
and contentstate
. contentstate
consists of blocks
. so a block
is mostly html paragraph with id
, type
and data
. id
is intended to identify a paragraph. type
is a bit tricky, but basically there are two types: atomic
non-atomic, for a non-editable paragraph (image / video / ...) and texts. data
is intended to be used, you want to save something to a block and use it later in any callbacks draft
.
You can read the documents with patience, especially understanding it in examples.
source to share