MCPcopy
hub / github.com/tinymce/tinymce / generateH

Function generateH

modules/snooker/src/test/ts/browser/TableSizesTest.ts:93–122  ·  view source on GitHub ↗
(tdInfo: string[][], trInfo: string[], totalHeight: string)

Source from the content-addressed store, hash-verified

91 };
92
93 const generateH = (tdInfo: string[][], trInfo: string[], totalHeight: string) => {
94 const table = SugarElement.fromTag('table');
95 Css.set(table, 'height', totalHeight);
96 const tbody = SugarElement.fromTag('tbody');
97 const numRows = tdInfo.length || trInfo.length;
98 const trows: SugarElement<HTMLTableRowElement>[] = [];
99 Arr.range(numRows, (r) => {
100 const tr = SugarElement.fromTag('tr');
101 const trHeight = trInfo[r];
102 if (Type.isNonNullable(trHeight)) {
103 Css.set(tr, 'height', trHeight);
104 }
105 const numCells = tdInfo[r].length || 1;
106 const cells: SugarElement<HTMLTableCellElement>[] = [];
107 Arr.range(numCells, (c) => {
108 const td = SugarElement.fromTag('td');
109 const height = tdInfo[r][c];
110 if (Type.isNonNullable(height)) {
111 Css.set(td, 'height', height);
112 }
113 Insert.append(td, SugarElement.fromText(String.fromCharCode('A'.charCodeAt(0) + c) + r));
114 cells.push(td);
115 });
116 InsertAll.append(tr, cells);
117 trows.push(tr);
118 });
119 InsertAll.append(tbody, trows);
120 Insert.append(table, tbody);
121 return table;
122 };
123
124 const checkWidth = (expected: string[][], table: SugarElement<HTMLTableElement>, newWidth: string) => {
125 Insert.append(SugarBody.body(), table);

Callers 2

Calls 2

setMethod · 0.80
appendMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…