From a4279f5762c4412b6629074300488c557e403d9b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philipp=20Ku=CC=88hn?= Date: Mon, 20 May 2019 19:58:11 +0200 Subject: [PATCH] code style --- packages/tiptap-commands/src/commands/toggleList.js | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/packages/tiptap-commands/src/commands/toggleList.js b/packages/tiptap-commands/src/commands/toggleList.js index 6e7adab3..a44e74fb 100644 --- a/packages/tiptap-commands/src/commands/toggleList.js +++ b/packages/tiptap-commands/src/commands/toggleList.js @@ -3,8 +3,8 @@ import { findParentNode } from 'prosemirror-utils' function isList(node, schema) { return (node.type === schema.nodes.bullet_list - || node.type === schema.nodes.ordered_list - || node.type === schema.nodes.todo_list) + || node.type === schema.nodes.ordered_list + || node.type === schema.nodes.todo_list) } export default function toggleList(listType, itemType) { @@ -12,6 +12,7 @@ export default function toggleList(listType, itemType) { const { schema, selection } = state const { $from, $to } = selection const range = $from.blockRange($to) + if (!range) { return false } @@ -26,7 +27,11 @@ export default function toggleList(listType, itemType) { if (isList(parentList.node, schema) && listType.validContent(parentList.node.content)) { const { tr } = state tr.setNodeMarkup(parentList.pos, listType) - if (dispatch) dispatch(tr) + + if (dispatch) { + dispatch(tr) + } + return false } }