@edifice.io/tiptap-extensions 2.6.9-develop-enabling.20261013152718 → 2.6.9-develop-integration.20261014191834

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (110) hide show
  1. package/dist/abbr/abbr.cjs +2 -2
  2. package/dist/abbr/abbr.cjs.map +1 -1
  3. package/dist/abbr/abbr.js +33 -2
  4. package/dist/abbr/abbr.js.map +1 -1
  5. package/dist/alert/alert.cjs +2 -2
  6. package/dist/alert/alert.cjs.map +1 -1
  7. package/dist/alert/alert.js +45 -2
  8. package/dist/alert/alert.js.map +1 -1
  9. package/dist/attachment/attachment-transformer.cjs +2 -2
  10. package/dist/attachment/attachment-transformer.cjs.map +1 -1
  11. package/dist/attachment/attachment-transformer.js +76 -2
  12. package/dist/attachment/attachment-transformer.js.map +1 -1
  13. package/dist/attachment/attachment.cjs +2 -2
  14. package/dist/attachment/attachment.cjs.map +1 -1
  15. package/dist/attachment/attachment.js +98 -2
  16. package/dist/attachment/attachment.js.map +1 -1
  17. package/dist/audio/audio.cjs +2 -2
  18. package/dist/audio/audio.cjs.map +1 -1
  19. package/dist/audio/audio.js +52 -3
  20. package/dist/audio/audio.js.map +1 -1
  21. package/dist/conversation-history/conversation-history.cjs +2 -2
  22. package/dist/conversation-history/conversation-history.cjs.map +1 -1
  23. package/dist/conversation-history/conversation-history.js +63 -2
  24. package/dist/conversation-history/conversation-history.js.map +1 -1
  25. package/dist/conversation-history-body/conversation-history-body.cjs +2 -2
  26. package/dist/conversation-history-body/conversation-history-body.cjs.map +1 -1
  27. package/dist/conversation-history-body/conversation-history-body.js +24 -2
  28. package/dist/conversation-history-body/conversation-history-body.js.map +1 -1
  29. package/dist/font-size/font-size.cjs +2 -2
  30. package/dist/font-size/font-size.cjs.map +1 -1
  31. package/dist/font-size/font-size.js +39 -2
  32. package/dist/font-size/font-size.js.map +1 -1
  33. package/dist/heading/heading.cjs +2 -2
  34. package/dist/heading/heading.cjs.map +1 -1
  35. package/dist/heading/heading.js +46 -2
  36. package/dist/heading/heading.js.map +1 -1
  37. package/dist/highlight/highlight.cjs +2 -2
  38. package/dist/highlight/highlight.cjs.map +1 -1
  39. package/dist/highlight/highlight.js +28 -2
  40. package/dist/highlight/highlight.js.map +1 -1
  41. package/dist/hyperlink/hyperlink.cjs +2 -2
  42. package/dist/hyperlink/hyperlink.cjs.map +1 -1
  43. package/dist/hyperlink/hyperlink.js +53 -2
  44. package/dist/hyperlink/hyperlink.js.map +1 -1
  45. package/dist/iframe/iframe.cjs +2 -2
  46. package/dist/iframe/iframe.cjs.map +1 -1
  47. package/dist/iframe/iframe.js +70 -2
  48. package/dist/iframe/iframe.js.map +1 -1
  49. package/dist/iframe/transformers/index.cjs +2 -2
  50. package/dist/iframe/transformers/index.cjs.map +1 -1
  51. package/dist/iframe/transformers/index.js +22 -2
  52. package/dist/iframe/transformers/index.js.map +1 -1
  53. package/dist/iframe/transformers/pad-transformer.cjs +2 -2
  54. package/dist/iframe/transformers/pad-transformer.cjs.map +1 -1
  55. package/dist/iframe/transformers/pad-transformer.js +24 -2
  56. package/dist/iframe/transformers/pad-transformer.js.map +1 -1
  57. package/dist/image/image.cjs +2 -2
  58. package/dist/image/image.cjs.map +1 -1
  59. package/dist/image/image.js +175 -2
  60. package/dist/image/image.js.map +1 -1
  61. package/dist/index.cjs +2 -1
  62. package/dist/index.cjs.map +1 -0
  63. package/dist/index.js +52 -1
  64. package/dist/index.js.map +1 -0
  65. package/dist/information-pane/information-pane.cjs +2 -2
  66. package/dist/information-pane/information-pane.cjs.map +1 -1
  67. package/dist/information-pane/information-pane.js +57 -2
  68. package/dist/information-pane/information-pane.js.map +1 -1
  69. package/dist/line-height/line-height.cjs +2 -2
  70. package/dist/line-height/line-height.cjs.map +1 -1
  71. package/dist/line-height/line-height.js +33 -2
  72. package/dist/line-height/line-height.js.map +1 -1
  73. package/dist/linker/linker.cjs +2 -2
  74. package/dist/linker/linker.cjs.map +1 -1
  75. package/dist/linker/linker.js +96 -2
  76. package/dist/linker/linker.js.map +1 -1
  77. package/dist/mathjax/mathjax.cjs +2 -2
  78. package/dist/mathjax/mathjax.cjs.map +1 -1
  79. package/dist/mathjax/mathjax.js +40 -2
  80. package/dist/mathjax/mathjax.js.map +1 -1
  81. package/dist/paragraph/paragraph.cjs +2 -2
  82. package/dist/paragraph/paragraph.cjs.map +1 -1
  83. package/dist/paragraph/paragraph.js +16 -2
  84. package/dist/paragraph/paragraph.js.map +1 -1
  85. package/dist/speech-recognition/speech-recognition.cjs +2 -2
  86. package/dist/speech-recognition/speech-recognition.cjs.map +1 -1
  87. package/dist/speech-recognition/speech-recognition.js +56 -2
  88. package/dist/speech-recognition/speech-recognition.js.map +1 -1
  89. package/dist/speech-synthesis/speech-synthesis.cjs +2 -2
  90. package/dist/speech-synthesis/speech-synthesis.cjs.map +1 -1
  91. package/dist/speech-synthesis/speech-synthesis.js +25 -2
  92. package/dist/speech-synthesis/speech-synthesis.js.map +1 -1
  93. package/dist/table-cell/table-cell.cjs +2 -2
  94. package/dist/table-cell/table-cell.cjs.map +1 -1
  95. package/dist/table-cell/table-cell.js +23 -2
  96. package/dist/table-cell/table-cell.js.map +1 -1
  97. package/dist/transform/html-to-json/html-to-json.cjs +2 -2
  98. package/dist/transform/html-to-json/html-to-json.cjs.map +1 -1
  99. package/dist/transform/html-to-json/html-to-json.js +6 -2
  100. package/dist/transform/html-to-json/html-to-json.js.map +1 -1
  101. package/dist/transform/json-to-html/json-to-html.cjs +2 -2
  102. package/dist/transform/json-to-html/json-to-html.cjs.map +1 -1
  103. package/dist/transform/json-to-html/json-to-html.js +6 -2
  104. package/dist/transform/json-to-html/json-to-html.js.map +1 -1
  105. package/dist/video/video.cjs +3 -3
  106. package/dist/video/video.cjs.map +1 -1
  107. package/dist/video/video.js +92 -3
  108. package/dist/video/video.js.map +1 -1
  109. package/package.json +5 -5
  110. package/dist/_virtual/_rolldown/runtime.cjs +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"audio.js","names":[],"sources":["../../src/audio/audio.ts"],"sourcesContent":["import { mergeAttributes, Node } from '@tiptap/core';\n\nexport interface AudioOptions {\n url: string;\n HTMLAttributes: Record<string, any>;\n}\n\ndeclare module '@tiptap/core' {\n interface Commands<ReturnType> {\n audio: {\n /**\n * Set a audio node\n * @param options.updateSelection set to true will select the newly inserted content\n */\n setAudio: (\n id: string,\n src: string,\n options?: { updateSelection: boolean },\n ) => ReturnType;\n };\n }\n}\n\nexport const Audio = Node.create({\n name: 'audio',\n group: 'block',\n\n selectable: true,\n draggable: true,\n\n addAttributes() {\n return {\n src: {\n default: null,\n parseHTML: (el: any) => (el as HTMLAudioElement).getAttribute('src'),\n renderHTML: (attrs: any) => ({ src: attrs.src }),\n },\n documentId: {\n default: '',\n renderHTML: (attributes: any) => {\n return { 'data-document-id': attributes.documentId };\n },\n parseHTML: (element: any) => element.getAttribute('data-document-id'),\n },\n };\n },\n\n parseHTML() {\n return [\n {\n tag: 'div.audio-wrapper>audio,audio',\n getAttrs: (el: any) => ({\n src: (el as HTMLAudioElement).getAttribute('src'),\n }),\n },\n ];\n },\n\n renderHTML({ HTMLAttributes }) {\n return [\n 'div',\n { class: 'audio-wrapper' },\n ['audio', mergeAttributes(HTMLAttributes)],\n ];\n },\n\n addCommands() {\n return {\n setAudio:\n (id, src, options) =>\n ({ commands, state }) => {\n return commands.insertContentAt(\n state.selection,\n `<audio \n src=\"${src}\" \n controls preload=\"none\"\n data-document-id=\"${id}\"></audio>`,\n options,\n );\n },\n };\n },\n});\n"],"mappings":"+CAuBA,IAAa,MAAQ,KAAK,OAAO,CAC/B,KAAM,QACN,MAAO,QAEP,WAAY,GACZ,UAAW,GAEX,eAAgB,CACd,MAAO,CACL,IAAK,CACH,QAAS,KACT,UAAY,IAAa,GAAwB,aAAa,KAAK,EACnE,WAAa,QAAgB,CAAE,IAAK,MAAM,GAAI,EAChD,EACA,WAAY,CACV,QAAS,GACT,WAAa,aACJ,CAAE,mBAAoB,WAAW,UAAW,GAErD,UAAY,SAAiB,QAAQ,aAAa,kBAAkB,CACtE,CACF,CACF,EAEA,WAAY,CACV,MAAO,CACL,CACE,IAAK,gCACL,SAAW,KAAa,CACtB,IAAM,GAAwB,aAAa,KAAK,CAClD,EACF,CACF,CACF,EAEA,WAAW,CAAE,gBAAkB,CAC7B,MAAO,CACL,MACA,CAAE,MAAO,eAAgB,EACzB,CAAC,QAAS,gBAAgB,cAAc,CAAC,CAC3C,CACF,EAEA,aAAc,CACZ,MAAO,CACL,UACG,GAAI,IAAK,WACT,CAAE,SAAU,SACJ,SAAS,gBACd,MAAM,UACN;qBACS,IAAI;;kCAES,GAAG,YACzB,OACF,CAEN,CACF,CACF,CAAC"}
1
+ {"version":3,"file":"audio.js","sources":["../../src/audio/audio.ts"],"sourcesContent":["import { mergeAttributes, Node } from '@tiptap/core';\n\nexport interface AudioOptions {\n url: string;\n HTMLAttributes: Record<string, any>;\n}\n\ndeclare module '@tiptap/core' {\n interface Commands<ReturnType> {\n audio: {\n /**\n * Set a audio node\n * @param options.updateSelection set to true will select the newly inserted content\n */\n setAudio: (\n id: string,\n src: string,\n options?: { updateSelection: boolean },\n ) => ReturnType;\n };\n }\n}\n\nexport const Audio = Node.create({\n name: 'audio',\n group: 'block',\n\n selectable: true,\n draggable: true,\n\n addAttributes() {\n return {\n src: {\n default: null,\n parseHTML: (el: any) => (el as HTMLAudioElement).getAttribute('src'),\n renderHTML: (attrs: any) => ({ src: attrs.src }),\n },\n documentId: {\n default: '',\n renderHTML: (attributes: any) => {\n return { 'data-document-id': attributes.documentId };\n },\n parseHTML: (element: any) => element.getAttribute('data-document-id'),\n },\n };\n },\n\n parseHTML() {\n return [\n {\n tag: 'div.audio-wrapper>audio,audio',\n getAttrs: (el: any) => ({\n src: (el as HTMLAudioElement).getAttribute('src'),\n }),\n },\n ];\n },\n\n renderHTML({ HTMLAttributes }) {\n return [\n 'div',\n { class: 'audio-wrapper' },\n ['audio', mergeAttributes(HTMLAttributes)],\n ];\n },\n\n addCommands() {\n return {\n setAudio:\n (id, src, options) =>\n ({ commands, state }) => {\n return commands.insertContentAt(\n state.selection,\n `<audio \n src=\"${src}\" \n controls preload=\"none\"\n data-document-id=\"${id}\"></audio>`,\n options,\n );\n },\n };\n },\n});\n"],"names":[],"mappings":";AAuBO,MAAM,QAAQ,KAAK,OAAO;AAAA,EAC/B,MAAM;AAAA,EACN,OAAO;AAAA,EAEP,YAAY;AAAA,EACZ,WAAW;AAAA,EAEX,gBAAgB;AACd,WAAO;AAAA,MACL,KAAK;AAAA,QACH,SAAS;AAAA,QACT,WAAW,CAAC,OAAa,GAAwB,aAAa,KAAK;AAAA,QACnE,YAAY,CAAC,WAAgB,EAAE,KAAK,MAAM,IAAA;AAAA,MAAI;AAAA,MAEhD,YAAY;AAAA,QACV,SAAS;AAAA,QACT,YAAY,CAAC,gBACJ,EAAE,oBAAoB,WAAW,WAAA;AAAA,QAE1C,WAAW,CAAC,YAAiB,QAAQ,aAAa,kBAAkB;AAAA,MAAA;AAAA,IACtE;AAAA,EAEJ;AAAA,EAEA,YAAY;AACV,WAAO;AAAA,MACL;AAAA,QACE,KAAK;AAAA,QACL,UAAU,CAAC,QAAa;AAAA,UACtB,KAAM,GAAwB,aAAa,KAAK;AAAA,QAAA;AAAA,MAClD;AAAA,IACF;AAAA,EAEJ;AAAA,EAEA,WAAW,EAAE,kBAAkB;AAC7B,WAAO;AAAA,MACL;AAAA,MACA,EAAE,OAAO,gBAAA;AAAA,MACT,CAAC,SAAS,gBAAgB,cAAc,CAAC;AAAA,IAAA;AAAA,EAE7C;AAAA,EAEA,cAAc;AACZ,WAAO;AAAA,MACL,UACE,CAAC,IAAI,KAAK,YACV,CAAC,EAAE,UAAU,YACJ,SAAS;AAAA,QACd,MAAM;AAAA,QACN;AAAA,qBACS,GAAG;AAAA;AAAA,kCAEU,EAAE;AAAA,QACxB;AAAA,MAAA;AAAA,IAEJ;AAAA,EAEN;AACF,CAAC;"}
@@ -1,2 +1,2 @@
1
- let _tiptap_core=require("@tiptap/core"),prosemirror_state=require("prosemirror-state");var ConversationHistory=_tiptap_core.Node.create({name:`converstationHistory`,group:`block`,content:`block+`,parseHTML(){return[{tag:`div.conversation-history`}]},renderHTML({HTMLAttributes}){return[`div`,(0,_tiptap_core.mergeAttributes)(HTMLAttributes,{class:`conversation-history`}),0]},addProseMirrorPlugins(){return[new prosemirror_state.Plugin({appendTransaction:(transactions,oldState,newState)=>{let tr=newState.tr,modified=!1,nodesAfterHr=[];return newState.doc.descendants((node,pos,parent)=>{if(node.type.name===`horizontalRule`&&parent.type.name===`doc`){let start=pos,end=newState.doc.content.size;if(newState.doc.nodesBetween(start,end,(n,p,parent)=>{if(n.type.name!==`horizontalRule`&&parent.type.name===`doc`)nodesAfterHr.push({node:n,pos:p});else return!1}),nodesAfterHr.length>0){let groupNode=this.type.create({},nodesAfterHr.map(n=>n.node));tr.replaceWith(start,end,groupNode),modified=!0}return!1}}),modified?tr:null}})]}});exports.ConversationHistory=ConversationHistory;
2
- //# sourceMappingURL=conversation-history.cjs.map
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const core=require("@tiptap/core"),prosemirrorState=require("prosemirror-state"),ConversationHistory=core.Node.create({name:"converstationHistory",group:"block",content:"block+",parseHTML(){return[{tag:"div.conversation-history"}]},renderHTML({HTMLAttributes}){return["div",core.mergeAttributes(HTMLAttributes,{class:"conversation-history"}),0]},addProseMirrorPlugins(){return[new prosemirrorState.Plugin({appendTransaction:(transactions,oldState,newState)=>{const tr=newState.tr;let modified=!1;const nodesAfterHr=[];return newState.doc.descendants((node,pos,parent)=>{if(node.type.name==="horizontalRule"&&parent.type.name==="doc"){const start=pos,end=newState.doc.content.size;if(newState.doc.nodesBetween(start,end,(n,p,parent2)=>{if(n.type.name!=="horizontalRule"&&parent2.type.name==="doc")nodesAfterHr.push({node:n,pos:p});else return!1}),nodesAfterHr.length>0){const groupNode=this.type.create({},nodesAfterHr.map(n=>n.node));tr.replaceWith(start,end,groupNode),modified=!0}return!1}}),modified?tr:null}})]}});exports.ConversationHistory=ConversationHistory;
2
+ //# sourceMappingURL=conversation-history.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"conversation-history.cjs","names":[],"sources":["../../src/conversation-history/conversation-history.ts"],"sourcesContent":["/**\n * A Tiptap Node extension that creates a conversation history container.\n * This extension groups content blocks that appear after a horizontal rule\n * into a conversation history section.\n *\n * @extends Node\n *\n * @remarks\n * The node is rendered as a div element with the class 'conversation-history'.\n * It can parse HTML elements that match the same structure.\n *\n * For retrocompatibility, this extension also includes a ProseMirror plugin\n * that handles the grouping all the content after an horizontal rules into the\n * conversation-history children block.\n *\n * Usage:\n * ```\n * // Add to your Tiptap editor extensions\n * import { ConversationHistory } from './conversation-history'\n *\n * new Editor({\n * extensions: [\n * ConversationHistory,\n * // ... other extensions\n * ],\n * })\n * ```\n */\nimport { mergeAttributes, Node } from '@tiptap/core';\nimport { Plugin } from 'prosemirror-state';\n\nexport const ConversationHistory = Node.create({\n name: 'converstationHistory',\n group: 'block',\n content: 'block+',\n\n parseHTML() {\n return [\n {\n tag: 'div.conversation-history',\n },\n ];\n },\n\n renderHTML({ HTMLAttributes }) {\n return [\n 'div',\n mergeAttributes(HTMLAttributes, { class: 'conversation-history' }),\n 0,\n ];\n },\n\n /**\n * Adds custom ProseMirror plugins to the editor.\n * When a horizontal rule is encountered, this plugin collects all nodes\n * following the horizontal rule until the end of the document.\n * These nodes are then grouped together and replaced with\n * a single node of the same type as the plugin's type.\n *\n * @returns {Plugin[]} An array of ProseMirror plugins.\n */\n addProseMirrorPlugins() {\n return [\n new Plugin({\n appendTransaction: (transactions, oldState, newState) => {\n const tr = newState.tr;\n let modified = false;\n const nodesAfterHr = [];\n\n newState.doc.descendants((node, pos, parent) => {\n if (\n node.type.name === 'horizontalRule' &&\n parent.type.name === 'doc'\n ) {\n const start = pos;\n const end = newState.doc.content.size;\n\n newState.doc.nodesBetween(start, end, (n, p, parent) => {\n if (\n n.type.name !== 'horizontalRule' &&\n parent.type.name === 'doc'\n ) {\n nodesAfterHr.push({ node: n, pos: p });\n } else {\n return false;\n }\n });\n\n if (nodesAfterHr.length > 0) {\n const groupNode = this.type.create(\n {},\n nodesAfterHr.map((n) => n.node),\n );\n tr.replaceWith(start, end, groupNode);\n modified = true;\n }\n return false;\n }\n });\n\n return modified ? tr : null;\n },\n }),\n ];\n },\n});\n"],"mappings":"wFA+BA,IAAa,oBAAsB,aAAA,KAAK,OAAO,CAC7C,KAAM,uBACN,MAAO,QACP,QAAS,SAET,WAAY,CACV,MAAO,CACL,CACE,IAAK,0BACP,CACF,CACF,EAEA,WAAW,CAAE,gBAAkB,CAC7B,MAAO,CACL,uCACgB,eAAgB,CAAE,MAAO,sBAAuB,CAAC,EACjE,CACF,CACF,EAWA,uBAAwB,CACtB,MAAO,CACL,IAAI,kBAAA,OAAO,CACT,mBAAoB,aAAc,SAAU,WAAa,CACvD,IAAM,GAAK,SAAS,GAChB,SAAW,GACT,aAAe,CAAC,EAiCtB,OA/BA,SAAS,IAAI,aAAa,KAAM,IAAK,SAAW,CAC9C,GACE,KAAK,KAAK,OAAS,kBACnB,OAAO,KAAK,OAAS,MACrB,CACA,IAAM,MAAQ,IACR,IAAM,SAAS,IAAI,QAAQ,KAajC,GAXA,SAAS,IAAI,aAAa,MAAO,KAAM,EAAG,EAAG,SAAW,CACtD,GACE,EAAE,KAAK,OAAS,kBAChB,OAAO,KAAK,OAAS,MAErB,aAAa,KAAK,CAAE,KAAM,EAAG,IAAK,CAAE,CAAC,OAErC,MAAO,EAEX,CAAC,EAEG,aAAa,OAAS,EAAG,CAC3B,IAAM,UAAY,KAAK,KAAK,OAC1B,CAAC,EACD,aAAa,IAAK,GAAM,EAAE,IAAI,CAChC,EACA,GAAG,YAAY,MAAO,IAAK,SAAS,EACpC,SAAW,EACb,CACA,MAAO,EACT,CACF,CAAC,EAEM,SAAW,GAAK,IACzB,CACF,CAAC,CACH,CACF,CACF,CAAC"}
1
+ {"version":3,"file":"conversation-history.cjs","sources":["../../src/conversation-history/conversation-history.ts"],"sourcesContent":["/**\n * A Tiptap Node extension that creates a conversation history container.\n * This extension groups content blocks that appear after a horizontal rule\n * into a conversation history section.\n *\n * @extends Node\n *\n * @remarks\n * The node is rendered as a div element with the class 'conversation-history'.\n * It can parse HTML elements that match the same structure.\n *\n * For retrocompatibility, this extension also includes a ProseMirror plugin\n * that handles the grouping all the content after an horizontal rules into the\n * conversation-history children block.\n *\n * Usage:\n * ```\n * // Add to your Tiptap editor extensions\n * import { ConversationHistory } from './conversation-history'\n *\n * new Editor({\n * extensions: [\n * ConversationHistory,\n * // ... other extensions\n * ],\n * })\n * ```\n */\nimport { mergeAttributes, Node } from '@tiptap/core';\nimport { Plugin } from 'prosemirror-state';\n\nexport const ConversationHistory = Node.create({\n name: 'converstationHistory',\n group: 'block',\n content: 'block+',\n\n parseHTML() {\n return [\n {\n tag: 'div.conversation-history',\n },\n ];\n },\n\n renderHTML({ HTMLAttributes }) {\n return [\n 'div',\n mergeAttributes(HTMLAttributes, { class: 'conversation-history' }),\n 0,\n ];\n },\n\n /**\n * Adds custom ProseMirror plugins to the editor.\n * When a horizontal rule is encountered, this plugin collects all nodes\n * following the horizontal rule until the end of the document.\n * These nodes are then grouped together and replaced with\n * a single node of the same type as the plugin's type.\n *\n * @returns {Plugin[]} An array of ProseMirror plugins.\n */\n addProseMirrorPlugins() {\n return [\n new Plugin({\n appendTransaction: (transactions, oldState, newState) => {\n const tr = newState.tr;\n let modified = false;\n const nodesAfterHr = [];\n\n newState.doc.descendants((node, pos, parent) => {\n if (\n node.type.name === 'horizontalRule' &&\n parent.type.name === 'doc'\n ) {\n const start = pos;\n const end = newState.doc.content.size;\n\n newState.doc.nodesBetween(start, end, (n, p, parent) => {\n if (\n n.type.name !== 'horizontalRule' &&\n parent.type.name === 'doc'\n ) {\n nodesAfterHr.push({ node: n, pos: p });\n } else {\n return false;\n }\n });\n\n if (nodesAfterHr.length > 0) {\n const groupNode = this.type.create(\n {},\n nodesAfterHr.map((n) => n.node),\n );\n tr.replaceWith(start, end, groupNode);\n modified = true;\n }\n return false;\n }\n });\n\n return modified ? tr : null;\n },\n }),\n ];\n },\n});\n"],"names":["Node","mergeAttributes","Plugin","parent"],"mappings":"iKA+Ba,oBAAsBA,KAAAA,KAAK,OAAO,CAC7C,KAAM,uBACN,MAAO,QACP,QAAS,SAET,WAAY,CACV,MAAO,CACL,CACE,IAAK,0BAAA,CACP,CAEJ,EAEA,WAAW,CAAE,gBAAkB,CAC7B,MAAO,CACL,MACAC,KAAAA,gBAAgB,eAAgB,CAAE,MAAO,uBAAwB,EACjE,CAAA,CAEJ,EAWA,uBAAwB,CACtB,MAAO,CACL,IAAIC,wBAAO,CACT,kBAAmB,CAAC,aAAc,SAAU,WAAa,CACvD,MAAM,GAAK,SAAS,GACpB,IAAI,SAAW,GACf,MAAM,aAAe,CAAA,EAErB,gBAAS,IAAI,YAAY,CAAC,KAAM,IAAK,SAAW,CAC9C,GACE,KAAK,KAAK,OAAS,kBACnB,OAAO,KAAK,OAAS,MACrB,CACA,MAAM,MAAQ,IACR,IAAM,SAAS,IAAI,QAAQ,KAajC,GAXA,SAAS,IAAI,aAAa,MAAO,IAAK,CAAC,EAAG,EAAGC,UAAW,CACtD,GACE,EAAE,KAAK,OAAS,kBAChBA,QAAO,KAAK,OAAS,MAErB,aAAa,KAAK,CAAE,KAAM,EAAG,IAAK,EAAG,MAErC,OAAO,EAEX,CAAC,EAEG,aAAa,OAAS,EAAG,CAC3B,MAAM,UAAY,KAAK,KAAK,OAC1B,CAAA,EACA,aAAa,IAAK,GAAM,EAAE,IAAI,CAAA,EAEhC,GAAG,YAAY,MAAO,IAAK,SAAS,EACpC,SAAW,EACb,CACA,MAAO,EACT,CACF,CAAC,EAEM,SAAW,GAAK,IACzB,CAAA,CACD,CAAA,CAEL,CACF,CAAC"}
@@ -1,2 +1,63 @@
1
- import{Node,mergeAttributes}from"@tiptap/core";import{Plugin}from"prosemirror-state";var ConversationHistory=Node.create({name:`converstationHistory`,group:`block`,content:`block+`,parseHTML(){return[{tag:`div.conversation-history`}]},renderHTML({HTMLAttributes}){return[`div`,mergeAttributes(HTMLAttributes,{class:`conversation-history`}),0]},addProseMirrorPlugins(){return[new Plugin({appendTransaction:(transactions,oldState,newState)=>{let tr=newState.tr,modified=!1,nodesAfterHr=[];return newState.doc.descendants((node,pos,parent)=>{if(node.type.name===`horizontalRule`&&parent.type.name===`doc`){let start=pos,end=newState.doc.content.size;if(newState.doc.nodesBetween(start,end,(n,p,parent)=>{if(n.type.name!==`horizontalRule`&&parent.type.name===`doc`)nodesAfterHr.push({node:n,pos:p});else return!1}),nodesAfterHr.length>0){let groupNode=this.type.create({},nodesAfterHr.map(n=>n.node));tr.replaceWith(start,end,groupNode),modified=!0}return!1}}),modified?tr:null}})]}});export{ConversationHistory};
2
- //# sourceMappingURL=conversation-history.js.map
1
+ import { Node, mergeAttributes } from "@tiptap/core";
2
+ import { Plugin } from "prosemirror-state";
3
+ const ConversationHistory = Node.create({
4
+ name: "converstationHistory",
5
+ group: "block",
6
+ content: "block+",
7
+ parseHTML() {
8
+ return [
9
+ {
10
+ tag: "div.conversation-history"
11
+ }
12
+ ];
13
+ },
14
+ renderHTML({ HTMLAttributes }) {
15
+ return [
16
+ "div",
17
+ mergeAttributes(HTMLAttributes, { class: "conversation-history" }),
18
+ 0
19
+ ];
20
+ },
21
+ /**
22
+ * Adds custom ProseMirror plugins to the editor.
23
+ * When a horizontal rule is encountered, this plugin collects all nodes
24
+ * following the horizontal rule until the end of the document.
25
+ * These nodes are then grouped together and replaced with
26
+ * a single node of the same type as the plugin's type.
27
+ *
28
+ * @returns {Plugin[]} An array of ProseMirror plugins.
29
+ */
30
+ addProseMirrorPlugins() {
31
+ return [
32
+ new Plugin({
33
+ appendTransaction: (transactions, oldState, newState) => {
34
+ const tr = newState.tr;
35
+ let modified = !1;
36
+ const nodesAfterHr = [];
37
+ return newState.doc.descendants((node, pos, parent) => {
38
+ if (node.type.name === "horizontalRule" && parent.type.name === "doc") {
39
+ const start = pos, end = newState.doc.content.size;
40
+ if (newState.doc.nodesBetween(start, end, (n, p, parent2) => {
41
+ if (n.type.name !== "horizontalRule" && parent2.type.name === "doc")
42
+ nodesAfterHr.push({ node: n, pos: p });
43
+ else
44
+ return !1;
45
+ }), nodesAfterHr.length > 0) {
46
+ const groupNode = this.type.create(
47
+ {},
48
+ nodesAfterHr.map((n) => n.node)
49
+ );
50
+ tr.replaceWith(start, end, groupNode), modified = !0;
51
+ }
52
+ return !1;
53
+ }
54
+ }), modified ? tr : null;
55
+ }
56
+ })
57
+ ];
58
+ }
59
+ });
60
+ export {
61
+ ConversationHistory
62
+ };
63
+ //# sourceMappingURL=conversation-history.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"conversation-history.js","names":[],"sources":["../../src/conversation-history/conversation-history.ts"],"sourcesContent":["/**\n * A Tiptap Node extension that creates a conversation history container.\n * This extension groups content blocks that appear after a horizontal rule\n * into a conversation history section.\n *\n * @extends Node\n *\n * @remarks\n * The node is rendered as a div element with the class 'conversation-history'.\n * It can parse HTML elements that match the same structure.\n *\n * For retrocompatibility, this extension also includes a ProseMirror plugin\n * that handles the grouping all the content after an horizontal rules into the\n * conversation-history children block.\n *\n * Usage:\n * ```\n * // Add to your Tiptap editor extensions\n * import { ConversationHistory } from './conversation-history'\n *\n * new Editor({\n * extensions: [\n * ConversationHistory,\n * // ... other extensions\n * ],\n * })\n * ```\n */\nimport { mergeAttributes, Node } from '@tiptap/core';\nimport { Plugin } from 'prosemirror-state';\n\nexport const ConversationHistory = Node.create({\n name: 'converstationHistory',\n group: 'block',\n content: 'block+',\n\n parseHTML() {\n return [\n {\n tag: 'div.conversation-history',\n },\n ];\n },\n\n renderHTML({ HTMLAttributes }) {\n return [\n 'div',\n mergeAttributes(HTMLAttributes, { class: 'conversation-history' }),\n 0,\n ];\n },\n\n /**\n * Adds custom ProseMirror plugins to the editor.\n * When a horizontal rule is encountered, this plugin collects all nodes\n * following the horizontal rule until the end of the document.\n * These nodes are then grouped together and replaced with\n * a single node of the same type as the plugin's type.\n *\n * @returns {Plugin[]} An array of ProseMirror plugins.\n */\n addProseMirrorPlugins() {\n return [\n new Plugin({\n appendTransaction: (transactions, oldState, newState) => {\n const tr = newState.tr;\n let modified = false;\n const nodesAfterHr = [];\n\n newState.doc.descendants((node, pos, parent) => {\n if (\n node.type.name === 'horizontalRule' &&\n parent.type.name === 'doc'\n ) {\n const start = pos;\n const end = newState.doc.content.size;\n\n newState.doc.nodesBetween(start, end, (n, p, parent) => {\n if (\n n.type.name !== 'horizontalRule' &&\n parent.type.name === 'doc'\n ) {\n nodesAfterHr.push({ node: n, pos: p });\n } else {\n return false;\n }\n });\n\n if (nodesAfterHr.length > 0) {\n const groupNode = this.type.create(\n {},\n nodesAfterHr.map((n) => n.node),\n );\n tr.replaceWith(start, end, groupNode);\n modified = true;\n }\n return false;\n }\n });\n\n return modified ? tr : null;\n },\n }),\n ];\n },\n});\n"],"mappings":"qFA+BA,IAAa,oBAAsB,KAAK,OAAO,CAC7C,KAAM,uBACN,MAAO,QACP,QAAS,SAET,WAAY,CACV,MAAO,CACL,CACE,IAAK,0BACP,CACF,CACF,EAEA,WAAW,CAAE,gBAAkB,CAC7B,MAAO,CACL,MACA,gBAAgB,eAAgB,CAAE,MAAO,sBAAuB,CAAC,EACjE,CACF,CACF,EAWA,uBAAwB,CACtB,MAAO,CACL,IAAI,OAAO,CACT,mBAAoB,aAAc,SAAU,WAAa,CACvD,IAAM,GAAK,SAAS,GAChB,SAAW,GACT,aAAe,CAAC,EAiCtB,OA/BA,SAAS,IAAI,aAAa,KAAM,IAAK,SAAW,CAC9C,GACE,KAAK,KAAK,OAAS,kBACnB,OAAO,KAAK,OAAS,MACrB,CACA,IAAM,MAAQ,IACR,IAAM,SAAS,IAAI,QAAQ,KAajC,GAXA,SAAS,IAAI,aAAa,MAAO,KAAM,EAAG,EAAG,SAAW,CACtD,GACE,EAAE,KAAK,OAAS,kBAChB,OAAO,KAAK,OAAS,MAErB,aAAa,KAAK,CAAE,KAAM,EAAG,IAAK,CAAE,CAAC,OAErC,MAAO,EAEX,CAAC,EAEG,aAAa,OAAS,EAAG,CAC3B,IAAM,UAAY,KAAK,KAAK,OAC1B,CAAC,EACD,aAAa,IAAK,GAAM,EAAE,IAAI,CAChC,EACA,GAAG,YAAY,MAAO,IAAK,SAAS,EACpC,SAAW,EACb,CACA,MAAO,EACT,CACF,CAAC,EAEM,SAAW,GAAK,IACzB,CACF,CAAC,CACH,CACF,CACF,CAAC"}
1
+ {"version":3,"file":"conversation-history.js","sources":["../../src/conversation-history/conversation-history.ts"],"sourcesContent":["/**\n * A Tiptap Node extension that creates a conversation history container.\n * This extension groups content blocks that appear after a horizontal rule\n * into a conversation history section.\n *\n * @extends Node\n *\n * @remarks\n * The node is rendered as a div element with the class 'conversation-history'.\n * It can parse HTML elements that match the same structure.\n *\n * For retrocompatibility, this extension also includes a ProseMirror plugin\n * that handles the grouping all the content after an horizontal rules into the\n * conversation-history children block.\n *\n * Usage:\n * ```\n * // Add to your Tiptap editor extensions\n * import { ConversationHistory } from './conversation-history'\n *\n * new Editor({\n * extensions: [\n * ConversationHistory,\n * // ... other extensions\n * ],\n * })\n * ```\n */\nimport { mergeAttributes, Node } from '@tiptap/core';\nimport { Plugin } from 'prosemirror-state';\n\nexport const ConversationHistory = Node.create({\n name: 'converstationHistory',\n group: 'block',\n content: 'block+',\n\n parseHTML() {\n return [\n {\n tag: 'div.conversation-history',\n },\n ];\n },\n\n renderHTML({ HTMLAttributes }) {\n return [\n 'div',\n mergeAttributes(HTMLAttributes, { class: 'conversation-history' }),\n 0,\n ];\n },\n\n /**\n * Adds custom ProseMirror plugins to the editor.\n * When a horizontal rule is encountered, this plugin collects all nodes\n * following the horizontal rule until the end of the document.\n * These nodes are then grouped together and replaced with\n * a single node of the same type as the plugin's type.\n *\n * @returns {Plugin[]} An array of ProseMirror plugins.\n */\n addProseMirrorPlugins() {\n return [\n new Plugin({\n appendTransaction: (transactions, oldState, newState) => {\n const tr = newState.tr;\n let modified = false;\n const nodesAfterHr = [];\n\n newState.doc.descendants((node, pos, parent) => {\n if (\n node.type.name === 'horizontalRule' &&\n parent.type.name === 'doc'\n ) {\n const start = pos;\n const end = newState.doc.content.size;\n\n newState.doc.nodesBetween(start, end, (n, p, parent) => {\n if (\n n.type.name !== 'horizontalRule' &&\n parent.type.name === 'doc'\n ) {\n nodesAfterHr.push({ node: n, pos: p });\n } else {\n return false;\n }\n });\n\n if (nodesAfterHr.length > 0) {\n const groupNode = this.type.create(\n {},\n nodesAfterHr.map((n) => n.node),\n );\n tr.replaceWith(start, end, groupNode);\n modified = true;\n }\n return false;\n }\n });\n\n return modified ? tr : null;\n },\n }),\n ];\n },\n});\n"],"names":["parent"],"mappings":";;AA+BO,MAAM,sBAAsB,KAAK,OAAO;AAAA,EAC7C,MAAM;AAAA,EACN,OAAO;AAAA,EACP,SAAS;AAAA,EAET,YAAY;AACV,WAAO;AAAA,MACL;AAAA,QACE,KAAK;AAAA,MAAA;AAAA,IACP;AAAA,EAEJ;AAAA,EAEA,WAAW,EAAE,kBAAkB;AAC7B,WAAO;AAAA,MACL;AAAA,MACA,gBAAgB,gBAAgB,EAAE,OAAO,wBAAwB;AAAA,MACjE;AAAA,IAAA;AAAA,EAEJ;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAWA,wBAAwB;AACtB,WAAO;AAAA,MACL,IAAI,OAAO;AAAA,QACT,mBAAmB,CAAC,cAAc,UAAU,aAAa;AACvD,gBAAM,KAAK,SAAS;AACpB,cAAI,WAAW;AACf,gBAAM,eAAe,CAAA;AAErB,0BAAS,IAAI,YAAY,CAAC,MAAM,KAAK,WAAW;AAC9C,gBACE,KAAK,KAAK,SAAS,oBACnB,OAAO,KAAK,SAAS,OACrB;AACA,oBAAM,QAAQ,KACR,MAAM,SAAS,IAAI,QAAQ;AAajC,kBAXA,SAAS,IAAI,aAAa,OAAO,KAAK,CAAC,GAAG,GAAGA,YAAW;AACtD,oBACE,EAAE,KAAK,SAAS,oBAChBA,QAAO,KAAK,SAAS;AAErB,+BAAa,KAAK,EAAE,MAAM,GAAG,KAAK,GAAG;AAAA;AAErC,yBAAO;AAAA,cAEX,CAAC,GAEG,aAAa,SAAS,GAAG;AAC3B,sBAAM,YAAY,KAAK,KAAK;AAAA,kBAC1B,CAAA;AAAA,kBACA,aAAa,IAAI,CAAC,MAAM,EAAE,IAAI;AAAA,gBAAA;AAEhC,mBAAG,YAAY,OAAO,KAAK,SAAS,GACpC,WAAW;AAAA,cACb;AACA,qBAAO;AAAA,YACT;AAAA,UACF,CAAC,GAEM,WAAW,KAAK;AAAA,QACzB;AAAA,MAAA,CACD;AAAA,IAAA;AAAA,EAEL;AACF,CAAC;"}
@@ -1,2 +1,2 @@
1
- let _tiptap_core=require("@tiptap/core");var ConversationHistoryBody=_tiptap_core.Node.create({name:`converstationHistoryBody`,group:`block`,content:`block+`,parseHTML(){return[{tag:`div.conversation-history-body`}]},renderHTML({HTMLAttributes}){return[`div`,(0,_tiptap_core.mergeAttributes)(HTMLAttributes,{class:`conversation-history-body`}),0]}});exports.ConversationHistoryBody=ConversationHistoryBody;
2
- //# sourceMappingURL=conversation-history-body.cjs.map
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const core=require("@tiptap/core"),ConversationHistoryBody=core.Node.create({name:"converstationHistoryBody",group:"block",content:"block+",parseHTML(){return[{tag:"div.conversation-history-body"}]},renderHTML({HTMLAttributes}){return["div",core.mergeAttributes(HTMLAttributes,{class:"conversation-history-body"}),0]}});exports.ConversationHistoryBody=ConversationHistoryBody;
2
+ //# sourceMappingURL=conversation-history-body.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"conversation-history-body.cjs","names":[],"sources":["../../src/conversation-history-body/conversation-history-body.ts"],"sourcesContent":["/**\n * A Tiptap Node extension that represents a conversation history body.\n * This node is a block-level element that can contain one or more block elements.\n *\n * @remarks\n * The node is rendered as a div element with the class 'conversation-history-body'.\n * It can parse HTML elements that match the same structure.\n *\n * @group Block Nodes\n */\nimport { mergeAttributes, Node } from '@tiptap/core';\n\nexport const ConversationHistoryBody = Node.create({\n name: 'converstationHistoryBody',\n group: 'block',\n content: 'block+',\n\n parseHTML() {\n return [\n {\n tag: 'div.conversation-history-body',\n },\n ];\n },\n\n renderHTML({ HTMLAttributes }) {\n return [\n 'div',\n mergeAttributes(HTMLAttributes, { class: 'conversation-history-body' }),\n 0,\n ];\n },\n});\n"],"mappings":"yCAYA,IAAa,wBAA0B,aAAA,KAAK,OAAO,CACjD,KAAM,2BACN,MAAO,QACP,QAAS,SAET,WAAY,CACV,MAAO,CACL,CACE,IAAK,+BACP,CACF,CACF,EAEA,WAAW,CAAE,gBAAkB,CAC7B,MAAO,CACL,uCACgB,eAAgB,CAAE,MAAO,2BAA4B,CAAC,EACtE,CACF,CACF,CACF,CAAC"}
1
+ {"version":3,"file":"conversation-history-body.cjs","sources":["../../src/conversation-history-body/conversation-history-body.ts"],"sourcesContent":["/**\n * A Tiptap Node extension that represents a conversation history body.\n * This node is a block-level element that can contain one or more block elements.\n *\n * @remarks\n * The node is rendered as a div element with the class 'conversation-history-body'.\n * It can parse HTML elements that match the same structure.\n *\n * @group Block Nodes\n */\nimport { mergeAttributes, Node } from '@tiptap/core';\n\nexport const ConversationHistoryBody = Node.create({\n name: 'converstationHistoryBody',\n group: 'block',\n content: 'block+',\n\n parseHTML() {\n return [\n {\n tag: 'div.conversation-history-body',\n },\n ];\n },\n\n renderHTML({ HTMLAttributes }) {\n return [\n 'div',\n mergeAttributes(HTMLAttributes, { class: 'conversation-history-body' }),\n 0,\n ];\n },\n});\n"],"names":["Node","mergeAttributes"],"mappings":"mHAYa,wBAA0BA,KAAAA,KAAK,OAAO,CACjD,KAAM,2BACN,MAAO,QACP,QAAS,SAET,WAAY,CACV,MAAO,CACL,CACE,IAAK,+BAAA,CACP,CAEJ,EAEA,WAAW,CAAE,gBAAkB,CAC7B,MAAO,CACL,MACAC,KAAAA,gBAAgB,eAAgB,CAAE,MAAO,4BAA6B,EACtE,CAAA,CAEJ,CACF,CAAC"}
@@ -1,2 +1,24 @@
1
- import{Node,mergeAttributes}from"@tiptap/core";var ConversationHistoryBody=Node.create({name:`converstationHistoryBody`,group:`block`,content:`block+`,parseHTML(){return[{tag:`div.conversation-history-body`}]},renderHTML({HTMLAttributes}){return[`div`,mergeAttributes(HTMLAttributes,{class:`conversation-history-body`}),0]}});export{ConversationHistoryBody};
2
- //# sourceMappingURL=conversation-history-body.js.map
1
+ import { Node, mergeAttributes } from "@tiptap/core";
2
+ const ConversationHistoryBody = Node.create({
3
+ name: "converstationHistoryBody",
4
+ group: "block",
5
+ content: "block+",
6
+ parseHTML() {
7
+ return [
8
+ {
9
+ tag: "div.conversation-history-body"
10
+ }
11
+ ];
12
+ },
13
+ renderHTML({ HTMLAttributes }) {
14
+ return [
15
+ "div",
16
+ mergeAttributes(HTMLAttributes, { class: "conversation-history-body" }),
17
+ 0
18
+ ];
19
+ }
20
+ });
21
+ export {
22
+ ConversationHistoryBody
23
+ };
24
+ //# sourceMappingURL=conversation-history-body.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"conversation-history-body.js","names":[],"sources":["../../src/conversation-history-body/conversation-history-body.ts"],"sourcesContent":["/**\n * A Tiptap Node extension that represents a conversation history body.\n * This node is a block-level element that can contain one or more block elements.\n *\n * @remarks\n * The node is rendered as a div element with the class 'conversation-history-body'.\n * It can parse HTML elements that match the same structure.\n *\n * @group Block Nodes\n */\nimport { mergeAttributes, Node } from '@tiptap/core';\n\nexport const ConversationHistoryBody = Node.create({\n name: 'converstationHistoryBody',\n group: 'block',\n content: 'block+',\n\n parseHTML() {\n return [\n {\n tag: 'div.conversation-history-body',\n },\n ];\n },\n\n renderHTML({ HTMLAttributes }) {\n return [\n 'div',\n mergeAttributes(HTMLAttributes, { class: 'conversation-history-body' }),\n 0,\n ];\n },\n});\n"],"mappings":"+CAYA,IAAa,wBAA0B,KAAK,OAAO,CACjD,KAAM,2BACN,MAAO,QACP,QAAS,SAET,WAAY,CACV,MAAO,CACL,CACE,IAAK,+BACP,CACF,CACF,EAEA,WAAW,CAAE,gBAAkB,CAC7B,MAAO,CACL,MACA,gBAAgB,eAAgB,CAAE,MAAO,2BAA4B,CAAC,EACtE,CACF,CACF,CACF,CAAC"}
1
+ {"version":3,"file":"conversation-history-body.js","sources":["../../src/conversation-history-body/conversation-history-body.ts"],"sourcesContent":["/**\n * A Tiptap Node extension that represents a conversation history body.\n * This node is a block-level element that can contain one or more block elements.\n *\n * @remarks\n * The node is rendered as a div element with the class 'conversation-history-body'.\n * It can parse HTML elements that match the same structure.\n *\n * @group Block Nodes\n */\nimport { mergeAttributes, Node } from '@tiptap/core';\n\nexport const ConversationHistoryBody = Node.create({\n name: 'converstationHistoryBody',\n group: 'block',\n content: 'block+',\n\n parseHTML() {\n return [\n {\n tag: 'div.conversation-history-body',\n },\n ];\n },\n\n renderHTML({ HTMLAttributes }) {\n return [\n 'div',\n mergeAttributes(HTMLAttributes, { class: 'conversation-history-body' }),\n 0,\n ];\n },\n});\n"],"names":[],"mappings":";AAYO,MAAM,0BAA0B,KAAK,OAAO;AAAA,EACjD,MAAM;AAAA,EACN,OAAO;AAAA,EACP,SAAS;AAAA,EAET,YAAY;AACV,WAAO;AAAA,MACL;AAAA,QACE,KAAK;AAAA,MAAA;AAAA,IACP;AAAA,EAEJ;AAAA,EAEA,WAAW,EAAE,kBAAkB;AAC7B,WAAO;AAAA,MACL;AAAA,MACA,gBAAgB,gBAAgB,EAAE,OAAO,6BAA6B;AAAA,MACtE;AAAA,IAAA;AAAA,EAEJ;AACF,CAAC;"}
@@ -1,2 +1,2 @@
1
- let _tiptap_core=require("@tiptap/core");require("@tiptap/extension-text-style");var FontSize=_tiptap_core.Extension.create({name:`fontSize`,addOptions(){return{types:[`textStyle`]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{fontSize:{default:null,parseHTML:element=>element.style.fontSize?.replace(/['"]+/g,``),renderHTML:attributes=>attributes.fontSize?{style:`font-size: ${attributes.fontSize}`}:{}}}}]},addCommands(){return{setFontSize:fontSize=>({chain})=>chain().setMark(`textStyle`,{fontSize}).run(),unsetFontSize:()=>({chain})=>chain().setMark(`textStyle`,{fontSize:null}).removeEmptyTextStyle().run()}}});exports.FontSize=FontSize;
2
- //# sourceMappingURL=font-size.cjs.map
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("@tiptap/extension-text-style");const core=require("@tiptap/core"),FontSize=core.Extension.create({name:"fontSize",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{fontSize:{default:null,parseHTML:element=>{var _a;return(_a=element.style.fontSize)==null?void 0:_a.replace(/['"]+/g,"")},renderHTML:attributes=>attributes.fontSize?{style:`font-size: ${attributes.fontSize}`}:{}}}}]},addCommands(){return{setFontSize:fontSize=>({chain})=>chain().setMark("textStyle",{fontSize}).run(),unsetFontSize:()=>({chain})=>chain().setMark("textStyle",{fontSize:null}).removeEmptyTextStyle().run()}}});exports.FontSize=FontSize;
2
+ //# sourceMappingURL=font-size.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"font-size.cjs","names":[],"sources":["../../src/font-size/font-size.ts"],"sourcesContent":["import '@tiptap/extension-text-style';\n\nimport { Extension } from '@tiptap/core';\n\nexport type FontSizeOptions = {\n types: string[];\n};\n\ndeclare module '@tiptap/core' {\n interface Commands<ReturnType> {\n fontSize: {\n /**\n * Set the font size\n */\n setFontSize: (fontSize: string) => ReturnType;\n /**\n * Unset the font size\n */\n unsetFontSize: () => ReturnType;\n };\n }\n}\n\nexport const FontSize = Extension.create<FontSizeOptions>({\n name: 'fontSize',\n\n addOptions() {\n return {\n types: ['textStyle'],\n };\n },\n\n addGlobalAttributes() {\n return [\n {\n types: this.options.types,\n attributes: {\n fontSize: {\n default: null,\n parseHTML: (element) =>\n element.style.fontSize?.replace(/['\"]+/g, ''),\n renderHTML: (attributes) => {\n if (!attributes.fontSize) {\n return {};\n }\n\n return {\n style: `font-size: ${attributes.fontSize}`,\n };\n },\n },\n },\n },\n ];\n },\n\n addCommands() {\n return {\n setFontSize:\n (fontSize) =>\n ({ chain }) => {\n return chain().setMark('textStyle', { fontSize }).run();\n },\n unsetFontSize:\n () =>\n ({ chain }) => {\n return chain()\n .setMark('textStyle', { fontSize: null })\n .removeEmptyTextStyle()\n .run();\n },\n };\n },\n});\n"],"mappings":"iFAuBA,IAAa,SAAW,aAAA,UAAU,OAAwB,CACxD,KAAM,WAEN,YAAa,CACX,MAAO,CACL,MAAO,CAAC,WAAW,CACrB,CACF,EAEA,qBAAsB,CACpB,MAAO,CACL,CACE,MAAO,KAAK,QAAQ,MACpB,WAAY,CACV,SAAU,CACR,QAAS,KACT,UAAY,SACV,QAAQ,MAAM,UAAU,QAAQ,SAAU,EAAE,EAC9C,WAAa,YACN,WAAW,SAIT,CACL,MAAO,cAAc,WAAW,UAClC,EALS,CAAC,CAOd,CACF,CACF,CACF,CACF,EAEA,aAAc,CACZ,MAAO,CACL,YACG,WACA,CAAE,SACM,MAAM,EAAE,QAAQ,YAAa,CAAE,QAAS,CAAC,EAAE,IAAI,EAE1D,mBAEG,CAAE,SACM,MAAM,EACV,QAAQ,YAAa,CAAE,SAAU,IAAK,CAAC,EACvC,qBAAqB,EACrB,IAAI,CAEb,CACF,CACF,CAAC"}
1
+ {"version":3,"file":"font-size.cjs","sources":["../../src/font-size/font-size.ts"],"sourcesContent":["import '@tiptap/extension-text-style';\n\nimport { Extension } from '@tiptap/core';\n\nexport type FontSizeOptions = {\n types: string[];\n};\n\ndeclare module '@tiptap/core' {\n interface Commands<ReturnType> {\n fontSize: {\n /**\n * Set the font size\n */\n setFontSize: (fontSize: string) => ReturnType;\n /**\n * Unset the font size\n */\n unsetFontSize: () => ReturnType;\n };\n }\n}\n\nexport const FontSize = Extension.create<FontSizeOptions>({\n name: 'fontSize',\n\n addOptions() {\n return {\n types: ['textStyle'],\n };\n },\n\n addGlobalAttributes() {\n return [\n {\n types: this.options.types,\n attributes: {\n fontSize: {\n default: null,\n parseHTML: (element) =>\n element.style.fontSize?.replace(/['\"]+/g, ''),\n renderHTML: (attributes) => {\n if (!attributes.fontSize) {\n return {};\n }\n\n return {\n style: `font-size: ${attributes.fontSize}`,\n };\n },\n },\n },\n },\n ];\n },\n\n addCommands() {\n return {\n setFontSize:\n (fontSize) =>\n ({ chain }) => {\n return chain().setMark('textStyle', { fontSize }).run();\n },\n unsetFontSize:\n () =>\n ({ chain }) => {\n return chain()\n .setMark('textStyle', { fontSize: null })\n .removeEmptyTextStyle()\n .run();\n },\n };\n },\n});\n"],"names":["Extension"],"mappings":"2JAuBa,SAAWA,KAAAA,UAAU,OAAwB,CACxD,KAAM,WAEN,YAAa,CACX,MAAO,CACL,MAAO,CAAC,WAAW,CAAA,CAEvB,EAEA,qBAAsB,CACpB,MAAO,CACL,CACE,MAAO,KAAK,QAAQ,MACpB,WAAY,CACV,SAAU,CACR,QAAS,KACT,UAAY,SAAA,QACV,kBAAQ,MAAM,WAAd,eAAwB,QAAQ,SAAU,KAC5C,WAAa,YACN,WAAW,SAIT,CACL,MAAO,cAAc,WAAW,QAAQ,EAAA,EAJjC,CAAA,CAMX,CACF,CACF,CACF,CAEJ,EAEA,aAAc,CACZ,MAAO,CACL,YACG,UACD,CAAC,CAAE,SACM,MAAA,EAAQ,QAAQ,YAAa,CAAE,QAAA,CAAU,EAAE,IAAA,EAEtD,cACE,IACA,CAAC,CAAE,SACM,MAAA,EACJ,QAAQ,YAAa,CAAE,SAAU,KAAM,EACvC,qBAAA,EACA,IAAA,CACL,CAEN,CACF,CAAC"}
@@ -1,2 +1,39 @@
1
- import{Extension}from"@tiptap/core";import"@tiptap/extension-text-style";var FontSize=Extension.create({name:`fontSize`,addOptions(){return{types:[`textStyle`]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{fontSize:{default:null,parseHTML:element=>element.style.fontSize?.replace(/['"]+/g,``),renderHTML:attributes=>attributes.fontSize?{style:`font-size: ${attributes.fontSize}`}:{}}}}]},addCommands(){return{setFontSize:fontSize=>({chain})=>chain().setMark(`textStyle`,{fontSize}).run(),unsetFontSize:()=>({chain})=>chain().setMark(`textStyle`,{fontSize:null}).removeEmptyTextStyle().run()}}});export{FontSize};
2
- //# sourceMappingURL=font-size.js.map
1
+ import "@tiptap/extension-text-style";
2
+ import { Extension } from "@tiptap/core";
3
+ const FontSize = Extension.create({
4
+ name: "fontSize",
5
+ addOptions() {
6
+ return {
7
+ types: ["textStyle"]
8
+ };
9
+ },
10
+ addGlobalAttributes() {
11
+ return [
12
+ {
13
+ types: this.options.types,
14
+ attributes: {
15
+ fontSize: {
16
+ default: null,
17
+ parseHTML: (element) => {
18
+ var _a;
19
+ return (_a = element.style.fontSize) == null ? void 0 : _a.replace(/['"]+/g, "");
20
+ },
21
+ renderHTML: (attributes) => attributes.fontSize ? {
22
+ style: `font-size: ${attributes.fontSize}`
23
+ } : {}
24
+ }
25
+ }
26
+ }
27
+ ];
28
+ },
29
+ addCommands() {
30
+ return {
31
+ setFontSize: (fontSize) => ({ chain }) => chain().setMark("textStyle", { fontSize }).run(),
32
+ unsetFontSize: () => ({ chain }) => chain().setMark("textStyle", { fontSize: null }).removeEmptyTextStyle().run()
33
+ };
34
+ }
35
+ });
36
+ export {
37
+ FontSize
38
+ };
39
+ //# sourceMappingURL=font-size.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"font-size.js","names":[],"sources":["../../src/font-size/font-size.ts"],"sourcesContent":["import '@tiptap/extension-text-style';\n\nimport { Extension } from '@tiptap/core';\n\nexport type FontSizeOptions = {\n types: string[];\n};\n\ndeclare module '@tiptap/core' {\n interface Commands<ReturnType> {\n fontSize: {\n /**\n * Set the font size\n */\n setFontSize: (fontSize: string) => ReturnType;\n /**\n * Unset the font size\n */\n unsetFontSize: () => ReturnType;\n };\n }\n}\n\nexport const FontSize = Extension.create<FontSizeOptions>({\n name: 'fontSize',\n\n addOptions() {\n return {\n types: ['textStyle'],\n };\n },\n\n addGlobalAttributes() {\n return [\n {\n types: this.options.types,\n attributes: {\n fontSize: {\n default: null,\n parseHTML: (element) =>\n element.style.fontSize?.replace(/['\"]+/g, ''),\n renderHTML: (attributes) => {\n if (!attributes.fontSize) {\n return {};\n }\n\n return {\n style: `font-size: ${attributes.fontSize}`,\n };\n },\n },\n },\n },\n ];\n },\n\n addCommands() {\n return {\n setFontSize:\n (fontSize) =>\n ({ chain }) => {\n return chain().setMark('textStyle', { fontSize }).run();\n },\n unsetFontSize:\n () =>\n ({ chain }) => {\n return chain()\n .setMark('textStyle', { fontSize: null })\n .removeEmptyTextStyle()\n .run();\n },\n };\n },\n});\n"],"mappings":"yEAuBA,IAAa,SAAW,UAAU,OAAwB,CACxD,KAAM,WAEN,YAAa,CACX,MAAO,CACL,MAAO,CAAC,WAAW,CACrB,CACF,EAEA,qBAAsB,CACpB,MAAO,CACL,CACE,MAAO,KAAK,QAAQ,MACpB,WAAY,CACV,SAAU,CACR,QAAS,KACT,UAAY,SACV,QAAQ,MAAM,UAAU,QAAQ,SAAU,EAAE,EAC9C,WAAa,YACN,WAAW,SAIT,CACL,MAAO,cAAc,WAAW,UAClC,EALS,CAAC,CAOd,CACF,CACF,CACF,CACF,EAEA,aAAc,CACZ,MAAO,CACL,YACG,WACA,CAAE,SACM,MAAM,EAAE,QAAQ,YAAa,CAAE,QAAS,CAAC,EAAE,IAAI,EAE1D,mBAEG,CAAE,SACM,MAAM,EACV,QAAQ,YAAa,CAAE,SAAU,IAAK,CAAC,EACvC,qBAAqB,EACrB,IAAI,CAEb,CACF,CACF,CAAC"}
1
+ {"version":3,"file":"font-size.js","sources":["../../src/font-size/font-size.ts"],"sourcesContent":["import '@tiptap/extension-text-style';\n\nimport { Extension } from '@tiptap/core';\n\nexport type FontSizeOptions = {\n types: string[];\n};\n\ndeclare module '@tiptap/core' {\n interface Commands<ReturnType> {\n fontSize: {\n /**\n * Set the font size\n */\n setFontSize: (fontSize: string) => ReturnType;\n /**\n * Unset the font size\n */\n unsetFontSize: () => ReturnType;\n };\n }\n}\n\nexport const FontSize = Extension.create<FontSizeOptions>({\n name: 'fontSize',\n\n addOptions() {\n return {\n types: ['textStyle'],\n };\n },\n\n addGlobalAttributes() {\n return [\n {\n types: this.options.types,\n attributes: {\n fontSize: {\n default: null,\n parseHTML: (element) =>\n element.style.fontSize?.replace(/['\"]+/g, ''),\n renderHTML: (attributes) => {\n if (!attributes.fontSize) {\n return {};\n }\n\n return {\n style: `font-size: ${attributes.fontSize}`,\n };\n },\n },\n },\n },\n ];\n },\n\n addCommands() {\n return {\n setFontSize:\n (fontSize) =>\n ({ chain }) => {\n return chain().setMark('textStyle', { fontSize }).run();\n },\n unsetFontSize:\n () =>\n ({ chain }) => {\n return chain()\n .setMark('textStyle', { fontSize: null })\n .removeEmptyTextStyle()\n .run();\n },\n };\n },\n});\n"],"names":[],"mappings":";;AAuBO,MAAM,WAAW,UAAU,OAAwB;AAAA,EACxD,MAAM;AAAA,EAEN,aAAa;AACX,WAAO;AAAA,MACL,OAAO,CAAC,WAAW;AAAA,IAAA;AAAA,EAEvB;AAAA,EAEA,sBAAsB;AACpB,WAAO;AAAA,MACL;AAAA,QACE,OAAO,KAAK,QAAQ;AAAA,QACpB,YAAY;AAAA,UACV,UAAU;AAAA,YACR,SAAS;AAAA,YACT,WAAW,CAAC,YAAA;;AACV,mCAAQ,MAAM,aAAd,mBAAwB,QAAQ,UAAU;AAAA;AAAA,YAC5C,YAAY,CAAC,eACN,WAAW,WAIT;AAAA,cACL,OAAO,cAAc,WAAW,QAAQ;AAAA,YAAA,IAJjC,CAAA;AAAA,UAMX;AAAA,QACF;AAAA,MACF;AAAA,IACF;AAAA,EAEJ;AAAA,EAEA,cAAc;AACZ,WAAO;AAAA,MACL,aACE,CAAC,aACD,CAAC,EAAE,YACM,MAAA,EAAQ,QAAQ,aAAa,EAAE,SAAA,CAAU,EAAE,IAAA;AAAA,MAEtD,eACE,MACA,CAAC,EAAE,YACM,MAAA,EACJ,QAAQ,aAAa,EAAE,UAAU,MAAM,EACvC,qBAAA,EACA,IAAA;AAAA,IACL;AAAA,EAEN;AACF,CAAC;"}
@@ -1,2 +1,2 @@
1
- let _tiptap_core=require("@tiptap/core");require("@tiptap/extension-text-style");var CustomHeading=require("@tiptap/extension-heading").Heading.extend({name:`customHeading`,addOptions(){return{...this.parent?.(),HTMLAttributes:{}}},parseHTML(){return this.options.levels.map(level=>({tag:`h${level}`,attrs:{level}}))},renderHTML({node,HTMLAttributes}){return[`h${this.options.levels.includes(node.attrs.level)?node.attrs.level:this.options.levels[0]}`,(0,_tiptap_core.mergeAttributes)(this.options.HTMLAttributes,HTMLAttributes),0]},addCommands(){return{setCustomHeading:attributes=>({tr,dispatch,commands})=>{if(!this.options.levels.includes(attributes.level))return!1;let{selection}=tr,{from,to}=selection;return tr.doc.nodesBetween(from,to,(node,pos)=>{node.isBlock&&from>=pos&&to<=pos+node.nodeSize&&node.content.forEach(content=>{content.marks.forEach(mark=>{mark.type.name===`textStyle`&&mark.attrs.fontSize&&mark.attrs.fontSize!==null&&(tr=tr.removeMark(pos,pos+node.nodeSize,mark.type))})})}),dispatch&&dispatch(tr),commands.setHeading({level:attributes.level})}}}});exports.CustomHeading=CustomHeading;
2
- //# sourceMappingURL=heading.cjs.map
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const core=require("@tiptap/core"),extensionHeading=require("@tiptap/extension-heading");require("@tiptap/extension-text-style");const CustomHeading=extensionHeading.Heading.extend({name:"customHeading",addOptions(){var _a;return{...(_a=this.parent)==null?void 0:_a.call(this),HTMLAttributes:{}}},parseHTML(){return this.options.levels.map(level=>({tag:`h${level}`,attrs:{level}}))},renderHTML({node,HTMLAttributes}){return[`h${this.options.levels.includes(node.attrs.level)?node.attrs.level:this.options.levels[0]}`,core.mergeAttributes(this.options.HTMLAttributes,HTMLAttributes),0]},addCommands(){return{setCustomHeading:attributes=>({tr,dispatch,commands})=>{if(!this.options.levels.includes(attributes.level))return!1;const{selection}=tr,{from,to}=selection;return tr.doc.nodesBetween(from,to,(node,pos)=>{node.isBlock&&from>=pos&&to<=pos+node.nodeSize&&node.content.forEach(content=>{content.marks.forEach(mark=>{mark.type.name==="textStyle"&&mark.attrs.fontSize&&mark.attrs.fontSize!==null&&(tr=tr.removeMark(pos,pos+node.nodeSize,mark.type))})})}),dispatch&&dispatch(tr),commands.setHeading({level:attributes.level})}}}});exports.CustomHeading=CustomHeading;
2
+ //# sourceMappingURL=heading.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"heading.cjs","names":[],"sources":["../../src/heading/heading.ts"],"sourcesContent":["import { mergeAttributes } from '@tiptap/core';\nimport { Heading } from '@tiptap/extension-heading';\nimport '@tiptap/extension-text-style';\n\nexport declare type Level = 1 | 2;\n\ninterface Options {\n levels: Level[];\n HTMLAttributes: Record<string, any>;\n}\n\ndeclare module '@tiptap/core' {\n interface Commands<ReturnType> {\n customHeading: {\n /**\n * Apply Heading Level\n */\n setCustomHeading: (attributes: { level: Level }) => ReturnType;\n };\n }\n}\n\nexport const CustomHeading = Heading.extend<Options>({\n name: 'customHeading',\n\n addOptions() {\n return {\n ...this.parent?.(),\n HTMLAttributes: {},\n };\n },\n\n parseHTML() {\n return this.options.levels.map((level: Level) => ({\n tag: `h${level}`,\n attrs: { level },\n }));\n },\n\n renderHTML({ node, HTMLAttributes }) {\n const hasLevel = this.options.levels.includes(node.attrs.level);\n const level = hasLevel ? node.attrs.level : this.options.levels[0];\n\n return [\n `h${level}`,\n mergeAttributes(this.options.HTMLAttributes, HTMLAttributes),\n 0,\n ];\n },\n\n addCommands() {\n return {\n setCustomHeading:\n (attributes) =>\n ({ tr, dispatch, commands }) => {\n if (!this.options.levels.includes(attributes.level)) {\n return false;\n }\n\n const { selection } = tr;\n const { from, to } = selection;\n\n tr.doc.nodesBetween(from, to, (node, pos) => {\n if (node.isBlock && from >= pos && to <= pos + node.nodeSize) {\n /* get node content and iterate through */\n node.content.forEach((content) => {\n /* get content marks and iterate through */\n content.marks.forEach((mark) => {\n /* find textStyle mark and if has fontSize attrs */\n if (\n mark.type.name === 'textStyle' &&\n mark.attrs['fontSize'] &&\n mark.attrs['fontSize'] !== null\n ) {\n /* remove any fontSize attr to reset heading style */\n tr = tr.removeMark(pos, pos + node.nodeSize, mark.type);\n }\n });\n });\n }\n });\n\n if (dispatch) {\n dispatch(tr);\n }\n return commands.setHeading({ level: attributes.level });\n },\n };\n },\n});\n"],"mappings":"iFAsBA,IAAa,iDAAgB,EAAA,QAAQ,OAAgB,CACnD,KAAM,gBAEN,YAAa,CACX,MAAO,CACL,GAAG,KAAK,SAAS,EACjB,eAAgB,CAAC,CACnB,CACF,EAEA,WAAY,CACV,OAAO,KAAK,QAAQ,OAAO,IAAK,QAAkB,CAChD,IAAK,IAAI,QACT,MAAO,CAAE,KAAM,CACjB,EAAE,CACJ,EAEA,WAAW,CAAE,KAAM,gBAAkB,CAInC,MAAO,CACL,IAJe,KAAK,QAAQ,OAAO,SAAS,KAAK,MAAM,KAC3C,EAAW,KAAK,MAAM,MAAQ,KAAK,QAAQ,OAAO,sCAI9C,KAAK,QAAQ,eAAgB,cAAc,EAC3D,CACF,CACF,EAEA,aAAc,CACZ,MAAO,CACL,iBACG,aACA,CAAE,GAAI,SAAU,YAAe,CAC9B,GAAI,CAAC,KAAK,QAAQ,OAAO,SAAS,WAAW,KAAK,EAChD,MAAO,GAGT,GAAM,CAAE,WAAc,GAChB,CAAE,KAAM,IAAO,UAyBrB,OAvBA,GAAG,IAAI,aAAa,KAAM,IAAK,KAAM,MAAQ,CACvC,KAAK,SAAW,MAAQ,KAAO,IAAM,IAAM,KAAK,UAElD,KAAK,QAAQ,QAAS,SAAY,CAEhC,QAAQ,MAAM,QAAS,MAAS,CAG5B,KAAK,KAAK,OAAS,aACnB,KAAK,MAAM,UACX,KAAK,MAAM,WAAgB,OAG3B,GAAK,GAAG,WAAW,IAAK,IAAM,KAAK,SAAU,KAAK,IAAI,EAE1D,CAAC,CACH,CAAC,CAEL,CAAC,EAEG,UACF,SAAS,EAAE,EAEN,SAAS,WAAW,CAAE,MAAO,WAAW,KAAM,CAAC,CACxD,CACJ,CACF,CACF,CAAC"}
1
+ {"version":3,"file":"heading.cjs","sources":["../../src/heading/heading.ts"],"sourcesContent":["import { mergeAttributes } from '@tiptap/core';\nimport { Heading } from '@tiptap/extension-heading';\nimport '@tiptap/extension-text-style';\n\nexport declare type Level = 1 | 2;\n\ninterface Options {\n levels: Level[];\n HTMLAttributes: Record<string, any>;\n}\n\ndeclare module '@tiptap/core' {\n interface Commands<ReturnType> {\n customHeading: {\n /**\n * Apply Heading Level\n */\n setCustomHeading: (attributes: { level: Level }) => ReturnType;\n };\n }\n}\n\nexport const CustomHeading = Heading.extend<Options>({\n name: 'customHeading',\n\n addOptions() {\n return {\n ...this.parent?.(),\n HTMLAttributes: {},\n };\n },\n\n parseHTML() {\n return this.options.levels.map((level: Level) => ({\n tag: `h${level}`,\n attrs: { level },\n }));\n },\n\n renderHTML({ node, HTMLAttributes }) {\n const hasLevel = this.options.levels.includes(node.attrs.level);\n const level = hasLevel ? node.attrs.level : this.options.levels[0];\n\n return [\n `h${level}`,\n mergeAttributes(this.options.HTMLAttributes, HTMLAttributes),\n 0,\n ];\n },\n\n addCommands() {\n return {\n setCustomHeading:\n (attributes) =>\n ({ tr, dispatch, commands }) => {\n if (!this.options.levels.includes(attributes.level)) {\n return false;\n }\n\n const { selection } = tr;\n const { from, to } = selection;\n\n tr.doc.nodesBetween(from, to, (node, pos) => {\n if (node.isBlock && from >= pos && to <= pos + node.nodeSize) {\n /* get node content and iterate through */\n node.content.forEach((content) => {\n /* get content marks and iterate through */\n content.marks.forEach((mark) => {\n /* find textStyle mark and if has fontSize attrs */\n if (\n mark.type.name === 'textStyle' &&\n mark.attrs['fontSize'] &&\n mark.attrs['fontSize'] !== null\n ) {\n /* remove any fontSize attr to reset heading style */\n tr = tr.removeMark(pos, pos + node.nodeSize, mark.type);\n }\n });\n });\n }\n });\n\n if (dispatch) {\n dispatch(tr);\n }\n return commands.setHeading({ level: attributes.level });\n },\n };\n },\n});\n"],"names":["Heading","mergeAttributes"],"mappings":"iNAsBO,MAAM,cAAgBA,iBAAAA,QAAQ,OAAgB,CACnD,KAAM,gBAEN,YAAa,QACX,MAAO,CACL,IAAG,QAAK,SAAL,0BACH,eAAgB,CAAA,CAAC,CAErB,EAEA,WAAY,CACV,OAAO,KAAK,QAAQ,OAAO,IAAK,QAAkB,CAChD,IAAK,IAAI,KAAK,GACd,MAAO,CAAE,KAAA,CAAM,EACf,CACJ,EAEA,WAAW,CAAE,KAAM,gBAAkB,CAInC,MAAO,CACL,IAJe,KAAK,QAAQ,OAAO,SAAS,KAAK,MAAM,KAAK,EACrC,KAAK,MAAM,MAAQ,KAAK,QAAQ,OAAO,CAAC,CAGtD,GACTC,KAAAA,gBAAgB,KAAK,QAAQ,eAAgB,cAAc,EAC3D,CAAA,CAEJ,EAEA,aAAc,CACZ,MAAO,CACL,iBACG,YACD,CAAC,CAAE,GAAI,SAAU,YAAe,CAC9B,GAAI,CAAC,KAAK,QAAQ,OAAO,SAAS,WAAW,KAAK,EAChD,MAAO,GAGT,KAAM,CAAE,WAAc,GAChB,CAAE,KAAM,EAAA,EAAO,UAErB,UAAG,IAAI,aAAa,KAAM,GAAI,CAAC,KAAM,MAAQ,CACvC,KAAK,SAAW,MAAQ,KAAO,IAAM,IAAM,KAAK,UAElD,KAAK,QAAQ,QAAS,SAAY,CAEhC,QAAQ,MAAM,QAAS,MAAS,CAG5B,KAAK,KAAK,OAAS,aACnB,KAAK,MAAM,UACX,KAAK,MAAM,WAAgB,OAG3B,GAAK,GAAG,WAAW,IAAK,IAAM,KAAK,SAAU,KAAK,IAAI,EAE1D,CAAC,CACH,CAAC,CAEL,CAAC,EAEG,UACF,SAAS,EAAE,EAEN,SAAS,WAAW,CAAE,MAAO,WAAW,MAAO,CACxD,CAAA,CAEN,CACF,CAAC"}
@@ -1,2 +1,46 @@
1
- import{mergeAttributes}from"@tiptap/core";import"@tiptap/extension-text-style";import{Heading}from"@tiptap/extension-heading";var CustomHeading=Heading.extend({name:`customHeading`,addOptions(){return{...this.parent?.(),HTMLAttributes:{}}},parseHTML(){return this.options.levels.map(level=>({tag:`h${level}`,attrs:{level}}))},renderHTML({node,HTMLAttributes}){return[`h${this.options.levels.includes(node.attrs.level)?node.attrs.level:this.options.levels[0]}`,mergeAttributes(this.options.HTMLAttributes,HTMLAttributes),0]},addCommands(){return{setCustomHeading:attributes=>({tr,dispatch,commands})=>{if(!this.options.levels.includes(attributes.level))return!1;let{selection}=tr,{from,to}=selection;return tr.doc.nodesBetween(from,to,(node,pos)=>{node.isBlock&&from>=pos&&to<=pos+node.nodeSize&&node.content.forEach(content=>{content.marks.forEach(mark=>{mark.type.name===`textStyle`&&mark.attrs.fontSize&&mark.attrs.fontSize!==null&&(tr=tr.removeMark(pos,pos+node.nodeSize,mark.type))})})}),dispatch&&dispatch(tr),commands.setHeading({level:attributes.level})}}}});export{CustomHeading};
2
- //# sourceMappingURL=heading.js.map
1
+ import { mergeAttributes } from "@tiptap/core";
2
+ import { Heading } from "@tiptap/extension-heading";
3
+ import "@tiptap/extension-text-style";
4
+ const CustomHeading = Heading.extend({
5
+ name: "customHeading",
6
+ addOptions() {
7
+ var _a;
8
+ return {
9
+ ...(_a = this.parent) == null ? void 0 : _a.call(this),
10
+ HTMLAttributes: {}
11
+ };
12
+ },
13
+ parseHTML() {
14
+ return this.options.levels.map((level) => ({
15
+ tag: `h${level}`,
16
+ attrs: { level }
17
+ }));
18
+ },
19
+ renderHTML({ node, HTMLAttributes }) {
20
+ return [
21
+ `h${this.options.levels.includes(node.attrs.level) ? node.attrs.level : this.options.levels[0]}`,
22
+ mergeAttributes(this.options.HTMLAttributes, HTMLAttributes),
23
+ 0
24
+ ];
25
+ },
26
+ addCommands() {
27
+ return {
28
+ setCustomHeading: (attributes) => ({ tr, dispatch, commands }) => {
29
+ if (!this.options.levels.includes(attributes.level))
30
+ return !1;
31
+ const { selection } = tr, { from, to } = selection;
32
+ return tr.doc.nodesBetween(from, to, (node, pos) => {
33
+ node.isBlock && from >= pos && to <= pos + node.nodeSize && node.content.forEach((content) => {
34
+ content.marks.forEach((mark) => {
35
+ mark.type.name === "textStyle" && mark.attrs.fontSize && mark.attrs.fontSize !== null && (tr = tr.removeMark(pos, pos + node.nodeSize, mark.type));
36
+ });
37
+ });
38
+ }), dispatch && dispatch(tr), commands.setHeading({ level: attributes.level });
39
+ }
40
+ };
41
+ }
42
+ });
43
+ export {
44
+ CustomHeading
45
+ };
46
+ //# sourceMappingURL=heading.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"heading.js","names":[],"sources":["../../src/heading/heading.ts"],"sourcesContent":["import { mergeAttributes } from '@tiptap/core';\nimport { Heading } from '@tiptap/extension-heading';\nimport '@tiptap/extension-text-style';\n\nexport declare type Level = 1 | 2;\n\ninterface Options {\n levels: Level[];\n HTMLAttributes: Record<string, any>;\n}\n\ndeclare module '@tiptap/core' {\n interface Commands<ReturnType> {\n customHeading: {\n /**\n * Apply Heading Level\n */\n setCustomHeading: (attributes: { level: Level }) => ReturnType;\n };\n }\n}\n\nexport const CustomHeading = Heading.extend<Options>({\n name: 'customHeading',\n\n addOptions() {\n return {\n ...this.parent?.(),\n HTMLAttributes: {},\n };\n },\n\n parseHTML() {\n return this.options.levels.map((level: Level) => ({\n tag: `h${level}`,\n attrs: { level },\n }));\n },\n\n renderHTML({ node, HTMLAttributes }) {\n const hasLevel = this.options.levels.includes(node.attrs.level);\n const level = hasLevel ? node.attrs.level : this.options.levels[0];\n\n return [\n `h${level}`,\n mergeAttributes(this.options.HTMLAttributes, HTMLAttributes),\n 0,\n ];\n },\n\n addCommands() {\n return {\n setCustomHeading:\n (attributes) =>\n ({ tr, dispatch, commands }) => {\n if (!this.options.levels.includes(attributes.level)) {\n return false;\n }\n\n const { selection } = tr;\n const { from, to } = selection;\n\n tr.doc.nodesBetween(from, to, (node, pos) => {\n if (node.isBlock && from >= pos && to <= pos + node.nodeSize) {\n /* get node content and iterate through */\n node.content.forEach((content) => {\n /* get content marks and iterate through */\n content.marks.forEach((mark) => {\n /* find textStyle mark and if has fontSize attrs */\n if (\n mark.type.name === 'textStyle' &&\n mark.attrs['fontSize'] &&\n mark.attrs['fontSize'] !== null\n ) {\n /* remove any fontSize attr to reset heading style */\n tr = tr.removeMark(pos, pos + node.nodeSize, mark.type);\n }\n });\n });\n }\n });\n\n if (dispatch) {\n dispatch(tr);\n }\n return commands.setHeading({ level: attributes.level });\n },\n };\n },\n});\n"],"mappings":"8HAsBA,IAAa,cAAgB,QAAQ,OAAgB,CACnD,KAAM,gBAEN,YAAa,CACX,MAAO,CACL,GAAG,KAAK,SAAS,EACjB,eAAgB,CAAC,CACnB,CACF,EAEA,WAAY,CACV,OAAO,KAAK,QAAQ,OAAO,IAAK,QAAkB,CAChD,IAAK,IAAI,QACT,MAAO,CAAE,KAAM,CACjB,EAAE,CACJ,EAEA,WAAW,CAAE,KAAM,gBAAkB,CAInC,MAAO,CACL,IAJe,KAAK,QAAQ,OAAO,SAAS,KAAK,MAAM,KAC3C,EAAW,KAAK,MAAM,MAAQ,KAAK,QAAQ,OAAO,KAI9D,gBAAgB,KAAK,QAAQ,eAAgB,cAAc,EAC3D,CACF,CACF,EAEA,aAAc,CACZ,MAAO,CACL,iBACG,aACA,CAAE,GAAI,SAAU,YAAe,CAC9B,GAAI,CAAC,KAAK,QAAQ,OAAO,SAAS,WAAW,KAAK,EAChD,MAAO,GAGT,GAAM,CAAE,WAAc,GAChB,CAAE,KAAM,IAAO,UAyBrB,OAvBA,GAAG,IAAI,aAAa,KAAM,IAAK,KAAM,MAAQ,CACvC,KAAK,SAAW,MAAQ,KAAO,IAAM,IAAM,KAAK,UAElD,KAAK,QAAQ,QAAS,SAAY,CAEhC,QAAQ,MAAM,QAAS,MAAS,CAG5B,KAAK,KAAK,OAAS,aACnB,KAAK,MAAM,UACX,KAAK,MAAM,WAAgB,OAG3B,GAAK,GAAG,WAAW,IAAK,IAAM,KAAK,SAAU,KAAK,IAAI,EAE1D,CAAC,CACH,CAAC,CAEL,CAAC,EAEG,UACF,SAAS,EAAE,EAEN,SAAS,WAAW,CAAE,MAAO,WAAW,KAAM,CAAC,CACxD,CACJ,CACF,CACF,CAAC"}
1
+ {"version":3,"file":"heading.js","sources":["../../src/heading/heading.ts"],"sourcesContent":["import { mergeAttributes } from '@tiptap/core';\nimport { Heading } from '@tiptap/extension-heading';\nimport '@tiptap/extension-text-style';\n\nexport declare type Level = 1 | 2;\n\ninterface Options {\n levels: Level[];\n HTMLAttributes: Record<string, any>;\n}\n\ndeclare module '@tiptap/core' {\n interface Commands<ReturnType> {\n customHeading: {\n /**\n * Apply Heading Level\n */\n setCustomHeading: (attributes: { level: Level }) => ReturnType;\n };\n }\n}\n\nexport const CustomHeading = Heading.extend<Options>({\n name: 'customHeading',\n\n addOptions() {\n return {\n ...this.parent?.(),\n HTMLAttributes: {},\n };\n },\n\n parseHTML() {\n return this.options.levels.map((level: Level) => ({\n tag: `h${level}`,\n attrs: { level },\n }));\n },\n\n renderHTML({ node, HTMLAttributes }) {\n const hasLevel = this.options.levels.includes(node.attrs.level);\n const level = hasLevel ? node.attrs.level : this.options.levels[0];\n\n return [\n `h${level}`,\n mergeAttributes(this.options.HTMLAttributes, HTMLAttributes),\n 0,\n ];\n },\n\n addCommands() {\n return {\n setCustomHeading:\n (attributes) =>\n ({ tr, dispatch, commands }) => {\n if (!this.options.levels.includes(attributes.level)) {\n return false;\n }\n\n const { selection } = tr;\n const { from, to } = selection;\n\n tr.doc.nodesBetween(from, to, (node, pos) => {\n if (node.isBlock && from >= pos && to <= pos + node.nodeSize) {\n /* get node content and iterate through */\n node.content.forEach((content) => {\n /* get content marks and iterate through */\n content.marks.forEach((mark) => {\n /* find textStyle mark and if has fontSize attrs */\n if (\n mark.type.name === 'textStyle' &&\n mark.attrs['fontSize'] &&\n mark.attrs['fontSize'] !== null\n ) {\n /* remove any fontSize attr to reset heading style */\n tr = tr.removeMark(pos, pos + node.nodeSize, mark.type);\n }\n });\n });\n }\n });\n\n if (dispatch) {\n dispatch(tr);\n }\n return commands.setHeading({ level: attributes.level });\n },\n };\n },\n});\n"],"names":[],"mappings":";;;AAsBO,MAAM,gBAAgB,QAAQ,OAAgB;AAAA,EACnD,MAAM;AAAA,EAEN,aAAa;;AACX,WAAO;AAAA,MACL,IAAG,UAAK,WAAL;AAAA,MACH,gBAAgB,CAAA;AAAA,IAAC;AAAA,EAErB;AAAA,EAEA,YAAY;AACV,WAAO,KAAK,QAAQ,OAAO,IAAI,CAAC,WAAkB;AAAA,MAChD,KAAK,IAAI,KAAK;AAAA,MACd,OAAO,EAAE,MAAA;AAAA,IAAM,EACf;AAAA,EACJ;AAAA,EAEA,WAAW,EAAE,MAAM,kBAAkB;AAInC,WAAO;AAAA,MACL,IAJe,KAAK,QAAQ,OAAO,SAAS,KAAK,MAAM,KAAK,IACrC,KAAK,MAAM,QAAQ,KAAK,QAAQ,OAAO,CAAC,CAGtD;AAAA,MACT,gBAAgB,KAAK,QAAQ,gBAAgB,cAAc;AAAA,MAC3D;AAAA,IAAA;AAAA,EAEJ;AAAA,EAEA,cAAc;AACZ,WAAO;AAAA,MACL,kBACE,CAAC,eACD,CAAC,EAAE,IAAI,UAAU,eAAe;AAC9B,YAAI,CAAC,KAAK,QAAQ,OAAO,SAAS,WAAW,KAAK;AAChD,iBAAO;AAGT,cAAM,EAAE,cAAc,IAChB,EAAE,MAAM,GAAA,IAAO;AAErB,kBAAG,IAAI,aAAa,MAAM,IAAI,CAAC,MAAM,QAAQ;AAC3C,UAAI,KAAK,WAAW,QAAQ,OAAO,MAAM,MAAM,KAAK,YAElD,KAAK,QAAQ,QAAQ,CAAC,YAAY;AAEhC,oBAAQ,MAAM,QAAQ,CAAC,SAAS;AAE9B,cACE,KAAK,KAAK,SAAS,eACnB,KAAK,MAAM,YACX,KAAK,MAAM,aAAgB,SAG3B,KAAK,GAAG,WAAW,KAAK,MAAM,KAAK,UAAU,KAAK,IAAI;AAAA,YAE1D,CAAC;AAAA,UACH,CAAC;AAAA,QAEL,CAAC,GAEG,YACF,SAAS,EAAE,GAEN,SAAS,WAAW,EAAE,OAAO,WAAW,OAAO;AAAA,MACxD;AAAA,IAAA;AAAA,EAEN;AACF,CAAC;"}
@@ -1,2 +1,2 @@
1
- const require_runtime=require("../_virtual/_rolldown/runtime.cjs");let _tiptap_extension_highlight=require("@tiptap/extension-highlight");_tiptap_extension_highlight=require_runtime.__toESM(_tiptap_extension_highlight,1);var CustomHighlight=_tiptap_extension_highlight.default.extend({name:`customHighlight`,addOptions(){return{...this.parent?.(),multicolor:!0,HTMLAttributes:{}}},parseHTML(){return[{...this.parent?.(),style:`background-color`,getAttrs:style=>({color:style})}]}});exports.CustomHighlight=CustomHighlight;
2
- //# sourceMappingURL=highlight.cjs.map
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const Highlight=require("@tiptap/extension-highlight"),CustomHighlight=Highlight.extend({name:"customHighlight",addOptions(){var _a;return{...(_a=this.parent)==null?void 0:_a.call(this),multicolor:!0,HTMLAttributes:{}}},parseHTML(){var _a;return[{...(_a=this.parent)==null?void 0:_a.call(this),style:"background-color",getAttrs:style=>({color:style})}]}});exports.CustomHighlight=CustomHighlight;
2
+ //# sourceMappingURL=highlight.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"highlight.cjs","names":[],"sources":["../../src/highlight/highlight.ts"],"sourcesContent":["import Highlight from '@tiptap/extension-highlight';\n\nexport const CustomHighlight = Highlight.extend({\n name: 'customHighlight',\n\n addOptions() {\n return {\n ...this.parent?.(),\n multicolor: true,\n HTMLAttributes: {},\n };\n },\n\n parseHTML() {\n return [\n {\n ...this.parent?.(),\n style: 'background-color',\n getAttrs: (style) => {\n return {\n color: style,\n };\n },\n },\n ];\n },\n});\n"],"mappings":"6NAEA,IAAa,gBAAkB,4BAAA,QAAU,OAAO,CAC9C,KAAM,kBAEN,YAAa,CACX,MAAO,CACL,GAAG,KAAK,SAAS,EACjB,WAAY,GACZ,eAAgB,CAAC,CACnB,CACF,EAEA,WAAY,CACV,MAAO,CACL,CACE,GAAG,KAAK,SAAS,EACjB,MAAO,mBACP,SAAW,QACF,CACL,MAAO,KACT,EAEJ,CACF,CACF,CACF,CAAC"}
1
+ {"version":3,"file":"highlight.cjs","sources":["../../src/highlight/highlight.ts"],"sourcesContent":["import Highlight from '@tiptap/extension-highlight';\n\nexport const CustomHighlight = Highlight.extend({\n name: 'customHighlight',\n\n addOptions() {\n return {\n ...this.parent?.(),\n multicolor: true,\n HTMLAttributes: {},\n };\n },\n\n parseHTML() {\n return [\n {\n ...this.parent?.(),\n style: 'background-color',\n getAttrs: (style) => {\n return {\n color: style,\n };\n },\n },\n ];\n },\n});\n"],"names":[],"mappings":"uIAEa,gBAAkB,UAAU,OAAO,CAC9C,KAAM,kBAEN,YAAa,QACX,MAAO,CACL,IAAG,QAAK,SAAL,0BACH,WAAY,GACZ,eAAgB,CAAA,CAAC,CAErB,EAEA,WAAY,QACV,MAAO,CACL,CACE,IAAG,QAAK,SAAL,0BACH,MAAO,mBACP,SAAW,QACF,CACL,MAAO,KAAA,EAEX,CACF,CAEJ,CACF,CAAC"}
@@ -1,2 +1,28 @@
1
- import Highlight from"@tiptap/extension-highlight";var CustomHighlight=Highlight.extend({name:`customHighlight`,addOptions(){return{...this.parent?.(),multicolor:!0,HTMLAttributes:{}}},parseHTML(){return[{...this.parent?.(),style:`background-color`,getAttrs:style=>({color:style})}]}});export{CustomHighlight};
2
- //# sourceMappingURL=highlight.js.map
1
+ import Highlight from "@tiptap/extension-highlight";
2
+ const CustomHighlight = Highlight.extend({
3
+ name: "customHighlight",
4
+ addOptions() {
5
+ var _a;
6
+ return {
7
+ ...(_a = this.parent) == null ? void 0 : _a.call(this),
8
+ multicolor: !0,
9
+ HTMLAttributes: {}
10
+ };
11
+ },
12
+ parseHTML() {
13
+ var _a;
14
+ return [
15
+ {
16
+ ...(_a = this.parent) == null ? void 0 : _a.call(this),
17
+ style: "background-color",
18
+ getAttrs: (style) => ({
19
+ color: style
20
+ })
21
+ }
22
+ ];
23
+ }
24
+ });
25
+ export {
26
+ CustomHighlight
27
+ };
28
+ //# sourceMappingURL=highlight.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"highlight.js","names":[],"sources":["../../src/highlight/highlight.ts"],"sourcesContent":["import Highlight from '@tiptap/extension-highlight';\n\nexport const CustomHighlight = Highlight.extend({\n name: 'customHighlight',\n\n addOptions() {\n return {\n ...this.parent?.(),\n multicolor: true,\n HTMLAttributes: {},\n };\n },\n\n parseHTML() {\n return [\n {\n ...this.parent?.(),\n style: 'background-color',\n getAttrs: (style) => {\n return {\n color: style,\n };\n },\n },\n ];\n },\n});\n"],"mappings":"mDAEA,IAAa,gBAAkB,UAAU,OAAO,CAC9C,KAAM,kBAEN,YAAa,CACX,MAAO,CACL,GAAG,KAAK,SAAS,EACjB,WAAY,GACZ,eAAgB,CAAC,CACnB,CACF,EAEA,WAAY,CACV,MAAO,CACL,CACE,GAAG,KAAK,SAAS,EACjB,MAAO,mBACP,SAAW,QACF,CACL,MAAO,KACT,EAEJ,CACF,CACF,CACF,CAAC"}
1
+ {"version":3,"file":"highlight.js","sources":["../../src/highlight/highlight.ts"],"sourcesContent":["import Highlight from '@tiptap/extension-highlight';\n\nexport const CustomHighlight = Highlight.extend({\n name: 'customHighlight',\n\n addOptions() {\n return {\n ...this.parent?.(),\n multicolor: true,\n HTMLAttributes: {},\n };\n },\n\n parseHTML() {\n return [\n {\n ...this.parent?.(),\n style: 'background-color',\n getAttrs: (style) => {\n return {\n color: style,\n };\n },\n },\n ];\n },\n});\n"],"names":[],"mappings":";AAEO,MAAM,kBAAkB,UAAU,OAAO;AAAA,EAC9C,MAAM;AAAA,EAEN,aAAa;;AACX,WAAO;AAAA,MACL,IAAG,UAAK,WAAL;AAAA,MACH,YAAY;AAAA,MACZ,gBAAgB,CAAA;AAAA,IAAC;AAAA,EAErB;AAAA,EAEA,YAAY;;AACV,WAAO;AAAA,MACL;AAAA,QACE,IAAG,UAAK,WAAL;AAAA,QACH,OAAO;AAAA,QACP,UAAU,CAAC,WACF;AAAA,UACL,OAAO;AAAA,QAAA;AAAA,MAEX;AAAA,IACF;AAAA,EAEJ;AACF,CAAC;"}
@@ -1,2 +1,2 @@
1
- var Hyperlink=require("@tiptap/extension-link").Link.extend({name:`hyperlink`,parseHTML(){return[{tag:`a[href]:not([href *= "javascript:" i])`,getAttrs:node=>{if(node.getAttribute(`data-id`)&&node.getAttribute(`data-app-prefix`))return!1}}]},addOptions(){return{...this.parent?.(),openOnClick:!1,HTMLAttributes:{...this.parent?.().HTMLAttributes,target:null}}},addAttributes(){return{...this.parent?.(),target:{default:this.options.HTMLAttributes.target,parseHTML:element=>element.getAttribute(`target`)===`_blank`?`_blank`:null,renderHTML:attributes=>({target:attributes.target})},title:{default:this.options.HTMLAttributes.title}}}});exports.Hyperlink=Hyperlink;
2
- //# sourceMappingURL=hyperlink.cjs.map
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const extensionLink=require("@tiptap/extension-link"),Hyperlink=extensionLink.Link.extend({name:"hyperlink",parseHTML(){return[{tag:'a[href]:not([href *= "javascript:" i])',getAttrs:node=>{if(node.getAttribute("data-id")&&node.getAttribute("data-app-prefix"))return!1}}]},addOptions(){var _a,_b;return{...(_a=this.parent)==null?void 0:_a.call(this),openOnClick:!1,HTMLAttributes:{...(_b=this.parent)==null?void 0:_b.call(this).HTMLAttributes,target:null}}},addAttributes(){var _a;return{...(_a=this.parent)==null?void 0:_a.call(this),target:{default:this.options.HTMLAttributes.target,parseHTML:element=>element.getAttribute("target")!=="_blank"?null:"_blank",renderHTML:attributes=>({target:attributes.target})},title:{default:this.options.HTMLAttributes.title}}}});exports.Hyperlink=Hyperlink;
2
+ //# sourceMappingURL=hyperlink.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"hyperlink.cjs","names":[],"sources":["../../src/hyperlink/hyperlink.ts"],"sourcesContent":["import { Link } from '@tiptap/extension-link';\n\n/** Our own model of an hyperlink in a rich document. */\nexport type HyperlinkAttributes = {\n href: string | null;\n target: '_blank' | null;\n title: string | null;\n text: string | null;\n};\n\ndeclare module '@tiptap/core' {\n interface Commands<ReturnType> {\n hyperlink: {\n /**\n * Set an hyperlink mark\n */\n setLink: (attributes: Partial<HyperlinkAttributes>) => ReturnType;\n /**\n * Toggle an hyperlink mark\n */\n toggleLink: (attributes: {\n href: string;\n target?: string | null;\n }) => ReturnType;\n /**\n * Unset an hyperlink mark\n */\n unsetLink: () => ReturnType;\n };\n }\n}\n\n/**\n * Hyperlink (external links), extends `Link` extension from TipTap.\n *\n * Links to external resources MUST NOT have a `data-id` nor a `data-app-prefix` attribute.\n * The `target` attribute has to be sanitized, so it is overriden.\n */\nexport const Hyperlink = Link.extend({\n name: 'hyperlink',\n\n parseHTML() {\n return [\n {\n tag: 'a[href]:not([href *= \"javascript:\" i])',\n // Be sure no data-id and data-app-prefix attribute exists :\n // it would then be an Linker, not an Hyperlink !\n getAttrs: (node: HTMLAnchorElement) => {\n // See https://prosemirror.net/docs/ref/version/0.18.0.html#model.ParseRule.getAttrs\n if (\n node.getAttribute('data-id') &&\n node.getAttribute('data-app-prefix')\n )\n return false;\n },\n },\n ];\n },\n\n addOptions() {\n return {\n ...this.parent?.(),\n openOnClick: false,\n HTMLAttributes: {\n ...this.parent?.().HTMLAttributes,\n target: null,\n },\n };\n },\n\n /* Manage `title` and `target` attributes. */\n addAttributes() {\n return {\n // Preserve attributes of parent extension...\n ...this.parent?.(),\n // ...then add or override the following :\n //------------------\n target: {\n default: this.options.HTMLAttributes.target,\n // Sanitize target value\n parseHTML: (element) =>\n element.getAttribute('target') !== '_blank' ? null : '_blank',\n renderHTML: (attributes) => ({\n target: attributes['target'],\n }),\n },\n title: {\n default: this.options.HTMLAttributes.title,\n },\n };\n },\n});\n"],"mappings":"AAsCA,IAAa,0CAAY,EAAA,KAAK,OAAO,CACnC,KAAM,YAEN,WAAY,CACV,MAAO,CACL,CACE,IAAK,yCAGL,SAAW,MAA4B,CAErC,GACE,KAAK,aAAa,SAAS,GAC3B,KAAK,aAAa,iBAAiB,EAEnC,MAAO,EACX,CACF,CACF,CACF,EAEA,YAAa,CACX,MAAO,CACL,GAAG,KAAK,SAAS,EACjB,YAAa,GACb,eAAgB,CACd,GAAG,KAAK,SAAS,EAAE,eACnB,OAAQ,IACV,CACF,CACF,EAGA,eAAgB,CACd,MAAO,CAEL,GAAG,KAAK,SAAS,EAGjB,OAAQ,CACN,QAAS,KAAK,QAAQ,eAAe,OAErC,UAAY,SACV,QAAQ,aAAa,QAAQ,IAAM,SAAkB,SAAP,KAChD,WAAa,aAAgB,CAC3B,OAAQ,WAAW,MACrB,EACF,EACA,MAAO,CACL,QAAS,KAAK,QAAQ,eAAe,KACvC,CACF,CACF,CACF,CAAC"}
1
+ {"version":3,"file":"hyperlink.cjs","sources":["../../src/hyperlink/hyperlink.ts"],"sourcesContent":["import { Link } from '@tiptap/extension-link';\n\n/** Our own model of an hyperlink in a rich document. */\nexport type HyperlinkAttributes = {\n href: string | null;\n target: '_blank' | null;\n title: string | null;\n text: string | null;\n};\n\ndeclare module '@tiptap/core' {\n interface Commands<ReturnType> {\n hyperlink: {\n /**\n * Set an hyperlink mark\n */\n setLink: (attributes: Partial<HyperlinkAttributes>) => ReturnType;\n /**\n * Toggle an hyperlink mark\n */\n toggleLink: (attributes: {\n href: string;\n target?: string | null;\n }) => ReturnType;\n /**\n * Unset an hyperlink mark\n */\n unsetLink: () => ReturnType;\n };\n }\n}\n\n/**\n * Hyperlink (external links), extends `Link` extension from TipTap.\n *\n * Links to external resources MUST NOT have a `data-id` nor a `data-app-prefix` attribute.\n * The `target` attribute has to be sanitized, so it is overriden.\n */\nexport const Hyperlink = Link.extend({\n name: 'hyperlink',\n\n parseHTML() {\n return [\n {\n tag: 'a[href]:not([href *= \"javascript:\" i])',\n // Be sure no data-id and data-app-prefix attribute exists :\n // it would then be an Linker, not an Hyperlink !\n getAttrs: (node: HTMLAnchorElement) => {\n // See https://prosemirror.net/docs/ref/version/0.18.0.html#model.ParseRule.getAttrs\n if (\n node.getAttribute('data-id') &&\n node.getAttribute('data-app-prefix')\n )\n return false;\n },\n },\n ];\n },\n\n addOptions() {\n return {\n ...this.parent?.(),\n openOnClick: false,\n HTMLAttributes: {\n ...this.parent?.().HTMLAttributes,\n target: null,\n },\n };\n },\n\n /* Manage `title` and `target` attributes. */\n addAttributes() {\n return {\n // Preserve attributes of parent extension...\n ...this.parent?.(),\n // ...then add or override the following :\n //------------------\n target: {\n default: this.options.HTMLAttributes.target,\n // Sanitize target value\n parseHTML: (element) =>\n element.getAttribute('target') !== '_blank' ? null : '_blank',\n renderHTML: (attributes) => ({\n target: attributes['target'],\n }),\n },\n title: {\n default: this.options.HTMLAttributes.title,\n },\n };\n },\n});\n"],"names":["Link"],"mappings":"sIAsCa,UAAYA,cAAAA,KAAK,OAAO,CACnC,KAAM,YAEN,WAAY,CACV,MAAO,CACL,CACE,IAAK,yCAGL,SAAW,MAA4B,CAErC,GACE,KAAK,aAAa,SAAS,GAC3B,KAAK,aAAa,iBAAiB,EAEnC,MAAO,EACX,CAAA,CACF,CAEJ,EAEA,YAAa,WACX,MAAO,CACL,IAAG,QAAK,SAAL,0BACH,YAAa,GACb,eAAgB,CACd,IAAG,QAAK,SAAL,0BAAgB,eACnB,OAAQ,IAAA,CACV,CAEJ,EAGA,eAAgB,QACd,MAAO,CAEL,IAAG,QAAK,SAAL,0BAGH,OAAQ,CACN,QAAS,KAAK,QAAQ,eAAe,OAErC,UAAY,SACV,QAAQ,aAAa,QAAQ,IAAM,SAAW,KAAO,SACvD,WAAa,aAAgB,CAC3B,OAAQ,WAAW,MAAQ,EAC7B,EAEF,MAAO,CACL,QAAS,KAAK,QAAQ,eAAe,KAAA,CACvC,CAEJ,CACF,CAAC"}
@@ -1,2 +1,53 @@
1
- import{Link}from"@tiptap/extension-link";var Hyperlink=Link.extend({name:`hyperlink`,parseHTML(){return[{tag:`a[href]:not([href *= "javascript:" i])`,getAttrs:node=>{if(node.getAttribute(`data-id`)&&node.getAttribute(`data-app-prefix`))return!1}}]},addOptions(){return{...this.parent?.(),openOnClick:!1,HTMLAttributes:{...this.parent?.().HTMLAttributes,target:null}}},addAttributes(){return{...this.parent?.(),target:{default:this.options.HTMLAttributes.target,parseHTML:element=>element.getAttribute(`target`)===`_blank`?`_blank`:null,renderHTML:attributes=>({target:attributes.target})},title:{default:this.options.HTMLAttributes.title}}}});export{Hyperlink};
2
- //# sourceMappingURL=hyperlink.js.map
1
+ import { Link } from "@tiptap/extension-link";
2
+ const Hyperlink = Link.extend({
3
+ name: "hyperlink",
4
+ parseHTML() {
5
+ return [
6
+ {
7
+ tag: 'a[href]:not([href *= "javascript:" i])',
8
+ // Be sure no data-id and data-app-prefix attribute exists :
9
+ // it would then be an Linker, not an Hyperlink !
10
+ getAttrs: (node) => {
11
+ if (node.getAttribute("data-id") && node.getAttribute("data-app-prefix"))
12
+ return !1;
13
+ }
14
+ }
15
+ ];
16
+ },
17
+ addOptions() {
18
+ var _a, _b;
19
+ return {
20
+ ...(_a = this.parent) == null ? void 0 : _a.call(this),
21
+ openOnClick: !1,
22
+ HTMLAttributes: {
23
+ ...(_b = this.parent) == null ? void 0 : _b.call(this).HTMLAttributes,
24
+ target: null
25
+ }
26
+ };
27
+ },
28
+ /* Manage `title` and `target` attributes. */
29
+ addAttributes() {
30
+ var _a;
31
+ return {
32
+ // Preserve attributes of parent extension...
33
+ ...(_a = this.parent) == null ? void 0 : _a.call(this),
34
+ // ...then add or override the following :
35
+ //------------------
36
+ target: {
37
+ default: this.options.HTMLAttributes.target,
38
+ // Sanitize target value
39
+ parseHTML: (element) => element.getAttribute("target") !== "_blank" ? null : "_blank",
40
+ renderHTML: (attributes) => ({
41
+ target: attributes.target
42
+ })
43
+ },
44
+ title: {
45
+ default: this.options.HTMLAttributes.title
46
+ }
47
+ };
48
+ }
49
+ });
50
+ export {
51
+ Hyperlink
52
+ };
53
+ //# sourceMappingURL=hyperlink.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"hyperlink.js","names":[],"sources":["../../src/hyperlink/hyperlink.ts"],"sourcesContent":["import { Link } from '@tiptap/extension-link';\n\n/** Our own model of an hyperlink in a rich document. */\nexport type HyperlinkAttributes = {\n href: string | null;\n target: '_blank' | null;\n title: string | null;\n text: string | null;\n};\n\ndeclare module '@tiptap/core' {\n interface Commands<ReturnType> {\n hyperlink: {\n /**\n * Set an hyperlink mark\n */\n setLink: (attributes: Partial<HyperlinkAttributes>) => ReturnType;\n /**\n * Toggle an hyperlink mark\n */\n toggleLink: (attributes: {\n href: string;\n target?: string | null;\n }) => ReturnType;\n /**\n * Unset an hyperlink mark\n */\n unsetLink: () => ReturnType;\n };\n }\n}\n\n/**\n * Hyperlink (external links), extends `Link` extension from TipTap.\n *\n * Links to external resources MUST NOT have a `data-id` nor a `data-app-prefix` attribute.\n * The `target` attribute has to be sanitized, so it is overriden.\n */\nexport const Hyperlink = Link.extend({\n name: 'hyperlink',\n\n parseHTML() {\n return [\n {\n tag: 'a[href]:not([href *= \"javascript:\" i])',\n // Be sure no data-id and data-app-prefix attribute exists :\n // it would then be an Linker, not an Hyperlink !\n getAttrs: (node: HTMLAnchorElement) => {\n // See https://prosemirror.net/docs/ref/version/0.18.0.html#model.ParseRule.getAttrs\n if (\n node.getAttribute('data-id') &&\n node.getAttribute('data-app-prefix')\n )\n return false;\n },\n },\n ];\n },\n\n addOptions() {\n return {\n ...this.parent?.(),\n openOnClick: false,\n HTMLAttributes: {\n ...this.parent?.().HTMLAttributes,\n target: null,\n },\n };\n },\n\n /* Manage `title` and `target` attributes. */\n addAttributes() {\n return {\n // Preserve attributes of parent extension...\n ...this.parent?.(),\n // ...then add or override the following :\n //------------------\n target: {\n default: this.options.HTMLAttributes.target,\n // Sanitize target value\n parseHTML: (element) =>\n element.getAttribute('target') !== '_blank' ? null : '_blank',\n renderHTML: (attributes) => ({\n target: attributes['target'],\n }),\n },\n title: {\n default: this.options.HTMLAttributes.title,\n },\n };\n },\n});\n"],"mappings":"yCAsCA,IAAa,UAAY,KAAK,OAAO,CACnC,KAAM,YAEN,WAAY,CACV,MAAO,CACL,CACE,IAAK,yCAGL,SAAW,MAA4B,CAErC,GACE,KAAK,aAAa,SAAS,GAC3B,KAAK,aAAa,iBAAiB,EAEnC,MAAO,EACX,CACF,CACF,CACF,EAEA,YAAa,CACX,MAAO,CACL,GAAG,KAAK,SAAS,EACjB,YAAa,GACb,eAAgB,CACd,GAAG,KAAK,SAAS,EAAE,eACnB,OAAQ,IACV,CACF,CACF,EAGA,eAAgB,CACd,MAAO,CAEL,GAAG,KAAK,SAAS,EAGjB,OAAQ,CACN,QAAS,KAAK,QAAQ,eAAe,OAErC,UAAY,SACV,QAAQ,aAAa,QAAQ,IAAM,SAAkB,SAAP,KAChD,WAAa,aAAgB,CAC3B,OAAQ,WAAW,MACrB,EACF,EACA,MAAO,CACL,QAAS,KAAK,QAAQ,eAAe,KACvC,CACF,CACF,CACF,CAAC"}
1
+ {"version":3,"file":"hyperlink.js","sources":["../../src/hyperlink/hyperlink.ts"],"sourcesContent":["import { Link } from '@tiptap/extension-link';\n\n/** Our own model of an hyperlink in a rich document. */\nexport type HyperlinkAttributes = {\n href: string | null;\n target: '_blank' | null;\n title: string | null;\n text: string | null;\n};\n\ndeclare module '@tiptap/core' {\n interface Commands<ReturnType> {\n hyperlink: {\n /**\n * Set an hyperlink mark\n */\n setLink: (attributes: Partial<HyperlinkAttributes>) => ReturnType;\n /**\n * Toggle an hyperlink mark\n */\n toggleLink: (attributes: {\n href: string;\n target?: string | null;\n }) => ReturnType;\n /**\n * Unset an hyperlink mark\n */\n unsetLink: () => ReturnType;\n };\n }\n}\n\n/**\n * Hyperlink (external links), extends `Link` extension from TipTap.\n *\n * Links to external resources MUST NOT have a `data-id` nor a `data-app-prefix` attribute.\n * The `target` attribute has to be sanitized, so it is overriden.\n */\nexport const Hyperlink = Link.extend({\n name: 'hyperlink',\n\n parseHTML() {\n return [\n {\n tag: 'a[href]:not([href *= \"javascript:\" i])',\n // Be sure no data-id and data-app-prefix attribute exists :\n // it would then be an Linker, not an Hyperlink !\n getAttrs: (node: HTMLAnchorElement) => {\n // See https://prosemirror.net/docs/ref/version/0.18.0.html#model.ParseRule.getAttrs\n if (\n node.getAttribute('data-id') &&\n node.getAttribute('data-app-prefix')\n )\n return false;\n },\n },\n ];\n },\n\n addOptions() {\n return {\n ...this.parent?.(),\n openOnClick: false,\n HTMLAttributes: {\n ...this.parent?.().HTMLAttributes,\n target: null,\n },\n };\n },\n\n /* Manage `title` and `target` attributes. */\n addAttributes() {\n return {\n // Preserve attributes of parent extension...\n ...this.parent?.(),\n // ...then add or override the following :\n //------------------\n target: {\n default: this.options.HTMLAttributes.target,\n // Sanitize target value\n parseHTML: (element) =>\n element.getAttribute('target') !== '_blank' ? null : '_blank',\n renderHTML: (attributes) => ({\n target: attributes['target'],\n }),\n },\n title: {\n default: this.options.HTMLAttributes.title,\n },\n };\n },\n});\n"],"names":[],"mappings":";AAsCO,MAAM,YAAY,KAAK,OAAO;AAAA,EACnC,MAAM;AAAA,EAEN,YAAY;AACV,WAAO;AAAA,MACL;AAAA,QACE,KAAK;AAAA;AAAA;AAAA,QAGL,UAAU,CAAC,SAA4B;AAErC,cACE,KAAK,aAAa,SAAS,KAC3B,KAAK,aAAa,iBAAiB;AAEnC,mBAAO;AAAA,QACX;AAAA,MAAA;AAAA,IACF;AAAA,EAEJ;AAAA,EAEA,aAAa;;AACX,WAAO;AAAA,MACL,IAAG,UAAK,WAAL;AAAA,MACH,aAAa;AAAA,MACb,gBAAgB;AAAA,QACd,IAAG,UAAK,WAAL,8BAAgB;AAAA,QACnB,QAAQ;AAAA,MAAA;AAAA,IACV;AAAA,EAEJ;AAAA;AAAA,EAGA,gBAAgB;;AACd,WAAO;AAAA;AAAA,MAEL,IAAG,UAAK,WAAL;AAAA;AAAA;AAAA,MAGH,QAAQ;AAAA,QACN,SAAS,KAAK,QAAQ,eAAe;AAAA;AAAA,QAErC,WAAW,CAAC,YACV,QAAQ,aAAa,QAAQ,MAAM,WAAW,OAAO;AAAA,QACvD,YAAY,CAAC,gBAAgB;AAAA,UAC3B,QAAQ,WAAW;AAAA,QAAQ;AAAA,MAC7B;AAAA,MAEF,OAAO;AAAA,QACL,SAAS,KAAK,QAAQ,eAAe;AAAA,MAAA;AAAA,IACvC;AAAA,EAEJ;AACF,CAAC;"}
@@ -1,2 +1,2 @@
1
- const require_index=require("./transformers/index.cjs");var Iframe=require("@tiptap/core").Node.create({name:`iframe`,group:`block`,atom:!0,draggable:!0,addOptions(){return{allowFullscreen:!0,HTMLAttributes:{class:`iframe-wrapper`}}},addAttributes(){return{src:{default:null},frameborder:{default:0},allowfullscreen:{default:this.options.allowFullscreen,parseHTML:()=>this.options.allowFullscreen},width:{renderHTML:attributes=>attributes.width?{width:attributes.width===`100%`?`100%`:parseInt(attributes.width)}:{},parseHTML:element=>element.getAttribute(`width`)},height:{renderHTML:attributes=>attributes.height?{height:parseInt(attributes.height)}:{},parseHTML:element=>element.getAttribute(`height`)},style:{renderHTML:attributes=>attributes.style?{style:attributes.style}:{},parseHTML:element=>element.getAttribute(`style`)}}},parseHTML(){return[{tag:`iframe`}]},renderHTML({HTMLAttributes}){return require_index.iframeTransformer.onRenderHTML({HTMLAttributes}),[`div`,this.options.HTMLAttributes,[`iframe`,HTMLAttributes]]},addCommands(){return{setIframe:options=>({tr,dispatch})=>{let{selection}=tr,node=this.type.create(options);return dispatch&&tr.replaceRangeWith(selection.from,selection.to,node),!0}}}});exports.Iframe=Iframe;
2
- //# sourceMappingURL=iframe.cjs.map
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const core=require("@tiptap/core"),index=require("./transformers/index.cjs"),Iframe=core.Node.create({name:"iframe",group:"block",atom:!0,draggable:!0,addOptions(){return{allowFullscreen:!0,HTMLAttributes:{class:"iframe-wrapper"}}},addAttributes(){return{src:{default:null},frameborder:{default:0},allowfullscreen:{default:this.options.allowFullscreen,parseHTML:()=>this.options.allowFullscreen},width:{renderHTML:attributes=>attributes.width?{width:attributes.width==="100%"?"100%":parseInt(attributes.width)}:{},parseHTML:element=>element.getAttribute("width")},height:{renderHTML:attributes=>attributes.height?{height:parseInt(attributes.height)}:{},parseHTML:element=>element.getAttribute("height")},style:{renderHTML:attributes=>attributes.style?{style:attributes.style}:{},parseHTML:element=>element.getAttribute("style")}}},parseHTML(){return[{tag:"iframe"}]},renderHTML({HTMLAttributes}){return index.iframeTransformer.onRenderHTML({HTMLAttributes}),["div",this.options.HTMLAttributes,["iframe",HTMLAttributes]]},addCommands(){return{setIframe:options=>({tr,dispatch})=>{const{selection}=tr,node=this.type.create(options);return dispatch&&tr.replaceRangeWith(selection.from,selection.to,node),!0}}}});exports.Iframe=Iframe;
2
+ //# sourceMappingURL=iframe.cjs.map