mirror of
https://github.com/makeplane/plane.git
synced 2026-07-12 05:21:14 +02:00
fix: types to insert list
This commit is contained in:
@@ -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<ReturnType> {
|
||||
flatListComponent: {
|
||||
toggleCustomList: (attrs: Record<string, any>) => 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];
|
||||
},
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user