{"version":3,"sources":["jsdelivr-header.js","/npm/@tiptap/extension-text-align@2.11.9/src/text-align.ts"],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA,0DC+Ca,MAAA,EAAY,EAAU,OAAyB,CAC1D,KAAM,YAEN,WAAU,KACD,CACL,MAAO,GACP,WAAY,CAAC,OAAQ,SAAU,QAAS,WACxC,iBAAkB,OAItB,mBAAA,GACE,MAAO,CACL,CACE,MAAO,KAAK,QAAQ,MACpB,WAAY,CACV,UAAW,CACT,QAAS,KAAK,QAAQ,iBACtB,UAAW,IACT,MAAM,EAAY,EAAQ,MAAM,UAEhC,OAAO,KAAK,QAAQ,WAAW,SAAS,GAAa,EAAY,KAAK,QAAQ,gBAAgB,EAEhG,WAAY,GACL,EAAW,UAIT,CAAE,MAAO,eAAe,EAAW,aAHjC,MASpB,EAED,WAAA,GACE,MAAO,CACL,aAAe,GAAsB,EAAG,gBACjC,KAAK,QAAQ,WAAW,SAAS,IAI/B,KAAK,QAAQ,MACjB,KAAI,GAAQ,EAAS,iBAAiB,EAAM,CAAE,UAAW,MACzD,OAAM,GAAY,IAGvB,eAAgB,IAAM,EAAG,cAChB,KAAK,QAAQ,MACjB,KAAI,GAAQ,EAAS,gBAAgB,EAAM,eAC3C,OAAM,GAAY,IAGvB,gBAAiB,GAAa,EAAG,SAAQ,gBAClC,KAAK,QAAQ,WAAW,SAAS,KAIlC,EAAO,SAAS,CAAE,UAAW,IACxB,EAAS,iBAEX,EAAS,aAAa,IAGlC,EAED,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,WAE1D,W","file":"/npm/@tiptap/extension-text-align@2.11.9/dist/index.js/+esm","sourceRoot":"","sourcesContent":["/**\n * Bundled by jsDelivr using Rollup v2.79.2 and Terser v5.39.0.\n * Original file: /npm/@tiptap/extension-text-align@2.11.9/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  /**\n   * The types where the text align attribute can be applied.\n   * @default []\n   * @example ['heading', 'paragraph']\n   */\n  types: string[],\n\n  /**\n   * The alignments which are allowed.\n   * @default ['left', 'center', 'right', 'justify']\n   * @example ['left', 'right']\n   */\n  alignments: string[],\n\n  /**\n   * The default alignment.\n   * @default null\n   * @example 'center'\n   */\n  defaultAlignment: string | null,\n}\n\ndeclare module '@tiptap/core' {\n  interface Commands<ReturnType> {\n    textAlign: {\n      /**\n       * Set the text align attribute\n       * @param alignment The alignment\n       * @example editor.commands.setTextAlign('left')\n       */\n      setTextAlign: (alignment: string) => ReturnType,\n      /**\n       * Unset the text align attribute\n       * @example editor.commands.unsetTextAlign()\n       */\n      unsetTextAlign: () => ReturnType,\n      /**\n       * Toggle the text align attribute\n       * @param alignment The alignment\n       * @example editor.commands.toggleTextAlign('right')\n       */\n      toggleTextAlign: (alignment: string) => ReturnType,\n    }\n  }\n}\n\n/**\n * This extension allows you to align text.\n * @see https://www.tiptap.dev/api/extensions/text-align\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: null,\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 => {\n              const alignment = element.style.textAlign\n\n              return this.options.alignments.includes(alignment) ? alignment : this.options.defaultAlignment\n            },\n            renderHTML: attributes => {\n              if (!attributes.textAlign) {\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\n          .map(type => commands.updateAttributes(type, { textAlign: alignment }))\n          .every(response => response)\n      },\n\n      unsetTextAlign: () => ({ commands }) => {\n        return this.options.types\n          .map(type => commands.resetAttributes(type, 'textAlign'))\n          .every(response => response)\n      },\n\n      toggleTextAlign: alignment => ({ editor, commands }) => {\n        if (!this.options.alignments.includes(alignment)) {\n          return false\n        }\n\n        if (editor.isActive({ textAlign: alignment })) {\n          return commands.unsetTextAlign()\n        }\n        return commands.setTextAlign(alignment)\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"]}