code style
This commit is contained in:
@@ -3,8 +3,8 @@ import { findParentNode } from 'prosemirror-utils'
|
|||||||
|
|
||||||
function isList(node, schema) {
|
function isList(node, schema) {
|
||||||
return (node.type === schema.nodes.bullet_list
|
return (node.type === schema.nodes.bullet_list
|
||||||
|| node.type === schema.nodes.ordered_list
|
|| node.type === schema.nodes.ordered_list
|
||||||
|| node.type === schema.nodes.todo_list)
|
|| node.type === schema.nodes.todo_list)
|
||||||
}
|
}
|
||||||
|
|
||||||
export default function toggleList(listType, itemType) {
|
export default function toggleList(listType, itemType) {
|
||||||
@@ -12,6 +12,7 @@ export default function toggleList(listType, itemType) {
|
|||||||
const { schema, selection } = state
|
const { schema, selection } = state
|
||||||
const { $from, $to } = selection
|
const { $from, $to } = selection
|
||||||
const range = $from.blockRange($to)
|
const range = $from.blockRange($to)
|
||||||
|
|
||||||
if (!range) {
|
if (!range) {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
@@ -26,7 +27,11 @@ export default function toggleList(listType, itemType) {
|
|||||||
if (isList(parentList.node, schema) && listType.validContent(parentList.node.content)) {
|
if (isList(parentList.node, schema) && listType.validContent(parentList.node.content)) {
|
||||||
const { tr } = state
|
const { tr } = state
|
||||||
tr.setNodeMarkup(parentList.pos, listType)
|
tr.setNodeMarkup(parentList.pos, listType)
|
||||||
if (dispatch) dispatch(tr)
|
|
||||||
|
if (dispatch) {
|
||||||
|
dispatch(tr)
|
||||||
|
}
|
||||||
|
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user