{"version":3,"sources":["jsdelivr-header.js","/npm/@tiptap/extension-text-align@2.3.1/src/text-align.ts"],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA,oCCiBa,MAAA,UAAY,UAAU,OAAyB,CAC1D,KAAM,YAEN,WAAU,KACD,CACL,MAAO,GACP,WAAY,CAAC,OAAQ,SAAU,QAAS,WACxC,iBAAkB,SAItB,mBAAA,GACE,MAAO,CACL,CACE,MAAO,KAAK,QAAQ,MACpB,WAAY,CACV,UAAW,CACT,QAAS,KAAK,QAAQ,iBACtB,UAAW,GAAW,EAAQ,MAAM,WAAa,KAAK,QAAQ,iBAC9D,WAAY,GACN,EAAW,YAAc,KAAK,QAAQ,iBACjC,GAGF,CAAE,MAAO,eAAe,EAAW,gB,EAQtD,WAAA,GACE,MAAO,CACL,aAAe,GAAsB,EAAG,gBACjC,KAAK,QAAQ,WAAW,SAAS,IAI/B,KAAK,QAAQ,MAAM,OAAM,GAAQ,EAAS,iBAAiB,EAAM,CAAE,UAAW,MAGvF,eAAgB,IAAM,EAAG,cAChB,KAAK,QAAQ,MAAM,OAAM,GAAQ,EAAS,gBAAgB,EAAM,e,EAK7E,oBAAA,GACE,MAAO,CACL,cAAe,IAAM,KAAK,OAAO,SAAS,aAAa,QACvD,cAAe,IAAM,KAAK,OAAO,SAAS,aAAa,UACvD,cAAe,IAAM,KAAK,OAAO,SAAS,aAAa,SACvD,cAAe,IAAM,KAAK,OAAO,SAAS,aAAa,W","file":"/npm/@tiptap/extension-text-align@2.3.1/dist/index.js","sourceRoot":"","sourcesContent":["/**\n * Minified by jsDelivr using Terser v5.39.0.\n * Original file: /npm/@tiptap/extension-text-align@2.3.1/dist/index.js\n *\n * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files\n */\n","import { Extension } from '@tiptap/core'\n\nexport interface TextAlignOptions {\n  types: string[],\n  alignments: string[],\n  defaultAlignment: string,\n}\n\ndeclare module '@tiptap/core' {\n  interface Commands<ReturnType> {\n    textAlign: {\n      /**\n       * Set the text align attribute\n       */\n      setTextAlign: (alignment: string) => ReturnType,\n      /**\n       * Unset the text align attribute\n       */\n      unsetTextAlign: () => ReturnType,\n    }\n  }\n}\n\nexport const TextAlign = Extension.create<TextAlignOptions>({\n  name: 'textAlign',\n\n  addOptions() {\n    return {\n      types: [],\n      alignments: ['left', 'center', 'right', 'justify'],\n      defaultAlignment: 'left',\n    }\n  },\n\n  addGlobalAttributes() {\n    return [\n      {\n        types: this.options.types,\n        attributes: {\n          textAlign: {\n            default: this.options.defaultAlignment,\n            parseHTML: element => element.style.textAlign || this.options.defaultAlignment,\n            renderHTML: attributes => {\n              if (attributes.textAlign === this.options.defaultAlignment) {\n                return {}\n              }\n\n              return { style: `text-align: ${attributes.textAlign}` }\n            },\n          },\n        },\n      },\n    ]\n  },\n\n  addCommands() {\n    return {\n      setTextAlign: (alignment: string) => ({ commands }) => {\n        if (!this.options.alignments.includes(alignment)) {\n          return false\n        }\n\n        return this.options.types.every(type => commands.updateAttributes(type, { textAlign: alignment }))\n      },\n\n      unsetTextAlign: () => ({ commands }) => {\n        return this.options.types.every(type => commands.resetAttributes(type, 'textAlign'))\n      },\n    }\n  },\n\n  addKeyboardShortcuts() {\n    return {\n      'Mod-Shift-l': () => this.editor.commands.setTextAlign('left'),\n      'Mod-Shift-e': () => this.editor.commands.setTextAlign('center'),\n      'Mod-Shift-r': () => this.editor.commands.setTextAlign('right'),\n      'Mod-Shift-j': () => this.editor.commands.setTextAlign('justify'),\n    }\n  },\n})\n"]}