@tiptap/extension-ordered-list 2.0.0-beta.19 → 2.0.0-beta.194
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/packages/extension-ordered-list/src/ordered-list.d.ts +2 -1
- package/dist/tiptap-extension-ordered-list.cjs.js +9 -4
- package/dist/tiptap-extension-ordered-list.cjs.js.map +1 -1
- package/dist/tiptap-extension-ordered-list.esm.js +9 -4
- package/dist/tiptap-extension-ordered-list.esm.js.map +1 -1
- package/dist/tiptap-extension-ordered-list.umd.js +9 -4
- package/dist/tiptap-extension-ordered-list.umd.js.map +1 -1
- package/package.json +3 -4
- package/src/ordered-list.ts +11 -5
- package/LICENSE.md +0 -21
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Node } from '@tiptap/core';
|
|
2
2
|
export interface OrderedListOptions {
|
|
3
|
+
itemTypeName: string;
|
|
3
4
|
HTMLAttributes: Record<string, any>;
|
|
4
5
|
}
|
|
5
6
|
declare module '@tiptap/core' {
|
|
@@ -13,4 +14,4 @@ declare module '@tiptap/core' {
|
|
|
13
14
|
}
|
|
14
15
|
}
|
|
15
16
|
export declare const inputRegex: RegExp;
|
|
16
|
-
export declare const OrderedList: Node<OrderedListOptions>;
|
|
17
|
+
export declare const OrderedList: Node<OrderedListOptions, any>;
|
|
@@ -7,11 +7,16 @@ var core = require('@tiptap/core');
|
|
|
7
7
|
const inputRegex = /^(\d+)\.\s$/;
|
|
8
8
|
const OrderedList = core.Node.create({
|
|
9
9
|
name: 'orderedList',
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
addOptions() {
|
|
11
|
+
return {
|
|
12
|
+
itemTypeName: 'listItem',
|
|
13
|
+
HTMLAttributes: {},
|
|
14
|
+
};
|
|
12
15
|
},
|
|
13
16
|
group: 'block list',
|
|
14
|
-
content
|
|
17
|
+
content() {
|
|
18
|
+
return `${this.options.itemTypeName}+`;
|
|
19
|
+
},
|
|
15
20
|
addAttributes() {
|
|
16
21
|
return {
|
|
17
22
|
start: {
|
|
@@ -40,7 +45,7 @@ const OrderedList = core.Node.create({
|
|
|
40
45
|
addCommands() {
|
|
41
46
|
return {
|
|
42
47
|
toggleOrderedList: () => ({ commands }) => {
|
|
43
|
-
return commands.toggleList(
|
|
48
|
+
return commands.toggleList(this.name, this.options.itemTypeName);
|
|
44
49
|
},
|
|
45
50
|
};
|
|
46
51
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tiptap-extension-ordered-list.cjs.js","sources":["../src/ordered-list.ts"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"tiptap-extension-ordered-list.cjs.js","sources":["../src/ordered-list.ts"],"sourcesContent":["import { mergeAttributes, Node, wrappingInputRule } from '@tiptap/core'\n\nexport interface OrderedListOptions {\n itemTypeName: string,\n HTMLAttributes: Record<string, any>,\n}\n\ndeclare module '@tiptap/core' {\n interface Commands<ReturnType> {\n orderedList: {\n /**\n * Toggle an ordered list\n */\n toggleOrderedList: () => ReturnType,\n }\n }\n}\n\nexport const inputRegex = /^(\\d+)\\.\\s$/\n\nexport const OrderedList = Node.create<OrderedListOptions>({\n name: 'orderedList',\n\n addOptions() {\n return {\n itemTypeName: 'listItem',\n HTMLAttributes: {},\n }\n },\n\n group: 'block list',\n\n content() {\n return `${this.options.itemTypeName}+`\n },\n\n addAttributes() {\n return {\n start: {\n default: 1,\n parseHTML: element => {\n return element.hasAttribute('start')\n ? parseInt(element.getAttribute('start') || '', 10)\n : 1\n },\n },\n }\n },\n\n parseHTML() {\n return [\n {\n tag: 'ol',\n },\n ]\n },\n\n renderHTML({ HTMLAttributes }) {\n const { start, ...attributesWithoutStart } = HTMLAttributes\n\n return start === 1\n ? ['ol', mergeAttributes(this.options.HTMLAttributes, attributesWithoutStart), 0]\n : ['ol', mergeAttributes(this.options.HTMLAttributes, HTMLAttributes), 0]\n },\n\n addCommands() {\n return {\n toggleOrderedList: () => ({ commands }) => {\n return commands.toggleList(this.name, this.options.itemTypeName)\n },\n }\n },\n\n addKeyboardShortcuts() {\n return {\n 'Mod-Shift-7': () => this.editor.commands.toggleOrderedList(),\n }\n },\n\n addInputRules() {\n return [\n wrappingInputRule({\n find: inputRegex,\n type: this.type,\n getAttributes: match => ({ start: +match[1] }),\n joinPredicate: (match, node) => node.childCount + node.attrs.start === +match[1],\n }),\n ]\n },\n})\n"],"names":["Node","mergeAttributes","wrappingInputRule"],"mappings":";;;;;;AAkBO,MAAM,UAAU,GAAG,cAAa;AAE1B,MAAA,WAAW,GAAGA,SAAI,CAAC,MAAM,CAAqB;AACzD,IAAA,IAAI,EAAE,aAAa;IAEnB,UAAU,GAAA;QACR,OAAO;AACL,YAAA,YAAY,EAAE,UAAU;AACxB,YAAA,cAAc,EAAE,EAAE;SACnB,CAAA;KACF;AAED,IAAA,KAAK,EAAE,YAAY;IAEnB,OAAO,GAAA;AACL,QAAA,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,YAAY,GAAG,CAAA;KACvC;IAED,aAAa,GAAA;QACX,OAAO;AACL,YAAA,KAAK,EAAE;AACL,gBAAA,OAAO,EAAE,CAAC;gBACV,SAAS,EAAE,OAAO,IAAG;AACnB,oBAAA,OAAO,OAAO,CAAC,YAAY,CAAC,OAAO,CAAC;AAClC,0BAAE,QAAQ,CAAC,OAAO,CAAC,YAAY,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,EAAE,CAAC;0BACjD,CAAC,CAAA;iBACN;AACF,aAAA;SACF,CAAA;KACF;IAED,SAAS,GAAA;QACP,OAAO;AACL,YAAA;AACE,gBAAA,GAAG,EAAE,IAAI;AACV,aAAA;SACF,CAAA;KACF;IAED,UAAU,CAAC,EAAE,cAAc,EAAE,EAAA;QAC3B,MAAM,EAAE,KAAK,EAAE,GAAG,sBAAsB,EAAE,GAAG,cAAc,CAAA;QAE3D,OAAO,KAAK,KAAK,CAAC;AAChB,cAAE,CAAC,IAAI,EAAEC,oBAAe,CAAC,IAAI,CAAC,OAAO,CAAC,cAAc,EAAE,sBAAsB,CAAC,EAAE,CAAC,CAAC;AACjF,cAAE,CAAC,IAAI,EAAEA,oBAAe,CAAC,IAAI,CAAC,OAAO,CAAC,cAAc,EAAE,cAAc,CAAC,EAAE,CAAC,CAAC,CAAA;KAC5E;IAED,WAAW,GAAA;QACT,OAAO;YACL,iBAAiB,EAAE,MAAM,CAAC,EAAE,QAAQ,EAAE,KAAI;AACxC,gBAAA,OAAO,QAAQ,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,CAAA;aACjE;SACF,CAAA;KACF;IAED,oBAAoB,GAAA;QAClB,OAAO;YACL,aAAa,EAAE,MAAM,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,iBAAiB,EAAE;SAC9D,CAAA;KACF;IAED,aAAa,GAAA;QACX,OAAO;AACL,YAAAC,sBAAiB,CAAC;AAChB,gBAAA,IAAI,EAAE,UAAU;gBAChB,IAAI,EAAE,IAAI,CAAC,IAAI;AACf,gBAAA,aAAa,EAAE,KAAK,KAAK,EAAE,KAAK,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC;gBAC9C,aAAa,EAAE,CAAC,KAAK,EAAE,IAAI,KAAK,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC;aACjF,CAAC;SACH,CAAA;KACF;AACF,CAAA;;;;;;"}
|
|
@@ -3,11 +3,16 @@ import { Node, mergeAttributes, wrappingInputRule } from '@tiptap/core';
|
|
|
3
3
|
const inputRegex = /^(\d+)\.\s$/;
|
|
4
4
|
const OrderedList = Node.create({
|
|
5
5
|
name: 'orderedList',
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
addOptions() {
|
|
7
|
+
return {
|
|
8
|
+
itemTypeName: 'listItem',
|
|
9
|
+
HTMLAttributes: {},
|
|
10
|
+
};
|
|
8
11
|
},
|
|
9
12
|
group: 'block list',
|
|
10
|
-
content
|
|
13
|
+
content() {
|
|
14
|
+
return `${this.options.itemTypeName}+`;
|
|
15
|
+
},
|
|
11
16
|
addAttributes() {
|
|
12
17
|
return {
|
|
13
18
|
start: {
|
|
@@ -36,7 +41,7 @@ const OrderedList = Node.create({
|
|
|
36
41
|
addCommands() {
|
|
37
42
|
return {
|
|
38
43
|
toggleOrderedList: () => ({ commands }) => {
|
|
39
|
-
return commands.toggleList(
|
|
44
|
+
return commands.toggleList(this.name, this.options.itemTypeName);
|
|
40
45
|
},
|
|
41
46
|
};
|
|
42
47
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tiptap-extension-ordered-list.esm.js","sources":["../src/ordered-list.ts"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"tiptap-extension-ordered-list.esm.js","sources":["../src/ordered-list.ts"],"sourcesContent":["import { mergeAttributes, Node, wrappingInputRule } from '@tiptap/core'\n\nexport interface OrderedListOptions {\n itemTypeName: string,\n HTMLAttributes: Record<string, any>,\n}\n\ndeclare module '@tiptap/core' {\n interface Commands<ReturnType> {\n orderedList: {\n /**\n * Toggle an ordered list\n */\n toggleOrderedList: () => ReturnType,\n }\n }\n}\n\nexport const inputRegex = /^(\\d+)\\.\\s$/\n\nexport const OrderedList = Node.create<OrderedListOptions>({\n name: 'orderedList',\n\n addOptions() {\n return {\n itemTypeName: 'listItem',\n HTMLAttributes: {},\n }\n },\n\n group: 'block list',\n\n content() {\n return `${this.options.itemTypeName}+`\n },\n\n addAttributes() {\n return {\n start: {\n default: 1,\n parseHTML: element => {\n return element.hasAttribute('start')\n ? parseInt(element.getAttribute('start') || '', 10)\n : 1\n },\n },\n }\n },\n\n parseHTML() {\n return [\n {\n tag: 'ol',\n },\n ]\n },\n\n renderHTML({ HTMLAttributes }) {\n const { start, ...attributesWithoutStart } = HTMLAttributes\n\n return start === 1\n ? ['ol', mergeAttributes(this.options.HTMLAttributes, attributesWithoutStart), 0]\n : ['ol', mergeAttributes(this.options.HTMLAttributes, HTMLAttributes), 0]\n },\n\n addCommands() {\n return {\n toggleOrderedList: () => ({ commands }) => {\n return commands.toggleList(this.name, this.options.itemTypeName)\n },\n }\n },\n\n addKeyboardShortcuts() {\n return {\n 'Mod-Shift-7': () => this.editor.commands.toggleOrderedList(),\n }\n },\n\n addInputRules() {\n return [\n wrappingInputRule({\n find: inputRegex,\n type: this.type,\n getAttributes: match => ({ start: +match[1] }),\n joinPredicate: (match, node) => node.childCount + node.attrs.start === +match[1],\n }),\n ]\n },\n})\n"],"names":[],"mappings":";;AAkBO,MAAM,UAAU,GAAG,cAAa;AAE1B,MAAA,WAAW,GAAG,IAAI,CAAC,MAAM,CAAqB;AACzD,IAAA,IAAI,EAAE,aAAa;IAEnB,UAAU,GAAA;QACR,OAAO;AACL,YAAA,YAAY,EAAE,UAAU;AACxB,YAAA,cAAc,EAAE,EAAE;SACnB,CAAA;KACF;AAED,IAAA,KAAK,EAAE,YAAY;IAEnB,OAAO,GAAA;AACL,QAAA,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,YAAY,GAAG,CAAA;KACvC;IAED,aAAa,GAAA;QACX,OAAO;AACL,YAAA,KAAK,EAAE;AACL,gBAAA,OAAO,EAAE,CAAC;gBACV,SAAS,EAAE,OAAO,IAAG;AACnB,oBAAA,OAAO,OAAO,CAAC,YAAY,CAAC,OAAO,CAAC;AAClC,0BAAE,QAAQ,CAAC,OAAO,CAAC,YAAY,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,EAAE,CAAC;0BACjD,CAAC,CAAA;iBACN;AACF,aAAA;SACF,CAAA;KACF;IAED,SAAS,GAAA;QACP,OAAO;AACL,YAAA;AACE,gBAAA,GAAG,EAAE,IAAI;AACV,aAAA;SACF,CAAA;KACF;IAED,UAAU,CAAC,EAAE,cAAc,EAAE,EAAA;QAC3B,MAAM,EAAE,KAAK,EAAE,GAAG,sBAAsB,EAAE,GAAG,cAAc,CAAA;QAE3D,OAAO,KAAK,KAAK,CAAC;AAChB,cAAE,CAAC,IAAI,EAAE,eAAe,CAAC,IAAI,CAAC,OAAO,CAAC,cAAc,EAAE,sBAAsB,CAAC,EAAE,CAAC,CAAC;AACjF,cAAE,CAAC,IAAI,EAAE,eAAe,CAAC,IAAI,CAAC,OAAO,CAAC,cAAc,EAAE,cAAc,CAAC,EAAE,CAAC,CAAC,CAAA;KAC5E;IAED,WAAW,GAAA;QACT,OAAO;YACL,iBAAiB,EAAE,MAAM,CAAC,EAAE,QAAQ,EAAE,KAAI;AACxC,gBAAA,OAAO,QAAQ,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,CAAA;aACjE;SACF,CAAA;KACF;IAED,oBAAoB,GAAA;QAClB,OAAO;YACL,aAAa,EAAE,MAAM,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,iBAAiB,EAAE;SAC9D,CAAA;KACF;IAED,aAAa,GAAA;QACX,OAAO;AACL,YAAA,iBAAiB,CAAC;AAChB,gBAAA,IAAI,EAAE,UAAU;gBAChB,IAAI,EAAE,IAAI,CAAC,IAAI;AACf,gBAAA,aAAa,EAAE,KAAK,KAAK,EAAE,KAAK,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC;gBAC9C,aAAa,EAAE,CAAC,KAAK,EAAE,IAAI,KAAK,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC;aACjF,CAAC;SACH,CAAA;KACF;AACF,CAAA;;;;"}
|
|
@@ -7,11 +7,16 @@
|
|
|
7
7
|
const inputRegex = /^(\d+)\.\s$/;
|
|
8
8
|
const OrderedList = core.Node.create({
|
|
9
9
|
name: 'orderedList',
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
addOptions() {
|
|
11
|
+
return {
|
|
12
|
+
itemTypeName: 'listItem',
|
|
13
|
+
HTMLAttributes: {},
|
|
14
|
+
};
|
|
12
15
|
},
|
|
13
16
|
group: 'block list',
|
|
14
|
-
content
|
|
17
|
+
content() {
|
|
18
|
+
return `${this.options.itemTypeName}+`;
|
|
19
|
+
},
|
|
15
20
|
addAttributes() {
|
|
16
21
|
return {
|
|
17
22
|
start: {
|
|
@@ -40,7 +45,7 @@
|
|
|
40
45
|
addCommands() {
|
|
41
46
|
return {
|
|
42
47
|
toggleOrderedList: () => ({ commands }) => {
|
|
43
|
-
return commands.toggleList(
|
|
48
|
+
return commands.toggleList(this.name, this.options.itemTypeName);
|
|
44
49
|
},
|
|
45
50
|
};
|
|
46
51
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tiptap-extension-ordered-list.umd.js","sources":["../src/ordered-list.ts"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"tiptap-extension-ordered-list.umd.js","sources":["../src/ordered-list.ts"],"sourcesContent":["import { mergeAttributes, Node, wrappingInputRule } from '@tiptap/core'\n\nexport interface OrderedListOptions {\n itemTypeName: string,\n HTMLAttributes: Record<string, any>,\n}\n\ndeclare module '@tiptap/core' {\n interface Commands<ReturnType> {\n orderedList: {\n /**\n * Toggle an ordered list\n */\n toggleOrderedList: () => ReturnType,\n }\n }\n}\n\nexport const inputRegex = /^(\\d+)\\.\\s$/\n\nexport const OrderedList = Node.create<OrderedListOptions>({\n name: 'orderedList',\n\n addOptions() {\n return {\n itemTypeName: 'listItem',\n HTMLAttributes: {},\n }\n },\n\n group: 'block list',\n\n content() {\n return `${this.options.itemTypeName}+`\n },\n\n addAttributes() {\n return {\n start: {\n default: 1,\n parseHTML: element => {\n return element.hasAttribute('start')\n ? parseInt(element.getAttribute('start') || '', 10)\n : 1\n },\n },\n }\n },\n\n parseHTML() {\n return [\n {\n tag: 'ol',\n },\n ]\n },\n\n renderHTML({ HTMLAttributes }) {\n const { start, ...attributesWithoutStart } = HTMLAttributes\n\n return start === 1\n ? ['ol', mergeAttributes(this.options.HTMLAttributes, attributesWithoutStart), 0]\n : ['ol', mergeAttributes(this.options.HTMLAttributes, HTMLAttributes), 0]\n },\n\n addCommands() {\n return {\n toggleOrderedList: () => ({ commands }) => {\n return commands.toggleList(this.name, this.options.itemTypeName)\n },\n }\n },\n\n addKeyboardShortcuts() {\n return {\n 'Mod-Shift-7': () => this.editor.commands.toggleOrderedList(),\n }\n },\n\n addInputRules() {\n return [\n wrappingInputRule({\n find: inputRegex,\n type: this.type,\n getAttributes: match => ({ start: +match[1] }),\n joinPredicate: (match, node) => node.childCount + node.attrs.start === +match[1],\n }),\n ]\n },\n})\n"],"names":["Node","mergeAttributes","wrappingInputRule"],"mappings":";;;;;;AAkBO,QAAM,UAAU,GAAG,cAAa;AAE1B,QAAA,WAAW,GAAGA,SAAI,CAAC,MAAM,CAAqB;EACzD,IAAA,IAAI,EAAE,aAAa;MAEnB,UAAU,GAAA;UACR,OAAO;EACL,YAAA,YAAY,EAAE,UAAU;EACxB,YAAA,cAAc,EAAE,EAAE;WACnB,CAAA;OACF;EAED,IAAA,KAAK,EAAE,YAAY;MAEnB,OAAO,GAAA;EACL,QAAA,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,YAAY,GAAG,CAAA;OACvC;MAED,aAAa,GAAA;UACX,OAAO;EACL,YAAA,KAAK,EAAE;EACL,gBAAA,OAAO,EAAE,CAAC;kBACV,SAAS,EAAE,OAAO,IAAG;EACnB,oBAAA,OAAO,OAAO,CAAC,YAAY,CAAC,OAAO,CAAC;EAClC,0BAAE,QAAQ,CAAC,OAAO,CAAC,YAAY,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,EAAE,CAAC;4BACjD,CAAC,CAAA;mBACN;EACF,aAAA;WACF,CAAA;OACF;MAED,SAAS,GAAA;UACP,OAAO;EACL,YAAA;EACE,gBAAA,GAAG,EAAE,IAAI;EACV,aAAA;WACF,CAAA;OACF;MAED,UAAU,CAAC,EAAE,cAAc,EAAE,EAAA;UAC3B,MAAM,EAAE,KAAK,EAAE,GAAG,sBAAsB,EAAE,GAAG,cAAc,CAAA;UAE3D,OAAO,KAAK,KAAK,CAAC;EAChB,cAAE,CAAC,IAAI,EAAEC,oBAAe,CAAC,IAAI,CAAC,OAAO,CAAC,cAAc,EAAE,sBAAsB,CAAC,EAAE,CAAC,CAAC;EACjF,cAAE,CAAC,IAAI,EAAEA,oBAAe,CAAC,IAAI,CAAC,OAAO,CAAC,cAAc,EAAE,cAAc,CAAC,EAAE,CAAC,CAAC,CAAA;OAC5E;MAED,WAAW,GAAA;UACT,OAAO;cACL,iBAAiB,EAAE,MAAM,CAAC,EAAE,QAAQ,EAAE,KAAI;EACxC,gBAAA,OAAO,QAAQ,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,CAAA;eACjE;WACF,CAAA;OACF;MAED,oBAAoB,GAAA;UAClB,OAAO;cACL,aAAa,EAAE,MAAM,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,iBAAiB,EAAE;WAC9D,CAAA;OACF;MAED,aAAa,GAAA;UACX,OAAO;EACL,YAAAC,sBAAiB,CAAC;EAChB,gBAAA,IAAI,EAAE,UAAU;kBAChB,IAAI,EAAE,IAAI,CAAC,IAAI;EACf,gBAAA,aAAa,EAAE,KAAK,KAAK,EAAE,KAAK,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC;kBAC9C,aAAa,EAAE,CAAC,KAAK,EAAE,IAAI,KAAK,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC;eACjF,CAAC;WACH,CAAA;OACF;EACF,CAAA;;;;;;;;;;;;"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tiptap/extension-ordered-list",
|
|
3
3
|
"description": "ordered list extension for tiptap",
|
|
4
|
-
"version": "2.0.0-beta.
|
|
4
|
+
"version": "2.0.0-beta.194",
|
|
5
5
|
"homepage": "https://tiptap.dev",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"tiptap",
|
|
@@ -21,12 +21,11 @@
|
|
|
21
21
|
"dist"
|
|
22
22
|
],
|
|
23
23
|
"peerDependencies": {
|
|
24
|
-
"@tiptap/core": "^2.0.0-beta.
|
|
24
|
+
"@tiptap/core": "^2.0.0-beta.193"
|
|
25
25
|
},
|
|
26
26
|
"repository": {
|
|
27
27
|
"type": "git",
|
|
28
28
|
"url": "https://github.com/ueberdosis/tiptap",
|
|
29
29
|
"directory": "packages/extension-ordered-list"
|
|
30
|
-
}
|
|
31
|
-
"gitHead": "9948e2499a3aa6ca72b677ef2ca96de1db1cb6b5"
|
|
30
|
+
}
|
|
32
31
|
}
|
package/src/ordered-list.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { mergeAttributes, Node, wrappingInputRule } from '@tiptap/core'
|
|
2
2
|
|
|
3
3
|
export interface OrderedListOptions {
|
|
4
|
+
itemTypeName: string,
|
|
4
5
|
HTMLAttributes: Record<string, any>,
|
|
5
6
|
}
|
|
6
7
|
|
|
@@ -20,13 +21,18 @@ export const inputRegex = /^(\d+)\.\s$/
|
|
|
20
21
|
export const OrderedList = Node.create<OrderedListOptions>({
|
|
21
22
|
name: 'orderedList',
|
|
22
23
|
|
|
23
|
-
|
|
24
|
-
|
|
24
|
+
addOptions() {
|
|
25
|
+
return {
|
|
26
|
+
itemTypeName: 'listItem',
|
|
27
|
+
HTMLAttributes: {},
|
|
28
|
+
}
|
|
25
29
|
},
|
|
26
30
|
|
|
27
31
|
group: 'block list',
|
|
28
32
|
|
|
29
|
-
content
|
|
33
|
+
content() {
|
|
34
|
+
return `${this.options.itemTypeName}+`
|
|
35
|
+
},
|
|
30
36
|
|
|
31
37
|
addAttributes() {
|
|
32
38
|
return {
|
|
@@ -60,7 +66,7 @@ export const OrderedList = Node.create<OrderedListOptions>({
|
|
|
60
66
|
addCommands() {
|
|
61
67
|
return {
|
|
62
68
|
toggleOrderedList: () => ({ commands }) => {
|
|
63
|
-
return commands.toggleList(
|
|
69
|
+
return commands.toggleList(this.name, this.options.itemTypeName)
|
|
64
70
|
},
|
|
65
71
|
}
|
|
66
72
|
},
|
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.
|