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

Support for optional counter types for ordered list #129

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

Conversation

jscastanos
Copy link

The current version has a fixed list of counter types, which are the default options for ordered list.

So this PR allows an optional way to specify a list on what counter types should be visible.

Example

 tools: {
        List: {
          class: List,
          config: {
             counterTypes: ['numeric', 'upper-roman']
          }
        },
      },

image

Closes #128

Copy link
Contributor

@e11sy e11sy left a comment

Choose a reason for hiding this comment

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

it seems, that user could specify empty array (or array with one value) for counterTypes, then Counter type option should not be displayed in tool settings (since it would never be a choice)

you can add this changes and then it would be ready to merge, thanks for contributing!

@jscastanos
Copy link
Author

Hi @e11sy, sorry I was busy this past few weeks. I've updated the PR. Feel free to review again. thank you

src/index.ts Outdated
/**
* Dont show Counter type tune if there is no valid counter types
*/
if (orderedListCountersTunes.children.items!.length > 0) {
Copy link
Contributor

Choose a reason for hiding this comment

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

if we will have 1 counter type, than it would be information plate, not a tune, better to add tunes, when user could change smth

Suggested change
if (orderedListCountersTunes.children.items!.length > 0) {
if (orderedListCountersTunes.children.items!.length > 1) {

Copy link
Author

Choose a reason for hiding this comment

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

yeah it make sense. kindly review the PR again thanks @e11sy

src/index.ts Outdated
/**
* Set the default counter types for the ordered list
*/
this.defaultCounterTypes = this.config?.counterTypes || ['numeric', 'upper-roman', 'lower-roman', 'upper-alpha', 'lower-alpha'];
Copy link
Contributor

Choose a reason for hiding this comment

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

can we use typeof Object.values of the OlCounterTypesMap to show, where it all goes from?

Copy link
Author

Choose a reason for hiding this comment

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

I agree with that since we have the values already in the map. I pushed a change in this line.

@e11sy
Copy link
Contributor

e11sy commented Feb 10, 2025

several small changes and feature would be done, thanks for improvements

Copy link
Contributor

@e11sy e11sy left a comment

Choose a reason for hiding this comment

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

sorry for delay in reviewing, now it seems fine, thanks for contributing

@e11sy
Copy link
Contributor

e11sy commented Feb 27, 2025

can you update version to 2.0.6 please, 2.0.5 is already release

then feature could be merged

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 Customizable start number and Customizable counter type
2 participants