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

Feature/disable tool elements #122

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

ahmedatigui
Copy link
Member

Closes #119

src/index.ts Outdated
@@ -75,6 +75,10 @@ export default class EditorjsList {
},
},
];

return this.displayedEntries ? entries.filter(
ele => this.displayedEntries?.includes(ele.data.style as ListDataStyle)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

improve naming please

src/index.ts Outdated
Comment on lines 178 to 181
/**
*
*/
private static displayedEntries?: ListDataStyle[];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

comments missing

src/index.ts Outdated
Comment on lines 316 to 318
if (EditorjsList.displayedEntries){
if (this.listStyle === 'ordered') this.addAdditionalTunes(defaultTunes);
} else if (this.listStyle === 'ordered') this.addAdditionalTunes(defaultTunes);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no need to check for EditorjsList.displayedEntries here

src/index.ts Outdated
@@ -75,6 +75,10 @@ export default class EditorjsList {
},
},
];

return this.displayedEntries ? entries.filter(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you cannot access this.displayedEntries since it is static

src/index.ts Outdated
Comment on lines 321 to 327
tune => {
if ('title' in tune) {
if(tune.title === 'Start with' || tune.title === 'Counter type') return true;
else return EditorjsList.displayedEntries?.includes(tune.title!.toLowerCase() as ListDataStyle);
} else if (('type' in tune) && tune.type === 'separator') return true;
}
) : defaultTunes;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you can firstly filter default tunes, and then add additional ones, then you won't need to check for Start with and Counter type in tunes

README.md Outdated
@@ -64,6 +64,7 @@ var editor = EditorJS({
|--------------|----------|----------------------------------------------------------------|
| 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 |
| displayedEntries | `listStyle[]` | List entries allowed to be displayed `ordered`, `unordered` or `checklist` |
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lets call it styles?

@ahmedatigui ahmedatigui requested a review from e11sy December 7, 2024 20:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Disable checklist
3 participants