@edifice.io/tiptap-extensions
Version:
Edifice Rich Text Editor Extensions
1 lines • 1.1 kB
Source Map (JSON)
{"version":3,"file":"paragraph.cjs","sources":["../../src/paragraph/paragraph.ts"],"sourcesContent":["import { Paragraph as TiptapParagraph } from '@tiptap/extension-paragraph';\n\n/**\n * Extends `Paragraph` extension from TipTap.\n *\n * This extension is used to parse documents in old-format (version 0),\n * where text alignments were applied on a <div> wrapping a <span>.\n * The new format is a <p> with style attributes.\n *\n * For example :\n * `<div style=\"text-align: right;\"><span style=\"font-size: 20pt;\">A right-aligned text</span></div>`\n * is now parsed and rendered as\n * `<p style=\"text-align: right;\"><span style=\"font-size: 20pt;\">A right-aligned text</span></p>`\n */\nexport const Paragraph = TiptapParagraph.extend({\n parseHTML() {\n const parentRules = this.parent?.() ?? [];\n return [\n ...parentRules,\n {\n tag: 'div[style]:has(> span)',\n },\n ];\n },\n});\n"],"names":["TiptapParagraph"],"mappings":"gJAca,UAAYA,mBAAAA,UAAgB,OAAO,CAC9C,WAAY,QAEV,MAAO,CACL,KAFkB,QAAK,SAAL,4BAAmB,CAAA,EAGrC,CACE,IAAK,wBAAA,CACP,CAEJ,CACF,CAAC"}