{"version":3,"file":"set-text-alignment-Bgdg7-5y.mjs","names":[],"sources":["../src/utils/set-text-alignment.ts"],"sourcesContent":["import type { Editor } from '@tiptap/core';\n\nexport function setTextAlignment(editor: Editor, alignment: string) {\n  const { from, to } = editor.state.selection;\n  const tr = editor.state.tr;\n  editor.state.doc.nodesBetween(from, to, (node, pos) => {\n    if (node.isTextblock) {\n      const prop = 'align' in node.attrs ? 'align' : 'alignment';\n      tr.setNodeMarkup(pos, null, { ...node.attrs, [prop]: alignment });\n    }\n  });\n  editor.view.dispatch(tr);\n}\n"],"mappings":";AAEA,SAAgB,iBAAiB,QAAgB,WAAmB;CAClE,MAAM,EAAE,MAAM,OAAO,OAAO,MAAM;CAClC,MAAM,KAAK,OAAO,MAAM;AACxB,QAAO,MAAM,IAAI,aAAa,MAAM,KAAK,MAAM,QAAQ;AACrD,MAAI,KAAK,aAAa;GACpB,MAAM,OAAO,WAAW,KAAK,QAAQ,UAAU;AAC/C,MAAG,cAAc,KAAK,MAAM;IAAE,GAAG,KAAK;KAAQ,OAAO;IAAW,CAAC;;GAEnE;AACF,QAAO,KAAK,SAAS,GAAG"}