2021-10-14 06:13:50 +08:00
|
|
|
|
---
|
|
|
|
|
description: If a bullet list doesn’t look serious enough, put some numbers in front of it.
|
2021-10-15 03:20:21 +08:00
|
|
|
|
icon: list-ordered
|
2021-10-14 06:13:50 +08:00
|
|
|
|
---
|
|
|
|
|
|
2020-08-19 03:39:41 +08:00
|
|
|
|
# OrderedList
|
2021-01-25 17:35:52 +08:00
|
|
|
|
[![Version](https://img.shields.io/npm/v/@tiptap/extension-ordered-list.svg?label=version)](https://www.npmjs.com/package/@tiptap/extension-ordered-list)
|
|
|
|
|
[![Downloads](https://img.shields.io/npm/dm/@tiptap/extension-ordered-list.svg)](https://npmcharts.com/compare/@tiptap/extension-ordered-list?minimal=true)
|
|
|
|
|
|
2020-11-03 23:13:13 +08:00
|
|
|
|
This extension enables you to use ordered lists in the editor. They are rendered as `<ol>` HTML tags.
|
2020-09-23 18:33:45 +08:00
|
|
|
|
|
|
|
|
|
Type <code>1. </code> (or any other number followed by a dot) at the beginning of a new line and it will magically transform to a ordered list.
|
2020-08-19 03:39:41 +08:00
|
|
|
|
|
2020-09-23 18:03:03 +08:00
|
|
|
|
## Installation
|
2020-09-23 15:52:04 +08:00
|
|
|
|
```bash
|
2020-10-30 21:24:16 +08:00
|
|
|
|
# with npm
|
2020-09-23 18:03:03 +08:00
|
|
|
|
npm install @tiptap/extension-ordered-list @tiptap/extension-list-item
|
2020-09-23 15:52:04 +08:00
|
|
|
|
|
2020-10-30 21:24:16 +08:00
|
|
|
|
# with Yarn
|
2020-09-23 18:03:03 +08:00
|
|
|
|
yarn add @tiptap/extension-ordered-list @tiptap/extension-list-item
|
2020-09-23 15:52:04 +08:00
|
|
|
|
```
|
|
|
|
|
|
2021-02-12 22:02:40 +08:00
|
|
|
|
This extension requires the [`ListItem`](/api/nodes/list-item) node.
|
|
|
|
|
|
2020-09-23 18:03:03 +08:00
|
|
|
|
## Settings
|
2021-10-02 05:27:39 +08:00
|
|
|
|
|
|
|
|
|
### HTMLAttributes
|
|
|
|
|
Custom HTML attributes that should be added to the rendered HTML tag.
|
|
|
|
|
|
|
|
|
|
```js
|
|
|
|
|
OrderedList.configure({
|
|
|
|
|
HTMLAttributes: {
|
|
|
|
|
class: 'my-custom-class',
|
|
|
|
|
},
|
|
|
|
|
})
|
|
|
|
|
```
|
2020-08-19 03:39:41 +08:00
|
|
|
|
|
2020-08-20 21:33:16 +08:00
|
|
|
|
## Commands
|
2021-10-02 06:14:44 +08:00
|
|
|
|
|
|
|
|
|
### toggleOrderedList()
|
|
|
|
|
Toggle an ordered list.
|
|
|
|
|
|
|
|
|
|
```js
|
|
|
|
|
editor.commands.toggleOrderedList()
|
|
|
|
|
```
|
2020-08-19 03:39:41 +08:00
|
|
|
|
|
2020-09-10 17:24:33 +08:00
|
|
|
|
## Keyboard shortcuts
|
2021-10-02 04:57:27 +08:00
|
|
|
|
| Command | Windows/Linux | macOS |
|
|
|
|
|
| ----------------- | ------------------------------- | --------------------------- |
|
|
|
|
|
| toggleOrderedList | `Control` `Shift` `7` | `Cmd` `Shift` `7` |
|
2020-08-19 03:39:41 +08:00
|
|
|
|
|
2020-09-23 18:33:45 +08:00
|
|
|
|
## Source code
|
2021-04-21 21:31:11 +08:00
|
|
|
|
[packages/extension-ordered-list/](https://github.com/ueberdosis/tiptap/blob/main/packages/extension-ordered-list/)
|
2020-08-19 03:39:41 +08:00
|
|
|
|
|
2020-09-23 18:33:45 +08:00
|
|
|
|
## Usage
|
2021-10-19 00:01:47 +08:00
|
|
|
|
https://embed.tiptap.dev/preview/Nodes/OrderedList
|