@manuscripts/transform 2.1.1-LEAN-3336-12 → 2.1.1-LEAN-3336-13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -241,7 +241,6 @@ exports.jatsBodyTransformations = {
241
241
  fixTables(body, createElement) {
242
242
  const tables = body.querySelectorAll('table-wrap > table');
243
243
  tables.forEach((table) => {
244
- var _a;
245
244
  const colgroup = table.querySelector('colgroup');
246
245
  const cols = table.querySelectorAll('col');
247
246
  if (!colgroup && table.firstChild && cols.length > 0) {
@@ -249,19 +248,20 @@ exports.jatsBodyTransformations = {
249
248
  for (const col of cols) {
250
249
  colgroup.appendChild(col);
251
250
  }
252
- (_a = table.parentNode) === null || _a === void 0 ? void 0 : _a.insertBefore(colgroup, table);
253
- }
254
- const rows = table.querySelectorAll('tr');
255
- for (const row of rows) {
256
- table.appendChild(row);
257
- }
258
- const thead = table.querySelector('thead');
259
- if (thead) {
260
- table.removeChild(thead);
251
+ table.insertBefore(colgroup, table.firstChild);
261
252
  }
262
253
  const tbody = table.querySelector('tbody');
263
254
  if (tbody) {
264
- table.removeChild(tbody);
255
+ const headerRow = table.querySelector('thead > tr');
256
+ if (!headerRow) {
257
+ const tr = createElement('tr');
258
+ tbody.insertBefore(tr, tbody.firstElementChild);
259
+ }
260
+ const footerRow = table.querySelector('tfoot > tr');
261
+ if (!footerRow) {
262
+ const tr = createElement('tr');
263
+ tbody.appendChild(tr);
264
+ }
265
265
  }
266
266
  });
267
267
  },
@@ -238,7 +238,6 @@ export const jatsBodyTransformations = {
238
238
  fixTables(body, createElement) {
239
239
  const tables = body.querySelectorAll('table-wrap > table');
240
240
  tables.forEach((table) => {
241
- var _a;
242
241
  const colgroup = table.querySelector('colgroup');
243
242
  const cols = table.querySelectorAll('col');
244
243
  if (!colgroup && table.firstChild && cols.length > 0) {
@@ -246,19 +245,20 @@ export const jatsBodyTransformations = {
246
245
  for (const col of cols) {
247
246
  colgroup.appendChild(col);
248
247
  }
249
- (_a = table.parentNode) === null || _a === void 0 ? void 0 : _a.insertBefore(colgroup, table);
250
- }
251
- const rows = table.querySelectorAll('tr');
252
- for (const row of rows) {
253
- table.appendChild(row);
254
- }
255
- const thead = table.querySelector('thead');
256
- if (thead) {
257
- table.removeChild(thead);
248
+ table.insertBefore(colgroup, table.firstChild);
258
249
  }
259
250
  const tbody = table.querySelector('tbody');
260
251
  if (tbody) {
261
- table.removeChild(tbody);
252
+ const headerRow = table.querySelector('thead > tr');
253
+ if (!headerRow) {
254
+ const tr = createElement('tr');
255
+ tbody.insertBefore(tr, tbody.firstElementChild);
256
+ }
257
+ const footerRow = table.querySelector('tfoot > tr');
258
+ if (!footerRow) {
259
+ const tr = createElement('tr');
260
+ tbody.appendChild(tr);
261
+ }
262
262
  }
263
263
  });
264
264
  },
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@manuscripts/transform",
3
3
  "description": "ProseMirror transformer for Manuscripts applications",
4
- "version": "2.1.1-LEAN-3336-12",
4
+ "version": "2.1.1-LEAN-3336-13",
5
5
  "repository": "github:Atypon-OpenSource/manuscripts-transform",
6
6
  "license": "Apache-2.0",
7
7
  "main": "dist/cjs",