fix: ensures nested lists always render properly

This commit is contained in:
James
2022-01-12 14:39:32 -05:00
parent d7c9d9f55b
commit 20e5dfbb4a
2 changed files with 3 additions and 1 deletions

View File

@@ -5,7 +5,9 @@ const isListActive = (editor: Editor, format: string): boolean => {
// If focus or anchor is at root of editor,
// Return false - as Editor.parent will fail
|| editor.selection.focus.path[1] === 0
// || editor.selection.focus.path.length === 0
|| editor.selection.anchor.path[1] === 0
// || editor.selection.anchor.path.length === 0
) return false;
const parentLI = Editor.parent(editor, editor.selection);

View File

@@ -3,7 +3,7 @@ import listTypes from '../listTypes';
const LI = (props) => {
const { attributes, element, children } = props;
const disableListStyle = element.children.length === 1 && listTypes.includes(element.children?.[0]?.type);
const disableListStyle = element.children.length >= 1 && listTypes.includes(element.children?.[0]?.type);
return (
<li