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
68 changes: 63 additions & 5 deletions e2e/tests/crepe/table.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -155,11 +155,10 @@ const googleDocsTableWithoutHeader = `
`.trim()

const expectedMarkdown = `
| <br /> | <br /> | <br /> |
| :----- | :----- | :----- |
| 111 | 222 | 333 |
| 444 | 555 | 666 |
| 777 | aaa | bbb |
| 111 | 222 | 333 |
| :-- | :-- | :-- |
| 444 | 555 | 666 |
| 777 | aaa | bbb |
`.trim()

test('paste missing header tables', async ({ page }) => {
Expand All @@ -177,3 +176,62 @@ test('paste missing header tables', async ({ page }) => {
await page.keyboard.type('First Header Cell')
await expect(firstCell).toContainText('First Header Cell')
})

const googleDocsThreeRowTable = `
<meta charset='utf-8'><meta charset="utf-8"><b style="font-weight:normal;" id="docs-internal-guid-test"><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:solid #000000 1pt;vertical-align:top;padding:5pt;"><p dir="ltr"><span>A1</span></p></td><td style="border:solid #000000 1pt;vertical-align:top;padding:5pt;"><p dir="ltr"><span>B1</span></p></td><td style="border:solid #000000 1pt;vertical-align:top;padding:5pt;"><p dir="ltr"><span>C1</span></p></td></tr><tr style="height:0pt"><td style="border:solid #000000 1pt;vertical-align:top;padding:5pt;"><p dir="ltr"><span>A2</span></p></td><td style="border:solid #000000 1pt;vertical-align:top;padding:5pt;"><p dir="ltr"><span>B2</span></p></td><td style="border:solid #000000 1pt;vertical-align:top;padding:5pt;"><p dir="ltr"><span>C2</span></p></td></tr><tr style="height:0pt"><td style="border:solid #000000 1pt;vertical-align:top;padding:5pt;"><p dir="ltr"><span>A3</span></p></td><td style="border:solid #000000 1pt;vertical-align:top;padding:5pt;"><p dir="ltr"><span>B3</span></p></td><td style="border:solid #000000 1pt;vertical-align:top;padding:5pt;"><p dir="ltr"><span>C3</span></p></td></tr></tbody></table></div></b>
`.trim()

test('paste google docs table promotes first row to header', async ({
page,
}) => {
await focusEditor(page)
await paste(page, {
'text/html': googleDocsThreeRowTable,
})
await waitNextFrame(page)
const md = await getMarkdown(page)
expect(md.includes('| A1 | B1 | C1 |')).toBeTruthy()
expect(md.includes('| A2 | B2 | C2 |')).toBeTruthy()
expect(md.includes('| A3 | B3 | C3 |')).toBeTruthy()
// First row should be header, no empty <br /> headers
expect(md.includes('<br />')).toBeFalsy()
})

test('paste google docs table promotes first row even when nested in wrapper', async ({
page,
}) => {
// Google Docs wraps tables in <b><div>...<table>...</table>...</div></b>
// This tests that the paste rule traverses into wrapper nodes
await focusEditor(page)
await paste(page, {
'text/html': googleDocsTableWithoutHeader,
})
await waitNextFrame(page)
const md = await getMarkdown(page)
// The table from googleDocsTableWithoutHeader is nested inside <b><div>
// The paste rule should still find and fix it
expect(md.includes('| 111 | 222 | 333 |')).toBeTruthy()
expect(md.includes('| 444 | 555 | 666 |')).toBeTruthy()
expect(md.includes('| 777 | aaa | bbb |')).toBeTruthy()
// First row should be promoted to header, no empty <br /> headers
expect(md.includes('<br />')).toBeFalsy()
})

const googleDocsSingleRowTable = `
<meta charset='utf-8'><meta charset="utf-8"><b style="font-weight:normal;" id="docs-internal-guid-single"><div dir="ltr" style="margin-left:0pt;" align="left"><table style="border:none;border-collapse:collapse;table-layout:fixed;width:468pt"><colgroup><col /><col /></colgroup><tbody><tr style="height:0pt"><td style="border:solid #000000 1pt;vertical-align:top;padding:5pt;"><p dir="ltr"><span>Only1</span></p></td><td style="border:solid #000000 1pt;vertical-align:top;padding:5pt;"><p dir="ltr"><span>Only2</span></p></td></tr></tbody></table></div></b>
`.trim()

test('paste single row google docs table keeps empty header', async ({
page,
}) => {
await focusEditor(page)
await paste(page, {
'text/html': googleDocsSingleRowTable,
})
await waitNextFrame(page)
const md = await getMarkdown(page)
// Single row can't be promoted (would leave 0 data rows), so empty header is kept
expect(md.includes('<br />')).toBeTruthy()
expect(md.includes('Only1')).toBeTruthy()
expect(md.includes('Only2')).toBeTruthy()
})
27 changes: 27 additions & 0 deletions packages/components/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,32 @@
# @milkdown/components

## 7.19.1

### Patch Changes

- b22143f: Milkdown patch version release.

## Fix
- fix(preset-gfm): incorrect table parsing when pasting from Google Docs (#2283)
- fix(transformer): inline code with bold/italic marks produces wrong markdown (#2281)
- fix(preset-gfm): add empty content guard to table_header_row serializer (#2279)
- fix(plugin-listener): listener bug regards to debounce in react (#2268)

## Chore
- chore: bump up sugar-high version to v1 (#2280)
- chore: bump up dompurify version to v3.3.2 [SECURITY] (#2267)

- Updated dependencies [b22143f]
- @milkdown/core@7.19.1
- @milkdown/ctx@7.19.1
- @milkdown/exception@7.19.1
- @milkdown/plugin-tooltip@7.19.1
- @milkdown/preset-commonmark@7.19.1
- @milkdown/preset-gfm@7.19.1
- @milkdown/prose@7.19.1
- @milkdown/transformer@7.19.1
- @milkdown/utils@7.19.1

## 7.19.0

### Minor 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.0",
"version": "7.19.1",
"license": "MIT",
"repository": {
"type": "git",
Expand Down
22 changes: 22 additions & 0 deletions packages/core/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,27 @@
# @milkdown/core

## 7.19.1

### Patch Changes

- b22143f: Milkdown patch version release.

## Fix
- fix(preset-gfm): incorrect table parsing when pasting from Google Docs (#2283)
- fix(transformer): inline code with bold/italic marks produces wrong markdown (#2281)
- fix(preset-gfm): add empty content guard to table_header_row serializer (#2279)
- fix(plugin-listener): listener bug regards to debounce in react (#2268)

## Chore
- chore: bump up sugar-high version to v1 (#2280)
- chore: bump up dompurify version to v3.3.2 [SECURITY] (#2267)

- Updated dependencies [b22143f]
- @milkdown/ctx@7.19.1
- @milkdown/exception@7.19.1
- @milkdown/prose@7.19.1
- @milkdown/transformer@7.19.1

## 7.19.0

### Minor 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.0",
"version": "7.19.1",
"license": "MIT",
"repository": {
"type": "git",
Expand Down
19 changes: 19 additions & 0 deletions packages/crepe/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,24 @@
# @milkdown/crepe

## 7.19.1

### Patch Changes

- b22143f: Milkdown patch version release.

## Fix
- fix(preset-gfm): incorrect table parsing when pasting from Google Docs (#2283)
- fix(transformer): inline code with bold/italic marks produces wrong markdown (#2281)
- fix(preset-gfm): add empty content guard to table_header_row serializer (#2279)
- fix(plugin-listener): listener bug regards to debounce in react (#2268)

## Chore
- chore: bump up sugar-high version to v1 (#2280)
- chore: bump up dompurify version to v3.3.2 [SECURITY] (#2267)

- Updated dependencies [b22143f]
- @milkdown/kit@7.19.1

## 7.19.0

### Minor 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.0",
"version": "7.19.1",
"license": "MIT",
"repository": {
"type": "git",
Expand Down
19 changes: 19 additions & 0 deletions packages/ctx/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,24 @@
# @milkdown/ctx

## 7.19.1

### Patch Changes

- b22143f: Milkdown patch version release.

## Fix
- fix(preset-gfm): incorrect table parsing when pasting from Google Docs (#2283)
- fix(transformer): inline code with bold/italic marks produces wrong markdown (#2281)
- fix(preset-gfm): add empty content guard to table_header_row serializer (#2279)
- fix(plugin-listener): listener bug regards to debounce in react (#2268)

## Chore
- chore: bump up sugar-high version to v1 (#2280)
- chore: bump up dompurify version to v3.3.2 [SECURITY] (#2267)

- Updated dependencies [b22143f]
- @milkdown/exception@7.19.1

## 7.19.0

### Minor 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.0",
"version": "7.19.1",
"license": "MIT",
"repository": {
"type": "git",
Expand Down
16 changes: 16 additions & 0 deletions packages/exception/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,21 @@
# @milkdown/exception

## 7.19.1

### Patch Changes

- b22143f: Milkdown patch version release.

## Fix
- fix(preset-gfm): incorrect table parsing when pasting from Google Docs (#2283)
- fix(transformer): inline code with bold/italic marks produces wrong markdown (#2281)
- fix(preset-gfm): add empty content guard to table_header_row serializer (#2279)
- fix(plugin-listener): listener bug regards to debounce in react (#2268)

## Chore
- chore: bump up sugar-high version to v1 (#2280)
- chore: bump up dompurify version to v3.3.2 [SECURITY] (#2267)

## 7.19.0

### Minor 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.0",
"version": "7.19.1",
"license": "MIT",
"repository": {
"type": "git",
Expand Down
20 changes: 20 additions & 0 deletions packages/integrations/react/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,25 @@
# @milkdown/react

## 7.19.1

### Patch Changes

- b22143f: Milkdown patch version release.

## Fix
- fix(preset-gfm): incorrect table parsing when pasting from Google Docs (#2283)
- fix(transformer): inline code with bold/italic marks produces wrong markdown (#2281)
- fix(preset-gfm): add empty content guard to table_header_row serializer (#2279)
- fix(plugin-listener): listener bug regards to debounce in react (#2268)

## Chore
- chore: bump up sugar-high version to v1 (#2280)
- chore: bump up dompurify version to v3.3.2 [SECURITY] (#2267)

- Updated dependencies [b22143f]
- @milkdown/crepe@7.19.1
- @milkdown/kit@7.19.1

## 7.19.0

### Minor 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.0",
"version": "7.19.1",
"license": "MIT",
"repository": {
"type": "git",
Expand Down
20 changes: 20 additions & 0 deletions packages/integrations/vue/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,25 @@
# @milkdown/vue

## 7.19.1

### Patch Changes

- b22143f: Milkdown patch version release.

## Fix
- fix(preset-gfm): incorrect table parsing when pasting from Google Docs (#2283)
- fix(transformer): inline code with bold/italic marks produces wrong markdown (#2281)
- fix(preset-gfm): add empty content guard to table_header_row serializer (#2279)
- fix(plugin-listener): listener bug regards to debounce in react (#2268)

## Chore
- chore: bump up sugar-high version to v1 (#2280)
- chore: bump up dompurify version to v3.3.2 [SECURITY] (#2267)

- Updated dependencies [b22143f]
- @milkdown/crepe@7.19.1
- @milkdown/kit@7.19.1

## 7.19.0

### Minor 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.0",
"version": "7.19.1",
"license": "MIT",
"repository": {
"type": "git",
Expand Down
36 changes: 36 additions & 0 deletions packages/kit/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,41 @@
# @milkdown/kit

## 7.19.1

### Patch Changes

- b22143f: Milkdown patch version release.

## Fix
- fix(preset-gfm): incorrect table parsing when pasting from Google Docs (#2283)
- fix(transformer): inline code with bold/italic marks produces wrong markdown (#2281)
- fix(preset-gfm): add empty content guard to table_header_row serializer (#2279)
- fix(plugin-listener): listener bug regards to debounce in react (#2268)

## Chore
- chore: bump up sugar-high version to v1 (#2280)
- chore: bump up dompurify version to v3.3.2 [SECURITY] (#2267)

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

## 7.19.0

### Minor 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.0",
"version": "7.19.1",
"license": "MIT",
"repository": {
"type": "git",
Expand Down
Loading
Loading