JSPM

tiptap-extension-ordered-list

1.0.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 9
  • Score
    100M100P100Q62977F
  • License ISC

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

Package Exports

  • tiptap-extension-ordered-list
  • tiptap-extension-ordered-list/src/index.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (tiptap-extension-ordered-list) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

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