2021-04-21 17:03:33 +08:00
# extendMarkRange
2021-05-17 19:00:54 +08:00
The `extendMarkRange` command expands the current selection to encompass the current mark. If the current selection doesn’ t have the specified mark, nothing changes.
2021-04-21 17:03:33 +08:00
2021-05-17 19:00:54 +08:00
## Parameters
`typeOrName: string | MarkType`
Name or type of the mark.
`attributes?: Record<string, any>`
Optionally, you can specify attributes that the extented mark must contain.
## Usage
```js
// Expand selection to link marks
editor.commands.extendMarkRange('link')
// Expand selection to link marks with specific attributes
editor.commands.extendMarkRange('link', { href: 'https://google.com' })
2021-05-28 17:45:52 +08:00
// Expand selection to link mark and update attributes
editor
.chain()
.extendMarkRange('link')
.updateAttributes('link', {
href: 'https://duckduckgo.com'
})
.run()
2021-05-17 19:00:54 +08:00
```