Merge branch 'main' of github.com:ueberdosis/tiptap-next into main

This commit is contained in:
Hans Pagel
2020-09-27 10:16:49 +02:00
7 changed files with 77 additions and 19 deletions

View File

@@ -22,6 +22,20 @@ context('/api/extensions/blockquote', () => {
.should('contain', 'Example Text')
})
it('the button should wrap all nodes in a blockquote', () => {
cy.get('.ProseMirror').then(([{ editor }]) => {
editor.setContent('<p>Example Text</p><p>Example Text</p>')
editor.selectAll()
})
cy.get('.demo__preview button:first')
.click()
cy.get('.ProseMirror')
.find('blockquote')
.should('have.length', 1)
})
it('the button should toggle the blockquote', () => {
cy.get('.ProseMirror blockquote')
.should('not.exist')

View File

@@ -59,9 +59,24 @@ context('/api/extensions/code-block', () => {
})
it('should make a code block from markdown shortcuts', () => {
cy.get('.ProseMirror')
.type('``` {enter}Code')
.find('pre')
.should('contain', 'Code')
cy.get('.ProseMirror').then(([{ editor }]) => {
editor.clearContent()
cy.get('.ProseMirror')
.type('``` Code')
.find('pre>code')
.should('contain', 'Code')
})
})
it('should make a code block for js', () => {
cy.get('.ProseMirror').then(([{ editor }]) => {
editor.clearContent()
cy.get('.ProseMirror')
.type('```js Code')
.find('pre>code.language-js')
.should('contain', 'Code')
})
})
})

View File

@@ -77,12 +77,7 @@ const CustomExtension = new Node()
Dont forget to call `create()` in the end! Read more about [all the nifty details building custom extensions](/guide/custom-extensions) in our guide.
### 4. Blockquotes must not be nested anymore
:::warning Breaking Change
Currently, blockquotes must not be nested anymore. That said, were working on bringing it back. If you use nested blockquotes in your app, dont upgrade yet.
:::
### 5. Renamed API methods
### 4. Renamed API methods
[We renamed a lot of commands](/api/commands), hopefully you can migrate to the new API with search & replace. Here is a list of what changed:
| Old method name | New method name |
@@ -90,11 +85,11 @@ Currently, blockquotes must not be nested anymore. That said, were working on
| ~~`getHTML`~~ | `html` |
| ~~`getJSON`~~ | `json` |
### 6. Commands can be chained now
### 5. Commands can be chained now
### 7. .focus() isnt called on every command anymore
### 6. .focus() isnt called on every command anymore
We tried to hide the `.focus()` command from you with tiptap 1 and executed that on every other command. That led to issues in specific use cases, where you want to run a command, but dont want to focus the editor. With tiptap 2.x you have to explicitly call the `focus()` and you probably want to do that in a lot of places. Here is an example:
```js