Skip to content

Tiptap ordered list extension with custom list-style-type support.

Notifications You must be signed in to change notification settings

KID-1912/tiptap-extension-ordered-list

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

tiptap-extension-ordered-list

Tiptap ordered list extension with custom list-style-type support.


NPM URL version



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

About

Tiptap ordered list extension with custom list-style-type support.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published