Update fails on table with incremental rows
Closed this issue · 1 comments
sblakey commented
Initial document markdown:
| Column A | Column B |
| ------ | ------- |
| Test | Test |
| Test 2 | Test 2 |
Updated with:
| Column A | Column B |
| ------ | ------- |
| Test | Test |
| Test 2 | Test 2 |
| Test 3 | test 3 |
Results in Quip document:
|Column A |Column B |
|--- |--- |
|Test |Test |
|--- |--- |
|Test 2 |Test 2 |
|Column A |Column B |
|--- |--- |
|Test |Test |
|--- |--- |
|Test 2 |Test 2 |
|Test 3 |test 3 |
sblakey commented
OK, I think I understand what is going on here. The current plugin code implements an "update" by:
- Deleting all elements-by-id that appear before the first Header.
- Finding the highest-level headers, and deleting each one, along with it's subtree.
- Finally, appending the new document to what should be an empty document.
The failure mode here is that Quip is enclosing tables in a top-level div that doesn't have a header or an ID. That's annoying.
Potential end-user workaround: put a header above the Table.
Potential code change (incremental): check for div-without-id-enclosing-a-table, to find the table ID to delete.
Potential code change (major): Prepend the updated document with a "delete everything after this header" marker, then use that marker for the deletion.