@bikdotai/bik-component-library 0.0.788-beta.0 → 0.0.788-beta.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (27) hide show
  1. package/dist/cjs/editor/BikEditor.js +1 -1
  2. package/dist/cjs/editor/BikEditor.styles.js +11 -3
  3. package/dist/cjs/editor/BikEditor.utils.js +1 -1
  4. package/dist/cjs/editor/extensions/buildExtensions.js +1 -1
  5. package/dist/cjs/editor/extensions/editorDropdown.styles.js +15 -18
  6. package/dist/cjs/editor/extensions/mention/MentionDropdown.js +1 -1
  7. package/dist/cjs/editor/extensions/sectionDivider/SectionDividerNode.js +1 -1
  8. package/dist/cjs/editor/extensions/slashCommand/SlashCommandMenu.js +1 -1
  9. package/dist/cjs/editor/serializers/toLiveChatText.js +1 -1
  10. package/dist/cjs/editor/serializers/toWhatsAppText.js +1 -1
  11. package/dist/cjs/src/components/bik-layout/MockMenus.d.ts +1 -0
  12. package/dist/cjs/src/editor/BikEditor.types.d.ts +27 -0
  13. package/dist/cjs/src/editor/BikEditor.utils.d.ts +15 -0
  14. package/dist/esm/editor/BikEditor.js +1 -1
  15. package/dist/esm/editor/BikEditor.styles.js +11 -3
  16. package/dist/esm/editor/BikEditor.utils.js +1 -1
  17. package/dist/esm/editor/extensions/buildExtensions.js +1 -1
  18. package/dist/esm/editor/extensions/editorDropdown.styles.js +11 -14
  19. package/dist/esm/editor/extensions/mention/MentionDropdown.js +1 -1
  20. package/dist/esm/editor/extensions/sectionDivider/SectionDividerNode.js +1 -1
  21. package/dist/esm/editor/extensions/slashCommand/SlashCommandMenu.js +1 -1
  22. package/dist/esm/editor/serializers/toLiveChatText.js +1 -1
  23. package/dist/esm/editor/serializers/toWhatsAppText.js +1 -1
  24. package/dist/esm/src/components/bik-layout/MockMenus.d.ts +1 -0
  25. package/dist/esm/src/editor/BikEditor.types.d.ts +27 -0
  26. package/dist/esm/src/editor/BikEditor.utils.d.ts +15 -0
  27. package/package.json +1 -1
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),n=require("../node_modules/@tiptap/core/dist/index.js"),t=require("@tiptap/react"),o=require("react"),i=require("./BikEditor.styles.js"),r=require("./BikEditor.utils.js"),l=require("./extensions/buildExtensions.js"),s=require("./floating/LinkBubbleMenu.js");function d(e){return Object.entries(e).map((e=>{let[n,t]=e;return`${n.replace(/([A-Z])/g,(e=>`-${e.toLowerCase()}`))}:${t}`})).join(";")}const u=(u,c)=>{var a;const{initialContent:m,sections:g,features:v,disabled:h,maxCharacters:f,shortcuts:C,sendShortcut:S,mentions:k,slashCommands:x,link:p,onPaste:B,onChange:b,onSend:y,onFocus:A,onBlur:E,onSelectionChange:j,minHeight:L,maxHeight:F,style:I,className:M,editorClassName:q,editorStyle:H}=u,P=(null==g?void 0:g.length)?r.buildSectionedContent(null!=m?m:"",g):null!=m?m:"",w=t.useEditor({extensions:l.buildExtensions({features:v,placeholder:u.placeholder,maxCharacters:f,hasSections:(null!==(a=null==g?void 0:g.length)&&void 0!==a?a:0)>0,mentions:{agents:null==k?void 0:k.agents,teams:null==k?void 0:k.teams},slashCommands:null==x?void 0:x.items,onPaste:B,onSend:y,sendShortcut:S,shortcuts:C,onMentionSelected:null==k?void 0:k.onSelect,onSlashCommandSelected:null==x?void 0:x.onSelect,renderMentionItem:null==k?void 0:k.renderItem,renderMentionDropdown:null==k?void 0:k.renderDropdown,renderSlashCommandItem:null==x?void 0:x.renderItem,renderSlashCommandDropdown:null==x?void 0:x.renderDropdown}),content:P,editable:!h,immediatelyRender:!1,editorProps:{attributes:Object.assign(Object.assign({},q?{class:q}:{}),H?{style:d(H)}:{})},onUpdate:e=>{let{editor:n}=e;return null==b?void 0:b(r.extractContent(n))},onSelectionUpdate:e=>{let{editor:n}=e;return null==j?void 0:j(r.extractActiveFormats(n))},onFocus:()=>null==A?void 0:A(),onBlur:()=>null==E?void 0:E()});return o.useImperativeHandle(c,(()=>({focus:()=>null==w?void 0:w.commands.focus(),blur:()=>null==w?void 0:w.commands.blur(),clearContent:()=>null==w?void 0:w.commands.clearContent(!0),setContent:e=>null==w?void 0:w.commands.setContent(e,{emitUpdate:!0}),insertContent:e=>null==w?void 0:w.commands.insertContent(e),insertAtStart:e=>{w&&w.commands.insertContentAt(1,e)},insertAtEnd:e=>{w&&w.commands.insertContentAt(w.state.doc.content.size,e)},appendContent:e=>{w&&w.commands.insertContentAt(w.state.doc.content.size-1,e)},getContent:()=>r.extractContent(w),getCursorPosition:()=>{const{from:e,to:n}=w.state.selection;return{from:e,to:n}},insertAtPosition:(e,n)=>{w&&w.commands.insertContentAt(e,n)},getSelectedText:()=>{const{state:e}=w,{from:t,to:o,empty:i}=e.selection;if(!i)return e.doc.textBetween(t,o," ");const r=e.schema.marks.link;if(r){const o=n.getMarkRange(e.doc.resolve(t),r);if(o)return e.doc.textBetween(o.from,o.to," ")}return""},getCharacterCount:()=>{var e,n,t,o;return{count:null!==(o=null!==(t=null===(n=null===(e=null==w?void 0:w.storage.characterCount)||void 0===e?void 0:e.characters)||void 0===n?void 0:n.call(e))&&void 0!==t?t:null==w?void 0:w.getText().length)&&void 0!==o?o:0,limit:null!=f?f:null}},getSectionContent:e=>r.extractSectionContent(w,e),setSectionContent:(e,n)=>{w&&r.setSectionContentInEditor(w,e,n)},focusSection:e=>{if(!w)return;if("body"===e)return void w.chain().focus().setTextSelection(1).run();let n=-1;w.state.doc.descendants(((t,o)=>{if(-1!==n)return!1;"sectionDivider"===t.type.name&&t.attrs.sectionId===e&&(n=o+t.nodeSize+1)})),-1!==n&&w.chain().focus().setTextSelection(n).run()},clearSection:e=>{w&&r.setSectionContentInEditor(w,e,"<p></p>")},getBodyContent:()=>r.extractBodyContent(w),setBodyContent:e=>{w&&r.setSectionContentInEditor(w,"body",e)},appendBodyContent:e=>{if(!w)return;const n=r.findSectionEndPos(w,"body");w.commands.insertContentAt(n-1,e)},insertAtSectionStart:(e,n)=>{if(!w)return;const t=r.findSectionStartPos(w,e);-1!==t&&w.commands.insertContentAt(t,n)},insertAtSectionEnd:(e,n)=>{if(!w)return;const t=r.findSectionEndPos(w,e);w.commands.insertContentAt(t,n)},getActiveFormats:()=>r.extractActiveFormats(w),actions:{toggleBold:()=>null==w?void 0:w.chain().focus().toggleBold().run(),toggleItalic:()=>null==w?void 0:w.chain().focus().toggleItalic().run(),toggleUnderline:()=>null==w?void 0:w.chain().focus().toggleUnderline().run(),toggleStrike:()=>null==w?void 0:w.chain().focus().toggleStrike().run(),toggleBulletList:()=>null==w?void 0:w.chain().focus().toggleBulletList().run(),toggleOrderedList:()=>null==w?void 0:w.chain().focus().toggleOrderedList().run(),toggleBlockquote:()=>null==w?void 0:w.chain().focus().toggleBlockquote().run(),toggleCodeBlock:()=>null==w?void 0:w.chain().focus().toggleCodeBlock().run(),setTextAlign:e=>null==w?void 0:w.chain().focus().setTextAlign(e).run(),setFontFamily:e=>null==w?void 0:w.chain().focus().setFontFamily(e).run(),setFontSize:e=>null==w?void 0:w.chain().focus().setFontSize(e).run(),setColor:e=>null==w?void 0:w.chain().focus().setColor(e).run(),setHighlight:e=>null==w?void 0:w.chain().focus().toggleHighlight({color:e}).run(),unsetColor:()=>null==w?void 0:w.chain().focus().unsetColor().run(),unsetHighlight:()=>null==w?void 0:w.chain().focus().unsetHighlight().run(),setLink:(e,n)=>{w&&(void 0!==n?w.chain().focus().extendMarkRange("link").command((t=>{let{tr:o,state:i}=t;const{from:r,to:l}=o.selection,s=i.schema.marks.link;return!!s&&(o.replaceWith(r,l,i.schema.text(n,[s.create({href:e})])),!0)})).run():w.chain().focus().extendMarkRange("link").setLink({href:e}).run())},updateLink:e=>null==w?void 0:w.chain().focus().extendMarkRange("link").setLink({href:e}).run(),removeLink:()=>null==w?void 0:w.chain().focus().extendMarkRange("link").unsetLink().run(),insertEmoji:e=>null==w?void 0:w.chain().focus().insertContent(e).run(),insertVariable:e=>null==w?void 0:w.chain().focus().insertContent(`{{${e}}}`).run(),insertHtml:e=>null==w?void 0:w.commands.insertContent(e),undo:()=>null==w?void 0:w.chain().focus().undo().run(),redo:()=>null==w?void 0:w.chain().focus().redo().run(),canUndo:()=>{var e;return null!==(e=null==w?void 0:w.can().undo())&&void 0!==e&&e},canRedo:()=>{var e;return null!==(e=null==w?void 0:w.can().redo())&&void 0!==e&&e}}})),[w]),w?e.jsxs(i.BikEditorShell,Object.assign({minHeight:L,maxHeight:F,style:I,className:M},{children:[e.jsx(t.EditorContent,{editor:w}),e.jsx(s.LinkBubbleMenu,{editor:w,renderLinkTooltip:null==p?void 0:p.renderTooltip})]})):null},c=o.forwardRef(u);c.displayName="BikEditor",exports.BikEditor=c;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var n=require("react/jsx-runtime"),t=require("../node_modules/@tiptap/core/dist/index.js"),e=require("@tiptap/react"),o=require("react"),i=require("./BikEditor.styles.js"),l=require("./BikEditor.utils.js"),r=require("./extensions/buildExtensions.js"),s=require("./floating/LinkBubbleMenu.js");function d(n){return Object.entries(n).map((n=>{let[t,e]=n;return`${t.replace(/([A-Z])/g,(n=>`-${n.toLowerCase()}`))}:${e}`})).join(";")}const a=(a,c)=>{var u;const{initialContent:m,sections:g,features:v,disabled:h,maxCharacters:C,shortcuts:f,sendShortcut:S,mentions:p,slashCommands:x,link:k,onPaste:H,onChange:b,onSend:B,onFocus:y,onBlur:z,onSelectionChange:A,minHeight:j,maxHeight:E,style:L,className:F,editorClassName:I,editorStyle:M}=a,q=(null==g?void 0:g.length)?l.buildSectionedContent(l.normalizeHtml(null!=m?m:""),g.map((n=>Object.assign(Object.assign({},n),{content:l.normalizeHtml(n.content)})))):l.normalizeHtml(null!=m?m:""),O=e.useEditor({extensions:r.buildExtensions({features:v,placeholder:a.placeholder,maxCharacters:C,hasSections:(null!==(u=null==g?void 0:g.length)&&void 0!==u?u:0)>0,mentions:{agents:null==p?void 0:p.agents,teams:null==p?void 0:p.teams},slashCommands:null==x?void 0:x.items,onPaste:H,onSend:B,sendShortcut:S,shortcuts:f,onMentionSelected:null==p?void 0:p.onSelect,onSlashCommandSelected:null==x?void 0:x.onSelect,renderMentionItem:null==p?void 0:p.renderItem,renderMentionDropdown:null==p?void 0:p.renderDropdown,renderSlashCommandItem:null==x?void 0:x.renderItem,renderSlashCommandDropdown:null==x?void 0:x.renderDropdown}),content:q,editable:!h,immediatelyRender:!1,editorProps:{attributes:Object.assign(Object.assign({},I?{class:I}:{}),M?{style:d(M)}:{})},onUpdate:n=>{let{editor:t}=n;return null==b?void 0:b(l.extractContent(t))},onSelectionUpdate:n=>{let{editor:t}=n;return null==A?void 0:A(l.extractActiveFormats(t))},onFocus:()=>null==y?void 0:y(),onBlur:()=>null==z?void 0:z()});return o.useImperativeHandle(c,(()=>({focus:()=>null==O?void 0:O.commands.focus(),blur:()=>null==O?void 0:O.commands.blur(),clearContent:()=>null==O?void 0:O.commands.clearContent(!0),setContent:n=>null==O?void 0:O.commands.setContent(l.normalizeHtml(n),{emitUpdate:!0}),insertContent:n=>null==O?void 0:O.commands.insertContent(l.normalizeHtml(n)),insertAtStart:n=>{O&&O.commands.insertContentAt(1,l.normalizeHtml(n))},insertAtEnd:n=>{O&&O.commands.insertContentAt(O.state.doc.content.size,l.normalizeHtml(n))},appendContent:n=>{O&&O.commands.insertContentAt(O.state.doc.content.size-1,l.normalizeHtml(n))},getContent:()=>O?l.extractContent(O):{html:"",text:"",isEmpty:!0,characterCount:0},getCursorPosition:()=>{const{from:n,to:t}=O.state.selection;return{from:n,to:t}},insertAtPosition:(n,t)=>{O&&O.commands.insertContentAt(n,t)},getSelectedText:()=>{const{state:n}=O,{from:e,to:o,empty:i}=n.selection;if(!i)return n.doc.textBetween(e,o," ");const l=n.schema.marks.link;if(l){const o=t.getMarkRange(n.doc.resolve(e),l);if(o)return n.doc.textBetween(o.from,o.to," ")}return""},getCharacterCount:()=>{var n,t,e,o;return{count:null!==(o=null!==(e=null===(t=null===(n=null==O?void 0:O.storage.characterCount)||void 0===n?void 0:n.characters)||void 0===t?void 0:t.call(n))&&void 0!==e?e:null==O?void 0:O.getText().length)&&void 0!==o?o:0,limit:null!=C?C:null}},getSectionContent:n=>l.extractSectionContent(O,n),setSectionContent:(n,t)=>{O&&l.setSectionContentInEditor(O,n,l.normalizeHtml(t))},focusSection:n=>{if(!O)return;if("body"===n)return void O.chain().focus().setTextSelection(1).run();let t=-1;O.state.doc.descendants(((e,o)=>{if(-1!==t)return!1;"sectionDivider"===e.type.name&&e.attrs.sectionId===n&&(t=o+e.nodeSize+1)})),-1!==t&&O.chain().focus().setTextSelection(t).run()},clearSection:n=>{O&&l.setSectionContentInEditor(O,n,"<p></p>")},getBodyContent:()=>l.extractBodyContent(O),setBodyContent:n=>{O&&l.setSectionContentInEditor(O,"body",l.normalizeHtml(n))},setBodyAndSections:(n,t)=>{if(!O)return;const e=l.buildSectionedContent(l.normalizeHtml(n),t.map((n=>({id:n.id,content:l.normalizeHtml(n.content)}))));O.commands.setContent(e,{emitUpdate:!0})},appendBodyContent:n=>{if(!O)return;const t=l.normalizeHtml(n),e=l.findSectionEndPos(O,"body");O.commands.insertContentAt(e-1,t)},insertAtSectionStart:(n,t)=>{if(!O)return;const e=l.findSectionStartPos(O,n);-1!==e&&O.commands.insertContentAt(e,l.normalizeHtml(t))},insertAtSectionEnd:(n,t)=>{if(!O)return;const e=l.findSectionEndPos(O,n);O.commands.insertContentAt(e,l.normalizeHtml(t))},getActiveFormats:()=>l.extractActiveFormats(O),actions:{toggleBold:()=>null==O?void 0:O.chain().focus().toggleBold().run(),toggleItalic:()=>null==O?void 0:O.chain().focus().toggleItalic().run(),toggleUnderline:()=>null==O?void 0:O.chain().focus().toggleUnderline().run(),toggleStrike:()=>null==O?void 0:O.chain().focus().toggleStrike().run(),toggleBulletList:()=>null==O?void 0:O.chain().focus().toggleBulletList().run(),toggleOrderedList:()=>null==O?void 0:O.chain().focus().toggleOrderedList().run(),toggleBlockquote:()=>null==O?void 0:O.chain().focus().toggleBlockquote().run(),toggleCodeBlock:()=>null==O?void 0:O.chain().focus().toggleCodeBlock().run(),setTextAlign:n=>null==O?void 0:O.chain().focus().setTextAlign(n).run(),setFontFamily:n=>null==O?void 0:O.chain().focus().setFontFamily(n).run(),setFontSize:n=>null==O?void 0:O.chain().focus().setFontSize(n).run(),setColor:n=>null==O?void 0:O.chain().focus().setColor(n).run(),setHighlight:n=>null==O?void 0:O.chain().focus().toggleHighlight({color:n}).run(),unsetColor:()=>null==O?void 0:O.chain().focus().unsetColor().run(),unsetHighlight:()=>null==O?void 0:O.chain().focus().unsetHighlight().run(),setLink:(n,t)=>{O&&(void 0!==t?O.chain().focus().extendMarkRange("link").command((e=>{let{tr:o,state:i}=e;const{from:l,to:r}=o.selection,s=i.schema.marks.link;return!!s&&(o.replaceWith(l,r,i.schema.text(t,[s.create({href:n})])),!0)})).run():O.chain().focus().extendMarkRange("link").setLink({href:n}).run())},updateLink:n=>null==O?void 0:O.chain().focus().extendMarkRange("link").setLink({href:n}).run(),removeLink:()=>null==O?void 0:O.chain().focus().extendMarkRange("link").unsetLink().run(),insertEmoji:n=>null==O?void 0:O.chain().focus().insertContent(n).run(),insertVariable:n=>null==O?void 0:O.chain().focus().insertContent(`{{${n}}}`).run(),insertHtml:n=>null==O?void 0:O.commands.insertContent(n),undo:()=>null==O?void 0:O.chain().focus().undo().run(),redo:()=>null==O?void 0:O.chain().focus().redo().run(),canUndo:()=>{var n;return null!==(n=null==O?void 0:O.can().undo())&&void 0!==n&&n},canRedo:()=>{var n;return null!==(n=null==O?void 0:O.can().redo())&&void 0!==n&&n}}})),[O]),O?n.jsxs(i.BikEditorShell,Object.assign({minHeight:j,maxHeight:E,style:L,className:F},{children:[n.jsx(e.EditorContent,{editor:O}),n.jsx(s.LinkBubbleMenu,{editor:O,renderLinkTooltip:null==k?void 0:k.renderTooltip})]})):null},c=o.forwardRef(a);c.displayName="BikEditor",exports.BikEditor=c;
@@ -14,12 +14,20 @@
14
14
 
15
15
  p {
16
16
  margin: 0;
17
+ padding: 0;
17
18
  }
18
- p + p {
19
- margin-top: 4px;
19
+
20
+ ul,
21
+ ol {
22
+ margin: 0;
23
+ padding-left: 1.5em;
24
+ }
25
+
26
+ li + li {
27
+ margin-top: 2px;
20
28
  }
21
29
 
22
- &.is-editor-empty::before {
30
+ p.is-editor-empty:first-child::before {
23
31
  content: attr(data-placeholder);
24
32
  float: left;
25
33
  color: #adb5bd;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});const t=t=>`<div data-section-divider="${t}" style="display:none;height:0;line-height:0;overflow:hidden;"></div>`;function e(e,n){let i=e;for(const e of n)i+=t(e.id)+e.content;return i}function n(t){return i(t.getHTML())}function i(t){const e=new Map,n=/<div[^>]*data-(?:section-divider="([^"]*)"|signature-divider|forwarded-divider)[^>]*>\s*<\/div>/g,i=[];let o;for(;null!==(o=n.exec(t));){let t=o[1];t||(t=o[0].includes("data-signature-divider")?"signature":"forwarded"),i.push({id:t,index:o.index,endIndex:o.index+o[0].length})}if(0===i.length)return e.set("body",t),e;e.set("body",t.slice(0,i[0].index));for(let n=0;n<i.length;n++){const o=i[n].endIndex,r=n+1<i.length?i[n+1].index:t.length;e.set(i[n].id,t.slice(o,r))}return e}function o(t,e){var i;return function(t){var e;const n="undefined"!=typeof document?document.createElement("div"):null;n&&(n.innerHTML=t);const i=null!==(e=null==n?void 0:n.textContent)&&void 0!==e?e:"";return{html:t,text:i,isEmpty:!i.trim(),characterCount:i.length}}(null!==(i=n(t).get(e))&&void 0!==i?i:"")}exports.SECTION_DIVIDER_HTML=t,exports.buildSectionedContent=e,exports.extractActiveFormats=function(t){var e,n,i,o,r;return{bold:t.isActive("bold"),italic:t.isActive("italic"),underline:t.isActive("underline"),strike:t.isActive("strike"),bulletList:t.isActive("bulletList"),orderedList:t.isActive("orderedList"),blockquote:t.isActive("blockquote"),codeBlock:t.isActive("codeBlock"),link:t.isActive("link")?{href:null!==(e=t.getAttributes("link").href)&&void 0!==e?e:""}:null,textAlign:t.isActive({textAlign:"center"})?"center":t.isActive({textAlign:"right"})?"right":t.isActive({textAlign:"justify"})?"justify":"left",fontFamily:null!==(n=t.getAttributes("textStyle").fontFamily)&&void 0!==n?n:null,fontSize:null!==(i=t.getAttributes("textStyle").fontSize)&&void 0!==i?i:null,color:null!==(o=t.getAttributes("textStyle").color)&&void 0!==o?o:null,highlight:t.isActive("highlight")?null!==(r=t.getAttributes("highlight").color)&&void 0!==r?r:"default":null}},exports.extractAllSections=n,exports.extractAllSectionsFromHtml=i,exports.extractBodyContent=function(t){return o(t,"body")},exports.extractContent=function(t){var e,n,i;return{html:t.getHTML(),text:t.getText(),isEmpty:t.isEmpty,characterCount:null!==(i=null===(n=null===(e=t.storage.characterCount)||void 0===e?void 0:e.characters)||void 0===n?void 0:n.call(e))&&void 0!==i?i:t.getText().length}},exports.extractSectionContent=o,exports.findSectionEndPos=function(t,e){const n=t.state.doc,i=n.content.size;if("body"===e){let t=-1;return n.descendants(((e,n)=>{if(-1!==t)return!1;"sectionDivider"===e.type.name&&(t=n)})),-1!==t?t:i}let o=!1,r=-1;return n.descendants(((t,n)=>-1===r&&(o?void("sectionDivider"===t.type.name&&(r=n)):("sectionDivider"===t.type.name&&t.attrs.sectionId===e&&(o=!0),!1)))),-1!==r?r:i},exports.findSectionStartPos=function(t,e){if("body"===e)return 1;let n=-1;return t.state.doc.descendants(((t,i)=>{if(-1!==n)return!1;"sectionDivider"===t.type.name&&t.attrs.sectionId===e&&(n=i+t.nodeSize)})),n},exports.setSectionContentInEditor=function(t,i,o){var r;const l=n(t);l.set(i,o);const d=e(null!==(r=l.get("body"))&&void 0!==r?r:"",[...l.entries()].filter((t=>{let[e]=t;return"body"!==e})).map((t=>{let[e,n]=t;return{id:e,content:n}})));t.commands.setContent(d,{emitUpdate:!1})};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});const t=t=>`<div data-section-divider="${t}" style="display:none;height:0;line-height:0;overflow:hidden;"></div>`;function e(e,n){let i=e;for(const e of n)i+=t(e.id)+e.content;return i}function n(t){return i(t.getHTML())}function i(t){const e=new Map,n=/<div[^>]*data-section-divider="([^"]*)[^>]*>\s*<\/div>/g,i=[];let o;for(;null!==(o=n.exec(t));)i.push({id:o[1],index:o.index,endIndex:o.index+o[0].length});if(0===i.length)return e.set("body",t),e;e.set("body",t.slice(0,i[0].index));for(let n=0;n<i.length;n++){const o=i[n].endIndex,r=n+1<i.length?i[n+1].index:t.length;e.set(i[n].id,t.slice(o,r))}return e}function o(t,e){var i;return function(t){var e;const n="undefined"!=typeof document?document.createElement("div"):null;n&&(n.innerHTML=t);const i=null!==(e=null==n?void 0:n.textContent)&&void 0!==e?e:"";return{html:t,text:i,isEmpty:!i.trim(),characterCount:i.length}}(null!==(i=n(t).get(e))&&void 0!==i?i:"")}exports.SECTION_DIVIDER_HTML=t,exports.buildSectionedContent=e,exports.extractActiveFormats=function(t){var e,n,i,o,r;return{bold:t.isActive("bold"),italic:t.isActive("italic"),underline:t.isActive("underline"),strike:t.isActive("strike"),bulletList:t.isActive("bulletList"),orderedList:t.isActive("orderedList"),blockquote:t.isActive("blockquote"),codeBlock:t.isActive("codeBlock"),link:t.isActive("link")?{href:null!==(e=t.getAttributes("link").href)&&void 0!==e?e:""}:null,textAlign:t.isActive({textAlign:"center"})?"center":t.isActive({textAlign:"right"})?"right":t.isActive({textAlign:"justify"})?"justify":"left",fontFamily:null!==(n=t.getAttributes("textStyle").fontFamily)&&void 0!==n?n:null,fontSize:null!==(i=t.getAttributes("textStyle").fontSize)&&void 0!==i?i:null,color:null!==(o=t.getAttributes("textStyle").color)&&void 0!==o?o:null,highlight:t.isActive("highlight")?null!==(r=t.getAttributes("highlight").color)&&void 0!==r?r:"default":null}},exports.extractAllSections=n,exports.extractAllSectionsFromHtml=i,exports.extractBodyContent=function(t){return o(t,"body")},exports.extractContent=function(t){var e,n,i;return{html:t.getHTML(),text:t.getText(),isEmpty:t.isEmpty,characterCount:null!==(i=null===(n=null===(e=t.storage.characterCount)||void 0===e?void 0:e.characters)||void 0===n?void 0:n.call(e))&&void 0!==i?i:t.getText().length}},exports.extractSectionContent=o,exports.findSectionEndPos=function(t,e){const n=t.state.doc,i=n.content.size;if("body"===e){let t=-1;return n.descendants(((e,n)=>{if(-1!==t)return!1;"sectionDivider"===e.type.name&&(t=n)})),-1!==t?t:i}let o=!1,r=-1;return n.descendants(((t,n)=>-1===r&&(o?void("sectionDivider"===t.type.name&&(r=n)):("sectionDivider"===t.type.name&&t.attrs.sectionId===e&&(o=!0),!1)))),-1!==r?r:i},exports.findSectionStartPos=function(t,e){if("body"===e)return 1;let n=-1;return t.state.doc.descendants(((t,i)=>{if(-1!==n)return!1;"sectionDivider"===t.type.name&&t.attrs.sectionId===e&&(n=i+t.nodeSize)})),n},exports.normalizeHtml=function(t){return t.replace(/<p>\s*<br\s*\/?>\s*<\/p>/gi,"<p></p>")},exports.setSectionContentInEditor=function(t,i,o){var r;const l=n(t);l.set(i,o);const s=e(null!==(r=l.get("body"))&&void 0!==r?r:"",[...l.entries()].filter((t=>{let[e]=t;return"body"!==e})).map((t=>{let[e,n]=t;return{id:e,content:n}})));t.commands.setContent(s,{emitUpdate:!1})};
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@tiptap/extension-character-count"),n=require("@tiptap/extension-color"),t=require("@tiptap/extension-font-family"),i=require("@tiptap/extension-highlight"),o=require("@tiptap/extension-image"),r=require("@tiptap/extension-link"),a=require("@tiptap/extension-placeholder"),s=require("@tiptap/extension-subscript"),l=require("@tiptap/extension-superscript"),u=require("@tiptap/extension-text-align"),d=require("@tiptap/extension-text-style"),p=require("@tiptap/extension-underline"),c=require("@tiptap/starter-kit"),x=require("./FontSizeExtension.js"),m=require("./mention/MentionExtension.js"),h=require("./paste/PasteExtension.js"),f=require("./plainClipboard/PlainClipboardExtension.js"),v=require("./sectionDivider/SectionDividerNode.js"),S=require("./sendShortcut/SendShortcutExtension.js"),g=require("./slashCommand/SlashCommandExtension.js"),q=require("./variable/VariableDecorationExtension.js");function E(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var b=E(e),C=E(n),M=E(t),P=E(i),j=E(o),y=E(r),k=E(a),D=E(s),T=E(l),I=E(u),w=E(p),O=E(c);exports.buildExtensions=function(e){var n,t,i,o,r,a,s,l,u,p,c;const E=null!==(t=null===(n=e.features)||void 0===n?void 0:n.richPaste)&&void 0!==t&&t,z=null!==(o=null===(i=e.features)||void 0===i?void 0:i.richTypography)&&void 0!==o&&o;return[...[O.default.configure({link:!1,underline:!1}),w.default,y.default.extend({addPasteRules:()=>[],addInputRules:()=>[]}).configure({openOnClick:!1,autolink:!1,linkOnPaste:!1,HTMLAttributes:{rel:"noopener noreferrer",class:"bik-link"}}),d.TextStyle,k.default.configure({placeholder:null!==(r=e.placeholder)&&void 0!==r?r:"Type a message..."}),...e.onPaste?[h.PasteExtension.configure({onPaste:e.onPaste})]:[],...E?[]:[f.PlainClipboardExtension],S.SendShortcutExtension.configure({onSend:e.onSend,sendShortcut:e.sendShortcut,extraShortcuts:null!==(a=e.shortcuts)&&void 0!==a?a:[]}),q.VariableDecorationExtension,...e.maxCharacters?[b.default.configure({limit:e.maxCharacters})]:[],...e.hasSections?[v.SectionDividerNode]:[]],...[...(null===(l=null===(s=e.mentions)||void 0===s?void 0:s.agents)||void 0===l?void 0:l.length)?[m.buildAgentMentionExtension(e.mentions.agents,e.onMentionSelected,e.renderMentionItem,e.renderMentionDropdown)]:[],...(null===(p=null===(u=e.mentions)||void 0===u?void 0:u.teams)||void 0===p?void 0:p.length)?[m.buildTeamMentionExtension(e.mentions.teams,e.onMentionSelected,e.renderMentionItem,e.renderMentionDropdown)]:[],...(null===(c=e.slashCommands)||void 0===c?void 0:c.length)?[g.buildSlashCommandExtension(e.slashCommands,e.onSlashCommandSelected,e.renderSlashCommandItem,e.renderSlashCommandDropdown)]:[]],...z?[C.default,P.default.configure({multicolor:!0}),M.default,x.FontSizeExtension,I.default.configure({types:["heading","paragraph"]}),D.default,T.default,j.default]:[C.default]]};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@tiptap/extension-character-count"),n=require("@tiptap/extension-color"),t=require("@tiptap/extension-font-family"),i=require("@tiptap/extension-highlight"),o=require("@tiptap/extension-image"),r=require("@tiptap/extension-link"),a=require("@tiptap/extension-placeholder"),l=require("@tiptap/extension-subscript"),s=require("@tiptap/extension-superscript"),d=require("@tiptap/extension-text-align"),u=require("@tiptap/extension-text-style"),p=require("@tiptap/extension-underline"),c=require("@tiptap/starter-kit"),x=require("./FontSizeExtension.js"),m=require("./mention/MentionExtension.js"),f=require("./paste/PasteExtension.js"),h=require("./plainClipboard/PlainClipboardExtension.js"),v=require("./sectionDivider/SectionDividerNode.js"),S=require("./sendShortcut/SendShortcutExtension.js"),g=require("./slashCommand/SlashCommandExtension.js"),q=require("./variable/VariableDecorationExtension.js");function b(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var E=b(e),C=b(n),M=b(t),k=b(i),P=b(o),j=b(r),y=b(a),D=b(l),T=b(s),w=b(d),I=b(p),O=b(c);exports.buildExtensions=function(e){var n,t,i,o,r,a,l,s,d,p,c,b;const z=null!==(t=null===(n=e.features)||void 0===n?void 0:n.richPaste)&&void 0!==t&&t,A=null!==(o=null===(i=e.features)||void 0===i?void 0:i.richTypography)&&void 0!==o&&o,F=null===(r=e.features)||void 0===r?void 0:r.allowedMarks,N=e=>!F||F.includes(e);return[...[O.default.configure({link:!1,underline:!1,bold:!!N("bold")&&{},italic:!!N("italic")&&{},strike:!!N("strike")&&{},code:!!N("code")&&{}}),...N("underline")?[I.default]:[],j.default.extend({addPasteRules:()=>[],addInputRules:()=>[]}).configure({openOnClick:!1,autolink:!1,linkOnPaste:!1,HTMLAttributes:{rel:"noopener noreferrer",class:"bik-link"}}),u.TextStyle,y.default.configure({placeholder:null!==(a=e.placeholder)&&void 0!==a?a:"Type a message..."}),...e.onPaste?[f.PasteExtension.configure({onPaste:e.onPaste})]:[],...z?[]:[h.PlainClipboardExtension],S.SendShortcutExtension.configure({onSend:e.onSend,sendShortcut:e.sendShortcut,extraShortcuts:null!==(l=e.shortcuts)&&void 0!==l?l:[]}),q.VariableDecorationExtension,...e.maxCharacters?[E.default.configure({limit:e.maxCharacters})]:[],v.SectionDividerNode],...[...(null===(d=null===(s=e.mentions)||void 0===s?void 0:s.agents)||void 0===d?void 0:d.length)?[m.buildAgentMentionExtension(e.mentions.agents,e.onMentionSelected,e.renderMentionItem,e.renderMentionDropdown)]:[],...(null===(c=null===(p=e.mentions)||void 0===p?void 0:p.teams)||void 0===c?void 0:c.length)?[m.buildTeamMentionExtension(e.mentions.teams,e.onMentionSelected,e.renderMentionItem,e.renderMentionDropdown)]:[],...(null===(b=e.slashCommands)||void 0===b?void 0:b.length)?[g.buildSlashCommandExtension(e.slashCommands,e.onSlashCommandSelected,e.renderSlashCommandItem,e.renderSlashCommandDropdown)]:[]],...A?[C.default,k.default.configure({multicolor:!0}),M.default,x.FontSizeExtension,w.default.configure({types:["heading","paragraph"]}),D.default,T.default,P.default]:[C.default]]};
@@ -1,27 +1,24 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("styled-components"),r=require("../../constants/Theme.js");function t(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var o=t(e);const n=o.default.div`
2
- background: ${r.COLORS.surface.standard};
3
- border: 1px solid ${r.COLORS.stroke.primary};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("styled-components"),t=require("../../constants/Theme.js");function r(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var o=r(e);const n=o.default.div`
2
+ background: ${t.COLORS.surface.standard};
3
+ border: 1px solid ${t.COLORS.stroke.primary};
4
4
  border-radius: 8px;
5
5
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
6
6
  padding: 4px;
7
- min-width: 180px;
7
+ min-width: 330px;
8
8
  max-height: 260px;
9
9
  overflow-y: auto;
10
10
  font-size: 14px;
11
- color: ${r.COLORS.content.primary};
11
+ color: ${t.COLORS.content.primary};
12
12
  `,a=o.default.div`
13
13
  display: flex;
14
14
  align-items: center;
15
15
  gap: 8px;
16
- padding: 6px 10px;
16
+ padding: 12px 16px;
17
+ min-height: 43px;
17
18
  border-radius: 6px;
18
19
  cursor: pointer;
19
- color: ${r.COLORS.content.primary};
20
- background: ${e=>{let{$isActive:t}=e;return t?r.COLORS.surface.hovered:"transparent"}};
21
-
22
- &:hover {
23
- background: ${r.COLORS.surface.hovered};
24
- }
20
+ color: ${t.COLORS.content.primary};
21
+ background: ${e=>{let{$isActive:r}=e;return r?t.COLORS.surface.hovered:"transparent"}};
25
22
  `,i=o.default.img`
26
23
  width: 24px;
27
24
  height: 24px;
@@ -30,19 +27,19 @@
30
27
  flex-shrink: 0;
31
28
  `,p=o.default.span`
32
29
  font-weight: 500;
33
- color: ${r.COLORS.content.primary};
30
+ color: ${t.COLORS.content.primary};
34
31
  `,s=o.default.span`
35
32
  width: 8px;
36
33
  height: 8px;
37
34
  border-radius: 50%;
38
- background: ${e=>{let{$online:t}=e;return t?r.COLORS.content.positive:r.COLORS.content.placeholder}};
35
+ background: ${e=>{let{$online:r}=e;return r?t.COLORS.content.positive:t.COLORS.content.placeholder}};
39
36
  margin-left: auto;
40
37
  flex-shrink: 0;
41
38
  `,d=o.default.span`
42
39
  font-weight: 500;
43
- color: ${r.COLORS.content.primary};
44
- `,c=o.default.span`
40
+ color: ${t.COLORS.content.primary};
41
+ `,l=o.default.span`
45
42
  font-size: 12px;
46
- color: ${r.COLORS.content.secondary};
43
+ color: ${t.COLORS.content.secondary};
47
44
  margin-left: auto;
48
- `;exports.DropdownContainer=n,exports.DropdownItem=a,exports.MentionAvatar=i,exports.MentionLabel=p,exports.MentionPresenceDot=s,exports.SlashDescription=c,exports.SlashLabel=d;
45
+ `;exports.DropdownContainer=n,exports.DropdownItem=a,exports.MentionAvatar=i,exports.MentionLabel=p,exports.MentionPresenceDot=s,exports.SlashDescription=l,exports.SlashLabel=d;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),n=require("react"),r=require("../editorDropdown.styles.js");const t=n.forwardRef(((t,o)=>{let{items:i,query:s,command:l,renderItem:a,renderDropdown:d}=t;const[c,u]=n.useState(0),p=e=>{i[e]&&l(i[e])};return n.useImperativeHandle(o,(()=>({onKeyDown:e=>{let{event:n}=e;return"ArrowUp"===n.key?(u((e=>(e+i.length-1)%i.length)),!0):"ArrowDown"===n.key?(u((e=>(e+1)%i.length)),!0):"Enter"===n.key&&(p(c),!0)}}))),n.useEffect((()=>u(0)),[i]),i.length?d?e.jsx(e.Fragment,{children:d({items:i,query:s,activeIndex:c,onSelect:e=>l(e)})}):e.jsx(r.DropdownContainer,{children:i.map(((n,t)=>e.jsx(r.DropdownItem,Object.assign({$isActive:t===c,onClick:()=>p(t)},{children:a?a(n,t===c):e.jsxs(e.Fragment,{children:[n.avatarUrl&&e.jsx(r.MentionAvatar,{src:n.avatarUrl,alt:""}),e.jsx(r.MentionLabel,{children:n.label}),void 0!==n.isOnline&&e.jsx(r.MentionPresenceDot,{$online:n.isOnline})]})}),n.id)))}):null}));t.displayName="MentionDropdown",exports.MentionDropdown=t;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),n=require("react"),r=require("../editorDropdown.styles.js");const t=n.forwardRef(((t,o)=>{let{items:i,query:s,command:l,renderItem:a,renderDropdown:d}=t;const[c,u]=n.useState(0),p=e=>{i[e]&&l(i[e])};return n.useImperativeHandle(o,(()=>({onKeyDown:e=>{let{event:n}=e;return"ArrowUp"===n.key?(u((e=>(e+i.length-1)%i.length)),!0):"ArrowDown"===n.key?(u((e=>(e+1)%i.length)),!0):"Enter"===n.key&&(p(c),!0)}}))),n.useEffect((()=>u(0)),[i]),i.length?d?e.jsx(e.Fragment,{children:d({items:i,query:s,activeIndex:c,onSelect:e=>l(e)})}):e.jsx(r.DropdownContainer,{children:i.map(((n,t)=>e.jsx(r.DropdownItem,Object.assign({$isActive:t===c,onMouseEnter:()=>u(t),onClick:()=>p(t)},{children:a?a(n,t===c):e.jsxs(e.Fragment,{children:[n.avatarUrl&&e.jsx(r.MentionAvatar,{src:n.avatarUrl,alt:""}),e.jsx(r.MentionLabel,{children:n.label}),void 0!==n.isOnline&&e.jsx(r.MentionPresenceDot,{$online:n.isOnline})]})}),n.id)))}):null}));t.displayName="MentionDropdown",exports.MentionDropdown=t;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../../node_modules/@tiptap/core/dist/index.js");const t=e.Node.create({name:"sectionDivider",group:"block",atom:!0,selectable:!1,draggable:!1,addAttributes:()=>({sectionId:{default:null}}),parseHTML:()=>[{tag:"div[data-section-divider]",getAttrs:e=>({sectionId:e.getAttribute("data-section-divider")})},{tag:"div[data-signature-divider]",getAttrs:()=>({sectionId:"signature"})},{tag:"div[data-forwarded-divider]",getAttrs:()=>({sectionId:"forwarded"})}],renderHTML(t){let{node:d,HTMLAttributes:i}=t;return["div",e.mergeAttributes(i,{"data-section-divider":d.attrs.sectionId,style:"display:none;height:0;line-height:0;overflow:hidden;"})]}});exports.SectionDividerNode=t;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../../node_modules/@tiptap/core/dist/index.js");const t=e.Node.create({name:"sectionDivider",group:"block",atom:!0,selectable:!1,draggable:!1,addAttributes:()=>({sectionId:{default:null,rendered:!1}}),parseHTML:()=>[{tag:"div[data-section-divider]",getAttrs:e=>({sectionId:e.getAttribute("data-section-divider")})},{tag:"div[data-signature-divider]",getAttrs:()=>({sectionId:"signature"})},{tag:"div[data-forwarded-divider]",getAttrs:()=>({sectionId:"forwarded"})}],renderHTML(t){let{node:d,HTMLAttributes:i}=t;return["div",e.mergeAttributes(i,{"data-section-divider":d.attrs.sectionId,style:"display:none;height:0;line-height:0;overflow:hidden;"})]}});exports.SectionDividerNode=t;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),r=require("react"),n=require("../editorDropdown.styles.js");const t=r.forwardRef(((t,s)=>{let{items:i,query:o,command:l,renderItem:a,renderDropdown:d}=t;const[c,u]=r.useState(0),m=e=>{i[e]&&l(i[e])};return r.useImperativeHandle(s,(()=>({onKeyDown:e=>{let{event:r}=e;return"ArrowUp"===r.key?(u((e=>(e+i.length-1)%i.length)),!0):"ArrowDown"===r.key?(u((e=>(e+1)%i.length)),!0):"Enter"===r.key&&(m(c),!0)}}))),r.useEffect((()=>u(0)),[i]),i.length?d?e.jsx(e.Fragment,{children:d({items:i,query:o,activeIndex:c,onSelect:e=>l(e)})}):e.jsx(n.DropdownContainer,{children:i.map(((r,t)=>e.jsx(n.DropdownItem,Object.assign({$isActive:t===c,onClick:()=>m(t)},{children:a?a(r,t===c):e.jsxs(e.Fragment,{children:[e.jsx(n.SlashLabel,{children:r.label}),r.description&&e.jsx(n.SlashDescription,{children:r.description})]})}),r.id)))}):null}));t.displayName="SlashCommandMenu",exports.SlashCommandMenu=t;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),r=require("react"),n=require("../editorDropdown.styles.js");const t=r.forwardRef(((t,s)=>{let{items:o,query:i,command:l,renderItem:a,renderDropdown:d}=t;const[c,u]=r.useState(0),m=e=>{o[e]&&l(o[e])};return r.useImperativeHandle(s,(()=>({onKeyDown:e=>{let{event:r}=e;return"ArrowUp"===r.key?(u((e=>(e+o.length-1)%o.length)),!0):"ArrowDown"===r.key?(u((e=>(e+1)%o.length)),!0):"Enter"===r.key&&(m(c),!0)}}))),r.useEffect((()=>u(0)),[o]),o.length?d?e.jsx(e.Fragment,{children:d({items:o,query:i,activeIndex:c,onSelect:e=>l(e)})}):e.jsx(n.DropdownContainer,{children:o.map(((r,t)=>e.jsx(n.DropdownItem,Object.assign({$isActive:t===c,onMouseEnter:()=>u(t),onClick:()=>m(t)},{children:a?a(r,t===c):e.jsxs(e.Fragment,{children:[e.jsx(n.SlashLabel,{children:r.label}),r.description&&e.jsx(n.SlashDescription,{children:r.description})]})}),r.id)))}):null}));t.displayName="SlashCommandMenu",exports.SlashCommandMenu=t;
@@ -1 +1 @@
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 n=r,c=n.tagName.toLowerCase(),s=function(r){return Array.from(r.childNodes).map(e).join("")}(n);switch(c){case"strong":case"b":return s?`*${s}*`:"";case"em":case"i":case"s":case"del":case"strike":case"code":case"pre":case"a":case"ul":case"ol":case"body":default:return s;case"br":return"\n";case"p":case"div":return s?`${s}\n`:"\n";case"h1":case"h2":case"h3":case"h4":case"h5":case"h6":return s?`*${s}*\n`:"\n";case"li":return`• ${s}\n`;case"blockquote":return s+"\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).replace(/\n{3,}/g,"\n\n").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(/<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(/&amp;/g,"&").replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&nbsp;/g," ").replace(/\n{3,}/g,"\n\n").trim()}(r)};
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 n=r,c=n.tagName.toLowerCase(),t=function(r){return Array.from(r.childNodes).map(e).join("")}(n);switch(c){case"strong":case"b":return t?`*${t}*`:"";case"em":case"i":case"s":case"del":case"strike":case"code":case"pre":case"a":case"ul":case"ol":case"body":default:return t;case"br":return"\n";case"p":case"div":return t?`${t}\n`:"\n";case"h1":case"h2":case"h3":case"h4":case"h5":case"h6":return t?`*${t}*\n`:"\n";case"li":return`• ${t.trimEnd()}\n`;case"blockquote":return t+"\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).replace(/\n{3,}/g,"\n\n").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(/<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(/&amp;/g,"&").replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&nbsp;/g," ").replace(/\n{3,}/g,"\n\n").trim()}(r)};
@@ -1 +1 @@
1
- "use strict";function e(r){var n,a;if(r.nodeType===Node.TEXT_NODE)return null!==(n=r.textContent)&&void 0!==n?n:"";if(r.nodeType!==Node.ELEMENT_NODE)return"";const t=r,c=t.tagName.toLowerCase(),s=function(r){return Array.from(r.childNodes).map(e).join("")}(t);switch(c){case"strong":case"b":return s?`*${s}*`:"";case"em":case"i":return s?`_${s}_`:"";case"s":case"del":case"strike":return s?`~${s}~`:"";case"code":return s?`\`${s}\``:"";case"pre":return s?`\`\`\`${s}\`\`\``:"";case"a":return(null!==(a=t.getAttribute("href"))&&void 0!==a?a:"")||s;case"br":return"\n";case"p":case"div":return s?`${s}\n`:"\n";case"h1":case"h2":case"h3":case"h4":case"h5":case"h6":return s?`*${s}*\n`:"\n";case"ul":case"ol":case"body":default:return s;case"li":return`• ${s}\n`;case"blockquote":return s.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).replace(/\n{3,}/g,"\n\n").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[^>]*href="([^"]*)"[^>]*>[\s\S]*?<\/a>/gi,"$1").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(/&amp;/g,"&").replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&nbsp;/g," ").replace(/\n{3,}/g,"\n\n").trim()}(r)};
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 a=r,c=a.tagName.toLowerCase(),s=function(r){return Array.from(r.childNodes).map(e).join("")}(a);switch(c){case"strong":case"b":return s?`*${s}*`:"";case"em":case"i":return s?`_${s}_`:"";case"s":case"del":case"strike":return s?`~${s}~`:"";case"code":return s?`\`${s}\``:"";case"pre":return s?`\`\`\`${s}\`\`\``:"";case"a":return(null!==(t=a.getAttribute("href"))&&void 0!==t?t:"")||s;case"br":return"\n";case"p":case"div":return s?`${s}\n`:"\n";case"h1":case"h2":case"h3":case"h4":case"h5":case"h6":return s?`*${s}*\n`:"\n";case"ul":case"ol":case"body":default:return s;case"li":return`• ${s.trimEnd()}\n`;case"blockquote":return s.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).replace(/\n{3,}/g,"\n\n").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[^>]*href="([^"]*)"[^>]*>[\s\S]*?<\/a>/gi,"$1").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(/&amp;/g,"&").replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&nbsp;/g," ").replace(/\n{3,}/g,"\n\n").trim()}(r)};
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  export declare const Menus: ({
2
3
  displayName: string;
3
4
  key: number;
@@ -26,6 +26,17 @@ export interface EditorFeatures {
26
26
  richPaste?: boolean;
27
27
  /** Enable font family, font size, text alignment, highlight, subscript, superscript, and image. Default: `false`. */
28
28
  richTypography?: boolean;
29
+ /**
30
+ * Restrict which inline marks are active in the editor.
31
+ * When set, only the listed marks are registered — all others are disabled
32
+ * (no rendering, no keyboard shortcuts, no paste preservation).
33
+ * Omit to allow all marks (default).
34
+ *
35
+ * @example
36
+ * // LiveChat: bold only, no italic / underline / strike
37
+ * features={{ allowedMarks: ['bold'] }}
38
+ */
39
+ allowedMarks?: Array<'bold' | 'italic' | 'strike' | 'underline' | 'code'>;
29
40
  }
30
41
  /**
31
42
  * A named content section placed below the main body, separated by an invisible divider.
@@ -478,6 +489,22 @@ export interface BikEditorRef {
478
489
  getBodyContent: () => EditorSnapshot;
479
490
  /** Shorthand for `setSectionContent('body', html)`. */
480
491
  setBodyContent: (html: string) => void;
492
+ /**
493
+ * Atomically sets the body AND all sections in a single editor update.
494
+ * Sections are laid out in the exact order supplied — use this instead of
495
+ * multiple `setSectionContent()` calls whenever order matters (e.g. forward
496
+ * mail where signature must appear before the forwarded thread).
497
+ *
498
+ * @example
499
+ * ref.current?.setBodyAndSections('<p></p>', [
500
+ * { id: 'signature', content: '<p>Alice</p>' },
501
+ * { id: 'forwarded', content: '<p>--- Forwarded ---</p>' },
502
+ * ]);
503
+ */
504
+ setBodyAndSections: (body: string, sections: Array<{
505
+ id: string;
506
+ content: string;
507
+ }>) => void;
481
508
  /**
482
509
  * Appends HTML to the end of the body section without moving the cursor.
483
510
  * Ideal for streaming AI-generated content — call repeatedly with each chunk.
@@ -1,5 +1,20 @@
1
1
  import { Editor } from '@tiptap/core';
2
2
  import { EditorSnapshot, FormatState } from './BikEditor.types';
3
+ /**
4
+ * Normalise HTML before passing it to TipTap.
5
+ *
6
+ * Problem: Quill uses `<p><br></p>` as a blank-line separator. TipTap's
7
+ * HardBreak extension parses that `<br>` as a real `hard_break` node.
8
+ * ProseMirror then also appends `<br class="ProseMirror-trailingBreak">` as a
9
+ * cursor-position decoration, making the empty paragraph render at **2× line
10
+ * height** instead of 1×.
11
+ *
12
+ * Fix: replace `<p><br></p>` → `<p></p>` so TipTap stores a truly empty
13
+ * paragraph. ProseMirror adds only the trailing decoration, giving the correct
14
+ * 1× line height. The WA text output is unchanged (`\n` either way after
15
+ * surrounding-newline collapse in `toWhatsAppText`).
16
+ */
17
+ export declare function normalizeHtml(html: string): string;
3
18
  export declare const SECTION_DIVIDER_HTML: (id: string) => string;
4
19
  /**
5
20
  * Build initial HTML for an editor with one or more named sections below the body.
@@ -1 +1 @@
1
- import{jsxs as n,jsx as t}from"react/jsx-runtime";import{getMarkRange as e}from"../node_modules/@tiptap/core/dist/index.js";import{useEditor as o,EditorContent as i}from"@tiptap/react";import{forwardRef as l,useImperativeHandle as r}from"react";import{BikEditorShell as s}from"./BikEditor.styles.js";import{buildSectionedContent as d,extractContent as u,extractActiveFormats as c,extractSectionContent as a,setSectionContentInEditor as m,extractBodyContent as g,findSectionEndPos as h,findSectionStartPos as v}from"./BikEditor.utils.js";import{buildExtensions as f}from"./extensions/buildExtensions.js";import{LinkBubbleMenu as C}from"./floating/LinkBubbleMenu.js";function p(n){return Object.entries(n).map((n=>{let[t,e]=n;return`${t.replace(/([A-Z])/g,(n=>`-${n.toLowerCase()}`))}:${e}`})).join(";")}const S=l(((l,S)=>{var k;const{initialContent:x,sections:B,features:y,disabled:b,maxCharacters:A,shortcuts:L,sendShortcut:j,mentions:F,slashCommands:H,link:M,onPaste:T,onChange:w,onSend:E,onFocus:I,onBlur:O,onSelectionChange:R,minHeight:U,maxHeight:z,style:D,className:P,editorClassName:N,editorStyle:$}=l,q=(null==B?void 0:B.length)?d(null!=x?x:"",B):null!=x?x:"",V=o({extensions:f({features:y,placeholder:l.placeholder,maxCharacters:A,hasSections:(null!==(k=null==B?void 0:B.length)&&void 0!==k?k:0)>0,mentions:{agents:null==F?void 0:F.agents,teams:null==F?void 0:F.teams},slashCommands:null==H?void 0:H.items,onPaste:T,onSend:E,sendShortcut:j,shortcuts:L,onMentionSelected:null==F?void 0:F.onSelect,onSlashCommandSelected:null==H?void 0:H.onSelect,renderMentionItem:null==F?void 0:F.renderItem,renderMentionDropdown:null==F?void 0:F.renderDropdown,renderSlashCommandItem:null==H?void 0:H.renderItem,renderSlashCommandDropdown:null==H?void 0:H.renderDropdown}),content:q,editable:!b,immediatelyRender:!1,editorProps:{attributes:Object.assign(Object.assign({},N?{class:N}:{}),$?{style:p($)}:{})},onUpdate:n=>{let{editor:t}=n;return null==w?void 0:w(u(t))},onSelectionUpdate:n=>{let{editor:t}=n;return null==R?void 0:R(c(t))},onFocus:()=>null==I?void 0:I(),onBlur:()=>null==O?void 0:O()});return r(S,(()=>({focus:()=>null==V?void 0:V.commands.focus(),blur:()=>null==V?void 0:V.commands.blur(),clearContent:()=>null==V?void 0:V.commands.clearContent(!0),setContent:n=>null==V?void 0:V.commands.setContent(n,{emitUpdate:!0}),insertContent:n=>null==V?void 0:V.commands.insertContent(n),insertAtStart:n=>{V&&V.commands.insertContentAt(1,n)},insertAtEnd:n=>{V&&V.commands.insertContentAt(V.state.doc.content.size,n)},appendContent:n=>{V&&V.commands.insertContentAt(V.state.doc.content.size-1,n)},getContent:()=>u(V),getCursorPosition:()=>{const{from:n,to:t}=V.state.selection;return{from:n,to:t}},insertAtPosition:(n,t)=>{V&&V.commands.insertContentAt(n,t)},getSelectedText:()=>{const{state:n}=V,{from:t,to:o,empty:i}=n.selection;if(!i)return n.doc.textBetween(t,o," ");const l=n.schema.marks.link;if(l){const o=e(n.doc.resolve(t),l);if(o)return n.doc.textBetween(o.from,o.to," ")}return""},getCharacterCount:()=>{var n,t,e,o;return{count:null!==(o=null!==(e=null===(t=null===(n=null==V?void 0:V.storage.characterCount)||void 0===n?void 0:n.characters)||void 0===t?void 0:t.call(n))&&void 0!==e?e:null==V?void 0:V.getText().length)&&void 0!==o?o:0,limit:null!=A?A:null}},getSectionContent:n=>a(V,n),setSectionContent:(n,t)=>{V&&m(V,n,t)},focusSection:n=>{if(!V)return;if("body"===n)return void V.chain().focus().setTextSelection(1).run();let t=-1;V.state.doc.descendants(((e,o)=>{if(-1!==t)return!1;"sectionDivider"===e.type.name&&e.attrs.sectionId===n&&(t=o+e.nodeSize+1)})),-1!==t&&V.chain().focus().setTextSelection(t).run()},clearSection:n=>{V&&m(V,n,"<p></p>")},getBodyContent:()=>g(V),setBodyContent:n=>{V&&m(V,"body",n)},appendBodyContent:n=>{if(!V)return;const t=h(V,"body");V.commands.insertContentAt(t-1,n)},insertAtSectionStart:(n,t)=>{if(!V)return;const e=v(V,n);-1!==e&&V.commands.insertContentAt(e,t)},insertAtSectionEnd:(n,t)=>{if(!V)return;const e=h(V,n);V.commands.insertContentAt(e,t)},getActiveFormats:()=>c(V),actions:{toggleBold:()=>null==V?void 0:V.chain().focus().toggleBold().run(),toggleItalic:()=>null==V?void 0:V.chain().focus().toggleItalic().run(),toggleUnderline:()=>null==V?void 0:V.chain().focus().toggleUnderline().run(),toggleStrike:()=>null==V?void 0:V.chain().focus().toggleStrike().run(),toggleBulletList:()=>null==V?void 0:V.chain().focus().toggleBulletList().run(),toggleOrderedList:()=>null==V?void 0:V.chain().focus().toggleOrderedList().run(),toggleBlockquote:()=>null==V?void 0:V.chain().focus().toggleBlockquote().run(),toggleCodeBlock:()=>null==V?void 0:V.chain().focus().toggleCodeBlock().run(),setTextAlign:n=>null==V?void 0:V.chain().focus().setTextAlign(n).run(),setFontFamily:n=>null==V?void 0:V.chain().focus().setFontFamily(n).run(),setFontSize:n=>null==V?void 0:V.chain().focus().setFontSize(n).run(),setColor:n=>null==V?void 0:V.chain().focus().setColor(n).run(),setHighlight:n=>null==V?void 0:V.chain().focus().toggleHighlight({color:n}).run(),unsetColor:()=>null==V?void 0:V.chain().focus().unsetColor().run(),unsetHighlight:()=>null==V?void 0:V.chain().focus().unsetHighlight().run(),setLink:(n,t)=>{V&&(void 0!==t?V.chain().focus().extendMarkRange("link").command((e=>{let{tr:o,state:i}=e;const{from:l,to:r}=o.selection,s=i.schema.marks.link;return!!s&&(o.replaceWith(l,r,i.schema.text(t,[s.create({href:n})])),!0)})).run():V.chain().focus().extendMarkRange("link").setLink({href:n}).run())},updateLink:n=>null==V?void 0:V.chain().focus().extendMarkRange("link").setLink({href:n}).run(),removeLink:()=>null==V?void 0:V.chain().focus().extendMarkRange("link").unsetLink().run(),insertEmoji:n=>null==V?void 0:V.chain().focus().insertContent(n).run(),insertVariable:n=>null==V?void 0:V.chain().focus().insertContent(`{{${n}}}`).run(),insertHtml:n=>null==V?void 0:V.commands.insertContent(n),undo:()=>null==V?void 0:V.chain().focus().undo().run(),redo:()=>null==V?void 0:V.chain().focus().redo().run(),canUndo:()=>{var n;return null!==(n=null==V?void 0:V.can().undo())&&void 0!==n&&n},canRedo:()=>{var n;return null!==(n=null==V?void 0:V.can().redo())&&void 0!==n&&n}}})),[V]),V?n(s,Object.assign({minHeight:U,maxHeight:z,style:D,className:P},{children:[t(i,{editor:V}),t(C,{editor:V,renderLinkTooltip:null==M?void 0:M.renderTooltip})]})):null}));S.displayName="BikEditor";export{S as BikEditor};
1
+ import{jsxs as n,jsx as t}from"react/jsx-runtime";import{getMarkRange as e}from"../node_modules/@tiptap/core/dist/index.js";import{useEditor as o,EditorContent as i}from"@tiptap/react";import{forwardRef as l,useImperativeHandle as r}from"react";import{BikEditorShell as s}from"./BikEditor.styles.js";import{buildSectionedContent as d,normalizeHtml as c,extractContent as u,extractActiveFormats as a,extractSectionContent as m,setSectionContentInEditor as g,extractBodyContent as h,findSectionEndPos as v,findSectionStartPos as f}from"./BikEditor.utils.js";import{buildExtensions as C}from"./extensions/buildExtensions.js";import{LinkBubbleMenu as p}from"./floating/LinkBubbleMenu.js";function S(n){return Object.entries(n).map((n=>{let[t,e]=n;return`${t.replace(/([A-Z])/g,(n=>`-${n.toLowerCase()}`))}:${e}`})).join(";")}const k=l(((l,k)=>{var x;const{initialContent:B,sections:y,features:b,disabled:A,maxCharacters:j,shortcuts:L,sendShortcut:F,mentions:H,slashCommands:E,link:M,onPaste:O,onChange:T,onSend:w,onFocus:I,onBlur:U,onSelectionChange:R,minHeight:z,maxHeight:D,style:P,className:N,editorClassName:$,editorStyle:q}=l,V=(null==y?void 0:y.length)?d(c(null!=B?B:""),y.map((n=>Object.assign(Object.assign({},n),{content:c(n.content)})))):c(null!=B?B:""),W=o({extensions:C({features:b,placeholder:l.placeholder,maxCharacters:j,hasSections:(null!==(x=null==y?void 0:y.length)&&void 0!==x?x:0)>0,mentions:{agents:null==H?void 0:H.agents,teams:null==H?void 0:H.teams},slashCommands:null==E?void 0:E.items,onPaste:O,onSend:w,sendShortcut:F,shortcuts:L,onMentionSelected:null==H?void 0:H.onSelect,onSlashCommandSelected:null==E?void 0:E.onSelect,renderMentionItem:null==H?void 0:H.renderItem,renderMentionDropdown:null==H?void 0:H.renderDropdown,renderSlashCommandItem:null==E?void 0:E.renderItem,renderSlashCommandDropdown:null==E?void 0:E.renderDropdown}),content:V,editable:!A,immediatelyRender:!1,editorProps:{attributes:Object.assign(Object.assign({},$?{class:$}:{}),q?{style:S(q)}:{})},onUpdate:n=>{let{editor:t}=n;return null==T?void 0:T(u(t))},onSelectionUpdate:n=>{let{editor:t}=n;return null==R?void 0:R(a(t))},onFocus:()=>null==I?void 0:I(),onBlur:()=>null==U?void 0:U()});return r(k,(()=>({focus:()=>null==W?void 0:W.commands.focus(),blur:()=>null==W?void 0:W.commands.blur(),clearContent:()=>null==W?void 0:W.commands.clearContent(!0),setContent:n=>null==W?void 0:W.commands.setContent(c(n),{emitUpdate:!0}),insertContent:n=>null==W?void 0:W.commands.insertContent(c(n)),insertAtStart:n=>{W&&W.commands.insertContentAt(1,c(n))},insertAtEnd:n=>{W&&W.commands.insertContentAt(W.state.doc.content.size,c(n))},appendContent:n=>{W&&W.commands.insertContentAt(W.state.doc.content.size-1,c(n))},getContent:()=>W?u(W):{html:"",text:"",isEmpty:!0,characterCount:0},getCursorPosition:()=>{const{from:n,to:t}=W.state.selection;return{from:n,to:t}},insertAtPosition:(n,t)=>{W&&W.commands.insertContentAt(n,t)},getSelectedText:()=>{const{state:n}=W,{from:t,to:o,empty:i}=n.selection;if(!i)return n.doc.textBetween(t,o," ");const l=n.schema.marks.link;if(l){const o=e(n.doc.resolve(t),l);if(o)return n.doc.textBetween(o.from,o.to," ")}return""},getCharacterCount:()=>{var n,t,e,o;return{count:null!==(o=null!==(e=null===(t=null===(n=null==W?void 0:W.storage.characterCount)||void 0===n?void 0:n.characters)||void 0===t?void 0:t.call(n))&&void 0!==e?e:null==W?void 0:W.getText().length)&&void 0!==o?o:0,limit:null!=j?j:null}},getSectionContent:n=>m(W,n),setSectionContent:(n,t)=>{W&&g(W,n,c(t))},focusSection:n=>{if(!W)return;if("body"===n)return void W.chain().focus().setTextSelection(1).run();let t=-1;W.state.doc.descendants(((e,o)=>{if(-1!==t)return!1;"sectionDivider"===e.type.name&&e.attrs.sectionId===n&&(t=o+e.nodeSize+1)})),-1!==t&&W.chain().focus().setTextSelection(t).run()},clearSection:n=>{W&&g(W,n,"<p></p>")},getBodyContent:()=>h(W),setBodyContent:n=>{W&&g(W,"body",c(n))},setBodyAndSections:(n,t)=>{if(!W)return;const e=d(c(n),t.map((n=>({id:n.id,content:c(n.content)}))));W.commands.setContent(e,{emitUpdate:!0})},appendBodyContent:n=>{if(!W)return;const t=c(n),e=v(W,"body");W.commands.insertContentAt(e-1,t)},insertAtSectionStart:(n,t)=>{if(!W)return;const e=f(W,n);-1!==e&&W.commands.insertContentAt(e,c(t))},insertAtSectionEnd:(n,t)=>{if(!W)return;const e=v(W,n);W.commands.insertContentAt(e,c(t))},getActiveFormats:()=>a(W),actions:{toggleBold:()=>null==W?void 0:W.chain().focus().toggleBold().run(),toggleItalic:()=>null==W?void 0:W.chain().focus().toggleItalic().run(),toggleUnderline:()=>null==W?void 0:W.chain().focus().toggleUnderline().run(),toggleStrike:()=>null==W?void 0:W.chain().focus().toggleStrike().run(),toggleBulletList:()=>null==W?void 0:W.chain().focus().toggleBulletList().run(),toggleOrderedList:()=>null==W?void 0:W.chain().focus().toggleOrderedList().run(),toggleBlockquote:()=>null==W?void 0:W.chain().focus().toggleBlockquote().run(),toggleCodeBlock:()=>null==W?void 0:W.chain().focus().toggleCodeBlock().run(),setTextAlign:n=>null==W?void 0:W.chain().focus().setTextAlign(n).run(),setFontFamily:n=>null==W?void 0:W.chain().focus().setFontFamily(n).run(),setFontSize:n=>null==W?void 0:W.chain().focus().setFontSize(n).run(),setColor:n=>null==W?void 0:W.chain().focus().setColor(n).run(),setHighlight:n=>null==W?void 0:W.chain().focus().toggleHighlight({color:n}).run(),unsetColor:()=>null==W?void 0:W.chain().focus().unsetColor().run(),unsetHighlight:()=>null==W?void 0:W.chain().focus().unsetHighlight().run(),setLink:(n,t)=>{W&&(void 0!==t?W.chain().focus().extendMarkRange("link").command((e=>{let{tr:o,state:i}=e;const{from:l,to:r}=o.selection,s=i.schema.marks.link;return!!s&&(o.replaceWith(l,r,i.schema.text(t,[s.create({href:n})])),!0)})).run():W.chain().focus().extendMarkRange("link").setLink({href:n}).run())},updateLink:n=>null==W?void 0:W.chain().focus().extendMarkRange("link").setLink({href:n}).run(),removeLink:()=>null==W?void 0:W.chain().focus().extendMarkRange("link").unsetLink().run(),insertEmoji:n=>null==W?void 0:W.chain().focus().insertContent(n).run(),insertVariable:n=>null==W?void 0:W.chain().focus().insertContent(`{{${n}}}`).run(),insertHtml:n=>null==W?void 0:W.commands.insertContent(n),undo:()=>null==W?void 0:W.chain().focus().undo().run(),redo:()=>null==W?void 0:W.chain().focus().redo().run(),canUndo:()=>{var n;return null!==(n=null==W?void 0:W.can().undo())&&void 0!==n&&n},canRedo:()=>{var n;return null!==(n=null==W?void 0:W.can().redo())&&void 0!==n&&n}}})),[W]),W?n(s,Object.assign({minHeight:z,maxHeight:D,style:P,className:N},{children:[t(i,{editor:W}),t(p,{editor:W,renderLinkTooltip:null==M?void 0:M.renderTooltip})]})):null}));k.displayName="BikEditor";export{k as BikEditor};
@@ -14,12 +14,20 @@ import e from"styled-components";const o=e.div`
14
14
 
15
15
  p {
16
16
  margin: 0;
17
+ padding: 0;
17
18
  }
18
- p + p {
19
- margin-top: 4px;
19
+
20
+ ul,
21
+ ol {
22
+ margin: 0;
23
+ padding-left: 1.5em;
24
+ }
25
+
26
+ li + li {
27
+ margin-top: 2px;
20
28
  }
21
29
 
22
- &.is-editor-empty::before {
30
+ p.is-editor-empty:first-child::before {
23
31
  content: attr(data-placeholder);
24
32
  float: left;
25
33
  color: #adb5bd;
@@ -1 +1 @@
1
- const t=t=>`<div data-section-divider="${t}" style="display:none;height:0;line-height:0;overflow:hidden;"></div>`;function e(e,i){let n=e;for(const e of i)n+=t(e.id)+e.content;return n}function i(t){return n(t.getHTML())}function n(t){const e=new Map,i=/<div[^>]*data-(?:section-divider="([^"]*)"|signature-divider|forwarded-divider)[^>]*>\s*<\/div>/g,n=[];let l;for(;null!==(l=i.exec(t));){let t=l[1];t||(t=l[0].includes("data-signature-divider")?"signature":"forwarded"),n.push({id:t,index:l.index,endIndex:l.index+l[0].length})}if(0===n.length)return e.set("body",t),e;e.set("body",t.slice(0,n[0].index));for(let i=0;i<n.length;i++){const l=n[i].endIndex,o=i+1<n.length?n[i+1].index:t.length;e.set(n[i].id,t.slice(l,o))}return e}function l(t,e){var n;return function(t){var e;const i="undefined"!=typeof document?document.createElement("div"):null;i&&(i.innerHTML=t);const n=null!==(e=null==i?void 0:i.textContent)&&void 0!==e?e:"";return{html:t,text:n,isEmpty:!n.trim(),characterCount:n.length}}(null!==(n=i(t).get(e))&&void 0!==n?n:"")}function o(t,n,l){var o;const r=i(t);r.set(n,l);const d=e(null!==(o=r.get("body"))&&void 0!==o?o:"",[...r.entries()].filter((t=>{let[e]=t;return"body"!==e})).map((t=>{let[e,i]=t;return{id:e,content:i}})));t.commands.setContent(d,{emitUpdate:!1})}function r(t){return l(t,"body")}function d(t){var e,i,n,l,o;return{bold:t.isActive("bold"),italic:t.isActive("italic"),underline:t.isActive("underline"),strike:t.isActive("strike"),bulletList:t.isActive("bulletList"),orderedList:t.isActive("orderedList"),blockquote:t.isActive("blockquote"),codeBlock:t.isActive("codeBlock"),link:t.isActive("link")?{href:null!==(e=t.getAttributes("link").href)&&void 0!==e?e:""}:null,textAlign:t.isActive({textAlign:"center"})?"center":t.isActive({textAlign:"right"})?"right":t.isActive({textAlign:"justify"})?"justify":"left",fontFamily:null!==(i=t.getAttributes("textStyle").fontFamily)&&void 0!==i?i:null,fontSize:null!==(n=t.getAttributes("textStyle").fontSize)&&void 0!==n?n:null,color:null!==(l=t.getAttributes("textStyle").color)&&void 0!==l?l:null,highlight:t.isActive("highlight")?null!==(o=t.getAttributes("highlight").color)&&void 0!==o?o:"default":null}}function c(t){var e,i,n;return{html:t.getHTML(),text:t.getText(),isEmpty:t.isEmpty,characterCount:null!==(n=null===(i=null===(e=t.storage.characterCount)||void 0===e?void 0:e.characters)||void 0===i?void 0:i.call(e))&&void 0!==n?n:t.getText().length}}function s(t,e){if("body"===e)return 1;let i=-1;return t.state.doc.descendants(((t,n)=>{if(-1!==i)return!1;"sectionDivider"===t.type.name&&t.attrs.sectionId===e&&(i=n+t.nodeSize)})),i}function u(t,e){const i=t.state.doc,n=i.content.size;if("body"===e){let t=-1;return i.descendants(((e,i)=>{if(-1!==t)return!1;"sectionDivider"===e.type.name&&(t=i)})),-1!==t?t:n}let l=!1,o=-1;return i.descendants(((t,i)=>-1===o&&(l?void("sectionDivider"===t.type.name&&(o=i)):("sectionDivider"===t.type.name&&t.attrs.sectionId===e&&(l=!0),!1)))),-1!==o?o:n}export{t as SECTION_DIVIDER_HTML,e as buildSectionedContent,d as extractActiveFormats,i as extractAllSections,n as extractAllSectionsFromHtml,r as extractBodyContent,c as extractContent,l as extractSectionContent,u as findSectionEndPos,s as findSectionStartPos,o as setSectionContentInEditor};
1
+ function t(t){return t.replace(/<p>\s*<br\s*\/?>\s*<\/p>/gi,"<p></p>")}const e=t=>`<div data-section-divider="${t}" style="display:none;height:0;line-height:0;overflow:hidden;"></div>`;function i(t,i){let n=t;for(const t of i)n+=e(t.id)+t.content;return n}function n(t){return l(t.getHTML())}function l(t){const e=new Map,i=/<div[^>]*data-section-divider="([^"]*)[^>]*>\s*<\/div>/g,n=[];let l;for(;null!==(l=i.exec(t));)n.push({id:l[1],index:l.index,endIndex:l.index+l[0].length});if(0===n.length)return e.set("body",t),e;e.set("body",t.slice(0,n[0].index));for(let i=0;i<n.length;i++){const l=n[i].endIndex,o=i+1<n.length?n[i+1].index:t.length;e.set(n[i].id,t.slice(l,o))}return e}function o(t,e){var i;return function(t){var e;const i="undefined"!=typeof document?document.createElement("div"):null;i&&(i.innerHTML=t);const n=null!==(e=null==i?void 0:i.textContent)&&void 0!==e?e:"";return{html:t,text:n,isEmpty:!n.trim(),characterCount:n.length}}(null!==(i=n(t).get(e))&&void 0!==i?i:"")}function r(t,e,l){var o;const r=n(t);r.set(e,l);const d=i(null!==(o=r.get("body"))&&void 0!==o?o:"",[...r.entries()].filter((t=>{let[e]=t;return"body"!==e})).map((t=>{let[e,i]=t;return{id:e,content:i}})));t.commands.setContent(d,{emitUpdate:!1})}function d(t){return o(t,"body")}function c(t){var e,i,n,l,o;return{bold:t.isActive("bold"),italic:t.isActive("italic"),underline:t.isActive("underline"),strike:t.isActive("strike"),bulletList:t.isActive("bulletList"),orderedList:t.isActive("orderedList"),blockquote:t.isActive("blockquote"),codeBlock:t.isActive("codeBlock"),link:t.isActive("link")?{href:null!==(e=t.getAttributes("link").href)&&void 0!==e?e:""}:null,textAlign:t.isActive({textAlign:"center"})?"center":t.isActive({textAlign:"right"})?"right":t.isActive({textAlign:"justify"})?"justify":"left",fontFamily:null!==(i=t.getAttributes("textStyle").fontFamily)&&void 0!==i?i:null,fontSize:null!==(n=t.getAttributes("textStyle").fontSize)&&void 0!==n?n:null,color:null!==(l=t.getAttributes("textStyle").color)&&void 0!==l?l:null,highlight:t.isActive("highlight")?null!==(o=t.getAttributes("highlight").color)&&void 0!==o?o:"default":null}}function s(t){var e,i,n;return{html:t.getHTML(),text:t.getText(),isEmpty:t.isEmpty,characterCount:null!==(n=null===(i=null===(e=t.storage.characterCount)||void 0===e?void 0:e.characters)||void 0===i?void 0:i.call(e))&&void 0!==n?n:t.getText().length}}function u(t,e){if("body"===e)return 1;let i=-1;return t.state.doc.descendants(((t,n)=>{if(-1!==i)return!1;"sectionDivider"===t.type.name&&t.attrs.sectionId===e&&(i=n+t.nodeSize)})),i}function v(t,e){const i=t.state.doc,n=i.content.size;if("body"===e){let t=-1;return i.descendants(((e,i)=>{if(-1!==t)return!1;"sectionDivider"===e.type.name&&(t=i)})),-1!==t?t:n}let l=!1,o=-1;return i.descendants(((t,i)=>-1===o&&(l?void("sectionDivider"===t.type.name&&(o=i)):("sectionDivider"===t.type.name&&t.attrs.sectionId===e&&(l=!0),!1)))),-1!==o?o:n}export{e as SECTION_DIVIDER_HTML,i as buildSectionedContent,c as extractActiveFormats,n as extractAllSections,l as extractAllSectionsFromHtml,d as extractBodyContent,s as extractContent,o as extractSectionContent,v as findSectionEndPos,u as findSectionStartPos,t as normalizeHtml,r as setSectionContentInEditor};
@@ -1 +1 @@
1
- import o from"@tiptap/extension-character-count";import e from"@tiptap/extension-color";import n from"@tiptap/extension-font-family";import t from"@tiptap/extension-highlight";import i from"@tiptap/extension-image";import r from"@tiptap/extension-link";import s from"@tiptap/extension-placeholder";import a from"@tiptap/extension-subscript";import m from"@tiptap/extension-superscript";import p from"@tiptap/extension-text-align";import{TextStyle as l}from"@tiptap/extension-text-style";import d from"@tiptap/extension-underline";import u from"@tiptap/starter-kit";import{FontSizeExtension as c}from"./FontSizeExtension.js";import{buildAgentMentionExtension as f,buildTeamMentionExtension as h}from"./mention/MentionExtension.js";import{PasteExtension as x}from"./paste/PasteExtension.js";import{PlainClipboardExtension as v}from"./plainClipboard/PlainClipboardExtension.js";import{SectionDividerNode as g}from"./sectionDivider/SectionDividerNode.js";import{SendShortcutExtension as S}from"./sendShortcut/SendShortcutExtension.js";import{buildSlashCommandExtension as C}from"./slashCommand/SlashCommandExtension.js";import{VariableDecorationExtension as j}from"./variable/VariableDecorationExtension.js";function k(k){var M,P,b,E,y,D,I,w,T,O,R;const z=null!==(P=null===(M=k.features)||void 0===M?void 0:M.richPaste)&&void 0!==P&&P,A=null!==(E=null===(b=k.features)||void 0===b?void 0:b.richTypography)&&void 0!==E&&E;return[...[u.configure({link:!1,underline:!1}),d,r.extend({addPasteRules:()=>[],addInputRules:()=>[]}).configure({openOnClick:!1,autolink:!1,linkOnPaste:!1,HTMLAttributes:{rel:"noopener noreferrer",class:"bik-link"}}),l,s.configure({placeholder:null!==(y=k.placeholder)&&void 0!==y?y:"Type a message..."}),...k.onPaste?[x.configure({onPaste:k.onPaste})]:[],...z?[]:[v],S.configure({onSend:k.onSend,sendShortcut:k.sendShortcut,extraShortcuts:null!==(D=k.shortcuts)&&void 0!==D?D:[]}),j,...k.maxCharacters?[o.configure({limit:k.maxCharacters})]:[],...k.hasSections?[g]:[]],...[...(null===(w=null===(I=k.mentions)||void 0===I?void 0:I.agents)||void 0===w?void 0:w.length)?[f(k.mentions.agents,k.onMentionSelected,k.renderMentionItem,k.renderMentionDropdown)]:[],...(null===(O=null===(T=k.mentions)||void 0===T?void 0:T.teams)||void 0===O?void 0:O.length)?[h(k.mentions.teams,k.onMentionSelected,k.renderMentionItem,k.renderMentionDropdown)]:[],...(null===(R=k.slashCommands)||void 0===R?void 0:R.length)?[C(k.slashCommands,k.onSlashCommandSelected,k.renderSlashCommandItem,k.renderSlashCommandDropdown)]:[]],...A?[e,t.configure({multicolor:!0}),n,c,p.configure({types:["heading","paragraph"]}),a,m,i]:[e]]}export{k as buildExtensions};
1
+ import o from"@tiptap/extension-character-count";import e from"@tiptap/extension-color";import t from"@tiptap/extension-font-family";import n from"@tiptap/extension-highlight";import i from"@tiptap/extension-image";import r from"@tiptap/extension-link";import s from"@tiptap/extension-placeholder";import a from"@tiptap/extension-subscript";import l from"@tiptap/extension-superscript";import m from"@tiptap/extension-text-align";import{TextStyle as p}from"@tiptap/extension-text-style";import d from"@tiptap/extension-underline";import u from"@tiptap/starter-kit";import{FontSizeExtension as c}from"./FontSizeExtension.js";import{buildAgentMentionExtension as f,buildTeamMentionExtension as h}from"./mention/MentionExtension.js";import{PasteExtension as x}from"./paste/PasteExtension.js";import{PlainClipboardExtension as v}from"./plainClipboard/PlainClipboardExtension.js";import{SectionDividerNode as g}from"./sectionDivider/SectionDividerNode.js";import{SendShortcutExtension as S}from"./sendShortcut/SendShortcutExtension.js";import{buildSlashCommandExtension as C}from"./slashCommand/SlashCommandExtension.js";import{VariableDecorationExtension as k}from"./variable/VariableDecorationExtension.js";function b(b){var M,j,P,E,y,D,w,I,T,O,R,z;const A=null!==(j=null===(M=b.features)||void 0===M?void 0:M.richPaste)&&void 0!==j&&j,F=null!==(E=null===(P=b.features)||void 0===P?void 0:P.richTypography)&&void 0!==E&&E,H=null===(y=b.features)||void 0===y?void 0:y.allowedMarks,L=o=>!H||H.includes(o);return[...[u.configure({link:!1,underline:!1,bold:!!L("bold")&&{},italic:!!L("italic")&&{},strike:!!L("strike")&&{},code:!!L("code")&&{}}),...L("underline")?[d]:[],r.extend({addPasteRules:()=>[],addInputRules:()=>[]}).configure({openOnClick:!1,autolink:!1,linkOnPaste:!1,HTMLAttributes:{rel:"noopener noreferrer",class:"bik-link"}}),p,s.configure({placeholder:null!==(D=b.placeholder)&&void 0!==D?D:"Type a message..."}),...b.onPaste?[x.configure({onPaste:b.onPaste})]:[],...A?[]:[v],S.configure({onSend:b.onSend,sendShortcut:b.sendShortcut,extraShortcuts:null!==(w=b.shortcuts)&&void 0!==w?w:[]}),k,...b.maxCharacters?[o.configure({limit:b.maxCharacters})]:[],g],...[...(null===(T=null===(I=b.mentions)||void 0===I?void 0:I.agents)||void 0===T?void 0:T.length)?[f(b.mentions.agents,b.onMentionSelected,b.renderMentionItem,b.renderMentionDropdown)]:[],...(null===(R=null===(O=b.mentions)||void 0===O?void 0:O.teams)||void 0===R?void 0:R.length)?[h(b.mentions.teams,b.onMentionSelected,b.renderMentionItem,b.renderMentionDropdown)]:[],...(null===(z=b.slashCommands)||void 0===z?void 0:z.length)?[C(b.slashCommands,b.onSlashCommandSelected,b.renderSlashCommandItem,b.renderSlashCommandDropdown)]:[]],...F?[e,n.configure({multicolor:!0}),t,c,m.configure({types:["heading","paragraph"]}),a,l,i]:[e]]}export{b as buildExtensions};
@@ -1,27 +1,24 @@
1
- import r from"styled-components";import{COLORS as o}from"../../constants/Theme.js";const e=r.div`
1
+ import r from"styled-components";import{COLORS as o}from"../../constants/Theme.js";const t=r.div`
2
2
  background: ${o.surface.standard};
3
3
  border: 1px solid ${o.stroke.primary};
4
4
  border-radius: 8px;
5
5
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
6
6
  padding: 4px;
7
- min-width: 180px;
7
+ min-width: 330px;
8
8
  max-height: 260px;
9
9
  overflow-y: auto;
10
10
  font-size: 14px;
11
11
  color: ${o.content.primary};
12
- `,t=r.div`
12
+ `,e=r.div`
13
13
  display: flex;
14
14
  align-items: center;
15
15
  gap: 8px;
16
- padding: 6px 10px;
16
+ padding: 12px 16px;
17
+ min-height: 43px;
17
18
  border-radius: 6px;
18
19
  cursor: pointer;
19
20
  color: ${o.content.primary};
20
- background: ${r=>{let{$isActive:e}=r;return e?o.surface.hovered:"transparent"}};
21
-
22
- &:hover {
23
- background: ${o.surface.hovered};
24
- }
21
+ background: ${r=>{let{$isActive:t}=r;return t?o.surface.hovered:"transparent"}};
25
22
  `,n=r.img`
26
23
  width: 24px;
27
24
  height: 24px;
@@ -31,18 +28,18 @@ import r from"styled-components";import{COLORS as o}from"../../constants/Theme.j
31
28
  `,i=r.span`
32
29
  font-weight: 500;
33
30
  color: ${o.content.primary};
34
- `,a=r.span`
31
+ `,p=r.span`
35
32
  width: 8px;
36
33
  height: 8px;
37
34
  border-radius: 50%;
38
- background: ${r=>{let{$online:e}=r;return e?o.content.positive:o.content.placeholder}};
35
+ background: ${r=>{let{$online:t}=r;return t?o.content.positive:o.content.placeholder}};
39
36
  margin-left: auto;
40
37
  flex-shrink: 0;
41
- `,p=r.span`
38
+ `,a=r.span`
42
39
  font-weight: 500;
43
40
  color: ${o.content.primary};
44
- `,d=r.span`
41
+ `,s=r.span`
45
42
  font-size: 12px;
46
43
  color: ${o.content.secondary};
47
44
  margin-left: auto;
48
- `;export{e as DropdownContainer,t as DropdownItem,n as MentionAvatar,i as MentionLabel,a as MentionPresenceDot,d as SlashDescription,p as SlashLabel};
45
+ `;export{t as DropdownContainer,e as DropdownItem,n as MentionAvatar,i as MentionLabel,p as MentionPresenceDot,s as SlashDescription,a as SlashLabel};
@@ -1 +1 @@
1
- import{jsx as e,Fragment as r,jsxs as n}from"react/jsx-runtime";import{forwardRef as t,useState as o,useImperativeHandle as i,useEffect as l}from"react";import{DropdownContainer as a,DropdownItem as c,MentionAvatar as d,MentionLabel as s,MentionPresenceDot as m}from"../editorDropdown.styles.js";const p=t(((t,p)=>{let{items:h,query:y,command:w,renderItem:u,renderDropdown:v}=t;const[g,D]=o(0),k=e=>{h[e]&&w(h[e])};return i(p,(()=>({onKeyDown:e=>{let{event:r}=e;return"ArrowUp"===r.key?(D((e=>(e+h.length-1)%h.length)),!0):"ArrowDown"===r.key?(D((e=>(e+1)%h.length)),!0):"Enter"===r.key&&(k(g),!0)}}))),l((()=>D(0)),[h]),h.length?v?e(r,{children:v({items:h,query:y,activeIndex:g,onSelect:e=>w(e)})}):e(a,{children:h.map(((t,o)=>e(c,Object.assign({$isActive:o===g,onClick:()=>k(o)},{children:u?u(t,o===g):n(r,{children:[t.avatarUrl&&e(d,{src:t.avatarUrl,alt:""}),e(s,{children:t.label}),void 0!==t.isOnline&&e(m,{$online:t.isOnline})]})}),t.id)))}):null}));p.displayName="MentionDropdown";export{p as MentionDropdown};
1
+ import{jsx as e,Fragment as n,jsxs as r}from"react/jsx-runtime";import{forwardRef as t,useState as o,useImperativeHandle as i,useEffect as l}from"react";import{DropdownContainer as a,DropdownItem as c,MentionAvatar as d,MentionLabel as s,MentionPresenceDot as m}from"../editorDropdown.styles.js";const p=t(((t,p)=>{let{items:h,query:y,command:u,renderItem:w,renderDropdown:v}=t;const[g,D]=o(0),k=e=>{h[e]&&u(h[e])};return i(p,(()=>({onKeyDown:e=>{let{event:n}=e;return"ArrowUp"===n.key?(D((e=>(e+h.length-1)%h.length)),!0):"ArrowDown"===n.key?(D((e=>(e+1)%h.length)),!0):"Enter"===n.key&&(k(g),!0)}}))),l((()=>D(0)),[h]),h.length?v?e(n,{children:v({items:h,query:y,activeIndex:g,onSelect:e=>u(e)})}):e(a,{children:h.map(((t,o)=>e(c,Object.assign({$isActive:o===g,onMouseEnter:()=>D(o),onClick:()=>k(o)},{children:w?w(t,o===g):r(n,{children:[t.avatarUrl&&e(d,{src:t.avatarUrl,alt:""}),e(s,{children:t.label}),void 0!==t.isOnline&&e(m,{$online:t.isOnline})]})}),t.id)))}):null}));p.displayName="MentionDropdown";export{p as MentionDropdown};
@@ -1 +1 @@
1
- import{Node as t,mergeAttributes as e}from"../../../node_modules/@tiptap/core/dist/index.js";const d=t.create({name:"sectionDivider",group:"block",atom:!0,selectable:!1,draggable:!1,addAttributes:()=>({sectionId:{default:null}}),parseHTML:()=>[{tag:"div[data-section-divider]",getAttrs:t=>({sectionId:t.getAttribute("data-section-divider")})},{tag:"div[data-signature-divider]",getAttrs:()=>({sectionId:"signature"})},{tag:"div[data-forwarded-divider]",getAttrs:()=>({sectionId:"forwarded"})}],renderHTML(t){let{node:d,HTMLAttributes:i}=t;return["div",e(i,{"data-section-divider":d.attrs.sectionId,style:"display:none;height:0;line-height:0;overflow:hidden;"})]}});export{d as SectionDividerNode};
1
+ import{Node as e,mergeAttributes as t}from"../../../node_modules/@tiptap/core/dist/index.js";const d=e.create({name:"sectionDivider",group:"block",atom:!0,selectable:!1,draggable:!1,addAttributes:()=>({sectionId:{default:null,rendered:!1}}),parseHTML:()=>[{tag:"div[data-section-divider]",getAttrs:e=>({sectionId:e.getAttribute("data-section-divider")})},{tag:"div[data-signature-divider]",getAttrs:()=>({sectionId:"signature"})},{tag:"div[data-forwarded-divider]",getAttrs:()=>({sectionId:"forwarded"})}],renderHTML(e){let{node:d,HTMLAttributes:i}=e;return["div",t(i,{"data-section-divider":d.attrs.sectionId,style:"display:none;height:0;line-height:0;overflow:hidden;"})]}});export{d as SectionDividerNode};
@@ -1 +1 @@
1
- import{jsx as e,Fragment as r,jsxs as n}from"react/jsx-runtime";import{forwardRef as t,useState as o,useImperativeHandle as i,useEffect as l}from"react";import{DropdownContainer as c,DropdownItem as d,SlashLabel as m,SlashDescription as s}from"../editorDropdown.styles.js";const a=t(((t,a)=>{let{items:h,query:p,command:y,renderItem:u,renderDropdown:w}=t;const[g,k]=o(0),D=e=>{h[e]&&y(h[e])};return i(a,(()=>({onKeyDown:e=>{let{event:r}=e;return"ArrowUp"===r.key?(k((e=>(e+h.length-1)%h.length)),!0):"ArrowDown"===r.key?(k((e=>(e+1)%h.length)),!0):"Enter"===r.key&&(D(g),!0)}}))),l((()=>k(0)),[h]),h.length?w?e(r,{children:w({items:h,query:p,activeIndex:g,onSelect:e=>y(e)})}):e(c,{children:h.map(((t,o)=>e(d,Object.assign({$isActive:o===g,onClick:()=>D(o)},{children:u?u(t,o===g):n(r,{children:[e(m,{children:t.label}),t.description&&e(s,{children:t.description})]})}),t.id)))}):null}));a.displayName="SlashCommandMenu";export{a as SlashCommandMenu};
1
+ import{jsx as e,Fragment as r,jsxs as n}from"react/jsx-runtime";import{forwardRef as t,useState as o,useImperativeHandle as i,useEffect as l}from"react";import{DropdownContainer as c,DropdownItem as d,SlashLabel as m,SlashDescription as s}from"../editorDropdown.styles.js";const a=t(((t,a)=>{let{items:h,query:p,command:u,renderItem:y,renderDropdown:w}=t;const[g,k]=o(0),D=e=>{h[e]&&u(h[e])};return i(a,(()=>({onKeyDown:e=>{let{event:r}=e;return"ArrowUp"===r.key?(k((e=>(e+h.length-1)%h.length)),!0):"ArrowDown"===r.key?(k((e=>(e+1)%h.length)),!0):"Enter"===r.key&&(D(g),!0)}}))),l((()=>k(0)),[h]),h.length?w?e(r,{children:w({items:h,query:p,activeIndex:g,onSelect:e=>u(e)})}):e(c,{children:h.map(((t,o)=>e(d,Object.assign({$isActive:o===g,onMouseEnter:()=>k(o),onClick:()=>D(o)},{children:y?y(t,o===g):n(r,{children:[e(m,{children:t.label}),t.description&&e(s,{children:t.description})]})}),t.id)))}):null}));a.displayName="SlashCommandMenu";export{a as SlashCommandMenu};
@@ -1 +1 @@
1
- function e(e){if(!e)return"";if("undefined"!=typeof document){return r((new DOMParser).parseFromString(e,"text/html").body).replace(/\n{3,}/g,"\n\n").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(/<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(/&amp;/g,"&").replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&nbsp;/g," ").replace(/\n{3,}/g,"\n\n").trim()}(e)}function r(e){var a;if(e.nodeType===Node.TEXT_NODE)return null!==(a=e.textContent)&&void 0!==a?a:"";if(e.nodeType!==Node.ELEMENT_NODE)return"";const n=e,c=n.tagName.toLowerCase(),s=function(e){return Array.from(e.childNodes).map(r).join("")}(n);switch(c){case"strong":case"b":return s?`*${s}*`:"";case"em":case"i":case"s":case"del":case"strike":case"code":case"pre":case"a":case"ul":case"ol":case"body":default:return s;case"br":return"\n";case"p":case"div":return s?`${s}\n`:"\n";case"h1":case"h2":case"h3":case"h4":case"h5":case"h6":return s?`*${s}*\n`:"\n";case"li":return`• ${s}\n`;case"blockquote":return s+"\n"}}export{e as toLiveChatText};
1
+ function e(e){if(!e)return"";if("undefined"!=typeof document){return r((new DOMParser).parseFromString(e,"text/html").body).replace(/\n{3,}/g,"\n\n").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(/<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(/&amp;/g,"&").replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&nbsp;/g," ").replace(/\n{3,}/g,"\n\n").trim()}(e)}function r(e){var a;if(e.nodeType===Node.TEXT_NODE)return null!==(a=e.textContent)&&void 0!==a?a:"";if(e.nodeType!==Node.ELEMENT_NODE)return"";const n=e,c=n.tagName.toLowerCase(),s=function(e){return Array.from(e.childNodes).map(r).join("")}(n);switch(c){case"strong":case"b":return s?`*${s}*`:"";case"em":case"i":case"s":case"del":case"strike":case"code":case"pre":case"a":case"ul":case"ol":case"body":default:return s;case"br":return"\n";case"p":case"div":return s?`${s}\n`:"\n";case"h1":case"h2":case"h3":case"h4":case"h5":case"h6":return s?`*${s}*\n`:"\n";case"li":return`• ${s.trimEnd()}\n`;case"blockquote":return s+"\n"}}export{e as toLiveChatText};
@@ -1 +1 @@
1
- function e(e){if(!e)return"";if("undefined"!=typeof document){return r((new DOMParser).parseFromString(e,"text/html").body).replace(/\n{3,}/g,"\n\n").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[^>]*href="([^"]*)"[^>]*>[\s\S]*?<\/a>/gi,"$1").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(/&amp;/g,"&").replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&nbsp;/g," ").replace(/\n{3,}/g,"\n\n").trim()}(e)}function r(e){var n,a;if(e.nodeType===Node.TEXT_NODE)return null!==(n=e.textContent)&&void 0!==n?n:"";if(e.nodeType!==Node.ELEMENT_NODE)return"";const c=e,t=c.tagName.toLowerCase(),s=function(e){return Array.from(e.childNodes).map(r).join("")}(c);switch(t){case"strong":case"b":return s?`*${s}*`:"";case"em":case"i":return s?`_${s}_`:"";case"s":case"del":case"strike":return s?`~${s}~`:"";case"code":return s?`\`${s}\``:"";case"pre":return s?`\`\`\`${s}\`\`\``:"";case"a":return(null!==(a=c.getAttribute("href"))&&void 0!==a?a:"")||s;case"br":return"\n";case"p":case"div":return s?`${s}\n`:"\n";case"h1":case"h2":case"h3":case"h4":case"h5":case"h6":return s?`*${s}*\n`:"\n";case"ul":case"ol":case"body":default:return s;case"li":return`• ${s}\n`;case"blockquote":return s.split("\n").map((e=>e?`> ${e}`:"")).join("\n")+"\n"}}export{e as toWhatsAppText};
1
+ function e(e){if(!e)return"";if("undefined"!=typeof document){return r((new DOMParser).parseFromString(e,"text/html").body).replace(/\n{3,}/g,"\n\n").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[^>]*href="([^"]*)"[^>]*>[\s\S]*?<\/a>/gi,"$1").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(/&amp;/g,"&").replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&nbsp;/g," ").replace(/\n{3,}/g,"\n\n").trim()}(e)}function r(e){var n,a;if(e.nodeType===Node.TEXT_NODE)return null!==(n=e.textContent)&&void 0!==n?n:"";if(e.nodeType!==Node.ELEMENT_NODE)return"";const c=e,t=c.tagName.toLowerCase(),s=function(e){return Array.from(e.childNodes).map(r).join("")}(c);switch(t){case"strong":case"b":return s?`*${s}*`:"";case"em":case"i":return s?`_${s}_`:"";case"s":case"del":case"strike":return s?`~${s}~`:"";case"code":return s?`\`${s}\``:"";case"pre":return s?`\`\`\`${s}\`\`\``:"";case"a":return(null!==(a=c.getAttribute("href"))&&void 0!==a?a:"")||s;case"br":return"\n";case"p":case"div":return s?`${s}\n`:"\n";case"h1":case"h2":case"h3":case"h4":case"h5":case"h6":return s?`*${s}*\n`:"\n";case"ul":case"ol":case"body":default:return s;case"li":return`• ${s.trimEnd()}\n`;case"blockquote":return s.split("\n").map((e=>e?`> ${e}`:"")).join("\n")+"\n"}}export{e as toWhatsAppText};
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  export declare const Menus: ({
2
3
  displayName: string;
3
4
  key: number;
@@ -26,6 +26,17 @@ export interface EditorFeatures {
26
26
  richPaste?: boolean;
27
27
  /** Enable font family, font size, text alignment, highlight, subscript, superscript, and image. Default: `false`. */
28
28
  richTypography?: boolean;
29
+ /**
30
+ * Restrict which inline marks are active in the editor.
31
+ * When set, only the listed marks are registered — all others are disabled
32
+ * (no rendering, no keyboard shortcuts, no paste preservation).
33
+ * Omit to allow all marks (default).
34
+ *
35
+ * @example
36
+ * // LiveChat: bold only, no italic / underline / strike
37
+ * features={{ allowedMarks: ['bold'] }}
38
+ */
39
+ allowedMarks?: Array<'bold' | 'italic' | 'strike' | 'underline' | 'code'>;
29
40
  }
30
41
  /**
31
42
  * A named content section placed below the main body, separated by an invisible divider.
@@ -478,6 +489,22 @@ export interface BikEditorRef {
478
489
  getBodyContent: () => EditorSnapshot;
479
490
  /** Shorthand for `setSectionContent('body', html)`. */
480
491
  setBodyContent: (html: string) => void;
492
+ /**
493
+ * Atomically sets the body AND all sections in a single editor update.
494
+ * Sections are laid out in the exact order supplied — use this instead of
495
+ * multiple `setSectionContent()` calls whenever order matters (e.g. forward
496
+ * mail where signature must appear before the forwarded thread).
497
+ *
498
+ * @example
499
+ * ref.current?.setBodyAndSections('<p></p>', [
500
+ * { id: 'signature', content: '<p>Alice</p>' },
501
+ * { id: 'forwarded', content: '<p>--- Forwarded ---</p>' },
502
+ * ]);
503
+ */
504
+ setBodyAndSections: (body: string, sections: Array<{
505
+ id: string;
506
+ content: string;
507
+ }>) => void;
481
508
  /**
482
509
  * Appends HTML to the end of the body section without moving the cursor.
483
510
  * Ideal for streaming AI-generated content — call repeatedly with each chunk.
@@ -1,5 +1,20 @@
1
1
  import { Editor } from '@tiptap/core';
2
2
  import { EditorSnapshot, FormatState } from './BikEditor.types';
3
+ /**
4
+ * Normalise HTML before passing it to TipTap.
5
+ *
6
+ * Problem: Quill uses `<p><br></p>` as a blank-line separator. TipTap's
7
+ * HardBreak extension parses that `<br>` as a real `hard_break` node.
8
+ * ProseMirror then also appends `<br class="ProseMirror-trailingBreak">` as a
9
+ * cursor-position decoration, making the empty paragraph render at **2× line
10
+ * height** instead of 1×.
11
+ *
12
+ * Fix: replace `<p><br></p>` → `<p></p>` so TipTap stores a truly empty
13
+ * paragraph. ProseMirror adds only the trailing decoration, giving the correct
14
+ * 1× line height. The WA text output is unchanged (`\n` either way after
15
+ * surrounding-newline collapse in `toWhatsAppText`).
16
+ */
17
+ export declare function normalizeHtml(html: string): string;
3
18
  export declare const SECTION_DIVIDER_HTML: (id: string) => string;
4
19
  /**
5
20
  * Build initial HTML for an editor with one or more named sections below the body.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bikdotai/bik-component-library",
3
- "version": "0.0.788-beta.0",
3
+ "version": "0.0.788-beta.10",
4
4
  "description": "Bik Component Library",
5
5
  "repository": {
6
6
  "type": "git",