import {Mark} from "tiptap"; import {toggleMark} from "tiptap-commands"; // — Mot - Accronyme // — Mot - Etranger // — Nom - Auteur - Citation // — Nom - Auteur - Œuvre // — Nom - Marque // — Nom - Propre // — Numeral - Chapitre // — Numeral - Date // — Numeral - Siecle // — Typo - Particulier export default class CustomStyle extends Mark { get name() { return "customstyle"; } get defaultOptions() { return { types: [ "acronym", "foreign", "author-quotation", "author-work", "brand", "proper-noun", "century", "date", "chapter"] }; } get schema() { return { attrs: { type: { default: "acronym" } }, parseDOM: [ { tag: "span.dede-style", getAttrs(dom) { return {type: dom.classList[1]}; } } ], toDOM: mark => { return ["span", {class: `dede-style ${mark.attrs.type}`}, 0]; } }; } commands({type}) { return attrs => toggleMark(type, attrs); } }