@bikdotai/bik-component-library 0.0.806-beta.8 → 0.0.806-beta.9

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.
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../../node_modules/@tiptap/core/dist/index.js"),t=require("@tiptap/pm/model"),n=require("@tiptap/pm/state");const r=new Set(["bold","italic","strike","underline","code"]);function a(e){const n=[];return e.forEach((e=>{if(e.isText){const t=e.marks.filter((e=>r.has(e.type.name)));n.push(t.length===e.marks.length?e:e.mark(t))}else n.push(e.copy(a(e.content)))})),t.Fragment.from(n)}function i(e){const n=[];let r=!1;return e.forEach((e=>{var t;if("paragraph"===e.type.name&&1===e.childCount&&"hardBreak"===(null===(t=e.firstChild)||void 0===t?void 0:t.type.name))return r||n.push(e.type.create(e.attrs)),void(r=!0);const a="paragraph"===e.type.name&&0===e.childCount;a&&r||(r=a,e.isBlock&&!e.isLeaf?n.push(e.copy(i(e.content))):n.push(e))})),t.Fragment.from(n)}const o=e.Extension.create({name:"plainClipboard",addProseMirrorPlugins:()=>[new n.Plugin({props:{handlePaste(e,n){var r,o,l,s;if(null===(o=null===(r=n.clipboardData)||void 0===r?void 0:r.files)||void 0===o?void 0:o.length)return!1;const c=null===(l=n.clipboardData)||void 0===l?void 0:l.getData("text/html"),p=null===(s=n.clipboardData)||void 0===s?void 0:s.getData("text/plain");if(!p)return!1;if(null==c?void 0:c.includes("data-pm-slice"))return!1;const d=e.state.schema;if(c){const n=document.createElement("div");n.innerHTML=c;const r=t.DOMParser.fromSchema(d).parseSlice(n),o=i(a(r.content)),l=new t.Slice(o,r.openStart,r.openEnd);return e.dispatch(e.state.tr.replaceSelection(l)),!0}const u=p.split("\n").map((e=>d.node("paragraph",null,e?[d.text(e)]:[]))),m=new t.Slice(t.Fragment.fromArray(u),1,1);return e.dispatch(e.state.tr.replaceSelection(m)),!0}}})]});exports.PlainClipboardExtension=o;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../../node_modules/@tiptap/core/dist/index.js"),t=require("@tiptap/pm/model"),n=require("@tiptap/pm/state");const o=new Set(["bold","italic","strike","underline","code"]);function a(e){const n=[];return e.forEach((e=>{if(e.isText){const t=e.marks.filter((e=>o.has(e.type.name)));n.push(t.length===e.marks.length?e:e.mark(t))}else n.push(e.copy(a(e.content)))})),t.Fragment.from(n)}function r(e){const n=[];let o=!1;return e.forEach((e=>{var t;if("paragraph"===e.type.name&&1===e.childCount&&"hardBreak"===(null===(t=e.firstChild)||void 0===t?void 0:t.type.name))return o||n.push(e.type.create(e.attrs)),void(o=!0);const a="paragraph"===e.type.name&&0===e.childCount;a&&o||(o=a,e.isBlock&&!e.isLeaf?n.push(e.copy(r(e.content))):n.push(e))})),t.Fragment.from(n)}const l=e.Extension.create({name:"plainClipboard",addProseMirrorPlugins:()=>[new n.Plugin({props:{handlePaste(e,n){var o,l,i,s;if(null===(l=null===(o=n.clipboardData)||void 0===o?void 0:o.files)||void 0===l?void 0:l.length)return!1;const c=null===(i=n.clipboardData)||void 0===i?void 0:i.getData("text/html"),p=null===(s=n.clipboardData)||void 0===s?void 0:s.getData("text/plain");if(!p)return!1;if(null==c?void 0:c.includes("data-pm-slice"))return!1;const d=e.state.schema;if(c){console.log("[PASTE-DEBUG] clipboard html:",c);const n=document.createElement("div");n.innerHTML=c;const o=t.DOMParser.fromSchema(d).parseSlice(n);console.log("[PASTE-DEBUG] parsed nodes:"),o.content.forEach(((e,t,n)=>{var o;const a=[];null===(o=e.forEach)||void 0===o||o.call(e,(e=>a.push(e.type.name+(e.isText?`="${e.text}"`:"")))),console.log(` [${n}] ${e.type.name} children=[${a.join(", ")}]`)}));const l=r(a(o.content));console.log("[PASTE-DEBUG] after normalizeBlanks:"),l.forEach(((e,t,n)=>{var o;const a=[];null===(o=e.forEach)||void 0===o||o.call(e,(e=>a.push(e.type.name+(e.isText?`="${e.text}"`:"")))),console.log(` [${n}] ${e.type.name} children=[${a.join(", ")}]`)}));const i=new t.Slice(l,o.openStart,o.openEnd);return e.dispatch(e.state.tr.replaceSelection(i)),!0}const u=p.split("\n").map((e=>d.node("paragraph",null,e?[d.text(e)]:[]))),h=new t.Slice(t.Fragment.fromArray(u),1,1);return e.dispatch(e.state.tr.replaceSelection(h)),!0}}})]});exports.PlainClipboardExtension=l;
2
2
  //# sourceMappingURL=PlainClipboardExtension.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"PlainClipboardExtension.js","sources":["../../../../../src/editor/extensions/plainClipboard/PlainClipboardExtension.ts"],"sourcesContent":["import { Extension } from '@tiptap/core';\nimport {\n\tFragment,\n\tNode as PMNode,\n\tDOMParser as ProseMirrorDOMParser,\n\tSlice,\n} from '@tiptap/pm/model';\nimport { Plugin } from '@tiptap/pm/state';\n\nconst BASIC_MARKS = new Set(['bold', 'italic', 'strike', 'underline', 'code']);\n\n/**\n * Strip only \"rich\" marks (link, textStyle, highlight, etc.) while keeping\n * basic formatting marks (bold, italic, strike, underline, code) that\n * messaging channels can represent.\n */\nfunction stripRichMarks(fragment: Fragment): Fragment {\n\tconst nodes: PMNode[] = [];\n\tfragment.forEach((node) => {\n\t\tif (node.isText) {\n\t\t\tconst kept = node.marks.filter((m) => BASIC_MARKS.has(m.type.name));\n\t\t\tnodes.push(kept.length === node.marks.length ? node : node.mark(kept));\n\t\t} else {\n\t\t\tnodes.push(node.copy(stripRichMarks(node.content)));\n\t\t}\n\t});\n\treturn Fragment.from(nodes);\n}\n\n/**\n * 1. Convert paragraphs containing only a hard_break into empty paragraphs.\n * (Google Docs: `<p><span style=\"...\"><br></span></p>`)\n * 2. Collapse consecutive empty paragraphs into one.\n * (Google Docs emits both a standalone `<br>` AND a `<p><br></p>` per\n * blank line — ProseMirror wraps the standalone into its own paragraph,\n * doubling each blank line.)\n */\nfunction normalizeBlanks(fragment: Fragment): Fragment {\n\tconst nodes: PMNode[] = [];\n\tlet prevEmpty = false;\n\tfragment.forEach((node) => {\n\t\tconst isHardBreakOnly =\n\t\t\tnode.type.name === 'paragraph' &&\n\t\t\tnode.childCount === 1 &&\n\t\t\tnode.firstChild?.type.name === 'hardBreak';\n\t\tif (isHardBreakOnly) {\n\t\t\tif (!prevEmpty) nodes.push(node.type.create(node.attrs));\n\t\t\tprevEmpty = true;\n\t\t\treturn;\n\t\t}\n\t\tconst isEmpty = node.type.name === 'paragraph' && node.childCount === 0;\n\t\tif (isEmpty && prevEmpty) return;\n\t\tprevEmpty = isEmpty;\n\t\tif (node.isBlock && !node.isLeaf) {\n\t\t\tnodes.push(node.copy(normalizeBlanks(node.content)));\n\t\t} else {\n\t\t\tnodes.push(node);\n\t\t}\n\t});\n\treturn Fragment.from(nodes);\n}\n\nexport const PlainClipboardExtension = Extension.create({\n\tname: 'plainClipboard',\n\taddProseMirrorPlugins() {\n\t\treturn [\n\t\t\tnew Plugin({\n\t\t\t\tprops: {\n\t\t\t\t\thandlePaste(_view, event) {\n\t\t\t\t\t\tif (event.clipboardData?.files?.length) return false; // let ImagePaste handle\n\t\t\t\t\t\tconst html = event.clipboardData?.getData('text/html');\n\t\t\t\t\t\tconst text = event.clipboardData?.getData('text/plain');\n\t\t\t\t\t\tif (!text) return false;\n\n\t\t\t\t\t\t// ProseMirror stamps its own clipboard with data-pm-slice.\n\t\t\t\t\t\t// Let ProseMirror handle its own format natively — it round-trips perfectly.\n\t\t\t\t\t\tif (html?.includes('data-pm-slice')) return false;\n\n\t\t\t\t\t\tconst schema = _view.state.schema;\n\n\t\t\t\t\t\tif (html) {\n\t\t\t\t\t\t\t// Parse the HTML to get the correct block structure,\n\t\t\t\t\t\t\t// then strip rich marks (links, colors, fonts) while\n\t\t\t\t\t\t\t// keeping basic formatting (bold, italic, strike, etc.)\n\t\t\t\t\t\t\tconst container = document.createElement('div');\n\t\t\t\t\t\t\tcontainer.innerHTML = html;\n\t\t\t\t\t\t\tconst parsed =\n\t\t\t\t\t\t\t\tProseMirrorDOMParser.fromSchema(schema).parseSlice(container);\n\t\t\t\t\t\t\tconst cleaned = normalizeBlanks(stripRichMarks(parsed.content));\n\t\t\t\t\t\t\tconst slice = new Slice(\n\t\t\t\t\t\t\t\tcleaned,\n\t\t\t\t\t\t\t\tparsed.openStart,\n\t\t\t\t\t\t\t\tparsed.openEnd,\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t_view.dispatch(_view.state.tr.replaceSelection(slice));\n\t\t\t\t\t\t\treturn true;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// Plain text only (no HTML): split on newlines\n\t\t\t\t\t\tconst paragraphs = text\n\t\t\t\t\t\t\t.split('\\n')\n\t\t\t\t\t\t\t.map((line) =>\n\t\t\t\t\t\t\t\tschema.node('paragraph', null, line ? [schema.text(line)] : []),\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\tconst slice = new Slice(Fragment.fromArray(paragraphs), 1, 1);\n\t\t\t\t\t\t_view.dispatch(_view.state.tr.replaceSelection(slice));\n\t\t\t\t\t\treturn true;\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t}),\n\t\t];\n\t},\n});\n"],"names":["BASIC_MARKS","Set","stripRichMarks","fragment","nodes","forEach","node","isText","kept","marks","filter","m","has","type","name","push","length","mark","copy","content","Fragment","from","normalizeBlanks","prevEmpty","childCount","_a","firstChild","create","attrs","isEmpty","isBlock","isLeaf","PlainClipboardExtension","Extension","addProseMirrorPlugins","Plugin","props","handlePaste","_view","event","_b","clipboardData","files","html","_c","getData","text","_d","includes","schema","state","container","document","createElement","innerHTML","parsed","ProseMirrorDOMParser","fromSchema","parseSlice","cleaned","slice","Slice","openStart","openEnd","dispatch","tr","replaceSelection","paragraphs","split","map","line","fromArray"],"mappings":"kMASA,MAAMA,EAAc,IAAIC,IAAI,CAAC,OAAQ,SAAU,SAAU,YAAa,SAOtE,SAASC,EAAeC,GACvB,MAAMC,EAAkB,GASxB,OARAD,EAASE,SAASC,IACjB,GAAIA,EAAKC,OAAQ,CAChB,MAAMC,EAAO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AJA,EAAMK,SAAS,iBAAkB,OAAO,EAE5C,MAAMC,EAASX,EAAMY,MAAMD,OAE3B,GAAIN,EAAM,CAIT,MAAMQ,EAAYC,SAASC,cAAc,OACzCF,EAAUG,UAAYX,EACtB,MAAMY,EACLC,EAAAA,UAAqBC,WAAWR,GAAQS,WAAWP,GAC9CQ,EAAUrC,EAAgBpB,EAAeqD,EAAOpC,UAChDyC,EAAQ,IAAIC,EAAAA,MACjBF,EACAJ,EAAOO,UACPP,EAAOQ,SAGR,OADAzB,EAAM0B,SAAS1B,EAAMY,MAAMe,GAAGC,iBAAiBN,KACxC,CACP,CAGD,MAAMO,EAAarB,EACjBsB,MAAM,MACNC,KAAKC,GACLrB,EAAO3C,KAAK,YAAa,KAAMgE,EAAO,CAACrB,EAAOH,KAAKwB,IAAS,MAExDV,EAAQ,IAAIC,EAAAA,MAAMzC,EAAQA,SAACmD,UAAUJ,GAAa,EAAG,GAE3D,OADA7B,EAAM0B,SAAS1B,EAAMY,MAAMe,GAAGC,iBAAiBN,KACxC,CACR"}
1
+ {"version":3,"file":"PlainClipboardExtension.js","sources":["../../../../../src/editor/extensions/plainClipboard/PlainClipboardExtension.ts"],"sourcesContent":["import { Extension } from '@tiptap/core';\nimport {\n\tFragment,\n\tNode as PMNode,\n\tDOMParser as ProseMirrorDOMParser,\n\tSlice,\n} from '@tiptap/pm/model';\nimport { Plugin } from '@tiptap/pm/state';\n\nconst BASIC_MARKS = new Set(['bold', 'italic', 'strike', 'underline', 'code']);\n\n/**\n * Strip only \"rich\" marks (link, textStyle, highlight, etc.) while keeping\n * basic formatting marks (bold, italic, strike, underline, code) that\n * messaging channels can represent.\n */\nfunction stripRichMarks(fragment: Fragment): Fragment {\n\tconst nodes: PMNode[] = [];\n\tfragment.forEach((node) => {\n\t\tif (node.isText) {\n\t\t\tconst kept = node.marks.filter((m) => BASIC_MARKS.has(m.type.name));\n\t\t\tnodes.push(kept.length === node.marks.length ? node : node.mark(kept));\n\t\t} else {\n\t\t\tnodes.push(node.copy(stripRichMarks(node.content)));\n\t\t}\n\t});\n\treturn Fragment.from(nodes);\n}\n\n/**\n * 1. Convert paragraphs containing only a hard_break into empty paragraphs.\n * (Google Docs: `<p><span style=\"...\"><br></span></p>`)\n * 2. Collapse consecutive empty paragraphs into one.\n * (Google Docs emits both a standalone `<br>` AND a `<p><br></p>` per\n * blank line — ProseMirror wraps the standalone into its own paragraph,\n * doubling each blank line.)\n */\nfunction normalizeBlanks(fragment: Fragment): Fragment {\n\tconst nodes: PMNode[] = [];\n\tlet prevEmpty = false;\n\tfragment.forEach((node) => {\n\t\tconst isHardBreakOnly =\n\t\t\tnode.type.name === 'paragraph' &&\n\t\t\tnode.childCount === 1 &&\n\t\t\tnode.firstChild?.type.name === 'hardBreak';\n\t\tif (isHardBreakOnly) {\n\t\t\tif (!prevEmpty) nodes.push(node.type.create(node.attrs));\n\t\t\tprevEmpty = true;\n\t\t\treturn;\n\t\t}\n\t\tconst isEmpty = node.type.name === 'paragraph' && node.childCount === 0;\n\t\tif (isEmpty && prevEmpty) return;\n\t\tprevEmpty = isEmpty;\n\t\tif (node.isBlock && !node.isLeaf) {\n\t\t\tnodes.push(node.copy(normalizeBlanks(node.content)));\n\t\t} else {\n\t\t\tnodes.push(node);\n\t\t}\n\t});\n\treturn Fragment.from(nodes);\n}\n\nexport const PlainClipboardExtension = Extension.create({\n\tname: 'plainClipboard',\n\taddProseMirrorPlugins() {\n\t\treturn [\n\t\t\tnew Plugin({\n\t\t\t\tprops: {\n\t\t\t\t\thandlePaste(_view, event) {\n\t\t\t\t\t\tif (event.clipboardData?.files?.length) return false; // let ImagePaste handle\n\t\t\t\t\t\tconst html = event.clipboardData?.getData('text/html');\n\t\t\t\t\t\tconst text = event.clipboardData?.getData('text/plain');\n\t\t\t\t\t\tif (!text) return false;\n\n\t\t\t\t\t\t// ProseMirror stamps its own clipboard with data-pm-slice.\n\t\t\t\t\t\t// Let ProseMirror handle its own format natively — it round-trips perfectly.\n\t\t\t\t\t\tif (html?.includes('data-pm-slice')) return false;\n\n\t\t\t\t\t\tconst schema = _view.state.schema;\n\n\t\t\t\t\t\tif (html) {\n\t\t\t\t\t\t\tconsole.log('[PASTE-DEBUG] clipboard html:', html);\n\t\t\t\t\t\t\t// Parse the HTML to get the correct block structure,\n\t\t\t\t\t\t\t// then strip rich marks (links, colors, fonts) while\n\t\t\t\t\t\t\t// keeping basic formatting (bold, italic, strike, etc.)\n\t\t\t\t\t\t\tconst container = document.createElement('div');\n\t\t\t\t\t\t\tcontainer.innerHTML = html;\n\t\t\t\t\t\t\tconst parsed =\n\t\t\t\t\t\t\t\tProseMirrorDOMParser.fromSchema(schema).parseSlice(container);\n\t\t\t\t\t\t\tconsole.log('[PASTE-DEBUG] parsed nodes:');\n\t\t\t\t\t\t\tparsed.content.forEach((n: any, _: any, i: number) => {\n\t\t\t\t\t\t\t\tconst kids: string[] = [];\n\t\t\t\t\t\t\t\tn.forEach?.((c: any) =>\n\t\t\t\t\t\t\t\t\tkids.push(c.type.name + (c.isText ? `=\"${c.text}\"` : '')),\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\tconsole.log(\n\t\t\t\t\t\t\t\t\t` [${i}] ${n.type.name} children=[${kids.join(', ')}]`,\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\tconst cleaned = normalizeBlanks(stripRichMarks(parsed.content));\n\t\t\t\t\t\t\tconsole.log('[PASTE-DEBUG] after normalizeBlanks:');\n\t\t\t\t\t\t\tcleaned.forEach((n: any, _: any, i: number) => {\n\t\t\t\t\t\t\t\tconst kids: string[] = [];\n\t\t\t\t\t\t\t\tn.forEach?.((c: any) =>\n\t\t\t\t\t\t\t\t\tkids.push(c.type.name + (c.isText ? `=\"${c.text}\"` : '')),\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\tconsole.log(\n\t\t\t\t\t\t\t\t\t` [${i}] ${n.type.name} children=[${kids.join(', ')}]`,\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\tconst slice = new Slice(\n\t\t\t\t\t\t\t\tcleaned,\n\t\t\t\t\t\t\t\tparsed.openStart,\n\t\t\t\t\t\t\t\tparsed.openEnd,\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t_view.dispatch(_view.state.tr.replaceSelection(slice));\n\t\t\t\t\t\t\treturn true;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// Plain text only (no HTML): split on newlines\n\t\t\t\t\t\tconst paragraphs = text\n\t\t\t\t\t\t\t.split('\\n')\n\t\t\t\t\t\t\t.map((line) =>\n\t\t\t\t\t\t\t\tschema.node('paragraph', null, line ? [schema.text(line)] : []),\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\tconst slice = new Slice(Fragment.fromArray(paragraphs), 1, 1);\n\t\t\t\t\t\t_view.dispatch(_view.state.tr.replaceSelection(slice));\n\t\t\t\t\t\treturn true;\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t}),\n\t\t];\n\t},\n});\n"],"names":["BASIC_MARKS","Set","stripRichMarks","fragment","nodes","forEach","node","isText","kept","marks","filter","m","has","type","name","push","length","mark","copy","content","Fragment","from","normalizeBlanks","prevEmpty","childCount","_a","firstChild","create","attrs","isEmpty","isBlock","isLeaf","PlainClipboardExtension","Extension","addProseMirrorPlugins","Plugin","props","handlePaste","_view","event","_b","clipboardData","files","html","_c","getData","text","_d","includes","schema","state","console","log","container","document","createElement","innerHTML","parsed","ProseMirrorDOMParser","fromSchema","parseSlice","n","_","i","kids","call","c","join","cleaned","slice","Slice","openStart","openEnd","dispatch","tr","replaceSelection","paragraphs","split","map","line","fromArray"],"mappings":"kMASA,MAAMA,EAAc,IAAIC,IAAI,CAAC,OAAQ,SAAU,SAAU,YAAa,SAOtE,SAASC,EAAeC,GACvB,MAAMC,EAAkB,GASxB,OARAD,EAASE,SAASC,IACjB,GAAIA,EAAKC,OAAQ,CAChB,MAAMC,EAAOF,EAAKG,M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J,GAAa,EAAG,GAE3D,OADAtC,EAAMmC,SAASnC,EAAMY,MAAMwB,GAAGC,iBAAiBN,KACxC,CACR"}
@@ -1,2 +1,2 @@
1
- import{Extension as t}from"../../../node_modules/@tiptap/core/dist/index.js";import{DOMParser as e,Slice as n,Fragment as r}from"@tiptap/pm/model";import{Plugin as a}from"@tiptap/pm/state";const o=new Set(["bold","italic","strike","underline","code"]);function i(t){const e=[];return t.forEach((t=>{if(t.isText){const n=t.marks.filter((t=>o.has(t.type.name)));e.push(n.length===t.marks.length?t:t.mark(n))}else e.push(t.copy(i(t.content)))})),r.from(e)}function l(t){const e=[];let n=!1;return t.forEach((t=>{var r;if("paragraph"===t.type.name&&1===t.childCount&&"hardBreak"===(null===(r=t.firstChild)||void 0===r?void 0:r.type.name))return n||e.push(t.type.create(t.attrs)),void(n=!0);const a="paragraph"===t.type.name&&0===t.childCount;a&&n||(n=a,t.isBlock&&!t.isLeaf?e.push(t.copy(l(t.content))):e.push(t))})),r.from(e)}const p=t.create({name:"plainClipboard",addProseMirrorPlugins:()=>[new a({props:{handlePaste(t,a){var o,p,s,c;if(null===(p=null===(o=a.clipboardData)||void 0===o?void 0:o.files)||void 0===p?void 0:p.length)return!1;const d=null===(s=a.clipboardData)||void 0===s?void 0:s.getData("text/html"),m=null===(c=a.clipboardData)||void 0===c?void 0:c.getData("text/plain");if(!m)return!1;if(null==d?void 0:d.includes("data-pm-slice"))return!1;const u=t.state.schema;if(d){const r=document.createElement("div");r.innerHTML=d;const a=e.fromSchema(u).parseSlice(r),o=l(i(a.content)),p=new n(o,a.openStart,a.openEnd);return t.dispatch(t.state.tr.replaceSelection(p)),!0}const h=m.split("\n").map((t=>u.node("paragraph",null,t?[u.text(t)]:[]))),f=new n(r.fromArray(h),1,1);return t.dispatch(t.state.tr.replaceSelection(f)),!0}}})]});export{p as PlainClipboardExtension};
1
+ import{Extension as t}from"../../../node_modules/@tiptap/core/dist/index.js";import{DOMParser as e,Slice as o,Fragment as n}from"@tiptap/pm/model";import{Plugin as a}from"@tiptap/pm/state";const r=new Set(["bold","italic","strike","underline","code"]);function l(t){const e=[];return t.forEach((t=>{if(t.isText){const o=t.marks.filter((t=>r.has(t.type.name)));e.push(o.length===t.marks.length?t:t.mark(o))}else e.push(t.copy(l(t.content)))})),n.from(e)}function i(t){const e=[];let o=!1;return t.forEach((t=>{var n;if("paragraph"===t.type.name&&1===t.childCount&&"hardBreak"===(null===(n=t.firstChild)||void 0===n?void 0:n.type.name))return o||e.push(t.type.create(t.attrs)),void(o=!0);const a="paragraph"===t.type.name&&0===t.childCount;a&&o||(o=a,t.isBlock&&!t.isLeaf?e.push(t.copy(i(t.content))):e.push(t))})),n.from(e)}const c=t.create({name:"plainClipboard",addProseMirrorPlugins:()=>[new a({props:{handlePaste(t,a){var r,c,s,p;if(null===(c=null===(r=a.clipboardData)||void 0===r?void 0:r.files)||void 0===c?void 0:c.length)return!1;const d=null===(s=a.clipboardData)||void 0===s?void 0:s.getData("text/html"),m=null===(p=a.clipboardData)||void 0===p?void 0:p.getData("text/plain");if(!m)return!1;if(null==d?void 0:d.includes("data-pm-slice"))return!1;const h=t.state.schema;if(d){console.log("[PASTE-DEBUG] clipboard html:",d);const n=document.createElement("div");n.innerHTML=d;const a=e.fromSchema(h).parseSlice(n);console.log("[PASTE-DEBUG] parsed nodes:"),a.content.forEach(((t,e,o)=>{var n;const a=[];null===(n=t.forEach)||void 0===n||n.call(t,(t=>a.push(t.type.name+(t.isText?`="${t.text}"`:"")))),console.log(` [${o}] ${t.type.name} children=[${a.join(", ")}]`)}));const r=i(l(a.content));console.log("[PASTE-DEBUG] after normalizeBlanks:"),r.forEach(((t,e,o)=>{var n;const a=[];null===(n=t.forEach)||void 0===n||n.call(t,(t=>a.push(t.type.name+(t.isText?`="${t.text}"`:"")))),console.log(` [${o}] ${t.type.name} children=[${a.join(", ")}]`)}));const c=new o(r,a.openStart,a.openEnd);return t.dispatch(t.state.tr.replaceSelection(c)),!0}const u=m.split("\n").map((t=>h.node("paragraph",null,t?[h.text(t)]:[]))),f=new o(n.fromArray(u),1,1);return t.dispatch(t.state.tr.replaceSelection(f)),!0}}})]});export{c as PlainClipboardExtension};
2
2
  //# sourceMappingURL=PlainClipboardExtension.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"PlainClipboardExtension.js","sources":["../../../../../src/editor/extensions/plainClipboard/PlainClipboardExtension.ts"],"sourcesContent":["import { Extension } from '@tiptap/core';\nimport {\n\tFragment,\n\tNode as PMNode,\n\tDOMParser as ProseMirrorDOMParser,\n\tSlice,\n} from '@tiptap/pm/model';\nimport { Plugin } from '@tiptap/pm/state';\n\nconst BASIC_MARKS = new Set(['bold', 'italic', 'strike', 'underline', 'code']);\n\n/**\n * Strip only \"rich\" marks (link, textStyle, highlight, etc.) while keeping\n * basic formatting marks (bold, italic, strike, underline, code) that\n * messaging channels can represent.\n */\nfunction stripRichMarks(fragment: Fragment): Fragment {\n\tconst nodes: PMNode[] = [];\n\tfragment.forEach((node) => {\n\t\tif (node.isText) {\n\t\t\tconst kept = node.marks.filter((m) => BASIC_MARKS.has(m.type.name));\n\t\t\tnodes.push(kept.length === node.marks.length ? node : node.mark(kept));\n\t\t} else {\n\t\t\tnodes.push(node.copy(stripRichMarks(node.content)));\n\t\t}\n\t});\n\treturn Fragment.from(nodes);\n}\n\n/**\n * 1. Convert paragraphs containing only a hard_break into empty paragraphs.\n * (Google Docs: `<p><span style=\"...\"><br></span></p>`)\n * 2. Collapse consecutive empty paragraphs into one.\n * (Google Docs emits both a standalone `<br>` AND a `<p><br></p>` per\n * blank line — ProseMirror wraps the standalone into its own paragraph,\n * doubling each blank line.)\n */\nfunction normalizeBlanks(fragment: Fragment): Fragment {\n\tconst nodes: PMNode[] = [];\n\tlet prevEmpty = false;\n\tfragment.forEach((node) => {\n\t\tconst isHardBreakOnly =\n\t\t\tnode.type.name === 'paragraph' &&\n\t\t\tnode.childCount === 1 &&\n\t\t\tnode.firstChild?.type.name === 'hardBreak';\n\t\tif (isHardBreakOnly) {\n\t\t\tif (!prevEmpty) nodes.push(node.type.create(node.attrs));\n\t\t\tprevEmpty = true;\n\t\t\treturn;\n\t\t}\n\t\tconst isEmpty = node.type.name === 'paragraph' && node.childCount === 0;\n\t\tif (isEmpty && prevEmpty) return;\n\t\tprevEmpty = isEmpty;\n\t\tif (node.isBlock && !node.isLeaf) {\n\t\t\tnodes.push(node.copy(normalizeBlanks(node.content)));\n\t\t} else {\n\t\t\tnodes.push(node);\n\t\t}\n\t});\n\treturn Fragment.from(nodes);\n}\n\nexport const PlainClipboardExtension = Extension.create({\n\tname: 'plainClipboard',\n\taddProseMirrorPlugins() {\n\t\treturn [\n\t\t\tnew Plugin({\n\t\t\t\tprops: {\n\t\t\t\t\thandlePaste(_view, event) {\n\t\t\t\t\t\tif (event.clipboardData?.files?.length) return false; // let ImagePaste handle\n\t\t\t\t\t\tconst html = event.clipboardData?.getData('text/html');\n\t\t\t\t\t\tconst text = event.clipboardData?.getData('text/plain');\n\t\t\t\t\t\tif (!text) return false;\n\n\t\t\t\t\t\t// ProseMirror stamps its own clipboard with data-pm-slice.\n\t\t\t\t\t\t// Let ProseMirror handle its own format natively — it round-trips perfectly.\n\t\t\t\t\t\tif (html?.includes('data-pm-slice')) return false;\n\n\t\t\t\t\t\tconst schema = _view.state.schema;\n\n\t\t\t\t\t\tif (html) {\n\t\t\t\t\t\t\t// Parse the HTML to get the correct block structure,\n\t\t\t\t\t\t\t// then strip rich marks (links, colors, fonts) while\n\t\t\t\t\t\t\t// keeping basic formatting (bold, italic, strike, etc.)\n\t\t\t\t\t\t\tconst container = document.createElement('div');\n\t\t\t\t\t\t\tcontainer.innerHTML = html;\n\t\t\t\t\t\t\tconst parsed =\n\t\t\t\t\t\t\t\tProseMirrorDOMParser.fromSchema(schema).parseSlice(container);\n\t\t\t\t\t\t\tconst cleaned = normalizeBlanks(stripRichMarks(parsed.content));\n\t\t\t\t\t\t\tconst slice = new Slice(\n\t\t\t\t\t\t\t\tcleaned,\n\t\t\t\t\t\t\t\tparsed.openStart,\n\t\t\t\t\t\t\t\tparsed.openEnd,\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t_view.dispatch(_view.state.tr.replaceSelection(slice));\n\t\t\t\t\t\t\treturn true;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// Plain text only (no HTML): split on newlines\n\t\t\t\t\t\tconst paragraphs = text\n\t\t\t\t\t\t\t.split('\\n')\n\t\t\t\t\t\t\t.map((line) =>\n\t\t\t\t\t\t\t\tschema.node('paragraph', null, line ? [schema.text(line)] : []),\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\tconst slice = new Slice(Fragment.fromArray(paragraphs), 1, 1);\n\t\t\t\t\t\t_view.dispatch(_view.state.tr.replaceSelection(slice));\n\t\t\t\t\t\treturn true;\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t}),\n\t\t];\n\t},\n});\n"],"names":["BASIC_MARKS","Set","stripRichMarks","fragment","nodes","forEach","node","isText","kept","marks","filter","m","has","type","name","push","length","mark","copy","content","Fragment","from","normalizeBlanks","prevEmpty","childCount","_a","firstChild","create","attrs","isEmpty","isBlock","isLeaf","PlainClipboardExtension","Extension","addProseMirrorPlugins","Plugin","props","handlePaste","_view","event","_b","clipboardData","files","html","_c","getData","text","_d","includes","schema","state","container","document","createElement","innerHTML","parsed","ProseMirrorDOMParser","fromSchema","parseSlice","cleaned","slice","Slice","openStart","openEnd","dispatch","tr","replaceSelection","paragraphs","split","map","line","fromArray"],"mappings":"6LASA,MAAMA,EAAc,IAAIC,IAAI,CAAC,OAAQ,SAAU,SAAU,YAAa,SAOtE,SAASC,EAAeC,GACvB,MAAMC,EAAkB,GASxB,OARAD,EAASE,SAASC,IACjB,GAAIA,EAAKC,OAAQ,CAChB,MAAMC,EAAOF,EAAKG,MAAMC,QAAQC,GAAMX,EAAYY,IAAID,EAAEE,KAAKC,QAC7DV,EAAMW,KAAKP,EAAKQ,SAAWV,EAAKG,MAAMO,OAASV,EAAOA,E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MY,EACLC,EAAqBC,WAAWR,GAAQS,WAAWP,GAC9CQ,EAAUrC,EAAgBpB,EAAeqD,EAAOpC,UAChDyC,EAAQ,IAAIC,EACjBF,EACAJ,EAAOO,UACPP,EAAOQ,SAGR,OADAzB,EAAM0B,SAAS1B,EAAMY,MAAMe,GAAGC,iBAAiBN,KACxC,CACP,CAGD,MAAMO,EAAarB,EACjBsB,MAAM,MACNC,KAAKC,GACLrB,EAAO3C,KAAK,YAAa,KAAMgE,EAAO,CAACrB,EAAOH,KAAKwB,IAAS,MAExDV,EAAQ,IAAIC,EAAMzC,EAASmD,UAAUJ,GAAa,EAAG,GAE3D,OADA7B,EAAM0B,SAAS1B,EAAMY,MAAMe,GAAGC,iBAAiBN,KACxC,CACR"}
1
+ {"version":3,"file":"PlainClipboardExtension.js","sources":["../../../../../src/editor/extensions/plainClipboard/PlainClipboardExtension.ts"],"sourcesContent":["import { Extension } from '@tiptap/core';\nimport {\n\tFragment,\n\tNode as PMNode,\n\tDOMParser as ProseMirrorDOMParser,\n\tSlice,\n} from '@tiptap/pm/model';\nimport { Plugin } from '@tiptap/pm/state';\n\nconst BASIC_MARKS = new Set(['bold', 'italic', 'strike', 'underline', 'code']);\n\n/**\n * Strip only \"rich\" marks (link, textStyle, highlight, etc.) while keeping\n * basic formatting marks (bold, italic, strike, underline, code) that\n * messaging channels can represent.\n */\nfunction stripRichMarks(fragment: Fragment): Fragment {\n\tconst nodes: PMNode[] = [];\n\tfragment.forEach((node) => {\n\t\tif (node.isText) {\n\t\t\tconst kept = node.marks.filter((m) => BASIC_MARKS.has(m.type.name));\n\t\t\tnodes.push(kept.length === node.marks.length ? node : node.mark(kept));\n\t\t} else {\n\t\t\tnodes.push(node.copy(stripRichMarks(node.content)));\n\t\t}\n\t});\n\treturn Fragment.from(nodes);\n}\n\n/**\n * 1. Convert paragraphs containing only a hard_break into empty paragraphs.\n * (Google Docs: `<p><span style=\"...\"><br></span></p>`)\n * 2. Collapse consecutive empty paragraphs into one.\n * (Google Docs emits both a standalone `<br>` AND a `<p><br></p>` per\n * blank line — ProseMirror wraps the standalone into its own paragraph,\n * doubling each blank line.)\n */\nfunction normalizeBlanks(fragment: Fragment): Fragment {\n\tconst nodes: PMNode[] = [];\n\tlet prevEmpty = false;\n\tfragment.forEach((node) => {\n\t\tconst isHardBreakOnly =\n\t\t\tnode.type.name === 'paragraph' &&\n\t\t\tnode.childCount === 1 &&\n\t\t\tnode.firstChild?.type.name === 'hardBreak';\n\t\tif (isHardBreakOnly) {\n\t\t\tif (!prevEmpty) nodes.push(node.type.create(node.attrs));\n\t\t\tprevEmpty = true;\n\t\t\treturn;\n\t\t}\n\t\tconst isEmpty = node.type.name === 'paragraph' && node.childCount === 0;\n\t\tif (isEmpty && prevEmpty) return;\n\t\tprevEmpty = isEmpty;\n\t\tif (node.isBlock && !node.isLeaf) {\n\t\t\tnodes.push(node.copy(normalizeBlanks(node.content)));\n\t\t} else {\n\t\t\tnodes.push(node);\n\t\t}\n\t});\n\treturn Fragment.from(nodes);\n}\n\nexport const PlainClipboardExtension = Extension.create({\n\tname: 'plainClipboard',\n\taddProseMirrorPlugins() {\n\t\treturn [\n\t\t\tnew Plugin({\n\t\t\t\tprops: {\n\t\t\t\t\thandlePaste(_view, event) {\n\t\t\t\t\t\tif (event.clipboardData?.files?.length) return false; // let ImagePaste handle\n\t\t\t\t\t\tconst html = event.clipboardData?.getData('text/html');\n\t\t\t\t\t\tconst text = event.clipboardData?.getData('text/plain');\n\t\t\t\t\t\tif (!text) return false;\n\n\t\t\t\t\t\t// ProseMirror stamps its own clipboard with data-pm-slice.\n\t\t\t\t\t\t// Let ProseMirror handle its own format natively — it round-trips perfectly.\n\t\t\t\t\t\tif (html?.includes('data-pm-slice')) return false;\n\n\t\t\t\t\t\tconst schema = _view.state.schema;\n\n\t\t\t\t\t\tif (html) {\n\t\t\t\t\t\t\tconsole.log('[PASTE-DEBUG] clipboard html:', html);\n\t\t\t\t\t\t\t// Parse the HTML to get the correct block structure,\n\t\t\t\t\t\t\t// then strip rich marks (links, colors, fonts) while\n\t\t\t\t\t\t\t// keeping basic formatting (bold, italic, strike, etc.)\n\t\t\t\t\t\t\tconst container = document.createElement('div');\n\t\t\t\t\t\t\tcontainer.innerHTML = html;\n\t\t\t\t\t\t\tconst parsed =\n\t\t\t\t\t\t\t\tProseMirrorDOMParser.fromSchema(schema).parseSlice(container);\n\t\t\t\t\t\t\tconsole.log('[PASTE-DEBUG] parsed nodes:');\n\t\t\t\t\t\t\tparsed.content.forEach((n: any, _: any, i: number) => {\n\t\t\t\t\t\t\t\tconst kids: string[] = [];\n\t\t\t\t\t\t\t\tn.forEach?.((c: any) =>\n\t\t\t\t\t\t\t\t\tkids.push(c.type.name + (c.isText ? `=\"${c.text}\"` : '')),\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\tconsole.log(\n\t\t\t\t\t\t\t\t\t` [${i}] ${n.type.name} children=[${kids.join(', ')}]`,\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\tconst cleaned = normalizeBlanks(stripRichMarks(parsed.content));\n\t\t\t\t\t\t\tconsole.log('[PASTE-DEBUG] after normalizeBlanks:');\n\t\t\t\t\t\t\tcleaned.forEach((n: any, _: any, i: number) => {\n\t\t\t\t\t\t\t\tconst kids: string[] = [];\n\t\t\t\t\t\t\t\tn.forEach?.((c: any) =>\n\t\t\t\t\t\t\t\t\tkids.push(c.type.name + (c.isText ? `=\"${c.text}\"` : '')),\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\tconsole.log(\n\t\t\t\t\t\t\t\t\t` [${i}] ${n.type.name} children=[${kids.join(', ')}]`,\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\tconst slice = new Slice(\n\t\t\t\t\t\t\t\tcleaned,\n\t\t\t\t\t\t\t\tparsed.openStart,\n\t\t\t\t\t\t\t\tparsed.openEnd,\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t_view.dispatch(_view.state.tr.replaceSelection(slice));\n\t\t\t\t\t\t\treturn true;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// Plain text only (no HTML): split on newlines\n\t\t\t\t\t\tconst paragraphs = text\n\t\t\t\t\t\t\t.split('\\n')\n\t\t\t\t\t\t\t.map((line) =>\n\t\t\t\t\t\t\t\tschema.node('paragraph', null, line ? [schema.text(line)] : []),\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\tconst slice = new Slice(Fragment.fromArray(paragraphs), 1, 1);\n\t\t\t\t\t\t_view.dispatch(_view.state.tr.replaceSelection(slice));\n\t\t\t\t\t\treturn true;\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t}),\n\t\t];\n\t},\n});\n"],"names":["BASIC_MARKS","Set","stripRichMarks","fragment","nodes","forEach","node","isText","kept","marks","filter","m","has","type","name","push","length","mark","copy","content","Fragment","from","normalizeBlanks","prevEmpty","childCount","_a","firstChild","create","attrs","isEmpty","isBlock","isLeaf","PlainClipboardExtension","Extension","addProseMirrorPlugins","Plugin","props","handlePaste","_view","event","_b","clipboardData","files","html","_c","getData","text","_d","includes","schema","state","console","log","container","document","createElement","innerHTML","parsed","ProseMirrorDOMParser","fromSchema","parseSlice","n","_","i","kids","call","c","join","cleaned","slice","Slice","openStart","openEnd","dispatch","tr","replaceSelection","paragraphs","split","map","line","fromArray"],"mappings":"6LASA,MAAMA,EAAc,IAAIC,IAAI,CAAC,OAAQ,SAAU,SAAU,YAAa,SAOtE,SAASC,EAAeC,GACvB,MAAMC,EAAkB,GASxB,OARAD,EAASE,SAASC,IACjB,GAAIA,EAAKC,OAAQ,CAChB,MAAMC,EAAOF,EAAKG,MAAMC,QAAQC,GAAMX,EAAYY,IAAID,EAAEE,KAAKC,QAC7DV,EAAMW,KAAKP,EAAKQ,SAAWV,EAAKG,MAAMO,OAASV,EAAOA,EAAKW,KAAKT,GAChE,MACAJ,EAAMW,KAAKT,EAAKY,KAAKhB,EAAeI,EA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WP,GACpDF,QAAQC,IAAI,+BACZK,EAAOtC,QAAQd,SAAQ,CAACwD,EAAQC,EAAQC,WACvC,MAAMC,EAAiB,GACX,QAAZvC,EAAAoC,EAAExD,eAAU,IAAAoB,GAAAA,EAAAwC,KAAAJ,GAACK,GACZF,EAAKjD,KAAKmD,EAAErD,KAAKC,MAAQoD,EAAE3D,YAAc2D,EAAEpB,QAAU,OAEtDK,QAAQC,IACP,MAAMW,MAAMF,EAAEhD,KAAKC,kBAAkBkD,EAAKG,KAAK,SAC/C,IAEF,MAAMC,EAAU9C,EAAgBpB,EAAeuD,EAAOtC,UACtDgC,QAAQC,IAAI,wCACZgB,EAAQ/D,SAAQ,CAACwD,EAAQC,EAAQC,WAChC,MAAMC,EAAiB,GACX,QAAZvC,EAAAoC,EAAExD,eAAU,IAAAoB,GAAAA,EAAAwC,KAAAJ,GAACK,GACZF,EAAKjD,KAAKmD,EAAErD,KAAKC,MAAQoD,EAAE3D,YAAc2D,EAAEpB,QAAU,OAEtDK,QAAQC,IACP,MAAMW,MAAMF,EAAEhD,KAAKC,kBAAkBkD,EAAKG,KAAK,SAC/C,IAEF,MAAME,EAAQ,IAAIC,EACjBF,EACAX,EAAOc,UACPd,EAAOe,SAGR,OADAlC,EAAMmC,SAASnC,EAAMY,MAAMwB,GAAGC,iBAAiBN,KACxC,CACP,CAGD,MAAMO,EAAa9B,EACjB+B,MAAM,MACNC,KAAKC,GACL9B,EAAO3C,KAAK,YAAa,KAAMyE,EAAO,CAAC9B,EAAOH,KAAKiC,IAAS,MAExDV,EAAQ,IAAIC,EAAMlD,EAAS4D,UAAUJ,GAAa,EAAG,GAE3D,OADAtC,EAAMmC,SAASnC,EAAMY,MAAMwB,GAAGC,iBAAiBN,KACxC,CACR"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bikdotai/bik-component-library",
3
- "version": "0.0.806-beta.8",
3
+ "version": "0.0.806-beta.9",
4
4
  "description": "Bik Component Library",
5
5
  "repository": {
6
6
  "type": "git",