diff --git a/packages/editor/core/src/ui/extensions/custom-list-keymap/list-helpers/get-prev-list-depth.ts b/packages/editor/core/src/ui/extensions/custom-list-keymap/list-helpers/get-prev-list-depth.ts index 0a594ce64..c2ef5535c 100644 --- a/packages/editor/core/src/ui/extensions/custom-list-keymap/list-helpers/get-prev-list-depth.ts +++ b/packages/editor/core/src/ui/extensions/custom-list-keymap/list-helpers/get-prev-list-depth.ts @@ -8,18 +8,15 @@ export const getPrevListDepth = (typeOrName: string, state: EditorState) => { return false; } - let depth = -2; - let pos = listItemPos.$pos; + let depth = 0; + const pos = listItemPos.$pos; // Adjust the position to ensure we're within the list item, especially for edge cases - // This adjustment aims to more accurately reflect the document structure - let adjustedPos = pos; - // Adjusting the position by -3 to account for the off-by-three error - adjustedPos = state.doc.resolve(Math.max(adjustedPos.pos - 3, 0)); + const resolvedPos = state.doc.resolve(Math.max(pos.pos - 1, 0)); // Traverse up the document structure from the adjusted position - for (let d = adjustedPos.depth; d > 0; d--) { - const node = adjustedPos.node(d); + for (let d = resolvedPos.depth; d > 0; d--) { + const node = resolvedPos.node(d); if (node.type.name === "bulletList" || node.type.name === "orderedList") { depth++; } diff --git a/packages/editor/core/src/ui/extensions/custom-list-keymap/list-helpers/handle-backspace.ts b/packages/editor/core/src/ui/extensions/custom-list-keymap/list-helpers/handle-backspace.ts index ee0a60757..0a1520b5f 100644 --- a/packages/editor/core/src/ui/extensions/custom-list-keymap/list-helpers/handle-backspace.ts +++ b/packages/editor/core/src/ui/extensions/custom-list-keymap/list-helpers/handle-backspace.ts @@ -6,9 +6,7 @@ import { hasListBefore } from "src/ui/extensions/custom-list-keymap/list-helpers import { hasListItemBefore } from "src/ui/extensions/custom-list-keymap/list-helpers/has-list-item-before"; import { listItemHasSubList } from "src/ui/extensions/custom-list-keymap/list-helpers/list-item-has-sub-list"; -import { isCursorInSubList } from "./is-sublist"; -import { nextListIsDeeper } from "./next-list-is-deeper"; -import { prevListIsHigher } from "./prev-list-is-deeper"; +import { prevListIsHigher } from "src/ui/extensions/custom-list-keymap/list-helpers/prev-list-is-higher"; export const handleBackspace = (editor: Editor, name: string, parentListTypes: string[]) => { // this is required to still handle the undo handling @@ -89,12 +87,13 @@ export const handleBackspace = (editor: Editor, name: string, parentListTypes: s // hasListItemBefore(name, editor.state) && // currentListItemHasSubList && // currentNodeSize > 4 && - // !previousListItemHasSubList && + // !previousListItemHasSubList isCurrentListItemSublist ) { console.log("ran 0"); - editor.chain().liftListItem(name).run(); - return editor.commands.joinItemBackward(); + // editor.chain().liftListItem(name).run(); + return false; + // return editor.commands.joinItemBackward(); // return editor.chain().liftListItem(name).run(); } diff --git a/packages/editor/core/src/ui/extensions/custom-list-keymap/list-helpers/prev-list-is-deeper.ts b/packages/editor/core/src/ui/extensions/custom-list-keymap/list-helpers/prev-list-is-higher.ts similarity index 100% rename from packages/editor/core/src/ui/extensions/custom-list-keymap/list-helpers/prev-list-is-deeper.ts rename to packages/editor/core/src/ui/extensions/custom-list-keymap/list-helpers/prev-list-is-higher.ts diff --git a/packages/editor/core/src/ui/extensions/index.tsx b/packages/editor/core/src/ui/extensions/index.tsx index bb974e496..4d61c302d 100644 --- a/packages/editor/core/src/ui/extensions/index.tsx +++ b/packages/editor/core/src/ui/extensions/index.tsx @@ -46,17 +46,17 @@ export const CoreEditorExtensions = ( StarterKit.configure({ bulletList: { HTMLAttributes: { - class: "not-prose", + class: "", }, }, orderedList: { HTMLAttributes: { - class: "not-prose", + class: "", }, }, listItem: { HTMLAttributes: { - class: "not-prose", + class: "", }, }, code: false, diff --git a/packages/editor/document-editor/src/ui/menu/fixed-menu.tsx b/packages/editor/document-editor/src/ui/menu/fixed-menu.tsx index 98a007eae..d22f1b99d 100644 --- a/packages/editor/document-editor/src/ui/menu/fixed-menu.tsx +++ b/packages/editor/document-editor/src/ui/menu/fixed-menu.tsx @@ -18,6 +18,7 @@ import { findTableAncestor, EditorMenuItem, UploadImage, + TodoListItem, } from "@plane/editor-core"; import { Selection } from "@tiptap/pm/state"; @@ -43,7 +44,7 @@ export const FixedMenu = (props: EditorBubbleMenuProps) => { StrikeThroughItem(editor), ]; - const listItems: BubbleMenuItem[] = [BulletListItem(editor), NumberedListItem(editor)]; + const listItems: BubbleMenuItem[] = [BulletListItem(editor), NumberedListItem(editor), TodoListItem(editor)]; const userActionItems: BubbleMenuItem[] = [QuoteItem(editor), CodeItem(editor)];