@tiptap/extension-ordered-list 2.0.0-beta.2 → 2.0.0-beta.20
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/LICENSE.md +1 -1
- package/README.md +2 -2
- package/dist/packages/extension-ordered-list/src/ordered-list.d.ts +5 -7
- package/dist/tiptap-extension-ordered-list.cjs.js +15 -9
- package/dist/tiptap-extension-ordered-list.cjs.js.map +1 -1
- package/dist/tiptap-extension-ordered-list.esm.js +16 -11
- package/dist/tiptap-extension-ordered-list.esm.js.map +1 -1
- package/dist/tiptap-extension-ordered-list.umd.js +20 -13
- package/dist/tiptap-extension-ordered-list.umd.js.map +1 -1
- package/package.json +6 -5
- package/src/ordered-list.ts +18 -19
- package/CHANGELOG.md +0 -123
- package/dist/tiptap-extension-ordered-list.bundle.umd.min.js +0 -2
- package/dist/tiptap-extension-ordered-list.bundle.umd.min.js.map +0 -1
package/LICENSE.md
CHANGED
package/README.md
CHANGED
|
@@ -7,8 +7,8 @@
|
|
|
7
7
|
## Introduction
|
|
8
8
|
tiptap is a headless wrapper around [ProseMirror](https://ProseMirror.net) – a toolkit for building rich text WYSIWYG editors, which is already in use at many well-known companies such as *New York Times*, *The Guardian* or *Atlassian*.
|
|
9
9
|
|
|
10
|
-
##
|
|
10
|
+
## Official Documentation
|
|
11
11
|
Documentation can be found on the [tiptap website](https://tiptap.dev).
|
|
12
12
|
|
|
13
13
|
## License
|
|
14
|
-
tiptap is open sourced software licensed under the [MIT license](https://github.com/ueberdosis/tiptap
|
|
14
|
+
tiptap is open sourced software licensed under the [MIT license](https://github.com/ueberdosis/tiptap/blob/main/LICENSE.md).
|
|
@@ -1,18 +1,16 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Node } from '@tiptap/core';
|
|
2
2
|
export interface OrderedListOptions {
|
|
3
|
-
HTMLAttributes:
|
|
4
|
-
[key: string]: any;
|
|
5
|
-
};
|
|
3
|
+
HTMLAttributes: Record<string, any>;
|
|
6
4
|
}
|
|
7
5
|
declare module '@tiptap/core' {
|
|
8
|
-
interface Commands {
|
|
6
|
+
interface Commands<ReturnType> {
|
|
9
7
|
orderedList: {
|
|
10
8
|
/**
|
|
11
9
|
* Toggle an ordered list
|
|
12
10
|
*/
|
|
13
|
-
toggleOrderedList: () =>
|
|
11
|
+
toggleOrderedList: () => ReturnType;
|
|
14
12
|
};
|
|
15
13
|
}
|
|
16
14
|
}
|
|
17
15
|
export declare const inputRegex: RegExp;
|
|
18
|
-
export declare const OrderedList: Node<OrderedListOptions>;
|
|
16
|
+
export declare const OrderedList: Node<OrderedListOptions, any>;
|
|
@@ -3,13 +3,14 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
var core = require('@tiptap/core');
|
|
6
|
-
var prosemirrorInputrules = require('prosemirror-inputrules');
|
|
7
6
|
|
|
8
7
|
const inputRegex = /^(\d+)\.\s$/;
|
|
9
8
|
const OrderedList = core.Node.create({
|
|
10
9
|
name: 'orderedList',
|
|
11
|
-
|
|
12
|
-
|
|
10
|
+
addOptions() {
|
|
11
|
+
return {
|
|
12
|
+
HTMLAttributes: {},
|
|
13
|
+
};
|
|
13
14
|
},
|
|
14
15
|
group: 'block list',
|
|
15
16
|
content: 'listItem+',
|
|
@@ -17,11 +18,11 @@ const OrderedList = core.Node.create({
|
|
|
17
18
|
return {
|
|
18
19
|
start: {
|
|
19
20
|
default: 1,
|
|
20
|
-
parseHTML: element =>
|
|
21
|
-
|
|
21
|
+
parseHTML: element => {
|
|
22
|
+
return element.hasAttribute('start')
|
|
22
23
|
? parseInt(element.getAttribute('start') || '', 10)
|
|
23
|
-
: 1
|
|
24
|
-
}
|
|
24
|
+
: 1;
|
|
25
|
+
},
|
|
25
26
|
},
|
|
26
27
|
};
|
|
27
28
|
},
|
|
@@ -52,12 +53,17 @@ const OrderedList = core.Node.create({
|
|
|
52
53
|
},
|
|
53
54
|
addInputRules() {
|
|
54
55
|
return [
|
|
55
|
-
|
|
56
|
+
core.wrappingInputRule({
|
|
57
|
+
find: inputRegex,
|
|
58
|
+
type: this.type,
|
|
59
|
+
getAttributes: match => ({ start: +match[1] }),
|
|
60
|
+
joinPredicate: (match, node) => node.childCount + node.attrs.start === +match[1],
|
|
61
|
+
}),
|
|
56
62
|
];
|
|
57
63
|
},
|
|
58
64
|
});
|
|
59
65
|
|
|
60
66
|
exports.OrderedList = OrderedList;
|
|
61
|
-
exports
|
|
67
|
+
exports["default"] = OrderedList;
|
|
62
68
|
exports.inputRegex = inputRegex;
|
|
63
69
|
//# sourceMappingURL=tiptap-extension-ordered-list.cjs.js.map
|
|
@@ -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 { Node, mergeAttributes, wrappingInputRule } from '@tiptap/core'\n\nexport interface OrderedListOptions {\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 HTMLAttributes: {},\n }\n },\n\n group: 'block list',\n\n content: 'listItem+',\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('orderedList', 'listItem')\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":";;;;;;MAiBa,UAAU,GAAG,cAAa;MAE1B,WAAW,GAAGA,SAAI,CAAC,MAAM,CAAqB;IACzD,IAAI,EAAE,aAAa;IAEnB,UAAU;QACR,OAAO;YACL,cAAc,EAAE,EAAE;SACnB,CAAA;KACF;IAED,KAAK,EAAE,YAAY;IAEnB,OAAO,EAAE,WAAW;IAEpB,aAAa;QACX,OAAO;YACL,KAAK,EAAE;gBACL,OAAO,EAAE,CAAC;gBACV,SAAS,EAAE,OAAO;oBAChB,OAAO,OAAO,CAAC,YAAY,CAAC,OAAO,CAAC;0BAChC,QAAQ,CAAC,OAAO,CAAC,YAAY,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,EAAE,CAAC;0BACjD,CAAC,CAAA;iBACN;aACF;SACF,CAAA;KACF;IAED,SAAS;QACP,OAAO;YACL;gBACE,GAAG,EAAE,IAAI;aACV;SACF,CAAA;KACF;IAED,UAAU,CAAC,EAAE,cAAc,EAAE;QAC3B,MAAM,EAAE,KAAK,EAAE,GAAG,sBAAsB,EAAE,GAAG,cAAc,CAAA;QAE3D,OAAO,KAAK,KAAK,CAAC;cACd,CAAC,IAAI,EAAEC,oBAAe,CAAC,IAAI,CAAC,OAAO,CAAC,cAAc,EAAE,sBAAsB,CAAC,EAAE,CAAC,CAAC;cAC/E,CAAC,IAAI,EAAEA,oBAAe,CAAC,IAAI,CAAC,OAAO,CAAC,cAAc,EAAE,cAAc,CAAC,EAAE,CAAC,CAAC,CAAA;KAC5E;IAED,WAAW;QACT,OAAO;YACL,iBAAiB,EAAE,MAAM,CAAC,EAAE,QAAQ,EAAE;gBACpC,OAAO,QAAQ,CAAC,UAAU,CAAC,aAAa,EAAE,UAAU,CAAC,CAAA;aACtD;SACF,CAAA;KACF;IAED,oBAAoB;QAClB,OAAO;YACL,aAAa,EAAE,MAAM,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,iBAAiB,EAAE;SAC9D,CAAA;KACF;IAED,aAAa;QACX,OAAO;YACLC,sBAAiB,CAAC;gBAChB,IAAI,EAAE,UAAU;gBAChB,IAAI,EAAE,IAAI,CAAC,IAAI;gBACf,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;CACF;;;;;;"}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import { Node, mergeAttributes } from '@tiptap/core';
|
|
2
|
-
import { wrappingInputRule } from 'prosemirror-inputrules';
|
|
1
|
+
import { Node, mergeAttributes, wrappingInputRule } from '@tiptap/core';
|
|
3
2
|
|
|
4
3
|
const inputRegex = /^(\d+)\.\s$/;
|
|
5
4
|
const OrderedList = Node.create({
|
|
6
5
|
name: 'orderedList',
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
addOptions() {
|
|
7
|
+
return {
|
|
8
|
+
HTMLAttributes: {},
|
|
9
|
+
};
|
|
9
10
|
},
|
|
10
11
|
group: 'block list',
|
|
11
12
|
content: 'listItem+',
|
|
@@ -13,11 +14,11 @@ const OrderedList = Node.create({
|
|
|
13
14
|
return {
|
|
14
15
|
start: {
|
|
15
16
|
default: 1,
|
|
16
|
-
parseHTML: element =>
|
|
17
|
-
|
|
17
|
+
parseHTML: element => {
|
|
18
|
+
return element.hasAttribute('start')
|
|
18
19
|
? parseInt(element.getAttribute('start') || '', 10)
|
|
19
|
-
: 1
|
|
20
|
-
}
|
|
20
|
+
: 1;
|
|
21
|
+
},
|
|
21
22
|
},
|
|
22
23
|
};
|
|
23
24
|
},
|
|
@@ -48,11 +49,15 @@ const OrderedList = Node.create({
|
|
|
48
49
|
},
|
|
49
50
|
addInputRules() {
|
|
50
51
|
return [
|
|
51
|
-
wrappingInputRule(
|
|
52
|
+
wrappingInputRule({
|
|
53
|
+
find: inputRegex,
|
|
54
|
+
type: this.type,
|
|
55
|
+
getAttributes: match => ({ start: +match[1] }),
|
|
56
|
+
joinPredicate: (match, node) => node.childCount + node.attrs.start === +match[1],
|
|
57
|
+
}),
|
|
52
58
|
];
|
|
53
59
|
},
|
|
54
60
|
});
|
|
55
61
|
|
|
56
|
-
export default
|
|
57
|
-
export { OrderedList, inputRegex };
|
|
62
|
+
export { OrderedList, OrderedList as default, inputRegex };
|
|
58
63
|
//# sourceMappingURL=tiptap-extension-ordered-list.esm.js.map
|
|
@@ -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 { Node, mergeAttributes, wrappingInputRule } from '@tiptap/core'\n\nexport interface OrderedListOptions {\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 HTMLAttributes: {},\n }\n },\n\n group: 'block list',\n\n content: 'listItem+',\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('orderedList', 'listItem')\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":";;MAiBa,UAAU,GAAG,cAAa;MAE1B,WAAW,GAAG,IAAI,CAAC,MAAM,CAAqB;IACzD,IAAI,EAAE,aAAa;IAEnB,UAAU;QACR,OAAO;YACL,cAAc,EAAE,EAAE;SACnB,CAAA;KACF;IAED,KAAK,EAAE,YAAY;IAEnB,OAAO,EAAE,WAAW;IAEpB,aAAa;QACX,OAAO;YACL,KAAK,EAAE;gBACL,OAAO,EAAE,CAAC;gBACV,SAAS,EAAE,OAAO;oBAChB,OAAO,OAAO,CAAC,YAAY,CAAC,OAAO,CAAC;0BAChC,QAAQ,CAAC,OAAO,CAAC,YAAY,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,EAAE,CAAC;0BACjD,CAAC,CAAA;iBACN;aACF;SACF,CAAA;KACF;IAED,SAAS;QACP,OAAO;YACL;gBACE,GAAG,EAAE,IAAI;aACV;SACF,CAAA;KACF;IAED,UAAU,CAAC,EAAE,cAAc,EAAE;QAC3B,MAAM,EAAE,KAAK,EAAE,GAAG,sBAAsB,EAAE,GAAG,cAAc,CAAA;QAE3D,OAAO,KAAK,KAAK,CAAC;cACd,CAAC,IAAI,EAAE,eAAe,CAAC,IAAI,CAAC,OAAO,CAAC,cAAc,EAAE,sBAAsB,CAAC,EAAE,CAAC,CAAC;cAC/E,CAAC,IAAI,EAAE,eAAe,CAAC,IAAI,CAAC,OAAO,CAAC,cAAc,EAAE,cAAc,CAAC,EAAE,CAAC,CAAC,CAAA;KAC5E;IAED,WAAW;QACT,OAAO;YACL,iBAAiB,EAAE,MAAM,CAAC,EAAE,QAAQ,EAAE;gBACpC,OAAO,QAAQ,CAAC,UAAU,CAAC,aAAa,EAAE,UAAU,CAAC,CAAA;aACtD;SACF,CAAA;KACF;IAED,oBAAoB;QAClB,OAAO;YACL,aAAa,EAAE,MAAM,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,iBAAiB,EAAE;SAC9D,CAAA;KACF;IAED,aAAa;QACX,OAAO;YACL,iBAAiB,CAAC;gBAChB,IAAI,EAAE,UAAU;gBAChB,IAAI,EAAE,IAAI,CAAC,IAAI;gBACf,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;CACF;;;;"}
|
|
@@ -1,14 +1,16 @@
|
|
|
1
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'
|
|
4
|
-
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global[
|
|
5
|
-
}(this, (function (exports, core
|
|
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-ordered-list"] = {}, global.core));
|
|
5
|
+
})(this, (function (exports, core) { 'use strict';
|
|
6
6
|
|
|
7
7
|
const inputRegex = /^(\d+)\.\s$/;
|
|
8
8
|
const OrderedList = core.Node.create({
|
|
9
9
|
name: 'orderedList',
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
addOptions() {
|
|
11
|
+
return {
|
|
12
|
+
HTMLAttributes: {},
|
|
13
|
+
};
|
|
12
14
|
},
|
|
13
15
|
group: 'block list',
|
|
14
16
|
content: 'listItem+',
|
|
@@ -16,11 +18,11 @@
|
|
|
16
18
|
return {
|
|
17
19
|
start: {
|
|
18
20
|
default: 1,
|
|
19
|
-
parseHTML: element =>
|
|
20
|
-
|
|
21
|
+
parseHTML: element => {
|
|
22
|
+
return element.hasAttribute('start')
|
|
21
23
|
? parseInt(element.getAttribute('start') || '', 10)
|
|
22
|
-
: 1
|
|
23
|
-
}
|
|
24
|
+
: 1;
|
|
25
|
+
},
|
|
24
26
|
},
|
|
25
27
|
};
|
|
26
28
|
},
|
|
@@ -51,16 +53,21 @@
|
|
|
51
53
|
},
|
|
52
54
|
addInputRules() {
|
|
53
55
|
return [
|
|
54
|
-
|
|
56
|
+
core.wrappingInputRule({
|
|
57
|
+
find: inputRegex,
|
|
58
|
+
type: this.type,
|
|
59
|
+
getAttributes: match => ({ start: +match[1] }),
|
|
60
|
+
joinPredicate: (match, node) => node.childCount + node.attrs.start === +match[1],
|
|
61
|
+
}),
|
|
55
62
|
];
|
|
56
63
|
},
|
|
57
64
|
});
|
|
58
65
|
|
|
59
66
|
exports.OrderedList = OrderedList;
|
|
60
|
-
exports
|
|
67
|
+
exports["default"] = OrderedList;
|
|
61
68
|
exports.inputRegex = inputRegex;
|
|
62
69
|
|
|
63
70
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
64
71
|
|
|
65
|
-
}))
|
|
72
|
+
}));
|
|
66
73
|
//# sourceMappingURL=tiptap-extension-ordered-list.umd.js.map
|
|
@@ -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 { Node, mergeAttributes, wrappingInputRule } from '@tiptap/core'\n\nexport interface OrderedListOptions {\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 HTMLAttributes: {},\n }\n },\n\n group: 'block list',\n\n content: 'listItem+',\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('orderedList', 'listItem')\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":";;;;;;QAiBa,UAAU,GAAG,cAAa;QAE1B,WAAW,GAAGA,SAAI,CAAC,MAAM,CAAqB;MACzD,IAAI,EAAE,aAAa;MAEnB,UAAU;UACR,OAAO;cACL,cAAc,EAAE,EAAE;WACnB,CAAA;OACF;MAED,KAAK,EAAE,YAAY;MAEnB,OAAO,EAAE,WAAW;MAEpB,aAAa;UACX,OAAO;cACL,KAAK,EAAE;kBACL,OAAO,EAAE,CAAC;kBACV,SAAS,EAAE,OAAO;sBAChB,OAAO,OAAO,CAAC,YAAY,CAAC,OAAO,CAAC;4BAChC,QAAQ,CAAC,OAAO,CAAC,YAAY,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,EAAE,CAAC;4BACjD,CAAC,CAAA;mBACN;eACF;WACF,CAAA;OACF;MAED,SAAS;UACP,OAAO;cACL;kBACE,GAAG,EAAE,IAAI;eACV;WACF,CAAA;OACF;MAED,UAAU,CAAC,EAAE,cAAc,EAAE;UAC3B,MAAM,EAAE,KAAK,EAAE,GAAG,sBAAsB,EAAE,GAAG,cAAc,CAAA;UAE3D,OAAO,KAAK,KAAK,CAAC;gBACd,CAAC,IAAI,EAAEC,oBAAe,CAAC,IAAI,CAAC,OAAO,CAAC,cAAc,EAAE,sBAAsB,CAAC,EAAE,CAAC,CAAC;gBAC/E,CAAC,IAAI,EAAEA,oBAAe,CAAC,IAAI,CAAC,OAAO,CAAC,cAAc,EAAE,cAAc,CAAC,EAAE,CAAC,CAAC,CAAA;OAC5E;MAED,WAAW;UACT,OAAO;cACL,iBAAiB,EAAE,MAAM,CAAC,EAAE,QAAQ,EAAE;kBACpC,OAAO,QAAQ,CAAC,UAAU,CAAC,aAAa,EAAE,UAAU,CAAC,CAAA;eACtD;WACF,CAAA;OACF;MAED,oBAAoB;UAClB,OAAO;cACL,aAAa,EAAE,MAAM,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,iBAAiB,EAAE;WAC9D,CAAA;OACF;MAED,aAAa;UACX,OAAO;cACLC,sBAAiB,CAAC;kBAChB,IAAI,EAAE,UAAU;kBAChB,IAAI,EAAE,IAAI,CAAC,IAAI;kBACf,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;GACF;;;;;;;;;;;;"}
|
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.20",
|
|
5
5
|
"homepage": "https://tiptap.dev",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"tiptap",
|
|
@@ -15,7 +15,6 @@
|
|
|
15
15
|
"main": "dist/tiptap-extension-ordered-list.cjs.js",
|
|
16
16
|
"umd": "dist/tiptap-extension-ordered-list.umd.js",
|
|
17
17
|
"module": "dist/tiptap-extension-ordered-list.esm.js",
|
|
18
|
-
"unpkg": "dist/tiptap-extension-ordered-list.bundle.umd.min.js",
|
|
19
18
|
"types": "dist/packages/extension-ordered-list/src/index.d.ts",
|
|
20
19
|
"files": [
|
|
21
20
|
"src",
|
|
@@ -24,8 +23,10 @@
|
|
|
24
23
|
"peerDependencies": {
|
|
25
24
|
"@tiptap/core": "^2.0.0-beta.1"
|
|
26
25
|
},
|
|
27
|
-
"
|
|
28
|
-
"
|
|
26
|
+
"repository": {
|
|
27
|
+
"type": "git",
|
|
28
|
+
"url": "https://github.com/ueberdosis/tiptap",
|
|
29
|
+
"directory": "packages/extension-ordered-list"
|
|
29
30
|
},
|
|
30
|
-
"gitHead": "
|
|
31
|
+
"gitHead": "642627ec3635a1d8fa851887d75bee5f193ec63b"
|
|
31
32
|
}
|
package/src/ordered-list.ts
CHANGED
|
@@ -1,19 +1,16 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { wrappingInputRule } from 'prosemirror-inputrules'
|
|
1
|
+
import { Node, mergeAttributes, wrappingInputRule } from '@tiptap/core'
|
|
3
2
|
|
|
4
3
|
export interface OrderedListOptions {
|
|
5
|
-
HTMLAttributes:
|
|
6
|
-
[key: string]: any
|
|
7
|
-
},
|
|
4
|
+
HTMLAttributes: Record<string, any>,
|
|
8
5
|
}
|
|
9
6
|
|
|
10
7
|
declare module '@tiptap/core' {
|
|
11
|
-
interface Commands {
|
|
8
|
+
interface Commands<ReturnType> {
|
|
12
9
|
orderedList: {
|
|
13
10
|
/**
|
|
14
11
|
* Toggle an ordered list
|
|
15
12
|
*/
|
|
16
|
-
toggleOrderedList: () =>
|
|
13
|
+
toggleOrderedList: () => ReturnType,
|
|
17
14
|
}
|
|
18
15
|
}
|
|
19
16
|
}
|
|
@@ -23,8 +20,10 @@ export const inputRegex = /^(\d+)\.\s$/
|
|
|
23
20
|
export const OrderedList = Node.create<OrderedListOptions>({
|
|
24
21
|
name: 'orderedList',
|
|
25
22
|
|
|
26
|
-
|
|
27
|
-
|
|
23
|
+
addOptions() {
|
|
24
|
+
return {
|
|
25
|
+
HTMLAttributes: {},
|
|
26
|
+
}
|
|
28
27
|
},
|
|
29
28
|
|
|
30
29
|
group: 'block list',
|
|
@@ -35,11 +34,11 @@ export const OrderedList = Node.create<OrderedListOptions>({
|
|
|
35
34
|
return {
|
|
36
35
|
start: {
|
|
37
36
|
default: 1,
|
|
38
|
-
parseHTML: element =>
|
|
39
|
-
|
|
37
|
+
parseHTML: element => {
|
|
38
|
+
return element.hasAttribute('start')
|
|
40
39
|
? parseInt(element.getAttribute('start') || '', 10)
|
|
41
|
-
: 1
|
|
42
|
-
}
|
|
40
|
+
: 1
|
|
41
|
+
},
|
|
43
42
|
},
|
|
44
43
|
}
|
|
45
44
|
},
|
|
@@ -76,12 +75,12 @@ export const OrderedList = Node.create<OrderedListOptions>({
|
|
|
76
75
|
|
|
77
76
|
addInputRules() {
|
|
78
77
|
return [
|
|
79
|
-
wrappingInputRule(
|
|
80
|
-
inputRegex,
|
|
81
|
-
this.type,
|
|
82
|
-
match => ({
|
|
83
|
-
(match, node) => node.childCount + node.attrs.
|
|
84
|
-
),
|
|
78
|
+
wrappingInputRule({
|
|
79
|
+
find: inputRegex,
|
|
80
|
+
type: this.type,
|
|
81
|
+
getAttributes: match => ({ start: +match[1] }),
|
|
82
|
+
joinPredicate: (match, node) => node.childCount + node.attrs.start === +match[1],
|
|
83
|
+
}),
|
|
85
84
|
]
|
|
86
85
|
},
|
|
87
86
|
})
|
package/CHANGELOG.md
DELETED
|
@@ -1,123 +0,0 @@
|
|
|
1
|
-
# Change Log
|
|
2
|
-
|
|
3
|
-
All notable changes to this project will be documented in this file.
|
|
4
|
-
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
|
-
|
|
6
|
-
# [2.0.0-beta.2](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/extension-ordered-list@2.0.0-beta.1...@tiptap/extension-ordered-list@2.0.0-beta.2) (2021-04-15)
|
|
7
|
-
|
|
8
|
-
**Note:** Version bump only for package @tiptap/extension-ordered-list
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
# [2.0.0-beta.1](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/extension-ordered-list@2.0.0-alpha.11...@tiptap/extension-ordered-list@2.0.0-beta.1) (2021-03-05)
|
|
15
|
-
|
|
16
|
-
**Note:** Version bump only for package @tiptap/extension-ordered-list
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
# [2.0.0-alpha.11](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/extension-ordered-list@2.0.0-alpha.10...@tiptap/extension-ordered-list@2.0.0-alpha.11) (2021-02-16)
|
|
23
|
-
|
|
24
|
-
**Note:** Version bump only for package @tiptap/extension-ordered-list
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
# [2.0.0-alpha.10](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/extension-ordered-list@2.0.0-alpha.9...@tiptap/extension-ordered-list@2.0.0-alpha.10) (2021-02-07)
|
|
31
|
-
|
|
32
|
-
**Note:** Version bump only for package @tiptap/extension-ordered-list
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
# [2.0.0-alpha.9](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/extension-ordered-list@2.0.0-alpha.8...@tiptap/extension-ordered-list@2.0.0-alpha.9) (2021-02-05)
|
|
39
|
-
|
|
40
|
-
**Note:** Version bump only for package @tiptap/extension-ordered-list
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
# [2.0.0-alpha.8](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/extension-ordered-list@2.0.0-alpha.7...@tiptap/extension-ordered-list@2.0.0-alpha.8) (2021-01-29)
|
|
47
|
-
|
|
48
|
-
**Note:** Version bump only for package @tiptap/extension-ordered-list
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
# [2.0.0-alpha.7](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/extension-ordered-list@2.0.0-alpha.6...@tiptap/extension-ordered-list@2.0.0-alpha.7) (2021-01-29)
|
|
55
|
-
|
|
56
|
-
**Note:** Version bump only for package @tiptap/extension-ordered-list
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
# [2.0.0-alpha.6](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/extension-ordered-list@2.0.0-alpha.5...@tiptap/extension-ordered-list@2.0.0-alpha.6) (2021-01-28)
|
|
63
|
-
|
|
64
|
-
**Note:** Version bump only for package @tiptap/extension-ordered-list
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
# [2.0.0-alpha.5](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/extension-ordered-list@2.0.0-alpha.4...@tiptap/extension-ordered-list@2.0.0-alpha.5) (2020-12-18)
|
|
71
|
-
|
|
72
|
-
**Note:** Version bump only for package @tiptap/extension-ordered-list
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
# [2.0.0-alpha.4](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/extension-ordered-list@2.0.0-alpha.3...@tiptap/extension-ordered-list@2.0.0-alpha.4) (2020-12-02)
|
|
79
|
-
|
|
80
|
-
**Note:** Version bump only for package @tiptap/extension-ordered-list
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
# [2.0.0-alpha.3](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/extension-ordered-list@2.0.0-alpha.2...@tiptap/extension-ordered-list@2.0.0-alpha.3) (2020-11-19)
|
|
87
|
-
|
|
88
|
-
**Note:** Version bump only for package @tiptap/extension-ordered-list
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
# [2.0.0-alpha.2](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/extension-ordered-list@2.0.0-alpha.1...@tiptap/extension-ordered-list@2.0.0-alpha.2) (2020-11-19)
|
|
95
|
-
|
|
96
|
-
**Note:** Version bump only for package @tiptap/extension-ordered-list
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
# [2.0.0-alpha.1](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/extension-ordered-list@1.0.0-alpha.2...@tiptap/extension-ordered-list@2.0.0-alpha.1) (2020-11-18)
|
|
103
|
-
|
|
104
|
-
**Note:** Version bump only for package @tiptap/extension-ordered-list
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
# [1.0.0-alpha.2](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/extension-ordered-list@1.0.0-alpha.1...@tiptap/extension-ordered-list@1.0.0-alpha.2) (2020-11-16)
|
|
111
|
-
|
|
112
|
-
**Note:** Version bump only for package @tiptap/extension-ordered-list
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
# 1.0.0-alpha.1 (2020-11-16)
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
### Reverts
|
|
122
|
-
|
|
123
|
-
* Revert "use global namespace" ([0c9ce26](https://github.com/ueberdosis/tiptap-next/commit/0c9ce26c02c07d88a757c01b0a9d7f9e2b0b7502))
|