Skip to content

Commit

Permalink
Revert TableElement.ts - bug introduced by #35
Browse files Browse the repository at this point in the history
  • Loading branch information
abccsss committed Nov 5, 2023
1 parent 7df5441 commit 6f65b1f
Showing 1 changed file with 6 additions and 15 deletions.
21 changes: 6 additions & 15 deletions src/lib/elements/TableElement.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { Context } from '../Context';
import { ContainerElement, RenderElement, RenderOptions } from '../Element';
import { ContainerElement, RenderOptions } from '../Element';
import { Token } from '../Token';
import { CaptionElement } from './CaptionElement';
import { ParagraphElement } from './ParagraphElement';

export class TableElement implements ContainerElement {
Expand All @@ -12,8 +11,6 @@ export class TableElement implements ContainerElement {
paragraph: ParagraphElement = new ParagraphElement();
isInline: boolean = false;
isPlain: boolean = false;
caption?: CaptionElement = undefined;
id?: string = undefined;

// current cell
row: number = 0;
Expand Down Expand Up @@ -88,8 +85,12 @@ export class TableElement implements ContainerElement {
}

render(options?: RenderOptions): HTMLElement[] {
let div = document.createElement('div');
div.classList.add('table-wrapper');

let table = document.createElement('table');
if (!this.isPlain) table.classList.add('wikitable');
div.append(table);

let tbody = document.createElement('tbody');
table.append(tbody);
Expand Down Expand Up @@ -133,16 +134,6 @@ export class TableElement implements ContainerElement {
}
}

if(this.caption)
{
table.append(...this.caption.render(options));
}

if(this.id)
{
table.setAttribute('id', this.id);
}

return [table];
return [div];
}
}

0 comments on commit 6f65b1f

Please sign in to comment.