@tiptap/extension-task-list
Advanced tools
Comparing version 3.0.0-next.0 to 3.0.0-next.1
@@ -1,45 +0,46 @@ | ||
import { Node, mergeAttributes } from '@tiptap/core'; | ||
/** | ||
* This extension allows you to create task lists. | ||
* @see https://www.tiptap.dev/api/nodes/task-list | ||
*/ | ||
const 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/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() | ||
}; | ||
} | ||
}); | ||
export { TaskList, TaskList as default }; | ||
//# sourceMappingURL=index.js.map | ||
// src/index.ts | ||
var src_default = TaskList; | ||
export { | ||
TaskList, | ||
src_default as default | ||
}; | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "@tiptap/extension-task-list", | ||
"description": "task list extension for tiptap", | ||
"version": "3.0.0-next.0", | ||
"version": "3.0.0-next.1", | ||
"homepage": "https://tiptap.dev", | ||
@@ -18,3 +18,3 @@ "keywords": [ | ||
".": { | ||
"types": "./dist/packages/extension-task-list/src/index.d.ts", | ||
"types": "./dist/index.d.ts", | ||
"import": "./dist/index.js", | ||
@@ -26,4 +26,3 @@ "require": "./dist/index.cjs" | ||
"module": "dist/index.js", | ||
"umd": "dist/index.umd.js", | ||
"types": "dist/packages/extension-task-list/src/index.d.ts", | ||
"types": "dist/index.d.ts", | ||
"files": [ | ||
@@ -34,6 +33,6 @@ "src", | ||
"devDependencies": { | ||
"@tiptap/core": "^3.0.0-next.0" | ||
"@tiptap/core": "^3.0.0-next.1" | ||
}, | ||
"peerDependencies": { | ||
"@tiptap/core": "^3.0.0-next.0" | ||
"@tiptap/core": "^3.0.0-next.1" | ||
}, | ||
@@ -46,5 +45,4 @@ "repository": { | ||
"scripts": { | ||
"clean": "rm -rf dist", | ||
"build": "npm run clean && rollup -c" | ||
"build": "tsup" | ||
} | ||
} |
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
13636
10
214
1