@tiptap/extension-bullet-list 3.0.0 → 3.0.2

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.
Files changed (180) hide show
  1. package/LICENSE.md +21 -0
  2. package/README.md +5 -1
  3. package/dist/index.cjs +31 -152
  4. package/dist/index.cjs.map +1 -1
  5. package/dist/index.d.cts +2 -0
  6. package/dist/index.d.ts +2 -0
  7. package/dist/index.js +9 -149
  8. package/dist/index.js.map +1 -1
  9. package/package.json +11 -9
  10. package/src/index.ts +3 -2
  11. package/dist/index.umd.js +0 -159
  12. package/dist/index.umd.js.map +0 -1
  13. package/dist/packages/core/src/CommandManager.d.ts +0 -20
  14. package/dist/packages/core/src/Editor.d.ts +0 -161
  15. package/dist/packages/core/src/EventEmitter.d.ts +0 -11
  16. package/dist/packages/core/src/Extension.d.ts +0 -343
  17. package/dist/packages/core/src/ExtensionManager.d.ts +0 -55
  18. package/dist/packages/core/src/InputRule.d.ts +0 -42
  19. package/dist/packages/core/src/Mark.d.ts +0 -451
  20. package/dist/packages/core/src/Node.d.ts +0 -611
  21. package/dist/packages/core/src/NodePos.d.ts +0 -44
  22. package/dist/packages/core/src/NodeView.d.ts +0 -31
  23. package/dist/packages/core/src/PasteRule.d.ts +0 -50
  24. package/dist/packages/core/src/Tracker.d.ts +0 -11
  25. package/dist/packages/core/src/commands/blur.d.ts +0 -13
  26. package/dist/packages/core/src/commands/clearContent.d.ts +0 -14
  27. package/dist/packages/core/src/commands/clearNodes.d.ts +0 -13
  28. package/dist/packages/core/src/commands/command.d.ts +0 -18
  29. package/dist/packages/core/src/commands/createParagraphNear.d.ts +0 -13
  30. package/dist/packages/core/src/commands/cut.d.ts +0 -20
  31. package/dist/packages/core/src/commands/deleteCurrentNode.d.ts +0 -13
  32. package/dist/packages/core/src/commands/deleteNode.d.ts +0 -15
  33. package/dist/packages/core/src/commands/deleteRange.d.ts +0 -14
  34. package/dist/packages/core/src/commands/deleteSelection.d.ts +0 -13
  35. package/dist/packages/core/src/commands/enter.d.ts +0 -13
  36. package/dist/packages/core/src/commands/exitCode.d.ts +0 -13
  37. package/dist/packages/core/src/commands/extendMarkRange.d.ts +0 -25
  38. package/dist/packages/core/src/commands/first.d.ts +0 -14
  39. package/dist/packages/core/src/commands/focus.d.ts +0 -27
  40. package/dist/packages/core/src/commands/forEach.d.ts +0 -14
  41. package/dist/packages/core/src/commands/index.d.ts +0 -55
  42. package/dist/packages/core/src/commands/insertContent.d.ts +0 -34
  43. package/dist/packages/core/src/commands/insertContentAt.d.ts +0 -47
  44. package/dist/packages/core/src/commands/join.d.ts +0 -41
  45. package/dist/packages/core/src/commands/joinItemBackward.d.ts +0 -13
  46. package/dist/packages/core/src/commands/joinItemForward.d.ts +0 -13
  47. package/dist/packages/core/src/commands/joinTextblockBackward.d.ts +0 -12
  48. package/dist/packages/core/src/commands/joinTextblockForward.d.ts +0 -12
  49. package/dist/packages/core/src/commands/keyboardShortcut.d.ts +0 -14
  50. package/dist/packages/core/src/commands/lift.d.ts +0 -17
  51. package/dist/packages/core/src/commands/liftEmptyBlock.d.ts +0 -13
  52. package/dist/packages/core/src/commands/liftListItem.d.ts +0 -15
  53. package/dist/packages/core/src/commands/newlineInCode.d.ts +0 -13
  54. package/dist/packages/core/src/commands/resetAttributes.d.ts +0 -16
  55. package/dist/packages/core/src/commands/scrollIntoView.d.ts +0 -13
  56. package/dist/packages/core/src/commands/selectAll.d.ts +0 -13
  57. package/dist/packages/core/src/commands/selectNodeBackward.d.ts +0 -13
  58. package/dist/packages/core/src/commands/selectNodeForward.d.ts +0 -13
  59. package/dist/packages/core/src/commands/selectParentNode.d.ts +0 -13
  60. package/dist/packages/core/src/commands/selectTextblockEnd.d.ts +0 -13
  61. package/dist/packages/core/src/commands/selectTextblockStart.d.ts +0 -13
  62. package/dist/packages/core/src/commands/setContent.d.ts +0 -40
  63. package/dist/packages/core/src/commands/setMark.d.ts +0 -15
  64. package/dist/packages/core/src/commands/setMeta.d.ts +0 -15
  65. package/dist/packages/core/src/commands/setNode.d.ts +0 -16
  66. package/dist/packages/core/src/commands/setNodeSelection.d.ts +0 -14
  67. package/dist/packages/core/src/commands/setTextSelection.d.ts +0 -14
  68. package/dist/packages/core/src/commands/sinkListItem.d.ts +0 -15
  69. package/dist/packages/core/src/commands/splitBlock.d.ts +0 -17
  70. package/dist/packages/core/src/commands/splitListItem.d.ts +0 -15
  71. package/dist/packages/core/src/commands/toggleList.d.ts +0 -18
  72. package/dist/packages/core/src/commands/toggleMark.d.ts +0 -30
  73. package/dist/packages/core/src/commands/toggleNode.d.ts +0 -17
  74. package/dist/packages/core/src/commands/toggleWrap.d.ts +0 -16
  75. package/dist/packages/core/src/commands/undoInputRule.d.ts +0 -13
  76. package/dist/packages/core/src/commands/unsetAllMarks.d.ts +0 -13
  77. package/dist/packages/core/src/commands/unsetMark.d.ts +0 -25
  78. package/dist/packages/core/src/commands/updateAttributes.d.ts +0 -24
  79. package/dist/packages/core/src/commands/wrapIn.d.ts +0 -16
  80. package/dist/packages/core/src/commands/wrapInList.d.ts +0 -16
  81. package/dist/packages/core/src/extensions/clipboardTextSerializer.d.ts +0 -5
  82. package/dist/packages/core/src/extensions/commands.d.ts +0 -3
  83. package/dist/packages/core/src/extensions/editable.d.ts +0 -2
  84. package/dist/packages/core/src/extensions/focusEvents.d.ts +0 -2
  85. package/dist/packages/core/src/extensions/index.d.ts +0 -6
  86. package/dist/packages/core/src/extensions/keymap.d.ts +0 -2
  87. package/dist/packages/core/src/extensions/tabindex.d.ts +0 -2
  88. package/dist/packages/core/src/helpers/combineTransactionSteps.d.ts +0 -10
  89. package/dist/packages/core/src/helpers/createChainableState.d.ts +0 -10
  90. package/dist/packages/core/src/helpers/createDocument.d.ts +0 -12
  91. package/dist/packages/core/src/helpers/createNodeFromContent.d.ts +0 -15
  92. package/dist/packages/core/src/helpers/defaultBlockAt.d.ts +0 -7
  93. package/dist/packages/core/src/helpers/findChildren.d.ts +0 -9
  94. package/dist/packages/core/src/helpers/findChildrenInRange.d.ts +0 -10
  95. package/dist/packages/core/src/helpers/findParentNode.d.ts +0 -16
  96. package/dist/packages/core/src/helpers/findParentNodeClosestToPos.d.ts +0 -17
  97. package/dist/packages/core/src/helpers/generateHTML.d.ts +0 -8
  98. package/dist/packages/core/src/helpers/generateJSON.d.ts +0 -8
  99. package/dist/packages/core/src/helpers/generateText.d.ts +0 -12
  100. package/dist/packages/core/src/helpers/getAttributes.d.ts +0 -9
  101. package/dist/packages/core/src/helpers/getAttributesFromExtensions.d.ts +0 -6
  102. package/dist/packages/core/src/helpers/getChangedRanges.d.ts +0 -11
  103. package/dist/packages/core/src/helpers/getDebugJSON.d.ts +0 -8
  104. package/dist/packages/core/src/helpers/getExtensionField.d.ts +0 -9
  105. package/dist/packages/core/src/helpers/getHTMLFromFragment.d.ts +0 -2
  106. package/dist/packages/core/src/helpers/getMarkAttributes.d.ts +0 -3
  107. package/dist/packages/core/src/helpers/getMarkRange.d.ts +0 -3
  108. package/dist/packages/core/src/helpers/getMarkType.d.ts +0 -2
  109. package/dist/packages/core/src/helpers/getMarksBetween.d.ts +0 -3
  110. package/dist/packages/core/src/helpers/getNodeAtPosition.d.ts +0 -11
  111. package/dist/packages/core/src/helpers/getNodeAttributes.d.ts +0 -3
  112. package/dist/packages/core/src/helpers/getNodeType.d.ts +0 -2
  113. package/dist/packages/core/src/helpers/getRenderedAttributes.d.ts +0 -3
  114. package/dist/packages/core/src/helpers/getSchema.d.ts +0 -4
  115. package/dist/packages/core/src/helpers/getSchemaByResolvedExtensions.d.ts +0 -10
  116. package/dist/packages/core/src/helpers/getSchemaTypeByName.d.ts +0 -8
  117. package/dist/packages/core/src/helpers/getSchemaTypeNameByName.d.ts +0 -8
  118. package/dist/packages/core/src/helpers/getSplittedAttributes.d.ts +0 -9
  119. package/dist/packages/core/src/helpers/getText.d.ts +0 -15
  120. package/dist/packages/core/src/helpers/getTextBetween.d.ts +0 -14
  121. package/dist/packages/core/src/helpers/getTextContentFromNodes.d.ts +0 -8
  122. package/dist/packages/core/src/helpers/getTextSerializersFromSchema.d.ts +0 -8
  123. package/dist/packages/core/src/helpers/index.d.ts +0 -50
  124. package/dist/packages/core/src/helpers/injectExtensionAttributesToParseRule.d.ts +0 -9
  125. package/dist/packages/core/src/helpers/isActive.d.ts +0 -2
  126. package/dist/packages/core/src/helpers/isAtEndOfNode.d.ts +0 -2
  127. package/dist/packages/core/src/helpers/isAtStartOfNode.d.ts +0 -2
  128. package/dist/packages/core/src/helpers/isExtensionRulesEnabled.d.ts +0 -2
  129. package/dist/packages/core/src/helpers/isList.d.ts +0 -2
  130. package/dist/packages/core/src/helpers/isMarkActive.d.ts +0 -3
  131. package/dist/packages/core/src/helpers/isNodeActive.d.ts +0 -3
  132. package/dist/packages/core/src/helpers/isNodeEmpty.d.ts +0 -2
  133. package/dist/packages/core/src/helpers/isNodeSelection.d.ts +0 -2
  134. package/dist/packages/core/src/helpers/isTextSelection.d.ts +0 -2
  135. package/dist/packages/core/src/helpers/posToDOMRect.d.ts +0 -2
  136. package/dist/packages/core/src/helpers/resolveFocusPosition.d.ts +0 -4
  137. package/dist/packages/core/src/helpers/selectionToInsertionEnd.d.ts +0 -2
  138. package/dist/packages/core/src/helpers/splitExtensions.d.ts +0 -9
  139. package/dist/packages/core/src/index.d.ts +0 -24
  140. package/dist/packages/core/src/inputRules/index.d.ts +0 -5
  141. package/dist/packages/core/src/inputRules/markInputRule.d.ts +0 -13
  142. package/dist/packages/core/src/inputRules/nodeInputRule.d.ts +0 -23
  143. package/dist/packages/core/src/inputRules/textInputRule.d.ts +0 -10
  144. package/dist/packages/core/src/inputRules/textblockTypeInputRule.d.ts +0 -15
  145. package/dist/packages/core/src/inputRules/wrappingInputRule.d.ts +0 -28
  146. package/dist/packages/core/src/pasteRules/index.d.ts +0 -3
  147. package/dist/packages/core/src/pasteRules/markPasteRule.d.ts +0 -13
  148. package/dist/packages/core/src/pasteRules/nodePasteRule.d.ts +0 -13
  149. package/dist/packages/core/src/pasteRules/textPasteRule.d.ts +0 -10
  150. package/dist/packages/core/src/style.d.ts +0 -1
  151. package/dist/packages/core/src/types.d.ts +0 -255
  152. package/dist/packages/core/src/utilities/callOrReturn.d.ts +0 -9
  153. package/dist/packages/core/src/utilities/createStyleTag.d.ts +0 -1
  154. package/dist/packages/core/src/utilities/deleteProps.d.ts +0 -6
  155. package/dist/packages/core/src/utilities/elementFromString.d.ts +0 -1
  156. package/dist/packages/core/src/utilities/escapeForRegEx.d.ts +0 -1
  157. package/dist/packages/core/src/utilities/findDuplicates.d.ts +0 -1
  158. package/dist/packages/core/src/utilities/fromString.d.ts +0 -1
  159. package/dist/packages/core/src/utilities/index.d.ts +0 -20
  160. package/dist/packages/core/src/utilities/isAndroid.d.ts +0 -1
  161. package/dist/packages/core/src/utilities/isEmptyObject.d.ts +0 -1
  162. package/dist/packages/core/src/utilities/isFunction.d.ts +0 -1
  163. package/dist/packages/core/src/utilities/isMacOS.d.ts +0 -1
  164. package/dist/packages/core/src/utilities/isNumber.d.ts +0 -1
  165. package/dist/packages/core/src/utilities/isPlainObject.d.ts +0 -1
  166. package/dist/packages/core/src/utilities/isRegExp.d.ts +0 -1
  167. package/dist/packages/core/src/utilities/isString.d.ts +0 -1
  168. package/dist/packages/core/src/utilities/isiOS.d.ts +0 -1
  169. package/dist/packages/core/src/utilities/mergeAttributes.d.ts +0 -1
  170. package/dist/packages/core/src/utilities/mergeDeep.d.ts +0 -1
  171. package/dist/packages/core/src/utilities/minMax.d.ts +0 -1
  172. package/dist/packages/core/src/utilities/objectIncludes.d.ts +0 -8
  173. package/dist/packages/core/src/utilities/removeDuplicates.d.ts +0 -8
  174. package/dist/packages/extension-bullet-list/src/bullet-list.d.ts +0 -48
  175. package/dist/packages/extension-bullet-list/src/index.d.ts +0 -3
  176. package/dist/packages/extension-list-item/src/index.d.ts +0 -3
  177. package/dist/packages/extension-list-item/src/list-item.d.ts +0 -26
  178. package/dist/packages/extension-text-style/src/index.d.ts +0 -3
  179. package/dist/packages/extension-text-style/src/text-style.d.ts +0 -26
  180. package/src/bullet-list.ts +0 -123
package/LICENSE.md ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025, Tiptap GmbH
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.
package/README.md CHANGED
@@ -1,14 +1,18 @@
1
1
  # @tiptap/extension-bullet-list
2
+
2
3
  [![Version](https://img.shields.io/npm/v/@tiptap/extension-bullet-list.svg?label=version)](https://www.npmjs.com/package/@tiptap/extension-bullet-list)
3
4
  [![Downloads](https://img.shields.io/npm/dm/@tiptap/extension-bullet-list.svg)](https://npmcharts.com/compare/tiptap?minimal=true)
4
5
  [![License](https://img.shields.io/npm/l/@tiptap/extension-bullet-list.svg)](https://www.npmjs.com/package/@tiptap/extension-bullet-list)
5
6
  [![Sponsor](https://img.shields.io/static/v1?label=Sponsor&message=%E2%9D%A4&logo=GitHub)](https://github.com/sponsors/ueberdosis)
6
7
 
7
8
  ## Introduction
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
+
10
+ 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
11
 
10
12
  ## Official Documentation
13
+
11
14
  Documentation can be found on the [Tiptap website](https://tiptap.dev).
12
15
 
13
16
  ## License
17
+
14
18
  Tiptap is open sourced software licensed under the [MIT license](https://github.com/ueberdosis/tiptap/blob/main/LICENSE.md).
package/dist/index.cjs CHANGED
@@ -1,155 +1,34 @@
1
- 'use strict';
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
2
19
 
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- var core = require('@tiptap/core');
6
-
7
- /**
8
- * This extension allows you to create list items.
9
- * @see https://www.tiptap.dev/api/nodes/list-item
10
- */
11
- const ListItem = core.Node.create({
12
- name: 'listItem',
13
- addOptions() {
14
- return {
15
- HTMLAttributes: {},
16
- bulletListTypeName: 'bulletList',
17
- orderedListTypeName: 'orderedList',
18
- };
19
- },
20
- content: 'paragraph block*',
21
- defining: true,
22
- parseHTML() {
23
- return [
24
- {
25
- tag: 'li',
26
- },
27
- ];
28
- },
29
- renderHTML({ HTMLAttributes }) {
30
- return ['li', core.mergeAttributes(this.options.HTMLAttributes, HTMLAttributes), 0];
31
- },
32
- addKeyboardShortcuts() {
33
- return {
34
- Enter: () => this.editor.commands.splitListItem(this.name),
35
- Tab: () => this.editor.commands.sinkListItem(this.name),
36
- 'Shift-Tab': () => this.editor.commands.liftListItem(this.name),
37
- };
38
- },
39
- });
40
-
41
- /**
42
- * This extension allows you to create text styles. It is required by default
43
- * for the `textColor` and `backgroundColor` extensions.
44
- * @see https://www.tiptap.dev/api/marks/text-style
45
- */
46
- const TextStyle = core.Mark.create({
47
- name: 'textStyle',
48
- addOptions() {
49
- return {
50
- HTMLAttributes: {},
51
- };
52
- },
53
- parseHTML() {
54
- return [
55
- {
56
- tag: 'span',
57
- getAttrs: element => {
58
- const hasStyles = element.hasAttribute('style');
59
- if (!hasStyles) {
60
- return false;
61
- }
62
- return {};
63
- },
64
- },
65
- ];
66
- },
67
- renderHTML({ HTMLAttributes }) {
68
- return ['span', core.mergeAttributes(this.options.HTMLAttributes, HTMLAttributes), 0];
69
- },
70
- addCommands() {
71
- return {
72
- removeEmptyTextStyle: () => ({ state, commands }) => {
73
- const attributes = core.getMarkAttributes(state, this.type);
74
- const hasStyles = Object.entries(attributes).some(([, value]) => !!value);
75
- if (hasStyles) {
76
- return true;
77
- }
78
- return commands.unsetMark(this.name);
79
- },
80
- };
81
- },
20
+ // src/index.ts
21
+ var index_exports = {};
22
+ __export(index_exports, {
23
+ BulletList: () => import_extension_list2.BulletList,
24
+ default: () => index_default
82
25
  });
83
-
84
- /**
85
- * Matches a bullet list to a dash or asterisk.
86
- */
87
- const inputRegex = /^\s*([-+*])\s$/;
88
- /**
89
- * This extension allows you to create bullet lists.
90
- * This requires the ListItem extension
91
- * @see https://tiptap.dev/api/nodes/bullet-list
92
- * @see https://tiptap.dev/api/nodes/list-item.
93
- */
94
- const BulletList = core.Node.create({
95
- name: 'bulletList',
96
- addOptions() {
97
- return {
98
- itemTypeName: 'listItem',
99
- HTMLAttributes: {},
100
- keepMarks: false,
101
- keepAttributes: false,
102
- };
103
- },
104
- group: 'block list',
105
- content() {
106
- return `${this.options.itemTypeName}+`;
107
- },
108
- parseHTML() {
109
- return [
110
- { tag: 'ul' },
111
- ];
112
- },
113
- renderHTML({ HTMLAttributes }) {
114
- return ['ul', core.mergeAttributes(this.options.HTMLAttributes, HTMLAttributes), 0];
115
- },
116
- addCommands() {
117
- return {
118
- toggleBulletList: () => ({ commands, chain }) => {
119
- if (this.options.keepAttributes) {
120
- return chain().toggleList(this.name, this.options.itemTypeName, this.options.keepMarks).updateAttributes(ListItem.name, this.editor.getAttributes(TextStyle.name)).run();
121
- }
122
- return commands.toggleList(this.name, this.options.itemTypeName, this.options.keepMarks);
123
- },
124
- };
125
- },
126
- addKeyboardShortcuts() {
127
- return {
128
- 'Mod-Shift-8': () => this.editor.commands.toggleBulletList(),
129
- };
130
- },
131
- addInputRules() {
132
- let inputRule = core.wrappingInputRule({
133
- find: inputRegex,
134
- type: this.type,
135
- });
136
- if (this.options.keepMarks || this.options.keepAttributes) {
137
- inputRule = core.wrappingInputRule({
138
- find: inputRegex,
139
- type: this.type,
140
- keepMarks: this.options.keepMarks,
141
- keepAttributes: this.options.keepAttributes,
142
- getAttributes: () => { return this.editor.getAttributes(TextStyle.name); },
143
- editor: this.editor,
144
- });
145
- }
146
- return [
147
- inputRule,
148
- ];
149
- },
26
+ module.exports = __toCommonJS(index_exports);
27
+ var import_extension_list = require("@tiptap/extension-list");
28
+ var import_extension_list2 = require("@tiptap/extension-list");
29
+ var index_default = import_extension_list.BulletList;
30
+ // Annotate the CommonJS export names for ESM import in node:
31
+ 0 && (module.exports = {
32
+ BulletList
150
33
  });
151
-
152
- exports.BulletList = BulletList;
153
- exports.default = BulletList;
154
- exports.inputRegex = inputRegex;
155
- //# sourceMappingURL=index.cjs.map
34
+ //# sourceMappingURL=index.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","sources":["../../extension-list-item/src/list-item.ts","../../extension-text-style/src/text-style.ts","../src/bullet-list.ts"],"sourcesContent":["import { mergeAttributes, Node } from '@tiptap/core'\n\nexport interface ListItemOptions {\n /**\n * The HTML attributes for a list item node.\n * @default {}\n * @example { class: 'foo' }\n */\n HTMLAttributes: Record<string, any>,\n\n /**\n * The node type for bulletList nodes\n * @default 'bulletList'\n * @example 'myCustomBulletList'\n */\n bulletListTypeName: string\n\n /**\n * The node type for orderedList nodes\n * @default 'orderedList'\n * @example 'myCustomOrderedList'\n */\n orderedListTypeName: string\n}\n\n/**\n * This extension allows you to create list items.\n * @see https://www.tiptap.dev/api/nodes/list-item\n */\nexport const ListItem = Node.create<ListItemOptions>({\n name: 'listItem',\n\n addOptions() {\n return {\n HTMLAttributes: {},\n bulletListTypeName: 'bulletList',\n orderedListTypeName: 'orderedList',\n }\n },\n\n content: 'paragraph block*',\n\n defining: true,\n\n parseHTML() {\n return [\n {\n tag: 'li',\n },\n ]\n },\n\n renderHTML({ HTMLAttributes }) {\n return ['li', mergeAttributes(this.options.HTMLAttributes, HTMLAttributes), 0]\n },\n\n addKeyboardShortcuts() {\n return {\n Enter: () => this.editor.commands.splitListItem(this.name),\n Tab: () => this.editor.commands.sinkListItem(this.name),\n 'Shift-Tab': () => this.editor.commands.liftListItem(this.name),\n }\n },\n})\n","import {\n getMarkAttributes,\n Mark,\n mergeAttributes,\n} from '@tiptap/core'\n\nexport interface TextStyleOptions {\n /**\n * HTML attributes to add to the span element.\n * @default {}\n * @example { class: 'foo' }\n */\n HTMLAttributes: Record<string, any>,\n}\n\ndeclare module '@tiptap/core' {\n interface Commands<ReturnType> {\n textStyle: {\n /**\n * Remove spans without inline style attributes.\n * @example editor.commands.removeEmptyTextStyle()\n */\n removeEmptyTextStyle: () => ReturnType,\n }\n }\n}\n\n/**\n * This extension allows you to create text styles. It is required by default\n * for the `textColor` and `backgroundColor` extensions.\n * @see https://www.tiptap.dev/api/marks/text-style\n */\nexport const TextStyle = Mark.create<TextStyleOptions>({\n name: 'textStyle',\n\n addOptions() {\n return {\n HTMLAttributes: {},\n }\n },\n\n parseHTML() {\n return [\n {\n tag: 'span',\n getAttrs: element => {\n const hasStyles = (element as HTMLElement).hasAttribute('style')\n\n if (!hasStyles) {\n return false\n }\n\n return {}\n },\n },\n ]\n },\n\n renderHTML({ HTMLAttributes }) {\n return ['span', mergeAttributes(this.options.HTMLAttributes, HTMLAttributes), 0]\n },\n\n addCommands() {\n return {\n removeEmptyTextStyle: () => ({ state, commands }) => {\n const attributes = getMarkAttributes(state, this.type)\n const hasStyles = Object.entries(attributes).some(([, value]) => !!value)\n\n if (hasStyles) {\n return true\n }\n\n return commands.unsetMark(this.name)\n },\n }\n },\n\n})\n","import { mergeAttributes, Node, wrappingInputRule } from '@tiptap/core'\n\nimport ListItem from '../../extension-list-item/src/index.js'\nimport TextStyle from '../../extension-text-style/src/index.js'\n\nexport interface BulletListOptions {\n /**\n * The node name for the list items\n * @default 'listItem'\n * @example 'paragraph'\n */\n itemTypeName: string,\n\n /**\n * HTML attributes to add to the bullet list element\n * @default {}\n * @example { class: 'foo' }\n */\n HTMLAttributes: Record<string, any>,\n\n /**\n * Keep the marks when splitting the list\n * @default false\n * @example true\n */\n keepMarks: boolean,\n\n /**\n * Keep the attributes when splitting the list\n * @default false\n * @example true\n */\n keepAttributes: boolean,\n}\n\ndeclare module '@tiptap/core' {\n interface Commands<ReturnType> {\n bulletList: {\n /**\n * Toggle a bullet list\n */\n toggleBulletList: () => ReturnType,\n }\n }\n}\n\n/**\n * Matches a bullet list to a dash or asterisk.\n */\nexport const inputRegex = /^\\s*([-+*])\\s$/\n\n/**\n * This extension allows you to create bullet lists.\n * This requires the ListItem extension\n * @see https://tiptap.dev/api/nodes/bullet-list\n * @see https://tiptap.dev/api/nodes/list-item.\n */\nexport const BulletList = Node.create<BulletListOptions>({\n name: 'bulletList',\n\n addOptions() {\n return {\n itemTypeName: 'listItem',\n HTMLAttributes: {},\n keepMarks: false,\n keepAttributes: false,\n }\n },\n\n group: 'block list',\n\n content() {\n return `${this.options.itemTypeName}+`\n },\n\n parseHTML() {\n return [\n { tag: 'ul' },\n ]\n },\n\n renderHTML({ HTMLAttributes }) {\n return ['ul', mergeAttributes(this.options.HTMLAttributes, HTMLAttributes), 0]\n },\n\n addCommands() {\n return {\n toggleBulletList: () => ({ commands, chain }) => {\n if (this.options.keepAttributes) {\n return chain().toggleList(this.name, this.options.itemTypeName, this.options.keepMarks).updateAttributes(ListItem.name, this.editor.getAttributes(TextStyle.name)).run()\n }\n return commands.toggleList(this.name, this.options.itemTypeName, this.options.keepMarks)\n },\n }\n },\n\n addKeyboardShortcuts() {\n return {\n 'Mod-Shift-8': () => this.editor.commands.toggleBulletList(),\n }\n },\n\n addInputRules() {\n let inputRule = wrappingInputRule({\n find: inputRegex,\n type: this.type,\n })\n\n if (this.options.keepMarks || this.options.keepAttributes) {\n inputRule = wrappingInputRule({\n find: inputRegex,\n type: this.type,\n keepMarks: this.options.keepMarks,\n keepAttributes: this.options.keepAttributes,\n getAttributes: () => { return this.editor.getAttributes(TextStyle.name) },\n editor: this.editor,\n })\n }\n return [\n inputRule,\n ]\n },\n})\n"],"names":["Node","mergeAttributes","Mark","getMarkAttributes","wrappingInputRule"],"mappings":";;;;;;AAyBA;;;AAGG;AACI,MAAM,QAAQ,GAAGA,SAAI,CAAC,MAAM,CAAkB;AACnD,IAAA,IAAI,EAAE,UAAU;IAEhB,UAAU,GAAA;QACR,OAAO;AACL,YAAA,cAAc,EAAE,EAAE;AAClB,YAAA,kBAAkB,EAAE,YAAY;AAChC,YAAA,mBAAmB,EAAE,aAAa;SACnC,CAAA;KACF;AAED,IAAA,OAAO,EAAE,kBAAkB;AAE3B,IAAA,QAAQ,EAAE,IAAI;IAEd,SAAS,GAAA;QACP,OAAO;AACL,YAAA;AACE,gBAAA,GAAG,EAAE,IAAI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AE,IAAI,CAAC,MAAM;AACpB,aAAA,CAAC,CAAA;SACH;QACD,OAAO;YACL,SAAS;SACV,CAAA;KACF;AACF,CAAA;;;;;;"}
1
+ {"version":3,"sources":["../src/index.ts"],"sourcesContent":["import { BulletList } from '@tiptap/extension-list'\n\nexport type { BulletListOptions } from '@tiptap/extension-list'\nexport { BulletList } from '@tiptap/extension-list'\n\nexport default BulletList\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,4BAA2B;AAG3B,IAAAA,yBAA2B;AAE3B,IAAO,gBAAQ;","names":["import_extension_list"]}
@@ -0,0 +1,2 @@
1
+ import { BulletList } from '@tiptap/extension-list';
2
+ export { BulletList, BulletListOptions, BulletList as default } from '@tiptap/extension-list';
@@ -0,0 +1,2 @@
1
+ import { BulletList } from '@tiptap/extension-list';
2
+ export { BulletList, BulletListOptions, BulletList as default } from '@tiptap/extension-list';
package/dist/index.js CHANGED
@@ -1,149 +1,9 @@
1
- import { Node, mergeAttributes, Mark, getMarkAttributes, wrappingInputRule } from '@tiptap/core';
2
-
3
- /**
4
- * This extension allows you to create list items.
5
- * @see https://www.tiptap.dev/api/nodes/list-item
6
- */
7
- const ListItem = Node.create({
8
- name: 'listItem',
9
- addOptions() {
10
- return {
11
- HTMLAttributes: {},
12
- bulletListTypeName: 'bulletList',
13
- orderedListTypeName: 'orderedList',
14
- };
15
- },
16
- content: 'paragraph block*',
17
- defining: true,
18
- parseHTML() {
19
- return [
20
- {
21
- tag: 'li',
22
- },
23
- ];
24
- },
25
- renderHTML({ HTMLAttributes }) {
26
- return ['li', mergeAttributes(this.options.HTMLAttributes, HTMLAttributes), 0];
27
- },
28
- addKeyboardShortcuts() {
29
- return {
30
- Enter: () => this.editor.commands.splitListItem(this.name),
31
- Tab: () => this.editor.commands.sinkListItem(this.name),
32
- 'Shift-Tab': () => this.editor.commands.liftListItem(this.name),
33
- };
34
- },
35
- });
36
-
37
- /**
38
- * This extension allows you to create text styles. It is required by default
39
- * for the `textColor` and `backgroundColor` extensions.
40
- * @see https://www.tiptap.dev/api/marks/text-style
41
- */
42
- const TextStyle = Mark.create({
43
- name: 'textStyle',
44
- addOptions() {
45
- return {
46
- HTMLAttributes: {},
47
- };
48
- },
49
- parseHTML() {
50
- return [
51
- {
52
- tag: 'span',
53
- getAttrs: element => {
54
- const hasStyles = element.hasAttribute('style');
55
- if (!hasStyles) {
56
- return false;
57
- }
58
- return {};
59
- },
60
- },
61
- ];
62
- },
63
- renderHTML({ HTMLAttributes }) {
64
- return ['span', mergeAttributes(this.options.HTMLAttributes, HTMLAttributes), 0];
65
- },
66
- addCommands() {
67
- return {
68
- removeEmptyTextStyle: () => ({ state, commands }) => {
69
- const attributes = getMarkAttributes(state, this.type);
70
- const hasStyles = Object.entries(attributes).some(([, value]) => !!value);
71
- if (hasStyles) {
72
- return true;
73
- }
74
- return commands.unsetMark(this.name);
75
- },
76
- };
77
- },
78
- });
79
-
80
- /**
81
- * Matches a bullet list to a dash or asterisk.
82
- */
83
- const inputRegex = /^\s*([-+*])\s$/;
84
- /**
85
- * This extension allows you to create bullet lists.
86
- * This requires the ListItem extension
87
- * @see https://tiptap.dev/api/nodes/bullet-list
88
- * @see https://tiptap.dev/api/nodes/list-item.
89
- */
90
- const BulletList = Node.create({
91
- name: 'bulletList',
92
- addOptions() {
93
- return {
94
- itemTypeName: 'listItem',
95
- HTMLAttributes: {},
96
- keepMarks: false,
97
- keepAttributes: false,
98
- };
99
- },
100
- group: 'block list',
101
- content() {
102
- return `${this.options.itemTypeName}+`;
103
- },
104
- parseHTML() {
105
- return [
106
- { tag: 'ul' },
107
- ];
108
- },
109
- renderHTML({ HTMLAttributes }) {
110
- return ['ul', mergeAttributes(this.options.HTMLAttributes, HTMLAttributes), 0];
111
- },
112
- addCommands() {
113
- return {
114
- toggleBulletList: () => ({ commands, chain }) => {
115
- if (this.options.keepAttributes) {
116
- return chain().toggleList(this.name, this.options.itemTypeName, this.options.keepMarks).updateAttributes(ListItem.name, this.editor.getAttributes(TextStyle.name)).run();
117
- }
118
- return commands.toggleList(this.name, this.options.itemTypeName, this.options.keepMarks);
119
- },
120
- };
121
- },
122
- addKeyboardShortcuts() {
123
- return {
124
- 'Mod-Shift-8': () => this.editor.commands.toggleBulletList(),
125
- };
126
- },
127
- addInputRules() {
128
- let inputRule = wrappingInputRule({
129
- find: inputRegex,
130
- type: this.type,
131
- });
132
- if (this.options.keepMarks || this.options.keepAttributes) {
133
- inputRule = wrappingInputRule({
134
- find: inputRegex,
135
- type: this.type,
136
- keepMarks: this.options.keepMarks,
137
- keepAttributes: this.options.keepAttributes,
138
- getAttributes: () => { return this.editor.getAttributes(TextStyle.name); },
139
- editor: this.editor,
140
- });
141
- }
142
- return [
143
- inputRule,
144
- ];
145
- },
146
- });
147
-
148
- export { BulletList, BulletList as default, inputRegex };
149
- //# sourceMappingURL=index.js.map
1
+ // src/index.ts
2
+ import { BulletList } from "@tiptap/extension-list";
3
+ import { BulletList as BulletList2 } from "@tiptap/extension-list";
4
+ var index_default = BulletList;
5
+ export {
6
+ BulletList2 as BulletList,
7
+ index_default as default
8
+ };
9
+ //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../extension-list-item/src/list-item.ts","../../extension-text-style/src/text-style.ts","../src/bullet-list.ts"],"sourcesContent":["import { mergeAttributes, Node } from '@tiptap/core'\n\nexport interface ListItemOptions {\n /**\n * The HTML attributes for a list item node.\n * @default {}\n * @example { class: 'foo' }\n */\n HTMLAttributes: Record<string, any>,\n\n /**\n * The node type for bulletList nodes\n * @default 'bulletList'\n * @example 'myCustomBulletList'\n */\n bulletListTypeName: string\n\n /**\n * The node type for orderedList nodes\n * @default 'orderedList'\n * @example 'myCustomOrderedList'\n */\n orderedListTypeName: string\n}\n\n/**\n * This extension allows you to create list items.\n * @see https://www.tiptap.dev/api/nodes/list-item\n */\nexport const ListItem = Node.create<ListItemOptions>({\n name: 'listItem',\n\n addOptions() {\n return {\n HTMLAttributes: {},\n bulletListTypeName: 'bulletList',\n orderedListTypeName: 'orderedList',\n }\n },\n\n content: 'paragraph block*',\n\n defining: true,\n\n parseHTML() {\n return [\n {\n tag: 'li',\n },\n ]\n },\n\n renderHTML({ HTMLAttributes }) {\n return ['li', mergeAttributes(this.options.HTMLAttributes, HTMLAttributes), 0]\n },\n\n addKeyboardShortcuts() {\n return {\n Enter: () => this.editor.commands.splitListItem(this.name),\n Tab: () => this.editor.commands.sinkListItem(this.name),\n 'Shift-Tab': () => this.editor.commands.liftListItem(this.name),\n }\n },\n})\n","import {\n getMarkAttributes,\n Mark,\n mergeAttributes,\n} from '@tiptap/core'\n\nexport interface TextStyleOptions {\n /**\n * HTML attributes to add to the span element.\n * @default {}\n * @example { class: 'foo' }\n */\n HTMLAttributes: Record<string, any>,\n}\n\ndeclare module '@tiptap/core' {\n interface Commands<ReturnType> {\n textStyle: {\n /**\n * Remove spans without inline style attributes.\n * @example editor.commands.removeEmptyTextStyle()\n */\n removeEmptyTextStyle: () => ReturnType,\n }\n }\n}\n\n/**\n * This extension allows you to create text styles. It is required by default\n * for the `textColor` and `backgroundColor` extensions.\n * @see https://www.tiptap.dev/api/marks/text-style\n */\nexport const TextStyle = Mark.create<TextStyleOptions>({\n name: 'textStyle',\n\n addOptions() {\n return {\n HTMLAttributes: {},\n }\n },\n\n parseHTML() {\n return [\n {\n tag: 'span',\n getAttrs: element => {\n const hasStyles = (element as HTMLElement).hasAttribute('style')\n\n if (!hasStyles) {\n return false\n }\n\n return {}\n },\n },\n ]\n },\n\n renderHTML({ HTMLAttributes }) {\n return ['span', mergeAttributes(this.options.HTMLAttributes, HTMLAttributes), 0]\n },\n\n addCommands() {\n return {\n removeEmptyTextStyle: () => ({ state, commands }) => {\n const attributes = getMarkAttributes(state, this.type)\n const hasStyles = Object.entries(attributes).some(([, value]) => !!value)\n\n if (hasStyles) {\n return true\n }\n\n return commands.unsetMark(this.name)\n },\n }\n },\n\n})\n","import { mergeAttributes, Node, wrappingInputRule } from '@tiptap/core'\n\nimport ListItem from '../../extension-list-item/src/index.js'\nimport TextStyle from '../../extension-text-style/src/index.js'\n\nexport interface BulletListOptions {\n /**\n * The node name for the list items\n * @default 'listItem'\n * @example 'paragraph'\n */\n itemTypeName: string,\n\n /**\n * HTML attributes to add to the bullet list element\n * @default {}\n * @example { class: 'foo' }\n */\n HTMLAttributes: Record<string, any>,\n\n /**\n * Keep the marks when splitting the list\n * @default false\n * @example true\n */\n keepMarks: boolean,\n\n /**\n * Keep the attributes when splitting the list\n * @default false\n * @example true\n */\n keepAttributes: boolean,\n}\n\ndeclare module '@tiptap/core' {\n interface Commands<ReturnType> {\n bulletList: {\n /**\n * Toggle a bullet list\n */\n toggleBulletList: () => ReturnType,\n }\n }\n}\n\n/**\n * Matches a bullet list to a dash or asterisk.\n */\nexport const inputRegex = /^\\s*([-+*])\\s$/\n\n/**\n * This extension allows you to create bullet lists.\n * This requires the ListItem extension\n * @see https://tiptap.dev/api/nodes/bullet-list\n * @see https://tiptap.dev/api/nodes/list-item.\n */\nexport const BulletList = Node.create<BulletListOptions>({\n name: 'bulletList',\n\n addOptions() {\n return {\n itemTypeName: 'listItem',\n HTMLAttributes: {},\n keepMarks: false,\n keepAttributes: false,\n }\n },\n\n group: 'block list',\n\n content() {\n return `${this.options.itemTypeName}+`\n },\n\n parseHTML() {\n return [\n { tag: 'ul' },\n ]\n },\n\n renderHTML({ HTMLAttributes }) {\n return ['ul', mergeAttributes(this.options.HTMLAttributes, HTMLAttributes), 0]\n },\n\n addCommands() {\n return {\n toggleBulletList: () => ({ commands, chain }) => {\n if (this.options.keepAttributes) {\n return chain().toggleList(this.name, this.options.itemTypeName, this.options.keepMarks).updateAttributes(ListItem.name, this.editor.getAttributes(TextStyle.name)).run()\n }\n return commands.toggleList(this.name, this.options.itemTypeName, this.options.keepMarks)\n },\n }\n },\n\n addKeyboardShortcuts() {\n return {\n 'Mod-Shift-8': () => this.editor.commands.toggleBulletList(),\n }\n },\n\n addInputRules() {\n let inputRule = wrappingInputRule({\n find: inputRegex,\n type: this.type,\n })\n\n if (this.options.keepMarks || this.options.keepAttributes) {\n inputRule = wrappingInputRule({\n find: inputRegex,\n type: this.type,\n keepMarks: this.options.keepMarks,\n keepAttributes: this.options.keepAttributes,\n getAttributes: () => { return this.editor.getAttributes(TextStyle.name) },\n editor: this.editor,\n })\n }\n return [\n inputRule,\n ]\n },\n})\n"],"names":[],"mappings":";;AAyBA;;;AAGG;AACI,MAAM,QAAQ,GAAG,IAAI,CAAC,MAAM,CAAkB;AACnD,IAAA,IAAI,EAAE,UAAU;IAEhB,UAAU,GAAA;QACR,OAAO;AACL,YAAA,cAAc,EAAE,EAAE;AAClB,YAAA,kBAAkB,EAAE,YAAY;AAChC,YAAA,mBAAmB,EAAE,aAAa;SACnC,CAAA;KACF;AAED,IAAA,OAAO,EAAE,kBAAkB;AAE3B,IAAA,QAAQ,EAAE,IAAI;IAEd,SAAS,GAAA;QACP,OAAO;AACL,YAAA;AACE,gBAAA,GAAG,EAAE,IAAI;AACV,aAAA;SACF,CAAA;KACF;IAED,UAAU,CAAC,EAAE,cAAc,EAAE,EAAA;AAC3B,QAAA,OAAO,CAAC,IAAI,EAAE,eAAe,CAAC,IAAI,CAAC,OAAO,CAAC,cAAc,EAAE,cAAc,CAAC,EAAE,CAAC,CAAC,CAAA;KAC/E;IAED,oBAAoB,GAAA;QAClB,OAAO;AACL,YAAA,KAAK,EAAE,MAAM,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC;AAC1D,YAAA,GAAG,EAAE,MAAM,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC;AACvD,YAAA,WAAW,EAAE,MAAM,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC;SAChE,CAAA;KACF;A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,EAAE,MAAM,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,gBAAgB,EAAE;SAC7D,CAAA;KACF;IAED,aAAa,GAAA;QACX,IAAI,SAAS,GAAG,iBAAiB,CAAC;AAChC,YAAA,IAAI,EAAE,UAAU;YAChB,IAAI,EAAE,IAAI,CAAC,IAAI;AAChB,SAAA,CAAC,CAAA;AAEF,QAAA,IAAI,IAAI,CAAC,OAAO,CAAC,SAAS,IAAI,IAAI,CAAC,OAAO,CAAC,cAAc,EAAE;YACzD,SAAS,GAAG,iBAAiB,CAAC;AAC5B,gBAAA,IAAI,EAAE,UAAU;gBAChB,IAAI,EAAE,IAAI,CAAC,IAAI;AACf,gBAAA,SAAS,EAAE,IAAI,CAAC,OAAO,CAAC,SAAS;AACjC,gBAAA,cAAc,EAAE,IAAI,CAAC,OAAO,CAAC,cAAc;AAC3C,gBAAA,aAAa,EAAE,MAAQ,EAAA,OAAO,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,SAAS,CAAC,IAAI,CAAC,CAAA,EAAE;gBACzE,MAAM,EAAE,IAAI,CAAC,MAAM;AACpB,aAAA,CAAC,CAAA;SACH;QACD,OAAO;YACL,SAAS;SACV,CAAA;KACF;AACF,CAAA;;;;"}
1
+ {"version":3,"sources":["../src/index.ts"],"sourcesContent":["import { BulletList } from '@tiptap/extension-list'\n\nexport type { BulletListOptions } from '@tiptap/extension-list'\nexport { BulletList } from '@tiptap/extension-list'\n\nexport default BulletList\n"],"mappings":";AAAA,SAAS,kBAAkB;AAG3B,SAAS,cAAAA,mBAAkB;AAE3B,IAAO,gBAAQ;","names":["BulletList"]}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tiptap/extension-bullet-list",
3
3
  "description": "bullet list extension for tiptap",
4
- "version": "3.0.0",
4
+ "version": "3.0.2",
5
5
  "homepage": "https://tiptap.dev",
6
6
  "keywords": [
7
7
  "tiptap",
@@ -15,24 +15,26 @@
15
15
  "type": "module",
16
16
  "exports": {
17
17
  ".": {
18
- "types": "./dist/packages/extension-bullet-list/src/index.d.ts",
18
+ "types": {
19
+ "import": "./dist/index.d.ts",
20
+ "require": "./dist/index.d.cts"
21
+ },
19
22
  "import": "./dist/index.js",
20
23
  "require": "./dist/index.cjs"
21
24
  }
22
25
  },
23
26
  "main": "dist/index.cjs",
24
27
  "module": "dist/index.js",
25
- "umd": "dist/index.umd.js",
26
- "types": "dist/packages/extension-bullet-list/src/index.d.ts",
28
+ "types": "dist/index.d.ts",
27
29
  "files": [
28
30
  "src",
29
31
  "dist"
30
32
  ],
31
33
  "devDependencies": {
32
- "@tiptap/core": "^3.0.0"
34
+ "@tiptap/extension-list": "^3.0.2"
33
35
  },
34
36
  "peerDependencies": {
35
- "@tiptap/core": "^3.0.0"
37
+ "@tiptap/extension-list": "^3.0.2"
36
38
  },
37
39
  "repository": {
38
40
  "type": "git",
@@ -40,7 +42,7 @@
40
42
  "directory": "packages/extension-bullet-list"
41
43
  },
42
44
  "scripts": {
43
- "clean": "rm -rf dist",
44
- "build": "npm run clean && rollup -c"
45
+ "build": "tsup",
46
+ "lint": "prettier ./src/ --check && eslint --cache --quiet --no-error-on-unmatched-pattern ./src/"
45
47
  }
46
- }
48
+ }
package/src/index.ts CHANGED
@@ -1,5 +1,6 @@
1
- import { BulletList } from './bullet-list.js'
1
+ import { BulletList } from '@tiptap/extension-list'
2
2
 
3
- export * from './bullet-list.js'
3
+ export type { BulletListOptions } from '@tiptap/extension-list'
4
+ export { BulletList } from '@tiptap/extension-list'
4
5
 
5
6
  export default BulletList
package/dist/index.umd.js DELETED
@@ -1,159 +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-bullet-list"] = {}, global.core));
5
- })(this, (function (exports, core) { 'use strict';
6
-
7
- /**
8
- * This extension allows you to create list items.
9
- * @see https://www.tiptap.dev/api/nodes/list-item
10
- */
11
- const ListItem = core.Node.create({
12
- name: 'listItem',
13
- addOptions() {
14
- return {
15
- HTMLAttributes: {},
16
- bulletListTypeName: 'bulletList',
17
- orderedListTypeName: 'orderedList',
18
- };
19
- },
20
- content: 'paragraph block*',
21
- defining: true,
22
- parseHTML() {
23
- return [
24
- {
25
- tag: 'li',
26
- },
27
- ];
28
- },
29
- renderHTML({ HTMLAttributes }) {
30
- return ['li', core.mergeAttributes(this.options.HTMLAttributes, HTMLAttributes), 0];
31
- },
32
- addKeyboardShortcuts() {
33
- return {
34
- Enter: () => this.editor.commands.splitListItem(this.name),
35
- Tab: () => this.editor.commands.sinkListItem(this.name),
36
- 'Shift-Tab': () => this.editor.commands.liftListItem(this.name),
37
- };
38
- },
39
- });
40
-
41
- /**
42
- * This extension allows you to create text styles. It is required by default
43
- * for the `textColor` and `backgroundColor` extensions.
44
- * @see https://www.tiptap.dev/api/marks/text-style
45
- */
46
- const TextStyle = core.Mark.create({
47
- name: 'textStyle',
48
- addOptions() {
49
- return {
50
- HTMLAttributes: {},
51
- };
52
- },
53
- parseHTML() {
54
- return [
55
- {
56
- tag: 'span',
57
- getAttrs: element => {
58
- const hasStyles = element.hasAttribute('style');
59
- if (!hasStyles) {
60
- return false;
61
- }
62
- return {};
63
- },
64
- },
65
- ];
66
- },
67
- renderHTML({ HTMLAttributes }) {
68
- return ['span', core.mergeAttributes(this.options.HTMLAttributes, HTMLAttributes), 0];
69
- },
70
- addCommands() {
71
- return {
72
- removeEmptyTextStyle: () => ({ state, commands }) => {
73
- const attributes = core.getMarkAttributes(state, this.type);
74
- const hasStyles = Object.entries(attributes).some(([, value]) => !!value);
75
- if (hasStyles) {
76
- return true;
77
- }
78
- return commands.unsetMark(this.name);
79
- },
80
- };
81
- },
82
- });
83
-
84
- /**
85
- * Matches a bullet list to a dash or asterisk.
86
- */
87
- const inputRegex = /^\s*([-+*])\s$/;
88
- /**
89
- * This extension allows you to create bullet lists.
90
- * This requires the ListItem extension
91
- * @see https://tiptap.dev/api/nodes/bullet-list
92
- * @see https://tiptap.dev/api/nodes/list-item.
93
- */
94
- const BulletList = core.Node.create({
95
- name: 'bulletList',
96
- addOptions() {
97
- return {
98
- itemTypeName: 'listItem',
99
- HTMLAttributes: {},
100
- keepMarks: false,
101
- keepAttributes: false,
102
- };
103
- },
104
- group: 'block list',
105
- content() {
106
- return `${this.options.itemTypeName}+`;
107
- },
108
- parseHTML() {
109
- return [
110
- { tag: 'ul' },
111
- ];
112
- },
113
- renderHTML({ HTMLAttributes }) {
114
- return ['ul', core.mergeAttributes(this.options.HTMLAttributes, HTMLAttributes), 0];
115
- },
116
- addCommands() {
117
- return {
118
- toggleBulletList: () => ({ commands, chain }) => {
119
- if (this.options.keepAttributes) {
120
- return chain().toggleList(this.name, this.options.itemTypeName, this.options.keepMarks).updateAttributes(ListItem.name, this.editor.getAttributes(TextStyle.name)).run();
121
- }
122
- return commands.toggleList(this.name, this.options.itemTypeName, this.options.keepMarks);
123
- },
124
- };
125
- },
126
- addKeyboardShortcuts() {
127
- return {
128
- 'Mod-Shift-8': () => this.editor.commands.toggleBulletList(),
129
- };
130
- },
131
- addInputRules() {
132
- let inputRule = core.wrappingInputRule({
133
- find: inputRegex,
134
- type: this.type,
135
- });
136
- if (this.options.keepMarks || this.options.keepAttributes) {
137
- inputRule = core.wrappingInputRule({
138
- find: inputRegex,
139
- type: this.type,
140
- keepMarks: this.options.keepMarks,
141
- keepAttributes: this.options.keepAttributes,
142
- getAttributes: () => { return this.editor.getAttributes(TextStyle.name); },
143
- editor: this.editor,
144
- });
145
- }
146
- return [
147
- inputRule,
148
- ];
149
- },
150
- });
151
-
152
- exports.BulletList = BulletList;
153
- exports.default = BulletList;
154
- exports.inputRegex = inputRegex;
155
-
156
- Object.defineProperty(exports, '__esModule', { value: true });
157
-
158
- }));
159
- //# sourceMappingURL=index.umd.js.map