Skip to content

Commit

Permalink
improve counter type tune
Browse files Browse the repository at this point in the history
  • Loading branch information
e11sy committed Nov 20, 2024
1 parent 1fdb4c4 commit 7195ecb
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 10 deletions.
9 changes: 4 additions & 5 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import type {
ToolConfig
} from '@editorjs/editorjs/types/tools';
import { IconListBulleted, IconListNumbered, IconChecklist } from '@codexteam/icons';
import { IconUpperAlpha, IconStartWith } from './styles/icons/index.js';
import { IconStartWith } from './styles/icons/index.js';
import type { ListConfig, ListData, ListDataStyle, ListItem, OldListData } from './types/ListParams';
import ListTabulator from './ListTabulator';
import { CheckListRenderer, OrderedListRenderer, UnorderedListRenderer } from './ListRenderer';
Expand Down Expand Up @@ -331,8 +331,8 @@ export default class EditorjsList {
];

const orderedListCountersTunes: MenuConfigItem = {
label: this.api.i18n.t('Counters type'),
icon: IconUpperAlpha,
label: this.api.i18n.t('Counter type'),
icon: OlCounterIconsMap.get((this.data.meta as OrderedListItemMeta).counterType!),
children: {
items: [],
},
Expand All @@ -341,11 +341,10 @@ export default class EditorjsList {
/**
* For each counter type in OlCounterType create toolbox item
*/

OlCounterTypesMap.forEach((_, counterType: string) => {
orderedListCountersTunes.children.items!.push({
title: this.api.i18n.t(counterType),
icon: OlCounterIconsMap.get(counterType),
icon: OlCounterIconsMap.get(OlCounterTypesMap.get(counterType)!),
isActive: (this.data.meta as OrderedListItemMeta).counterType === OlCounterTypesMap.get(counterType),
closeOnActivate: true,
onActivate: () => {
Expand Down
10 changes: 5 additions & 5 deletions src/types/OlCounterType.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,25 +39,25 @@ export const OlCounterIconsMap = new Map<string, string>([
/**
* Value that represents Icon for Numeric counter type
*/
['Numeric', IconNumber],
['numeric', IconNumber],

/**
* Value that represents Icon for Lower Roman counter type
*/
['Lower Roman', IconLowerRoman],
['lower-roman', IconLowerRoman],

/**
* Value that represents Icon for Upper Roman counter type
*/
['Upper Roman', IconUpperRoman],
['upper-roman', IconUpperRoman],

/**
* Value that represents Icon for Lower Alpha counter type
*/
['Lower Alpha', IconLowerAlpha],
['lower-alpha', IconLowerAlpha],

/**
* Value that represents Icon for Upper Alpha counter type
*/
['Upper Alpha', IconUpperAlpha],
['upper-alpha', IconUpperAlpha],
]);

0 comments on commit 7195ecb

Please sign in to comment.