editor-js / list

Advanced List tool for the Editor.js.
MIT License
48 stars 47 forks source link

Nested checklist support #11

Closed mqtik closed 1 week ago

mqtik commented 3 years ago

The list is amazing. It would be really nice to do a module with nested checklists

calumk commented 2 years ago

@talyguryn

I have a proof of concept for this, built on the nested-list addon. Is it worth submitting it as a pull request, or better to release as an unofficial block?

https://user-images.githubusercontent.com/1183991/162813240-482109a5-97f4-42df-87ad-4aa8226f3359.mp4

Calum

talyguryn commented 2 years ago

firstly i think checklist should look the same as editor-js/checklist

may be we need to use nested-list's code as base logic and implement there an updated method for creating an item. also need to add click listener for checkbox and there it is — nested-checklist

calumk commented 2 years ago

I updated the styling (not perfect yet, but getting closer)

I added "None" Style, so we can represent None | Unordered | Ordered

The "Checked" paramerter is currently boolen, with the option of being "null", to allow for three states. This is a bit of an odd way to store, but i did it to reflect the way that remark-gfm imports markdown lists, as for me this is part of a larger project.

I could change it to be represented as an int : -1 = None, 0 = False, 1 = True;

The data is exported as follows

Output data

Field Type Description
style string type of a list: ordered or unordered or none
items Item[] the array of list's items

Object Item:

Field Type Description
content string item's string content
checked Boolean Item is checked : true or false or null
items Item[] the array of list's items
Screenshot 2022-04-12 at 07 40 28

I will upload a test repo soon.

calumk commented 2 years ago

I published here :

@calumk/editorjs-nested-checklist