@bikdotai/bik-component-library 0.0.804-beta.9 → 0.0.804

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 (67) hide show
  1. package/dist/cjs/editor/BikEditor.js +1 -1
  2. package/dist/cjs/editor/BikEditor.js.map +1 -1
  3. package/dist/cjs/editor/BikEditor.types.js.map +1 -1
  4. package/dist/cjs/editor/BikEditor.utils.js +1 -1
  5. package/dist/cjs/editor/BikEditor.utils.js.map +1 -1
  6. package/dist/cjs/editor/extensions/buildExtensions.js +1 -1
  7. package/dist/cjs/editor/extensions/buildExtensions.js.map +1 -1
  8. package/dist/cjs/editor/extensions/mention/MentionDropdown.js +1 -1
  9. package/dist/cjs/editor/extensions/mention/MentionDropdown.js.map +1 -1
  10. package/dist/cjs/editor/extensions/mention/MentionExtension.js +1 -1
  11. package/dist/cjs/editor/extensions/mention/MentionExtension.js.map +1 -1
  12. package/dist/cjs/editor/extensions/slashCommand/SlashCommandExtension.js +1 -1
  13. package/dist/cjs/editor/extensions/slashCommand/SlashCommandExtension.js.map +1 -1
  14. package/dist/cjs/editor/extensions/slashCommand/SlashCommandMenu.js +1 -1
  15. package/dist/cjs/editor/extensions/slashCommand/SlashCommandMenu.js.map +1 -1
  16. package/dist/cjs/editor/extensions/suggestionPopup.js +2 -0
  17. package/dist/cjs/editor/extensions/suggestionPopup.js.map +1 -0
  18. package/dist/cjs/editor/floating/LinkBubbleMenu.js +1 -1
  19. package/dist/cjs/editor/floating/LinkBubbleMenu.js.map +1 -1
  20. package/dist/cjs/editor/toolbar/BikEditorToolbar.js +1 -1
  21. package/dist/cjs/editor/toolbar/BikEditorToolbar.js.map +1 -1
  22. package/dist/cjs/src/components/QueryBuilder/Triggers/EVENTS/components/EventsTrigger.d.ts +1 -1
  23. package/dist/cjs/src/components/QueryBuilder/Triggers/EVENTS/selectors/useIGTriggerNameCacheSelector.d.ts +1 -1
  24. package/dist/cjs/src/components/QueryBuilder/Triggers/IG/components/IGTrigger.d.ts +1 -1
  25. package/dist/cjs/src/components/QueryBuilder/Triggers/IG/selectors/useIGTriggerNameCacheSelector.d.ts +1 -1
  26. package/dist/cjs/src/components/QueryBuilder/Triggers/components/BaseTriggerQueryBuilderNode.d.ts +2 -2
  27. package/dist/cjs/src/components/bik-layout/MockMenus.d.ts +0 -1
  28. package/dist/cjs/src/editor/BikEditor.types.d.ts +2 -2
  29. package/dist/cjs/src/editor/BikEditor.utils.d.ts +6 -4
  30. package/dist/cjs/src/editor/extensions/buildExtensions.d.ts +9 -3
  31. package/dist/cjs/src/editor/extensions/mention/MentionExtension.d.ts +6 -2
  32. package/dist/cjs/src/editor/extensions/slashCommand/SlashCommandExtension.d.ts +3 -1
  33. package/dist/cjs/src/editor/extensions/suggestionPopup.d.ts +13 -0
  34. package/dist/esm/editor/BikEditor.js +1 -1
  35. package/dist/esm/editor/BikEditor.js.map +1 -1
  36. package/dist/esm/editor/BikEditor.types.js.map +1 -1
  37. package/dist/esm/editor/BikEditor.utils.js +1 -1
  38. package/dist/esm/editor/BikEditor.utils.js.map +1 -1
  39. package/dist/esm/editor/extensions/buildExtensions.js +1 -1
  40. package/dist/esm/editor/extensions/buildExtensions.js.map +1 -1
  41. package/dist/esm/editor/extensions/mention/MentionDropdown.js +1 -1
  42. package/dist/esm/editor/extensions/mention/MentionDropdown.js.map +1 -1
  43. package/dist/esm/editor/extensions/mention/MentionExtension.js +1 -1
  44. package/dist/esm/editor/extensions/mention/MentionExtension.js.map +1 -1
  45. package/dist/esm/editor/extensions/slashCommand/SlashCommandExtension.js +1 -1
  46. package/dist/esm/editor/extensions/slashCommand/SlashCommandExtension.js.map +1 -1
  47. package/dist/esm/editor/extensions/slashCommand/SlashCommandMenu.js +1 -1
  48. package/dist/esm/editor/extensions/slashCommand/SlashCommandMenu.js.map +1 -1
  49. package/dist/esm/editor/extensions/suggestionPopup.js +2 -0
  50. package/dist/esm/editor/extensions/suggestionPopup.js.map +1 -0
  51. package/dist/esm/editor/floating/LinkBubbleMenu.js +1 -1
  52. package/dist/esm/editor/floating/LinkBubbleMenu.js.map +1 -1
  53. package/dist/esm/editor/toolbar/BikEditorToolbar.js +1 -1
  54. package/dist/esm/editor/toolbar/BikEditorToolbar.js.map +1 -1
  55. package/dist/esm/src/components/QueryBuilder/Triggers/EVENTS/components/EventsTrigger.d.ts +1 -1
  56. package/dist/esm/src/components/QueryBuilder/Triggers/EVENTS/selectors/useIGTriggerNameCacheSelector.d.ts +1 -1
  57. package/dist/esm/src/components/QueryBuilder/Triggers/IG/components/IGTrigger.d.ts +1 -1
  58. package/dist/esm/src/components/QueryBuilder/Triggers/IG/selectors/useIGTriggerNameCacheSelector.d.ts +1 -1
  59. package/dist/esm/src/components/QueryBuilder/Triggers/components/BaseTriggerQueryBuilderNode.d.ts +2 -2
  60. package/dist/esm/src/components/bik-layout/MockMenus.d.ts +0 -1
  61. package/dist/esm/src/editor/BikEditor.types.d.ts +2 -2
  62. package/dist/esm/src/editor/BikEditor.utils.d.ts +6 -4
  63. package/dist/esm/src/editor/extensions/buildExtensions.d.ts +9 -3
  64. package/dist/esm/src/editor/extensions/mention/MentionExtension.d.ts +6 -2
  65. package/dist/esm/src/editor/extensions/slashCommand/SlashCommandExtension.d.ts +3 -1
  66. package/dist/esm/src/editor/extensions/suggestionPopup.d.ts +13 -0
  67. package/package.json +1 -2
@@ -1 +1 @@
1
- {"version":3,"file":"buildExtensions.js","sources":["../../../../src/editor/extensions/buildExtensions.ts"],"sourcesContent":["import CharacterCount from '@tiptap/extension-character-count';\nimport Color from '@tiptap/extension-color';\nimport FontFamily from '@tiptap/extension-font-family';\nimport Highlight from '@tiptap/extension-highlight';\nimport Image from '@tiptap/extension-image';\nimport Link from '@tiptap/extension-link';\nimport Placeholder from '@tiptap/extension-placeholder';\nimport Subscript from '@tiptap/extension-subscript';\nimport Superscript from '@tiptap/extension-superscript';\nimport TextAlign from '@tiptap/extension-text-align';\nimport { TextStyle } from '@tiptap/extension-text-style';\nimport Underline from '@tiptap/extension-underline';\nimport StarterKit from '@tiptap/starter-kit';\nimport type { ReactNode } from 'react';\nimport type {\n\tEditorFeatures,\n\tEditorSnapshot,\n\tKeyboardShortcut,\n\tMentionDropdownRenderProps,\n\tMentionItem,\n\tPasteData,\n\tSlashCommandDropdownRenderProps,\n\tSlashCommandItem,\n} from '../BikEditor.types';\nimport { FontSizeExtension } from './FontSizeExtension';\nimport {\n\tbuildAgentMentionExtension,\n\tbuildTeamMentionExtension,\n} from './mention/MentionExtension';\nimport { PasteExtension } from './paste/PasteExtension';\nimport { PlainClipboardExtension } from './plainClipboard/PlainClipboardExtension';\nimport { SectionDividerNode } from './sectionDivider/SectionDividerNode';\nimport { SendShortcutExtension } from './sendShortcut/SendShortcutExtension';\nimport { buildSlashCommandExtension } from './slashCommand/SlashCommandExtension';\nimport { VariableDecorationExtension } from './variable/VariableDecorationExtension';\n\ninterface ExtensionConfig {\n\tfeatures?: EditorFeatures;\n\tplaceholder?: string;\n\tmaxCharacters?: number;\n\thasSections?: boolean;\n\tmentions?: { agents?: MentionItem[]; teams?: MentionItem[] };\n\tslashCommands?: SlashCommandItem[];\n\tonPaste?: (data: PasteData) => boolean | void;\n\tonSend?: (content: EditorSnapshot) => void;\n\tsendShortcut?:\n\t\t| { key: string; modifiers?: Array<'mod' | 'ctrl' | 'shift' | 'alt'> }\n\t\t| Array<{\n\t\t\t\tkey: string;\n\t\t\t\tmodifiers?: Array<'mod' | 'ctrl' | 'shift' | 'alt'>;\n\t\t }>;\n\tshortcuts?: KeyboardShortcut[];\n\tonMentionSelected?: (item: MentionItem, char: '@' | '#') => void;\n\tonSlashCommandSelected?: (command: SlashCommandItem) => void;\n\trenderMentionItem?: (item: MentionItem, isActive: boolean) => ReactNode;\n\trenderMentionDropdown?: (props: MentionDropdownRenderProps) => ReactNode;\n\trenderSlashCommandItem?: (\n\t\titem: SlashCommandItem,\n\t\tisActive: boolean,\n\t) => ReactNode;\n\trenderSlashCommandDropdown?: (\n\t\tprops: SlashCommandDropdownRenderProps,\n\t) => ReactNode;\n}\n\nexport function buildExtensions(config: ExtensionConfig) {\n\tconst hasRichPaste = config.features?.richPaste ?? false;\n\tconst hasRichTypography = config.features?.richTypography ?? false;\n\n\t// When allowedMarks is specified only those marks are registered in the schema.\n\t// This disables rendering, keyboard shortcuts AND paste-preservation for the\n\t// excluded marks — all three come for free when the extension is absent.\n\tconst allowedMarks = config.features?.allowedMarks;\n\tconst isMark = (m: 'bold' | 'italic' | 'strike' | 'underline' | 'code') =>\n\t\t!allowedMarks || allowedMarks.includes(m);\n\n\tconst base = [\n\t\t// Exclude Link and Underline from StarterKit — TipTap v3 bundles both.\n\t\t// Without this, two copies of each are registered and the StarterKit copy's\n\t\t// click handler calls window.open even when openOnClick: false is set.\n\t\tStarterKit.configure({\n\t\t\tlink: false,\n\t\t\tunderline: false,\n\t\t\tbold: isMark('bold') ? {} : false,\n\t\t\titalic: isMark('italic') ? {} : false,\n\t\t\tstrike: isMark('strike') ? {} : false,\n\t\t\tcode: isMark('code') ? {} : false,\n\t\t}),\n\t\t...(isMark('underline') ? [Underline] : []),\n\t\t// Extend Link to strip addPasteRules() and addInputRules() so pasting a\n\t\t// URL never creates a hyperlink regardless of autolink/linkOnPaste values.\n\t\tLink.extend({\n\t\t\taddPasteRules: () => [],\n\t\t\taddInputRules: () => [],\n\t\t}).configure({\n\t\t\topenOnClick: false,\n\t\t\tautolink: false,\n\t\t\tlinkOnPaste: false,\n\t\t\tHTMLAttributes: {\n\t\t\t\trel: 'noopener noreferrer',\n\t\t\t\tclass: 'bik-link',\n\t\t\t},\n\t\t}),\n\t\tTextStyle,\n\t\tPlaceholder.configure({\n\t\t\tplaceholder: config.placeholder ?? 'Type a message...',\n\t\t}),\n\t\t// Consumer paste callback runs first. If it returns true the event is\n\t\t// consumed and neither PlainClipboardExtension nor the editor's default\n\t\t// paste handling will run for that event.\n\t\t...(config.onPaste\n\t\t\t? [PasteExtension.configure({ onPaste: config.onPaste })]\n\t\t\t: []),\n\t\t// Strip HTML on paste for non-rich modes so plain text is inserted.\n\t\t...(!hasRichPaste ? [PlainClipboardExtension] : []),\n\t\tSendShortcutExtension.configure({\n\t\t\tonSend: config.onSend,\n\t\t\tsendShortcut: config.sendShortcut,\n\t\t\textraShortcuts: config.shortcuts ?? [],\n\t\t}),\n\t\tVariableDecorationExtension,\n\t\t...(config.maxCharacters\n\t\t\t? [CharacterCount.configure({ limit: config.maxCharacters })]\n\t\t\t: []),\n\t\t// Always register SectionDividerNode so the custom <div data-section-divider>\n\t\t// node is part of the schema in every editor instance. This means imperative\n\t\t// callers (setBodyAndSections / setSectionContent) work even when no\n\t\t// `sections` prop was provided at mount time.\n\t\tSectionDividerNode,\n\t];\n\n\tconst mentionExtensions = [\n\t\t...(config.mentions?.agents?.length\n\t\t\t? [\n\t\t\t\t\tbuildAgentMentionExtension(\n\t\t\t\t\t\tconfig.mentions.agents,\n\t\t\t\t\t\tconfig.onMentionSelected,\n\t\t\t\t\t\tconfig.renderMentionItem,\n\t\t\t\t\t\tconfig.renderMentionDropdown,\n\t\t\t\t\t),\n\t\t\t ]\n\t\t\t: []),\n\t\t...(config.mentions?.teams?.length\n\t\t\t? [\n\t\t\t\t\tbuildTeamMentionExtension(\n\t\t\t\t\t\tconfig.mentions.teams,\n\t\t\t\t\t\tconfig.onMentionSelected,\n\t\t\t\t\t\tconfig.renderMentionItem,\n\t\t\t\t\t\tconfig.renderMentionDropdown,\n\t\t\t\t\t),\n\t\t\t ]\n\t\t\t: []),\n\t\t...(config.slashCommands?.length\n\t\t\t? [\n\t\t\t\t\tbuildSlashCommandExtension(\n\t\t\t\t\t\tconfig.slashCommands,\n\t\t\t\t\t\tconfig.onSlashCommandSelected,\n\t\t\t\t\t\tconfig.renderSlashCommandItem,\n\t\t\t\t\t\tconfig.renderSlashCommandDropdown,\n\t\t\t\t\t),\n\t\t\t ]\n\t\t\t: []),\n\t];\n\n\tconst richExtensions = hasRichTypography\n\t\t? [\n\t\t\t\tColor,\n\t\t\t\tHighlight.configure({ multicolor: true }),\n\t\t\t\tFontFamily,\n\t\t\t\tFontSizeExtension,\n\t\t\t\tTextAlign.configure({ types: ['heading', 'paragraph'] }),\n\t\t\t\tSubscript,\n\t\t\t\tSuperscript,\n\t\t\t\tImage,\n\t\t ]\n\t\t: [Color];\n\n\treturn [...base, ...mentionExtensions, ...richExtensions];\n}\n"],"names":["config","hasRichPaste","_b","_a","features","richPaste","hasRichTypography","_d","_c","richTypography","allowedMarks","_e","isMark","m","includes","StarterKit","configure","link","underline","bold","italic","strike","code","Underline","Link","extend","addPasteRules","addInputRules","openOnClick","autolink","linkOnPaste","HTMLAttributes","rel","class","TextStyle","Placeholder","placeholder","_f","onPaste","PasteExtension","PlainClipboardExtension","SendShortcutExtension","onSend","sendShortcut","extraShortcuts","_g","shortcuts","VariableDecorationExtension","maxCharacters","CharacterCount","limit","SectionDividerNode","_j","_h","mentions","agents","length","buildAgentMentionExtension","onMentionSelected","renderMentionItem","renderMentionDropdown","_l","_k","teams","buildTeamMentionExtension","_m","slashCommands","buildSlashCommandExtension","onSlashCommandSelected","renderSlashCommandItem","renderSlashCommandDropdown","Color","Highlight","multicolor","FontFamily","FontSizeExtension","TextAlign","types","Subscript","Superscript","Image"],"mappings":"kpCAiEM,SAA0BA,+BAC/B,MAAMC,EAA6C,QAA9BC,EAAiB,QAAjBC,EAAAH,EAAOI,gBAAU,IAAAD,OAAA,EAAAA,EAAAE,iBAAa,IAAAH,GAAAA,EAC7CI,EAAuD,QAAnCC,EAAiB,QAAjBC,EAAAR,EAAOI,gBAAU,IAAAI,OAAA,EAAAA,EAAAC,sBAAkB,IAAAF,GAAAA,EAKvDG,EAA8B,QAAfC,EAAAX,EAAOI,gBAAQ,IAAAO,OAAA,EAAAA,EAAED,aAChCE,EAAUC,IACdH,GAAgBA,EAAaI,SAASD,GAuGxC,MAAO,IArGM,CAIZE,EAAAA,QAAWC,UAAU,CACpBC,MAAM,EACNC,WAAW,EACXC,OAAMP,EAA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E,EAAOkE,cACPlE,EAAOoE,uBACPpE,EAAOqE,uBACPrE,EAAOsE,6BAGR,OAGmBhE,EACpB,CACAiE,EAAAA,QACAC,EAAAA,QAAUxD,UAAU,CAAEyD,YAAY,IAClCC,EAAU,QACVC,oBACAC,EAAAA,QAAU5D,UAAU,CAAE6D,MAAO,CAAC,UAAW,eACzCC,EAAS,QACTC,EAAW,QACXC,EAAK,SAEL,CAACT,EAAK,SAGV"}
1
+ {"version":3,"file":"buildExtensions.js","sources":["../../../../src/editor/extensions/buildExtensions.ts"],"sourcesContent":["import CharacterCount from '@tiptap/extension-character-count';\nimport Color from '@tiptap/extension-color';\nimport FontFamily from '@tiptap/extension-font-family';\nimport Highlight from '@tiptap/extension-highlight';\nimport Image from '@tiptap/extension-image';\nimport Link from '@tiptap/extension-link';\nimport Placeholder from '@tiptap/extension-placeholder';\nimport Subscript from '@tiptap/extension-subscript';\nimport Superscript from '@tiptap/extension-superscript';\nimport TextAlign from '@tiptap/extension-text-align';\nimport { TextStyle } from '@tiptap/extension-text-style';\nimport Underline from '@tiptap/extension-underline';\nimport StarterKit from '@tiptap/starter-kit';\nimport type { ReactNode } from 'react';\nimport type {\n\tEditorFeatures,\n\tEditorSnapshot,\n\tKeyboardShortcut,\n\tMentionDropdownRenderProps,\n\tMentionItem,\n\tPasteData,\n\tSlashCommandDropdownRenderProps,\n\tSlashCommandItem,\n} from '../BikEditor.types';\nimport { FontSizeExtension } from './FontSizeExtension';\nimport {\n\tbuildAgentMentionExtension,\n\tbuildTeamMentionExtension,\n} from './mention/MentionExtension';\nimport { PasteExtension } from './paste/PasteExtension';\nimport { PlainClipboardExtension } from './plainClipboard/PlainClipboardExtension';\nimport { SectionDividerNode } from './sectionDivider/SectionDividerNode';\nimport { SendShortcutExtension } from './sendShortcut/SendShortcutExtension';\nimport { buildSlashCommandExtension } from './slashCommand/SlashCommandExtension';\nimport { VariableDecorationExtension } from './variable/VariableDecorationExtension';\n\ninterface ExtensionConfig {\n\tfeatures?: EditorFeatures;\n\tplaceholder?: string;\n\tmaxCharacters?: number;\n\thasSections?: boolean;\n\tmentions?: {\n\t\tagents?: { current: MentionItem[] };\n\t\tteams?: { current: MentionItem[] };\n\t};\n\tslashCommands?: { current: SlashCommandItem[] };\n\tonPaste?: (data: PasteData) => boolean | void;\n\tonSend?: (content: EditorSnapshot) => void;\n\tsendShortcut?:\n\t\t| { key: string; modifiers?: Array<'mod' | 'ctrl' | 'shift' | 'alt'> }\n\t\t| Array<{\n\t\t\t\tkey: string;\n\t\t\t\tmodifiers?: Array<'mod' | 'ctrl' | 'shift' | 'alt'>;\n\t\t }>;\n\tshortcuts?: KeyboardShortcut[];\n\tonMentionSelected?: (item: MentionItem, char: '@' | '#') => void;\n\tonSlashCommandSelected?: (command: SlashCommandItem) => void;\n\trenderMentionItem?: (item: MentionItem, isActive: boolean) => ReactNode;\n\trenderMentionDropdown?: (props: MentionDropdownRenderProps) => ReactNode;\n\trenderSlashCommandItem?: (\n\t\titem: SlashCommandItem,\n\t\tisActive: boolean,\n\t) => ReactNode;\n\trenderSlashCommandDropdown?: (\n\t\tprops: SlashCommandDropdownRenderProps,\n\t) => ReactNode;\n}\n\nexport function buildExtensions(config: ExtensionConfig) {\n\tconst hasRichPaste = config.features?.richPaste ?? false;\n\tconst hasRichTypography = config.features?.richTypography ?? false;\n\n\t// When allowedMarks is specified only those marks are registered in the schema.\n\t// This disables rendering, keyboard shortcuts AND paste-preservation for the\n\t// excluded marks — all three come for free when the extension is absent.\n\tconst allowedMarks = config.features?.allowedMarks;\n\tconst isMark = (m: 'bold' | 'italic' | 'strike' | 'underline' | 'code') =>\n\t\t!allowedMarks || allowedMarks.includes(m);\n\n\tconst base = [\n\t\t// Exclude Link and Underline from StarterKit — TipTap v3 bundles both.\n\t\t// Without this, two copies of each are registered and the StarterKit copy's\n\t\t// click handler calls window.open even when openOnClick: false is set.\n\t\tStarterKit.configure({\n\t\t\tlink: false,\n\t\t\tunderline: false,\n\t\t\tbold: isMark('bold') ? {} : false,\n\t\t\titalic: isMark('italic') ? {} : false,\n\t\t\tstrike: isMark('strike') ? {} : false,\n\t\t\tcode: isMark('code') ? {} : false,\n\t\t}),\n\t\t...(isMark('underline') ? [Underline] : []),\n\t\t// Extend Link to strip addPasteRules() and addInputRules() so pasting a\n\t\t// URL never creates a hyperlink regardless of autolink/linkOnPaste values.\n\t\tLink.extend({\n\t\t\taddPasteRules: () => [],\n\t\t\taddInputRules: () => [],\n\t\t}).configure({\n\t\t\topenOnClick: false,\n\t\t\tautolink: false,\n\t\t\tlinkOnPaste: false,\n\t\t\tHTMLAttributes: {\n\t\t\t\trel: 'noopener noreferrer',\n\t\t\t\tclass: 'bik-link',\n\t\t\t},\n\t\t}),\n\t\tTextStyle,\n\t\tPlaceholder.configure({\n\t\t\tplaceholder: config.placeholder ?? 'Type a message...',\n\t\t}),\n\t\t// Consumer paste callback runs first. If it returns true the event is\n\t\t// consumed and neither PlainClipboardExtension nor the editor's default\n\t\t// paste handling will run for that event.\n\t\t...(config.onPaste\n\t\t\t? [PasteExtension.configure({ onPaste: config.onPaste })]\n\t\t\t: []),\n\t\t// Strip HTML on paste for non-rich modes so plain text is inserted.\n\t\t...(!hasRichPaste ? [PlainClipboardExtension] : []),\n\t\tSendShortcutExtension.configure({\n\t\t\tonSend: config.onSend,\n\t\t\tsendShortcut: config.sendShortcut,\n\t\t\textraShortcuts: config.shortcuts ?? [],\n\t\t}),\n\t\tVariableDecorationExtension,\n\t\t...(config.maxCharacters\n\t\t\t? [CharacterCount.configure({ limit: config.maxCharacters })]\n\t\t\t: []),\n\t\t// Always register SectionDividerNode so the custom <div data-section-divider>\n\t\t// node is part of the schema in every editor instance. This means imperative\n\t\t// callers (setBodyAndSections / setSectionContent) work even when no\n\t\t// `sections` prop was provided at mount time.\n\t\tSectionDividerNode,\n\t];\n\n\tconst mentionExtensions = [\n\t\t...(config.mentions?.agents\n\t\t\t? [\n\t\t\t\t\tbuildAgentMentionExtension(\n\t\t\t\t\t\tconfig.mentions.agents,\n\t\t\t\t\t\tconfig.onMentionSelected,\n\t\t\t\t\t\tconfig.renderMentionItem,\n\t\t\t\t\t\tconfig.renderMentionDropdown,\n\t\t\t\t\t),\n\t\t\t ]\n\t\t\t: []),\n\t\t...(config.mentions?.teams\n\t\t\t? [\n\t\t\t\t\tbuildTeamMentionExtension(\n\t\t\t\t\t\tconfig.mentions.teams,\n\t\t\t\t\t\tconfig.onMentionSelected,\n\t\t\t\t\t\tconfig.renderMentionItem,\n\t\t\t\t\t\tconfig.renderMentionDropdown,\n\t\t\t\t\t),\n\t\t\t ]\n\t\t\t: []),\n\t\t...(config.slashCommands\n\t\t\t? [\n\t\t\t\t\tbuildSlashCommandExtension(\n\t\t\t\t\t\tconfig.slashCommands,\n\t\t\t\t\t\tconfig.onSlashCommandSelected,\n\t\t\t\t\t\tconfig.renderSlashCommandItem,\n\t\t\t\t\t\tconfig.renderSlashCommandDropdown,\n\t\t\t\t\t),\n\t\t\t ]\n\t\t\t: []),\n\t];\n\n\tconst richExtensions = hasRichTypography\n\t\t? [\n\t\t\t\tColor,\n\t\t\t\tHighlight.configure({ multicolor: true }),\n\t\t\t\tFontFamily,\n\t\t\t\tFontSizeExtension,\n\t\t\t\tTextAlign.configure({ types: ['heading', 'paragraph'] }),\n\t\t\t\tSubscript,\n\t\t\t\tSuperscript,\n\t\t\t\tImage,\n\t\t ]\n\t\t: [Color];\n\n\treturn [...base, ...mentionExtensions, ...richExtensions];\n}\n"],"names":["config","hasRichPaste","_b","_a","features","richPaste","hasRichTypography","_d","_c","richTypography","allowedMarks","_e","isMark","m","includes","StarterKit","configure","link","underline","bold","italic","strike","code","Underline","Link","extend","addPasteRules","addInputRules","openOnClick","autolink","linkOnPaste","HTMLAttributes","rel","class","TextStyle","Placeholder","placeholder","_f","onPaste","PasteExtension","PlainClipboardExtension","SendShortcutExtension","onSend","sendShortcut","extraShortcuts","_g","shortcuts","VariableDecorationExtension","maxCharacters","CharacterCount","limit","SectionDividerNode","_h","mentions","agents","buildAgentMentionExtension","onMentionSelected","renderMentionItem","renderMentionDropdown","_j","teams","buildTeamMentionExtension","slashCommands","buildSlashCommandExtension","onSlashCommandSelected","renderSlashCommandItem","renderSlashCommandDropdown","Color","Highlight","multicolor","FontFamily","FontSizeExtension","TextAlign","types","Subscript","Superscript","Image"],"mappings":"kpCAoEM,SAA0BA,yBAC/B,MAAMC,EAA6C,QAA9BC,EAAiB,QAAjBC,EAAAH,EAAOI,gBAAU,IAAAD,OAAA,EAAAA,EAAAE,iBAAa,IAAAH,GAAAA,EAC7CI,EAAuD,QAAnCC,EAAiB,QAAjBC,EAAAR,EAAOI,gBAAU,IAAAI,OAAA,EAAAA,EAAAC,sBAAkB,IAAAF,GAAAA,EAKvDG,EAA8B,QAAfC,EAAAX,EAAOI,gBAAQ,IAAAO,OAAA,EAAAA,EAAED,aAChCE,EAAUC,IACdH,GAAgBA,EAAaI,SAASD,GAuGxC,MAAO,IArGM,CAIZE,EAAAA,QAAWC,UAAU,CACpBC,MAAM,EACNC,WAAW,EACXC,OAAMP,EAAO,SAAU,CAAE,EACzBQ,SAAQR,EAAO,WAAY,CAAE,EAC7BS,SAAQT,EAAO,WAAY,CAAE,EAC7BU,OAAMV,EAAO,SAAU,CAAE,OAEtBA,EAAO,aAAe,CAACW,EAAAA,SAAa,GAGxCC,EAAAA,QAAKC,OAAO,CACXC,cAAeA,IAAM,GACrBC,cAAeA,IAAM,KACnBX,UAAU,CACZY,aAAa,EACbC,UAAU,EACVC,aAAa,EACbC,eAAgB,CACfC,IAAK,sBACLC,MAAO,cAGTC,EAAAA,UACAC,EAAW,QAACnB,UAAU,CACrBoB,oBAAaC,EAAArC,EAAOoC,2BAAe,yBAKhCpC,EAAOsC,QACR,CAACC,EAAAA,eAAevB,UAAU,CAAEsB,QAAStC,EAAOsC,WAC5C,MAEErC,EAA2C,GAA5B,CAACuC,EAAuBA,yBAC5CC,EAAqBA,sBAACzB,UAAU,CAC/B0B,OAAQ1C,EAAO0C,OACfC,aAAc3C,EAAO2C,aACrBC,uBAAgBC,EAAA7C,EAAO8C,yBAAa,KAErCC,EAA2BA,+BACvB/C,EAAOgD,cACR,CAACC,EAAc,QAACjC,UAAU,CAAEkC,MAAOlD,EAAOgD,iBAC1C,GAKHG,EAAAA,uBAGyB,aACrBC,EAAApD,EAAOqD,+BAAUC,QAClB,CACAC,6BACCvD,EAAOqD,SAASC,OAChBtD,EAAOwD,kBACPxD,EAAOyD,kBACPzD,EAAO0D,wBAGR,eACCC,EAAA3D,EAAOqD,+BAAUO,OAClB,CACAC,EAAyBA,0BACxB7D,EAAOqD,SAASO,MAChB5D,EAAOwD,kBACPxD,EAAOyD,kBACPzD,EAAO0D,wBAGR,MACC1D,EAAO8D,cACR,CACAC,EAAAA,2BACC/D,EAAO8D,cACP9D,EAAOgE,uBACPhE,EAAOiE,uBACPjE,EAAOkE,6BAGR,OAGmB5D,EACpB,CACA6D,EAAAA,QACAC,EAAAA,QAAUpD,UAAU,CAAEqD,YAAY,IAClCC,EAAU,QACVC,oBACAC,EAAAA,QAAUxD,UAAU,CAAEyD,MAAO,CAAC,UAAW,eACzCC,EAAS,QACTC,EAAW,QACXC,EAAK,SAEL,CAACT,EAAK,SAGV"}
@@ -1,2 +1,2 @@
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:s,query:l,command:i,renderItem:a,renderDropdown:c}=t;const[d,u]=n.useState(0),p=n.useRef(null),j=n.useCallback((e=>{const n=p.current;if(!n)return;const r=n.children[e];null==r||r.scrollIntoView({block:"nearest"})}),[]),h=e=>{s[e]&&i(s[e])};return n.useImperativeHandle(o,(()=>({onKeyDown:e=>{let{event:n}=e;return"ArrowUp"===n.key?(u((e=>{const n=(e+s.length-1)%s.length;return j(n),n})),!0):"ArrowDown"===n.key?(u((e=>{const n=(e+1)%s.length;return j(n),n})),!0):"Enter"===n.key&&(h(d),!0)}}))),n.useEffect((()=>u(0)),[s]),s.length?c?e.jsx(e.Fragment,{children:c({items:s,query:l,activeIndex:d,onSelect:e=>i(e)})}):e.jsx(r.DropdownContainer,Object.assign({ref:p},{children:s.map(((n,t)=>e.jsx(r.DropdownItem,Object.assign({$isActive:t===d,onMouseEnter:()=>u(t),onClick:()=>h(t)},{children:a?a(n,t===d):e.jsxs(e.Fragment,{children:[n.avatarUrl?e.jsx(r.MentionAvatar,{src:n.avatarUrl,alt:""}):e.jsx(r.MentionAvatarFallback,{children:n.label.charAt(0).toUpperCase()}),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:l,query:s,command:i,renderItem:a,renderDropdown:c}=t;const[d,u]=n.useState(0),p=n.useRef(null),h=n.useCallback((e=>{const n=p.current;if(!n)return;const r=n.children[e];null==r||r.scrollIntoView({block:"nearest"})}),[]),j=e=>{l[e]&&i(l[e])};return n.useImperativeHandle(o,(()=>({onKeyDown:e=>{let{event:n}=e;return!!l.length&&("ArrowUp"===n.key?(u((e=>{const n=(e+l.length-1)%l.length;return h(n),n})),!0):"ArrowDown"===n.key?(u((e=>{const n=(e+1)%l.length;return h(n),n})),!0):"Enter"===n.key&&(j(d),!0))}}))),n.useEffect((()=>u(0)),[l]),l.length?c?e.jsx(e.Fragment,{children:c({items:l,query:s,activeIndex:d,onSelect:e=>i(e)})}):e.jsx(r.DropdownContainer,Object.assign({ref:p},{children:l.map(((n,t)=>e.jsx(r.DropdownItem,Object.assign({$isActive:t===d,onMouseEnter:()=>u(t),onClick:()=>j(t)},{children:a?a(n,t===d):e.jsxs(e.Fragment,{children:[n.avatarUrl?e.jsx(r.MentionAvatar,{src:n.avatarUrl,alt:""}):e.jsx(r.MentionAvatarFallback,{children:n.label.charAt(0).toUpperCase()}),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;
2
2
  //# sourceMappingURL=MentionDropdown.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"MentionDropdown.js","sources":["../../../../../src/editor/extensions/mention/MentionDropdown.tsx"],"sourcesContent":["import React, {\n\tforwardRef,\n\tuseCallback,\n\tuseEffect,\n\tuseImperativeHandle,\n\tuseRef,\n\tuseState,\n} from 'react';\nimport type {\n\tMentionDropdownRenderProps,\n\tMentionItem,\n} from '../../BikEditor.types';\nimport {\n\tDropdownContainer,\n\tDropdownItem,\n\tMentionAvatar,\n\tMentionAvatarFallback,\n\tMentionLabel,\n\tMentionPresenceDot,\n} from '../editorDropdown.styles';\n\ninterface Props {\n\titems: MentionItem[];\n\tquery: string;\n\tcommand: (item: MentionItem) => void;\n\t/** Custom per-row renderer. Receives the item and whether it is the active row. */\n\trenderItem?: (item: MentionItem, isActive: boolean) => React.ReactNode;\n\t/**\n\t * Full custom dropdown renderer. Takes priority over renderItem.\n\t * The editor passes activeIndex and onSelect — you handle all the visual rendering.\n\t */\n\trenderDropdown?: (props: MentionDropdownRenderProps) => React.ReactNode;\n}\n\nexport const MentionDropdown = forwardRef<any, Props>(\n\t({ items, query, command, renderItem, renderDropdown }, ref) => {\n\t\tconst [selectedIndex, setSelectedIndex] = useState(0);\n\t\tconst containerRef = useRef<HTMLDivElement>(null);\n\n\t\tconst scrollToIndex = useCallback((index: number) => {\n\t\t\tconst container = containerRef.current;\n\t\t\tif (!container) return;\n\t\t\tconst item = container.children[index] as HTMLElement | undefined;\n\t\t\titem?.scrollIntoView({ block: 'nearest' });\n\t\t}, []);\n\n\t\tconst select = (i: number) => {\n\t\t\tif (items[i]) command(items[i]);\n\t\t};\n\n\t\tuseImperativeHandle(ref, () => ({\n\t\t\tonKeyDown: ({ event }: { event: KeyboardEvent }) => {\n\t\t\t\tif (event.key === 'ArrowUp') {\n\t\t\t\t\tsetSelectedIndex((prev) => {\n\t\t\t\t\t\tconst next = (prev + items.length - 1) % items.length;\n\t\t\t\t\t\tscrollToIndex(next);\n\t\t\t\t\t\treturn next;\n\t\t\t\t\t});\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t\tif (event.key === 'ArrowDown') {\n\t\t\t\t\tsetSelectedIndex((prev) => {\n\t\t\t\t\t\tconst next = (prev + 1) % items.length;\n\t\t\t\t\t\tscrollToIndex(next);\n\t\t\t\t\t\treturn next;\n\t\t\t\t\t});\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t\tif (event.key === 'Enter') {\n\t\t\t\t\tselect(selectedIndex);\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t\treturn false;\n\t\t\t},\n\t\t}));\n\n\t\tuseEffect(() => setSelectedIndex(0), [items]);\n\n\t\tif (!items.length) return null;\n\n\t\t// Full custom dropdown — editor still manages keyboard nav via selectedIndex\n\t\tif (renderDropdown) {\n\t\t\treturn (\n\t\t\t\t<>\n\t\t\t\t\t{renderDropdown({\n\t\t\t\t\t\titems,\n\t\t\t\t\t\tquery,\n\t\t\t\t\t\tactiveIndex: selectedIndex,\n\t\t\t\t\t\tonSelect: (item) => command(item),\n\t\t\t\t\t})}\n\t\t\t\t</>\n\t\t\t);\n\t\t}\n\n\t\treturn (\n\t\t\t<DropdownContainer ref={containerRef}>\n\t\t\t\t{items.map((item, i) => (\n\t\t\t\t\t<DropdownItem\n\t\t\t\t\t\tkey={item.id}\n\t\t\t\t\t\t$isActive={i === selectedIndex}\n\t\t\t\t\t\tonMouseEnter={() => setSelectedIndex(i)}\n\t\t\t\t\t\tonClick={() => select(i)}\n\t\t\t\t\t>\n\t\t\t\t\t\t{renderItem ? (\n\t\t\t\t\t\t\trenderItem(item, i === selectedIndex)\n\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t{item.avatarUrl ? (\n\t\t\t\t\t\t\t\t\t<MentionAvatar src={item.avatarUrl} alt=\"\" />\n\t\t\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t\t\t<MentionAvatarFallback>\n\t\t\t\t\t\t\t\t\t\t{item.label.charAt(0).toUpperCase()}\n\t\t\t\t\t\t\t\t\t</MentionAvatarFallback>\n\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t\t<MentionLabel>{item.label}</MentionLabel>\n\t\t\t\t\t\t\t\t{item.isOnline !== undefined && (\n\t\t\t\t\t\t\t\t\t<MentionPresenceDot $online={item.isOnline} />\n\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t)}\n\t\t\t\t\t</DropdownItem>\n\t\t\t\t))}\n\t\t\t</DropdownContainer>\n\t\t);\n\t},\n);\nMentionDropdown.displayName = 'MentionDropdown';\n"],"names":["MentionDropdown","forwardRef","_ref","ref","items","query","command","renderItem","renderDropdown","selectedIndex","setSelectedIndex","useState","containerRef","useRef","scrollToIndex","useCallback","index","container","current","item","children","scrollIntoView","block","select","i","useImperativeHandle","onKeyDown","_ref2","event","key","prev","next","length","useEffect","_jsx","_Fragment","activeIndex","onSelect","DropdownContainer","Object","assign","map","DropdownItem","onMouseEnter","onClick","_jsxs","jsxs","avatarUrl","MentionAvatar","src","alt","jsx","MentionAvatarFallback","label","charAt","toUpperCase","MentionLabel","undefined","isOnline","MentionPresenceDot","$online","id","displayName"],"mappings":"mKAkCO,MAAMA,EAAkBC,EAAUA,YACxC,CAAAC,EAAwDC,KAAO,IAA9DC,MAAEA,EAAKC,MAAEA,EAAKC,QAAEA,EAAOC,WAAEA,EAAUC,eAAEA,GAAgBN,EACrD,MAAOO,EAAeC,GAAoBC,EAAQA,SAAC,GAC7CC,EAAeC,SAAuB,MAEtCC,EAAgBC,EAAWA,aAAEC,IAClC,MAAMC,EAAYL,EA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B,EAAAiB,IAACK,eAAY,CAAApC,SAAED,EAAKkC,aACDI,IAAlBtC,EAAKuC,UACLxB,EAAAA,IAACyB,EAAAA,mBAA4B,CAAAC,QAAAzC,EAAKuC,gBAlBhCvC,EAAK0C,SApBY,IA4CL,IAIvB7D,EAAgB8D,YAAc"}
1
+ {"version":3,"file":"MentionDropdown.js","sources":["../../../../../src/editor/extensions/mention/MentionDropdown.tsx"],"sourcesContent":["import React, {\n\tforwardRef,\n\tuseCallback,\n\tuseEffect,\n\tuseImperativeHandle,\n\tuseRef,\n\tuseState,\n} from 'react';\nimport type {\n\tMentionDropdownRenderProps,\n\tMentionItem,\n} from '../../BikEditor.types';\nimport {\n\tDropdownContainer,\n\tDropdownItem,\n\tMentionAvatar,\n\tMentionAvatarFallback,\n\tMentionLabel,\n\tMentionPresenceDot,\n} from '../editorDropdown.styles';\n\ninterface Props {\n\titems: MentionItem[];\n\tquery: string;\n\tcommand: (item: MentionItem) => void;\n\t/** Custom per-row renderer. Receives the item and whether it is the active row. */\n\trenderItem?: (item: MentionItem, isActive: boolean) => React.ReactNode;\n\t/**\n\t * Full custom dropdown renderer. Takes priority over renderItem.\n\t * The editor passes activeIndex and onSelect — you handle all the visual rendering.\n\t */\n\trenderDropdown?: (props: MentionDropdownRenderProps) => React.ReactNode;\n}\n\nexport const MentionDropdown = forwardRef<any, Props>(\n\t({ items, query, command, renderItem, renderDropdown }, ref) => {\n\t\tconst [selectedIndex, setSelectedIndex] = useState(0);\n\t\tconst containerRef = useRef<HTMLDivElement>(null);\n\n\t\tconst scrollToIndex = useCallback((index: number) => {\n\t\t\tconst container = containerRef.current;\n\t\t\tif (!container) return;\n\t\t\tconst item = container.children[index] as HTMLElement | undefined;\n\t\t\titem?.scrollIntoView({ block: 'nearest' });\n\t\t}, []);\n\n\t\tconst select = (i: number) => {\n\t\t\tif (items[i]) command(items[i]);\n\t\t};\n\n\t\tuseImperativeHandle(ref, () => ({\n\t\t\tonKeyDown: ({ event }: { event: KeyboardEvent }) => {\n\t\t\t\tif (!items.length) return false;\n\t\t\t\tif (event.key === 'ArrowUp') {\n\t\t\t\t\tsetSelectedIndex((prev) => {\n\t\t\t\t\t\tconst next = (prev + items.length - 1) % items.length;\n\t\t\t\t\t\tscrollToIndex(next);\n\t\t\t\t\t\treturn next;\n\t\t\t\t\t});\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t\tif (event.key === 'ArrowDown') {\n\t\t\t\t\tsetSelectedIndex((prev) => {\n\t\t\t\t\t\tconst next = (prev + 1) % items.length;\n\t\t\t\t\t\tscrollToIndex(next);\n\t\t\t\t\t\treturn next;\n\t\t\t\t\t});\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t\tif (event.key === 'Enter') {\n\t\t\t\t\tselect(selectedIndex);\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t\treturn false;\n\t\t\t},\n\t\t}));\n\n\t\tuseEffect(() => setSelectedIndex(0), [items]);\n\n\t\tif (!items.length) return null;\n\n\t\t// Full custom dropdown — editor still manages keyboard nav via selectedIndex\n\t\tif (renderDropdown) {\n\t\t\treturn (\n\t\t\t\t<>\n\t\t\t\t\t{renderDropdown({\n\t\t\t\t\t\titems,\n\t\t\t\t\t\tquery,\n\t\t\t\t\t\tactiveIndex: selectedIndex,\n\t\t\t\t\t\tonSelect: (item) => command(item),\n\t\t\t\t\t})}\n\t\t\t\t</>\n\t\t\t);\n\t\t}\n\n\t\treturn (\n\t\t\t<DropdownContainer ref={containerRef}>\n\t\t\t\t{items.map((item, i) => (\n\t\t\t\t\t<DropdownItem\n\t\t\t\t\t\tkey={item.id}\n\t\t\t\t\t\t$isActive={i === selectedIndex}\n\t\t\t\t\t\tonMouseEnter={() => setSelectedIndex(i)}\n\t\t\t\t\t\tonClick={() => select(i)}\n\t\t\t\t\t>\n\t\t\t\t\t\t{renderItem ? (\n\t\t\t\t\t\t\trenderItem(item, i === selectedIndex)\n\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t{item.avatarUrl ? (\n\t\t\t\t\t\t\t\t\t<MentionAvatar src={item.avatarUrl} alt=\"\" />\n\t\t\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t\t\t<MentionAvatarFallback>\n\t\t\t\t\t\t\t\t\t\t{item.label.charAt(0).toUpperCase()}\n\t\t\t\t\t\t\t\t\t</MentionAvatarFallback>\n\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t\t<MentionLabel>{item.label}</MentionLabel>\n\t\t\t\t\t\t\t\t{item.isOnline !== undefined && (\n\t\t\t\t\t\t\t\t\t<MentionPresenceDot $online={item.isOnline} />\n\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t)}\n\t\t\t\t\t</DropdownItem>\n\t\t\t\t))}\n\t\t\t</DropdownContainer>\n\t\t);\n\t},\n);\nMentionDropdown.displayName = 'MentionDropdown';\n"],"names":["MentionDropdown","forwardRef","_ref","ref","items","query","command","renderItem","renderDropdown","selectedIndex","setSelectedIndex","useState","containerRef","useRef","scrollToIndex","useCallback","index","container","current","item","children","scrollIntoView","block","select","i","useImperativeHandle","onKeyDown","_ref2","event","length","key","prev","next","useEffect","_jsx","_Fragment","activeIndex","onSelect","DropdownContainer","Object","assign","map","DropdownItem","onMouseEnter","onClick","_jsxs","jsxs","avatarUrl","MentionAvatar","src","alt","jsx","MentionAvatarFallback","label","charAt","toUpperCase","MentionLabel","undefined","isOnline","MentionPresenceDot","$online","id","displayName"],"mappings":"mKAkCO,MAAMA,EAAkBC,EAAUA,YACxC,CAAAC,EAAwDC,KAAO,IAA9DC,MAAEA,EAAKC,MAAEA,EAAKC,QAAEA,EAAOC,WAAEA,EAAUC,eAAEA,GAAgBN,EACrD,MAAOO,EAAeC,GAAoBC,EAAQA,SAAC,GAC7CC,EAAeC,SAAuB,MAEtCC,EAAgBC,EAAWA,aAAEC,IAClC,MAAMC,EAAYL,EAAaM,QAC/B,IAAKD,EAAW,O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eAAY,CAAApC,SAAED,EAAKkC,aACDI,IAAlBtC,EAAKuC,UACLxB,EAAAA,IAACyB,EAAAA,mBAA4B,CAAAC,QAAAzC,EAAKuC,gBAlBhCvC,EAAK0C,SApBY,IA4CL,IAIvB7D,EAAgB8D,YAAc"}
@@ -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("tippy.js"),o=require("./MentionDropdown.js");function i(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var s=i(t),a=i(r);function d(e){let t=arguments.length>2?arguments[2]:void 0,r=arguments.length>3?arguments[3]:void 0;return()=>{let e,i;return{onStart:s=>{e=new n.ReactRenderer(o.MentionDropdown,{props:Object.assign(Object.assign({},s),{renderItem:t,renderDropdown:r}),editor:s.editor}),i=a.default(document.body,{getReferenceClientRect:s.clientRect,appendTo:()=>document.body,content:e.element,showOnCreate:!0,interactive:!0,trigger:"manual",placement:"bottom-start",zIndex:9999,arrow:!1,onMount:e=>{const t=e.popper.querySelector(".tippy-box");t&&(t.style.cssText="background:none;box-shadow:none;border:none;padding:0;border-radius:0;")}})},onUpdate:n=>{var o,s,a;e.updateProps(Object.assign(Object.assign({},n),{renderItem:t,renderDropdown:r})),(null===(o=n.items)||void 0===o?void 0:o.length)?null===(a=i[0])||void 0===a||a.setProps({getReferenceClientRect:n.clientRect}):null===(s=i[0])||void 0===s||s.hide()},onKeyDown:t=>{var n,r,o;return"Escape"===t.event.key?(null===(n=i[0])||void 0===n||n.hide(),!0):null!==(o=null===(r=e.ref)||void 0===r?void 0:r.onKeyDown(t))&&void 0!==o&&o},onExit:()=>{var t;null===(t=i[0])||void 0===t||t.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.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:d(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.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:d(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:"@",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)}})};
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 tippy from 'tippy.js';\nimport type {\n\tMentionDropdownRenderProps,\n\tMentionItem,\n} from '../../BikEditor.types';\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: any;\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 = tippy(document.body, {\n\t\t\t\t\tgetReferenceClientRect: props.clientRect,\n\t\t\t\t\tappendTo: () => document.body,\n\t\t\t\t\tcontent: component.element,\n\t\t\t\t\tshowOnCreate: true,\n\t\t\t\t\tinteractive: true,\n\t\t\t\t\ttrigger: 'manual',\n\t\t\t\t\tplacement: 'bottom-start',\n\t\t\t\t\tzIndex: 9999,\n\t\t\t\t\tarrow: false,\n\t\t\t\t\t// tippy's default dark theme adds a visible box even when content\n\t\t\t\t\t// is empty. Strip it so our dropdown handles all visual styling.\n\t\t\t\t\tonMount: (instance) => {\n\t\t\t\t\t\tconst box =\n\t\t\t\t\t\t\tinstance.popper.querySelector<HTMLElement>('.tippy-box');\n\t\t\t\t\t\tif (box)\n\t\t\t\t\t\t\tbox.style.cssText =\n\t\t\t\t\t\t\t\t'background:none;box-shadow:none;border:none;padding:0;border-radius:0;';\n\t\t\t\t\t},\n\t\t\t\t});\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[0]?.hide();\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tpopup[0]?.setProps({ getReferenceClientRect: 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[0]?.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[0]?.destroy();\n\t\t\t\tcomponent.destroy();\n\t\t\t},\n\t\t};\n\t};\n}\n\nexport function buildAgentMentionExtension(\n\tagents: 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\tagents.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\tteams: 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\tteams.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","tippy","document","body","getReferenceClientRect","clientRect","appendTo","content","element","showOnCreate","interactive","trigger","placement","zIndex","arrow","onMount","instance","box","popper","querySelector","style","cssText","onUpdate","updateProps","Object","assign","_a","items","_c","setProps","_b","hide","onKeyDown","event","key","ref","onExit","destroy","agents","Mention","extend","name","configure","HTMLAttributes","class","renderText","_ref","options","node","suggestion","char","attrs","renderHTML","_ref2","mergeAttributes","_ref3","query","filter","a","label","toLowerCase","includes","command","_ref4","range","chain","focus","deleteRange","insertContent","type","id","run","render","teams","_ref5","_ref6","_ref7","t","_ref8"],"mappings":"0VAWA,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,EAAAA,QAAMC,SAASC,KAAM,CAC5BC,uBAAwBP,EAAMQ,WAC9BC,SAAUA,IAAMJ,SAASC,KACzBI,QAASb,EAAUc,QACnBC,cAAc,EACdC,aAAa,EACbC,QAAS,SACTC,UAAW,eACXC,OAAQ,KACRC,OAAO,EAGPC,QAAUC,IACT,MAAMC,EACLD,EAASE,OAAOC,cAA2B,cACxCF,IACHA,EAAIG,MAAMC,QACT,yEAAwE,GAE1E,EAEHC,SAAWzB,cACVH,EAAU6B,YAAiBC,OAAAC,OAAAD,OAAAC,OAAA,CAAA,EAAA5B,IAAOR,aAAYI,qBAC9B,QAAXiC,EAAA7B,EAAM8B,aAAK,IAAAD,OAAA,EAAAA,EAAEnC,gBAIlBqC,EAAAjC,EAAM,mBAAIkC,SAAS,CAAEzB,uBAAwBP,EAAMQ,aAHxC,QAAVyB,EAAAnC,EAAM,UAAI,IAAAmC,GAAAA,EAAAC,MAGqD,EAEjEC,UAAYnC,cACX,MAAwB,WAApBA,EAAMoC,MAAMC,KACL,QAAVR,EAAA/B,EAAM,UAAI,IAAA+B,GAAAA,EAAAK,QACH,GAE2C,QAA5CH,EAAsB,QAAtBE,EAACpC,EAAUyC,WAAW,IAAAL,OAAA,EAAAA,EAAEE,UAAUnC,UAAU,IAAA+B,GAAAA,CAAK,EAEzDQ,OAAQA,WACG,QAAVV,EAAA/B,EAAM,UAAI,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eA,gBAACP,EAAQJ,gBACxB,GAAGI,EAAQE,WAAWC,OAAOF,EAAKG,MAAa,QAC/C,EACDF,WAAY,CACXC,KAAM,IACNvB,MAAOiD,IAAA,IAACpB,MAAEA,GAA0BoB,EAAA,OACnCH,EAAMhB,QAAQoB,GACbA,EAAElB,MAAMC,cAAcC,SAASL,EAAMI,gBACrC,EACFE,QAASgB,IAAkC,IAAjC9E,OAAEA,EAAMgE,MAAEA,EAAKnE,MAAEA,GAAYiF,EACtC9E,EACEiE,QACAC,QACAC,YAAYH,GACZI,cAAc,CACdC,KAAM,cACNlB,MAAO,CAAEmB,GAAIzE,EAAMyE,GAAIX,MAAO9D,EAAM8D,SAEpCY,MACFnF,SAAAA,EAAWS,EAAO,IAAI,EAEvB2E,OAAQrF,EAAYC,EAAU,IAAKC,EAAYI,KAGlD"}
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,MAC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AASgB,IAAkC,IAAjC7D,OAAEA,EAAM+C,MAAEA,EAAKlD,MAAEA,GAAYgE,EACtC7D,EACEgD,QACAC,QACAC,YAAYH,GACZI,cAAc,CACdC,KAAM,cACNnB,MAAO,CAAEoB,GAAIxD,EAAMwD,GAAIX,MAAO7C,EAAM6C,SAEpCY,MACFlE,SAAAA,EAAWS,EAAO,IAAI,EAEvB0D,OAAQpE,EAAYC,EAAU,IAAKC,EAAYI,KAGlD"}
@@ -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/react"),n=require("@tiptap/suggestion"),r=require("tippy.js"),o=require("./SlashCommandMenu.js");function d(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var i=d(n),a=d(r);exports.buildSlashCommandExtension=function(n,r,d,s){return e.Extension.create({name:"slashCommand",addProseMirrorPlugins(){return[i.default({editor:this.editor,char:"/",items:e=>{let{query:t}=e;return n.filter((e=>e.label.toLowerCase().includes(t.toLowerCase()))).slice(0,20)},command:e=>{let{editor:t,range:n,props:o}=e;t.chain().focus().deleteRange(n).run(),null==r||r(o)},render:()=>{let e,n;return{onStart:r=>{e=new t.ReactRenderer(o.SlashCommandMenu,{props:Object.assign(Object.assign({},r),{renderItem:d,renderDropdown:s}),editor:r.editor}),n=a.default(document.body,{getReferenceClientRect:r.clientRect,appendTo:()=>document.body,content:e.element,showOnCreate:!0,interactive:!0,trigger:"manual",placement:"bottom-start",zIndex:9999,arrow:!1,onMount:e=>{const t=e.popper.querySelector(".tippy-box");t&&(t.style.cssText="background:none;box-shadow:none;border:none;padding:0;border-radius:0;")}})},onUpdate:t=>{var r,o,i;e.updateProps(Object.assign(Object.assign({},t),{renderItem:d,renderDropdown:s})),(null===(r=t.items)||void 0===r?void 0:r.length)?null===(i=n[0])||void 0===i||i.setProps({getReferenceClientRect:t.clientRect}):null===(o=n[0])||void 0===o||o.hide()},onKeyDown:t=>{var r,o,d;return"Escape"===t.event.key?(null===(r=n[0])||void 0===r||r.hide(),!0):null!==(d=null===(o=e.ref)||void 0===o?void 0:o.onKeyDown(t))&&void 0!==d&&d},onExit:()=>{var t;null===(t=n[0])||void 0===t||t.destroy(),e.destroy()}}}})]}})};
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,a){return e.Extension.create({name:"slashCommand",addProseMirrorPlugins(){return[s.default({editor:this.editor,char:"/",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:d,renderDropdown:a}),editor:i.editor}),t=n.createSuggestionPopup(e.element,i.clientRect)},onUpdate:r=>{var n;e.updateProps(Object.assign(Object.assign({},r),{renderItem:d,renderDropdown:a})),(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 tippy from 'tippy.js';\nimport type {\n\tSlashCommandDropdownRenderProps,\n\tSlashCommandItem,\n} from '../../BikEditor.types';\nimport { SlashCommandMenu } from './SlashCommandMenu';\n\nexport function buildSlashCommandExtension(\n\tcommands: 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\tcommands\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: any;\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 = tippy(document.body, {\n\t\t\t\t\t\t\t\t\tgetReferenceClientRect: props.clientRect,\n\t\t\t\t\t\t\t\t\tappendTo: () => document.body,\n\t\t\t\t\t\t\t\t\tcontent: component.element,\n\t\t\t\t\t\t\t\t\tshowOnCreate: true,\n\t\t\t\t\t\t\t\t\tinteractive: true,\n\t\t\t\t\t\t\t\t\ttrigger: 'manual',\n\t\t\t\t\t\t\t\t\tplacement: 'bottom-start',\n\t\t\t\t\t\t\t\t\tzIndex: 9999,\n\t\t\t\t\t\t\t\t\tarrow: false,\n\t\t\t\t\t\t\t\t\t// tippy's default dark theme adds a visible box even when content\n\t\t\t\t\t\t\t\t\t// is empty. Strip it so our dropdown handles all visual styling.\n\t\t\t\t\t\t\t\t\tonMount: (instance) => {\n\t\t\t\t\t\t\t\t\t\tconst box =\n\t\t\t\t\t\t\t\t\t\t\tinstance.popper.querySelector<HTMLElement>('.tippy-box');\n\t\t\t\t\t\t\t\t\t\tif (box)\n\t\t\t\t\t\t\t\t\t\t\tbox.style.cssText =\n\t\t\t\t\t\t\t\t\t\t\t\t'background:none;box-shadow:none;border:none;padding:0;border-radius:0;';\n\t\t\t\t\t\t\t\t\t},\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[0]?.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[0]?.setProps({\n\t\t\t\t\t\t\t\t\tgetReferenceClientRect: props.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\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[0]?.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[0]?.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":["commands","onSelect","renderItem","renderDropdown","Extension","create","name","addProseMirrorPlugins","Suggestion","editor","this","char","items","_ref","query","filter","c","label","toLowerCase","includes","slice","command","_ref2","range","props","chain","focus","deleteRange","run","render","component","popup","onStart","ReactRenderer","SlashCommandMenu","tippy","document","body","getReferenceClientRect","clientRect","appendTo","content","element","showOnCreate","interactive","trigger","placement","zIndex","arrow","onMount","instance","box","popper","querySelector","style","cssText","onUpdate","updateProps","Object","assign","_a","length","_c","setProps","_b","hide","onKeyDown","event","key","ref","onExit","destroy"],"mappings":"uXAWM,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,OACrBb,EACEe,QAAQC,GACRA,EAAEC,MAAMC,cAAcC,SAASL,EAAMI,iBAErCE,MAAM,EAAG,GAAG,EACfC,QAASC,IAAkC,IAAjCb,OAAEA,EAAMc,MAAEA,EAAKC,MAAEA,GAAYF,EACtCb,EAAOgB,QAAQC,QAAQC,YAAYJ,GAAOK,MAC1C3B,SAAAA,EAAWuB,EAAM,EAElBK,OAAQA,KACP,IAAIC,EACAC,EAEJ,MAAO,CACNC,QAAUR,IACTM,EAAY,IAAIG,EAAaA,cAACC,mBAAkB,CAC/CV,qCAAYA,GAAK,CAAEtB,aAAYC,mBAC/BM,OAAQe,EAAMf,SAEfsB,EAAQI,EAAAA,QAAMC,SAASC,KAAM,CAC5BC,uBAAwBd,EAAMe,WAC9BC,SAAUA,IAAMJ,SAASC,KACzBI,QAASX,EAAUY,QACnBC,cAAc,EACdC,aAAa,EACbC,QAAS,SACTC,UAAW,eACXC,OAAQ,KACRC,OAAO,EAGPC,QAAUC,IACT,MAAMC,EACLD,EAASE,OAAOC,cAA2B,cACxCF,IACHA,EAAIG,MAAMC,QACT,yEAAwE,GAE1E,EAEHC,SAAWhC,cACVM,EAAU2B,YAAiBC,OAAAC,OAAAD,OAAAC,OAAA,CAAA,EAAAnC,IAAOtB,aAAYC,qBAC9B,QAAXyD,EAAApC,EAAMZ,aAAK,IAAAgD,OAAA,EAAAA,EAAEC,QAIV,QAARC,EAAA/B,EAAM,UAAE,IAAA+B,GAAAA,EAAEC,SAAS,CAClBzB,uBAAwBd,EAAMe,aAJpB,QAAVyB,EAAAjC,EAAM,UAAI,IAAAiC,GAAAA,EAAAC,MAKT,EAEHC,UAAY1C,cACX,MAAwB,WAApBA,EAAM2C,MAAMC,KACL,QAAVR,EAAA7B,EAAM,UAAI,IAAA6B,GAAAA,EAAAK,QACH,GAE2C,QAA5CH,EAAsB,QAAtBE,EAAClC,EAAUuC,WAAW,IAAAL,OAAA,EAAAA,EAAEE,UAAU1C,UAAU,IAAAsC,GAAAA,CAAK,EAEzDQ,OAAQA,WACG,QAAVV,EAAA7B,EAAM,UAAI,IAAA6B,GAAAA,EAAAW,UACVzC,EAAUyC,SAAS,EAEpB,IAIL,GAEF"}
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,OACrBb,EAAYe,QACVC,QAAQC,GACRA,EAAEC,MAAMC,cAAcC,SAASN,EAAMK,iBAErCE,MAAM,EAAG,GAAG,EACfC,QAASC,IAAkC,IAAjCd,OAAEA,EAAMe,MAAEA,EAAKC,MAAEA,GAAYF,EACtCd,EAAOiB,QAAQC,QAAQC,YAAYJ,GAAOK,MAC1C5B,SAAAA,EAAWwB,EAAM,EAElBK,OAAQA,KACP,IAAIC,EACAC,EAEJ,MAAO,CACNC,QAAUR,IACTM,EAAY,IAAIG,EAAaA,cAACC,mBAAkB,CAC/CV,qCAAYA,GAAK,CAAEvB,aAAYC,mBAC/BM,OAAQgB,EAAMhB,SAEfuB,EAAQI,EAAqBA,sBAC5BL,EAAUM,QACVZ,EAAMa,WACN,EAEFC,SAAWd,UACVM,EAAUS,YAAiBC,OAAAC,OAAAD,OAAAC,OAAA,CAAA,EAAAjB,IAAOvB,aAAYC,qBAC9B,QAAXwC,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";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:l,command:i,renderItem:c,renderDropdown:a}=t;const[d,u]=r.useState(0),m=r.useRef(null),h=r.useCallback((e=>{const r=m.current;if(!r)return;const n=r.children[e];null==n||n.scrollIntoView({block:"nearest"})}),[]),p=e=>{o[e]&&i(o[e])};return r.useImperativeHandle(s,(()=>({onKeyDown:e=>{let{event:r}=e;return"ArrowUp"===r.key?(u((e=>{const r=(e+o.length-1)%o.length;return h(r),r})),!0):"ArrowDown"===r.key?(u((e=>{const r=(e+1)%o.length;return h(r),r})),!0):"Enter"===r.key&&(p(d),!0)}}))),r.useEffect((()=>u(0)),[o]),o.length?a?e.jsx(e.Fragment,{children:a({items:o,query:l,activeIndex:d,onSelect:e=>i(e)})}):e.jsx(n.DropdownContainer,Object.assign({ref:m},{children:o.map(((r,t)=>e.jsx(n.DropdownItem,Object.assign({$isActive:t===d,onMouseEnter:()=>u(t),onClick:()=>p(t)},{children:c?c(r,t===d):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:l,query:o,command:i,renderItem:c,renderDropdown:a}=t;const[d,u]=r.useState(0),h=r.useRef(null),m=r.useCallback((e=>{const r=h.current;if(!r)return;const n=r.children[e];null==n||n.scrollIntoView({block:"nearest"})}),[]),p=e=>{l[e]&&i(l[e])};return r.useImperativeHandle(s,(()=>({onKeyDown:e=>{let{event:r}=e;return!!l.length&&("ArrowUp"===r.key?(u((e=>{const r=(e+l.length-1)%l.length;return m(r),r})),!0):"ArrowDown"===r.key?(u((e=>{const r=(e+1)%l.length;return m(r),r})),!0):"Enter"===r.key&&(p(d),!0))}}))),r.useEffect((()=>u(0)),[l]),l.length?a?e.jsx(e.Fragment,{children:a({items:l,query:o,activeIndex:d,onSelect:e=>i(e)})}):e.jsx(n.DropdownContainer,Object.assign({ref:h},{children:l.map(((r,t)=>e.jsx(n.DropdownItem,Object.assign({$isActive:t===d,onMouseEnter:()=>u(t),onClick:()=>p(t)},{children:c?c(r,t===d):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;
2
2
  //# sourceMappingURL=SlashCommandMenu.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"SlashCommandMenu.js","sources":["../../../../../src/editor/extensions/slashCommand/SlashCommandMenu.tsx"],"sourcesContent":["import React, {\n\tforwardRef,\n\tuseCallback,\n\tuseEffect,\n\tuseImperativeHandle,\n\tuseRef,\n\tuseState,\n} from 'react';\nimport type {\n\tSlashCommandDropdownRenderProps,\n\tSlashCommandItem,\n} from '../../BikEditor.types';\nimport {\n\tDropdownContainer,\n\tDropdownItem,\n\tSlashDescription,\n\tSlashLabel,\n} from '../editorDropdown.styles';\n\ninterface Props {\n\titems: SlashCommandItem[];\n\tquery: string;\n\tcommand: (item: SlashCommandItem) => void;\n\t/** Custom per-row renderer. Receives the item and whether it is the active row. */\n\trenderItem?: (item: SlashCommandItem, isActive: boolean) => React.ReactNode;\n\t/**\n\t * Full custom dropdown renderer. Takes priority over renderItem.\n\t * The editor passes activeIndex and onSelect — you handle all the visual rendering.\n\t */\n\trenderDropdown?: (props: SlashCommandDropdownRenderProps) => React.ReactNode;\n}\n\nexport const SlashCommandMenu = forwardRef<any, Props>(\n\t({ items, query, command, renderItem, renderDropdown }, ref) => {\n\t\tconst [selectedIndex, setSelectedIndex] = useState(0);\n\t\tconst containerRef = useRef<HTMLDivElement>(null);\n\n\t\tconst scrollToIndex = useCallback((index: number) => {\n\t\t\tconst container = containerRef.current;\n\t\t\tif (!container) return;\n\t\t\tconst item = container.children[index] as HTMLElement | undefined;\n\t\t\titem?.scrollIntoView({ block: 'nearest' });\n\t\t}, []);\n\n\t\tconst select = (i: number) => {\n\t\t\tif (items[i]) command(items[i]);\n\t\t};\n\n\t\tuseImperativeHandle(ref, () => ({\n\t\t\tonKeyDown: ({ event }: { event: KeyboardEvent }) => {\n\t\t\t\tif (event.key === 'ArrowUp') {\n\t\t\t\t\tsetSelectedIndex((prev) => {\n\t\t\t\t\t\tconst next = (prev + items.length - 1) % items.length;\n\t\t\t\t\t\tscrollToIndex(next);\n\t\t\t\t\t\treturn next;\n\t\t\t\t\t});\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t\tif (event.key === 'ArrowDown') {\n\t\t\t\t\tsetSelectedIndex((prev) => {\n\t\t\t\t\t\tconst next = (prev + 1) % items.length;\n\t\t\t\t\t\tscrollToIndex(next);\n\t\t\t\t\t\treturn next;\n\t\t\t\t\t});\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t\tif (event.key === 'Enter') {\n\t\t\t\t\tselect(selectedIndex);\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t\treturn false;\n\t\t\t},\n\t\t}));\n\n\t\tuseEffect(() => setSelectedIndex(0), [items]);\n\n\t\tif (!items.length) return null;\n\n\t\t// Full custom dropdown — editor still manages keyboard nav via selectedIndex\n\t\tif (renderDropdown) {\n\t\t\treturn (\n\t\t\t\t<>\n\t\t\t\t\t{renderDropdown({\n\t\t\t\t\t\titems,\n\t\t\t\t\t\tquery,\n\t\t\t\t\t\tactiveIndex: selectedIndex,\n\t\t\t\t\t\tonSelect: (item) => command(item),\n\t\t\t\t\t})}\n\t\t\t\t</>\n\t\t\t);\n\t\t}\n\n\t\treturn (\n\t\t\t<DropdownContainer ref={containerRef}>\n\t\t\t\t{items.map((item, i) => (\n\t\t\t\t\t<DropdownItem\n\t\t\t\t\t\tkey={item.id}\n\t\t\t\t\t\t$isActive={i === selectedIndex}\n\t\t\t\t\t\tonMouseEnter={() => setSelectedIndex(i)}\n\t\t\t\t\t\tonClick={() => select(i)}\n\t\t\t\t\t>\n\t\t\t\t\t\t{renderItem ? (\n\t\t\t\t\t\t\trenderItem(item, i === selectedIndex)\n\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t<SlashLabel>{item.label}</SlashLabel>\n\t\t\t\t\t\t\t\t{item.description && (\n\t\t\t\t\t\t\t\t\t<SlashDescription>{item.description}</SlashDescription>\n\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t)}\n\t\t\t\t\t</DropdownItem>\n\t\t\t\t))}\n\t\t\t</DropdownContainer>\n\t\t);\n\t},\n);\nSlashCommandMenu.displayName = 'SlashCommandMenu';\n"],"names":["SlashCommandMenu","forwardRef","_ref","ref","items","query","command","renderItem","renderDropdown","selectedIndex","setSelectedIndex","useState","containerRef","useRef","scrollToIndex","useCallback","index","container","current","item","children","scrollIntoView","block","select","i","useImperativeHandle","onKeyDown","_ref2","event","key","prev","next","length","useEffect","_jsx","_Fragment","activeIndex","onSelect","DropdownContainer","Object","assign","map","DropdownItem","$isActive","onMouseEnter","onClick","_jsxs","jsxs","jsx","SlashLabel","label","description","SlashDescription","id","displayName"],"mappings":"mKAgCO,MAAMA,EAAmBC,EAAUA,YACzC,CAAAC,EAAwDC,KAAO,IAA9DC,MAAEA,EAAKC,MAAEA,EAAKC,QAAEA,EAAOC,WAAEA,EAAUC,eAAEA,GAAgBN,EACrD,MAAOO,EAAeC,GAAoBC,EAAQA,SAAC,GAC7CC,EAAeC,SAAuB,MAEtCC,EAAgBC,EAAWA,aAAEC,IAClC,MAAMC,EAAYL,EAAaM,QAC/B,IAAKD,EAAW,OAChB,MAAME,EAAOF,EAAUG,SAASJ,GAChCG,SAAAA,EAAME,eAAe,CAAEC,MAAO,WAAY,GACxC,IAEGC,EAAUC,IACXpB,EAAMoB,IAAIlB,EAAQF,EAAMoB,GAAG,EA+BhC,OA5BAC,EAAmBA,oBAACtB,GAAK,KAAO,CAC/BuB,UAAWC,IAAwC,IAAvCC,MAAEA,GAAiCD,EAC9C,MAAkB,YAAdC,EAAMC,KACTnB,GAAkBoB,IACjB,MAAMC,GAAQD,EAAO1B,EAAM4B,OAAS,GAAK5B,EAAM4B,OAE/C,OADAlB,EAAciB,GACPA,CAAI,KAEL,GAEU,cAAdH,EAAMC,KACTnB,GAAkBoB,IACjB,MAAMC,GAAQD,EAAO,GAAK1B,EAAM4B,OAEhC,OADAlB,EAAciB,GACPA,CAAI,KAEL,GAEU,UAAdH,EAAMC,MACTN,EAAOd,IACA,EAEI,MAIdwB,EAASA,WAAC,IAAMvB,EAAiB,IAAI,CAACN,IAEjCA,EAAM4B,OAGPxB,EAEF0B,EAAAA,IACEC,EAAAA,SAAA,CAAAf,SAAAZ,EAAe,CACfJ,QACAC,QACA+B,YAAa3B,EACb4B,SAAWlB,GAASb,EAAQa,OAO/Be,MAACI,EAAAA,kBAAiBC,OAAAC,OAAA,CAACrC,IAAKS,aACtBR,EAAMqC,KAAI,CAACtB,EAAMK,IACjBU,MAACQ,EAAAA,aAAYH,OAAAC,OAAA,CAAAG,UAEDnB,IAAMf,EACjBmC,aAAcA,IAAMlC,EAAiBc,GACrCqB,QAASA,IAAMtB,EAAOC,IAAE,CAAAJ,SAEvBb,EACAA,EAAWY,EAAMK,IAAMf,GAEvBqC,EACCC,KAAAZ,WAAA,CAAAf,SAAA,CAAAc,EAAAc,IAACC,aAAY,CAAA7B,SAAAD,EAAK+B,QACjB/B,EAAKgC,aACLjB,EAAAA,IAACkB,EAAAA,iBAAkB,CAAAhC,SAAAD,EAAKgC,mBAXtBhC,EAAKkC,SApBY,IAqCL,IAIvBrD,EAAiBsD,YAAc"}
1
+ {"version":3,"file":"SlashCommandMenu.js","sources":["../../../../../src/editor/extensions/slashCommand/SlashCommandMenu.tsx"],"sourcesContent":["import React, {\n\tforwardRef,\n\tuseCallback,\n\tuseEffect,\n\tuseImperativeHandle,\n\tuseRef,\n\tuseState,\n} from 'react';\nimport type {\n\tSlashCommandDropdownRenderProps,\n\tSlashCommandItem,\n} from '../../BikEditor.types';\nimport {\n\tDropdownContainer,\n\tDropdownItem,\n\tSlashDescription,\n\tSlashLabel,\n} from '../editorDropdown.styles';\n\ninterface Props {\n\titems: SlashCommandItem[];\n\tquery: string;\n\tcommand: (item: SlashCommandItem) => void;\n\t/** Custom per-row renderer. Receives the item and whether it is the active row. */\n\trenderItem?: (item: SlashCommandItem, isActive: boolean) => React.ReactNode;\n\t/**\n\t * Full custom dropdown renderer. Takes priority over renderItem.\n\t * The editor passes activeIndex and onSelect — you handle all the visual rendering.\n\t */\n\trenderDropdown?: (props: SlashCommandDropdownRenderProps) => React.ReactNode;\n}\n\nexport const SlashCommandMenu = forwardRef<any, Props>(\n\t({ items, query, command, renderItem, renderDropdown }, ref) => {\n\t\tconst [selectedIndex, setSelectedIndex] = useState(0);\n\t\tconst containerRef = useRef<HTMLDivElement>(null);\n\n\t\tconst scrollToIndex = useCallback((index: number) => {\n\t\t\tconst container = containerRef.current;\n\t\t\tif (!container) return;\n\t\t\tconst item = container.children[index] as HTMLElement | undefined;\n\t\t\titem?.scrollIntoView({ block: 'nearest' });\n\t\t}, []);\n\n\t\tconst select = (i: number) => {\n\t\t\tif (items[i]) command(items[i]);\n\t\t};\n\n\t\tuseImperativeHandle(ref, () => ({\n\t\t\tonKeyDown: ({ event }: { event: KeyboardEvent }) => {\n\t\t\t\tif (!items.length) return false;\n\t\t\t\tif (event.key === 'ArrowUp') {\n\t\t\t\t\tsetSelectedIndex((prev) => {\n\t\t\t\t\t\tconst next = (prev + items.length - 1) % items.length;\n\t\t\t\t\t\tscrollToIndex(next);\n\t\t\t\t\t\treturn next;\n\t\t\t\t\t});\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t\tif (event.key === 'ArrowDown') {\n\t\t\t\t\tsetSelectedIndex((prev) => {\n\t\t\t\t\t\tconst next = (prev + 1) % items.length;\n\t\t\t\t\t\tscrollToIndex(next);\n\t\t\t\t\t\treturn next;\n\t\t\t\t\t});\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t\tif (event.key === 'Enter') {\n\t\t\t\t\tselect(selectedIndex);\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t\treturn false;\n\t\t\t},\n\t\t}));\n\n\t\tuseEffect(() => setSelectedIndex(0), [items]);\n\n\t\tif (!items.length) return null;\n\n\t\t// Full custom dropdown — editor still manages keyboard nav via selectedIndex\n\t\tif (renderDropdown) {\n\t\t\treturn (\n\t\t\t\t<>\n\t\t\t\t\t{renderDropdown({\n\t\t\t\t\t\titems,\n\t\t\t\t\t\tquery,\n\t\t\t\t\t\tactiveIndex: selectedIndex,\n\t\t\t\t\t\tonSelect: (item) => command(item),\n\t\t\t\t\t})}\n\t\t\t\t</>\n\t\t\t);\n\t\t}\n\n\t\treturn (\n\t\t\t<DropdownContainer ref={containerRef}>\n\t\t\t\t{items.map((item, i) => (\n\t\t\t\t\t<DropdownItem\n\t\t\t\t\t\tkey={item.id}\n\t\t\t\t\t\t$isActive={i === selectedIndex}\n\t\t\t\t\t\tonMouseEnter={() => setSelectedIndex(i)}\n\t\t\t\t\t\tonClick={() => select(i)}\n\t\t\t\t\t>\n\t\t\t\t\t\t{renderItem ? (\n\t\t\t\t\t\t\trenderItem(item, i === selectedIndex)\n\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t<SlashLabel>{item.label}</SlashLabel>\n\t\t\t\t\t\t\t\t{item.description && (\n\t\t\t\t\t\t\t\t\t<SlashDescription>{item.description}</SlashDescription>\n\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t)}\n\t\t\t\t\t</DropdownItem>\n\t\t\t\t))}\n\t\t\t</DropdownContainer>\n\t\t);\n\t},\n);\nSlashCommandMenu.displayName = 'SlashCommandMenu';\n"],"names":["SlashCommandMenu","forwardRef","_ref","ref","items","query","command","renderItem","renderDropdown","selectedIndex","setSelectedIndex","useState","containerRef","useRef","scrollToIndex","useCallback","index","container","current","item","children","scrollIntoView","block","select","i","useImperativeHandle","onKeyDown","_ref2","event","length","key","prev","next","useEffect","_jsx","_Fragment","activeIndex","onSelect","DropdownContainer","Object","assign","map","DropdownItem","$isActive","onMouseEnter","onClick","_jsxs","jsxs","jsx","SlashLabel","label","description","SlashDescription","id","displayName"],"mappings":"mKAgCO,MAAMA,EAAmBC,EAAUA,YACzC,CAAAC,EAAwDC,KAAO,IAA9DC,MAAEA,EAAKC,MAAEA,EAAKC,QAAEA,EAAOC,WAAEA,EAAUC,eAAEA,GAAgBN,EACrD,MAAOO,EAAeC,GAAoBC,EAAQA,SAAC,GAC7CC,EAAeC,SAAuB,MAEtCC,EAAgBC,EAAWA,a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AAAD,EAAKgC,mBAXtBhC,EAAKkC,SApBY,IAqCL,IAIvBrD,EAAiBsD,YAAc"}
@@ -0,0 +1,2 @@
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});exports.createSuggestionPopup=function(e,t){const o=document.createElement("div");o.style.cssText="position:fixed;z-index:9999;pointer-events:auto;",o.appendChild(e),document.body.appendChild(o);let n=t;function i(){const e=null==n?void 0:n();if(!e)return;const t=o.offsetHeight,i=o.offsetWidth,s=window.innerHeight,d=window.innerWidth,p=s-e.bottom-4,r=e.top-4,l=p>=t?e.bottom+4:r>=t?e.top-4-t:4,c=Math.min(e.left,d-i-4);o.style.left=`${Math.max(4,c)}px`,o.style.top=`${l}px`}const s=new ResizeObserver(i);return s.observe(o),i(),{element:o,show(){o.style.display=""},hide(){o.style.display="none"},destroy(){s.disconnect(),o.remove()},updatePosition(e){n=e,i()}}};
2
+ //# sourceMappingURL=suggestionPopup.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"suggestionPopup.js","sources":["../../../../src/editor/extensions/suggestionPopup.ts"],"sourcesContent":["/**\n * Lightweight popup positioner for suggestion dropdowns (mentions, slash commands).\n * Replaces tippy.js — all we need is a positioned container near the cursor\n * that flips above when there isn't enough room below.\n */\n\nconst GAP = 4;\n\nexport interface SuggestionPopup {\n\tshow(): void;\n\thide(): void;\n\tdestroy(): void;\n\tupdatePosition(clientRect: () => DOMRect | null): void;\n\treadonly element: HTMLDivElement;\n}\n\nexport function createSuggestionPopup(\n\tcontent: HTMLElement,\n\tclientRect: (() => DOMRect | null) | null,\n): SuggestionPopup {\n\tconst wrapper = document.createElement('div');\n\twrapper.style.cssText = 'position:fixed;z-index:9999;pointer-events:auto;';\n\twrapper.appendChild(content);\n\tdocument.body.appendChild(wrapper);\n\n\tlet latestRectFn: (() => DOMRect | null) | null = clientRect;\n\n\tfunction reposition() {\n\t\tconst rect = latestRectFn?.();\n\t\tif (!rect) return;\n\n\t\tconst popupHeight = wrapper.offsetHeight;\n\t\tconst popupWidth = wrapper.offsetWidth;\n\t\tconst viewportH = window.innerHeight;\n\t\tconst viewportW = window.innerWidth;\n\n\t\tconst spaceBelow = viewportH - rect.bottom - GAP;\n\t\tconst spaceAbove = rect.top - GAP;\n\t\tconst fitsBelow = spaceBelow >= popupHeight;\n\n\t\tconst top = fitsBelow\n\t\t\t? rect.bottom + GAP\n\t\t\t: spaceAbove >= popupHeight\n\t\t\t? rect.top - GAP - popupHeight\n\t\t\t: GAP;\n\n\t\tconst left = Math.min(rect.left, viewportW - popupWidth - GAP);\n\n\t\twrapper.style.left = `${Math.max(GAP, left)}px`;\n\t\twrapper.style.top = `${top}px`;\n\t}\n\n\tconst observer = new ResizeObserver(reposition);\n\tobserver.observe(wrapper);\n\n\treposition();\n\n\treturn {\n\t\telement: wrapper,\n\t\tshow() {\n\t\t\twrapper.style.display = '';\n\t\t},\n\t\thide() {\n\t\t\twrapper.style.display = 'none';\n\t\t},\n\t\tdestroy() {\n\t\t\tobserver.disconnect();\n\t\t\twrapper.remove();\n\t\t},\n\t\tupdatePosition(getRectFn: () => DOMRect | null) {\n\t\t\tlatestRectFn = getRectFn;\n\t\t\treposition();\n\t\t},\n\t};\n}\n"],"names":["content","clientRect","wrapper","document","createElement","style","cssText","appendChild","body","latestRectFn","reposition","rect","popupHeight","offsetHeight","popupWidth","offsetWidth","viewportH","window","innerHeight","viewportW","innerWidth","spaceBelow","bottom","spaceAbove","top","left","Math","min","max","observer","ResizeObserver","observe","element","show","display","hide","destroy","disconnect","remove","updatePosition","getRectFn"],"mappings":"kGAgBgB,SACfA,EACAC,GAEA,MAAMC,EAAUC,SAASC,cAAc,OACvCF,EAAQG,MAAMC,QAAU,mDACxBJ,EAAQK,YAAYP,GACpBG,SAASK,KAAKD,YAAYL,GAE1B,IAAIO,EAA8CR,EAElD,SAASS,IACR,MAAMC,EAAOF,aAAA,EAAAA,IACb,IAAKE,EAAM,OAEX,MAAMC,EAAcV,EAAQW,aACtBC,EAAaZ,EAAQa,YACrBC,EAAYC,OAAOC,YACnBC,EAAYF,OAAOG,WAEnBC,EAAaL,EAAYL,EAAKW,OA9B1B,EA+BJC,EAAaZ,EAAKa,IA/Bd,EAkCJA,EAFYH,GAAcT,EAG7BD,EAAKW,OAnCE,EAoCPC,GAAcX,EACdD,EAAKa,IArCE,EAqCUZ,EArCV,EAwCJa,EAAOC,KAAKC,IAAIhB,EAAKc,KAAMN,EAAYL,EAxCnC,GA0CVZ,EAAQG,MAAMoB,KAAU,GAAAC,KAAKE,IA1CnB,EA0C4BH,OACtCvB,EAAQG,MAAMmB,IAAS,GAAAA,KACxB,CAEA,MAAMK,EAAW,IAAIC,eAAepB,GAKpC,OAJAmB,EAASE,QAAQ7B,GAEjBQ,IAEO,CACNsB,QAAS9B,EACT+B,OACC/B,EAAQG,MAAM6B,QAAU,EACxB,EACDC,OACCjC,EAAQG,MAAM6B,QAAU,MACxB,EACDE,UACCP,EAASQ,aACTnC,EAAQoC,QACR,EACDC,eAAeC,GACd/B,EAAe+B,EACf9B,GACD,EAEF"}
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),n=require("react");exports.LinkBubbleMenu=t=>{let{editor:o,renderLinkTooltip:r}=t;const[i,s]=n.useState(null),l=n.useRef(null),a=n.useCallback((()=>s(null)),[]);if(n.useEffect((()=>{const e=o.view.dom,n=n=>{var t,o;if(!e.contains(n.target))return;const r=n.target.closest("a");r?(n.preventDefault(),n.stopPropagation(),n.stopImmediatePropagation(),s({href:null!==(t=r.getAttribute("href"))&&void 0!==t?t:"",text:null!==(o=r.textContent)&&void 0!==o?o:"",rect:r.getBoundingClientRect()})):a()},t=n=>{var t;const o=n.target;e.contains(o)||(null===(t=l.current)||void 0===t?void 0:t.contains(o))||a()},r=()=>a();return document.addEventListener("click",n,{capture:!0}),document.addEventListener("mousedown",t),e.addEventListener("keydown",r),()=>{document.removeEventListener("click",n,{capture:!0}),document.removeEventListener("mousedown",t),e.removeEventListener("keydown",r)}}),[o,a]),!i)return null;const{href:d,text:c,rect:u}=i,p=()=>window.open(d,"_blank","noopener,noreferrer"),x=()=>{o.chain().focus().extendMarkRange("link").unsetLink().run(),a()};return e.jsx("div",Object.assign({ref:l},{children:r?r({href:d,text:c,rect:u,onOpen:p,onRemove:x,onHide:a}):e.jsxs("div",Object.assign({className:"bik-link-bubble",style:{position:"fixed",top:u.bottom+8,left:u.left,zIndex:9999,background:"#fff",border:"1px solid #dee2e6",borderRadius:6,boxShadow:"0 4px 12px rgba(0,0,0,0.15)",padding:"6px 10px",display:"flex",alignItems:"center",gap:8,fontSize:13}},{children:[e.jsxs("span",Object.assign({style:{display:"inline-flex",alignItems:"center",gap:4,color:"#4f46e5",maxWidth:220,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}},{children:[e.jsxs("svg",Object.assign({width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2"},{children:[e.jsx("path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"}),e.jsx("path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"})]})),d.length>40?d.slice(0,40)+"…":d]})),e.jsx("button",Object.assign({onMouseDown:e=>{e.preventDefault(),p()},style:{background:"none",border:"none",cursor:"pointer",padding:"2px 4px",fontSize:12,color:"#495057"}},{children:"Open ↗"})),e.jsx("span",Object.assign({style:{color:"#dee2e6"}},{children:"|"})),e.jsx("button",Object.assign({onMouseDown:e=>{e.preventDefault(),x()},style:{background:"none",border:"none",cursor:"pointer",padding:"2px 4px",fontSize:12,color:"#dc3545"}},{children:"Remove"}))]}))}))};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),n=require("react");exports.LinkBubbleMenu=t=>{let{editor:o,renderLinkTooltip:r}=t;const[i,s]=n.useState(null),l=n.useRef(null),a=n.useCallback((()=>s(null)),[]);if(n.useEffect((()=>{const e=o.view.dom,n=n=>{var t,o,r;if(!e.contains(n.target))return;const i=n.target,l=i instanceof Element?i:i.parentElement,d=null!==(t=null==l?void 0:l.closest("a"))&&void 0!==t?t:null;d?(n.preventDefault(),n.stopPropagation(),n.stopImmediatePropagation(),s({href:null!==(o=d.getAttribute("href"))&&void 0!==o?o:"",text:null!==(r=d.textContent)&&void 0!==r?r:"",rect:d.getBoundingClientRect()})):a()},t=n=>{var t;const o=n.target;e.contains(o)||(null===(t=l.current)||void 0===t?void 0:t.contains(o))||a()},r=()=>a();return document.addEventListener("click",n,{capture:!0}),document.addEventListener("mousedown",t),e.addEventListener("keydown",r),()=>{document.removeEventListener("click",n,{capture:!0}),document.removeEventListener("mousedown",t),e.removeEventListener("keydown",r)}}),[o,a]),!i)return null;const{href:d,text:c,rect:u}=i,p=()=>window.open(d,"_blank","noopener,noreferrer"),x=()=>{o.chain().focus().extendMarkRange("link").unsetLink().run(),a()};return e.jsx("div",Object.assign({ref:l},{children:r?r({href:d,text:c,rect:u,onOpen:p,onRemove:x,onHide:a}):e.jsxs("div",Object.assign({className:"bik-link-bubble",style:{position:"fixed",top:u.bottom+8,left:u.left,zIndex:9999,background:"#fff",border:"1px solid #dee2e6",borderRadius:6,boxShadow:"0 4px 12px rgba(0,0,0,0.15)",padding:"6px 10px",display:"flex",alignItems:"center",gap:8,fontSize:13}},{children:[e.jsxs("span",Object.assign({style:{display:"inline-flex",alignItems:"center",gap:4,color:"#4f46e5",maxWidth:220,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}},{children:[e.jsxs("svg",Object.assign({width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2"},{children:[e.jsx("path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"}),e.jsx("path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"})]})),d.length>40?d.slice(0,40)+"…":d]})),e.jsx("button",Object.assign({onMouseDown:e=>{e.preventDefault(),p()},style:{background:"none",border:"none",cursor:"pointer",padding:"2px 4px",fontSize:12,color:"#495057"}},{children:"Open ↗"})),e.jsx("span",Object.assign({style:{color:"#dee2e6"}},{children:"|"})),e.jsx("button",Object.assign({onMouseDown:e=>{e.preventDefault(),x()},style:{background:"none",border:"none",cursor:"pointer",padding:"2px 4px",fontSize:12,color:"#dc3545"}},{children:"Remove"}))]}))}))};
2
2
  //# sourceMappingURL=LinkBubbleMenu.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"LinkBubbleMenu.js","sources":["../../../../src/editor/floating/LinkBubbleMenu.tsx"],"sourcesContent":["import { Editor } from '@tiptap/core';\nimport React, { useCallback, useEffect, useRef, useState } from 'react';\nimport type { LinkTooltipProps } from '../BikEditor.types';\n\ninterface Props {\n\teditor: Editor;\n\trenderLinkTooltip?: (props: LinkTooltipProps) => React.ReactNode;\n}\n\ninterface LinkState {\n\thref: string;\n\ttext: string;\n\trect: DOMRect;\n}\n\n/**\n * Shows a tooltip when the user **clicks** a hyperlink inside the editor.\n * Hides on click outside the editor/bubble or on any keypress.\n * Does NOT trigger on cursor movement or keyboard navigation.\n */\nexport const LinkBubbleMenu: React.FC<Props> = ({\n\teditor,\n\trenderLinkTooltip,\n}) => {\n\tconst [link, setLink] = useState<LinkState | null>(null);\n\tconst bubbleRef = useRef<HTMLDivElement>(null);\n\n\tconst hide = useCallback(() => setLink(null), []);\n\n\tuseEffect(() => {\n\t\tconst dom = editor.view.dom;\n\n\t\t// Use document-level capture so we fire before ANY other listener on the\n\t\t// page — ProseMirror, browser defaults, and Storybook iframes included.\n\t\tconst handleCaptureClick = (e: MouseEvent) => {\n\t\t\t// Only act on clicks that land inside the editor\n\t\t\tif (!dom.contains(e.target as Node)) return;\n\n\t\t\tconst linkEl = (e.target as Element).closest('a');\n\t\t\tif (!linkEl) {\n\t\t\t\thide();\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// Prevent browser href navigation\n\t\t\te.preventDefault();\n\t\t\t// Prevent the event reaching ProseMirror's bubble-phase handlers\n\t\t\te.stopPropagation();\n\t\t\te.stopImmediatePropagation();\n\n\t\t\tsetLink({\n\t\t\t\thref: linkEl.getAttribute('href') ?? '',\n\t\t\t\ttext: linkEl.textContent ?? '',\n\t\t\t\trect: linkEl.getBoundingClientRect(),\n\t\t\t});\n\t\t};\n\n\t\t// Hide when clicking outside both the editor and the bubble\n\t\tconst handleDocumentMousedown = (e: MouseEvent) => {\n\t\t\tconst target = e.target as Node;\n\t\t\tif (!dom.contains(target) && !bubbleRef.current?.contains(target)) {\n\t\t\t\thide();\n\t\t\t}\n\t\t};\n\n\t\t// Hide on any keypress — user is typing or navigating away\n\t\tconst handleKeyDown = () => hide();\n\n\t\t// { capture: true } on document — fires before every other listener\n\t\tdocument.addEventListener('click', handleCaptureClick, { capture: true });\n\t\tdocument.addEventListener('mousedown', handleDocumentMousedown);\n\t\tdom.addEventListener('keydown', handleKeyDown);\n\n\t\treturn () => {\n\t\t\tdocument.removeEventListener('click', handleCaptureClick, {\n\t\t\t\tcapture: true,\n\t\t\t});\n\t\t\tdocument.removeEventListener('mousedown', handleDocumentMousedown);\n\t\t\tdom.removeEventListener('keydown', handleKeyDown);\n\t\t};\n\t}, [editor, hide]);\n\n\tif (!link) return null;\n\n\tconst { href, text, rect } = link;\n\n\tconst onOpen = () => window.open(href, '_blank', 'noopener,noreferrer');\n\tconst onRemove = () => {\n\t\teditor.chain().focus().extendMarkRange('link').unsetLink().run();\n\t\thide();\n\t};\n\n\t// The <div ref={bubbleRef}> wrapper is what we check for outside-click detection.\n\t// Consumer tooltips use position:fixed internally but remain DOM descendants of\n\t// this wrapper, so bubbleRef.contains() correctly identifies clicks inside them.\n\treturn (\n\t\t<div ref={bubbleRef}>\n\t\t\t{renderLinkTooltip ? (\n\t\t\t\trenderLinkTooltip({ href, text, rect, onOpen, onRemove, onHide: hide })\n\t\t\t) : (\n\t\t\t\t// Built-in fallback: shows href + Open + Remove.\n\t\t\t\t// Use renderLinkTooltip to add an Edit button or custom styling.\n\t\t\t\t<div\n\t\t\t\t\tclassName=\"bik-link-bubble\"\n\t\t\t\t\tstyle={{\n\t\t\t\t\t\tposition: 'fixed',\n\t\t\t\t\t\ttop: rect.bottom + 8,\n\t\t\t\t\t\tleft: rect.left,\n\t\t\t\t\t\tzIndex: 9999,\n\t\t\t\t\t\tbackground: '#fff',\n\t\t\t\t\t\tborder: '1px solid #dee2e6',\n\t\t\t\t\t\tborderRadius: 6,\n\t\t\t\t\t\tboxShadow: '0 4px 12px rgba(0,0,0,0.15)',\n\t\t\t\t\t\tpadding: '6px 10px',\n\t\t\t\t\t\tdisplay: 'flex',\n\t\t\t\t\t\talignItems: 'center',\n\t\t\t\t\t\tgap: 8,\n\t\t\t\t\t\tfontSize: 13,\n\t\t\t\t\t}}\n\t\t\t\t>\n\t\t\t\t\t<span\n\t\t\t\t\t\tstyle={{\n\t\t\t\t\t\t\tdisplay: 'inline-flex',\n\t\t\t\t\t\t\talignItems: 'center',\n\t\t\t\t\t\t\tgap: 4,\n\t\t\t\t\t\t\tcolor: '#4f46e5',\n\t\t\t\t\t\t\tmaxWidth: 220,\n\t\t\t\t\t\t\toverflow: 'hidden',\n\t\t\t\t\t\t\ttextOverflow: 'ellipsis',\n\t\t\t\t\t\t\twhiteSpace: 'nowrap',\n\t\t\t\t\t\t}}\n\t\t\t\t\t>\n\t\t\t\t\t\t<svg\n\t\t\t\t\t\t\twidth=\"14\"\n\t\t\t\t\t\t\theight=\"14\"\n\t\t\t\t\t\t\tviewBox=\"0 0 24 24\"\n\t\t\t\t\t\t\tfill=\"none\"\n\t\t\t\t\t\t\tstroke=\"currentColor\"\n\t\t\t\t\t\t\tstrokeWidth=\"2\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<path d=\"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71\" />\n\t\t\t\t\t\t\t<path d=\"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71\" />\n\t\t\t\t\t\t</svg>\n\t\t\t\t\t\t{href.length > 40 ? href.slice(0, 40) + '…' : href}\n\t\t\t\t\t</span>\n\t\t\t\t\t<button\n\t\t\t\t\t\tonMouseDown={(e) => {\n\t\t\t\t\t\t\te.preventDefault();\n\t\t\t\t\t\t\tonOpen();\n\t\t\t\t\t\t}}\n\t\t\t\t\t\tstyle={{\n\t\t\t\t\t\t\tbackground: 'none',\n\t\t\t\t\t\t\tborder: 'none',\n\t\t\t\t\t\t\tcursor: 'pointer',\n\t\t\t\t\t\t\tpadding: '2px 4px',\n\t\t\t\t\t\t\tfontSize: 12,\n\t\t\t\t\t\t\tcolor: '#495057',\n\t\t\t\t\t\t}}\n\t\t\t\t\t>\n\t\t\t\t\t\tOpen ↗\n\t\t\t\t\t</button>\n\t\t\t\t\t<span style={{ color: '#dee2e6' }}>|</span>\n\t\t\t\t\t<button\n\t\t\t\t\t\tonMouseDown={(e) => {\n\t\t\t\t\t\t\te.preventDefault();\n\t\t\t\t\t\t\tonRemove();\n\t\t\t\t\t\t}}\n\t\t\t\t\t\tstyle={{\n\t\t\t\t\t\t\tbackground: 'none',\n\t\t\t\t\t\t\tborder: 'none',\n\t\t\t\t\t\t\tcursor: 'pointer',\n\t\t\t\t\t\t\tpadding: '2px 4px',\n\t\t\t\t\t\t\tfontSize: 12,\n\t\t\t\t\t\t\tcolor: '#dc3545',\n\t\t\t\t\t\t}}\n\t\t\t\t\t>\n\t\t\t\t\t\tRemove\n\t\t\t\t\t</button>\n\t\t\t\t</div>\n\t\t\t)}\n\t\t</div>\n\t);\n};\n"],"names":["_ref","editor","renderLinkTooltip","link","setLink","useState","bubbleRef","useRef","hide","useCallback","useEffect","dom","view","handleCaptureClick","e","contains","target","linkEl","closest","preventDefault","stopPropagation","stopImmediatePropagation","href","getAttribute","_a","text","_b","textContent","rect","getBoundingClientRect","handleDocumentMousedown","current","handleKeyDown","document","addEventListener","capture","removeEventListener","onOpen","window","open","onRemove","chain","focus","extendMarkRange","unsetLink","run","_jsx","Object","assign","ref","children","onHide","_jsxs","className","style","position","top","bottom","left","zIndex","background","border","borderRadius","boxShadow","padding","display","alignItems","gap","fontSize","jsxs","color","maxWidth","overflow","textOverflow","whiteSpace","width","height","viewBox","fill","stroke","strokeWidth","jsx","d","length","slice","onMouseDown","cursor"],"mappings":"iJAoB+CA,IAG1C,IAH2CC,OAC/CA,EAAMC,kBACNA,GACAF,EACA,MAAOG,EAAMC,GAAWC,EAAQA,SAAmB,MAC7CC,EAAYC,SAAuB,MAEnCC,EAAOC,EAAAA,aAAY,IAAML,EAAQ,OAAO,IAuD9C,GArDAM,EAAAA,WAAU,KACT,MAAMC,EAAMV,EAAOW,KAAKD,IAIlBE,EAAsBC,YAE3B,IAAKH,EAAII,SAASD,EAAEE,QAAiB,OAErC,MAAMC,EAAUH,EAAEE,OAAmBE,QAAQ,KACxCD,GAMLH,EAAEK,iBAEFL,EAAEM,kBACFN,EAAEO,2BAEFjB,EAAQ,CACPkB,KAAiC,UAA3BL,EAAOM,aAAa,eAAO,IAAAC,EAAAA,EAAI,GACrCC,aAAMC,EAAAT,EAAOU,2BAAe,GAC5BC,KAAMX,EAAOY,2BAbbrB,GAcC,EAIGsB,EAA2BhB,UAChC,MAAME,EAASF,EAAEE,OACZL,EAAII,SAASC,KAA+B,UAAnBV,EAAUyB,eAAS,IAAAP,OAAA,EAAAA,EAAAT,SAASC,KACzDR,GACA,EAIIwB,EAAgBA,IAAMxB,IAO5B,OAJAyB,SAASC,iBAAiB,QAASrB,EAAoB,CAAEsB,SAAS,IAClEF,SAASC,iBAAiB,YAAaJ,GACvCnB,EAAIuB,iBAAiB,UAAWF,GAEzB,KACNC,SAASG,oBAAoB,QAASvB,EAAoB,CACzDsB,SAAS,IAEVF,SAASG,oBAAoB,YAAaN,GAC1CnB,EAAIyB,oBAAoB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ACZC,OAAQ,OACRyB,OAAQ,UACRtB,QAAS,UACTI,SAAU,GACVE,MAAO,YACP,CAAApB,SAAA,YAIFJ,EAAMmC,IAAA,OAAAlC,OAAAC,OAAA,CAAAM,MAAO,CAAEgB,MAAO,YAAW,CAAApB,SAAA,OACjCJ,EACCmC,IAAA,SAAAlC,OAAAC,OAAA,CAAAqC,YAAcvE,IACbA,EAAEK,iBACFqB,GAAU,EAEXc,MAAO,CACNM,WAAY,OACZC,OAAQ,OACRyB,OAAQ,UACRtB,QAAS,UACTI,SAAU,GACVE,MAAO,YACP,CAAApB,SAAA,kBAMC"}
1
+ {"version":3,"file":"LinkBubbleMenu.js","sources":["../../../../src/editor/floating/LinkBubbleMenu.tsx"],"sourcesContent":["import { Editor } from '@tiptap/core';\nimport React, { useCallback, useEffect, useRef, useState } from 'react';\nimport type { LinkTooltipProps } from '../BikEditor.types';\n\ninterface Props {\n\teditor: Editor;\n\trenderLinkTooltip?: (props: LinkTooltipProps) => React.ReactNode;\n}\n\ninterface LinkState {\n\thref: string;\n\ttext: string;\n\trect: DOMRect;\n}\n\n/**\n * Shows a tooltip when the user **clicks** a hyperlink inside the editor.\n * Hides on click outside the editor/bubble or on any keypress.\n * Does NOT trigger on cursor movement or keyboard navigation.\n */\nexport const LinkBubbleMenu: React.FC<Props> = ({\n\teditor,\n\trenderLinkTooltip,\n}) => {\n\tconst [link, setLink] = useState<LinkState | null>(null);\n\tconst bubbleRef = useRef<HTMLDivElement>(null);\n\n\tconst hide = useCallback(() => setLink(null), []);\n\n\tuseEffect(() => {\n\t\tconst dom = editor.view.dom;\n\n\t\t// Use document-level capture so we fire before ANY other listener on the\n\t\t// page — ProseMirror, browser defaults, and Storybook iframes included.\n\t\tconst handleCaptureClick = (e: MouseEvent) => {\n\t\t\t// Only act on clicks that land inside the editor\n\t\t\tif (!dom.contains(e.target as Node)) return;\n\n\t\t\tconst target = e.target as Node;\n\t\t\tconst el = target instanceof Element ? target : target.parentElement;\n\t\t\tconst linkEl = el?.closest('a') ?? null;\n\t\t\tif (!linkEl) {\n\t\t\t\thide();\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// Prevent browser href navigation\n\t\t\te.preventDefault();\n\t\t\t// Prevent the event reaching ProseMirror's bubble-phase handlers\n\t\t\te.stopPropagation();\n\t\t\te.stopImmediatePropagation();\n\n\t\t\tsetLink({\n\t\t\t\thref: linkEl.getAttribute('href') ?? '',\n\t\t\t\ttext: linkEl.textContent ?? '',\n\t\t\t\trect: linkEl.getBoundingClientRect(),\n\t\t\t});\n\t\t};\n\n\t\t// Hide when clicking outside both the editor and the bubble\n\t\tconst handleDocumentMousedown = (e: MouseEvent) => {\n\t\t\tconst target = e.target as Node;\n\t\t\tif (!dom.contains(target) && !bubbleRef.current?.contains(target)) {\n\t\t\t\thide();\n\t\t\t}\n\t\t};\n\n\t\t// Hide on any keypress — user is typing or navigating away\n\t\tconst handleKeyDown = () => hide();\n\n\t\t// { capture: true } on document — fires before every other listener\n\t\tdocument.addEventListener('click', handleCaptureClick, { capture: true });\n\t\tdocument.addEventListener('mousedown', handleDocumentMousedown);\n\t\tdom.addEventListener('keydown', handleKeyDown);\n\n\t\treturn () => {\n\t\t\tdocument.removeEventListener('click', handleCaptureClick, {\n\t\t\t\tcapture: true,\n\t\t\t});\n\t\t\tdocument.removeEventListener('mousedown', handleDocumentMousedown);\n\t\t\tdom.removeEventListener('keydown', handleKeyDown);\n\t\t};\n\t}, [editor, hide]);\n\n\tif (!link) return null;\n\n\tconst { href, text, rect } = link;\n\n\tconst onOpen = () => window.open(href, '_blank', 'noopener,noreferrer');\n\tconst onRemove = () => {\n\t\teditor.chain().focus().extendMarkRange('link').unsetLink().run();\n\t\thide();\n\t};\n\n\t// The <div ref={bubbleRef}> wrapper is what we check for outside-click detection.\n\t// Consumer tooltips use position:fixed internally but remain DOM descendants of\n\t// this wrapper, so bubbleRef.contains() correctly identifies clicks inside them.\n\treturn (\n\t\t<div ref={bubbleRef}>\n\t\t\t{renderLinkTooltip ? (\n\t\t\t\trenderLinkTooltip({ href, text, rect, onOpen, onRemove, onHide: hide })\n\t\t\t) : (\n\t\t\t\t// Built-in fallback: shows href + Open + Remove.\n\t\t\t\t// Use renderLinkTooltip to add an Edit button or custom styling.\n\t\t\t\t<div\n\t\t\t\t\tclassName=\"bik-link-bubble\"\n\t\t\t\t\tstyle={{\n\t\t\t\t\t\tposition: 'fixed',\n\t\t\t\t\t\ttop: rect.bottom + 8,\n\t\t\t\t\t\tleft: rect.left,\n\t\t\t\t\t\tzIndex: 9999,\n\t\t\t\t\t\tbackground: '#fff',\n\t\t\t\t\t\tborder: '1px solid #dee2e6',\n\t\t\t\t\t\tborderRadius: 6,\n\t\t\t\t\t\tboxShadow: '0 4px 12px rgba(0,0,0,0.15)',\n\t\t\t\t\t\tpadding: '6px 10px',\n\t\t\t\t\t\tdisplay: 'flex',\n\t\t\t\t\t\talignItems: 'center',\n\t\t\t\t\t\tgap: 8,\n\t\t\t\t\t\tfontSize: 13,\n\t\t\t\t\t}}\n\t\t\t\t>\n\t\t\t\t\t<span\n\t\t\t\t\t\tstyle={{\n\t\t\t\t\t\t\tdisplay: 'inline-flex',\n\t\t\t\t\t\t\talignItems: 'center',\n\t\t\t\t\t\t\tgap: 4,\n\t\t\t\t\t\t\tcolor: '#4f46e5',\n\t\t\t\t\t\t\tmaxWidth: 220,\n\t\t\t\t\t\t\toverflow: 'hidden',\n\t\t\t\t\t\t\ttextOverflow: 'ellipsis',\n\t\t\t\t\t\t\twhiteSpace: 'nowrap',\n\t\t\t\t\t\t}}\n\t\t\t\t\t>\n\t\t\t\t\t\t<svg\n\t\t\t\t\t\t\twidth=\"14\"\n\t\t\t\t\t\t\theight=\"14\"\n\t\t\t\t\t\t\tviewBox=\"0 0 24 24\"\n\t\t\t\t\t\t\tfill=\"none\"\n\t\t\t\t\t\t\tstroke=\"currentColor\"\n\t\t\t\t\t\t\tstrokeWidth=\"2\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<path d=\"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71\" />\n\t\t\t\t\t\t\t<path d=\"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71\" />\n\t\t\t\t\t\t</svg>\n\t\t\t\t\t\t{href.length > 40 ? href.slice(0, 40) + '…' : href}\n\t\t\t\t\t</span>\n\t\t\t\t\t<button\n\t\t\t\t\t\tonMouseDown={(e) => {\n\t\t\t\t\t\t\te.preventDefault();\n\t\t\t\t\t\t\tonOpen();\n\t\t\t\t\t\t}}\n\t\t\t\t\t\tstyle={{\n\t\t\t\t\t\t\tbackground: 'none',\n\t\t\t\t\t\t\tborder: 'none',\n\t\t\t\t\t\t\tcursor: 'pointer',\n\t\t\t\t\t\t\tpadding: '2px 4px',\n\t\t\t\t\t\t\tfontSize: 12,\n\t\t\t\t\t\t\tcolor: '#495057',\n\t\t\t\t\t\t}}\n\t\t\t\t\t>\n\t\t\t\t\t\tOpen ↗\n\t\t\t\t\t</button>\n\t\t\t\t\t<span style={{ color: '#dee2e6' }}>|</span>\n\t\t\t\t\t<button\n\t\t\t\t\t\tonMouseDown={(e) => {\n\t\t\t\t\t\t\te.preventDefault();\n\t\t\t\t\t\t\tonRemove();\n\t\t\t\t\t\t}}\n\t\t\t\t\t\tstyle={{\n\t\t\t\t\t\t\tbackground: 'none',\n\t\t\t\t\t\t\tborder: 'none',\n\t\t\t\t\t\t\tcursor: 'pointer',\n\t\t\t\t\t\t\tpadding: '2px 4px',\n\t\t\t\t\t\t\tfontSize: 12,\n\t\t\t\t\t\t\tcolor: '#dc3545',\n\t\t\t\t\t\t}}\n\t\t\t\t\t>\n\t\t\t\t\t\tRemove\n\t\t\t\t\t</button>\n\t\t\t\t</div>\n\t\t\t)}\n\t\t</div>\n\t);\n};\n"],"names":["_ref","editor","renderLinkTooltip","link","setLink","useState","bubbleRef","useRef","hide","useCallback","useEffect","dom","view","handleCaptureClick","e","contains","target","el","Element","parentElement","linkEl","_a","closest","preventDefault","stopPropagation","stopImmediatePropagation","href","getAttribute","_b","text","_c","textContent","rect","getBoundingClientRect","handleDocumentMousedown","current","handleKeyDown","document","addEventListener","capture","removeEventListener","onOpen","window","open","onRemove","chain","focus","extendMarkRange","unsetLink","run","_jsx","Object","assign","ref","children","onHide","_jsxs","className","style","position","top","bottom","left","zIndex","background","border","borderRadius","boxShadow","padding","display","alignItems","gap","fontSize","jsxs","color","maxWidth","overflow","textOverflow","whiteSpace","width","height","viewBox","fill","stroke","strokeWidth","jsx","d","length","slice","onMouseDown","cursor"],"mappings":"iJAoB+CA,IAG1C,IAH2CC,OAC/CA,EAAMC,kBACNA,GACAF,EACA,MAAOG,EAAMC,GAAWC,EAAQA,SAAmB,MAC7CC,EAAYC,SAAuB,MAEnCC,EAAOC,EAAAA,aAAY,IAAML,EAAQ,OAAO,IAyD9C,GAvDAM,EAAAA,WAAU,KACT,MAAMC,EAAMV,EAAOW,KAAKD,IAIlBE,EAAsBC,cAE3B,IAAKH,EAAII,SAASD,EAAEE,QAAiB,OAErC,MAAMA,EAASF,EAAEE,OACXC,EAAKD,aAAkBE,QAAUF,EAASA,EAAOG,cACjDC,EAAyB,QAAhBC,EAAAJ,aAAE,EAAFA,EAAIK,QAAQ,YAAI,IAAAD,EAAAA,EAAI,KAC9BD,GAMLN,EAAES,iBAEFT,EAAEU,kBACFV,EAAEW,2BAEFrB,EAAQ,CACPsB,KAAiC,UAA3BN,EAAOO,aAAa,eAAO,IAAAC,EAAAA,EAAI,GACrCC,aAAMC,EAAAV,EAAOW,2BAAe,GAC5BC,KAAMZ,EAAOa,2BAbbzB,GAcC,EAIG0B,EAA2BpB,UAChC,MAAME,EAASF,EAAEE,OACZL,EAAII,SAASC,KAA+B,UAAnBV,EAAU6B,eAAS,IAAAd,OAAA,EAAAA,EAAAN,SAASC,KACzDR,GACA,EAII4B,EAAgBA,IAAM5B,IAO5B,OAJA6B,SAASC,iBAAiB,QAASzB,EAA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C,EAAE,qEAER5D,EAAK6D,OAAS,GAAK7D,EAAK8D,MAAM,EAAG,IAAM,IAAM9D,MAE/CwB,EAAAmC,IAAA,SAAAlC,OAAAC,OAAA,CACCqC,YAAc3E,IACbA,EAAES,iBACFkB,GAAQ,EAETiB,MAAO,CACNM,WAAY,OACZC,OAAQ,OACRyB,OAAQ,UACRtB,QAAS,UACTI,SAAU,GACVE,MAAO,YACP,CAAApB,SAAA,YAIFJ,EAAMmC,IAAA,OAAAlC,OAAAC,OAAA,CAAAM,MAAO,CAAEgB,MAAO,YAAW,CAAApB,SAAA,OACjCJ,EACCmC,IAAA,SAAAlC,OAAAC,OAAA,CAAAqC,YAAc3E,IACbA,EAAES,iBACFqB,GAAU,EAEXc,MAAO,CACNM,WAAY,OACZC,OAAQ,OACRyB,OAAQ,UACRtB,QAAS,UACTI,SAAU,GACVE,MAAO,YACP,CAAApB,SAAA,kBAMC"}
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime");const t=t=>{let{active:l,onPress:s,label:i}=t;return e.jsx("button",Object.assign({type:"button",title:i,className:"bik-toolbar-btn"+(l?" bik-toolbar-btn--active":""),onMouseDown:e=>{e.preventDefault(),s()}},{children:i}))};exports.BikEditorToolbar=l=>{let{editorRef:s,activeFormats:i,showBold:n=!0,showItalic:r=!0,showUnderline:o=!0,showStrike:a=!0,showLink:c=!0,showLists:d=!0,showAlignment:b=!1,showFontPicker:g=!1,onLinkButtonClick:v}=l;var u;const x=null===(u=s.current)||void 0===u?void 0:u.actions;return x?e.jsxs("div",Object.assign({className:"bik-editor-toolbar"},{children:[n&&e.jsx(t,{active:i.bold,onPress:x.toggleBold,label:"Bold"}),r&&e.jsx(t,{active:i.italic,onPress:x.toggleItalic,label:"Italic"}),o&&e.jsx(t,{active:i.underline,onPress:x.toggleUnderline,label:"Underline"}),a&&e.jsx(t,{active:i.strike,onPress:x.toggleStrike,label:"Strike"}),c&&e.jsx(t,{active:!!i.link,onPress:()=>{var e,t,l,n;const r=null!==(t=null===(e=s.current)||void 0===e?void 0:e.getSelectedText())&&void 0!==t?t:"",o=null!==(n=null===(l=i.link)||void 0===l?void 0:l.href)&&void 0!==n?n:null;null==v||v(r,o)},label:"Link"}),d&&e.jsxs(e.Fragment,{children:[e.jsx(t,{active:i.bulletList,onPress:x.toggleBulletList,label:"Bullet"}),e.jsx(t,{active:i.orderedList,onPress:x.toggleOrderedList,label:"Ordered"})]}),b&&e.jsxs(e.Fragment,{children:[e.jsx(t,{active:"left"===i.textAlign,onPress:()=>x.setTextAlign("left"),label:"Left"}),e.jsx(t,{active:"center"===i.textAlign,onPress:()=>x.setTextAlign("center"),label:"Center"}),e.jsx(t,{active:"right"===i.textAlign,onPress:()=>x.setTextAlign("right"),label:"Right"})]})]})):null};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime");const t=t=>{let{active:l,onPress:s,label:i}=t;return e.jsx("button",Object.assign({type:"button",title:i,className:"bik-toolbar-btn"+(l?" bik-toolbar-btn--active":""),onMouseDown:e=>{e.preventDefault(),s()}},{children:i}))};exports.BikEditorToolbar=l=>{let{editorRef:s,activeFormats:i,showBold:n=!0,showItalic:r=!0,showUnderline:o=!0,showStrike:a=!0,showLink:c=!0,showLists:d=!0,showAlignment:b=!1,showFontPicker:g=!1,onLinkButtonClick:v}=l;var u;const x=null===(u=s.current)||void 0===u?void 0:u.actions;return x?e.jsxs("div",Object.assign({className:"bik-editor-toolbar"},{children:[n&&e.jsx(t,{active:i.bold,onPress:x.toggleBold,label:"Bold"}),r&&e.jsx(t,{active:i.italic,onPress:x.toggleItalic,label:"Italic"}),o&&e.jsx(t,{active:i.underline,onPress:x.toggleUnderline,label:"Underline"}),a&&e.jsx(t,{active:i.strike,onPress:x.toggleStrike,label:"Strike"}),c&&e.jsx(t,{active:!!i.link,onPress:()=>{var e,t,l,n;const r=null!==(t=null===(e=s.current)||void 0===e?void 0:e.getSelectedText())&&void 0!==t?t:"",o=null!==(n=null===(l=i.link)||void 0===l?void 0:l.href)&&void 0!==n?n:null;null==v||v(r,o)},label:"Link"}),d&&e.jsxs(e.Fragment,{children:[e.jsx(t,{active:i.bulletList,onPress:x.toggleBulletList,label:"Bullet"}),e.jsx(t,{active:i.orderedList,onPress:x.toggleOrderedList,label:"Ordered"})]}),b&&e.jsxs(e.Fragment,{children:[e.jsx(t,{active:"left"===i.textAlign,onPress:()=>x.setTextAlign("left"),label:"Left"}),e.jsx(t,{active:"center"===i.textAlign,onPress:()=>x.setTextAlign("center"),label:"Center"}),e.jsx(t,{active:"right"===i.textAlign,onPress:()=>x.setTextAlign("right"),label:"Right"})]})]})):null};
2
2
  //# sourceMappingURL=BikEditorToolbar.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"BikEditorToolbar.js","sources":["../../../../src/editor/toolbar/BikEditorToolbar.tsx"],"sourcesContent":["import React from 'react';\nimport type { BikEditorRef, FormatState } from '../BikEditor.types';\n\n/**\n * Props for `<BikEditorToolbar />`.\n *\n * All `show*` props default to `true` except `showAlignment`, `showFontPicker`,\n * and `showColorPicker` which default to `false`.\n */\ninterface Props {\n\t/** The same ref you passed to `<BikEditor ref={...} />`. Required. */\n\teditorRef: React.RefObject<BikEditorRef>;\n\t/**\n\t * Active format snapshot. Keep this in state, updated via `onSelectionChange`.\n\t *\n\t * @example\n\t * const [formats, setFormats] = useState(DEFAULT_ACTIVE_FORMATS);\n\t * <BikEditor onSelectionChange={setFormats} ... />\n\t * <BikEditorToolbar activeFormats={formats} ... />\n\t */\n\tactiveFormats: FormatState;\n\t/** Show the Bold button. Default `true`. */\n\tshowBold?: boolean;\n\t/** Show the Italic button. Default `true`. */\n\tshowItalic?: boolean;\n\t/** Show the Underline button. Default `true`. */\n\tshowUnderline?: boolean;\n\t/** Show the Strikethrough button. Default `true`. */\n\tshowStrike?: boolean;\n\t/** Show the Link button. Default `true`. */\n\tshowLink?: boolean;\n\t/** Show Bullet and Ordered list buttons. Default `true`. */\n\tshowLists?: boolean;\n\t/** Show Left / Center / Right alignment buttons. Default `false`. */\n\tshowAlignment?: boolean;\n\t/** Reserved — renders nothing yet. Default `false`. */\n\tshowFontPicker?: boolean;\n\t/** Reserved — renders nothing yet. Default `false`. */\n\tshowColorPicker?: boolean;\n\t/**\n\t * Called when the user clicks the Link button.\n\t *\n\t * - `selectedText` — the selected text, or the full text of the link the cursor\n\t * is already inside (useful for pre-filling the \"Text\" field of your modal).\n\t * - `currentHref` — non-null when the cursor is inside an existing link\n\t * (useful for pre-filling the \"URL\" field).\n\t *\n\t * After the user saves, call `editorRef.current?.actions.setLink(href, text)`.\n\t */\n\tonLinkButtonClick?: (\n\t\tselectedText: string,\n\t\tcurrentHref: string | null,\n\t) => void;\n}\n\nexport const BikEditorToolbar: React.FC<Props> = ({\n\teditorRef,\n\tactiveFormats,\n\tshowBold = true,\n\tshowItalic = true,\n\tshowUnderline = true,\n\tshowStrike = true,\n\tshowLink = true,\n\tshowLists = true,\n\tshowAlignment = false,\n\tshowFontPicker = false,\n\tonLinkButtonClick,\n}) => {\n\tconst act = editorRef.current?.actions;\n\tif (!act) return null;\n\n\treturn (\n\t\t<div className=\"bik-editor-toolbar\">\n\t\t\t{showBold && (\n\t\t\t\t<Btn\n\t\t\t\t\tactive={activeFormats.bold}\n\t\t\t\t\tonPress={act.toggleBold}\n\t\t\t\t\tlabel=\"Bold\"\n\t\t\t\t/>\n\t\t\t)}\n\t\t\t{showItalic && (\n\t\t\t\t<Btn\n\t\t\t\t\tactive={activeFormats.italic}\n\t\t\t\t\tonPress={act.toggleItalic}\n\t\t\t\t\tlabel=\"Italic\"\n\t\t\t\t/>\n\t\t\t)}\n\t\t\t{showUnderline && (\n\t\t\t\t<Btn\n\t\t\t\t\tactive={activeFormats.underline}\n\t\t\t\t\tonPress={act.toggleUnderline}\n\t\t\t\t\tlabel=\"Underline\"\n\t\t\t\t/>\n\t\t\t)}\n\t\t\t{showStrike && (\n\t\t\t\t<Btn\n\t\t\t\t\tactive={activeFormats.strike}\n\t\t\t\t\tonPress={act.toggleStrike}\n\t\t\t\t\tlabel=\"Strike\"\n\t\t\t\t/>\n\t\t\t)}\n\t\t\t{showLink && (\n\t\t\t\t<Btn\n\t\t\t\t\tactive={!!activeFormats.link}\n\t\t\t\t\tonPress={() => {\n\t\t\t\t\t\tconst selectedText = editorRef.current?.getSelectedText() ?? '';\n\t\t\t\t\t\tconst currentHref = activeFormats.link?.href ?? null;\n\t\t\t\t\t\tonLinkButtonClick?.(selectedText, currentHref);\n\t\t\t\t\t}}\n\t\t\t\t\tlabel=\"Link ↗\"\n\t\t\t\t/>\n\t\t\t)}\n\t\t\t{showLists && (\n\t\t\t\t<>\n\t\t\t\t\t<Btn\n\t\t\t\t\t\tactive={activeFormats.bulletList}\n\t\t\t\t\t\tonPress={act.toggleBulletList}\n\t\t\t\t\t\tlabel=\"Bullet\"\n\t\t\t\t\t/>\n\t\t\t\t\t<Btn\n\t\t\t\t\t\tactive={activeFormats.orderedList}\n\t\t\t\t\t\tonPress={act.toggleOrderedList}\n\t\t\t\t\t\tlabel=\"Ordered\"\n\t\t\t\t\t/>\n\t\t\t\t</>\n\t\t\t)}\n\t\t\t{showAlignment && (\n\t\t\t\t<>\n\t\t\t\t\t<Btn\n\t\t\t\t\t\tactive={activeFormats.textAlign === 'left'}\n\t\t\t\t\t\tonPress={() => act.setTextAlign('left')}\n\t\t\t\t\t\tlabel=\"Left\"\n\t\t\t\t\t/>\n\t\t\t\t\t<Btn\n\t\t\t\t\t\tactive={activeFormats.textAlign === 'center'}\n\t\t\t\t\t\tonPress={() => act.setTextAlign('center')}\n\t\t\t\t\t\tlabel=\"Center\"\n\t\t\t\t\t/>\n\t\t\t\t\t<Btn\n\t\t\t\t\t\tactive={activeFormats.textAlign === 'right'}\n\t\t\t\t\t\tonPress={() => act.setTextAlign('right')}\n\t\t\t\t\t\tlabel=\"Right\"\n\t\t\t\t\t/>\n\t\t\t\t</>\n\t\t\t)}\n\t\t</div>\n\t);\n};\n\nconst Btn: React.FC<{\n\tactive: boolean;\n\tonPress: () => void;\n\tlabel: string;\n}> = ({ active, onPress, label }) => (\n\t<button\n\t\ttype=\"button\"\n\t\ttitle={label}\n\t\tclassName={`bik-toolbar-btn${active ? ' bik-toolbar-btn--active' : ''}`}\n\t\tonMouseDown={(e) => {\n\t\t\te.preventDefault();\n\t\t\tonPress();\n\t\t}}\n\t>\n\t\t{label}\n\t</button>\n);\n"],"names":["BikEditorToolbar","Btn","_ref2","active","onPress","label","_jsx","Object","assign","type","title","className","onMouseDown","e","preventDefault","children","_ref","editorRef","activeFormats","showBold","showItalic","showUnderline","showStrike","showLink","showLists","showAlignment","showFontPicker","onLinkButtonClick","act","_a","current","actions","_jsxs","jsx","bold","toggleBold","italic","toggleItalic","underline","toggleUnderline","strike","toggleStrike","link","selectedText","_b","getSelectedText","currentHref","_d","_c","href","jsxs","_Fragment","bulletList","toggleBulletList","orderedList","toggleOrderedList","textAlign","setTextAlign"],"mappings":"uGAuDaA,MA8FPC,EAIDC,IAAA,IAACC,OAAEA,EAAMC,QAAEA,EAAOC,MAAEA,GAAOH,EAAA,OAC/BI,MAAA,SAAAC,OAAAC,OAAA,CACCC,KAAK,SACLC,MAAOL,EACPM,UAAW,mBAAkBR,EAAS,2BAA6B,IACnES,YAAcC,IACbA,EAAEC,iBACFV,GAAS,GAGT,CAAAW,SAAAV,IACO,2BA7GuCW,IAY5C,IAZ6CC,UACjDA,EAASC,cACTA,EAAaC,SACbA,GAAW,EAAIC,WACfA,GAAa,EAAIC,cACjBA,GAAgB,EAAIC,WACpBA,GAAa,EAAIC,SACjBA,GAAW,EAAIC,UACfA,GAAY,EAAIC,cAChBA,GAAgB,EAAKC,eACrBA,GAAiB,EAAKC,kBACtBA,GACAX,QACA,MAAMY,EAAuB,QAAjBC,EAAAZ,EAAUa,eAAO,IAAAD,OAAA,EAAAA,EAAEE,QAC/B,OAAKH,EAGJI,OAAK,MAAAzB,OAAAC,OAAA,CAAAG,U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ChCpD,MAAM,WAEPC,EAAC2B,IAAAhC,GACAE,OAAoC,UAA5Be,EAAcsC,UACtBpD,QAASA,IAAMwB,EAAI6B,aAAa,SAChCpD,MAAM,iBAxEM,IA4EV"}
1
+ {"version":3,"file":"BikEditorToolbar.js","sources":["../../../../src/editor/toolbar/BikEditorToolbar.tsx"],"sourcesContent":["import React from 'react';\nimport type { BikEditorRef, FormatState } from '../BikEditor.types';\n\n/**\n * Props for `<BikEditorToolbar />`.\n *\n * All `show*` props default to `true` except `showAlignment`, `showFontPicker`,\n * and `showColorPicker` which default to `false`.\n */\ninterface Props {\n\t/** The same ref you passed to `<BikEditor ref={...} />`. Required. */\n\teditorRef: React.RefObject<BikEditorRef>;\n\t/**\n\t * Active format snapshot. Keep this in state, updated via `onSelectionChange`.\n\t *\n\t * @example\n\t * const [formats, setFormats] = useState(DEFAULT_ACTIVE_FORMATS);\n\t * <BikEditor onSelectionChange={setFormats} ... />\n\t * <BikEditorToolbar activeFormats={formats} ... />\n\t */\n\tactiveFormats: FormatState;\n\t/** Show the Bold button. Default `true`. */\n\tshowBold?: boolean;\n\t/** Show the Italic button. Default `true`. */\n\tshowItalic?: boolean;\n\t/** Show the Underline button. Default `true`. */\n\tshowUnderline?: boolean;\n\t/** Show the Strikethrough button. Default `true`. */\n\tshowStrike?: boolean;\n\t/** Show the Link button. Default `true`. */\n\tshowLink?: boolean;\n\t/** Show Bullet and Ordered list buttons. Default `true`. */\n\tshowLists?: boolean;\n\t/** Show Left / Center / Right alignment buttons. Default `false`. */\n\tshowAlignment?: boolean;\n\t/** Reserved — renders nothing yet. Default `false`. */\n\tshowFontPicker?: boolean;\n\t/** Reserved — renders nothing yet. Default `false`. */\n\tshowColorPicker?: boolean;\n\t/**\n\t * Called when the user clicks the Link button.\n\t *\n\t * - `selectedText` — the selected text, or the full text of the link the cursor\n\t * is already inside (useful for pre-filling the \"Text\" field of your modal).\n\t * - `currentHref` — non-null when the cursor is inside an existing link\n\t * (useful for pre-filling the \"URL\" field).\n\t *\n\t * After the user saves, call `editorRef.current?.actions.setLink(href, text)`.\n\t */\n\tonLinkButtonClick?: (\n\t\tselectedText: string,\n\t\tcurrentHref: string | null,\n\t) => void;\n}\n\nexport const BikEditorToolbar: React.FC<Props> = ({\n\teditorRef,\n\tactiveFormats,\n\tshowBold = true,\n\tshowItalic = true,\n\tshowUnderline = true,\n\tshowStrike = true,\n\tshowLink = true,\n\tshowLists = true,\n\tshowAlignment = false,\n\tshowFontPicker = false,\n\tonLinkButtonClick,\n}) => {\n\tconst act = editorRef.current?.actions;\n\tif (!act) return null;\n\n\treturn (\n\t\t<div className=\"bik-editor-toolbar\">\n\t\t\t{showBold && (\n\t\t\t\t<Btn\n\t\t\t\t\tactive={activeFormats.bold}\n\t\t\t\t\tonPress={act.toggleBold}\n\t\t\t\t\tlabel=\"Bold\"\n\t\t\t\t/>\n\t\t\t)}\n\t\t\t{showItalic && (\n\t\t\t\t<Btn\n\t\t\t\t\tactive={activeFormats.italic}\n\t\t\t\t\tonPress={act.toggleItalic}\n\t\t\t\t\tlabel=\"Italic\"\n\t\t\t\t/>\n\t\t\t)}\n\t\t\t{showUnderline && (\n\t\t\t\t<Btn\n\t\t\t\t\tactive={activeFormats.underline}\n\t\t\t\t\tonPress={act.toggleUnderline}\n\t\t\t\t\tlabel=\"Underline\"\n\t\t\t\t/>\n\t\t\t)}\n\t\t\t{showStrike && (\n\t\t\t\t<Btn\n\t\t\t\t\tactive={activeFormats.strike}\n\t\t\t\t\tonPress={act.toggleStrike}\n\t\t\t\t\tlabel=\"Strike\"\n\t\t\t\t/>\n\t\t\t)}\n\t\t\t{showLink && (\n\t\t\t\t<Btn\n\t\t\t\t\tactive={!!activeFormats.link}\n\t\t\t\t\tonPress={() => {\n\t\t\t\t\t\tconst selectedText = editorRef.current?.getSelectedText() ?? '';\n\t\t\t\t\t\tconst currentHref = activeFormats.link?.href ?? null;\n\t\t\t\t\t\tonLinkButtonClick?.(selectedText, currentHref);\n\t\t\t\t\t}}\n\t\t\t\t\tlabel=\"Link\"\n\t\t\t\t/>\n\t\t\t)}\n\t\t\t{showLists && (\n\t\t\t\t<>\n\t\t\t\t\t<Btn\n\t\t\t\t\t\tactive={activeFormats.bulletList}\n\t\t\t\t\t\tonPress={act.toggleBulletList}\n\t\t\t\t\t\tlabel=\"Bullet\"\n\t\t\t\t\t/>\n\t\t\t\t\t<Btn\n\t\t\t\t\t\tactive={activeFormats.orderedList}\n\t\t\t\t\t\tonPress={act.toggleOrderedList}\n\t\t\t\t\t\tlabel=\"Ordered\"\n\t\t\t\t\t/>\n\t\t\t\t</>\n\t\t\t)}\n\t\t\t{showAlignment && (\n\t\t\t\t<>\n\t\t\t\t\t<Btn\n\t\t\t\t\t\tactive={activeFormats.textAlign === 'left'}\n\t\t\t\t\t\tonPress={() => act.setTextAlign('left')}\n\t\t\t\t\t\tlabel=\"Left\"\n\t\t\t\t\t/>\n\t\t\t\t\t<Btn\n\t\t\t\t\t\tactive={activeFormats.textAlign === 'center'}\n\t\t\t\t\t\tonPress={() => act.setTextAlign('center')}\n\t\t\t\t\t\tlabel=\"Center\"\n\t\t\t\t\t/>\n\t\t\t\t\t<Btn\n\t\t\t\t\t\tactive={activeFormats.textAlign === 'right'}\n\t\t\t\t\t\tonPress={() => act.setTextAlign('right')}\n\t\t\t\t\t\tlabel=\"Right\"\n\t\t\t\t\t/>\n\t\t\t\t</>\n\t\t\t)}\n\t\t</div>\n\t);\n};\n\nconst Btn: React.FC<{\n\tactive: boolean;\n\tonPress: () => void;\n\tlabel: string;\n}> = ({ active, onPress, label }) => (\n\t<button\n\t\ttype=\"button\"\n\t\ttitle={label}\n\t\tclassName={`bik-toolbar-btn${active ? ' bik-toolbar-btn--active' : ''}`}\n\t\tonMouseDown={(e) => {\n\t\t\te.preventDefault();\n\t\t\tonPress();\n\t\t}}\n\t>\n\t\t{label}\n\t</button>\n);\n"],"names":["BikEditorToolbar","Btn","_ref2","active","onPress","label","_jsx","Object","assign","type","title","className","onMouseDown","e","preventDefault","children","_ref","editorRef","activeFormats","showBold","showItalic","showUnderline","showStrike","showLink","showLists","showAlignment","showFontPicker","onLinkButtonClick","act","_a","current","actions","_jsxs","jsx","bold","toggleBold","italic","toggleItalic","underline","toggleUnderline","strike","toggleStrike","link","selectedText","_b","getSelectedText","currentHref","_d","_c","href","jsxs","_Fragment","bulletList","toggleBulletList","orderedList","toggleOrderedList","textAlign","setTextAlign"],"mappings":"uGAuDaA,MA8FPC,EAIDC,IAAA,IAACC,OAAEA,EAAMC,QAAEA,EAAOC,MAAEA,GAAOH,EAAA,OAC/BI,MAAA,SAAAC,OAAAC,OAAA,CACCC,KAAK,SACLC,MAAOL,EACPM,UAAW,mBAAkBR,EAAS,2BAA6B,IACnES,YAAcC,IACbA,EAAEC,iBACFV,GAAS,GAGT,CAAAW,SAAAV,IACO,2BA7GuCW,IAY5C,IAZ6CC,UACjDA,EAASC,cACTA,EAAaC,SACbA,GAAW,EAAIC,WACfA,GAAa,EAAIC,cACjBA,GAAgB,EAAIC,WACpBA,GAAa,EAAIC,SACjBA,GAAW,EAAIC,UACfA,GAAY,EAAIC,cAChBA,GAAgB,EAAKC,eACrBA,GAAiB,EAAKC,kBACtBA,GACAX,QACA,MAAMY,EAAuB,QAAjBC,EAAAZ,EAAUa,eAAO,IAAAD,OAAA,EAAAA,EAAEE,QAC/B,OAAKH,EAGJI,OAAK,MAAAzB,OAAAC,OAAA,CAAAG,UAAU,sBACb,CAAAI,SAAA,CAAAI,GACAb,EAAC2B,IAAAhC,EACA,CAAAE,OAAQe,EAAcgB,KACtB9B,QAASwB,EAAIO,WACb9B,MAAM,SAGPe,GACAd,EAAC2B,IAAAhC,EACA,CAAAE,OAAQe,EAAckB,OACtBhC,QAASwB,EAAIS,aACbhC,MAAM,WAGPgB,GACAf,EAAC2B,IAAAhC,GACAE,OAAQe,EAAcoB,UACtBlC,QAASwB,EAAIW,gBACblC,MAAM,cAGPiB,GACAhB,EAAA2B,IAAChC,EAAG,CACHE,OAAQe,EAAcsB,OACtBpC,QAASwB,EAAIa,aACbpC,MAAM,WAGPkB,GACAjB,EAAC2B,IAAAhC,EACA,CAAAE,SAAUe,EAAcwB,KACxBtC,QAASA,iBACR,MAAMuC,EAAuD,QAAxCC,EAAiB,QAAjBf,EAAAZ,EAAUa,eAAO,IAAAD,OAAA,EAAAA,EAAEgB,yBAAqB,IAAAD,EAAAA,EAAA,GACvDE,EAA0C,QAA5BC,EAAoB,QAApBC,EAAA9B,EAAcwB,YAAM,IAAAM,OAAA,EAAAA,EAAAC,YAAQ,IAAAF,EAAAA,EAAA,KAChDpB,SAAAA,EAAoBgB,EAAcG,EAAY,EAE/CzC,MAAM,SAGPmB,GACAQ,EAAAkB,KAAAC,WAAA,CAAApC,SAAA,CACCT,EAAC2B,IAAAhC,GACAE,OAAQe,EAAckC,WACtBhD,QAASwB,EAAIyB,iBACbhD,MAAM,WAEPC,EAAA2B,IAAChC,EACA,CAAAE,OAAQe,EAAcoC,YACtBlD,QAASwB,EAAI2B,kBACblD,MAAM,eAIRoB,GACAO,EAAAkB,KAAAC,WAAA,CAAApC,SAAA,CACCT,EAAC2B,IAAAhC,GACAE,OAAoC,SAA5Be,EAAcsC,UACtBpD,QAASA,IAAMwB,EAAI6B,aAAa,QAChCpD,MAAM,SAEPC,EAAC2B,IAAAhC,GACAE,OAAoC,WAA5Be,EAAcsC,UACtBpD,QAASA,IAAMwB,EAAI6B,aAAa,UAChCpD,MAAM,WAEPC,EAAC2B,IAAAhC,GACAE,OAAoC,UAA5Be,EAAcsC,UACtBpD,QAASA,IAAMwB,EAAI6B,aAAa,SAChCpD,MAAM,iBAxEM,IA4EV"}
@@ -1,4 +1,4 @@
1
1
  import React from 'react';
2
- import { QueryBuilderNodeProps } from "../../../Types/QueryBuilderNodeProps.type";
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 "../../../Types/QueryBuilderAPI.type";
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 "../../../Types/QueryBuilderNodeProps.type";
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 "../../../Types/QueryBuilderAPI.type";
1
+ import { QueryBuilderAPIData } from "../../../types/QueryBuilderAPI.type";
2
2
  export declare const useIGTriggerNameCacheSelector: () => QueryBuilderAPIData[];
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
2
  import { DropdownOption } from "../../../dropdown/type";
3
- import { QueryBuilderProperty } from "../../Types/QueryBuilder.type";
4
- import { QueryBuilderNodeProps } from "../../Types/QueryBuilderNodeProps.type";
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;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  export declare const Menus: ({
3
2
  displayName: string;
4
3
  key: number;
@@ -688,8 +688,8 @@ export interface BikEditorProps {
688
688
  /** Called on every document change. */
689
689
  onChange?: (content: EditorSnapshot) => void;
690
690
  /**
691
- * Called when the user presses Mod+Enter (Cmd on Mac, Ctrl on Win/Linux).
692
- * Only fires when this prop is provided.
691
+ * Called when the user presses the key combo defined by `sendShortcut`.
692
+ * Only fires when both `onSend` and `sendShortcut` are provided.
693
693
  */
694
694
  onSend?: (content: EditorSnapshot) => void;
695
695
  /** Called when the editor gains focus. */
@@ -16,10 +16,12 @@ import { EditorSnapshot, FormatState } from './BikEditor.types';
16
16
  */
17
17
  export declare function normalizeHtml(html: string): string;
18
18
  /**
19
- * Insert HTML at the current cursor position as inline content.
20
- * Parses the HTML into ProseMirror nodes, collects only the inline children
21
- * (unwrapping block wrappers like <p>), and replaces the current selection
22
- * with an open Slice so the content merges into the surrounding paragraph.
19
+ * Insert HTML at the current cursor position, merging the first paragraph
20
+ * inline while preserving the block structure of subsequent paragraphs/lists.
21
+ *
22
+ * Uses `parseSlice` which returns an open-ended Slice the first block merges
23
+ * at the cursor, middle blocks stay intact, and the last block merges with any
24
+ * text that follows the cursor.
23
25
  */
24
26
  export declare function insertInlineHtml(editor: Editor, html: string): void;
25
27
  export declare const SECTION_DIVIDER_HTML: (id: string) => string;
@@ -6,10 +6,16 @@ interface ExtensionConfig {
6
6
  maxCharacters?: number;
7
7
  hasSections?: boolean;
8
8
  mentions?: {
9
- agents?: MentionItem[];
10
- teams?: MentionItem[];
9
+ agents?: {
10
+ current: MentionItem[];
11
+ };
12
+ teams?: {
13
+ current: MentionItem[];
14
+ };
15
+ };
16
+ slashCommands?: {
17
+ current: SlashCommandItem[];
11
18
  };
12
- slashCommands?: SlashCommandItem[];
13
19
  onPaste?: (data: PasteData) => boolean | void;
14
20
  onSend?: (content: EditorSnapshot) => void;
15
21
  sendShortcut?: {
@@ -1,4 +1,8 @@
1
1
  import type { ReactNode } from 'react';
2
2
  import type { MentionDropdownRenderProps, MentionItem } from '../../BikEditor.types';
3
- export declare function buildAgentMentionExtension(agents: MentionItem[], onSelect?: (item: MentionItem, char: '@' | '#') => void, renderItem?: (item: MentionItem, isActive: boolean) => ReactNode, renderDropdown?: (props: MentionDropdownRenderProps) => ReactNode): import("@tiptap/core").Node<import("@tiptap/extension-mention").MentionOptions<any, import("@tiptap/extension-mention").MentionNodeAttrs>, any>;
4
- export declare function buildTeamMentionExtension(teams: MentionItem[], onSelect?: (item: MentionItem, char: '@' | '#') => void, renderItem?: (item: MentionItem, isActive: boolean) => ReactNode, renderDropdown?: (props: MentionDropdownRenderProps) => ReactNode): import("@tiptap/core").Node<import("@tiptap/extension-mention").MentionOptions<any, import("@tiptap/extension-mention").MentionNodeAttrs>, any>;
3
+ export declare function buildAgentMentionExtension(agentsRef: {
4
+ current: MentionItem[];
5
+ }, onSelect?: (item: MentionItem, char: '@' | '#') => void, renderItem?: (item: MentionItem, isActive: boolean) => ReactNode, renderDropdown?: (props: MentionDropdownRenderProps) => ReactNode): import("@tiptap/core").Node<import("@tiptap/extension-mention").MentionOptions<any, import("@tiptap/extension-mention").MentionNodeAttrs>, any>;
6
+ export declare function buildTeamMentionExtension(teamsRef: {
7
+ current: MentionItem[];
8
+ }, onSelect?: (item: MentionItem, char: '@' | '#') => void, renderItem?: (item: MentionItem, isActive: boolean) => ReactNode, renderDropdown?: (props: MentionDropdownRenderProps) => ReactNode): import("@tiptap/core").Node<import("@tiptap/extension-mention").MentionOptions<any, import("@tiptap/extension-mention").MentionNodeAttrs>, any>;
@@ -1,4 +1,6 @@
1
1
  import { Extension } from '@tiptap/core';
2
2
  import type { ReactNode } from 'react';
3
3
  import type { SlashCommandDropdownRenderProps, SlashCommandItem } from '../../BikEditor.types';
4
- export declare function buildSlashCommandExtension(commands: SlashCommandItem[], onSelect?: (command: SlashCommandItem) => void, renderItem?: (item: SlashCommandItem, isActive: boolean) => ReactNode, renderDropdown?: (props: SlashCommandDropdownRenderProps) => ReactNode): Extension<any, any>;
4
+ export declare function buildSlashCommandExtension(commandsRef: {
5
+ current: SlashCommandItem[];
6
+ }, onSelect?: (command: SlashCommandItem) => void, renderItem?: (item: SlashCommandItem, isActive: boolean) => ReactNode, renderDropdown?: (props: SlashCommandDropdownRenderProps) => ReactNode): Extension<any, any>;
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Lightweight popup positioner for suggestion dropdowns (mentions, slash commands).
3
+ * Replaces tippy.js — all we need is a positioned container near the cursor
4
+ * that flips above when there isn't enough room below.
5
+ */
6
+ export interface SuggestionPopup {
7
+ show(): void;
8
+ hide(): void;
9
+ destroy(): void;
10
+ updatePosition(clientRect: () => DOMRect | null): void;
11
+ readonly element: HTMLDivElement;
12
+ }
13
+ export declare function createSuggestionPopup(content: HTMLElement, clientRect: (() => DOMRect | null) | null): SuggestionPopup;