{"version":3,"file":"information-pane.cjs","sources":["../../src/information-pane/information-pane.ts"],"sourcesContent":["import { Node, mergeAttributes } from '@tiptap/core';\n\ndeclare module '@tiptap/core' {\n  interface Commands<ReturnType> {\n    informationPane: {\n      /**\n       * Set a informationPane node\n       * @param type The type of the informationPane\n       */\n      setInformationPane: (type?: string) => ReturnType;\n    };\n  }\n}\n\nexport const InformationPane = Node.create({\n  name: 'information-pane',\n\n  group: 'block',\n  content: 'block+',\n  defining: true,\n  marks: '',\n\n  addAttributes() {\n    return {\n      type: {\n        default: 'info', // type par défaut\n        parseHTML: (element) => element.getAttribute('data-type') || 'info',\n        renderHTML: (attributes) => {\n          return {\n            'data-type': attributes.type,\n          };\n        },\n      },\n    };\n  },\n\n  parseHTML() {\n    return [\n      {\n        tag: 'div[data-information-pane]',\n      },\n    ];\n  },\n\n  renderHTML({ node, HTMLAttributes }) {\n    const type = node.attrs.type;\n    return [\n      'div',\n      mergeAttributes(HTMLAttributes, {\n        'data-information-pane': '',\n        'class': `information-pane information-pane-${type}`,\n      }),\n      0,\n    ];\n  },\n\n  addCommands() {\n    return {\n      setInformationPane:\n        (type = 'info') =>\n        ({ commands }) => {\n          return commands.insertContent([\n            {\n              type: this.name,\n              attrs: { type },\n              content: [\n                {\n                  type: 'paragraph',\n                },\n              ],\n            },\n          ]);\n        },\n    };\n  },\n});\n"],"names":["Node","mergeAttributes"],"mappings":"mHAca,gBAAkBA,KAAAA,KAAK,OAAO,CACzC,KAAM,mBAEN,MAAO,QACP,QAAS,SACT,SAAU,GACV,MAAO,GAEP,eAAgB,CACd,MAAO,CACL,KAAM,CACJ,QAAS,OACT,UAAY,SAAY,QAAQ,aAAa,WAAW,GAAK,OAC7D,WAAa,aACJ,CACL,YAAa,WAAW,IAAA,EAE5B,CACF,CAEJ,EAEA,WAAY,CACV,MAAO,CACL,CACE,IAAK,4BAAA,CACP,CAEJ,EAEA,WAAW,CAAE,KAAM,gBAAkB,CACnC,MAAM,KAAO,KAAK,MAAM,KACxB,MAAO,CACL,MACAC,KAAAA,gBAAgB,eAAgB,CAC9B,wBAAyB,GACzB,MAAS,qCAAqC,IAAI,EAAA,CACnD,EACD,CAAA,CAEJ,EAEA,aAAc,CACZ,MAAO,CACL,mBACE,CAAC,KAAO,SACR,CAAC,CAAE,YACM,SAAS,cAAc,CAC5B,CACE,KAAM,KAAK,KACX,MAAO,CAAE,IAAA,EACT,QAAS,CACP,CACE,KAAM,WAAA,CACR,CACF,CACF,CACD,CACH,CAEN,CACF,CAAC"}