Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions e2e/tests/crepe/table.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -235,3 +235,32 @@ test('paste single row google docs table keeps empty header', async ({
expect(md.includes('Only1')).toBeTruthy()
expect(md.includes('Only2')).toBeTruthy()
})

// Case B: Real Google Docs HTML with multiple tables and text
const googleDocsMultiTableDocument = `<meta charset='utf-8'><meta charset="utf-8"><b style="font-weight:normal;" id="docs-internal-guid-384d1cc7-7fff-bf64-4250-19e95cb0e0ca"><div dir="ltr" style="margin-left:0pt;" align="left"><table style="border:none;border-collapse:collapse;table-layout:fixed;width:468pt"><colgroup><col /><col /><col /></colgroup><tbody><tr style="height:0pt"><td style="border-left:solid #000000 1pt;border-right:solid #000000 1pt;border-bottom:solid #000000 1pt;border-top:solid #000000 1pt;vertical-align:top;padding:5pt 5pt 5pt 5pt;overflow:hidden;overflow-wrap:break-word;"><p dir="ltr" style="line-height:1.2;margin-top:0pt;margin-bottom:0pt;"><span style="font-size:11pt;font-family:Arial,sans-serif;color:#000000;background-color:transparent;font-weight:400;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline;white-space:pre;white-space:pre-wrap;">111</span></p></td><td style="border-left:solid #000000 1pt;border-right:solid #000000 1pt;border-bottom:solid #000000 1pt;border-top:solid #000000 1pt;vertical-align:top;padding:5pt 5pt 5pt 5pt;overflow:hidden;overflow-wrap:break-word;"><p dir="ltr" style="line-height:1.2;margin-top:0pt;margin-bottom:0pt;"><span style="font-size:11pt;font-family:Arial,sans-serif;color:#000000;background-color:transparent;font-weight:400;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline;white-space:pre;white-space:pre-wrap;">222</span></p></td><td style="border-left:solid #000000 1pt;border-right:solid #000000 1pt;border-bottom:solid #000000 1pt;border-top:solid #000000 1pt;vertical-align:top;padding:5pt 5pt 5pt 5pt;overflow:hidden;overflow-wrap:break-word;"><p dir="ltr" style="line-height:1.2;margin-top:0pt;margin-bottom:0pt;"><span style="font-size:11pt;font-family:Arial,sans-serif;color:#000000;background-color:transparent;font-weight:400;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline;white-space:pre;white-space:pre-wrap;">333</span></p></td></tr><tr style="height:0pt"><td style="border-left:solid #000000 1pt;border-right:solid #000000 1pt;border-bottom:solid #000000 1pt;border-top:solid #000000 1pt;vertical-align:top;padding:5pt 5pt 5pt 5pt;overflow:hidden;overflow-wrap:break-word;"><p dir="ltr" style="line-height:1.2;margin-top:0pt;margin-bottom:0pt;"><span style="font-size:11pt;font-family:Arial,sans-serif;color:#000000;background-color:transparent;font-weight:400;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline;white-space:pre;white-space:pre-wrap;">444</span></p></td><td style="border-left:solid #000000 1pt;border-right:solid #000000 1pt;border-bottom:solid #000000 1pt;border-top:solid #000000 1pt;vertical-align:top;padding:5pt 5pt 5pt 5pt;overflow:hidden;overflow-wrap:break-word;"><p dir="ltr" style="line-height:1.2;margin-top:0pt;margin-bottom:0pt;"><span style="font-size:11pt;font-family:Arial,sans-serif;color:#000000;background-color:transparent;font-weight:400;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline;white-space:pre;white-space:pre-wrap;">555</span></p></td><td style="border-left:solid #000000 1pt;border-right:solid #000000 1pt;border-bottom:solid #000000 1pt;border-top:solid #000000 1pt;vertical-align:top;padding:5pt 5pt 5pt 5pt;overflow:hidden;overflow-wrap:break-word;"><p dir="ltr" style="line-height:1.2;margin-top:0pt;margin-bottom:0pt;"><span style="font-size:11pt;font-family:Arial,sans-serif;color:#000000;background-color:transparent;font-weight:400;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline;white-space:pre;white-space:pre-wrap;">666</span></p></td></tr><tr style="height:0pt"><td style="border-left:solid #000000 1pt;border-right:solid #000000 1pt;border-bottom:solid #000000 1pt;border-top:solid #000000 1pt;vertical-align:top;padding:5pt 5pt 5pt 5pt;overflow:hidden;overflow-wrap:break-word;"><p dir="ltr" style="line-height:1.2;margin-top:0pt;margin-bottom:0pt;"><span style="font-size:11pt;font-family:Arial,sans-serif;color:#000000;background-color:transparent;font-weight:400;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline;white-space:pre;white-space:pre-wrap;">777</span></p></td><td style="border-left:solid #000000 1pt;border-right:solid #000000 1pt;border-bottom:solid #000000 1pt;border-top:solid #000000 1pt;vertical-align:top;padding:5pt 5pt 5pt 5pt;overflow:hidden;overflow-wrap:break-word;"><p dir="ltr" style="line-height:1.2;margin-top:0pt;margin-bottom:0pt;"><span style="font-size:11pt;font-family:Arial,sans-serif;color:#000000;background-color:transparent;font-weight:400;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline;white-space:pre;white-space:pre-wrap;">aaa</span></p></td><td style="border-left:solid #000000 1pt;border-right:solid #000000 1pt;border-bottom:solid #000000 1pt;border-top:solid #000000 1pt;vertical-align:top;padding:5pt 5pt 5pt 5pt;overflow:hidden;overflow-wrap:break-word;"><p dir="ltr" style="line-height:1.2;margin-top:0pt;margin-bottom:0pt;"><span style="font-size:11pt;font-family:Arial,sans-serif;color:#000000;background-color:transparent;font-weight:400;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline;white-space:pre;white-space:pre-wrap;">bbb</span></p></td></tr></tbody></table></div><br /><br /><div dir="ltr" style="margin-left:0pt;" align="left"><table style="border:none;border-collapse:collapse;table-layout:fixed;width:468pt"><colgroup><col /><col /><col /></colgroup><tbody><tr style="height:0pt"><td style="border-left:solid #000000 1pt;border-right:solid #000000 1pt;border-bottom:solid #000000 1pt;border-top:solid #000000 1pt;vertical-align:top;padding:5pt 5pt 5pt 5pt;overflow:hidden;overflow-wrap:break-word;"><p dir="ltr" style="line-height:1.2;margin-top:0pt;margin-bottom:0pt;"><span style="font-size:11pt;font-family:Arial,sans-serif;color:#000000;background-color:transparent;font-weight:400;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline;white-space:pre;white-space:pre-wrap;">111</span></p></td><td style="border-left:solid #000000 1pt;border-right:solid #000000 1pt;border-bottom:solid #000000 1pt;border-top:solid #000000 1pt;vertical-align:top;padding:5pt 5pt 5pt 5pt;overflow:hidden;overflow-wrap:break-word;"><p dir="ltr" style="line-height:1.2;margin-top:0pt;margin-bottom:0pt;"><span style="font-size:11pt;font-family:Arial,sans-serif;color:#000000;background-color:transparent;font-weight:400;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline;white-space:pre;white-space:pre-wrap;">222</span></p></td><td style="border-left:solid #000000 1pt;border-right:solid #000000 1pt;border-bottom:solid #000000 1pt;border-top:solid #000000 1pt;vertical-align:top;padding:5pt 5pt 5pt 5pt;overflow:hidden;overflow-wrap:break-word;"><p dir="ltr" style="line-height:1.2;margin-top:0pt;margin-bottom:0pt;"><span style="font-size:11pt;font-family:Arial,sans-serif;color:#000000;background-color:transparent;font-weight:400;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline;white-space:pre;white-space:pre-wrap;">333</span></p></td></tr><tr style="height:0pt"><td style="border-left:solid #000000 1pt;border-right:solid #000000 1pt;border-bottom:solid #000000 1pt;border-top:solid #000000 1pt;vertical-align:top;padding:5pt 5pt 5pt 5pt;overflow:hidden;overflow-wrap:break-word;"><p dir="ltr" style="line-height:1.2;margin-top:0pt;margin-bottom:0pt;"><span style="font-size:11pt;font-family:Arial,sans-serif;color:#000000;background-color:transparent;font-weight:400;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline;white-space:pre;white-space:pre-wrap;">444</span></p></td><td style="border-left:solid #000000 1pt;border-right:solid #000000 1pt;border-bottom:solid #000000 1pt;border-top:solid #000000 1pt;vertical-align:top;padding:5pt 5pt 5pt 5pt;overflow:hidden;overflow-wrap:break-word;"><p dir="ltr" style="line-height:1.2;margin-top:0pt;margin-bottom:0pt;"><span style="font-size:11pt;font-family:Arial,sans-serif;color:#000000;background-color:transparent;font-weight:400;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline;white-space:pre;white-space:pre-wrap;">555</span></p></td><td style="border-left:solid #000000 1pt;border-right:solid #000000 1pt;border-bottom:solid #000000 1pt;border-top:solid #000000 1pt;vertical-align:top;padding:5pt 5pt 5pt 5pt;overflow:hidden;overflow-wrap:break-word;"><p dir="ltr" style="line-height:1.2;margin-top:0pt;margin-bottom:0pt;"><span style="font-size:11pt;font-family:Arial,sans-serif;color:#000000;background-color:transparent;font-weight:400;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline;white-space:pre;white-space:pre-wrap;">666</span></p></td></tr><tr style="height:0pt"><td style="border-left:solid #000000 1pt;border-right:solid #000000 1pt;border-bottom:solid #000000 1pt;border-top:solid #000000 1pt;vertical-align:top;padding:5pt 5pt 5pt 5pt;overflow:hidden;overflow-wrap:break-word;"><p dir="ltr" style="line-height:1.2;margin-top:0pt;margin-bottom:0pt;"><span style="font-size:11pt;font-family:Arial,sans-serif;color:#000000;background-color:transparent;font-weight:400;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline;white-space:pre;white-space:pre-wrap;">777</span></p></td><td style="border-left:solid #000000 1pt;border-right:solid #000000 1pt;border-bottom:solid #000000 1pt;border-top:solid #000000 1pt;vertical-align:top;padding:5pt 5pt 5pt 5pt;overflow:hidden;overflow-wrap:break-word;"><p dir="ltr" style="line-height:1.2;margin-top:0pt;margin-bottom:0pt;"><span style="font-size:11pt;font-family:Arial,sans-serif;color:#000000;background-color:transparent;font-weight:400;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline;white-space:pre;white-space:pre-wrap;">aaa</span></p></td><td style="border-left:solid #000000 1pt;border-right:solid #000000 1pt;border-bottom:solid #000000 1pt;border-top:solid #000000 1pt;vertical-align:top;padding:5pt 5pt 5pt 5pt;overflow:hidden;overflow-wrap:break-word;"><p dir="ltr" style="line-height:1.2;margin-top:0pt;margin-bottom:0pt;"><span style="font-size:11pt;font-family:Arial,sans-serif;color:#000000;background-color:transparent;font-weight:400;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline;white-space:pre;white-space:pre-wrap;">bbb</span></p></td></tr></tbody></table></div><br /><p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt;"><span style="font-size:11pt;font-family:Arial,sans-serif;color:#000000;background-color:transparent;font-weight:400;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline;white-space:pre;white-space:pre-wrap;">123</span></p></b><br class="Apple-interchange-newline">`

test('paste google docs document with multiple tables (Case B)', async ({
page,
}) => {
await focusEditor(page)
await paste(page, {
'text/html': googleDocsMultiTableDocument,
})
await waitNextFrame(page)
const md = await getMarkdown(page)

// Both tables should be rendered as markdown tables
// Count the number of table separators (| :-- |)
const separatorMatches = md.match(/\| :--/g)
expect(separatorMatches?.length).toBeGreaterThanOrEqual(6) // 3 cols x 2 tables

// Text "123" should be present
expect(md.includes('123')).toBeTruthy()

// No empty <br /> header rows in tables
const lines = md.split('\n')
const headerLines = lines.filter(
(l) => l.includes('<br />') && l.includes('|')
)
expect(headerLines.length).toBe(0)
})
20 changes: 20 additions & 0 deletions packages/components/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,25 @@
# @milkdown/components

## 7.19.2

### Patch Changes

- 39f9064: Milkdown patch version release.

## Fix
- fix(plugin-clipboard, preset-gfm): fix pasting multiple tables from Google Docs (#2286)

- Updated dependencies [39f9064]
- @milkdown/core@7.19.2
- @milkdown/ctx@7.19.2
- @milkdown/exception@7.19.2
- @milkdown/plugin-tooltip@7.19.2
- @milkdown/preset-commonmark@7.19.2
- @milkdown/preset-gfm@7.19.2
- @milkdown/prose@7.19.2
- @milkdown/transformer@7.19.2
- @milkdown/utils@7.19.2

## 7.19.1

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/components/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@milkdown/components",
"type": "module",
"version": "7.19.1",
"version": "7.19.2",
"license": "MIT",
"repository": {
"type": "git",
Expand Down
15 changes: 15 additions & 0 deletions packages/core/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,20 @@
# @milkdown/core

## 7.19.2

### Patch Changes

- 39f9064: Milkdown patch version release.

## Fix
- fix(plugin-clipboard, preset-gfm): fix pasting multiple tables from Google Docs (#2286)

- Updated dependencies [39f9064]
- @milkdown/ctx@7.19.2
- @milkdown/exception@7.19.2
- @milkdown/prose@7.19.2
- @milkdown/transformer@7.19.2

## 7.19.1

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/core/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@milkdown/core",
"type": "module",
"version": "7.19.1",
"version": "7.19.2",
"license": "MIT",
"repository": {
"type": "git",
Expand Down
12 changes: 12 additions & 0 deletions packages/crepe/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
# @milkdown/crepe

## 7.19.2

### Patch Changes

- 39f9064: Milkdown patch version release.

## Fix
- fix(plugin-clipboard, preset-gfm): fix pasting multiple tables from Google Docs (#2286)

- Updated dependencies [39f9064]
- @milkdown/kit@7.19.2

## 7.19.1

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/crepe/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@milkdown/crepe",
"type": "module",
"version": "7.19.1",
"version": "7.19.2",
"license": "MIT",
"repository": {
"type": "git",
Expand Down
12 changes: 12 additions & 0 deletions packages/ctx/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
# @milkdown/ctx

## 7.19.2

### Patch Changes

- 39f9064: Milkdown patch version release.

## Fix
- fix(plugin-clipboard, preset-gfm): fix pasting multiple tables from Google Docs (#2286)

- Updated dependencies [39f9064]
- @milkdown/exception@7.19.2

## 7.19.1

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/ctx/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@milkdown/ctx",
"type": "module",
"version": "7.19.1",
"version": "7.19.2",
"license": "MIT",
"repository": {
"type": "git",
Expand Down
9 changes: 9 additions & 0 deletions packages/exception/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
# @milkdown/exception

## 7.19.2

### Patch Changes

- 39f9064: Milkdown patch version release.

## Fix
- fix(plugin-clipboard, preset-gfm): fix pasting multiple tables from Google Docs (#2286)

## 7.19.1

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/exception/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@milkdown/exception",
"type": "module",
"version": "7.19.1",
"version": "7.19.2",
"license": "MIT",
"repository": {
"type": "git",
Expand Down
13 changes: 13 additions & 0 deletions packages/integrations/react/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
# @milkdown/react

## 7.19.2

### Patch Changes

- 39f9064: Milkdown patch version release.

## Fix
- fix(plugin-clipboard, preset-gfm): fix pasting multiple tables from Google Docs (#2286)

- Updated dependencies [39f9064]
- @milkdown/crepe@7.19.2
- @milkdown/kit@7.19.2

## 7.19.1

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/integrations/react/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@milkdown/react",
"type": "module",
"version": "7.19.1",
"version": "7.19.2",
"license": "MIT",
"repository": {
"type": "git",
Expand Down
13 changes: 13 additions & 0 deletions packages/integrations/vue/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
# @milkdown/vue

## 7.19.2

### Patch Changes

- 39f9064: Milkdown patch version release.

## Fix
- fix(plugin-clipboard, preset-gfm): fix pasting multiple tables from Google Docs (#2286)

- Updated dependencies [39f9064]
- @milkdown/crepe@7.19.2
- @milkdown/kit@7.19.2

## 7.19.1

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/integrations/vue/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@milkdown/vue",
"type": "module",
"version": "7.19.1",
"version": "7.19.2",
"license": "MIT",
"repository": {
"type": "git",
Expand Down
29 changes: 29 additions & 0 deletions packages/kit/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,34 @@
# @milkdown/kit

## 7.19.2

### Patch Changes

- 39f9064: Milkdown patch version release.

## Fix
- fix(plugin-clipboard, preset-gfm): fix pasting multiple tables from Google Docs (#2286)

- Updated dependencies [39f9064]
- @milkdown/components@7.19.2
- @milkdown/core@7.19.2
- @milkdown/ctx@7.19.2
- @milkdown/plugin-block@7.19.2
- @milkdown/plugin-clipboard@7.19.2
- @milkdown/plugin-cursor@7.19.2
- @milkdown/plugin-history@7.19.2
- @milkdown/plugin-indent@7.19.2
- @milkdown/plugin-listener@7.19.2
- @milkdown/plugin-slash@7.19.2
- @milkdown/plugin-tooltip@7.19.2
- @milkdown/plugin-trailing@7.19.2
- @milkdown/plugin-upload@7.19.2
- @milkdown/preset-commonmark@7.19.2
- @milkdown/preset-gfm@7.19.2
- @milkdown/prose@7.19.2
- @milkdown/transformer@7.19.2
- @milkdown/utils@7.19.2

## 7.19.1

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/kit/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@milkdown/kit",
"type": "module",
"version": "7.19.1",
"version": "7.19.2",
"license": "MIT",
"repository": {
"type": "git",
Expand Down
15 changes: 15 additions & 0 deletions packages/plugins/plugin-automd/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,20 @@
# @milkdown/plugin-automd

## 7.19.2

### Patch Changes

- 39f9064: Milkdown patch version release.

## Fix
- fix(plugin-clipboard, preset-gfm): fix pasting multiple tables from Google Docs (#2286)

- Updated dependencies [39f9064]
- @milkdown/core@7.19.2
- @milkdown/ctx@7.19.2
- @milkdown/prose@7.19.2
- @milkdown/utils@7.19.2

## 7.19.1

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/plugins/plugin-automd/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@milkdown/plugin-automd",
"type": "module",
"version": "7.19.1",
"version": "7.19.2",
"license": "MIT",
"repository": {
"type": "git",
Expand Down
15 changes: 15 additions & 0 deletions packages/plugins/plugin-block/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,20 @@
# @milkdown/plugin-block

## 7.19.2

### Patch Changes

- 39f9064: Milkdown patch version release.

## Fix
- fix(plugin-clipboard, preset-gfm): fix pasting multiple tables from Google Docs (#2286)

- Updated dependencies [39f9064]
- @milkdown/core@7.19.2
- @milkdown/ctx@7.19.2
- @milkdown/prose@7.19.2
- @milkdown/utils@7.19.2

## 7.19.1

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/plugins/plugin-block/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@milkdown/plugin-block",
"type": "module",
"version": "7.19.1",
"version": "7.19.2",
"license": "MIT",
"repository": {
"type": "git",
Expand Down
15 changes: 15 additions & 0 deletions packages/plugins/plugin-clipboard/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,20 @@
# @milkdown/plugin-clipboard

## 7.19.2

### Patch Changes

- 39f9064: Milkdown patch version release.

## Fix
- fix(plugin-clipboard, preset-gfm): fix pasting multiple tables from Google Docs (#2286)

- Updated dependencies [39f9064]
- @milkdown/core@7.19.2
- @milkdown/ctx@7.19.2
- @milkdown/prose@7.19.2
- @milkdown/utils@7.19.2

## 7.19.1

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/plugins/plugin-clipboard/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@milkdown/plugin-clipboard",
"type": "module",
"version": "7.19.1",
"version": "7.19.2",
"license": "MIT",
"repository": {
"type": "git",
Expand Down
Loading
Loading