The Draft framework provides support for nested lists, as demonstrated in the Facebook Notes editor. There, you can use
Tab
andShift+Tab
to add or remove depth to a list item.
正如在Facebook Notes编辑器中演示的那样,Draft框架提供了对嵌套列表的支持。因此,你能够用Tab
或者Shift+Tab
来添加或删除列表项的深度。
Implementation
The
RichUtils
module provides a handyonTab
method that manages this behavior, and should be sufficient for most nested list needs. You can use theonTab
prop on yourEditor
to make use of this utility.
[RichUtils](https://draftjs.org/docs/api-reference-rich-utils)
模块提供了一个方便的onTab方法来管理这个行为,对于大多数嵌套列表的需求应该足够了。您可以在编辑器上声明onTab prop
来使用这个能力。
By default, styling is applied to list items to set appropriate spacing and list style behavior, via
DraftStyleDefault.css
.
默认情况下,样式应用于列表项,通过DraftStyleDefault.css
来设置合适的间距和列表样式行为。
Note that there is currently no support for handling depth for blocks of any type except
'ordered-list-item'
and'unordered-list-item'
.
值得注意的是,目前不支持处理除了 'ordered-list-item'
和'unordered-list-item'
之外的任何类型的块类型。