diff options
author | Max <max@nextcloud.com> | 2022-03-16 13:07:31 +0300 |
---|---|---|
committer | Max <max@nextcloud.com> | 2022-03-31 15:29:22 +0300 |
commit | df1deb6c36b42e4dee065742e5791afe95f04f5d (patch) | |
tree | 7c452cc94d3ca955c7114f72db330ac111ff0b12 /cypress | |
parent | 230dba77c564cdafb5c0a32c4b5c000d605ef1c3 (diff) |
fix: preserve td and th attributes
Prosemirror expects colspan, rowspan and the like to calculate the table layout.
Signed-off-by: Max <max@nextcloud.com>
Diffstat (limited to 'cypress')
-rw-r--r-- | cypress/fixtures/Table.md | 60 | ||||
-rw-r--r-- | cypress/integration/Table.spec.js | 12 |
2 files changed, 66 insertions, 6 deletions
diff --git a/cypress/fixtures/Table.md b/cypress/fixtures/Table.md index 634544249..546ecb189 100644 --- a/cypress/fixtures/Table.md +++ b/cypress/fixtures/Table.md @@ -52,3 +52,63 @@ insertTable did insertTable +## Add a new row at the end + +| | | | +|--|--|--| +| | | | +| | | addRowAfter | + + +--- + +| | | | +|--|--|--| +| | | | +| | | did addRowAfter | +| | | | + +## Add a new column at the end + +| | | | +|--|--|--| +| | | | +| | | addColumnAfter | + + +--- + +| | | | | +|--|--|--|--| +| | | | | +| | | did addColumnAfter | | + +## Delete row at the end + +| | | | +|--|--|--| +| | | | +| | | deleteRow | + + +--- + +| | | | +|--|--|--| +| | | | + +## Delete column at the end + +| | | | +|--|--|--| +| | | | +| | | deleteColumn | + + +--- + +| | | +|--|--| +| | | +| | | + diff --git a/cypress/integration/Table.spec.js b/cypress/integration/Table.spec.js index a04601123..cbf38f86d 100644 --- a/cypress/integration/Table.spec.js +++ b/cypress/integration/Table.spec.js @@ -1,9 +1,8 @@ import Table from './../../src/nodes/Table' -import TableBody from './../../src/nodes/TableBody' import TableCell from './../../src/nodes/TableCell' -import TableHead from './../../src/nodes/TableHead' import TableHeader from './../../src/nodes/TableHeader' import TableRow from './../../src/nodes/TableRow' +import TableHeadRow from './../../src/nodes/TableHeadRow' import Markdown from './../../src/extensions/Markdown' import markdownit from './../../src/markdownit' import { createMarkdownSerializer } from './../../src/extensions/Markdown'; @@ -18,10 +17,9 @@ describe('ListItem extension integrated in the editor', () => { extensions: [ Markdown, Table, - TableBody, TableCell, - TableHead, TableHeader, + TableHeadRow, TableRow, ], }) @@ -53,8 +51,10 @@ describe('ListItem extension integrated in the editor', () => { editor.commands.setTextSelection(found.pos) editor.commands[name]() const updated = findCommand() - editor.commands.setTextSelection(updated.pos) - editor.commands.insertContent('did ') + if (updated) { + editor.commands.setTextSelection(updated.pos) + editor.commands.insertContent('did ') + } } } |