GitbookIO/slate-edit-list

Enforce that items contain only blocks (no text nodes)

Soreine opened this issue · 0 comments

It is simpler that list items always contain blocks, and no direct text nodes. This should be enforced as a schema rule, and documented as a requirement to use the plugin.

Here is a minimal list:

nodes:
    - kind: block
      type: ul_list
      nodes:
          - kind: block
            type: list_item
            nodes:
              - kind: block
                type: paragraph
                nodes:
                  - kind: text
                    text: Hello World

The default block type should be provided to the plugin (default to paragraph).

Here is an example of how a sublist is made

nodes:
  - kind: block
    type: ol_list
    nodes:
      - kind: block
        type: list_item
        nodes:
          - kind: block
            type: paragraph
            nodes:
              - kind: text
                text: Item 1
          - kind: block
            type: ol_list
            nodes:
              - kind: block
                type: list_item
                nodes:
                  - kind: block
                    type: paragraph
                    nodes:
                      - kind: text
                        text: Item 1.1
              - kind: block
                type: list_item
                nodes:
                  - kind: block
                    type: paragraph
                    nodes:
                      - kind: text
                        text: Item 1.2