Skip to content

Commit

Permalink
[table-generator] do not throw udpate error when no value is in cell (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
origami-z authored Jul 7, 2023
1 parent 4383896 commit 15f835c
Showing 1 changed file with 14 additions and 11 deletions.
25 changes: 14 additions & 11 deletions packages/table-generator/plugin-src/utils/data-interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -153,25 +153,28 @@ export const writeDataFromUiTable = async (
if (rowIndex === 0) {
// header
const textNode = getPreferredChildTextNode(cell);
const newValue = headerValues[columnIndex];
if (textNode) {
await syncTextInTextNode(headerValues[columnIndex], textNode);
await syncTextInTextNode(newValue, textNode);
} else {
throw new Error(
`Can't find visible text layer within col ${columnIndex} header cell`
);
if (newValue) {
throw new Error(
`Can't find visible text layer within col ${columnIndex} header cell`
);
}
}
} else {
// body
const textNode = getPreferredChildTextNode(cell);
const newValue = cellValues[columnIndex][rowIndex - 1];
if (textNode) {
await syncTextInTextNode(
cellValues[columnIndex][rowIndex - 1],
textNode
);
await syncTextInTextNode(newValue, textNode);
} else {
throw new Error(
`Can't find visible text layer within col ${columnIndex} row ${rowIndex}`
);
if (newValue) {
throw new Error(
`Can't find visible text layer within col ${columnIndex} row ${rowIndex}`
);
}
}
}
} else {
Expand Down

0 comments on commit 15f835c

Please sign in to comment.