diff --git a/docs/src/demos/Extensions/ListItem/index.spec.js b/docs/src/demos/Extensions/ListItem/index.spec.js
new file mode 100644
index 00000000..19aa202d
--- /dev/null
+++ b/docs/src/demos/Extensions/ListItem/index.spec.js
@@ -0,0 +1,5 @@
+context('/api/extensions/list-item', () => {
+ before(() => {
+ cy.visit('/api/extensions/list-item')
+ })
+})
\ No newline at end of file
diff --git a/docs/src/demos/Extensions/ListItem/index.vue b/docs/src/demos/Extensions/ListItem/index.vue
new file mode 100644
index 00000000..531a5e13
--- /dev/null
+++ b/docs/src/demos/Extensions/ListItem/index.vue
@@ -0,0 +1,73 @@
+
+
Example Text
') + editor.selectAll() + }) + }) + + it('the button should make the selected line a ordered list item', () => { + cy.get('.ProseMirror ol') + .should('not.exist') + + cy.get('.ProseMirror ol li') + .should('not.exist') + + cy.get('.demo__preview button:nth-child(1)') + .click() + + cy.get('.ProseMirror') + .find('ol') + .should('contain', 'Example Text') + + cy.get('.ProseMirror') + .find('ol li') + .should('contain', 'Example Text') + }) + + it('the button should toggle the ordered list', () => { + cy.get('.ProseMirror ol') + .should('not.exist') + + cy.get('.demo__preview button:nth-child(1)') + .click() + + cy.get('.ProseMirror') + .find('ol') + .should('contain', 'Example Text') + + cy.get('.demo__preview button:nth-child(1)') + .click() + + cy.get('.ProseMirror ol') + .should('not.exist') + }) + + it('should leave the list with double enter', () => { + cy.get('.ProseMirror').then(([{ editor }]) => { + editor.clearContent() + }) + + cy.get('.ProseMirror') + .type('1. List Item 1{enter}{enter}Paragraph') + + cy.get('.ProseMirror') + .find('li') + .its('length') + .should('eq', 1) + + cy.get('.ProseMirror') + .find('p') + .should('contain', 'Paragraph') + }) + + it('should make a ordered list from a number', () => { + cy.get('.ProseMirror').then(([{ editor }]) => { + editor.clearContent() + }) + + cy.get('.ProseMirror') + .type('1. List Item 1{enter}List Item 2') + + cy.get('.ProseMirror') + .find('li:nth-child(1)') + .should('contain', 'List Item 1') + + cy.get('.ProseMirror') + .find('li:nth-child(2)') + .should('contain', 'List Item 2') + }) + + it('should remove the ordered list after pressing backspace', () => { + cy.get('.ProseMirror').then(([{ editor }]) => { + editor.clearContent() + }) + + cy.get('.ProseMirror') + .type('1. {backspace}Example') + + cy.get('.ProseMirror') + .find('p') + .should('contain', '1. Example') + }) +}) \ No newline at end of file diff --git a/docs/src/demos/Extensions/OrderedList/index.vue b/docs/src/demos/Extensions/OrderedList/index.vue new file mode 100644 index 00000000..181e8c00 --- /dev/null +++ b/docs/src/demos/Extensions/OrderedList/index.vue @@ -0,0 +1,53 @@ + +1. (or any other number followed by a dot) at the beginning of a new line and it will magically transform to a ordered list.
## Installation
::: warning Use with ListItem
@@ -20,57 +22,15 @@ yarn add @tiptap/extension-ordered-list @tiptap/extension-list-item
| class | string | – | Add a custom class to the rendered HTML tag. |
## Commands
-| Command | Options | Description |
-| ------------ | ------- | ----------------------- |
-| ordered_list | — | Toggle an ordered list. |
+| Command | Options | Description |
+| ----------- | ------- | --------------------- |
+| ordered_list | — | Toggle a ordered list. |
## Keyboard shortcuts
* `Control` + `Shift` + `9`
+## Source code
+[packages/extension-ordered-list/](https://github.com/ueberdosis/tiptap-next/blob/main/packages/extension-ordered-list/)
+
## Usage
-```markup
-
-