Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 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
5 changes: 5 additions & 0 deletions .changeset/2026-06-01-prosemirror-tables-findtable.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@tiptap/pm': patch
---

Bump `prosemirror-tables` to `^1.8.0` so `findTable` is available from `@tiptap/pm`, and align the related ProseMirror dependencies with the versions required by `prosemirror-tables`.
12 changes: 6 additions & 6 deletions demos/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,17 +31,17 @@
"prosemirror-gapcursor": "^1.3.2",
"prosemirror-history": "^1.4.1",
"prosemirror-inputrules": "^1.4.0",
"prosemirror-keymap": "^1.2.2",
"prosemirror-keymap": "^1.2.3",
"prosemirror-markdown": "^1.13.1",
"prosemirror-menu": "^1.2.4",
"prosemirror-model": "^1.24.1",
"prosemirror-model": "^1.25.7",
"prosemirror-schema-basic": "^1.2.3",
"prosemirror-schema-list": "^1.5.0",
"prosemirror-state": "^1.4.3",
"prosemirror-tables": "^1.6.2",
"prosemirror-state": "^1.4.4",
"prosemirror-tables": "^1.8.0",
"prosemirror-trailing-node": "^3.0.0",
"prosemirror-transform": "^1.10.2",
"prosemirror-view": "^1.38.1",
"prosemirror-transform": "^1.12.0",
"prosemirror-view": "^1.41.8",
"remixicon": "^2.5.0",
"shiki": "^1.25.1",
"y-webrtc": "10.3.0",
Expand Down
4 changes: 2 additions & 2 deletions demos/src/Examples/CustomDocument/index.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ test.describe(`${demoPath}/${demoName}`, () => {
await editor.evaluate((el: any) => {
el.editor.chain().focus().clearContent().insertContent('Hello world').run()
})
await editor.click()
await page.locator('.tiptap h1').click()
await page.keyboard.press('End')
await page.keyboard.press('Enter')

Expand All @@ -77,7 +77,7 @@ test.describe(`${demoPath}/${demoName}`, () => {
'Can you add some further context?',
)

await editor.type('This is a paragraph for this test document')
await page.keyboard.type('This is a paragraph for this test document')
await expect(page.locator('.tiptap p').first()).toHaveText(
'This is a paragraph for this test document',
)
Expand Down
4 changes: 2 additions & 2 deletions demos/src/Extensions/TextAlign/index.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ test.describe(`${demoPath}/${demoName}`, () => {
el.editor.commands.setContent(`<p style="text-align: ${a}">Example Text</p>`)
return el.editor.getHTML()
}, alignment)
expect(html).toBe(`<p style="text-align: ${alignment}">Example Text</p>`)
expect(html).toBe(`<p style="text-align: ${alignment};">Example Text</p>`)
})
})

Expand All @@ -59,7 +59,7 @@ test.describe(`${demoPath}/${demoName}`, () => {
const expected: string[] = []
alignments.forEach(alignment => {
headings.forEach(level => {
expected.push(`<h${level} style="text-align: ${alignment}">Example Text</h${level}>`)
expected.push(`<h${level} style="text-align: ${alignment};">Example Text</h${level}>`)
})
})
expect(result).toEqual(expected)
Expand Down
2 changes: 1 addition & 1 deletion packages/core/__tests__/insertContent.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ And more lines`)
it('respects editor.options.parseOptions if defined to be `true`', () => {
editor.options.parseOptions = { preserveWhitespace: true }
editor.commands.insertContent('<h1>Tiptap</h1><p><strong>Hello\n World</strong>\n</p>')
expect(editor.getHTML()).toContain('<h1>Tiptap</h1><p><strong>Hello World</strong></p>')
expect(editor.getHTML()).toContain('<h1>Tiptap</h1><p><strong>Hello<br> World</strong></p>')
})
})

Expand Down
4 changes: 2 additions & 2 deletions packages/extension-table/__tests__/tableCommands.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -158,15 +158,15 @@ describe('Table commands', () => {
editor.commands.clearContent()
editor.commands.insertTable({ cols: 1, rows: 1, withHeaderRow: false })
expect(editor.getHTML()).toBe(
'<table style="min-width: 25px"><colgroup><col style="min-width: 25px"></colgroup><tbody><tr><td colspan="1" rowspan="1"><p></p></td></tr></tbody></table>',
'<table style="min-width: 25px;"><colgroup><col style="min-width: 25px;"></colgroup><tbody><tr><td colspan="1" rowspan="1"><p></p></td></tr></tbody></table>',
)
})

it('generates correct markup for a 1x1 table with header', () => {
editor.commands.clearContent()
editor.commands.insertTable({ cols: 1, rows: 1, withHeaderRow: true })
expect(editor.getHTML()).toBe(
'<table style="min-width: 25px"><colgroup><col style="min-width: 25px"></colgroup><tbody><tr><th colspan="1" rowspan="1"><p></p></th></tr></tbody></table>',
'<table style="min-width: 25px;"><colgroup><col style="min-width: 25px;"></colgroup><tbody><tr><th colspan="1" rowspan="1"><p></p></th></tr></tbody></table>',
)
})

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ describe('BackgroundColor commands', () => {
editor.commands.setBackgroundColor('#958DF1')
expect(editor.isActive('textStyle', { backgroundColor: '#958DF1' })).toBe(true)
expect(editor.getHTML()).toContain(
'<span style="background-color: #958DF1">Example Text</span>',
'<span style="background-color: #958DF1;">Example Text</span>',
)
})

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ describe('Color commands', () => {
expect(editor.isActive('textStyle', { color: '#958DF1' })).toBe(false)
editor.commands.setColor('#958DF1')
expect(editor.isActive('textStyle', { color: '#958DF1' })).toBe(true)
expect(editor.getHTML()).toContain('<span style="color: #958DF1">Example Text</span>')
expect(editor.getHTML()).toContain('<span style="color: #958DF1;">Example Text</span>')
})

it('removes the color of the selected text', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ describe('FontFamily commands', () => {
expect(editor.isActive('textStyle', { fontFamily: 'monospace' })).toBe(false)
editor.commands.setFontFamily('monospace')
expect(editor.isActive('textStyle', { fontFamily: 'monospace' })).toBe(true)
expect(editor.getHTML()).toContain('<span style="font-family: monospace">Example Text</span>')
expect(editor.getHTML()).toContain('<span style="font-family: monospace;">Example Text</span>')
})

it('removes the font-family of the selected text', () => {
Expand All @@ -41,21 +41,21 @@ describe('FontFamily commands', () => {
it('allows CSS variables as a font-family', () => {
editor.commands.setFontFamily('var(--title-font-family)')
expect(editor.getHTML()).toContain(
'<span style="font-family: var(--title-font-family)">Example Text</span>',
'<span style="font-family: var(--title-font-family);">Example Text</span>',
)
})

it('allows fonts containing multiple font families', () => {
editor.commands.setFontFamily('"Comic Sans MS", "Comic Sans"')
expect(editor.getHTML()).toContain(
'<span style="font-family: &quot;Comic Sans MS&quot;, &quot;Comic Sans&quot;">Example Text</span>',
'<span style="font-family: &quot;Comic Sans MS&quot;, &quot;Comic Sans&quot;;">Example Text</span>',
)
})

it('allows fonts containing a space and number as a font-family', () => {
editor.commands.setFontFamily('"Exo 2"')
expect(editor.getHTML()).toContain(
'<span style="font-family: &quot;Exo 2&quot;">Example Text</span>',
'<span style="font-family: &quot;Exo 2&quot;;">Example Text</span>',
)
})
})
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,12 @@ describe('FontSize commands', () => {
expect(editor.isActive('textStyle', { fontSize: '28px' })).toBe(false)
editor.commands.setFontSize('28px')
expect(editor.isActive('textStyle', { fontSize: '28px' })).toBe(true)
expect(editor.getHTML()).toContain('<span style="font-size: 28px">Example Text</span>')
expect(editor.getHTML()).toContain('<span style="font-size: 28px;">Example Text</span>')
})

it('removes the font-size of the selected text', () => {
editor.commands.setFontSize('28px')
expect(editor.getHTML()).toContain('<span style="font-size: 28px">')
expect(editor.getHTML()).toContain('<span style="font-size: 28px;">')

editor.commands.unsetFontSize()
expect(editor.getHTML()).not.toContain('<span')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ describe('LineHeight commands', () => {
})

const cases = [
{ value: '1.5', style: 'line-height: 1.5' },
{ value: '2.0', style: 'line-height: 2.0' },
{ value: '4.0', style: 'line-height: 4.0' },
{ value: '1.5', style: 'line-height: 1.5;' },
{ value: '2.0', style: 'line-height: 2;' },
{ value: '4.0', style: 'line-height: 4;' },
]

cases.forEach(({ value, style }) => {
Expand All @@ -40,7 +40,7 @@ describe('LineHeight commands', () => {

it('removes the line-height of the selected text', () => {
editor.commands.toggleTextStyle({ lineHeight: '1.5' })
expect(editor.getHTML()).toContain('<span style="line-height: 1.5">')
expect(editor.getHTML()).toContain('<span style="line-height: 1.5;">')

editor.commands.unsetLineHeight()
expect(editor.getHTML()).not.toContain('<span')
Expand Down
22 changes: 11 additions & 11 deletions packages/extension-text-style/__tests__/text-style-merge.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,46 +79,46 @@ describe('TextStyleKit nested span merge', () => {
const spans = editor.view.dom.querySelectorAll('p:nth-child(4) > span')
expect(spans.length).toBe(1)
expect(spans[0].textContent?.trim()).toBe('red serif')
expect(spans[0].getAttribute('style')).toBe('color: #FF0000; font-family: serif')
expect(spans[0].getAttribute('style')).toBe('color: #FF0000; font-family: serif;')
})

it('merges styles of multiple nested spans into the innermost descendant', () => {
const spans = editor.view.dom.querySelectorAll('p:nth-child(5) > span')
expect(spans.length).toBe(1)
expect(spans[0].textContent?.trim()).toBe('blue serif')
expect(spans[0].getAttribute('style')).toBe('color: #0000FF; font-family: serif')
expect(spans[0].getAttribute('style')).toBe('color: #0000FF; font-family: serif;')
})

it('merges parent styles into each sibling descendant span', () => {
const spans = editor.view.dom.querySelectorAll('p:nth-child(6) > span')
expect(spans.length).toBe(2)
expect(spans[0].textContent?.trim()).toBe('green serif')
expect(spans[0].getAttribute('style')).toBe('color: #00FF00; font-family: serif')
expect(spans[0].getAttribute('style')).toBe('color: #00FF00; font-family: serif;')
expect(spans[1].textContent?.trim()).toBe('red serif')
expect(spans[1].getAttribute('style')).toBe('color: #FF0000; font-family: serif')
expect(spans[1].getAttribute('style')).toBe('color: #FF0000; font-family: serif;')
})

it('keeps descendant spans intact when the parent span has no style', () => {
const spans = editor.view.dom.querySelectorAll('p:nth-child(7) > span')
expect(spans.length).toBe(4)
expect(spans[0].textContent?.trim()).toBe('blue')
expect(spans[0].getAttribute('style')).toBe('color: #0000FF')
expect(spans[0].getAttribute('style')).toBe('color: #0000FF;')
expect(spans[1].textContent?.trim()).toBe('green')
expect(spans[1].getAttribute('style')).toBe('color: #00FF00')
expect(spans[1].getAttribute('style')).toBe('color: #00FF00;')
expect(spans[2].textContent?.trim()).toBe('green serif')
expect(spans[2].getAttribute('style')).toBe('color: #00FF00; font-family: serif')
expect(spans[2].getAttribute('style')).toBe('color: #00FF00; font-family: serif;')
})

it('merges parent styles into descendants while preserving root text spans', () => {
const spans = editor.view.dom.querySelectorAll('p:nth-child(8) > span')
expect(spans.length).toBe(4)
expect(spans[0].textContent?.trim()).toBe('blue')
expect(spans[0].getAttribute('style')).toBe('color: #0000FF')
expect(spans[0].getAttribute('style')).toBe('color: #0000FF;')
expect(spans[1].textContent?.trim()).toBe('green')
expect(spans[1].getAttribute('style')).toBe('color: #00FF00')
expect(spans[1].getAttribute('style')).toBe('color: #00FF00;')
expect(spans[2].textContent?.trim()).toBe('green serif')
expect(spans[2].getAttribute('style')).toBe('color: #00FF00; font-family: serif')
expect(spans[2].getAttribute('style')).toBe('color: #00FF00; font-family: serif;')
expect(spans[3].textContent?.trim()).toBe('blue serif')
expect(spans[3].getAttribute('style')).toBe('color: #0000FF; font-family: serif')
expect(spans[3].getAttribute('style')).toBe('color: #0000FF; font-family: serif;')
})
})
12 changes: 6 additions & 6 deletions packages/pm/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -152,12 +152,12 @@
"prosemirror-gapcursor": "^1.3.2",
"prosemirror-history": "^1.4.1",
"prosemirror-inputrules": "^1.4.0",
"prosemirror-keymap": "^1.2.2",
"prosemirror-model": "^1.24.1",
"prosemirror-keymap": "^1.2.3",
"prosemirror-model": "^1.25.7",
"prosemirror-schema-list": "^1.5.0",
"prosemirror-state": "^1.4.3",
"prosemirror-tables": "^1.6.4",
"prosemirror-transform": "^1.10.2",
"prosemirror-view": "^1.38.1"
"prosemirror-state": "^1.4.4",
"prosemirror-tables": "^1.8.0",
"prosemirror-transform": "^1.12.0",
"prosemirror-view": "^1.41.8"
}
}
Loading
Loading