Skip to content

Commit

Permalink
feat: configure getFallbackListStyleTypeFromNestLevel in `renderers…
Browse files Browse the repository at this point in the history
…Props.ol|ul`
  • Loading branch information
jsamr committed Jun 4, 2021
1 parent 96daa5e commit 1377ef7
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 12 deletions.
13 changes: 1 addition & 12 deletions packages/render-html/src/elements/ListElement.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,6 @@ export interface ListElementProps<T extends 'ol' | 'ul'>
extends DefaultTagRendererProps<TBlock>,
ListElementConfig {
listType: T;
/**
* Get default list-style-type given the number of nest level for this list.
*
* @param nestLevel - The number of ol or ul parents elements.
*/
getFallbackListStyleTypeFromNestLevel: (
nestLevel: number
) => DefaultSupportedListStyleType;
/**
* Specifications to render list markers.
*/
listStyleSpecs: Record<string, ListStyleSpec>;
}

Expand Down Expand Up @@ -128,7 +117,7 @@ export default function ListElement({
tnode.nodeIndex === tnode.parent?.children.length - 1
? styles.zeroMarginBottom
: null;
const selectedListType = getListStyleTypeFromNestLevel(nestLevel);
const selectedListType = getListStyleTypeFromNestLevel!(nestLevel);
const listStyleType =
(tnode.styles.webTextFlow.listStyleType as DefaultSupportedListStyleType) ||
selectedListType;
Expand Down
8 changes: 8 additions & 0 deletions packages/render-html/src/shared-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,14 @@ export interface ListElementConfig {
* @defaultValue false
*/
enableExperimentalRtl?: boolean;
/**
* Get default list-style-type given the number of nest level for this list.
*
* @param nestLevel - The number of ol or ul parents elements.
*/
getFallbackListStyleTypeFromNestLevel?: (
nestLevel: number
) => DefaultSupportedListStyleType;
}

/**
Expand Down

0 comments on commit 1377ef7

Please sign in to comment.