UNPKG

tldraw

Version:

A tiny little drawing editor.

32 lines (31 loc) 789 B
import { Extension } from "@tiptap/core"; const TextDirection = Extension.create({ name: "textDirection", addGlobalAttributes() { return [ { types: ["heading", "paragraph"], attributes: { dir: { default: "auto", parseHTML: (element) => { const dirAttribute = element.getAttribute("dir"); if (dirAttribute && ["ltr", "rtl", "auto"].includes(dirAttribute)) { return dirAttribute; } else { return "auto"; } }, renderHTML: (attributes) => { return { dir: attributes.dir }; } } } } ]; } }); export { TextDirection }; //# sourceMappingURL=textDirection.mjs.map