Skip to content

Commit

Permalink
export all lists into toolbox
Browse files Browse the repository at this point in the history
  • Loading branch information
e11sy committed Oct 14, 2024
1 parent 73dead0 commit a1699da
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 7 deletions.
3 changes: 2 additions & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,11 @@
-->

<!-- Load Editor.js's Core -->
<script src="https://cdn.jsdelivr.net/npm/@editorjs/editorjs@latest"></script>
<!-- <script src="https://cdn.jsdelivr.net/npm/@editorjs/editorjs@latest"></script> -->

<!-- Initialization -->
<script type="module">
import EditorJS from '@editorjs/editorjs'
import List from './src/index.ts';

/**
Expand Down
31 changes: 25 additions & 6 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,29 @@ export default class NestedList {
* title - title to show in toolbox
*/
public static get toolbox(): ToolboxConfig {
return {
icon: IconListNumbered,
title: 'List',
};
return [
{
icon: IconListBulleted,
title: 'Unordered List',
data: {
style: 'unordered',
},
},
{
icon: IconListNumbered,
title: 'Ordered List',
data: {
style: 'ordered',
},
},
{
icon: IconChecklist,
title: 'Checklist',
data: {
style: 'checklist',
},
},
];
}

/**
Expand Down Expand Up @@ -177,9 +196,9 @@ export default class NestedList {
this.block = block;

/**
* Set the default list style from the config or presetted 'ordered'.
* Set the default list style from the config or presetted 'unordered'.
*/
this.defaultListStyle = this.config?.defaultStyle || 'ordered';
this.defaultListStyle = this.config?.defaultStyle || 'unordered';

const initialData = {
style: this.defaultListStyle,
Expand Down

0 comments on commit a1699da

Please sign in to comment.