Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release/2.0 #104

Merged
merged 211 commits into from
Nov 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
211 commits
Select commit Hold shift + click to select a range
16d85dd
implemented dev model
e11sy Aug 1, 2024
88eb6c6
added ol and ul list renderer classes
e11sy Aug 1, 2024
d057bca
patched types
e11sy Aug 1, 2024
da80ff6
added styles for checklist
e11sy Aug 1, 2024
2afda74
pathced style names
e11sy Aug 1, 2024
e7a585e
added checklist renderer
e11sy Aug 1, 2024
7cbd0d7
separated list renderer classes
e11sy Aug 1, 2024
7452185
types separated
e11sy Aug 1, 2024
d949cbc
added tabulator class
e11sy Aug 1, 2024
df88c86
added new index
e11sy Aug 2, 2024
d46b8dd
list types switch implemented
e11sy Aug 2, 2024
5bae2c0
content is editable
e11sy Aug 2, 2024
dd576b9
ordered list item numbering improved
e11sy Aug 3, 2024
0da5fd1
children styles updated
e11sy Aug 3, 2024
3227a52
fixed saving and content format
e11sy Aug 3, 2024
d484ff8
refactored checkbox styles
e11sy Aug 3, 2024
e04e8df
now tool saving data with meta field
e11sy Aug 3, 2024
a180404
comments improved
e11sy Aug 3, 2024
3d1ef9d
get rid of ex.ts
e11sy Aug 3, 2024
9064c1b
comments improved in types
e11sy Aug 3, 2024
d9110c9
removed unneded for dev mode tools from index
e11sy Aug 3, 2024
f899714
for ordered and unordered list item meta would be {}
e11sy Aug 3, 2024
fdac5a2
added private class properties
e11sy Aug 3, 2024
78d8f32
moved click event delegation from `toggleCheckbox()`
e11sy Aug 3, 2024
8de6984
separated types
e11sy Aug 3, 2024
b4cf738
added `currentLevel` property for ListTabulator
e11sy Aug 3, 2024
91b7cfa
minor fix
e11sy Aug 3, 2024
cf25166
separated css styles for different classes
e11sy Aug 3, 2024
717f079
comments improved
e11sy Aug 3, 2024
99eebd6
files renaming
e11sy Aug 3, 2024
a9e2507
files renaming
e11sy Aug 3, 2024
5903be0
list css classes interface now extended
e11sy Aug 3, 2024
7314e07
style fix
e11sy Aug 3, 2024
348da48
removed itemBody
e11sy Aug 5, 2024
1a012b2
changed addTab behaviour
e11sy Aug 6, 2024
20e6073
file renaming
e11sy Aug 7, 2024
e2a8d6f
file renaming
e11sy Aug 7, 2024
a9abfa3
file renaming
e11sy Aug 7, 2024
c60e9fe
renaming
e11sy Aug 7, 2024
ac07f38
renaming
e11sy Aug 7, 2024
3bb7736
List renderer now interface
e11sy Aug 7, 2024
3d87c88
filled list renderer interface
e11sy Aug 7, 2024
d38e7b2
comment improved
e11sy Aug 7, 2024
d14575d
Merge pull request #76 from editor-js/List-2.0
e11sy Aug 7, 2024
22922cb
refactored tab and shift+tab nehaviour
e11sy Aug 9, 2024
faba066
tab fix
e11sy Aug 9, 2024
1083cf1
now list could be splitted in the middle on enter
e11sy Aug 9, 2024
787d03e
comments improved
e11sy Aug 9, 2024
d0d1852
split corner case fixed
e11sy Aug 9, 2024
8dd7b56
fix enter behaviour
e11sy Aug 12, 2024
01e4788
replace some of the utils with @editorjs/utils packages
e11sy Aug 26, 2024
128655a
refactored item merging behaviour
e11sy Aug 26, 2024
d38c568
clean up
e11sy Aug 26, 2024
158bcd2
blocks merge implemented
e11sy Sep 9, 2024
8977973
now nested list passes initialized renderer to the tabulator
e11sy Sep 9, 2024
0d65f0a
moved to types
e11sy Sep 9, 2024
9549e90
merge method added
e11sy Sep 11, 2024
a2a9090
refactor merge lists
e11sy Sep 17, 2024
96f07a6
renaming and comments improvements
e11sy Sep 17, 2024
b71cef8
now new instance of tabulator is created on convertion
e11sy Sep 17, 2024
1267fa3
codestyle
e11sy Sep 17, 2024
b64470a
renaming
e11sy Sep 17, 2024
358ac9e
removed currentLevel from tabulator
e11sy Sep 18, 2024
8d2d555
fix paragraph insertion bug
e11sy Sep 23, 2024
227644e
improved responsibilities of enterpressed and backspace
e11sy Sep 25, 2024
4e76dc7
codestyle improvement
e11sy Sep 25, 2024
f72e54f
suggestions
e11sy Sep 25, 2024
d0518f0
caret alias added
e11sy Sep 25, 2024
01efb29
comments improved
e11sy Sep 25, 2024
2e43690
typo fixed
e11sy Sep 25, 2024
b6249b9
added utils for code readability
e11sy Sep 28, 2024
6de4e14
fixed merge item logic
e11sy Sep 28, 2024
740ceef
build fix and comments improved
e11sy Sep 28, 2024
eee722a
get child items could not return null now
e11sy Sep 28, 2024
a9009ee
changed getSiblings util
e11sy Sep 28, 2024
16abb05
fix bug
e11sy Sep 28, 2024
11dd1b6
Merge pull request #79 from editor-js/keydown-refactor
e11sy Sep 28, 2024
0e71f28
remove .eslintrc
e11sy Sep 28, 2024
1dc7608
update dependencies
e11sy Oct 2, 2024
391546c
fixed some of ts eslint errors
e11sy Oct 3, 2024
c3060e0
update jsdoc descriptions
e11sy Oct 4, 2024
a9964f9
remove unwanted comments
e11sy Oct 4, 2024
288e7a4
eslint fixes of src index and utils
e11sy Oct 4, 2024
594f89e
Merge pull request #83 from editor-js/eslint-setup
e11sy Oct 5, 2024
f86d78a
change method modifier
e11sy Oct 5, 2024
fb82c54
Merge pull request #84 from editor-js/eslint-fixes
e11sy Oct 5, 2024
6e616ac
list tabulator eslint fixes
e11sy Oct 5, 2024
6b5691c
esliing fixes for list renderers
e11sy Oct 5, 2024
8cd2047
eslint fix for the listRenderer class
e11sy Oct 5, 2024
613a195
setted up javascript linter and fixed eslint in js files
e11sy Oct 5, 2024
83d0d7b
comments improved
e11sy Oct 5, 2024
dc00453
postcss config update
e11sy Oct 5, 2024
e8c74c5
change save-restore to focusItem method
e11sy Oct 5, 2024
32da70d
fix in merge method
e11sy Oct 5, 2024
ff82af9
remove all restore methods
e11sy Oct 5, 2024
b72272a
remove unwanted comments
e11sy Oct 7, 2024
eaab334
Merge pull request #85 from editor-js/eslint-fixes
e11sy Oct 7, 2024
7f5010b
moved from focus method to focusItem
e11sy Oct 9, 2024
4462318
update dependencies without installing
e11sy Oct 9, 2024
0988d88
build fix
e11sy Oct 9, 2024
2ed8149
fix backspace bug
e11sy Oct 9, 2024
06bdbad
fix merging
e11sy Oct 9, 2024
af4e4d3
update caret version
e11sy Oct 9, 2024
73dead0
Merge pull request #86 from editor-js/safari-restore-caret-bigfix
e11sy Oct 9, 2024
a1699da
export all lists into toolbox
e11sy Oct 14, 2024
645d783
Merge pull request #88 from editor-js/improve-toolbox
e11sy Oct 14, 2024
be4bd01
convert by shortcut converts respectfully to the defaultStyle
e11sy Oct 17, 2024
d3eaf04
Update src/index.ts
e11sy Oct 17, 2024
8d1d9e6
eslint fix
e11sy Oct 17, 2024
047bb73
Merge pull request #89 from editor-js/improve-conversion-config
e11sy Oct 17, 2024
c1c9b98
start with implemented
e11sy Oct 19, 2024
400f8d4
start property displays inside of the input
e11sy Oct 23, 2024
7d0c286
fix start index ( +1 index )
e11sy Oct 23, 2024
1970d37
fix start inheritance on split
e11sy Oct 23, 2024
971737d
support max level variable for nested list
e11sy Oct 23, 2024
773a101
close toolbox on conversion
e11sy Oct 23, 2024
719225a
fix savind of the unneeded field for unordered and checklist
e11sy Oct 23, 2024
747b84d
move styles to src
e11sy Oct 23, 2024
c5ad296
do not render element when it is not needed
e11sy Oct 23, 2024
333d323
Update src/types/ItemMeta.ts
e11sy Oct 23, 2024
9398f99
make input universal
e11sy Oct 23, 2024
9afdb12
Merge branch 'ol-customisation' of https://github.com/editor-js/neste…
e11sy Oct 23, 2024
7289432
made renderToolbox input universal
e11sy Oct 23, 2024
307277c
Merge pull request #90 from editor-js/ol-customisation
e11sy Oct 23, 2024
7692b7f
Merge branch 'release/2.0' into support-max-level
e11sy Oct 24, 2024
078c617
improve comments
e11sy Oct 26, 2024
20cb12d
do not calculate currentItem level when it is not needed
e11sy Oct 28, 2024
bb6781e
Merge pull request #91 from editor-js/support-max-level
e11sy Oct 28, 2024
73badce
implemented counterType config property
e11sy Oct 28, 2024
90be126
naming imroved
e11sy Oct 28, 2024
43850ad
removed unneded types annotation
e11sy Oct 28, 2024
d62c3cf
fix eslint
e11sy Oct 28, 2024
a605425
Merge branch 'release/2.0' into ol-couters-customization
e11sy Oct 28, 2024
3540e34
remove unneeded type: 'default'
e11sy Oct 28, 2024
ea042f6
remove redundant toolbox item names
e11sy Oct 28, 2024
7c74b64
Merge pull request #92 from editor-js/ol-couters-customization
e11sy Oct 28, 2024
3f86e57
improve styling
e11sy Oct 30, 2024
9303776
added spacing variable
e11sy Oct 30, 2024
7f0612c
fix removeChildWrapperIfEmpty behaviour
e11sy Oct 30, 2024
e0cb899
Merge branch 'fix-shift-tab-behaviour' into ui-improvements
e11sy Oct 30, 2024
0a56a52
fix add tab behaviour
e11sy Oct 30, 2024
2364a6d
Merge branch 'fix-shift-tab-behaviour' into ui-improvements
e11sy Oct 30, 2024
92dfeb6
fix line heigth
e11sy Oct 30, 2024
fa0fbb7
fix backspace behaviour
e11sy Oct 30, 2024
12f9fc3
Merge branch 'fix-shift-tab-behaviour' into ui-improvements
e11sy Oct 30, 2024
522673c
improve comments
e11sy Oct 30, 2024
818bfea
improve removeChildWrapperIfEmpty behaviour and comments
e11sy Oct 30, 2024
1dbf3d4
Merge pull request #94 from editor-js/fix-shift-tab-behaviour
e11sy Oct 30, 2024
0efccba
Merge branch 'release/2.0' into ui-improvements
e11sy Oct 30, 2024
c2efb42
added padding for the whole list
e11sy Oct 30, 2024
1525116
Merge pull request #93 from editor-js/ui-improvements
e11sy Oct 30, 2024
75cde4f
improved toolbox input
e11sy Oct 30, 2024
1b54dbc
add data normalization method
e11sy Oct 30, 2024
3a1f7a6
renaming
e11sy Oct 30, 2024
eee081e
renaming
e11sy Oct 30, 2024
62e44c8
Update src/utils/normalizeData.ts
e11sy Oct 30, 2024
b1fabcd
fix safari map iteration
neSpecc Oct 30, 2024
8b1a3ae
lint fix
e11sy Oct 30, 2024
2f46c0e
Merge pull request #95 from editor-js/improve-toolbox-input
e11sy Oct 30, 2024
e04ffe3
Merge pull request #96 from editor-js/add-converter-for-list-tool-data
e11sy Oct 30, 2024
df8d541
add paste config
e11sy Oct 30, 2024
9fa9579
add paste config
e11sy Oct 30, 2024
5d89c2d
Merge branch 'release/2.0' of https://github.com/editor-js/nested-lis…
e11sy Oct 30, 2024
9012c85
Revert "add paste config"
e11sy Oct 30, 2024
506b1a8
add paste config
e11sy Oct 30, 2024
c42c955
Merge pull request #97 from editor-js/add-paste-config
e11sy Oct 31, 2024
e35f0d8
fixed behaviour of the get out of list method
e11sy Nov 2, 2024
3887e46
remove logs
e11sy Nov 2, 2024
49551e0
fix
e11sy Nov 2, 2024
2940479
fix bug with deletion of the bloxk
e11sy Nov 2, 2024
b4b624c
fix block indexing
e11sy Nov 2, 2024
970b8c4
fix double backspace
e11sy Nov 2, 2024
8983b11
updated readme and images
e11sy Nov 2, 2024
0e6d851
typo
e11sy Nov 2, 2024
42e50ae
remove unwanted changes
e11sy Nov 2, 2024
05e88d4
naming improved
e11sy Nov 2, 2024
d29ab6d
comments improved
e11sy Nov 2, 2024
e0544a7
Merge pull request #100 from editor-js/backspace-in-first-item
e11sy Nov 2, 2024
9f9b5ce
improve readme
e11sy Nov 2, 2024
df8f00a
remove unneded pictures
e11sy Nov 2, 2024
34f54bc
maxLevel moved to config
e11sy Nov 2, 2024
76bf68c
features improved
e11sy Nov 2, 2024
94ee6f6
improve features
e11sy Nov 2, 2024
f44e546
more features
e11sy Nov 2, 2024
d79ac19
features
e11sy Nov 2, 2024
7f711b1
improvement
e11sy Nov 2, 2024
1ca3405
Merge pull request #101 from editor-js/update-readme
e11sy Nov 2, 2024
45aee3e
Merge pull request #102 from editor-js/move-max-level-to-config
e11sy Nov 2, 2024
6e2bad4
added normalization of the checklist data
e11sy Nov 3, 2024
bde7158
rm logs
e11sy Nov 3, 2024
42dbe15
improve comments
e11sy Nov 5, 2024
2d84882
Merge pull request #103 from editor-js/improve-normalize-data
e11sy Nov 5, 2024
b324a9f
update dependencies
e11sy Nov 6, 2024
af095b5
improved invalid input
e11sy Nov 6, 2024
a723c51
Merge pull request #105 from editor-js/fix-build
e11sy Nov 6, 2024
eedac68
Merge pull request #106 from editor-js/support-invalid-input
e11sy Nov 6, 2024
d5f8eb9
get rid of `Nested` in naming
e11sy Nov 6, 2024
12c13bc
bump version
e11sy Nov 6, 2024
40ad72f
typo
e11sy Nov 6, 2024
0cdea32
Merge pull request #107 from editor-js/rename-to-list
e11sy Nov 6, 2024
be12977
remove redundant lines
e11sy Nov 6, 2024
1aa7f97
improve typings and playground
e11sy Nov 6, 2024
7ab6f7d
improved readme
e11sy Nov 6, 2024
ab07fd7
imp readme
e11sy Nov 6, 2024
0af4810
Update README.md
e11sy Nov 6, 2024
115d00d
improved type assertions
e11sy Nov 6, 2024
c6d99ef
Merge branch 'improve-item-meta' of https://github.com/editor-js/nest…
e11sy Nov 6, 2024
84dc345
improve readme
e11sy Nov 6, 2024
c0cb8ee
Merge pull request #108 from editor-js/rename-to-list
e11sy Nov 6, 2024
d92ff75
Merge pull request #109 from editor-js/improve-item-meta
e11sy Nov 6, 2024
1b0346c
improve demo gif
e11sy Nov 13, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 0 additions & 11 deletions .eslintrc

This file was deleted.

160 changes: 112 additions & 48 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,43 +1,50 @@
![](https://badgen.net/badge/Editor.js/v2.19.2/blue)

# Nested List Tool for Editor.js
# Editorjs List Tool

Multi-leveled lists for the [Editor.js](https://editorjs.io).
- 🤩 Part of [Editor.js](https://editorjs.io/) ecosystem.
- 📂 Nesting.
- 🔥 Ordered and Unordered lists.
- ✅ Checklists.
- 🔢 Customizable start number.
- 🏛️ Customizable counter type (e.g. `lower-roman`).
- 🪜 Max nesting level configuration.
- 📝 Compatible with [List](https://github.com/editor-js/list) and [Checklist](https://github.com/editor-js/checklist).

Use `Tab` and `Shift+Tab` keys to create or remove sublist with a padding.
![](assets/demo.gif)

![](assets/example.gif)
Use `Tab` and `Shift+Tab` keys to create or remove sublist with a padding.

## Installation

Get the package

```shell
yarn add @editorjs/nested-list
yarn add @editorjs/list
```

Include module at your application

```javascript
import NestedList from '@editorjs/nested-list';
import List from '@editorjs/list';
```

Optionally, you can load this tool from CDN [JsDelivr CDN](https://cdn.jsdelivr.net/npm/@editorjs/nested-list@latest)
Optionally, you can load this tool from CDN [JsDelivr CDN](https://cdn.jsdelivr.net/npm/@editorjs/list@latest)

## Usage

Add the NestedList Tool to the `tools` property of the Editor.js initial config.
Add the List Tool to the `tools` property of the Editor.js initial config.

```javascript
import EditorJS from '@editorjs/editorjs';
import NestedList from '@editorjs/nested-list';
import List from '@editorjs/list';

var editor = EditorJS({
// ...
tools: {
...
list: {
class: NestedList,
class: List,
inlineToolbar: true,
config: {
defaultStyle: 'unordered'
Expand All @@ -51,58 +58,115 @@ var editor = EditorJS({

| Field | Type | Description |
|--------------|----------|----------------------------------------------------------------|
| defaultStyle | `string` | default list style: `ordered` or `unordered`, default is `unordered` |
| defaultStyle | `string` | default list style: `ordered`, `unordered` or `checklist`, default is `unordered` |
| maxLevel | `number` | maximum level of the list nesting, could be set to `1` to disable nesting, unlimited by default |

## Tool's settings
## Output data

![](assets/bf5a42e4-1350-499d-a728-493b0fcaeda4.jpg)
| Field | Type | Description |
| ----------------- | --------- | ------------------------------------------------------------------------------------------------------------------------- |
| style | `string` | list will be rendered with this style: `ordered`, `unordered` or `checklist`, default is `defaultStyle` from tool config |
| meta | `ItemMeta`| Item meta based on the list style |
| items | `Item[]` | the array of list's items |

You can choose list`s type.
Object `Item`:

## Output data
| Field | Type | Description |
| ------- | ---------- | --------------------------- |
| content | `string` | item's string content |
| meta | `ItemMeta` | meta information about item |
| items | `Item[]` | the array of list's items |

| Field | Type | Description |
| ----- | --------- | ---------------------------------------- |
| style | `string` | type of a list: `ordered` or `unordered` |
| items | `Item[]` | the array of list's items |
Object `ItemMeta` for Checklist:

Object `Item`:
| Field | Type | Description |
| ------- | --------- | ------------------------- |
| checked | `boolean` | state of the checkbox |

Object `ItemMeta` for Ordered list

| Field | Type | Description |
| ------- | --------- | ------------------------- |
| content | `string` | item's string content |
| items | `Item[]` | the array of list's items |
| start | `number` | number for list to start with, default is 1 |
| counterType | `string` | counter type for list, it could be `numeric`, `lower-roman`, `upper-roman`, `lower-alpha`, `upper-alpha`, default is `numeric` |


Object `ItemMeta` for Unordered list would be empty.


## Example of the content for `Unordered List`
```json
{
"type" : "list",
"data" : {
"style" : "unordered",
"items" : [
{
"content": "Apples",
"items": [
{
"content": "Red",
"items": []
},
{
"content": "Green",
"items": []
},
]
},
{
"content": "Bananas",
"items": [
{
"content": "Yellow",
"items": []
},
]
"type" : "list",
"data" : {
"style": "unordered",
"items": [
{
"content": "Apples",
"meta": {},
"items": [
{
"content": "Red",
"meta": {},
"items": []
},
]
},
]
}
},
```

## Example of the content for `Ordered List`
```json
{
"type" : "list",
"data" : {
"style": "ordered",
"meta": {
"start": 2,
"counterType": "upper-roman",
},
"items" : [
{
"content": "Apples",
"meta": {},
"items": [
{
"content": "Red",
"meta": {},
"items": []
},
]
},
]
}
},
```

## Example of the content for `Checklist`
```json
{
"type" : "list",
"data" : {
"style": "checklist",
"items" : [
{
"content": "Apples",
"meta": {
"checked": false
},
"items": [
{
"content": "Red",
"meta": {
"checked": true
},
"items": []
},
]
}
},
]
}
},
```
Binary file removed assets/bf5a42e4-1350-499d-a728-493b0fcaeda4.jpg
Binary file not shown.
Binary file added assets/demo.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed assets/example.gif
Binary file not shown.
62 changes: 62 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
import CodeX from 'eslint-config-codex';
import { plugin as TsPlugin, parser as TsParser } from 'typescript-eslint';

export default [
...CodeX,

/**
* Redefine language options and some of the rules of CodeX eslint config for javascript config
*/
{
files: ['vite.config.js', 'eslint.config.mjs', 'postcss.config.js', '**/json-preview.js'],
languageOptions: {
parserOptions: {
project: './tsconfig.eslint.json',
ecmaVersion: 2022,
sourceType: 'module',
},
},
rules: {
'n/no-extraneous-import': ['error', {
allowModules: ['typescript-eslint'],
}],
},
},

/**
* Redefine language oprions and some of the rules of the CodeX eslint config for typescript config
*/
{
name: 'editorjs-list',
ignores: ['vite.config.js', 'eslint.config.mjs', 'postcss.config.js', '**/json-preview.js'],
plugins: {
'@typescript-eslint': TsPlugin,
},

/**
* This are the options for typescript files
*/
languageOptions: {
parser: TsParser,
parserOptions: {
project: './tsconfig.eslint.json',
tsconfigRootDir: './',
sourceType: 'module', // Allows for the use of imports
},
},

rules: {
'n/no-missing-import': ['off'],
'n/no-unpublished-import': ['error', {
allowModules: ['eslint-config-codex'],
ignoreTypeImport: true,
}],
'n/no-unsupported-features/node-builtins': ['error', {
version: '>=22.1.0',
}],
'@typescript-eslint/no-empty-object-type': ['error', {
allowInterfaces: 'always',
}],
},
},
];
45 changes: 0 additions & 45 deletions example/assets/json-preview.js

This file was deleted.

Loading
Loading