diff --git a/packages/editor/src/core/extensions/flat-list.ts b/packages/editor/src/core/extensions/flat-list.ts index 93eec48327..d73cfd64a7 100644 --- a/packages/editor/src/core/extensions/flat-list.ts +++ b/packages/editor/src/core/extensions/flat-list.ts @@ -1,12 +1,12 @@ import { Node } from "@tiptap/core"; -import { createListSpec, createListPlugins, listKeymap, listInputRules } from "prosemirror-flat-list"; +import { createListSpec, createListPlugins, listKeymap, listInputRules, ListAttributes } from "prosemirror-flat-list"; import { keymap } from "@tiptap/pm/keymap"; import { inputRules } from "@tiptap/pm/inputrules"; declare module "@tiptap/core" { interface Commands { flatListComponent: { - toggleCustomList: (attrs: Record) => ReturnType; + createList: (attrs: ListAttributes) => ReturnType; }; } } @@ -30,6 +30,18 @@ export const FlatListExtension = Node.create({ renderHTML({ node }) { return toDOM(node); }, + + addCommands() { + return { + createList: + (attrs: ListAttributes) => + ({ commands }) => + commands.insertContent({ + type: this.name, + attrs, + }), + }; + }, addProseMirrorPlugins() { return [...createListPlugins({ schema: this.editor.schema }), listKeymapPlugin, listInputRulePlugin]; }, diff --git a/packages/editor/src/styles/editor.css b/packages/editor/src/styles/editor.css index 47af311c87..f95eb92167 100644 --- a/packages/editor/src/styles/editor.css +++ b/packages/editor/src/styles/editor.css @@ -444,3 +444,7 @@ ul[data-type="taskList"] ul[data-type="taskList"] { background-color: var(--editor-colors-purple-background); } /* end background colors */ + +.prosemirror-flat-list > .list-marker { + top: 7px; +}