update the heading page
This commit is contained in:
@@ -45,4 +45,33 @@ context('/api/extensions/heading', () => {
|
|||||||
.find('h3')
|
.find('h3')
|
||||||
.should('contain', 'Example Text')
|
.should('contain', 'Example Text')
|
||||||
})
|
})
|
||||||
|
|
||||||
|
it('the button should toggle the headline', () => {
|
||||||
|
cy.get('.ProseMirror h1')
|
||||||
|
.should('not.exist')
|
||||||
|
|
||||||
|
cy.get('.demo__preview button:nth-child(1)')
|
||||||
|
.click()
|
||||||
|
|
||||||
|
cy.get('.ProseMirror')
|
||||||
|
.find('h1')
|
||||||
|
.should('contain', 'Example Text')
|
||||||
|
|
||||||
|
cy.get('.demo__preview button:nth-child(1)')
|
||||||
|
.click()
|
||||||
|
|
||||||
|
cy.get('.ProseMirror h1')
|
||||||
|
.should('not.exist')
|
||||||
|
})
|
||||||
|
|
||||||
|
it('should make a headline from the default markdown shortcut', () => {
|
||||||
|
cy.get('.ProseMirror').then(([{ editor }]) => {
|
||||||
|
editor.clearContent()
|
||||||
|
})
|
||||||
|
|
||||||
|
cy.get('.ProseMirror')
|
||||||
|
.type('# Headline')
|
||||||
|
.find('h1')
|
||||||
|
.should('contain', 'Headline')
|
||||||
|
})
|
||||||
})
|
})
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
# Heading
|
# Heading
|
||||||
The Heading extension adds support for headlines. Headlines are rendered with `<h1>` to `<h6>` HTML tags. By default six headline levels are enabled, but you can pass an array to only allow a few levels, see an example below.
|
The Heading extension adds support for headings of different levels. Headings are rendered with `<h1>`, `<h2>`, `<h3>`, `<h4>`, `<h5>` or `<h6>` HTML tags. By default all six headline levels are enabled, but you can pass an array to only allow a few levels. Check the usage example to see how this is done.
|
||||||
|
|
||||||
Type `# ` at the beginning of a new line and it will be magically transformed to a headline, same for `## `, `### `, `#### `, `##### ` and `###### `.
|
Type `# ` at the beginning of a new line and it will be magically transformed to a headline, same for `## `, `### `, `#### `, `##### ` and `###### `.
|
||||||
|
|
||||||
|
|||||||
@@ -136,7 +136,6 @@
|
|||||||
link: /api/extensions/hard-break
|
link: /api/extensions/hard-break
|
||||||
- title: Heading
|
- title: Heading
|
||||||
link: /api/extensions/heading
|
link: /api/extensions/heading
|
||||||
draft: true
|
|
||||||
- title: History
|
- title: History
|
||||||
link: /api/extensions/history
|
link: /api/extensions/history
|
||||||
- title: HorizontalRule
|
- title: HorizontalRule
|
||||||
|
|||||||
@@ -41,6 +41,7 @@ export default new Node<HeadingOptions>()
|
|||||||
next()
|
next()
|
||||||
},
|
},
|
||||||
}))
|
}))
|
||||||
|
// TODO: Keyboard Shortcuts
|
||||||
.inputRules(({ options, type }) => {
|
.inputRules(({ options, type }) => {
|
||||||
return options.levels.map((level: Level) => {
|
return options.levels.map((level: Level) => {
|
||||||
return textblockTypeInputRule(new RegExp(`^(#{1,${level}})\\s$`), type, { level })
|
return textblockTypeInputRule(new RegExp(`^(#{1,${level}})\\s$`), type, { level })
|
||||||
|
|||||||
Reference in New Issue
Block a user