@bikdotai/bik-component-library 0.0.806 → 0.0.807-beta.1
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/cjs/components/feature-announcements/FeatureAnnouncementProvider.js.map +1 -1
- package/dist/cjs/editor/BikEditor.styles.js +8 -2
- package/dist/cjs/editor/BikEditor.styles.js.map +1 -1
- package/dist/cjs/editor/BikEditor.utils.js +1 -1
- package/dist/cjs/editor/BikEditor.utils.js.map +1 -1
- package/dist/cjs/editor/extensions/buildExtensions.js +1 -1
- package/dist/cjs/editor/extensions/buildExtensions.js.map +1 -1
- package/dist/cjs/editor/extensions/mention/MentionExtension.js +1 -1
- package/dist/cjs/editor/extensions/mention/MentionExtension.js.map +1 -1
- package/dist/cjs/editor/extensions/plainClipboard/ClipboardNormalizationExtension.js +2 -0
- package/dist/cjs/editor/extensions/plainClipboard/ClipboardNormalizationExtension.js.map +1 -0
- package/dist/cjs/editor/extensions/plainClipboard/PlainClipboardExtension.js +1 -1
- package/dist/cjs/editor/extensions/plainClipboard/PlainClipboardExtension.js.map +1 -1
- package/dist/cjs/editor/extensions/plainClipboard/pasteUtils.js +2 -0
- package/dist/cjs/editor/extensions/plainClipboard/pasteUtils.js.map +1 -0
- package/dist/cjs/editor/extensions/slashCommand/SlashCommandExtension.js +1 -1
- package/dist/cjs/editor/extensions/slashCommand/SlashCommandExtension.js.map +1 -1
- package/dist/cjs/editor/serializers/toLiveChatText.js +1 -1
- package/dist/cjs/editor/serializers/toLiveChatText.js.map +1 -1
- package/dist/cjs/editor/serializers/toWhatsAppText.js +1 -1
- package/dist/cjs/editor/serializers/toWhatsAppText.js.map +1 -1
- package/dist/cjs/src/components/QueryBuilder/Triggers/EVENTS/components/EventsTrigger.d.ts +1 -1
- package/dist/cjs/src/components/QueryBuilder/Triggers/EVENTS/selectors/useIGTriggerNameCacheSelector.d.ts +1 -1
- package/dist/cjs/src/components/QueryBuilder/Triggers/IG/components/IGTrigger.d.ts +1 -1
- package/dist/cjs/src/components/QueryBuilder/Triggers/IG/selectors/useIGTriggerNameCacheSelector.d.ts +1 -1
- package/dist/cjs/src/components/QueryBuilder/Triggers/components/BaseTriggerQueryBuilderNode.d.ts +2 -2
- package/dist/cjs/src/components/bik-layout/MockMenus.d.ts +1 -0
- package/dist/cjs/src/editor/BikEditor.utils.d.ts +15 -10
- package/dist/cjs/src/editor/extensions/plainClipboard/ClipboardNormalizationExtension.d.ts +7 -0
- package/dist/cjs/src/editor/extensions/plainClipboard/pasteUtils.d.ts +21 -0
- package/dist/cjs/src/editor/serializers/toWhatsAppText.d.ts +2 -2
- package/dist/esm/components/feature-announcements/FeatureAnnouncementProvider.js.map +1 -1
- package/dist/esm/editor/BikEditor.styles.js +6 -0
- package/dist/esm/editor/BikEditor.styles.js.map +1 -1
- package/dist/esm/editor/BikEditor.utils.js +1 -1
- package/dist/esm/editor/BikEditor.utils.js.map +1 -1
- package/dist/esm/editor/extensions/buildExtensions.js +1 -1
- package/dist/esm/editor/extensions/buildExtensions.js.map +1 -1
- package/dist/esm/editor/extensions/mention/MentionExtension.js +1 -1
- package/dist/esm/editor/extensions/mention/MentionExtension.js.map +1 -1
- package/dist/esm/editor/extensions/plainClipboard/ClipboardNormalizationExtension.js +2 -0
- package/dist/esm/editor/extensions/plainClipboard/ClipboardNormalizationExtension.js.map +1 -0
- package/dist/esm/editor/extensions/plainClipboard/PlainClipboardExtension.js +1 -1
- package/dist/esm/editor/extensions/plainClipboard/PlainClipboardExtension.js.map +1 -1
- package/dist/esm/editor/extensions/plainClipboard/pasteUtils.js +2 -0
- package/dist/esm/editor/extensions/plainClipboard/pasteUtils.js.map +1 -0
- package/dist/esm/editor/extensions/slashCommand/SlashCommandExtension.js +1 -1
- package/dist/esm/editor/extensions/slashCommand/SlashCommandExtension.js.map +1 -1
- package/dist/esm/editor/serializers/toLiveChatText.js +1 -1
- package/dist/esm/editor/serializers/toLiveChatText.js.map +1 -1
- package/dist/esm/editor/serializers/toWhatsAppText.js +1 -1
- package/dist/esm/editor/serializers/toWhatsAppText.js.map +1 -1
- package/dist/esm/src/components/QueryBuilder/Triggers/EVENTS/components/EventsTrigger.d.ts +1 -1
- package/dist/esm/src/components/QueryBuilder/Triggers/EVENTS/selectors/useIGTriggerNameCacheSelector.d.ts +1 -1
- package/dist/esm/src/components/QueryBuilder/Triggers/IG/components/IGTrigger.d.ts +1 -1
- package/dist/esm/src/components/QueryBuilder/Triggers/IG/selectors/useIGTriggerNameCacheSelector.d.ts +1 -1
- package/dist/esm/src/components/QueryBuilder/Triggers/components/BaseTriggerQueryBuilderNode.d.ts +2 -2
- package/dist/esm/src/components/bik-layout/MockMenus.d.ts +1 -0
- package/dist/esm/src/editor/BikEditor.utils.d.ts +15 -10
- package/dist/esm/src/editor/extensions/plainClipboard/ClipboardNormalizationExtension.d.ts +7 -0
- package/dist/esm/src/editor/extensions/plainClipboard/pasteUtils.d.ts +21 -0
- package/dist/esm/src/editor/serializers/toWhatsAppText.d.ts +2 -2
- package/package.json +1 -1
|
@@ -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/extension-mention"),n=require("@tiptap/react"),r=require("../suggestionPopup.js"),o=require("./MentionDropdown.js");function i(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var s=i(t);function a(e){let t=arguments.length>2?arguments[2]:void 0,i=arguments.length>3?arguments[3]:void 0;return()=>{let e,s;return{onStart:a=>{e=new n.ReactRenderer(o.MentionDropdown,{props:Object.assign(Object.assign({},a),{renderItem:t,renderDropdown:i}),editor:a.editor}),s=r.createSuggestionPopup(e.element,a.clientRect)},onUpdate:n=>{var r;e.updateProps(Object.assign(Object.assign({},n),{renderItem:t,renderDropdown:i})),(null===(r=n.items)||void 0===r?void 0:r.length)?(s.show(),s.updatePosition(n.clientRect)):s.hide()},onKeyDown:t=>{var n,r;return"Escape"===t.event.key?(s.hide(),!0):null!==(r=null===(n=e.ref)||void 0===n?void 0:n.onKeyDown(t))&&void 0!==r&&r},onExit:()=>{s.destroy(),e.destroy()}}}}exports.buildAgentMentionExtension=function(t,n,r,o){return s.default.extend({name:"mentionAgent"}).configure({HTMLAttributes:{class:"bik-mention bik-mention--agent"},renderText:e=>{let{options:t,node:n}=e;return`${t.suggestion.char}${n.attrs.label}`},renderHTML:t=>{let{options:n,node:r}=t;return["span",e.mergeAttributes(n.HTMLAttributes),`${n.suggestion.char}${r.attrs.label}`]},suggestion:{char:"@",items:e=>{let{query:n}=e;return t.current.filter((e=>e.label.toLowerCase().includes(n.toLowerCase())))},command:e=>{let{editor:t,range:r,props:o}=e;t.chain().focus().deleteRange(r).insertContent({type:"mentionAgent",attrs:{id:o.id,label:o.label}}).run(),null==n||n(o,"@")},render:a(n,"@",r,o)}})},exports.buildTeamMentionExtension=function(t,n,r,o){return s.default.extend({name:"mentionTeam"}).configure({HTMLAttributes:{class:"bik-mention bik-mention--team"},renderText:e=>{let{options:t,node:n}=e;return`${t.suggestion.char}${n.attrs.label}`},renderHTML:t=>{let{options:n,node:r}=t;return["span",e.mergeAttributes(n.HTMLAttributes),`${n.suggestion.char}${r.attrs.label}`]},suggestion:{char:"#",items:e=>{let{query:n}=e;return t.current.filter((e=>e.label.toLowerCase().includes(n.toLowerCase())))},command:e=>{let{editor:t,range:r,props:o}=e;t.chain().focus().deleteRange(r).insertContent({type:"mentionTeam",attrs:{id:o.id,label:o.label}}).run(),null==n||n(o,"#")},render:a(n,"#",r,o)}})};
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../../node_modules/@tiptap/core/dist/index.js"),t=require("@tiptap/extension-mention"),n=require("@tiptap/react"),r=require("../suggestionPopup.js"),o=require("./MentionDropdown.js");function i(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var s=i(t);function a(e){let t=arguments.length>2?arguments[2]:void 0,i=arguments.length>3?arguments[3]:void 0;return()=>{let e,s;return{onStart:a=>{e=new n.ReactRenderer(o.MentionDropdown,{props:Object.assign(Object.assign({},a),{renderItem:t,renderDropdown:i}),editor:a.editor}),s=r.createSuggestionPopup(e.element,a.clientRect)},onUpdate:n=>{var r;e.updateProps(Object.assign(Object.assign({},n),{renderItem:t,renderDropdown:i})),(null===(r=n.items)||void 0===r?void 0:r.length)?(s.show(),s.updatePosition(n.clientRect)):s.hide()},onKeyDown:t=>{var n,r;return"Escape"===t.event.key?(s.hide(),!0):null!==(r=null===(n=e.ref)||void 0===n?void 0:n.onKeyDown(t))&&void 0!==r&&r},onExit:()=>{s.destroy(),e.destroy()}}}}exports.buildAgentMentionExtension=function(t,n,r,o){return s.default.extend({name:"mentionAgent"}).configure({HTMLAttributes:{class:"bik-mention bik-mention--agent"},renderText:e=>{let{options:t,node:n}=e;return`${t.suggestion.char}${n.attrs.label}`},renderHTML:t=>{let{options:n,node:r}=t;return["span",e.mergeAttributes(n.HTMLAttributes),`${n.suggestion.char}${r.attrs.label}`]},suggestion:{char:"@",allowSpaces:!0,items:e=>{let{query:n}=e;return t.current.filter((e=>e.label.toLowerCase().includes(n.toLowerCase())))},command:e=>{let{editor:t,range:r,props:o}=e;t.chain().focus().deleteRange(r).insertContent({type:"mentionAgent",attrs:{id:o.id,label:o.label}}).run(),null==n||n(o,"@")},render:a(n,"@",r,o)}})},exports.buildTeamMentionExtension=function(t,n,r,o){return s.default.extend({name:"mentionTeam"}).configure({HTMLAttributes:{class:"bik-mention bik-mention--team"},renderText:e=>{let{options:t,node:n}=e;return`${t.suggestion.char}${n.attrs.label}`},renderHTML:t=>{let{options:n,node:r}=t;return["span",e.mergeAttributes(n.HTMLAttributes),`${n.suggestion.char}${r.attrs.label}`]},suggestion:{char:"#",allowSpaces:!0,items:e=>{let{query:n}=e;return t.current.filter((e=>e.label.toLowerCase().includes(n.toLowerCase())))},command:e=>{let{editor:t,range:r,props:o}=e;t.chain().focus().deleteRange(r).insertContent({type:"mentionTeam",attrs:{id:o.id,label:o.label}}).run(),null==n||n(o,"#")},render:a(n,"#",r,o)}})};
|
|
2
2
|
//# sourceMappingURL=MentionExtension.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MentionExtension.js","sources":["../../../../../src/editor/extensions/mention/MentionExtension.ts"],"sourcesContent":["import { mergeAttributes } from '@tiptap/core';\nimport Mention from '@tiptap/extension-mention';\nimport { ReactRenderer } from '@tiptap/react';\nimport type { ReactNode } from 'react';\nimport type {\n\tMentionDropdownRenderProps,\n\tMentionItem,\n} from '../../BikEditor.types';\nimport {\n\tcreateSuggestionPopup,\n\ttype SuggestionPopup,\n} from '../suggestionPopup';\nimport { MentionDropdown } from './MentionDropdown';\n\nfunction buildRender(\n\tonSelect?: (item: MentionItem, char: '@' | '#') => void,\n\tchar: '@' | '#' = '@',\n\trenderItem?: (item: MentionItem, isActive: boolean) => ReactNode,\n\trenderDropdown?: (props: MentionDropdownRenderProps) => ReactNode,\n) {\n\treturn () => {\n\t\tlet component: ReactRenderer;\n\t\tlet popup: SuggestionPopup;\n\n\t\treturn {\n\t\t\tonStart: (props: any) => {\n\t\t\t\tcomponent = new ReactRenderer(MentionDropdown, {\n\t\t\t\t\tprops: { ...props, renderItem, renderDropdown },\n\t\t\t\t\teditor: props.editor,\n\t\t\t\t});\n\t\t\t\tpopup = createSuggestionPopup(component.element, props.clientRect);\n\t\t\t},\n\t\t\tonUpdate: (props: any) => {\n\t\t\t\tcomponent.updateProps({ ...props, renderItem, renderDropdown });\n\t\t\t\tif (!props.items?.length) {\n\t\t\t\t\tpopup.hide();\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tpopup.show();\n\t\t\t\tpopup.updatePosition(props.clientRect);\n\t\t\t},\n\t\t\tonKeyDown: (props: any) => {\n\t\t\t\tif (props.event.key === 'Escape') {\n\t\t\t\t\tpopup.hide();\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t\treturn (component.ref as any)?.onKeyDown(props) ?? false;\n\t\t\t},\n\t\t\tonExit: () => {\n\t\t\t\tpopup.destroy();\n\t\t\t\tcomponent.destroy();\n\t\t\t},\n\t\t};\n\t};\n}\n\nexport function buildAgentMentionExtension(\n\tagentsRef: { current: MentionItem[] },\n\tonSelect?: (item: MentionItem, char: '@' | '#') => void,\n\trenderItem?: (item: MentionItem, isActive: boolean) => ReactNode,\n\trenderDropdown?: (props: MentionDropdownRenderProps) => ReactNode,\n) {\n\treturn Mention.extend({ name: 'mentionAgent' }).configure({\n\t\tHTMLAttributes: { class: 'bik-mention bik-mention--agent' },\n\t\trenderText: ({ options, node }) =>\n\t\t\t`${options.suggestion.char}${node.attrs['label']}`,\n\t\trenderHTML: ({ options, node }) => [\n\t\t\t'span',\n\t\t\tmergeAttributes(options.HTMLAttributes),\n\t\t\t`${options.suggestion.char}${node.attrs['label']}`,\n\t\t],\n\t\tsuggestion: {\n\t\t\tchar: '@',\n\t\t\titems: ({ query }: { query: string }) =>\n\t\t\t\tagentsRef.current.filter((a) =>\n\t\t\t\t\ta.label.toLowerCase().includes(query.toLowerCase()),\n\t\t\t\t),\n\t\t\tcommand: ({ editor, range, props }: any) => {\n\t\t\t\teditor\n\t\t\t\t\t.chain()\n\t\t\t\t\t.focus()\n\t\t\t\t\t.deleteRange(range)\n\t\t\t\t\t.insertContent({\n\t\t\t\t\t\ttype: 'mentionAgent',\n\t\t\t\t\t\tattrs: { id: props.id, label: props.label },\n\t\t\t\t\t})\n\t\t\t\t\t.run();\n\t\t\t\tonSelect?.(props, '@');\n\t\t\t},\n\t\t\trender: buildRender(onSelect, '@', renderItem, renderDropdown),\n\t\t},\n\t});\n}\n\nexport function buildTeamMentionExtension(\n\tteamsRef: { current: MentionItem[] },\n\tonSelect?: (item: MentionItem, char: '@' | '#') => void,\n\trenderItem?: (item: MentionItem, isActive: boolean) => ReactNode,\n\trenderDropdown?: (props: MentionDropdownRenderProps) => ReactNode,\n) {\n\treturn Mention.extend({ name: 'mentionTeam' }).configure({\n\t\tHTMLAttributes: { class: 'bik-mention bik-mention--team' },\n\t\trenderText: ({ options, node }) =>\n\t\t\t`${options.suggestion.char}${node.attrs['label']}`,\n\t\trenderHTML: ({ options, node }) => [\n\t\t\t'span',\n\t\t\tmergeAttributes(options.HTMLAttributes),\n\t\t\t`${options.suggestion.char}${node.attrs['label']}`,\n\t\t],\n\t\tsuggestion: {\n\t\t\tchar: '#',\n\t\t\titems: ({ query }: { query: string }) =>\n\t\t\t\tteamsRef.current.filter((t) =>\n\t\t\t\t\tt.label.toLowerCase().includes(query.toLowerCase()),\n\t\t\t\t),\n\t\t\tcommand: ({ editor, range, props }: any) => {\n\t\t\t\teditor\n\t\t\t\t\t.chain()\n\t\t\t\t\t.focus()\n\t\t\t\t\t.deleteRange(range)\n\t\t\t\t\t.insertContent({\n\t\t\t\t\t\ttype: 'mentionTeam',\n\t\t\t\t\t\tattrs: { id: props.id, label: props.label },\n\t\t\t\t\t})\n\t\t\t\t\t.run();\n\t\t\t\tonSelect?.(props, '#');\n\t\t\t},\n\t\t\trender: buildRender(onSelect, '#', renderItem, renderDropdown),\n\t\t},\n\t});\n}\n"],"names":["buildRender","onSelect","renderItem","arguments","length","undefined","renderDropdown","component","popup","onStart","props","ReactRenderer","MentionDropdown","editor","createSuggestionPopup","element","clientRect","onUpdate","updateProps","Object","assign","_a","items","show","updatePosition","hide","onKeyDown","event","key","_b","ref","onExit","destroy","agentsRef","Mention","extend","name","configure","HTMLAttributes","class","renderText","_ref","options","node","suggestion","char","attrs","renderHTML","_ref2","mergeAttributes","_ref3","query","current","filter","a","label","toLowerCase","includes","command","_ref4","range","chain","focus","deleteRange","insertContent","type","id","run","render","teamsRef","_ref5","_ref6","_ref7","t","_ref8"],"mappings":"gWAcA,SAASA,EACRC,GACqB,IACrBC,EAAgEC,UAAAC,OAAAD,EAAAA,kBAAAE,EAChEC,EAAiEH,UAAAC,OAAAD,EAAAA,kBAAAE,EAEjE,MAAO,KACN,IAAIE,EACAC,EAEJ,MAAO,CACNC,QAAUC,IACTH,EAAY,IAAII,EAAaA,cAACC,kBAAiB,CAC9CF,qCAAYA,GAAK,CAAER,aAAYI,mBAC/BO,OAAQH,EAAMG,SAEfL,EAAQM,EAAqBA,sBAACP,EAAUQ,QAASL,EAAMM,WAAW,EAEnEC,SAAWP,UACVH,EAAUW,YAAiBC,OAAAC,OAAAD,OAAAC,OAAA,CAAA,EAAAV,IAAOR,aAAYI,qBAC9B,QAAXe,EAAAX,EAAMY,aAAK,IAAAD,OAAA,EAAAA,EAAEjB,SAIlBI,EAAMe,OACNf,EAAMgB,eAAed,EAAMM,aAJ1BR,EAAMiB,MAI+B,EAEvCC,UAAYhB,YACX,MAAwB,WAApBA,EAAMiB,MAAMC,KACfpB,EAAMiB,QACC,GAE2C,QAA5CI,EAAsB,QAAtBR,EAACd,EAAUuB,WAAW,IAAAT,OAAA,EAAAA,EAAEK,UAAUhB,UAAU,IAAAmB,GAAAA,CAAK,EAEzDE,OAAQA,KACPvB,EAAMwB,UACNzB,EAAUyB,SAAS,EAEpB,CAEH,oCAEM,SACLC,EACAhC,EACAC,EACAI,GAEA,OAAO4B,EAAAA,QAAQC,OAAO,CAAEC,KAAM,iBAAkBC,UAAU,CACzDC,eAAgB,CAAEC,MAAO,kCACzBC,WAAYC,IAAA,IAACC,QAAEA,EAAOC,KAAEA,GAAMF,EAAA,MAC7B,GAAGC,EAAQE,WAAWC,OAAOF,EAAKG,MAAa,OAAG,EACnDC,WAAYC,IAAA,IAACN,QAAEA,EAAOC,KAAEA,GAAMK,EAAA,MAAK,CAClC,OACAC,EAAeA,gBAACP,EAAQJ,gBACxB,GAAGI,EAAQE,WAAWC,OAAOF,EAAKG,MAAa,QAC/C,EACDF,WAAY,CACXC,KAAM,
|
|
1
|
+
{"version":3,"file":"MentionExtension.js","sources":["../../../../../src/editor/extensions/mention/MentionExtension.ts"],"sourcesContent":["import { mergeAttributes } from '@tiptap/core';\nimport Mention from '@tiptap/extension-mention';\nimport { ReactRenderer } from '@tiptap/react';\nimport type { ReactNode } from 'react';\nimport type {\n\tMentionDropdownRenderProps,\n\tMentionItem,\n} from '../../BikEditor.types';\nimport {\n\tcreateSuggestionPopup,\n\ttype SuggestionPopup,\n} from '../suggestionPopup';\nimport { MentionDropdown } from './MentionDropdown';\n\nfunction buildRender(\n\tonSelect?: (item: MentionItem, char: '@' | '#') => void,\n\tchar: '@' | '#' = '@',\n\trenderItem?: (item: MentionItem, isActive: boolean) => ReactNode,\n\trenderDropdown?: (props: MentionDropdownRenderProps) => ReactNode,\n) {\n\treturn () => {\n\t\tlet component: ReactRenderer;\n\t\tlet popup: SuggestionPopup;\n\n\t\treturn {\n\t\t\tonStart: (props: any) => {\n\t\t\t\tcomponent = new ReactRenderer(MentionDropdown, {\n\t\t\t\t\tprops: { ...props, renderItem, renderDropdown },\n\t\t\t\t\teditor: props.editor,\n\t\t\t\t});\n\t\t\t\tpopup = createSuggestionPopup(component.element, props.clientRect);\n\t\t\t},\n\t\t\tonUpdate: (props: any) => {\n\t\t\t\tcomponent.updateProps({ ...props, renderItem, renderDropdown });\n\t\t\t\tif (!props.items?.length) {\n\t\t\t\t\tpopup.hide();\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tpopup.show();\n\t\t\t\tpopup.updatePosition(props.clientRect);\n\t\t\t},\n\t\t\tonKeyDown: (props: any) => {\n\t\t\t\tif (props.event.key === 'Escape') {\n\t\t\t\t\tpopup.hide();\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t\treturn (component.ref as any)?.onKeyDown(props) ?? false;\n\t\t\t},\n\t\t\tonExit: () => {\n\t\t\t\tpopup.destroy();\n\t\t\t\tcomponent.destroy();\n\t\t\t},\n\t\t};\n\t};\n}\n\nexport function buildAgentMentionExtension(\n\tagentsRef: { current: MentionItem[] },\n\tonSelect?: (item: MentionItem, char: '@' | '#') => void,\n\trenderItem?: (item: MentionItem, isActive: boolean) => ReactNode,\n\trenderDropdown?: (props: MentionDropdownRenderProps) => ReactNode,\n) {\n\treturn Mention.extend({ name: 'mentionAgent' }).configure({\n\t\tHTMLAttributes: { class: 'bik-mention bik-mention--agent' },\n\t\trenderText: ({ options, node }) =>\n\t\t\t`${options.suggestion.char}${node.attrs['label']}`,\n\t\trenderHTML: ({ options, node }) => [\n\t\t\t'span',\n\t\t\tmergeAttributes(options.HTMLAttributes),\n\t\t\t`${options.suggestion.char}${node.attrs['label']}`,\n\t\t],\n\t\tsuggestion: {\n\t\t\tchar: '@',\n\t\t\tallowSpaces: true,\n\t\t\titems: ({ query }: { query: string }) =>\n\t\t\t\tagentsRef.current.filter((a) =>\n\t\t\t\t\ta.label.toLowerCase().includes(query.toLowerCase()),\n\t\t\t\t),\n\t\t\tcommand: ({ editor, range, props }: any) => {\n\t\t\t\teditor\n\t\t\t\t\t.chain()\n\t\t\t\t\t.focus()\n\t\t\t\t\t.deleteRange(range)\n\t\t\t\t\t.insertContent({\n\t\t\t\t\t\ttype: 'mentionAgent',\n\t\t\t\t\t\tattrs: { id: props.id, label: props.label },\n\t\t\t\t\t})\n\t\t\t\t\t.run();\n\t\t\t\tonSelect?.(props, '@');\n\t\t\t},\n\t\t\trender: buildRender(onSelect, '@', renderItem, renderDropdown),\n\t\t},\n\t});\n}\n\nexport function buildTeamMentionExtension(\n\tteamsRef: { current: MentionItem[] },\n\tonSelect?: (item: MentionItem, char: '@' | '#') => void,\n\trenderItem?: (item: MentionItem, isActive: boolean) => ReactNode,\n\trenderDropdown?: (props: MentionDropdownRenderProps) => ReactNode,\n) {\n\treturn Mention.extend({ name: 'mentionTeam' }).configure({\n\t\tHTMLAttributes: { class: 'bik-mention bik-mention--team' },\n\t\trenderText: ({ options, node }) =>\n\t\t\t`${options.suggestion.char}${node.attrs['label']}`,\n\t\trenderHTML: ({ options, node }) => [\n\t\t\t'span',\n\t\t\tmergeAttributes(options.HTMLAttributes),\n\t\t\t`${options.suggestion.char}${node.attrs['label']}`,\n\t\t],\n\t\tsuggestion: {\n\t\t\tchar: '#',\n\t\t\tallowSpaces: true,\n\t\t\titems: ({ query }: { query: string }) =>\n\t\t\t\tteamsRef.current.filter((t) =>\n\t\t\t\t\tt.label.toLowerCase().includes(query.toLowerCase()),\n\t\t\t\t),\n\t\t\tcommand: ({ editor, range, props }: any) => {\n\t\t\t\teditor\n\t\t\t\t\t.chain()\n\t\t\t\t\t.focus()\n\t\t\t\t\t.deleteRange(range)\n\t\t\t\t\t.insertContent({\n\t\t\t\t\t\ttype: 'mentionTeam',\n\t\t\t\t\t\tattrs: { id: props.id, label: props.label },\n\t\t\t\t\t})\n\t\t\t\t\t.run();\n\t\t\t\tonSelect?.(props, '#');\n\t\t\t},\n\t\t\trender: buildRender(onSelect, '#', renderItem, renderDropdown),\n\t\t},\n\t});\n}\n"],"names":["buildRender","onSelect","renderItem","arguments","length","undefined","renderDropdown","component","popup","onStart","props","ReactRenderer","MentionDropdown","editor","createSuggestionPopup","element","clientRect","onUpdate","updateProps","Object","assign","_a","items","show","updatePosition","hide","onKeyDown","event","key","_b","ref","onExit","destroy","agentsRef","Mention","extend","name","configure","HTMLAttributes","class","renderText","_ref","options","node","suggestion","char","attrs","renderHTML","_ref2","mergeAttributes","allowSpaces","_ref3","query","current","filter","a","label","toLowerCase","includes","command","_ref4","range","chain","focus","deleteRange","insertContent","type","id","run","render","teamsRef","_ref5","_ref6","_ref7","t","_ref8"],"mappings":"gWAcA,SAASA,EACRC,GACqB,IACrBC,EAAgEC,UAAAC,OAAAD,EAAAA,kBAAAE,EAChEC,EAAiEH,UAAAC,OAAAD,EAAAA,kBAAAE,EAEjE,MAAO,KACN,IAAIE,EACAC,EAEJ,MAAO,CACNC,QAAUC,IACTH,EAAY,IAAII,EAAaA,cAACC,kBAAiB,CAC9CF,qCAAYA,GAAK,CAAER,aAAYI,mBAC/BO,OAAQH,EAAMG,SAEfL,EAAQM,EAAqBA,sBAACP,EAAUQ,QAASL,EAAMM,WAAW,EAEnEC,SAAWP,UACVH,EAAUW,YAAiBC,OAAAC,OAAAD,OAAAC,OAAA,CAAA,EAAAV,IAAOR,aAAYI,qBAC9B,QAAXe,EAAAX,EAAMY,aAAK,IAAAD,OAAA,EAAAA,EAAEjB,SAIlBI,EAAMe,OACNf,EAAMgB,eAAed,EAAMM,aAJ1BR,EAAMiB,MAI+B,EAEvCC,UAAYhB,YACX,MAAwB,WAApBA,EAAMiB,MAAMC,KACfpB,EAAMiB,QACC,GAE2C,QAA5CI,EAAsB,QAAtBR,EAACd,EAAUuB,WAAW,IAAAT,OAAA,EAAAA,EAAEK,UAAUhB,UAAU,IAAAmB,GAAAA,CAAK,EAEzDE,OAAQA,KACPvB,EAAMwB,UACNzB,EAAUyB,SAAS,EAEpB,CAEH,oCAEM,SACLC,EACAhC,EACAC,EACAI,GAEA,OAAO4B,EAAAA,QAAQC,OAAO,CAAEC,KAAM,iBAAkBC,UAAU,CACzDC,eAAgB,CAAEC,MAAO,kCACzBC,WAAYC,IAAA,IAACC,QAAEA,EAAOC,KAAEA,GAAMF,EAAA,MAC7B,GAAGC,EAAQE,WAAWC,OAAOF,EAAKG,MAAa,OAAG,EACnDC,WAAYC,IAAA,IAACN,QAAEA,EAAOC,KAAEA,GAAMK,EAAA,MAAK,CAClC,OACAC,EAAeA,gBAACP,EAAQJ,gBACxB,GAAGI,EAAQE,WAAWC,OAAOF,EAAKG,MAAa,QAC/C,EACDF,WAAY,CACXC,KAAM,IACNK,aAAa,EACb5B,MAAO6B,IAAA,IAACC,MAAEA,GAA0BD,EAAA,OACnClB,EAAUoB,QAAQC,QAAQC,GACzBA,EAAEC,MAAMC,cAAcC,SAASN,EAAMK,gBACrC,EACFE,QAASC,IAAkC,IAAjC/C,OAAEA,EAAMgD,MAAEA,EAAKnD,MAAEA,GAAYkD,EACtC/C,EACEiD,QACAC,QACAC,YAAYH,GACZI,cAAc,CACdC,KAAM,eACNpB,MAAO,CAAEqB,GAAIzD,EAAMyD,GAAIX,MAAO9C,EAAM8C,SAEpCY,MACFnE,SAAAA,EAAWS,EAAO,IAAI,EAEvB2D,OAAQrE,EAAYC,EAAU,IAAKC,EAAYI,KAGlD,oCAEM,SACLgE,EACArE,EACAC,EACAI,GAEA,OAAO4B,EAAAA,QAAQC,OAAO,CAAEC,KAAM,gBAAiBC,UAAU,CACxDC,eAAgB,CAAEC,MAAO,iCACzBC,WAAY+B,IAAA,IAAC7B,QAAEA,EAAOC,KAAEA,GAAM4B,EAAA,MAC7B,GAAG7B,EAAQE,WAAWC,OAAOF,EAAKG,MAAa,OAAG,EACnDC,WAAYyB,IAAA,IAAC9B,QAAEA,EAAOC,KAAEA,GAAM6B,EAAA,MAAK,CAClC,OACAvB,EAAeA,gBAACP,EAAQJ,gBACxB,GAAGI,EAAQE,WAAWC,OAAOF,EAAKG,MAAa,QAC/C,EACDF,WAAY,CACXC,KAAM,IACNK,aAAa,EACb5B,MAAOmD,IAAA,IAACrB,MAAEA,GAA0BqB,EAAA,OACnCH,EAASjB,QAAQC,QAAQoB,GACxBA,EAAElB,MAAMC,cAAcC,SAASN,EAAMK,gBACrC,EACFE,QAASgB,IAAkC,IAAjC9D,OAAEA,EAAMgD,MAAEA,EAAKnD,MAAEA,GAAYiE,EACtC9D,EACEiD,QACAC,QACAC,YAAYH,GACZI,cAAc,CACdC,KAAM,cACNpB,MAAO,CAAEqB,GAAIzD,EAAMyD,GAAIX,MAAO9C,EAAM8C,SAEpCY,MACFnE,SAAAA,EAAWS,EAAO,IAAI,EAEvB2D,OAAQrE,EAAYC,EAAU,IAAKC,EAAYI,KAGlD"}
|
|
@@ -0,0 +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"),r=require("@tiptap/pm/state"),i=require("./pasteUtils.js");const a=e.Extension.create({name:"clipboardNormalization",addProseMirrorPlugins:()=>[new r.Plugin({props:{handlePaste(e,r){var a,n,o;if(null===(n=null===(a=r.clipboardData)||void 0===a?void 0:a.files)||void 0===n?void 0:n.length)return!1;const l=null===(o=r.clipboardData)||void 0===o?void 0:o.getData("text/html");if(!l)return!1;if(l.includes("data-pm-slice"))return!1;const s=document.createElement("div");if(s.innerHTML=l,!s.querySelector(i.BLOCK_SELECTOR))return!1;i.cleanBlockBrs(s);const c=e.state.schema,d=t.DOMParser.fromSchema(c).parseSlice(s),p=i.normalizeBlanks(d.content),u=new t.Slice(p,d.openStart,d.openEnd);return e.dispatch(e.state.tr.replaceSelection(u)),!0}}})]});exports.ClipboardNormalizationExtension=a;
|
|
2
|
+
//# sourceMappingURL=ClipboardNormalizationExtension.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ClipboardNormalizationExtension.js","sources":["../../../../../src/editor/extensions/plainClipboard/ClipboardNormalizationExtension.ts"],"sourcesContent":["import { Extension } from '@tiptap/core';\nimport { DOMParser as ProseMirrorDOMParser, Slice } from '@tiptap/pm/model';\nimport { Plugin } from '@tiptap/pm/state';\nimport { BLOCK_SELECTOR, cleanBlockBrs, normalizeBlanks } from './pasteUtils';\n\n/**\n * Lightweight paste normalizer for rich-paste editors (email).\n * Fixes Google Docs' standalone `<br>` between paragraphs and collapses\n * consecutive empty paragraphs — but keeps ALL formatting marks intact.\n */\nexport const ClipboardNormalizationExtension = Extension.create({\n\tname: 'clipboardNormalization',\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;\n\t\t\t\t\t\tconst html = event.clipboardData?.getData('text/html');\n\t\t\t\t\t\tif (!html) return false;\n\t\t\t\t\t\tif (html.includes('data-pm-slice')) return false;\n\n\t\t\t\t\t\tconst container = document.createElement('div');\n\t\t\t\t\t\tcontainer.innerHTML = html;\n\t\t\t\t\t\tif (!container.querySelector(BLOCK_SELECTOR)) return false;\n\n\t\t\t\t\t\tcleanBlockBrs(container);\n\t\t\t\t\t\tconst schema = _view.state.schema;\n\t\t\t\t\t\tconst parsed =\n\t\t\t\t\t\t\tProseMirrorDOMParser.fromSchema(schema).parseSlice(container);\n\t\t\t\t\t\tconst cleaned = normalizeBlanks(parsed.content);\n\t\t\t\t\t\tconst slice = new Slice(cleaned, parsed.openStart, parsed.openEnd);\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":["ClipboardNormalizationExtension","Extension","create","name","addProseMirrorPlugins","Plugin","props","handlePaste","_view","event","_b","clipboardData","_a","files","length","html","_c","getData","includes","container","document","createElement","innerHTML","querySelector","BLOCK_SELECTOR","cleanBlockBrs","schema","state","parsed","ProseMirrorDOMParser","fromSchema","parseSlice","cleaned","normalizeBlanks","content","slice","Slice","openStart","openEnd","dispatch","tr","replaceSelection"],"mappings":"qOAUaA,EAAkCC,EAASA,UAACC,OAAO,CAC/DC,KAAM,yBACNC,sBAAqBA,IACb,CACN,IAAIC,EAAAA,OAAO,CACVC,MAAO,CACNC,YAAYC,EAAOC,aAClB,WAAIC,EAAqB,UAArBD,EAAME,qBAAe,IAAAC,OAAA,EAAAA,EAAAC,4BAAOC,OAAQ,OAAO,EAC/C,MAAMC,EAA0B,QAAnBC,EAAAP,EAAME,qBAAa,IAAAK,OAAA,EAAAA,EAAEC,QAAQ,aAC1C,IAAKF,EAAM,OAAO,EAClB,GAAIA,EAAKG,SAAS,iBAAkB,OAAO,EAE3C,MAAMC,EAAYC,SAASC,cAAc,OAEzC,GADAF,EAAUG,UAAYP,GACjBI,EAAUI,cAAcC,EAAAA,gBAAiB,OAAO,EAErDC,EAAaA,cAACN,GACd,MAAMO,EAASlB,EAAMmB,MAAMD,OACrBE,EACLC,EAAAA,UAAqBC,WAAWJ,GAAQK,WAAWZ,GAC9Ca,EAAUC,EAAAA,gBAAgBL,EAAOM,SACjCC,EAAQ,IAAIC,EAAAA,MAAMJ,EAASJ,EAAOS,UAAWT,EAAOU,SAE1D,OADA9B,EAAM+B,SAAS/B,EAAMmB,MAAMa,GAAGC,iBAAiBN,KACxC,CACR"}
|
|
@@ -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"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../../node_modules/@tiptap/core/dist/index.js"),t=require("@tiptap/pm/model"),r=require("@tiptap/pm/state"),a=require("./pasteUtils.js");const i=e.Extension.create({name:"plainClipboard",addProseMirrorPlugins:()=>[new r.Plugin({props:{handlePaste(e,r){var i,n,l,o;if(null===(n=null===(i=r.clipboardData)||void 0===i?void 0:i.files)||void 0===n?void 0:n.length)return!1;const s=null===(l=r.clipboardData)||void 0===l?void 0:l.getData("text/html"),p=null===(o=r.clipboardData)||void 0===o?void 0:o.getData("text/plain");if(!p)return!1;if(null==s?void 0:s.includes("data-pm-slice"))return!1;const c=e.state.schema;if(s){const r=document.createElement("div");r.innerHTML=s;if(r.querySelector(a.BLOCK_SELECTOR)){a.cleanBlockBrs(r);const i=t.DOMParser.fromSchema(c).parseSlice(r),n=a.normalizeBlanks(a.stripRichMarks(i.content)),l=new t.Slice(n,i.openStart,i.openEnd);return e.dispatch(e.state.tr.replaceSelection(l)),!0}}const d=p.split("\n").map((e=>c.node("paragraph",null,e?[c.text(e)]:[]))),u=new t.Slice(t.Fragment.fromArray(d),1,1);return e.dispatch(e.state.tr.replaceSelection(u)),!0}}})]});exports.PlainClipboardExtension=i;
|
|
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 {
|
|
1
|
+
{"version":3,"file":"PlainClipboardExtension.js","sources":["../../../../../src/editor/extensions/plainClipboard/PlainClipboardExtension.ts"],"sourcesContent":["import { Extension } from '@tiptap/core';\nimport {\n\tFragment,\n\tDOMParser as ProseMirrorDOMParser,\n\tSlice,\n} from '@tiptap/pm/model';\nimport { Plugin } from '@tiptap/pm/state';\nimport {\n\tBLOCK_SELECTOR,\n\tcleanBlockBrs,\n\tnormalizeBlanks,\n\tstripRichMarks,\n} from './pasteUtils';\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;\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\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\tconst container = document.createElement('div');\n\t\t\t\t\t\t\tcontainer.innerHTML = html;\n\t\t\t\t\t\t\tconst hasBlocks = container.querySelector(BLOCK_SELECTOR);\n\t\t\t\t\t\t\tif (hasBlocks) {\n\t\t\t\t\t\t\t\tcleanBlockBrs(container);\n\t\t\t\t\t\t\t\tconst parsed =\n\t\t\t\t\t\t\t\t\tProseMirrorDOMParser.fromSchema(schema).parseSlice(container);\n\t\t\t\t\t\t\t\tconst cleaned = normalizeBlanks(stripRichMarks(parsed.content));\n\t\t\t\t\t\t\t\tconst slice = new Slice(\n\t\t\t\t\t\t\t\t\tcleaned,\n\t\t\t\t\t\t\t\t\tparsed.openStart,\n\t\t\t\t\t\t\t\t\tparsed.openEnd,\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t_view.dispatch(_view.state.tr.replaceSelection(slice));\n\t\t\t\t\t\t\t\treturn true;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\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":["PlainClipboardExtension","Extension","create","name","addProseMirrorPlugins","Plugin","props","handlePaste","_view","event","_b","clipboardData","_a","files","length","html","_c","getData","text","_d","includes","schema","state","container","document","createElement","innerHTML","querySelector","BLOCK_SELECTOR","cleanBlockBrs","parsed","ProseMirrorDOMParser","fromSchema","parseSlice","cleaned","normalizeBlanks","stripRichMarks","content","slice","Slice","openStart","openEnd","dispatch","tr","replaceSelection","paragraphs","split","map","line","node","Fragment","fromArray"],"mappings":"qOAcaA,EAA0BC,EAASA,UAACC,OAAO,CACvDC,KAAM,iBACNC,sBAAqBA,IACb,CACN,IAAIC,EAAAA,OAAO,CACVC,MAAO,CACNC,YAAYC,EAAOC,eAClB,WAAIC,EAAqB,UAArBD,EAAME,qBAAe,IAAAC,OAAA,EAAAA,EAAAC,4BAAOC,OAAQ,OAAO,EAC/C,MAAMC,EAA0B,QAAnBC,EAAAP,EAAME,qBAAa,IAAAK,OAAA,EAAAA,EAAEC,QAAQ,aACpCC,EAA0B,QAAnBC,EAAAV,EAAME,qBAAa,IAAAQ,OAAA,EAAAA,EAAEF,QAAQ,cAC1C,IAAKC,EAAM,OAAO,EAElB,GAAIH,aAAI,EAAJA,EAAMK,SAAS,iBAAkB,OAAO,EAE5C,MAAMC,EAASb,EAAMc,MAAMD,OAE3B,GAAIN,EAAM,CACT,MAAMQ,EAAYC,SAASC,cAAc,OACzCF,EAAUG,UAAYX,EAEtB,GADkBQ,EAAUI,cAAcC,EAAcA,gBACzC,CACdC,EAAaA,cAACN,GACd,MAAMO,EACLC,EAAAA,UAAqBC,WAAWX,GAAQY,WAAWV,GAC9CW,EAAUC,EAAAA,gBAAgBC,EAAAA,eAAeN,EAAOO,UAChDC,EAAQ,IAAIC,EAAAA,MACjBL,EACAJ,EAAOU,UACPV,EAAOW,SAGR,OADAjC,EAAMkC,SAASlC,EAAMc,MAAMqB,GAAGC,iBAAiBN,KACxC,CACP,CACD,CAED,MAAMO,EAAa3B,EACjB4B,MAAM,MACNC,KAAKC,GACL3B,EAAO4B,KAAK,YAAa,KAAMD,EAAO,CAAC3B,EAAOH,KAAK8B,IAAS,MAExDV,EAAQ,IAAIC,EAAAA,MAAMW,EAAQA,SAACC,UAAUN,GAAa,EAAG,GAE3D,OADArC,EAAMkC,SAASlC,EAAMc,MAAMqB,GAAGC,iBAAiBN,KACxC,CACR"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@tiptap/pm/model");const t=new Set(["P","LI","H1","H2","H3","H4","H5","H6","TD","TH","PRE"]),r=new Set(["bold","italic","strike","underline","code"]);exports.BLOCK_SELECTOR="p,div,h1,h2,h3,h4,h5,h6,ul,ol,li,blockquote,table,pre",exports.TEXTBLOCK_TAGS=t,exports.cleanBlockBrs=function(e){const r=Array.from(e.querySelectorAll("br"));for(const n of r){let r=!1,o=n.parentElement;for(;o&&o!==e;){if(t.has(o.tagName)){r=!0;break}o=o.parentElement}r||n.parentElement.replaceChild(document.createElement("p"),n)}},exports.normalizeBlanks=function t(r){const n=[];let o=!1;return r.forEach((e=>{var r;if("paragraph"===e.type.name&&1===e.childCount&&"hardBreak"===(null===(r=e.firstChild)||void 0===r?void 0:r.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(t(e.content))):n.push(e))})),e.Fragment.from(n)},exports.stripRichMarks=function t(n){const o=[];return n.forEach((e=>{if(e.isText){const t=e.marks.filter((e=>r.has(e.type.name)));o.push(t.length===e.marks.length?e:e.mark(t))}else o.push(e.copy(t(e.content)))})),e.Fragment.from(o)};
|
|
2
|
+
//# sourceMappingURL=pasteUtils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pasteUtils.js","sources":["../../../../../src/editor/extensions/plainClipboard/pasteUtils.ts"],"sourcesContent":["import { Fragment, Node as PMNode } from '@tiptap/pm/model';\n\nexport const TEXTBLOCK_TAGS = new Set([\n\t'P',\n\t'LI',\n\t'H1',\n\t'H2',\n\t'H3',\n\t'H4',\n\t'H5',\n\t'H6',\n\t'TD',\n\t'TH',\n\t'PRE',\n]);\n\nexport const BLOCK_SELECTOR =\n\t'p,div,h1,h2,h3,h4,h5,h6,ul,ol,li,blockquote,table,pre';\n\nconst BASIC_MARKS = new Set(['bold', 'italic', 'strike', 'underline', 'code']);\n\n/**\n * Replace `<br>` elements that sit at block level (not inside a textblock\n * like `<p>`, `<li>`, etc.) with empty `<p></p>` elements. Google Docs\n * puts standalone `<br>` tags between paragraphs to represent blank lines.\n * Without this, ProseMirror parses them as top-level hardBreak nodes.\n */\nexport function cleanBlockBrs(container: HTMLElement): void {\n\tconst brs = Array.from(container.querySelectorAll('br'));\n\tfor (const br of brs) {\n\t\tlet insideTextblock = false;\n\t\tlet el = br.parentElement;\n\t\twhile (el && el !== container) {\n\t\t\tif (TEXTBLOCK_TAGS.has(el.tagName)) {\n\t\t\t\tinsideTextblock = true;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tel = el.parentElement;\n\t\t}\n\t\tif (!insideTextblock) {\n\t\t\tbr.parentElement!.replaceChild(document.createElement('p'), br);\n\t\t}\n\t}\n}\n\n/**\n * 1. Convert paragraphs containing only a hard_break into empty paragraphs.\n * 2. Collapse consecutive empty paragraphs into one.\n */\nexport function 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\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 */\nexport function 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"],"names":["TEXTBLOCK_TAGS","Set","BASIC_MARKS","container","brs","Array","from","querySelectorAll","br","insideTextblock","el","parentElement","has","tagName","replaceChild","document","createElement","normalizeBlanks","fragment","nodes","prevEmpty","forEach","node","type","name","childCount","_a","firstChild","push","create","attrs","isEmpty","isBlock","isLeaf","copy","content","Fragment","stripRichMarks","isText","kept","marks","filter","m","length","mark"],"mappings":"sGAEaA,MAAAA,EAAiB,IAAIC,IAAI,CACrC,IACA,KACA,KACA,KACA,KACA,KACA,KACA,KACA,KACA,KACA,QAMKC,EAAc,IAAID,IAAI,CAAC,OAAQ,SAAU,SAAU,YAAa,gCAFrE,uGAUK,SAAwBE,GAC7B,MAAMC,EAAMC,MAAMC,KAAKH,EAAUI,iBAAiB,OAClD,IAAK,MAAMC,KAAMJ,EAAK,CACrB,IAAIK,GAAkB,EAClBC,EAAKF,EAAGG,cACZ,KAAOD,GAAMA,IAAOP,GAAW,CAC9B,GAAIH,EAAeY,IAAIF,EAAGG,SAAU,CACnCJ,GAAkB,EAClB,KACA,CACDC,EAAKA,EAAGC,aACR,CACIF,GACJD,EAAGG,cAAeG,aAAaC,SAASC,cAAc,KAAMR,EAE7D,CACF,0BAMM,SAAUS,EAAgBC,GAC/B,MAAMC,EAAkB,GACxB,IAAIC,GAAY,EAoBhB,OAnBAF,EAASG,SAASC,UAKjB,GAHoB,cAAnBA,EAAKC,KAAKC,MACU,IAApBF,EAAKG,YAC0B,eAAhB,QAAfC,EAAAJ,EAAKK,kBAAU,IAAAD,OAAA,EAAAA,EAAEH,KAAKC,MAItB,OAFKJ,GAAWD,EAAMS,KAAKN,EAAKC,KAAKM,OAAOP,EAAKQ,aACjDV,GAAY,GAGb,MAAMW,EAA6B,cAAnBT,EAAKC,KAAKC,MAA4C,IAApBF,EAAKG,WACnDM,GAAWX,IACfA,EAAYW,EACRT,EAAKU,UAAYV,EAAKW,OACzBd,EAAMS,KAAKN,EAAKY,KAAKjB,EAAgBK,EAAKa,WAE1ChB,EAAMS,KAAKN,GACX,IAEKc,EAAQA,SAAC9B,KAAKa,EACtB,yBAOM,SAAUkB,EAAenB,GAC9B,MAAMC,EAAkB,GASxB,OARAD,EAASG,SAASC,IACjB,GAAIA,EAAKgB,OAAQ,CAChB,MAAMC,EAAOjB,EAAKkB,MAAMC,QAAQC,GAAMxC,EAAYU,IAAI8B,EAAEnB,KAAKC,QAC7DL,EAAMS,KAAKW,EAAKI,SAAWrB,EAAKkB,MAAMG,OAASrB,EAAOA,EAAKsB,KAAKL,GAChE,MACApB,EAAMS,KAAKN,EAAKY,KAAKG,EAAef,EAAKa,UACzC,IAEKC,EAAQA,SAAC9B,KAAKa,EACtB"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../../node_modules/@tiptap/core/dist/index.js"),r=require("@tiptap/react"),t=require("@tiptap/suggestion"),n=require("../suggestionPopup.js"),o=require("./SlashCommandMenu.js");function i(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var s=i(t);exports.buildSlashCommandExtension=function(t,i,d
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../../node_modules/@tiptap/core/dist/index.js"),r=require("@tiptap/react"),t=require("@tiptap/suggestion"),n=require("../suggestionPopup.js"),o=require("./SlashCommandMenu.js");function i(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var s=i(t);exports.buildSlashCommandExtension=function(t,i,a,d){return e.Extension.create({name:"slashCommand",addProseMirrorPlugins(){return[s.default({editor:this.editor,char:"/",allowSpaces:!0,items:e=>{let{query:r}=e;return t.current.filter((e=>e.label.toLowerCase().includes(r.toLowerCase()))).slice(0,20)},command:e=>{let{editor:r,range:t,props:n}=e;r.chain().focus().deleteRange(t).run(),null==i||i(n)},render:()=>{let e,t;return{onStart:i=>{e=new r.ReactRenderer(o.SlashCommandMenu,{props:Object.assign(Object.assign({},i),{renderItem:a,renderDropdown:d}),editor:i.editor}),t=n.createSuggestionPopup(e.element,i.clientRect)},onUpdate:r=>{var n;e.updateProps(Object.assign(Object.assign({},r),{renderItem:a,renderDropdown:d})),(null===(n=r.items)||void 0===n?void 0:n.length)?(t.show(),t.updatePosition(r.clientRect)):t.hide()},onKeyDown:r=>{var n,o;return"Escape"===r.event.key?(t.hide(),!0):null!==(o=null===(n=e.ref)||void 0===n?void 0:n.onKeyDown(r))&&void 0!==o&&o},onExit:()=>{t.destroy(),e.destroy()}}}})]}})};
|
|
2
2
|
//# sourceMappingURL=SlashCommandExtension.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SlashCommandExtension.js","sources":["../../../../../src/editor/extensions/slashCommand/SlashCommandExtension.ts"],"sourcesContent":["import { Extension } from '@tiptap/core';\nimport { ReactRenderer } from '@tiptap/react';\nimport Suggestion from '@tiptap/suggestion';\nimport type { ReactNode } from 'react';\nimport type {\n\tSlashCommandDropdownRenderProps,\n\tSlashCommandItem,\n} from '../../BikEditor.types';\nimport {\n\tcreateSuggestionPopup,\n\ttype SuggestionPopup,\n} from '../suggestionPopup';\nimport { SlashCommandMenu } from './SlashCommandMenu';\n\nexport function buildSlashCommandExtension(\n\tcommandsRef: { current: SlashCommandItem[] },\n\tonSelect?: (command: SlashCommandItem) => void,\n\trenderItem?: (item: SlashCommandItem, isActive: boolean) => ReactNode,\n\trenderDropdown?: (props: SlashCommandDropdownRenderProps) => ReactNode,\n) {\n\treturn Extension.create({\n\t\tname: 'slashCommand',\n\t\taddProseMirrorPlugins() {\n\t\t\treturn [\n\t\t\t\tSuggestion({\n\t\t\t\t\teditor: this.editor,\n\t\t\t\t\tchar: '/',\n\t\t\t\t\titems: ({ query }: any) =>\n\t\t\t\t\t\tcommandsRef.current\n\t\t\t\t\t\t\t.filter((c) =>\n\t\t\t\t\t\t\t\tc.label.toLowerCase().includes(query.toLowerCase()),\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t.slice(0, 20),\n\t\t\t\t\tcommand: ({ editor, range, props }: any) => {\n\t\t\t\t\t\teditor.chain().focus().deleteRange(range).run();\n\t\t\t\t\t\tonSelect?.(props);\n\t\t\t\t\t},\n\t\t\t\t\trender: () => {\n\t\t\t\t\t\tlet component: ReactRenderer;\n\t\t\t\t\t\tlet popup: SuggestionPopup;\n\n\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\tonStart: (props: any) => {\n\t\t\t\t\t\t\t\tcomponent = new ReactRenderer(SlashCommandMenu, {\n\t\t\t\t\t\t\t\t\tprops: { ...props, renderItem, renderDropdown },\n\t\t\t\t\t\t\t\t\teditor: props.editor,\n\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\tpopup = createSuggestionPopup(\n\t\t\t\t\t\t\t\t\tcomponent.element,\n\t\t\t\t\t\t\t\t\tprops.clientRect,\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tonUpdate: (props: any) => {\n\t\t\t\t\t\t\t\tcomponent.updateProps({ ...props, renderItem, renderDropdown });\n\t\t\t\t\t\t\t\tif (!props.items?.length) {\n\t\t\t\t\t\t\t\t\tpopup.hide();\n\t\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tpopup.show();\n\t\t\t\t\t\t\t\tpopup.updatePosition(props.clientRect);\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tonKeyDown: (props: any) => {\n\t\t\t\t\t\t\t\tif (props.event.key === 'Escape') {\n\t\t\t\t\t\t\t\t\tpopup.hide();\n\t\t\t\t\t\t\t\t\treturn true;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\treturn (component.ref as any)?.onKeyDown(props) ?? false;\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tonExit: () => {\n\t\t\t\t\t\t\t\tpopup.destroy();\n\t\t\t\t\t\t\t\tcomponent.destroy();\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t};\n\t\t\t\t\t},\n\t\t\t\t}),\n\t\t\t];\n\t\t},\n\t});\n}\n"],"names":["commandsRef","onSelect","renderItem","renderDropdown","Extension","create","name","addProseMirrorPlugins","Suggestion","editor","this","char","items","_ref","query","current","filter","c","label","toLowerCase","includes","slice","command","_ref2","range","props","chain","focus","deleteRange","run","render","component","popup","onStart","ReactRenderer","SlashCommandMenu","createSuggestionPopup","element","clientRect","onUpdate","updateProps","Object","assign","_a","length","show","updatePosition","hide","onKeyDown","event","key","_b","ref","onExit","destroy"],"mappings":"6XAcM,SACLA,EACAC,EACAC,EACAC,GAEA,OAAOC,EAAAA,UAAUC,OAAO,CACvBC,KAAM,eACNC,wBACC,MAAO,CACNC,EAAAA,QAAW,CACVC,OAAQC,KAAKD,OACbE,KAAM,IACNC,MAAOC,IAAA,IAACC,MAAEA,GAAYD,EAAA,
|
|
1
|
+
{"version":3,"file":"SlashCommandExtension.js","sources":["../../../../../src/editor/extensions/slashCommand/SlashCommandExtension.ts"],"sourcesContent":["import { Extension } from '@tiptap/core';\nimport { ReactRenderer } from '@tiptap/react';\nimport Suggestion from '@tiptap/suggestion';\nimport type { ReactNode } from 'react';\nimport type {\n\tSlashCommandDropdownRenderProps,\n\tSlashCommandItem,\n} from '../../BikEditor.types';\nimport {\n\tcreateSuggestionPopup,\n\ttype SuggestionPopup,\n} from '../suggestionPopup';\nimport { SlashCommandMenu } from './SlashCommandMenu';\n\nexport function buildSlashCommandExtension(\n\tcommandsRef: { current: SlashCommandItem[] },\n\tonSelect?: (command: SlashCommandItem) => void,\n\trenderItem?: (item: SlashCommandItem, isActive: boolean) => ReactNode,\n\trenderDropdown?: (props: SlashCommandDropdownRenderProps) => ReactNode,\n) {\n\treturn Extension.create({\n\t\tname: 'slashCommand',\n\t\taddProseMirrorPlugins() {\n\t\t\treturn [\n\t\t\t\tSuggestion({\n\t\t\t\t\teditor: this.editor,\n\t\t\t\t\tchar: '/',\n\t\t\t\t\tallowSpaces: true,\n\t\t\t\t\titems: ({ query }: any) =>\n\t\t\t\t\t\tcommandsRef.current\n\t\t\t\t\t\t\t.filter((c) =>\n\t\t\t\t\t\t\t\tc.label.toLowerCase().includes(query.toLowerCase()),\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t.slice(0, 20),\n\t\t\t\t\tcommand: ({ editor, range, props }: any) => {\n\t\t\t\t\t\teditor.chain().focus().deleteRange(range).run();\n\t\t\t\t\t\tonSelect?.(props);\n\t\t\t\t\t},\n\t\t\t\t\trender: () => {\n\t\t\t\t\t\tlet component: ReactRenderer;\n\t\t\t\t\t\tlet popup: SuggestionPopup;\n\n\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\tonStart: (props: any) => {\n\t\t\t\t\t\t\t\tcomponent = new ReactRenderer(SlashCommandMenu, {\n\t\t\t\t\t\t\t\t\tprops: { ...props, renderItem, renderDropdown },\n\t\t\t\t\t\t\t\t\teditor: props.editor,\n\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\tpopup = createSuggestionPopup(\n\t\t\t\t\t\t\t\t\tcomponent.element,\n\t\t\t\t\t\t\t\t\tprops.clientRect,\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tonUpdate: (props: any) => {\n\t\t\t\t\t\t\t\tcomponent.updateProps({ ...props, renderItem, renderDropdown });\n\t\t\t\t\t\t\t\tif (!props.items?.length) {\n\t\t\t\t\t\t\t\t\tpopup.hide();\n\t\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tpopup.show();\n\t\t\t\t\t\t\t\tpopup.updatePosition(props.clientRect);\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tonKeyDown: (props: any) => {\n\t\t\t\t\t\t\t\tif (props.event.key === 'Escape') {\n\t\t\t\t\t\t\t\t\tpopup.hide();\n\t\t\t\t\t\t\t\t\treturn true;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\treturn (component.ref as any)?.onKeyDown(props) ?? false;\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tonExit: () => {\n\t\t\t\t\t\t\t\tpopup.destroy();\n\t\t\t\t\t\t\t\tcomponent.destroy();\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t};\n\t\t\t\t\t},\n\t\t\t\t}),\n\t\t\t];\n\t\t},\n\t});\n}\n"],"names":["commandsRef","onSelect","renderItem","renderDropdown","Extension","create","name","addProseMirrorPlugins","Suggestion","editor","this","char","allowSpaces","items","_ref","query","current","filter","c","label","toLowerCase","includes","slice","command","_ref2","range","props","chain","focus","deleteRange","run","render","component","popup","onStart","ReactRenderer","SlashCommandMenu","createSuggestionPopup","element","clientRect","onUpdate","updateProps","Object","assign","_a","length","show","updatePosition","hide","onKeyDown","event","key","_b","ref","onExit","destroy"],"mappings":"6XAcM,SACLA,EACAC,EACAC,EACAC,GAEA,OAAOC,EAAAA,UAAUC,OAAO,CACvBC,KAAM,eACNC,wBACC,MAAO,CACNC,EAAAA,QAAW,CACVC,OAAQC,KAAKD,OACbE,KAAM,IACNC,aAAa,EACbC,MAAOC,IAAA,IAACC,MAAEA,GAAYD,EAAA,OACrBd,EAAYgB,QACVC,QAAQC,GACRA,EAAEC,MAAMC,cAAcC,SAASN,EAAMK,iBAErCE,MAAM,EAAG,GAAG,EACfC,QAASC,IAAkC,IAAjCf,OAAEA,EAAMgB,MAAEA,EAAKC,MAAEA,GAAYF,EACtCf,EAAOkB,QAAQC,QAAQC,YAAYJ,GAAOK,MAC1C7B,SAAAA,EAAWyB,EAAM,EAElBK,OAAQA,KACP,IAAIC,EACAC,EAEJ,MAAO,CACNC,QAAUR,IACTM,EAAY,IAAIG,EAAaA,cAACC,mBAAkB,CAC/CV,qCAAYA,GAAK,CAAExB,aAAYC,mBAC/BM,OAAQiB,EAAMjB,SAEfwB,EAAQI,EAAqBA,sBAC5BL,EAAUM,QACVZ,EAAMa,WACN,EAEFC,SAAWd,UACVM,EAAUS,YAAiBC,OAAAC,OAAAD,OAAAC,OAAA,CAAA,EAAAjB,IAAOxB,aAAYC,qBAC9B,QAAXyC,EAAAlB,EAAMb,aAAK,IAAA+B,OAAA,EAAAA,EAAEC,SAIlBZ,EAAMa,OACNb,EAAMc,eAAerB,EAAMa,aAJ1BN,EAAMe,MAI+B,EAEvCC,UAAYvB,YACX,MAAwB,WAApBA,EAAMwB,MAAMC,KACflB,EAAMe,QACC,GAE2C,QAA5CI,EAAsB,QAAtBR,EAACZ,EAAUqB,WAAW,IAAAT,OAAA,EAAAA,EAAEK,UAAUvB,UAAU,IAAA0B,GAAAA,CAAK,EAEzDE,OAAQA,KACPrB,EAAMsB,UACNvB,EAAUuB,SAAS,EAEpB,IAIL,GAEF"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";function e(r){var a;if(r.nodeType===Node.TEXT_NODE)return null!==(a=r.textContent)&&void 0!==a?a:"";if(r.nodeType!==Node.ELEMENT_NODE)return"";const
|
|
1
|
+
"use strict";function e(r){var a,n,s;if(r.nodeType===Node.TEXT_NODE)return null!==(a=r.textContent)&&void 0!==a?a:"";if(r.nodeType!==Node.ELEMENT_NODE)return"";const c=r,t=c.tagName.toLowerCase(),i=function(r){return Array.from(r.childNodes).map(e).join("")}(c);switch(t){case"strong":case"b":return i?`*${i}*`:"";case"em":case"i":case"s":case"del":case"strike":case"code":case"pre":case"a":case"ul":case"ol":case"body":default:return i;case"br":return"\n";case"p":case"div":return 1===c.childNodes.length&&"br"===(null===(s=null===(n=c.firstChild)||void 0===n?void 0:n.tagName)||void 0===s?void 0:s.toLowerCase())?"\n":i?`${i}\n`:"\n";case"h1":case"h2":case"h3":case"h4":case"h5":case"h6":return i?`*${i}*\n`:"\n";case"li":return`• ${i.trimEnd()}\n`;case"blockquote":return i+"\n"}}Object.defineProperty(exports,"__esModule",{value:!0}),exports.toLiveChatText=function(r){if(!r)return"";if("undefined"!=typeof document){return e((new DOMParser).parseFromString(r,"text/html").body).trim()}return function(e){return e.replace(/<strong[^>]*>([\s\S]*?)<\/strong>/gi,"*$1*").replace(/<b[^>]*>([\s\S]*?)<\/b>/gi,"*$1*").replace(/<em[^>]*>([\s\S]*?)<\/em>/gi,"$1").replace(/<i[^>]*>([\s\S]*?)<\/i>/gi,"$1").replace(/<s[^>]*>([\s\S]*?)<\/s>/gi,"$1").replace(/<del[^>]*>([\s\S]*?)<\/del>/gi,"$1").replace(/<a[^>]*>([\s\S]*?)<\/a>/gi,"$1").replace(/<p[^>]*>\s*<br\s*\/?>\s*<\/p>/gi,"\n").replace(/<br\s*\/?>/gi,"\n").replace(/<\/p>/gi,"\n").replace(/<\/div>/gi,"\n").replace(/<\/h[1-6]>/gi,"\n").replace(/<li[^>]*>/gi,"• ").replace(/<\/li>/gi,"\n").replace(/<[^>]+>/g,"").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/ /g," ").trim()}(r)};
|
|
2
2
|
//# sourceMappingURL=toLiveChatText.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toLiveChatText.js","sources":["../../../../src/editor/serializers/toLiveChatText.ts"],"sourcesContent":["/**\n * Converts TipTap HTML to LiveChat plain text.\n *\n * LiveChat supports **bold** (`*text*`) but NOT italic or strikethrough.\n * Italic and strikethrough marks are stripped — the inner text is preserved.\n * Links emit only the display text (href is dropped).\n *\n * @example\n * const { html } = ref.current?.getContent();\n * const lcText = toLiveChatText(html);\n * sendLiveChat({ text: lcText });\n */\nexport function toLiveChatText(html: string): string {\n\tif (!html) return '';\n\n\tif (typeof document !== 'undefined') {\n\t\tconst doc = new DOMParser().parseFromString(html, 'text/html');\n\t\treturn serializeNode(doc.body)
|
|
1
|
+
{"version":3,"file":"toLiveChatText.js","sources":["../../../../src/editor/serializers/toLiveChatText.ts"],"sourcesContent":["/**\n * Converts TipTap HTML to LiveChat plain text.\n *\n * LiveChat supports **bold** (`*text*`) but NOT italic or strikethrough.\n * Italic and strikethrough marks are stripped — the inner text is preserved.\n * Links emit only the display text (href is dropped).\n *\n * @example\n * const { html } = ref.current?.getContent();\n * const lcText = toLiveChatText(html);\n * sendLiveChat({ text: lcText });\n */\nexport function toLiveChatText(html: string): string {\n\tif (!html) return '';\n\n\tif (typeof document !== 'undefined') {\n\t\tconst doc = new DOMParser().parseFromString(html, 'text/html');\n\t\treturn serializeNode(doc.body).trim();\n\t}\n\n\treturn ssrFallback(html);\n}\n\n// ---------------------------------------------------------------------------\n// Browser path — DOM-based, handles nested marks correctly\n// ---------------------------------------------------------------------------\n\nfunction serializeNode(node: Node): string {\n\tif (node.nodeType === Node.TEXT_NODE) return node.textContent ?? '';\n\tif (node.nodeType !== Node.ELEMENT_NODE) return '';\n\n\tconst el = node as Element;\n\tconst tag = el.tagName.toLowerCase();\n\tconst inner = serializeChildren(el);\n\n\tswitch (tag) {\n\t\tcase 'strong':\n\t\tcase 'b':\n\t\t\treturn inner ? `*${inner}*` : '';\n\n\t\t// Italic and strike: strip marks, keep inner text\n\t\tcase 'em':\n\t\tcase 'i':\n\t\tcase 's':\n\t\tcase 'del':\n\t\tcase 'strike':\n\t\t\treturn inner;\n\n\t\tcase 'code':\n\t\tcase 'pre':\n\t\t\treturn inner;\n\n\t\tcase 'a':\n\t\t\t// LiveChat does not support hyperlinks — emit display text only\n\t\t\treturn inner;\n\n\t\tcase 'br':\n\t\t\treturn '\\n';\n\n\t\tcase 'p':\n\t\tcase 'div': {\n\t\t\tconst isBlankLine =\n\t\t\t\tel.childNodes.length === 1 &&\n\t\t\t\t(el.firstChild as Element)?.tagName?.toLowerCase() === 'br';\n\t\t\treturn isBlankLine ? '\\n' : inner ? `${inner}\\n` : '\\n';\n\t\t}\n\n\t\tcase 'h1':\n\t\tcase 'h2':\n\t\tcase 'h3':\n\t\tcase 'h4':\n\t\tcase 'h5':\n\t\tcase 'h6':\n\t\t\treturn inner ? `*${inner}*\\n` : '\\n';\n\n\t\tcase 'ul':\n\t\tcase 'ol':\n\t\t\treturn inner;\n\n\t\tcase 'li':\n\t\t\treturn `• ${inner.trimEnd()}\\n`;\n\n\t\tcase 'blockquote':\n\t\t\treturn inner + '\\n';\n\n\t\tcase 'body':\n\t\tdefault:\n\t\t\treturn inner;\n\t}\n}\n\nfunction serializeChildren(el: Element): string {\n\treturn Array.from(el.childNodes).map(serializeNode).join('');\n}\n\n// ---------------------------------------------------------------------------\n// SSR / Node.js fallback — regex-based, best-effort for simple markup\n// ---------------------------------------------------------------------------\n\nfunction ssrFallback(html: string): string {\n\treturn html\n\t\t.replace(/<strong[^>]*>([\\s\\S]*?)<\\/strong>/gi, '*$1*')\n\t\t.replace(/<b[^>]*>([\\s\\S]*?)<\\/b>/gi, '*$1*')\n\t\t.replace(/<em[^>]*>([\\s\\S]*?)<\\/em>/gi, '$1')\n\t\t.replace(/<i[^>]*>([\\s\\S]*?)<\\/i>/gi, '$1')\n\t\t.replace(/<s[^>]*>([\\s\\S]*?)<\\/s>/gi, '$1')\n\t\t.replace(/<del[^>]*>([\\s\\S]*?)<\\/del>/gi, '$1')\n\t\t.replace(/<a[^>]*>([\\s\\S]*?)<\\/a>/gi, '$1')\n\t\t.replace(/<p[^>]*>\\s*<br\\s*\\/?>\\s*<\\/p>/gi, '\\n')\n\t\t.replace(/<br\\s*\\/?>/gi, '\\n')\n\t\t.replace(/<\\/p>/gi, '\\n')\n\t\t.replace(/<\\/div>/gi, '\\n')\n\t\t.replace(/<\\/h[1-6]>/gi, '\\n')\n\t\t.replace(/<li[^>]*>/gi, '• ')\n\t\t.replace(/<\\/li>/gi, '\\n')\n\t\t.replace(/<[^>]+>/g, '')\n\t\t.replace(/&/g, '&')\n\t\t.replace(/</g, '<')\n\t\t.replace(/>/g, '>')\n\t\t.replace(/ /g, ' ')\n\t\t.trim();\n}\n"],"names":["serializeNode","node","nodeType","Node","TEXT_NODE","textContent","_a","ELEMENT_NODE","el","tag","tagName","toLowerCase","inner","Array","from","childNodes","map","join","serializeChildren","length","_c","_b","firstChild","trimEnd","html","document","DOMParser","parseFromString","body","trim","replace","ssrFallback"],"mappings":"aA2BA,SAASA,EAAcC,aACtB,GAAIA,EAAKC,WAAaC,KAAKC,UAAW,OAAuB,UAAhBH,EAAKI,mBAAW,IAAAC,EAAAA,EAAI,GACjE,GAAIL,EAAKC,WAAaC,KAAKI,aAAc,MAAO,GAEhD,MAAMC,EAAKP,EACLQ,EAAMD,EAAGE,QAAQC,cACjBC,EA0DP,SAA2BJ,GAC1B,OAAOK,MAAMC,KAAKN,EAAGO,YAAYC,IAAIhB,GAAeiB,KAAK,GAC1D,CA5DeC,CAAkBV,GAEhC,OAAQC,GACP,IAAK,SACL,IAAK,IACJ,OAAOG,EAAQ,IAAIA,KAAW,GAG/B,IAAK,KACL,IAAK,IACL,IAAK,IACL,IAAK,MACL,IAAK,SAGL,IAAK,OACL,IAAK,MAGL,IAAK,IAuBL,IAAK,KACL,IAAK,KASL,IAAK,OACL,QACC,OAAOA,EA/BR,IAAK,KACJ,MAAO,KAER,IAAK,IACL,IAAK,MAIJ,OAF0B,IAAzBJ,EAAGO,WAAWI,QACyC,QAApB,QAAnCC,EAA0B,QAA1BC,EAACb,EAAGc,kBAAsB,IAAAD,OAAA,EAAAA,EAAEX,eAAO,IAAAU,OAAA,EAAAA,EAAET,eACjB,KAAOC,KAAWA,MAAY,KAGpD,IAAK,KACL,IAAK,KACL,IAAK,KACL,IAAK,KACL,IAAK,KACL,IAAK,KACJ,OAAOA,EAAQ,IAAIA,OAAa,KAMjC,IAAK,KACJ,WAAYA,EAAMW,cAEnB,IAAK,aACJ,OAAOX,EAAQ,KAMlB,+EA7EM,SAAyBY,GAC9B,IAAKA,EAAM,MAAO,GAElB,GAAwB,oBAAbC,SAA0B,CAEpC,OAAOzB,GADK,IAAI0B,WAAYC,gBAAgBH,EAAM,aACzBI,MAAMC,MAC/B,CAED,OA+ED,SAAqBL,GACpB,OAAOA,EACLM,QAAQ,sCAAuC,QAC/CA,QAAQ,4BAA6B,QACrCA,QAAQ,8BAA+B,MACvCA,QAAQ,4BAA6B,MACrCA,QAAQ,4BAA6B,MACrCA,QAAQ,gCAAiC,MACzCA,QAAQ,4BAA6B,MACrCA,QAAQ,kCAAmC,MAC3CA,QAAQ,eAAgB,MACxBA,QAAQ,UAAW,MACnBA,QAAQ,YAAa,MACrBA,QAAQ,eAAgB,MACxBA,QAAQ,cAAe,MACvBA,QAAQ,WAAY,MACpBA,QAAQ,WAAY,IACpBA,QAAQ,SAAU,KAClBA,QAAQ,QAAS,KACjBA,QAAQ,QAAS,KACjBA,QAAQ,UAAW,KACnBD,MACH,CArGQE,CAAYP,EACpB"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";function e(r){var n,t;if(r.nodeType===Node.TEXT_NODE)return null!==(n=r.textContent)&&void 0!==n?n:"";if(r.nodeType!==Node.ELEMENT_NODE)return"";const
|
|
1
|
+
"use strict";function e(r){var n,a,t;if(r.nodeType===Node.TEXT_NODE)return null!==(n=r.textContent)&&void 0!==n?n:"";if(r.nodeType!==Node.ELEMENT_NODE)return"";const s=r,c=s.tagName.toLowerCase(),i=function(r){return Array.from(r.childNodes).map(e).join("")}(s);switch(c){case"strong":case"b":return i?`*${i}*`:"";case"em":case"i":return i?`_${i}_`:"";case"s":case"del":case"strike":return i?`~${i}~`:"";case"code":return i?`\`${i}\``:"";case"pre":return i?`\`\`\`${i}\`\`\``:"";case"a":case"ul":case"ol":case"body":default:return i;case"br":return"\n";case"p":case"div":return 1===s.childNodes.length&&"br"===(null===(t=null===(a=s.firstChild)||void 0===a?void 0:a.tagName)||void 0===t?void 0:t.toLowerCase())?"\n":i?`${i}\n`:"\n";case"h1":case"h2":case"h3":case"h4":case"h5":case"h6":return i?`*${i}*\n`:"\n";case"li":return`• ${i.trimEnd()}\n`;case"blockquote":return i.split("\n").map((e=>e?`> ${e}`:"")).join("\n")+"\n"}}Object.defineProperty(exports,"__esModule",{value:!0}),exports.toWhatsAppText=function(r){if(!r)return"";if("undefined"!=typeof document){return e((new DOMParser).parseFromString(r,"text/html").body).trim()}return function(e){return e.replace(/<strong[^>]*>([\s\S]*?)<\/strong>/gi,"*$1*").replace(/<b[^>]*>([\s\S]*?)<\/b>/gi,"*$1*").replace(/<em[^>]*>([\s\S]*?)<\/em>/gi,"_$1_").replace(/<i[^>]*>([\s\S]*?)<\/i>/gi,"_$1_").replace(/<s[^>]*>([\s\S]*?)<\/s>/gi,"~$1~").replace(/<del[^>]*>([\s\S]*?)<\/del>/gi,"~$1~").replace(/<code[^>]*>([\s\S]*?)<\/code>/gi,"`$1`").replace(/<a[^>]*>([\s\S]*?)<\/a>/gi,"$1").replace(/<p[^>]*>\s*<br\s*\/?>\s*<\/p>/gi,"\n").replace(/<br\s*\/?>/gi,"\n").replace(/<\/p>/gi,"\n").replace(/<\/div>/gi,"\n").replace(/<\/h[1-6]>/gi,"\n").replace(/<li[^>]*>/gi,"• ").replace(/<\/li>/gi,"\n").replace(/<[^>]+>/g,"").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/ /g," ").trim()}(r)};
|
|
2
2
|
//# sourceMappingURL=toWhatsAppText.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toWhatsAppText.js","sources":["../../../../src/editor/serializers/toWhatsAppText.ts"],"sourcesContent":["/**\n * Converts TipTap HTML to WhatsApp-flavoured markdown text.\n *\n * WhatsApp formatting:\n * *bold* _italic_ ~strikethrough~ ```monospace```\n *\n * Links: WhatsApp does not support
|
|
1
|
+
{"version":3,"file":"toWhatsAppText.js","sources":["../../../../src/editor/serializers/toWhatsAppText.ts"],"sourcesContent":["/**\n * Converts TipTap HTML to WhatsApp-flavoured markdown text.\n *\n * WhatsApp formatting:\n * *bold* _italic_ ~strikethrough~ ```monospace```\n *\n * Links: WhatsApp does not support hyperlinks.\n * <a href=\"https://…\">Visit us</a> → Visit us (display text kept, href dropped)\n *\n * @example\n * const { html } = ref.current?.getContent();\n * const waText = toWhatsAppText(html);\n * sendWhatsApp({ text: waText });\n */\nexport function toWhatsAppText(html: string): string {\n\tif (!html) return '';\n\n\tif (typeof document !== 'undefined') {\n\t\tconst doc = new DOMParser().parseFromString(html, 'text/html');\n\t\treturn serializeNode(doc.body).trim();\n\t}\n\n\t// SSR / Node.js fallback — handles simple non-nested markup\n\treturn ssrFallback(html);\n}\n\n// ---------------------------------------------------------------------------\n// Browser path — DOM-based, handles nested marks correctly\n// ---------------------------------------------------------------------------\n\nfunction serializeNode(node: Node): string {\n\tif (node.nodeType === Node.TEXT_NODE) {\n\t\treturn node.textContent ?? '';\n\t}\n\tif (node.nodeType !== Node.ELEMENT_NODE) return '';\n\n\tconst el = node as Element;\n\tconst tag = el.tagName.toLowerCase();\n\tconst inner = serializeChildren(el);\n\n\tswitch (tag) {\n\t\tcase 'strong':\n\t\tcase 'b':\n\t\t\treturn inner ? `*${inner}*` : '';\n\n\t\tcase 'em':\n\t\tcase 'i':\n\t\t\treturn inner ? `_${inner}_` : '';\n\n\t\tcase 's':\n\t\tcase 'del':\n\t\tcase 'strike':\n\t\t\treturn inner ? `~${inner}~` : '';\n\n\t\tcase 'code':\n\t\t\treturn inner ? `\\`${inner}\\`` : '';\n\n\t\tcase 'pre':\n\t\t\treturn inner ? `\\`\\`\\`${inner}\\`\\`\\`` : '';\n\n\t\tcase 'a':\n\t\t\treturn inner;\n\n\t\tcase 'br':\n\t\t\treturn '\\n';\n\n\t\tcase 'p':\n\t\tcase 'div': {\n\t\t\tconst isBlankLine =\n\t\t\t\tel.childNodes.length === 1 &&\n\t\t\t\t(el.firstChild as Element)?.tagName?.toLowerCase() === 'br';\n\t\t\treturn isBlankLine ? '\\n' : inner ? `${inner}\\n` : '\\n';\n\t\t}\n\n\t\tcase 'h1':\n\t\tcase 'h2':\n\t\tcase 'h3':\n\t\tcase 'h4':\n\t\tcase 'h5':\n\t\tcase 'h6':\n\t\t\treturn inner ? `*${inner}*\\n` : '\\n';\n\n\t\tcase 'ul':\n\t\tcase 'ol':\n\t\t\treturn inner;\n\n\t\tcase 'li':\n\t\t\treturn `• ${inner.trimEnd()}\\n`;\n\n\t\tcase 'blockquote':\n\t\t\treturn (\n\t\t\t\tinner\n\t\t\t\t\t.split('\\n')\n\t\t\t\t\t.map((l) => (l ? `> ${l}` : ''))\n\t\t\t\t\t.join('\\n') + '\\n'\n\t\t\t);\n\n\t\tcase 'body':\n\t\tdefault:\n\t\t\treturn inner;\n\t}\n}\n\nfunction serializeChildren(el: Element): string {\n\treturn Array.from(el.childNodes).map(serializeNode).join('');\n}\n\n// ---------------------------------------------------------------------------\n// SSR fallback — regex-based, best-effort for simple markup\n// ---------------------------------------------------------------------------\n\nfunction ssrFallback(html: string): string {\n\treturn html\n\t\t.replace(/<strong[^>]*>([\\s\\S]*?)<\\/strong>/gi, '*$1*')\n\t\t.replace(/<b[^>]*>([\\s\\S]*?)<\\/b>/gi, '*$1*')\n\t\t.replace(/<em[^>]*>([\\s\\S]*?)<\\/em>/gi, '_$1_')\n\t\t.replace(/<i[^>]*>([\\s\\S]*?)<\\/i>/gi, '_$1_')\n\t\t.replace(/<s[^>]*>([\\s\\S]*?)<\\/s>/gi, '~$1~')\n\t\t.replace(/<del[^>]*>([\\s\\S]*?)<\\/del>/gi, '~$1~')\n\t\t.replace(/<code[^>]*>([\\s\\S]*?)<\\/code>/gi, '`$1`')\n\t\t.replace(/<a[^>]*>([\\s\\S]*?)<\\/a>/gi, '$1')\n\t\t.replace(/<p[^>]*>\\s*<br\\s*\\/?>\\s*<\\/p>/gi, '\\n')\n\t\t.replace(/<br\\s*\\/?>/gi, '\\n')\n\t\t.replace(/<\\/p>/gi, '\\n')\n\t\t.replace(/<\\/div>/gi, '\\n')\n\t\t.replace(/<\\/h[1-6]>/gi, '\\n')\n\t\t.replace(/<li[^>]*>/gi, '• ')\n\t\t.replace(/<\\/li>/gi, '\\n')\n\t\t.replace(/<[^>]+>/g, '')\n\t\t.replace(/&/g, '&')\n\t\t.replace(/</g, '<')\n\t\t.replace(/>/g, '>')\n\t\t.replace(/ /g, ' ')\n\t\t.trim();\n}\n"],"names":["serializeNode","node","nodeType","Node","TEXT_NODE","textContent","_a","ELEMENT_NODE","el","tag","tagName","toLowerCase","inner","Array","from","childNodes","map","join","serializeChildren","length","_c","_b","firstChild","trimEnd","split","l","html","document","DOMParser","parseFromString","body","trim","replace","ssrFallback"],"mappings":"aA8BA,SAASA,EAAcC,aACtB,GAAIA,EAAKC,WAAaC,KAAKC,UAC1B,OAAuB,UAAhBH,EAAKI,mBAAW,IAAAC,EAAAA,EAAI,GAE5B,GAAIL,EAAKC,WAAaC,KAAKI,aAAc,MAAO,GAEhD,MAAMC,EAAKP,EACLQ,EAAMD,EAAGE,QAAQC,cACjBC,EAiEP,SAA2BJ,GAC1B,OAAOK,MAAMC,KAAKN,EAAGO,YAAYC,IAAIhB,GAAeiB,KAAK,GAC1D,CAnEeC,CAAkBV,GAEhC,OAAQC,GACP,IAAK,SACL,IAAK,IACJ,OAAOG,EAAQ,IAAIA,KAAW,GAE/B,IAAK,KACL,IAAK,IACJ,OAAOA,EAAQ,IAAIA,KAAW,GAE/B,IAAK,IACL,IAAK,MACL,IAAK,SACJ,OAAOA,EAAQ,IAAIA,KAAW,GAE/B,IAAK,OACJ,OAAOA,EAAQ,KAAKA,MAAY,GAEjC,IAAK,MACJ,OAAOA,EAAQ,SAASA,UAAgB,GAEzC,IAAK,IAsBL,IAAK,KACL,IAAK,KAcL,IAAK,OACL,QACC,OAAOA,EApCR,IAAK,KACJ,MAAO,KAER,IAAK,IACL,IAAK,MAIJ,OAF0B,IAAzBJ,EAAGO,WAAWI,QACyC,QAApB,QAAnCC,EAA0B,QAA1BC,EAACb,EAAGc,kBAAsB,IAAAD,OAAA,EAAAA,EAAEX,eAAO,IAAAU,OAAA,EAAAA,EAAET,eACjB,KAAOC,KAAWA,MAAY,KAGpD,IAAK,KACL,IAAK,KACL,IAAK,KACL,IAAK,KACL,IAAK,KACL,IAAK,KACJ,OAAOA,EAAQ,IAAIA,OAAa,KAMjC,IAAK,KACJ,WAAYA,EAAMW,cAEnB,IAAK,aACJ,OACCX,EACEY,MAAM,MACNR,KAAKS,GAAOA,EAAI,KAAKA,IAAM,KAC3BR,KAAK,MAAQ,KAOnB,+EAvFM,SAAyBS,GAC9B,IAAKA,EAAM,MAAO,GAElB,GAAwB,oBAAbC,SAA0B,CAEpC,OAAO3B,GADK,IAAI4B,WAAYC,gBAAgBH,EAAM,aACzBI,MAAMC,MAC/B,CAGD,OAwFD,SAAqBL,GACpB,OAAOA,EACLM,QAAQ,sCAAuC,QAC/CA,QAAQ,4BAA6B,QACrCA,QAAQ,8BAA+B,QACvCA,QAAQ,4BAA6B,QACrCA,QAAQ,4BAA6B,QACrCA,QAAQ,gCAAiC,QACzCA,QAAQ,kCAAmC,QAC3CA,QAAQ,4BAA6B,MACrCA,QAAQ,kCAAmC,MAC3CA,QAAQ,eAAgB,MACxBA,QAAQ,UAAW,MACnBA,QAAQ,YAAa,MACrBA,QAAQ,eAAgB,MACxBA,QAAQ,cAAe,MACvBA,QAAQ,WAAY,MACpBA,QAAQ,WAAY,IACpBA,QAAQ,SAAU,KAClBA,QAAQ,QAAS,KACjBA,QAAQ,QAAS,KACjBA,QAAQ,UAAW,KACnBD,MACH,CA/GQE,CAAYP,EACpB"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { QueryBuilderNodeProps } from "../../../
|
|
2
|
+
import { QueryBuilderNodeProps } from "../../../Types/QueryBuilderNodeProps.type";
|
|
3
3
|
declare const EventsTrigger: React.FC<QueryBuilderNodeProps>;
|
|
4
4
|
export default EventsTrigger;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { QueryBuilderAPIData } from "../../../
|
|
1
|
+
import { QueryBuilderAPIData } from "../../../Types/QueryBuilderAPI.type";
|
|
2
2
|
export declare const useIGTriggerNameCacheSelector: () => QueryBuilderAPIData[];
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { QueryBuilderNodeProps } from "../../../
|
|
2
|
+
import { QueryBuilderNodeProps } from "../../../Types/QueryBuilderNodeProps.type";
|
|
3
3
|
declare const IGTrigger: React.FC<QueryBuilderNodeProps>;
|
|
4
4
|
export default IGTrigger;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { QueryBuilderAPIData } from "../../../
|
|
1
|
+
import { QueryBuilderAPIData } from "../../../Types/QueryBuilderAPI.type";
|
|
2
2
|
export declare const useIGTriggerNameCacheSelector: () => QueryBuilderAPIData[];
|
package/dist/cjs/src/components/QueryBuilder/Triggers/components/BaseTriggerQueryBuilderNode.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { DropdownOption } from "../../../dropdown/type";
|
|
3
|
-
import { QueryBuilderProperty } from "../../
|
|
4
|
-
import { QueryBuilderNodeProps } from "../../
|
|
3
|
+
import { QueryBuilderProperty } from "../../Types/QueryBuilder.type";
|
|
4
|
+
import { QueryBuilderNodeProps } from "../../Types/QueryBuilderNodeProps.type";
|
|
5
5
|
declare const BaseTriggerQueryBuilderNode: React.FC<QueryBuilderNodeProps & {
|
|
6
6
|
cacheKey: string;
|
|
7
7
|
propertyAddBtnText: string;
|
|
@@ -3,18 +3,23 @@ import { EditorSnapshot, FormatState } from './BikEditor.types';
|
|
|
3
3
|
/**
|
|
4
4
|
* Normalise HTML before passing it to TipTap.
|
|
5
5
|
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
* 1× line height. The WA text output is unchanged (`\n` either way after
|
|
15
|
-
* surrounding-newline collapse in `toWhatsAppText`).
|
|
6
|
+
* 1. Strip all `<span>` tags first (keeps inner content). This exposes
|
|
7
|
+
* bare `<br>` inside otherwise-empty paragraphs like Quill's
|
|
8
|
+
* `<p><span class="ql-cursor"><br></span></p>`.
|
|
9
|
+
* 2. Then convert `<p><br></p>` → `<p></p>`. ProseMirror parses `<p></p>`
|
|
10
|
+
* as an empty paragraph node and adds its own DOM `<br>` for cursor
|
|
11
|
+
* positioning — one blank line, correct height. Leaving the `<br>`
|
|
12
|
+
* would create a `hard_break` child AND the cursor `<br>`, producing
|
|
13
|
+
* double-height blank lines.
|
|
16
14
|
*/
|
|
17
15
|
export declare function normalizeHtml(html: string): string;
|
|
16
|
+
/**
|
|
17
|
+
* Convert ProseMirror's `<p></p>` empty paragraphs to the universally
|
|
18
|
+
* rendered `<p><br></p>` format before the HTML leaves the editor.
|
|
19
|
+
* Email clients, chat bubbles, and every renderer understand `<p><br></p>`
|
|
20
|
+
* as a visible blank line, whereas `<p></p>` collapses to zero height.
|
|
21
|
+
*/
|
|
22
|
+
export declare function toPortableHtml(html: string): string;
|
|
18
23
|
/**
|
|
19
24
|
* Insert HTML at the current cursor position, merging the first paragraph
|
|
20
25
|
* inline while preserving the block structure of subsequent paragraphs/lists.
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Extension } from '@tiptap/core';
|
|
2
|
+
/**
|
|
3
|
+
* Lightweight paste normalizer for rich-paste editors (email).
|
|
4
|
+
* Fixes Google Docs' standalone `<br>` between paragraphs and collapses
|
|
5
|
+
* consecutive empty paragraphs — but keeps ALL formatting marks intact.
|
|
6
|
+
*/
|
|
7
|
+
export declare const ClipboardNormalizationExtension: Extension<any, any>;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Fragment } from '@tiptap/pm/model';
|
|
2
|
+
export declare const TEXTBLOCK_TAGS: Set<string>;
|
|
3
|
+
export declare const BLOCK_SELECTOR = "p,div,h1,h2,h3,h4,h5,h6,ul,ol,li,blockquote,table,pre";
|
|
4
|
+
/**
|
|
5
|
+
* Replace `<br>` elements that sit at block level (not inside a textblock
|
|
6
|
+
* like `<p>`, `<li>`, etc.) with empty `<p></p>` elements. Google Docs
|
|
7
|
+
* puts standalone `<br>` tags between paragraphs to represent blank lines.
|
|
8
|
+
* Without this, ProseMirror parses them as top-level hardBreak nodes.
|
|
9
|
+
*/
|
|
10
|
+
export declare function cleanBlockBrs(container: HTMLElement): void;
|
|
11
|
+
/**
|
|
12
|
+
* 1. Convert paragraphs containing only a hard_break into empty paragraphs.
|
|
13
|
+
* 2. Collapse consecutive empty paragraphs into one.
|
|
14
|
+
*/
|
|
15
|
+
export declare function normalizeBlanks(fragment: Fragment): Fragment;
|
|
16
|
+
/**
|
|
17
|
+
* Strip only "rich" marks (link, textStyle, highlight, etc.) while keeping
|
|
18
|
+
* basic formatting marks (bold, italic, strike, underline, code) that
|
|
19
|
+
* messaging channels can represent.
|
|
20
|
+
*/
|
|
21
|
+
export declare function stripRichMarks(fragment: Fragment): Fragment;
|
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
* WhatsApp formatting:
|
|
5
5
|
* *bold* _italic_ ~strikethrough~ ```monospace```
|
|
6
6
|
*
|
|
7
|
-
* Links: WhatsApp does not support
|
|
8
|
-
* <a href="https://…">Visit us</a> →
|
|
7
|
+
* Links: WhatsApp does not support hyperlinks.
|
|
8
|
+
* <a href="https://…">Visit us</a> → Visit us (display text kept, href dropped)
|
|
9
9
|
*
|
|
10
10
|
* @example
|
|
11
11
|
* const { html } = ref.current?.getContent();
|