diff --git a/extension/src-context-table/html.tsx b/extension/src-context-table/html.tsx index eda7691..68a127d 100644 --- a/extension/src-context-table/html.tsx +++ b/extension/src-context-table/html.tsx @@ -52,13 +52,22 @@ export function createSelector(id: string, index: number, options: string[], top } } +/** + * Creates a table VNode enclosed by a div element with the 'context table' class. + * @param id The id of the table. + * @returns A table VNode enclosed by a div element. + */ +export function initContextTable(id: string): VNode { + return
{createTable(id)}
; +} + /** * Creates a table VNode. * @param id The id of the table. * @returns A table VNode. */ export function createTable(id: string): VNode { - return
; + return
; } /** @@ -87,7 +96,7 @@ export function createText(text: string): VNode { * @param colspan The colspan of the header. * @returns A header element. */ -export function createHeaderElement(header: string, top: string, rowspan?: number, colspan?: number) { +export function createHeaderElement(header: string, top: string, rowspan?: number, colspan?: number): VNode { if (rowspan && colspan) { return {header}; } else if (rowspan) { @@ -104,7 +113,7 @@ export function createHeaderElement(header: string, top: string, rowspan?: numbe * @param headers The headers of the header row. * @returns A header row element. */ -export function createHeaderRow(headers: VNode[]) { +export function createHeaderRow(headers: VNode[]): VNode { return {...headers} ; @@ -115,7 +124,7 @@ export function createHeaderRow(headers: VNode[]) { * @param headers The header rows * @returns A thead element containing the given header rows. */ -export function createTHead(headers: VNode[]) { +export function createTHead(headers: VNode[]): VNode { return {...headers}; } diff --git a/extension/src-context-table/main.ts b/extension/src-context-table/main.ts index f1e15a3..e2a0c79 100644 --- a/extension/src-context-table/main.ts +++ b/extension/src-context-table/main.ts @@ -18,7 +18,7 @@ import "./css/table.css"; import { Table } from "@kieler/table-webview/lib/table"; import { SendContextTableDataAction } from "./actions"; -import { createHeaderElement, createHeaderRow, createRow, createTable, createTHead, patch } from "./html"; +import { createHeaderElement, createHeaderRow, createRow, createTable, createTHead, initContextTable, patch } from "./html"; import { addSelector, addText, @@ -163,7 +163,7 @@ export class ContextTable extends Table { // create a table const placeholderTable = document.createElement("div"); mainDiv.append(placeholderTable); - const table = createTable(this.tableId); + const table = initContextTable(this.tableId); patch(placeholderTable, table); } }