@edifice.io/tiptap-extensions 2.6.8-develop-enabling.20261007103744 → 2.6.8-develop-enabling.20261012145010
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.
- package/dist/_virtual/_rolldown/runtime.cjs +1 -0
- package/dist/abbr/abbr.cjs +2 -2
- package/dist/abbr/abbr.cjs.map +1 -1
- package/dist/abbr/abbr.js +2 -33
- package/dist/abbr/abbr.js.map +1 -1
- package/dist/alert/alert.cjs +2 -2
- package/dist/alert/alert.cjs.map +1 -1
- package/dist/alert/alert.js +2 -45
- package/dist/alert/alert.js.map +1 -1
- package/dist/attachment/attachment-transformer.cjs +2 -2
- package/dist/attachment/attachment-transformer.cjs.map +1 -1
- package/dist/attachment/attachment-transformer.js +2 -76
- package/dist/attachment/attachment-transformer.js.map +1 -1
- package/dist/attachment/attachment.cjs +2 -2
- package/dist/attachment/attachment.cjs.map +1 -1
- package/dist/attachment/attachment.js +2 -98
- package/dist/attachment/attachment.js.map +1 -1
- package/dist/audio/audio.cjs +2 -2
- package/dist/audio/audio.cjs.map +1 -1
- package/dist/audio/audio.js +3 -52
- package/dist/audio/audio.js.map +1 -1
- package/dist/conversation-history/conversation-history.cjs +2 -2
- package/dist/conversation-history/conversation-history.cjs.map +1 -1
- package/dist/conversation-history/conversation-history.js +2 -63
- package/dist/conversation-history/conversation-history.js.map +1 -1
- package/dist/conversation-history-body/conversation-history-body.cjs +2 -2
- package/dist/conversation-history-body/conversation-history-body.cjs.map +1 -1
- package/dist/conversation-history-body/conversation-history-body.js +2 -24
- package/dist/conversation-history-body/conversation-history-body.js.map +1 -1
- package/dist/font-size/font-size.cjs +2 -2
- package/dist/font-size/font-size.cjs.map +1 -1
- package/dist/font-size/font-size.js +2 -39
- package/dist/font-size/font-size.js.map +1 -1
- package/dist/heading/heading.cjs +2 -2
- package/dist/heading/heading.cjs.map +1 -1
- package/dist/heading/heading.js +2 -46
- package/dist/heading/heading.js.map +1 -1
- package/dist/highlight/highlight.cjs +2 -2
- package/dist/highlight/highlight.cjs.map +1 -1
- package/dist/highlight/highlight.js +2 -28
- package/dist/highlight/highlight.js.map +1 -1
- package/dist/hyperlink/hyperlink.cjs +2 -2
- package/dist/hyperlink/hyperlink.cjs.map +1 -1
- package/dist/hyperlink/hyperlink.js +2 -53
- package/dist/hyperlink/hyperlink.js.map +1 -1
- package/dist/iframe/iframe.cjs +2 -2
- package/dist/iframe/iframe.cjs.map +1 -1
- package/dist/iframe/iframe.js +2 -70
- package/dist/iframe/iframe.js.map +1 -1
- package/dist/iframe/transformers/index.cjs +2 -2
- package/dist/iframe/transformers/index.cjs.map +1 -1
- package/dist/iframe/transformers/index.js +2 -22
- package/dist/iframe/transformers/index.js.map +1 -1
- package/dist/iframe/transformers/pad-transformer.cjs +2 -2
- package/dist/iframe/transformers/pad-transformer.cjs.map +1 -1
- package/dist/iframe/transformers/pad-transformer.js +2 -24
- package/dist/iframe/transformers/pad-transformer.js.map +1 -1
- package/dist/image/image.cjs +2 -2
- package/dist/image/image.cjs.map +1 -1
- package/dist/image/image.js +2 -175
- package/dist/image/image.js.map +1 -1
- package/dist/index.cjs +1 -2
- package/dist/index.js +1 -52
- package/dist/information-pane/information-pane.cjs +2 -2
- package/dist/information-pane/information-pane.cjs.map +1 -1
- package/dist/information-pane/information-pane.js +2 -57
- package/dist/information-pane/information-pane.js.map +1 -1
- package/dist/line-height/line-height.cjs +2 -2
- package/dist/line-height/line-height.cjs.map +1 -1
- package/dist/line-height/line-height.js +2 -33
- package/dist/line-height/line-height.js.map +1 -1
- package/dist/linker/linker.cjs +2 -2
- package/dist/linker/linker.cjs.map +1 -1
- package/dist/linker/linker.js +2 -96
- package/dist/linker/linker.js.map +1 -1
- package/dist/mathjax/mathjax.cjs +2 -2
- package/dist/mathjax/mathjax.cjs.map +1 -1
- package/dist/mathjax/mathjax.js +2 -40
- package/dist/mathjax/mathjax.js.map +1 -1
- package/dist/paragraph/paragraph.cjs +2 -2
- package/dist/paragraph/paragraph.cjs.map +1 -1
- package/dist/paragraph/paragraph.js +2 -16
- package/dist/paragraph/paragraph.js.map +1 -1
- package/dist/speech-recognition/speech-recognition.cjs +2 -2
- package/dist/speech-recognition/speech-recognition.cjs.map +1 -1
- package/dist/speech-recognition/speech-recognition.js +2 -56
- package/dist/speech-recognition/speech-recognition.js.map +1 -1
- package/dist/speech-synthesis/speech-synthesis.cjs +2 -2
- package/dist/speech-synthesis/speech-synthesis.cjs.map +1 -1
- package/dist/speech-synthesis/speech-synthesis.js +2 -25
- package/dist/speech-synthesis/speech-synthesis.js.map +1 -1
- package/dist/table-cell/table-cell.cjs +2 -2
- package/dist/table-cell/table-cell.cjs.map +1 -1
- package/dist/table-cell/table-cell.js +2 -23
- package/dist/table-cell/table-cell.js.map +1 -1
- package/dist/transform/html-to-json/html-to-json.cjs +2 -2
- package/dist/transform/html-to-json/html-to-json.cjs.map +1 -1
- package/dist/transform/html-to-json/html-to-json.js +2 -6
- package/dist/transform/html-to-json/html-to-json.js.map +1 -1
- package/dist/transform/json-to-html/json-to-html.cjs +2 -2
- package/dist/transform/json-to-html/json-to-html.cjs.map +1 -1
- package/dist/transform/json-to-html/json-to-html.js +2 -6
- package/dist/transform/json-to-html/json-to-html.js.map +1 -1
- package/dist/video/video.cjs +3 -3
- package/dist/video/video.cjs.map +1 -1
- package/dist/video/video.js +3 -92
- package/dist/video/video.js.map +1 -1
- package/package.json +5 -5
- package/dist/index.cjs.map +0 -1
- package/dist/index.js.map +0 -1
package/dist/audio/audio.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
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"],"
|
|
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,2 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
//# sourceMappingURL=conversation-history.cjs.map
|
|
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 +1 @@
|
|
|
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"],"
|
|
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,63 +1,2 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
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
|
+
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 +1 @@
|
|
|
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"],"
|
|
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,2 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
//# sourceMappingURL=conversation-history-body.cjs.map
|
|
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 +1 @@
|
|
|
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"],"
|
|
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,24 +1,2 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
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
|
+
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 +1 @@
|
|
|
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"],"
|
|
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,2 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
//# sourceMappingURL=font-size.cjs.map
|
|
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 +1 @@
|
|
|
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"],"
|
|
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,39 +1,2 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
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
|
+
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 +1 @@
|
|
|
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"],"
|
|
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"}
|
package/dist/heading/heading.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
//# sourceMappingURL=heading.cjs.map
|
|
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 +1 @@
|
|
|
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"],"
|
|
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"}
|
package/dist/heading/heading.js
CHANGED
|
@@ -1,46 +1,2 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
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
|
+
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 +1 @@
|
|
|
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"],"
|
|
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,2 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
//# sourceMappingURL=highlight.cjs.map
|
|
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 +1 @@
|
|
|
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"],"
|
|
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,28 +1,2 @@
|
|
|
1
|
-
import Highlight from
|
|
2
|
-
|
|
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
|
+
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 +1 @@
|
|
|
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"],"
|
|
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,2 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
//# sourceMappingURL=hyperlink.cjs.map
|
|
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 +1 @@
|
|
|
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"],"
|
|
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,53 +1,2 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
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
|
+
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 +1 @@
|
|
|
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"],"
|
|
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"}
|
package/dist/iframe/iframe.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
//# sourceMappingURL=iframe.cjs.map
|
|
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
|