tiptap-extension-ordered-list
v1.0.0
Published
Tiptap ordered list extension with custom list-style-type support.
Downloads
44
Maintainers
Readme
tiptap-extension-ordered-list
Install
npm install tiptap-extension-ordered-list -S
Usage
const listType = e.target.dataset.listType; // decimal lower-alpha lower-roman upper-alpha upper-roman
let chain = editor.chain().focus();
// 开启列表类型
if (!editor.isActive("orderedList")) {
chain.toggleOrderedList().updateAttributes("orderedList", { listStyleType });
}
// 切换列表类型
else if (editor.getAttributes("orderedList").listStyleType !== listStyleType) {
chain.updateAttributes("orderedList", { listStyleType });
}
// 关闭列表类型
else {
chain.toggleOrderedList();
}
Options
Add listStyleType
option, other options are same as @tiptap/extension-ordered-list
import OrderedList from "tiptap-extension-ordered-list";
const editor = new Editor({
element: document.querySelector(".editor"),
extensions: [
StarterKit,
OrderedList.configure({
listStyleType: "decimal", // default decimal
HTMLAttributes: { class: "list-paddingleft-1" },
}),
],
});
Relations
@tiptap/extension-ordered-list: https://github.com/ueberdosis/tiptap/tree/develop/packages/extension-ordered-list
tiptap-appmsg-editor: https://github.com/KID-1912/tiptap-appmsg-editor