@tiptap/extension-bullet-list
Advanced tools
Comparing version 3.0.0-next.4 to 3.0.0-next.5
@@ -1,51 +0,2 @@ | ||
import { Node } from '@tiptap/core'; | ||
interface BulletListOptions { | ||
/** | ||
* The node name for the list items | ||
* @default 'listItem' | ||
* @example 'paragraph' | ||
*/ | ||
itemTypeName: string; | ||
/** | ||
* HTML attributes to add to the bullet list element | ||
* @default {} | ||
* @example { class: 'foo' } | ||
*/ | ||
HTMLAttributes: Record<string, any>; | ||
/** | ||
* Keep the marks when splitting the list | ||
* @default false | ||
* @example true | ||
*/ | ||
keepMarks: boolean; | ||
/** | ||
* Keep the attributes when splitting the list | ||
* @default false | ||
* @example true | ||
*/ | ||
keepAttributes: boolean; | ||
} | ||
declare module '@tiptap/core' { | ||
interface Commands<ReturnType> { | ||
bulletList: { | ||
/** | ||
* Toggle a bullet list | ||
*/ | ||
toggleBulletList: () => ReturnType; | ||
}; | ||
} | ||
} | ||
/** | ||
* Matches a bullet list to a dash or asterisk. | ||
*/ | ||
declare const inputRegex: RegExp; | ||
/** | ||
* This extension allows you to create bullet lists. | ||
* This requires the ListItem extension | ||
* @see https://tiptap.dev/api/nodes/bullet-list | ||
* @see https://tiptap.dev/api/nodes/list-item. | ||
*/ | ||
declare const BulletList: Node<BulletListOptions, any>; | ||
export { BulletList, type BulletListOptions, BulletList as default, inputRegex }; | ||
import { BulletList } from '@tiptap/extension-list'; | ||
export { BulletList, BulletListOptions, BulletList as default } from '@tiptap/extension-list'; |
@@ -1,69 +0,10 @@ | ||
// src/bullet-list.ts | ||
import { mergeAttributes, Node, wrappingInputRule } from "@tiptap/core"; | ||
var ListItemName = "listItem"; | ||
var TextStyleName = "textStyle"; | ||
var inputRegex = /^\s*([-+*])\s$/; | ||
var BulletList = Node.create({ | ||
name: "bulletList", | ||
addOptions() { | ||
return { | ||
itemTypeName: "listItem", | ||
HTMLAttributes: {}, | ||
keepMarks: false, | ||
keepAttributes: false | ||
}; | ||
}, | ||
group: "block list", | ||
content() { | ||
return `${this.options.itemTypeName}+`; | ||
}, | ||
parseHTML() { | ||
return [{ tag: "ul" }]; | ||
}, | ||
renderHTML({ HTMLAttributes }) { | ||
return ["ul", mergeAttributes(this.options.HTMLAttributes, HTMLAttributes), 0]; | ||
}, | ||
addCommands() { | ||
return { | ||
toggleBulletList: () => ({ commands, chain }) => { | ||
if (this.options.keepAttributes) { | ||
return chain().toggleList(this.name, this.options.itemTypeName, this.options.keepMarks).updateAttributes(ListItemName, this.editor.getAttributes(TextStyleName)).run(); | ||
} | ||
return commands.toggleList(this.name, this.options.itemTypeName, this.options.keepMarks); | ||
} | ||
}; | ||
}, | ||
addKeyboardShortcuts() { | ||
return { | ||
"Mod-Shift-8": () => this.editor.commands.toggleBulletList() | ||
}; | ||
}, | ||
addInputRules() { | ||
let inputRule = wrappingInputRule({ | ||
find: inputRegex, | ||
type: this.type | ||
}); | ||
if (this.options.keepMarks || this.options.keepAttributes) { | ||
inputRule = wrappingInputRule({ | ||
find: inputRegex, | ||
type: this.type, | ||
keepMarks: this.options.keepMarks, | ||
keepAttributes: this.options.keepAttributes, | ||
getAttributes: () => { | ||
return this.editor.getAttributes(TextStyleName); | ||
}, | ||
editor: this.editor | ||
}); | ||
} | ||
return [inputRule]; | ||
} | ||
}); | ||
// src/index.ts | ||
import { BulletList } from "@tiptap/extension-list"; | ||
import { BulletList as BulletList2, BulletListOptions } from "@tiptap/extension-list"; | ||
var index_default = BulletList; | ||
export { | ||
BulletList, | ||
index_default as default, | ||
inputRegex | ||
BulletList2 as BulletList, | ||
BulletListOptions, | ||
index_default as default | ||
}; | ||
//# sourceMappingURL=index.js.map |
MIT License | ||
Copyright (c) 2024, Tiptap GmbH | ||
Copyright (c) 2025, Tiptap GmbH | ||
@@ -5,0 +5,0 @@ Permission is hereby granted, free of charge, to any person obtaining a copy |
{ | ||
"name": "@tiptap/extension-bullet-list", | ||
"description": "bullet list extension for tiptap", | ||
"version": "3.0.0-next.4", | ||
"version": "3.0.0-next.5", | ||
"homepage": "https://tiptap.dev", | ||
@@ -34,6 +34,6 @@ "keywords": [ | ||
"devDependencies": { | ||
"@tiptap/core": "^3.0.0-next.4" | ||
"@tiptap/extension-list": "^3.0.0-next.5" | ||
}, | ||
"peerDependencies": { | ||
"@tiptap/core": "^3.0.0-next.1" | ||
"@tiptap/extension-list": "^3.0.0-next.4" | ||
}, | ||
@@ -40,0 +40,0 @@ "repository": { |
@@ -1,5 +0,5 @@ | ||
import { BulletList } from './bullet-list.js' | ||
import { BulletList } from '@tiptap/extension-list' | ||
export * from './bullet-list.js' | ||
export { BulletList, BulletListOptions } from '@tiptap/extension-list' | ||
export default BulletList |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
6142
10
48
1