0
Fork 0
mirror of https://github.com/penpot/penpot-exporter-figma-plugin.git synced 2024-12-22 05:33:02 -05:00

fixed lists (#91)

This commit is contained in:
Alex Sánchez 2024-05-08 12:11:41 +02:00 committed by GitHub
parent 2920ac297b
commit a18f98151a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -10,7 +10,7 @@ type Level = {
type: ListType;
};
type ListType = 'ORDERED' | 'UNORDERED';
type ListType = 'ORDERED' | 'UNORDERED' | 'NONE';
export class List {
private levels: Map<number, Level> = new Map();
@ -27,11 +27,11 @@ export class List {
let level = this.levels.get(segment.indentation);
if (!level || level.type !== this.getListType(segment)) {
if (!level || level.type !== segment.listOptions.type) {
level = {
style: this.createStyle(textNode, segment.indentation),
counter: 0,
type: this.getListType(segment)
type: segment.listOptions.type
};
this.levels.set(segment.indentation, level);
@ -55,14 +55,6 @@ export class List {
);
}
private getListType(segment: StyleTextSegment): ListType {
if (segment.listOptions.type === 'NONE') {
throw new Error('List type not valid');
}
return segment.listOptions.type;
}
private createStyle(node: PenpotTextNode, indentation: number): PenpotTextNode {
return {
...node,