@tiptap/extension-task-list 2.0.0-beta.21 → 2.0.0-beta.211

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs ADDED
@@ -0,0 +1,45 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});// src/task-list.ts
2
+ var _core = require('@tiptap/core');
3
+ var TaskList = _core.Node.create({
4
+ name: "taskList",
5
+ addOptions() {
6
+ return {
7
+ itemTypeName: "taskItem",
8
+ HTMLAttributes: {}
9
+ };
10
+ },
11
+ group: "block list",
12
+ content() {
13
+ return `${this.options.itemTypeName}+`;
14
+ },
15
+ parseHTML() {
16
+ return [
17
+ {
18
+ tag: `ul[data-type="${this.name}"]`,
19
+ priority: 51
20
+ }
21
+ ];
22
+ },
23
+ renderHTML({ HTMLAttributes }) {
24
+ return ["ul", _core.mergeAttributes.call(void 0, this.options.HTMLAttributes, HTMLAttributes, { "data-type": this.name }), 0];
25
+ },
26
+ addCommands() {
27
+ return {
28
+ toggleTaskList: () => ({ commands }) => {
29
+ return commands.toggleList(this.name, this.options.itemTypeName);
30
+ }
31
+ };
32
+ },
33
+ addKeyboardShortcuts() {
34
+ return {
35
+ "Mod-Shift-9": () => this.editor.commands.toggleTaskList()
36
+ };
37
+ }
38
+ });
39
+
40
+ // src/index.ts
41
+ var src_default = TaskList;
42
+
43
+
44
+
45
+ exports.TaskList = TaskList; exports.default = src_default;
@@ -1,15 +1,19 @@
1
- import { Node } from '@tiptap/core';
2
- export interface TaskListOptions {
3
- HTMLAttributes: Record<string, any>;
4
- }
5
- declare module '@tiptap/core' {
6
- interface Commands<ReturnType> {
7
- taskList: {
8
- /**
9
- * Toggle a task list
10
- */
11
- toggleTaskList: () => ReturnType;
12
- };
13
- }
14
- }
15
- export declare const TaskList: Node<TaskListOptions, any>;
1
+ import { Node } from '@tiptap/core';
2
+
3
+ interface TaskListOptions {
4
+ itemTypeName: string;
5
+ HTMLAttributes: Record<string, any>;
6
+ }
7
+ declare module '@tiptap/core' {
8
+ interface Commands<ReturnType> {
9
+ taskList: {
10
+ /**
11
+ * Toggle a task list
12
+ */
13
+ toggleTaskList: () => ReturnType;
14
+ };
15
+ }
16
+ }
17
+ declare const TaskList: Node<TaskListOptions, any>;
18
+
19
+ export { TaskList, TaskListOptions, TaskList as default };
package/dist/index.js ADDED
@@ -0,0 +1,45 @@
1
+ // src/task-list.ts
2
+ import { mergeAttributes, Node } from "@tiptap/core";
3
+ var TaskList = Node.create({
4
+ name: "taskList",
5
+ addOptions() {
6
+ return {
7
+ itemTypeName: "taskItem",
8
+ HTMLAttributes: {}
9
+ };
10
+ },
11
+ group: "block list",
12
+ content() {
13
+ return `${this.options.itemTypeName}+`;
14
+ },
15
+ parseHTML() {
16
+ return [
17
+ {
18
+ tag: `ul[data-type="${this.name}"]`,
19
+ priority: 51
20
+ }
21
+ ];
22
+ },
23
+ renderHTML({ HTMLAttributes }) {
24
+ return ["ul", mergeAttributes(this.options.HTMLAttributes, HTMLAttributes, { "data-type": this.name }), 0];
25
+ },
26
+ addCommands() {
27
+ return {
28
+ toggleTaskList: () => ({ commands }) => {
29
+ return commands.toggleList(this.name, this.options.itemTypeName);
30
+ }
31
+ };
32
+ },
33
+ addKeyboardShortcuts() {
34
+ return {
35
+ "Mod-Shift-9": () => this.editor.commands.toggleTaskList()
36
+ };
37
+ }
38
+ });
39
+
40
+ // src/index.ts
41
+ var src_default = TaskList;
42
+ export {
43
+ TaskList,
44
+ src_default as default
45
+ };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tiptap/extension-task-list",
3
3
  "description": "task list extension for tiptap",
4
- "version": "2.0.0-beta.21",
4
+ "version": "2.0.0-beta.211",
5
5
  "homepage": "https://tiptap.dev",
6
6
  "keywords": [
7
7
  "tiptap",
@@ -12,21 +12,44 @@
12
12
  "type": "github",
13
13
  "url": "https://github.com/sponsors/ueberdosis"
14
14
  },
15
- "main": "dist/tiptap-extension-task-list.cjs.js",
16
- "umd": "dist/tiptap-extension-task-list.umd.js",
17
- "module": "dist/tiptap-extension-task-list.esm.js",
18
- "types": "dist/packages/extension-task-list/src/index.d.ts",
15
+ "type": "module",
16
+ "exports": {
17
+ ".": {
18
+ "types": "./dist/index.d.ts",
19
+ "import": "./dist/index.js",
20
+ "require": "./dist/index.cjs"
21
+ }
22
+ },
23
+ "main": "dist/index.cjs",
24
+ "module": "dist/index.js",
25
+ "types": "dist/index.d.ts",
19
26
  "files": [
20
27
  "src",
21
28
  "dist"
22
29
  ],
23
30
  "peerDependencies": {
24
- "@tiptap/core": "^2.0.0-beta.1"
31
+ "@tiptap/core": "^2.0.0-beta.209"
32
+ },
33
+ "devDependencies": {
34
+ "@tiptap/core": "^2.0.0-beta.211"
25
35
  },
26
36
  "repository": {
27
37
  "type": "git",
28
38
  "url": "https://github.com/ueberdosis/tiptap",
29
39
  "directory": "packages/extension-task-list"
30
40
  },
31
- "gitHead": "d59c6958331c456931cec240aca27384d44fb67e"
41
+ "scripts": {
42
+ "build": "tsup"
43
+ },
44
+ "tsup": {
45
+ "entry": [
46
+ "src/index.ts"
47
+ ],
48
+ "dts": true,
49
+ "splitting": true,
50
+ "format": [
51
+ "esm",
52
+ "cjs"
53
+ ]
54
+ }
32
55
  }
package/src/task-list.ts CHANGED
@@ -1,6 +1,7 @@
1
- import { Node, mergeAttributes } from '@tiptap/core'
1
+ import { mergeAttributes, Node } from '@tiptap/core'
2
2
 
3
3
  export interface TaskListOptions {
4
+ itemTypeName: string,
4
5
  HTMLAttributes: Record<string, any>,
5
6
  }
6
7
 
@@ -20,31 +21,34 @@ export const TaskList = Node.create<TaskListOptions>({
20
21
 
21
22
  addOptions() {
22
23
  return {
24
+ itemTypeName: 'taskItem',
23
25
  HTMLAttributes: {},
24
26
  }
25
27
  },
26
28
 
27
29
  group: 'block list',
28
30
 
29
- content: 'taskItem+',
31
+ content() {
32
+ return `${this.options.itemTypeName}+`
33
+ },
30
34
 
31
35
  parseHTML() {
32
36
  return [
33
37
  {
34
- tag: 'ul[data-type="taskList"]',
38
+ tag: `ul[data-type="${this.name}"]`,
35
39
  priority: 51,
36
40
  },
37
41
  ]
38
42
  },
39
43
 
40
44
  renderHTML({ HTMLAttributes }) {
41
- return ['ul', mergeAttributes(this.options.HTMLAttributes, HTMLAttributes, { 'data-type': 'taskList' }), 0]
45
+ return ['ul', mergeAttributes(this.options.HTMLAttributes, HTMLAttributes, { 'data-type': this.name }), 0]
42
46
  },
43
47
 
44
48
  addCommands() {
45
49
  return {
46
50
  toggleTaskList: () => ({ commands }) => {
47
- return commands.toggleList('taskList', 'taskItem')
51
+ return commands.toggleList(this.name, this.options.itemTypeName)
48
52
  },
49
53
  }
50
54
  },
package/LICENSE.md DELETED
@@ -1,21 +0,0 @@
1
- MIT License
2
-
3
- Copyright (c) 2021, überdosis GbR
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
@@ -1,3 +0,0 @@
1
- import { TaskList } from './task-list';
2
- export * from './task-list';
3
- export default TaskList;
@@ -1,43 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- var core = require('@tiptap/core');
6
-
7
- const TaskList = core.Node.create({
8
- name: 'taskList',
9
- addOptions() {
10
- return {
11
- HTMLAttributes: {},
12
- };
13
- },
14
- group: 'block list',
15
- content: 'taskItem+',
16
- parseHTML() {
17
- return [
18
- {
19
- tag: 'ul[data-type="taskList"]',
20
- priority: 51,
21
- },
22
- ];
23
- },
24
- renderHTML({ HTMLAttributes }) {
25
- return ['ul', core.mergeAttributes(this.options.HTMLAttributes, HTMLAttributes, { 'data-type': 'taskList' }), 0];
26
- },
27
- addCommands() {
28
- return {
29
- toggleTaskList: () => ({ commands }) => {
30
- return commands.toggleList('taskList', 'taskItem');
31
- },
32
- };
33
- },
34
- addKeyboardShortcuts() {
35
- return {
36
- 'Mod-Shift-9': () => this.editor.commands.toggleTaskList(),
37
- };
38
- },
39
- });
40
-
41
- exports.TaskList = TaskList;
42
- exports["default"] = TaskList;
43
- //# sourceMappingURL=tiptap-extension-task-list.cjs.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"tiptap-extension-task-list.cjs.js","sources":["../src/task-list.ts"],"sourcesContent":["import { Node, mergeAttributes } from '@tiptap/core'\n\nexport interface TaskListOptions {\n HTMLAttributes: Record<string, any>,\n}\n\ndeclare module '@tiptap/core' {\n interface Commands<ReturnType> {\n taskList: {\n /**\n * Toggle a task list\n */\n toggleTaskList: () => ReturnType,\n }\n }\n}\n\nexport const TaskList = Node.create<TaskListOptions>({\n name: 'taskList',\n\n addOptions() {\n return {\n HTMLAttributes: {},\n }\n },\n\n group: 'block list',\n\n content: 'taskItem+',\n\n parseHTML() {\n return [\n {\n tag: 'ul[data-type=\"taskList\"]',\n priority: 51,\n },\n ]\n },\n\n renderHTML({ HTMLAttributes }) {\n return ['ul', mergeAttributes(this.options.HTMLAttributes, HTMLAttributes, { 'data-type': 'taskList' }), 0]\n },\n\n addCommands() {\n return {\n toggleTaskList: () => ({ commands }) => {\n return commands.toggleList('taskList', 'taskItem')\n },\n }\n },\n\n addKeyboardShortcuts() {\n return {\n 'Mod-Shift-9': () => this.editor.commands.toggleTaskList(),\n }\n },\n})\n"],"names":["Node","mergeAttributes"],"mappings":";;;;;;MAiBa,QAAQ,GAAGA,SAAI,CAAC,MAAM,CAAkB;IACnD,IAAI,EAAE,UAAU;IAEhB,UAAU;QACR,OAAO;YACL,cAAc,EAAE,EAAE;SACnB,CAAA;KACF;IAED,KAAK,EAAE,YAAY;IAEnB,OAAO,EAAE,WAAW;IAEpB,SAAS;QACP,OAAO;YACL;gBACE,GAAG,EAAE,0BAA0B;gBAC/B,QAAQ,EAAE,EAAE;aACb;SACF,CAAA;KACF;IAED,UAAU,CAAC,EAAE,cAAc,EAAE;QAC3B,OAAO,CAAC,IAAI,EAAEC,oBAAe,CAAC,IAAI,CAAC,OAAO,CAAC,cAAc,EAAE,cAAc,EAAE,EAAE,WAAW,EAAE,UAAU,EAAE,CAAC,EAAE,CAAC,CAAC,CAAA;KAC5G;IAED,WAAW;QACT,OAAO;YACL,cAAc,EAAE,MAAM,CAAC,EAAE,QAAQ,EAAE;gBACjC,OAAO,QAAQ,CAAC,UAAU,CAAC,UAAU,EAAE,UAAU,CAAC,CAAA;aACnD;SACF,CAAA;KACF;IAED,oBAAoB;QAClB,OAAO;YACL,aAAa,EAAE,MAAM,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,cAAc,EAAE;SAC3D,CAAA;KACF;CACF;;;;;"}
@@ -1,38 +0,0 @@
1
- import { Node, mergeAttributes } from '@tiptap/core';
2
-
3
- const TaskList = Node.create({
4
- name: 'taskList',
5
- addOptions() {
6
- return {
7
- HTMLAttributes: {},
8
- };
9
- },
10
- group: 'block list',
11
- content: 'taskItem+',
12
- parseHTML() {
13
- return [
14
- {
15
- tag: 'ul[data-type="taskList"]',
16
- priority: 51,
17
- },
18
- ];
19
- },
20
- renderHTML({ HTMLAttributes }) {
21
- return ['ul', mergeAttributes(this.options.HTMLAttributes, HTMLAttributes, { 'data-type': 'taskList' }), 0];
22
- },
23
- addCommands() {
24
- return {
25
- toggleTaskList: () => ({ commands }) => {
26
- return commands.toggleList('taskList', 'taskItem');
27
- },
28
- };
29
- },
30
- addKeyboardShortcuts() {
31
- return {
32
- 'Mod-Shift-9': () => this.editor.commands.toggleTaskList(),
33
- };
34
- },
35
- });
36
-
37
- export { TaskList, TaskList as default };
38
- //# sourceMappingURL=tiptap-extension-task-list.esm.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"tiptap-extension-task-list.esm.js","sources":["../src/task-list.ts"],"sourcesContent":["import { Node, mergeAttributes } from '@tiptap/core'\n\nexport interface TaskListOptions {\n HTMLAttributes: Record<string, any>,\n}\n\ndeclare module '@tiptap/core' {\n interface Commands<ReturnType> {\n taskList: {\n /**\n * Toggle a task list\n */\n toggleTaskList: () => ReturnType,\n }\n }\n}\n\nexport const TaskList = Node.create<TaskListOptions>({\n name: 'taskList',\n\n addOptions() {\n return {\n HTMLAttributes: {},\n }\n },\n\n group: 'block list',\n\n content: 'taskItem+',\n\n parseHTML() {\n return [\n {\n tag: 'ul[data-type=\"taskList\"]',\n priority: 51,\n },\n ]\n },\n\n renderHTML({ HTMLAttributes }) {\n return ['ul', mergeAttributes(this.options.HTMLAttributes, HTMLAttributes, { 'data-type': 'taskList' }), 0]\n },\n\n addCommands() {\n return {\n toggleTaskList: () => ({ commands }) => {\n return commands.toggleList('taskList', 'taskItem')\n },\n }\n },\n\n addKeyboardShortcuts() {\n return {\n 'Mod-Shift-9': () => this.editor.commands.toggleTaskList(),\n }\n },\n})\n"],"names":[],"mappings":";;MAiBa,QAAQ,GAAG,IAAI,CAAC,MAAM,CAAkB;IACnD,IAAI,EAAE,UAAU;IAEhB,UAAU;QACR,OAAO;YACL,cAAc,EAAE,EAAE;SACnB,CAAA;KACF;IAED,KAAK,EAAE,YAAY;IAEnB,OAAO,EAAE,WAAW;IAEpB,SAAS;QACP,OAAO;YACL;gBACE,GAAG,EAAE,0BAA0B;gBAC/B,QAAQ,EAAE,EAAE;aACb;SACF,CAAA;KACF;IAED,UAAU,CAAC,EAAE,cAAc,EAAE;QAC3B,OAAO,CAAC,IAAI,EAAE,eAAe,CAAC,IAAI,CAAC,OAAO,CAAC,cAAc,EAAE,cAAc,EAAE,EAAE,WAAW,EAAE,UAAU,EAAE,CAAC,EAAE,CAAC,CAAC,CAAA;KAC5G;IAED,WAAW;QACT,OAAO;YACL,cAAc,EAAE,MAAM,CAAC,EAAE,QAAQ,EAAE;gBACjC,OAAO,QAAQ,CAAC,UAAU,CAAC,UAAU,EAAE,UAAU,CAAC,CAAA;aACnD;SACF,CAAA;KACF;IAED,oBAAoB;QAClB,OAAO;YACL,aAAa,EAAE,MAAM,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,cAAc,EAAE;SAC3D,CAAA;KACF;CACF;;;;"}
@@ -1,47 +0,0 @@
1
- (function (global, factory) {
2
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@tiptap/core')) :
3
- typeof define === 'function' && define.amd ? define(['exports', '@tiptap/core'], factory) :
4
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["@tiptap/extension-task-list"] = {}, global.core));
5
- })(this, (function (exports, core) { 'use strict';
6
-
7
- const TaskList = core.Node.create({
8
- name: 'taskList',
9
- addOptions() {
10
- return {
11
- HTMLAttributes: {},
12
- };
13
- },
14
- group: 'block list',
15
- content: 'taskItem+',
16
- parseHTML() {
17
- return [
18
- {
19
- tag: 'ul[data-type="taskList"]',
20
- priority: 51,
21
- },
22
- ];
23
- },
24
- renderHTML({ HTMLAttributes }) {
25
- return ['ul', core.mergeAttributes(this.options.HTMLAttributes, HTMLAttributes, { 'data-type': 'taskList' }), 0];
26
- },
27
- addCommands() {
28
- return {
29
- toggleTaskList: () => ({ commands }) => {
30
- return commands.toggleList('taskList', 'taskItem');
31
- },
32
- };
33
- },
34
- addKeyboardShortcuts() {
35
- return {
36
- 'Mod-Shift-9': () => this.editor.commands.toggleTaskList(),
37
- };
38
- },
39
- });
40
-
41
- exports.TaskList = TaskList;
42
- exports["default"] = TaskList;
43
-
44
- Object.defineProperty(exports, '__esModule', { value: true });
45
-
46
- }));
47
- //# sourceMappingURL=tiptap-extension-task-list.umd.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"tiptap-extension-task-list.umd.js","sources":["../src/task-list.ts"],"sourcesContent":["import { Node, mergeAttributes } from '@tiptap/core'\n\nexport interface TaskListOptions {\n HTMLAttributes: Record<string, any>,\n}\n\ndeclare module '@tiptap/core' {\n interface Commands<ReturnType> {\n taskList: {\n /**\n * Toggle a task list\n */\n toggleTaskList: () => ReturnType,\n }\n }\n}\n\nexport const TaskList = Node.create<TaskListOptions>({\n name: 'taskList',\n\n addOptions() {\n return {\n HTMLAttributes: {},\n }\n },\n\n group: 'block list',\n\n content: 'taskItem+',\n\n parseHTML() {\n return [\n {\n tag: 'ul[data-type=\"taskList\"]',\n priority: 51,\n },\n ]\n },\n\n renderHTML({ HTMLAttributes }) {\n return ['ul', mergeAttributes(this.options.HTMLAttributes, HTMLAttributes, { 'data-type': 'taskList' }), 0]\n },\n\n addCommands() {\n return {\n toggleTaskList: () => ({ commands }) => {\n return commands.toggleList('taskList', 'taskItem')\n },\n }\n },\n\n addKeyboardShortcuts() {\n return {\n 'Mod-Shift-9': () => this.editor.commands.toggleTaskList(),\n }\n },\n})\n"],"names":["Node","mergeAttributes"],"mappings":";;;;;;QAiBa,QAAQ,GAAGA,SAAI,CAAC,MAAM,CAAkB;MACnD,IAAI,EAAE,UAAU;MAEhB,UAAU;UACR,OAAO;cACL,cAAc,EAAE,EAAE;WACnB,CAAA;OACF;MAED,KAAK,EAAE,YAAY;MAEnB,OAAO,EAAE,WAAW;MAEpB,SAAS;UACP,OAAO;cACL;kBACE,GAAG,EAAE,0BAA0B;kBAC/B,QAAQ,EAAE,EAAE;eACb;WACF,CAAA;OACF;MAED,UAAU,CAAC,EAAE,cAAc,EAAE;UAC3B,OAAO,CAAC,IAAI,EAAEC,oBAAe,CAAC,IAAI,CAAC,OAAO,CAAC,cAAc,EAAE,cAAc,EAAE,EAAE,WAAW,EAAE,UAAU,EAAE,CAAC,EAAE,CAAC,CAAC,CAAA;OAC5G;MAED,WAAW;UACT,OAAO;cACL,cAAc,EAAE,MAAM,CAAC,EAAE,QAAQ,EAAE;kBACjC,OAAO,QAAQ,CAAC,UAAU,CAAC,UAAU,EAAE,UAAU,CAAC,CAAA;eACnD;WACF,CAAA;OACF;MAED,oBAAoB;UAClB,OAAO;cACL,aAAa,EAAE,MAAM,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,cAAc,EAAE;WAC3D,CAAA;OACF;GACF;;;;;;;;;;;"}