@tiptap/extension-task-list
Advanced tools
Comparing version 3.0.0-next.4 to 3.0.0-next.5
@@ -1,34 +0,2 @@ | ||
import { Node } from '@tiptap/core'; | ||
interface TaskListOptions { | ||
/** | ||
* The node type name for a task item. | ||
* @default 'taskItem' | ||
* @example 'myCustomTaskItem' | ||
*/ | ||
itemTypeName: string; | ||
/** | ||
* The HTML attributes for a task list node. | ||
* @default {} | ||
* @example { class: 'foo' } | ||
*/ | ||
HTMLAttributes: Record<string, any>; | ||
} | ||
declare module '@tiptap/core' { | ||
interface Commands<ReturnType> { | ||
taskList: { | ||
/** | ||
* Toggle a task list | ||
* @example editor.commands.toggleTaskList() | ||
*/ | ||
toggleTaskList: () => ReturnType; | ||
}; | ||
} | ||
} | ||
/** | ||
* This extension allows you to create task lists. | ||
* @see https://www.tiptap.dev/api/nodes/task-list | ||
*/ | ||
declare const TaskList: Node<TaskListOptions, any>; | ||
export { TaskList, type TaskListOptions, TaskList as default }; | ||
import { TaskList } from '@tiptap/extension-list'; | ||
export { TaskList, TaskListOptions, TaskList as default } from '@tiptap/extension-list'; |
@@ -1,46 +0,10 @@ | ||
// src/task-list.ts | ||
import { mergeAttributes, Node } from "@tiptap/core"; | ||
var TaskList = Node.create({ | ||
name: "taskList", | ||
addOptions() { | ||
return { | ||
itemTypeName: "taskItem", | ||
HTMLAttributes: {} | ||
}; | ||
}, | ||
group: "block list", | ||
content() { | ||
return `${this.options.itemTypeName}+`; | ||
}, | ||
parseHTML() { | ||
return [ | ||
{ | ||
tag: `ul[data-type="${this.name}"]`, | ||
priority: 51 | ||
} | ||
]; | ||
}, | ||
renderHTML({ HTMLAttributes }) { | ||
return ["ul", mergeAttributes(this.options.HTMLAttributes, HTMLAttributes, { "data-type": this.name }), 0]; | ||
}, | ||
addCommands() { | ||
return { | ||
toggleTaskList: () => ({ commands }) => { | ||
return commands.toggleList(this.name, this.options.itemTypeName); | ||
} | ||
}; | ||
}, | ||
addKeyboardShortcuts() { | ||
return { | ||
"Mod-Shift-9": () => this.editor.commands.toggleTaskList() | ||
}; | ||
} | ||
}); | ||
// src/index.ts | ||
import { TaskList } from "@tiptap/extension-list"; | ||
import { TaskList as TaskList2, TaskListOptions } from "@tiptap/extension-list"; | ||
var index_default = TaskList; | ||
export { | ||
TaskList, | ||
TaskList2 as TaskList, | ||
TaskListOptions, | ||
index_default as default | ||
}; | ||
//# sourceMappingURL=index.js.map |
MIT License | ||
Copyright (c) 2024, Tiptap GmbH | ||
Copyright (c) 2025, Tiptap GmbH | ||
@@ -5,0 +5,0 @@ Permission is hereby granted, free of charge, to any person obtaining a copy |
{ | ||
"name": "@tiptap/extension-task-list", | ||
"description": "task list extension for tiptap", | ||
"version": "3.0.0-next.4", | ||
"version": "3.0.0-next.5", | ||
"homepage": "https://tiptap.dev", | ||
@@ -34,6 +34,6 @@ "keywords": [ | ||
"devDependencies": { | ||
"@tiptap/core": "^3.0.0-next.4" | ||
"@tiptap/extension-list": "^3.0.0-next.5" | ||
}, | ||
"peerDependencies": { | ||
"@tiptap/core": "^3.0.0-next.1" | ||
"@tiptap/extension-list": "^3.0.0-next.4" | ||
}, | ||
@@ -40,0 +40,0 @@ "repository": { |
@@ -1,5 +0,5 @@ | ||
import { TaskList } from './task-list.js' | ||
import { TaskList } from '@tiptap/extension-list' | ||
export * from './task-list.js' | ||
export { TaskList, TaskListOptions } from '@tiptap/extension-list' | ||
export default TaskList |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
6052
10
48