@bikdotai/bik-component-library 0.0.802-beta.1 → 0.0.802-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/editor/BikEditor.styles.js +0 -2
- package/dist/cjs/editor/BikEditor.styles.js.map +1 -1
- package/dist/cjs/editor/extensions/editorDropdown.styles.js +17 -5
- package/dist/cjs/editor/extensions/editorDropdown.styles.js.map +1 -1
- package/dist/cjs/editor/extensions/mention/MentionDropdown.js +1 -1
- package/dist/cjs/editor/extensions/mention/MentionDropdown.js.map +1 -1
- package/dist/cjs/editor/extensions/plainClipboard/PlainClipboardExtension.js +1 -1
- package/dist/cjs/editor/extensions/plainClipboard/PlainClipboardExtension.js.map +1 -1
- package/dist/cjs/editor/extensions/slashCommand/SlashCommandMenu.js +1 -1
- package/dist/cjs/editor/extensions/slashCommand/SlashCommandMenu.js.map +1 -1
- package/dist/cjs/src/editor/extensions/editorDropdown.styles.d.ts +1 -0
- package/dist/esm/editor/BikEditor.styles.js +0 -2
- package/dist/esm/editor/BikEditor.styles.js.map +1 -1
- package/dist/esm/editor/extensions/editorDropdown.styles.js +27 -15
- package/dist/esm/editor/extensions/editorDropdown.styles.js.map +1 -1
- package/dist/esm/editor/extensions/mention/MentionDropdown.js +1 -1
- package/dist/esm/editor/extensions/mention/MentionDropdown.js.map +1 -1
- package/dist/esm/editor/extensions/plainClipboard/PlainClipboardExtension.js +1 -1
- package/dist/esm/editor/extensions/plainClipboard/PlainClipboardExtension.js.map +1 -1
- package/dist/esm/editor/extensions/slashCommand/SlashCommandMenu.js +1 -1
- package/dist/esm/editor/extensions/slashCommand/SlashCommandMenu.js.map +1 -1
- package/dist/esm/src/editor/extensions/editorDropdown.styles.d.ts +1 -0
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BikEditor.styles.js","sources":["../../../src/editor/BikEditor.styles.ts"],"sourcesContent":["import styled from 'styled-components';\nimport { COLORS } from '../constants/Theme';\n\nexport const BikEditorShell = styled.div<{\n\tminHeight?: string;\n\tmaxHeight?: string;\n}>`\n\tposition: relative;\n\twidth: 100%;\n\n\t.ProseMirror {\n\t\tmin-height: ${({ minHeight }) => minHeight ?? '80px'};\n\t\tmax-height: ${({ maxHeight }) => maxHeight ?? 'none'};\n\t\toverflow-y: auto;\n\t\toutline: none;\n\t\tpadding: 8px 12px;\n\t\tfont-size: 14px;\n\t\tline-height: 1.5;\n\t\tword-break: break-word;\n\n\t\tp {\n\t\t\tmargin: 0;\n\t\t\tpadding: 0;\n\t\t}\n\n\t\tul,\n\t\tol {\n\t\t\tmargin: 0;\n\t\t\tpadding-left: 1.5em;\n\t\t}\n\n\t\tli + li {\n\t\t\tmargin-top: 2px;\n\t\t}\n\n\t\tp.is-editor-empty:first-child::before {\n\t\t\tcontent: attr(data-placeholder);\n\t\t\tfloat: left;\n\t\t\tcolor: #adb5bd;\n\t\t\tpointer-events: none;\n\t\t\theight: 0;\n\t\t}\n\t}\n\n\t.bik-mention {\n\t\tcolor: ${COLORS.content.brand};\n\t\tpadding: 1px 4px;\n\t}\n\t.bik-mention--team {\n\t\tcolor: ${COLORS.content.brand};\n\t}\n\t.bik-variable {\n\t
|
|
1
|
+
{"version":3,"file":"BikEditor.styles.js","sources":["../../../src/editor/BikEditor.styles.ts"],"sourcesContent":["import styled from 'styled-components';\nimport { COLORS } from '../constants/Theme';\n\nexport const BikEditorShell = styled.div<{\n\tminHeight?: string;\n\tmaxHeight?: string;\n}>`\n\tposition: relative;\n\twidth: 100%;\n\n\t.ProseMirror {\n\t\tmin-height: ${({ minHeight }) => minHeight ?? '80px'};\n\t\tmax-height: ${({ maxHeight }) => maxHeight ?? 'none'};\n\t\toverflow-y: auto;\n\t\toutline: none;\n\t\tpadding: 8px 12px;\n\t\tfont-size: 14px;\n\t\tline-height: 1.5;\n\t\tword-break: break-word;\n\n\t\tp {\n\t\t\tmargin: 0;\n\t\t\tpadding: 0;\n\t\t}\n\n\t\tul,\n\t\tol {\n\t\t\tmargin: 0;\n\t\t\tpadding-left: 1.5em;\n\t\t}\n\n\t\tli + li {\n\t\t\tmargin-top: 2px;\n\t\t}\n\n\t\tp.is-editor-empty:first-child::before {\n\t\t\tcontent: attr(data-placeholder);\n\t\t\tfloat: left;\n\t\t\tcolor: #adb5bd;\n\t\t\tpointer-events: none;\n\t\t\theight: 0;\n\t\t}\n\t}\n\n\t.bik-mention {\n\t\tcolor: ${COLORS.content.brand};\n\t\tpadding: 1px 4px;\n\t}\n\t.bik-mention--team {\n\t\tcolor: ${COLORS.content.brand};\n\t}\n\t.bik-variable {\n\t}\n\n\ta,\n\t.bik-link {\n\t\tcolor: #4f46e5;\n\t\ttext-decoration: underline;\n\t\ttext-decoration-color: #a5b4fc;\n\t\ttext-underline-offset: 2px;\n\t\tcursor: pointer;\n\t\t&:hover {\n\t\t\tcolor: #3730a3;\n\t\t\ttext-decoration-color: #6366f1;\n\t\t}\n\t}\n`;\n"],"names":["BikEditorShell","div","_ref","minHeight","_ref2","maxHeight","COLORS","content","brand"],"mappings":"kNAGaA,MAAAA,OAAuB,QAACC,GAGnC;;;;;gBAKcC,IAAA,IAACC,UAAEA,GAAWD,EAAA,OAAKC,QAAAA,EAAa,MAAM;gBACtCC,IAAA,IAACC,UAAEA,GAAWD,EAAA,OAAKC,QAAAA,EAAa,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;WAiC3CC,EAAMA,OAACC,QAAQC;;;;WAIfF,EAAMA,OAACC,QAAQC;;;;;;;;;;;;;;;;;"}
|
|
@@ -25,22 +25,34 @@
|
|
|
25
25
|
border-radius: 50%;
|
|
26
26
|
object-fit: cover;
|
|
27
27
|
flex-shrink: 0;
|
|
28
|
-
`,p=o.default.
|
|
29
|
-
|
|
28
|
+
`,p=o.default.div`
|
|
29
|
+
width: 24px;
|
|
30
|
+
height: 24px;
|
|
31
|
+
border-radius: 50%;
|
|
32
|
+
background: ${t.COLORS.surface.hovered};
|
|
33
|
+
display: flex;
|
|
34
|
+
align-items: center;
|
|
35
|
+
justify-content: center;
|
|
36
|
+
font-size: 12px;
|
|
37
|
+
font-weight: 600;
|
|
30
38
|
color: ${t.COLORS.content.primary};
|
|
39
|
+
flex-shrink: 0;
|
|
31
40
|
`,s=o.default.span`
|
|
41
|
+
font-weight: 500;
|
|
42
|
+
color: ${t.COLORS.content.primary};
|
|
43
|
+
`,d=o.default.span`
|
|
32
44
|
width: 8px;
|
|
33
45
|
height: 8px;
|
|
34
46
|
border-radius: 50%;
|
|
35
47
|
background: ${e=>{let{$online:r}=e;return r?t.COLORS.content.positive:t.COLORS.content.placeholder}};
|
|
36
48
|
margin-left: auto;
|
|
37
49
|
flex-shrink: 0;
|
|
38
|
-
`,
|
|
50
|
+
`,l=o.default.span`
|
|
39
51
|
font-weight: 500;
|
|
40
52
|
color: ${t.COLORS.content.primary};
|
|
41
|
-
`,
|
|
53
|
+
`,c=o.default.span`
|
|
42
54
|
font-size: 12px;
|
|
43
55
|
color: ${t.COLORS.content.secondary};
|
|
44
56
|
margin-left: auto;
|
|
45
|
-
`;exports.DropdownContainer=n,exports.DropdownItem=a,exports.MentionAvatar=i,exports.
|
|
57
|
+
`;exports.DropdownContainer=n,exports.DropdownItem=a,exports.MentionAvatar=i,exports.MentionAvatarFallback=p,exports.MentionLabel=s,exports.MentionPresenceDot=d,exports.SlashDescription=c,exports.SlashLabel=l;
|
|
46
58
|
//# sourceMappingURL=editorDropdown.styles.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"editorDropdown.styles.js","sources":["../../../../src/editor/extensions/editorDropdown.styles.ts"],"sourcesContent":["import styled from 'styled-components';\nimport { COLORS } from '@src/constants/Theme';\n\nexport const DropdownContainer = styled.div`\n\tbackground: ${COLORS.surface.standard};\n\tborder: 1px solid ${COLORS.stroke.primary};\n\tborder-radius: 8px;\n\tbox-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);\n\tpadding: 4px;\n\tmin-width: 330px;\n\tmax-height: 260px;\n\toverflow-y: auto;\n\tfont-size: 14px;\n\tcolor: ${COLORS.content.primary};\n`;\n\nexport const DropdownItem = styled.div<{ $isActive?: boolean }>`\n\tdisplay: flex;\n\talign-items: center;\n\tgap: 8px;\n\tpadding: 12px 16px;\n\tmin-height: 43px;\n\tborder-radius: 6px;\n\tcursor: pointer;\n\tcolor: ${COLORS.content.primary};\n\tbackground: ${({ $isActive }) =>\n\t\t$isActive ? COLORS.surface.hovered : 'transparent'};\n`;\n\nexport const MentionAvatar = styled.img`\n\twidth: 24px;\n\theight: 24px;\n\tborder-radius: 50%;\n\tobject-fit: cover;\n\tflex-shrink: 0;\n`;\n\nexport const MentionLabel = styled.span`\n\tfont-weight: 500;\n\tcolor: ${COLORS.content.primary};\n`;\n\nexport const MentionPresenceDot = styled.span<{ $online?: boolean }>`\n\twidth: 8px;\n\theight: 8px;\n\tborder-radius: 50%;\n\tbackground: ${({ $online }) =>\n\t\t$online ? COLORS.content.positive : COLORS.content.placeholder};\n\tmargin-left: auto;\n\tflex-shrink: 0;\n`;\n\nexport const SlashLabel = styled.span`\n\tfont-weight: 500;\n\tcolor: ${COLORS.content.primary};\n`;\n\nexport const SlashDescription = styled.span`\n\tfont-size: 12px;\n\tcolor: ${COLORS.content.secondary};\n\tmargin-left: auto;\n`;\n"],"names":["DropdownContainer","styled","div","COLORS","surface","standard","stroke","primary","content","DropdownItem","_ref","$isActive","hovered","MentionAvatar","img","MentionLabel","span","MentionPresenceDot","_ref2","$online","positive","placeholder","SlashLabel","SlashDescription","secondary"],"mappings":"gOAGaA,MAAAA,EAAoBC,EAAM,QAACC,GAAG;eAC5BC,EAAMA,OAACC,QAAQC;qBACTF,EAAMA,OAACG,OAAOC;;;;;;;;UAQzBJ,EAAMA,OAACK,QAAQD;EAGZE,EAAeR,EAAM,QAACC,GAA4B;;;;;;;;UAQrDC,EAAMA,OAACK,QAAQD;eACVG,IAAA,IAACC,UAAEA,GAAWD,EAAA,OAC3BC,EAAYR,EAAMA,OAACC,QAAQQ,QAAU,aAAa;EAGvCC,EAAgBZ,EAAM,QAACa,GAAG;;;;;;EAQ1BC,
|
|
1
|
+
{"version":3,"file":"editorDropdown.styles.js","sources":["../../../../src/editor/extensions/editorDropdown.styles.ts"],"sourcesContent":["import styled from 'styled-components';\nimport { COLORS } from '@src/constants/Theme';\n\nexport const DropdownContainer = styled.div`\n\tbackground: ${COLORS.surface.standard};\n\tborder: 1px solid ${COLORS.stroke.primary};\n\tborder-radius: 8px;\n\tbox-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);\n\tpadding: 4px;\n\tmin-width: 330px;\n\tmax-height: 260px;\n\toverflow-y: auto;\n\tfont-size: 14px;\n\tcolor: ${COLORS.content.primary};\n`;\n\nexport const DropdownItem = styled.div<{ $isActive?: boolean }>`\n\tdisplay: flex;\n\talign-items: center;\n\tgap: 8px;\n\tpadding: 12px 16px;\n\tmin-height: 43px;\n\tborder-radius: 6px;\n\tcursor: pointer;\n\tcolor: ${COLORS.content.primary};\n\tbackground: ${({ $isActive }) =>\n\t\t$isActive ? COLORS.surface.hovered : 'transparent'};\n`;\n\nexport const MentionAvatar = styled.img`\n\twidth: 24px;\n\theight: 24px;\n\tborder-radius: 50%;\n\tobject-fit: cover;\n\tflex-shrink: 0;\n`;\n\nexport const MentionAvatarFallback = styled.div`\n\twidth: 24px;\n\theight: 24px;\n\tborder-radius: 50%;\n\tbackground: ${COLORS.surface.hovered};\n\tdisplay: flex;\n\talign-items: center;\n\tjustify-content: center;\n\tfont-size: 12px;\n\tfont-weight: 600;\n\tcolor: ${COLORS.content.primary};\n\tflex-shrink: 0;\n`;\n\nexport const MentionLabel = styled.span`\n\tfont-weight: 500;\n\tcolor: ${COLORS.content.primary};\n`;\n\nexport const MentionPresenceDot = styled.span<{ $online?: boolean }>`\n\twidth: 8px;\n\theight: 8px;\n\tborder-radius: 50%;\n\tbackground: ${({ $online }) =>\n\t\t$online ? COLORS.content.positive : COLORS.content.placeholder};\n\tmargin-left: auto;\n\tflex-shrink: 0;\n`;\n\nexport const SlashLabel = styled.span`\n\tfont-weight: 500;\n\tcolor: ${COLORS.content.primary};\n`;\n\nexport const SlashDescription = styled.span`\n\tfont-size: 12px;\n\tcolor: ${COLORS.content.secondary};\n\tmargin-left: auto;\n`;\n"],"names":["DropdownContainer","styled","div","COLORS","surface","standard","stroke","primary","content","DropdownItem","_ref","$isActive","hovered","MentionAvatar","img","MentionAvatarFallback","MentionLabel","span","MentionPresenceDot","_ref2","$online","positive","placeholder","SlashLabel","SlashDescription","secondary"],"mappings":"gOAGaA,MAAAA,EAAoBC,EAAM,QAACC,GAAG;eAC5BC,EAAMA,OAACC,QAAQC;qBACTF,EAAMA,OAACG,OAAOC;;;;;;;;UAQzBJ,EAAMA,OAACK,QAAQD;EAGZE,EAAeR,EAAM,QAACC,GAA4B;;;;;;;;UAQrDC,EAAMA,OAACK,QAAQD;eACVG,IAAA,IAACC,UAAEA,GAAWD,EAAA,OAC3BC,EAAYR,EAAMA,OAACC,QAAQQ,QAAU,aAAa;EAGvCC,EAAgBZ,EAAM,QAACa,GAAG;;;;;;EAQ1BC,EAAwBd,EAAM,QAACC,GAAG;;;;eAIhCC,EAAMA,OAACC,QAAQQ;;;;;;UAMpBT,EAAMA,OAACK,QAAQD;;EAIZS,EAAef,EAAM,QAACgB,IAAI;;UAE7Bd,EAAMA,OAACK,QAAQD;EAGZW,EAAqBjB,EAAM,QAACgB,IAA2B;;;;eAIrDE,IAAA,IAACC,QAAEA,GAASD,EAAA,OACzBC,EAAUjB,EAAAA,OAAOK,QAAQa,SAAWlB,EAAMA,OAACK,QAAQc,WAAW;;;EAKnDC,EAAatB,EAAM,QAACgB,IAAI;;UAE3Bd,EAAMA,OAACK,QAAQD;EAGZiB,EAAmBvB,EAAM,QAACgB,IAAI;;UAEjCd,EAAMA,OAACK,QAAQiB;;"}
|
|
@@ -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"})}),[]),
|
|
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;
|
|
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\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
|
|
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,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,GACtB,CAAAQ,SAAAhB,EAAMqC,KAAI,CAACtB,EAAMK,IACjBU,MAACQ,EAAAA,sCAEWlB,IAAMf,EACjBkC,aAAcA,IAAMjC,EAAiBc,GACrCoB,QAASA,IAAMrB,EAAOC,IAAE,CAAAJ,SAEvBb,EACAA,EAAWY,EAAMK,IAAMf,GAEvBoC,EAAAC,KAAAX,WAAA,CAAAf,SAAA,CACED,EAAK4B,UACLb,EAAAA,IAACc,EAAAA,cAAc,CAAAC,IAAK9B,EAAK4B,UAAWG,IAAI,KAExChB,EAACiB,IAAAC,wBACC,CAAAhC,SAAAD,EAAKkC,MAAMC,OAAO,GAAGC,gBAGxBrB,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,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../../node_modules/@tiptap/core/dist/index.js"),t=require("@tiptap/pm/model"),a=require("@tiptap/pm/state");const r=e.Extension.create({name:"plainClipboard",addProseMirrorPlugins:()=>[new a.Plugin({props:{handlePaste(e,a){var r,i,l,n;if(null===(i=null===(r=a.clipboardData)||void 0===r?void 0:r.files)||void 0===i?void 0:i.length)return!1;const o=null===(l=a.clipboardData)||void 0===l?void 0:l.getData("text/html"),p=null===(n=a.clipboardData)||void 0===n?void 0:n.getData("text/plain");if(!p||!o)return!1;const d=e.state.schema,s=p.split("\n").map((e=>d.node("paragraph",null,e?[d.text(e)]:[]))),u=new t.Slice(t.Fragment.fromArray(s),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../../node_modules/@tiptap/core/dist/index.js"),t=require("@tiptap/pm/model"),a=require("@tiptap/pm/state");const r=e.Extension.create({name:"plainClipboard",addProseMirrorPlugins:()=>[new a.Plugin({props:{handlePaste(e,a){var r,i,l,n;if(null===(i=null===(r=a.clipboardData)||void 0===r?void 0:r.files)||void 0===i?void 0:i.length)return!1;const o=null===(l=a.clipboardData)||void 0===l?void 0:l.getData("text/html"),p=null===(n=a.clipboardData)||void 0===n?void 0:n.getData("text/plain");if(!p||!o)return!1;const d=e.state.schema,s=p.split("\n").map((e=>d.node("paragraph",null,e?[d.text(e)]:[]))),u=new t.Slice(t.Fragment.fromArray(s),1,1);return e.dispatch(e.state.tr.replaceSelection(u)),!0}}})]});exports.PlainClipboardExtension=r;
|
|
2
2
|
//# sourceMappingURL=PlainClipboardExtension.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PlainClipboardExtension.js","sources":["../../../../../src/editor/extensions/plainClipboard/PlainClipboardExtension.ts"],"sourcesContent":["import { Extension } from '@tiptap/core';\nimport { Fragment, Slice } from '@tiptap/pm/model';\nimport { Plugin } from '@tiptap/pm/state';\n\nexport const PlainClipboardExtension = Extension.create({\n\tname: 'plainClipboard',\n\taddProseMirrorPlugins() {\n\t\treturn [\n\t\t\tnew Plugin({\n\t\t\t\tprops: {\n\t\t\t\t\thandlePaste(_view, event) {\n\t\t\t\t\t\tif (event.clipboardData?.files?.length) return false; // let ImagePaste handle\n\t\t\t\t\t\tconst html = event.clipboardData?.getData('text/html');\n\t\t\t\t\t\tconst text = event.clipboardData?.getData('text/plain');\n\t\t\t\t\t\tif (!text || !html) return false;\n\n\t\t\t\t\t\tconst schema = _view.state.schema;\n\t\t\t\t\t\t// Split on each newline so that multi-paragraph pastes produce\n\t\t\t\t\t\t// separate paragraph nodes — matching the behaviour of pressing\n\t\t\t\t\t\t// Enter between lines. Using schema.text() collapses all newlines\n\t\t\t\t\t\t// because ProseMirror text nodes cannot contain '\\n'.\n\t\t\t\t\t\tconst paragraphs = text\n\t\t\t\t\t\t\t.split('\\n')\n\t\t\t\t\t\t\t.map((line) =>\n\t\t\t\t\t\t\t\tschema.node('paragraph', null, line ? [schema.text(line)] : []),\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\tconst slice = new Slice(Fragment.fromArray(paragraphs),
|
|
1
|
+
{"version":3,"file":"PlainClipboardExtension.js","sources":["../../../../../src/editor/extensions/plainClipboard/PlainClipboardExtension.ts"],"sourcesContent":["import { Extension } from '@tiptap/core';\nimport { Fragment, Slice } from '@tiptap/pm/model';\nimport { Plugin } from '@tiptap/pm/state';\n\nexport const PlainClipboardExtension = Extension.create({\n\tname: 'plainClipboard',\n\taddProseMirrorPlugins() {\n\t\treturn [\n\t\t\tnew Plugin({\n\t\t\t\tprops: {\n\t\t\t\t\thandlePaste(_view, event) {\n\t\t\t\t\t\tif (event.clipboardData?.files?.length) return false; // let ImagePaste handle\n\t\t\t\t\t\tconst html = event.clipboardData?.getData('text/html');\n\t\t\t\t\t\tconst text = event.clipboardData?.getData('text/plain');\n\t\t\t\t\t\tif (!text || !html) return false;\n\n\t\t\t\t\t\tconst schema = _view.state.schema;\n\t\t\t\t\t\t// Split on each newline so that multi-paragraph pastes produce\n\t\t\t\t\t\t// separate paragraph nodes — matching the behaviour of pressing\n\t\t\t\t\t\t// Enter between lines. Using schema.text() collapses all newlines\n\t\t\t\t\t\t// because ProseMirror text nodes cannot contain '\\n'.\n\t\t\t\t\t\tconst paragraphs = text\n\t\t\t\t\t\t\t.split('\\n')\n\t\t\t\t\t\t\t.map((line) =>\n\t\t\t\t\t\t\t\tschema.node('paragraph', null, line ? [schema.text(line)] : []),\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\tconst slice = new Slice(Fragment.fromArray(paragraphs), 1, 1);\n\t\t\t\t\t\t_view.dispatch(_view.state.tr.replaceSelection(slice));\n\t\t\t\t\t\treturn true;\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t}),\n\t\t];\n\t},\n});\n"],"names":["PlainClipboardExtension","Extension","create","name","addProseMirrorPlugins","Plugin","props","handlePaste","_view","event","_b","clipboardData","_a","files","length","html","_c","getData","text","_d","schema","state","paragraphs","split","map","line","node","slice","Slice","Fragment","fromArray","dispatch","tr","replaceSelection"],"mappings":"wMAIaA,EAA0BC,EAASA,UAACC,OAAO,CACvDC,KAAM,iBACNC,sBAAqBA,IACb,CACN,IAAIC,EAAAA,OAAO,CACVC,MAAO,CACNC,YAAYC,EAAOC,eAClB,WAAIC,EAAqB,UAArBD,EAAME,qBAAe,IAAAC,OAAA,EAAAA,EAAAC,4BAAOC,OAAQ,OAAO,EAC/C,MAAMC,EAA0B,QAAnBC,EAAAP,EAAME,qBAAa,IAAAK,OAAA,EAAAA,EAAEC,QAAQ,aACpCC,EAA0B,QAAnBC,EAAAV,EAAME,qBAAa,IAAAQ,OAAA,EAAAA,EAAEF,QAAQ,cAC1C,IAAKC,IAASH,EAAM,OAAO,EAE3B,MAAMK,EAASZ,EAAMa,MAAMD,OAKrBE,EAAaJ,EACjBK,MAAM,MACNC,KAAKC,GACLL,EAAOM,KAAK,YAAa,KAAMD,EAAO,CAACL,EAAOF,KAAKO,IAAS,MAExDE,EAAQ,IAAIC,EAAAA,MAAMC,EAAQA,SAACC,UAAUR,GAAa,EAAG,GAE3D,OADAd,EAAMuB,SAASvB,EAAMa,MAAMW,GAAGC,iBAAiBN,KACxC,CACR"}
|
|
@@ -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:
|
|
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;
|
|
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\tuseEffect,\n\tuseImperativeHandle,\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\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((
|
|
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"}
|
|
@@ -3,6 +3,7 @@ export declare const DropdownItem: import("styled-components").StyledComponent<"
|
|
|
3
3
|
$isActive?: boolean | undefined;
|
|
4
4
|
}, never>;
|
|
5
5
|
export declare const MentionAvatar: import("styled-components").StyledComponent<"img", any, {}, never>;
|
|
6
|
+
export declare const MentionAvatarFallback: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
6
7
|
export declare const MentionLabel: import("styled-components").StyledComponent<"span", any, {}, never>;
|
|
7
8
|
export declare const MentionPresenceDot: import("styled-components").StyledComponent<"span", any, {
|
|
8
9
|
$online?: boolean | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BikEditor.styles.js","sources":["../../../src/editor/BikEditor.styles.ts"],"sourcesContent":["import styled from 'styled-components';\nimport { COLORS } from '../constants/Theme';\n\nexport const BikEditorShell = styled.div<{\n\tminHeight?: string;\n\tmaxHeight?: string;\n}>`\n\tposition: relative;\n\twidth: 100%;\n\n\t.ProseMirror {\n\t\tmin-height: ${({ minHeight }) => minHeight ?? '80px'};\n\t\tmax-height: ${({ maxHeight }) => maxHeight ?? 'none'};\n\t\toverflow-y: auto;\n\t\toutline: none;\n\t\tpadding: 8px 12px;\n\t\tfont-size: 14px;\n\t\tline-height: 1.5;\n\t\tword-break: break-word;\n\n\t\tp {\n\t\t\tmargin: 0;\n\t\t\tpadding: 0;\n\t\t}\n\n\t\tul,\n\t\tol {\n\t\t\tmargin: 0;\n\t\t\tpadding-left: 1.5em;\n\t\t}\n\n\t\tli + li {\n\t\t\tmargin-top: 2px;\n\t\t}\n\n\t\tp.is-editor-empty:first-child::before {\n\t\t\tcontent: attr(data-placeholder);\n\t\t\tfloat: left;\n\t\t\tcolor: #adb5bd;\n\t\t\tpointer-events: none;\n\t\t\theight: 0;\n\t\t}\n\t}\n\n\t.bik-mention {\n\t\tcolor: ${COLORS.content.brand};\n\t\tpadding: 1px 4px;\n\t}\n\t.bik-mention--team {\n\t\tcolor: ${COLORS.content.brand};\n\t}\n\t.bik-variable {\n\t
|
|
1
|
+
{"version":3,"file":"BikEditor.styles.js","sources":["../../../src/editor/BikEditor.styles.ts"],"sourcesContent":["import styled from 'styled-components';\nimport { COLORS } from '../constants/Theme';\n\nexport const BikEditorShell = styled.div<{\n\tminHeight?: string;\n\tmaxHeight?: string;\n}>`\n\tposition: relative;\n\twidth: 100%;\n\n\t.ProseMirror {\n\t\tmin-height: ${({ minHeight }) => minHeight ?? '80px'};\n\t\tmax-height: ${({ maxHeight }) => maxHeight ?? 'none'};\n\t\toverflow-y: auto;\n\t\toutline: none;\n\t\tpadding: 8px 12px;\n\t\tfont-size: 14px;\n\t\tline-height: 1.5;\n\t\tword-break: break-word;\n\n\t\tp {\n\t\t\tmargin: 0;\n\t\t\tpadding: 0;\n\t\t}\n\n\t\tul,\n\t\tol {\n\t\t\tmargin: 0;\n\t\t\tpadding-left: 1.5em;\n\t\t}\n\n\t\tli + li {\n\t\t\tmargin-top: 2px;\n\t\t}\n\n\t\tp.is-editor-empty:first-child::before {\n\t\t\tcontent: attr(data-placeholder);\n\t\t\tfloat: left;\n\t\t\tcolor: #adb5bd;\n\t\t\tpointer-events: none;\n\t\t\theight: 0;\n\t\t}\n\t}\n\n\t.bik-mention {\n\t\tcolor: ${COLORS.content.brand};\n\t\tpadding: 1px 4px;\n\t}\n\t.bik-mention--team {\n\t\tcolor: ${COLORS.content.brand};\n\t}\n\t.bik-variable {\n\t}\n\n\ta,\n\t.bik-link {\n\t\tcolor: #4f46e5;\n\t\ttext-decoration: underline;\n\t\ttext-decoration-color: #a5b4fc;\n\t\ttext-underline-offset: 2px;\n\t\tcursor: pointer;\n\t\t&:hover {\n\t\t\tcolor: #3730a3;\n\t\t\ttext-decoration-color: #6366f1;\n\t\t}\n\t}\n`;\n"],"names":["BikEditorShell","styled","div","_ref","minHeight","_ref2","maxHeight","COLORS","content","brand"],"mappings":"gFAGaA,MAAAA,EAAiBC,EAAOC,GAGnC;;;;;gBAKcC,IAAA,IAACC,UAAEA,GAAWD,EAAA,OAAKC,QAAAA,EAAa,MAAM;gBACtCC,IAAA,IAACC,UAAEA,GAAWD,EAAA,OAAKC,QAAAA,EAAa,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;WAiC3CC,EAAOC,QAAQC;;;;WAIfF,EAAOC,QAAQC;;;;;;;;;;;;;;;;;"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import r from"styled-components";import{COLORS as
|
|
2
|
-
background: ${
|
|
3
|
-
border: 1px solid ${
|
|
1
|
+
import r from"styled-components";import{COLORS as e}from"../../constants/Theme.js";const t=r.div`
|
|
2
|
+
background: ${e.surface.standard};
|
|
3
|
+
border: 1px solid ${e.stroke.primary};
|
|
4
4
|
border-radius: 8px;
|
|
5
5
|
box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
|
|
6
6
|
padding: 4px;
|
|
@@ -8,8 +8,8 @@ import r from"styled-components";import{COLORS as o}from"../../constants/Theme.j
|
|
|
8
8
|
max-height: 260px;
|
|
9
9
|
overflow-y: auto;
|
|
10
10
|
font-size: 14px;
|
|
11
|
-
color: ${
|
|
12
|
-
`,
|
|
11
|
+
color: ${e.content.primary};
|
|
12
|
+
`,o=r.div`
|
|
13
13
|
display: flex;
|
|
14
14
|
align-items: center;
|
|
15
15
|
gap: 8px;
|
|
@@ -17,30 +17,42 @@ import r from"styled-components";import{COLORS as o}from"../../constants/Theme.j
|
|
|
17
17
|
min-height: 43px;
|
|
18
18
|
border-radius: 6px;
|
|
19
19
|
cursor: pointer;
|
|
20
|
-
color: ${
|
|
21
|
-
background: ${r=>{let{$isActive:t}=r;return t?
|
|
20
|
+
color: ${e.content.primary};
|
|
21
|
+
background: ${r=>{let{$isActive:t}=r;return t?e.surface.hovered:"transparent"}};
|
|
22
22
|
`,n=r.img`
|
|
23
23
|
width: 24px;
|
|
24
24
|
height: 24px;
|
|
25
25
|
border-radius: 50%;
|
|
26
26
|
object-fit: cover;
|
|
27
27
|
flex-shrink: 0;
|
|
28
|
-
`,i=r.
|
|
28
|
+
`,i=r.div`
|
|
29
|
+
width: 24px;
|
|
30
|
+
height: 24px;
|
|
31
|
+
border-radius: 50%;
|
|
32
|
+
background: ${e.surface.hovered};
|
|
33
|
+
display: flex;
|
|
34
|
+
align-items: center;
|
|
35
|
+
justify-content: center;
|
|
36
|
+
font-size: 12px;
|
|
37
|
+
font-weight: 600;
|
|
38
|
+
color: ${e.content.primary};
|
|
39
|
+
flex-shrink: 0;
|
|
40
|
+
`,a=r.span`
|
|
29
41
|
font-weight: 500;
|
|
30
|
-
color: ${
|
|
42
|
+
color: ${e.content.primary};
|
|
31
43
|
`,p=r.span`
|
|
32
44
|
width: 8px;
|
|
33
45
|
height: 8px;
|
|
34
46
|
border-radius: 50%;
|
|
35
|
-
background: ${r=>{let{$online:t}=r;return t?
|
|
47
|
+
background: ${r=>{let{$online:t}=r;return t?e.content.positive:e.content.placeholder}};
|
|
36
48
|
margin-left: auto;
|
|
37
49
|
flex-shrink: 0;
|
|
38
|
-
`,a=r.span`
|
|
39
|
-
font-weight: 500;
|
|
40
|
-
color: ${o.content.primary};
|
|
41
50
|
`,s=r.span`
|
|
51
|
+
font-weight: 500;
|
|
52
|
+
color: ${e.content.primary};
|
|
53
|
+
`,d=r.span`
|
|
42
54
|
font-size: 12px;
|
|
43
|
-
color: ${
|
|
55
|
+
color: ${e.content.secondary};
|
|
44
56
|
margin-left: auto;
|
|
45
|
-
`;export{t as DropdownContainer,
|
|
57
|
+
`;export{t as DropdownContainer,o as DropdownItem,n as MentionAvatar,i as MentionAvatarFallback,a as MentionLabel,p as MentionPresenceDot,d as SlashDescription,s as SlashLabel};
|
|
46
58
|
//# sourceMappingURL=editorDropdown.styles.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"editorDropdown.styles.js","sources":["../../../../src/editor/extensions/editorDropdown.styles.ts"],"sourcesContent":["import styled from 'styled-components';\nimport { COLORS } from '@src/constants/Theme';\n\nexport const DropdownContainer = styled.div`\n\tbackground: ${COLORS.surface.standard};\n\tborder: 1px solid ${COLORS.stroke.primary};\n\tborder-radius: 8px;\n\tbox-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);\n\tpadding: 4px;\n\tmin-width: 330px;\n\tmax-height: 260px;\n\toverflow-y: auto;\n\tfont-size: 14px;\n\tcolor: ${COLORS.content.primary};\n`;\n\nexport const DropdownItem = styled.div<{ $isActive?: boolean }>`\n\tdisplay: flex;\n\talign-items: center;\n\tgap: 8px;\n\tpadding: 12px 16px;\n\tmin-height: 43px;\n\tborder-radius: 6px;\n\tcursor: pointer;\n\tcolor: ${COLORS.content.primary};\n\tbackground: ${({ $isActive }) =>\n\t\t$isActive ? COLORS.surface.hovered : 'transparent'};\n`;\n\nexport const MentionAvatar = styled.img`\n\twidth: 24px;\n\theight: 24px;\n\tborder-radius: 50%;\n\tobject-fit: cover;\n\tflex-shrink: 0;\n`;\n\nexport const MentionLabel = styled.span`\n\tfont-weight: 500;\n\tcolor: ${COLORS.content.primary};\n`;\n\nexport const MentionPresenceDot = styled.span<{ $online?: boolean }>`\n\twidth: 8px;\n\theight: 8px;\n\tborder-radius: 50%;\n\tbackground: ${({ $online }) =>\n\t\t$online ? COLORS.content.positive : COLORS.content.placeholder};\n\tmargin-left: auto;\n\tflex-shrink: 0;\n`;\n\nexport const SlashLabel = styled.span`\n\tfont-weight: 500;\n\tcolor: ${COLORS.content.primary};\n`;\n\nexport const SlashDescription = styled.span`\n\tfont-size: 12px;\n\tcolor: ${COLORS.content.secondary};\n\tmargin-left: auto;\n`;\n"],"names":["DropdownContainer","styled","div","COLORS","surface","standard","stroke","primary","content","DropdownItem","_ref","$isActive","hovered","MentionAvatar","img","MentionLabel","span","MentionPresenceDot","_ref2","$online","positive","placeholder","SlashLabel","SlashDescription","secondary"],"mappings":"mFAGaA,MAAAA,EAAoBC,EAAOC,GAAG;eAC5BC,EAAOC,QAAQC;qBACTF,EAAOG,OAAOC;;;;;;;;UAQzBJ,EAAOK,QAAQD;EAGZE,EAAeR,EAAOC,GAA4B;;;;;;;;UAQrDC,EAAOK,QAAQD;eACVG,IAAA,IAACC,UAAEA,GAAWD,EAAA,OAC3BC,EAAYR,EAAOC,QAAQQ,QAAU,aAAa;EAGvCC,EAAgBZ,EAAOa,GAAG;;;;;;EAQ1BC,
|
|
1
|
+
{"version":3,"file":"editorDropdown.styles.js","sources":["../../../../src/editor/extensions/editorDropdown.styles.ts"],"sourcesContent":["import styled from 'styled-components';\nimport { COLORS } from '@src/constants/Theme';\n\nexport const DropdownContainer = styled.div`\n\tbackground: ${COLORS.surface.standard};\n\tborder: 1px solid ${COLORS.stroke.primary};\n\tborder-radius: 8px;\n\tbox-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);\n\tpadding: 4px;\n\tmin-width: 330px;\n\tmax-height: 260px;\n\toverflow-y: auto;\n\tfont-size: 14px;\n\tcolor: ${COLORS.content.primary};\n`;\n\nexport const DropdownItem = styled.div<{ $isActive?: boolean }>`\n\tdisplay: flex;\n\talign-items: center;\n\tgap: 8px;\n\tpadding: 12px 16px;\n\tmin-height: 43px;\n\tborder-radius: 6px;\n\tcursor: pointer;\n\tcolor: ${COLORS.content.primary};\n\tbackground: ${({ $isActive }) =>\n\t\t$isActive ? COLORS.surface.hovered : 'transparent'};\n`;\n\nexport const MentionAvatar = styled.img`\n\twidth: 24px;\n\theight: 24px;\n\tborder-radius: 50%;\n\tobject-fit: cover;\n\tflex-shrink: 0;\n`;\n\nexport const MentionAvatarFallback = styled.div`\n\twidth: 24px;\n\theight: 24px;\n\tborder-radius: 50%;\n\tbackground: ${COLORS.surface.hovered};\n\tdisplay: flex;\n\talign-items: center;\n\tjustify-content: center;\n\tfont-size: 12px;\n\tfont-weight: 600;\n\tcolor: ${COLORS.content.primary};\n\tflex-shrink: 0;\n`;\n\nexport const MentionLabel = styled.span`\n\tfont-weight: 500;\n\tcolor: ${COLORS.content.primary};\n`;\n\nexport const MentionPresenceDot = styled.span<{ $online?: boolean }>`\n\twidth: 8px;\n\theight: 8px;\n\tborder-radius: 50%;\n\tbackground: ${({ $online }) =>\n\t\t$online ? COLORS.content.positive : COLORS.content.placeholder};\n\tmargin-left: auto;\n\tflex-shrink: 0;\n`;\n\nexport const SlashLabel = styled.span`\n\tfont-weight: 500;\n\tcolor: ${COLORS.content.primary};\n`;\n\nexport const SlashDescription = styled.span`\n\tfont-size: 12px;\n\tcolor: ${COLORS.content.secondary};\n\tmargin-left: auto;\n`;\n"],"names":["DropdownContainer","styled","div","COLORS","surface","standard","stroke","primary","content","DropdownItem","_ref","$isActive","hovered","MentionAvatar","img","MentionAvatarFallback","MentionLabel","span","MentionPresenceDot","_ref2","$online","positive","placeholder","SlashLabel","SlashDescription","secondary"],"mappings":"mFAGaA,MAAAA,EAAoBC,EAAOC,GAAG;eAC5BC,EAAOC,QAAQC;qBACTF,EAAOG,OAAOC;;;;;;;;UAQzBJ,EAAOK,QAAQD;EAGZE,EAAeR,EAAOC,GAA4B;;;;;;;;UAQrDC,EAAOK,QAAQD;eACVG,IAAA,IAACC,UAAEA,GAAWD,EAAA,OAC3BC,EAAYR,EAAOC,QAAQQ,QAAU,aAAa;EAGvCC,EAAgBZ,EAAOa,GAAG;;;;;;EAQ1BC,EAAwBd,EAAOC,GAAG;;;;eAIhCC,EAAOC,QAAQQ;;;;;;UAMpBT,EAAOK,QAAQD;;EAIZS,EAAef,EAAOgB,IAAI;;UAE7Bd,EAAOK,QAAQD;EAGZW,EAAqBjB,EAAOgB,IAA2B;;;;eAIrDE,IAAA,IAACC,QAAEA,GAASD,EAAA,OACzBC,EAAUjB,EAAOK,QAAQa,SAAWlB,EAAOK,QAAQc,WAAW;;;EAKnDC,EAAatB,EAAOgB,IAAI;;UAE3Bd,EAAOK,QAAQD;EAGZiB,EAAmBvB,EAAOgB,IAAI;;UAEjCd,EAAOK,QAAQiB;;"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{jsx as e,Fragment as n,jsxs as r}from"react/jsx-runtime";import{forwardRef as t,useState as o,useRef as l,useCallback as i,useImperativeHandle as c,useEffect as s}from"react";import{DropdownContainer as a,DropdownItem as d,MentionAvatar as m,
|
|
1
|
+
import{jsx as e,Fragment as n,jsxs as r}from"react/jsx-runtime";import{forwardRef as t,useState as o,useRef as l,useCallback as i,useImperativeHandle as c,useEffect as s}from"react";import{DropdownContainer as a,DropdownItem as d,MentionAvatar as m,MentionAvatarFallback as u,MentionLabel as h,MentionPresenceDot as p}from"../editorDropdown.styles.js";const w=t(((t,w)=>{let{items:y,query:g,command:v,renderItem:b,renderDropdown:f}=t;const[k,D]=o(0),j=l(null),A=i((e=>{const n=j.current;if(!n)return;const r=n.children[e];null==r||r.scrollIntoView({block:"nearest"})}),[]),O=e=>{y[e]&&v(y[e])};return c(w,(()=>({onKeyDown:e=>{let{event:n}=e;return"ArrowUp"===n.key?(D((e=>{const n=(e+y.length-1)%y.length;return A(n),n})),!0):"ArrowDown"===n.key?(D((e=>{const n=(e+1)%y.length;return A(n),n})),!0):"Enter"===n.key&&(O(k),!0)}}))),s((()=>D(0)),[y]),y.length?f?e(n,{children:f({items:y,query:g,activeIndex:k,onSelect:e=>v(e)})}):e(a,Object.assign({ref:j},{children:y.map(((t,o)=>e(d,Object.assign({$isActive:o===k,onMouseEnter:()=>D(o),onClick:()=>O(o)},{children:b?b(t,o===k):r(n,{children:[t.avatarUrl?e(m,{src:t.avatarUrl,alt:""}):e(u,{children:t.label.charAt(0).toUpperCase()}),e(h,{children:t.label}),void 0!==t.isOnline&&e(p,{$online:t.isOnline})]})}),t.id)))})):null}));w.displayName="MentionDropdown";export{w as MentionDropdown};
|
|
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\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
|
|
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","avatarUrl","MentionAvatar","src","alt","MentionAvatarFallback","label","charAt","toUpperCase","MentionLabel","undefined","isOnline","MentionPresenceDot","$online","id","displayName"],"mappings":"gWAkCO,MAAMA,EAAkBC,GAC9B,CAAAC,EAAwDC,KAAO,IAA9DC,MAAEA,EAAKC,MAAEA,EAAKC,QAAEA,EAAOC,WAAEA,EAAUC,eAAEA,GAAgBN,EACrD,MAAOO,EAAeC,GAAoBC,EAAS,GAC7CC,EAAeC,EAAuB,MAEtCC,EAAgBC,GAAaC,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,EAAoBtB,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,GAAU,IAAMvB,EAAiB,IAAI,CAACN,IAEjCA,EAAM4B,OAGPxB,EAEF0B,EACEC,EAAA,CAAAf,SAAAZ,EAAe,CACfJ,QACAC,QACA+B,YAAa3B,EACb4B,SAAWlB,GAASb,EAAQa,OAO/Be,EAACI,EAAiBC,OAAAC,OAAA,CAACrC,IAAKS,GACtB,CAAAQ,SAAAhB,EAAMqC,KAAI,CAACtB,EAAMK,IACjBU,EAACQ,2BAEWlB,IAAMf,EACjBkC,aAAcA,IAAMjC,EAAiBc,GACrCoB,QAASA,IAAMrB,EAAOC,IAAE,CAAAJ,SAEvBb,EACAA,EAAWY,EAAMK,IAAMf,GAEvBoC,EAAAV,EAAA,CAAAf,SAAA,CACED,EAAK2B,UACLZ,EAACa,EAAc,CAAAC,IAAK7B,EAAK2B,UAAWG,IAAI,KAExCf,EAACgB,EACC,CAAA9B,SAAAD,EAAKgC,MAAMC,OAAO,GAAGC,gBAGxBnB,EAACoB,EAAY,CAAAlC,SAAED,EAAKgC,aACDI,IAAlBpC,EAAKqC,UACLtB,EAACuB,EAA4B,CAAAC,QAAAvC,EAAKqC,gBAlBhCrC,EAAKwC,SApBY,IA4CL,IAIvB3D,EAAgB4D,YAAc"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{Extension as t}from"../../../node_modules/@tiptap/core/dist/index.js";import{Slice as a,Fragment as e}from"@tiptap/pm/model";import{Plugin as o}from"@tiptap/pm/state";const r=t.create({name:"plainClipboard",addProseMirrorPlugins:()=>[new o({props:{handlePaste(t,o){var r,i,l,p;if(null===(i=null===(r=o.clipboardData)||void 0===r?void 0:r.files)||void 0===i?void 0:i.length)return!1;const n=null===(l=o.clipboardData)||void 0===l?void 0:l.getData("text/html"),d=null===(p=o.clipboardData)||void 0===p?void 0:p.getData("text/plain");if(!d||!n)return!1;const s=t.state.schema,m=d.split("\n").map((t=>s.node("paragraph",null,t?[s.text(t)]:[]))),c=new a(e.fromArray(m),
|
|
1
|
+
import{Extension as t}from"../../../node_modules/@tiptap/core/dist/index.js";import{Slice as a,Fragment as e}from"@tiptap/pm/model";import{Plugin as o}from"@tiptap/pm/state";const r=t.create({name:"plainClipboard",addProseMirrorPlugins:()=>[new o({props:{handlePaste(t,o){var r,i,l,p;if(null===(i=null===(r=o.clipboardData)||void 0===r?void 0:r.files)||void 0===i?void 0:i.length)return!1;const n=null===(l=o.clipboardData)||void 0===l?void 0:l.getData("text/html"),d=null===(p=o.clipboardData)||void 0===p?void 0:p.getData("text/plain");if(!d||!n)return!1;const s=t.state.schema,m=d.split("\n").map((t=>s.node("paragraph",null,t?[s.text(t)]:[]))),c=new a(e.fromArray(m),1,1);return t.dispatch(t.state.tr.replaceSelection(c)),!0}}})]});export{r as PlainClipboardExtension};
|
|
2
2
|
//# sourceMappingURL=PlainClipboardExtension.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PlainClipboardExtension.js","sources":["../../../../../src/editor/extensions/plainClipboard/PlainClipboardExtension.ts"],"sourcesContent":["import { Extension } from '@tiptap/core';\nimport { Fragment, Slice } from '@tiptap/pm/model';\nimport { Plugin } from '@tiptap/pm/state';\n\nexport const PlainClipboardExtension = Extension.create({\n\tname: 'plainClipboard',\n\taddProseMirrorPlugins() {\n\t\treturn [\n\t\t\tnew Plugin({\n\t\t\t\tprops: {\n\t\t\t\t\thandlePaste(_view, event) {\n\t\t\t\t\t\tif (event.clipboardData?.files?.length) return false; // let ImagePaste handle\n\t\t\t\t\t\tconst html = event.clipboardData?.getData('text/html');\n\t\t\t\t\t\tconst text = event.clipboardData?.getData('text/plain');\n\t\t\t\t\t\tif (!text || !html) return false;\n\n\t\t\t\t\t\tconst schema = _view.state.schema;\n\t\t\t\t\t\t// Split on each newline so that multi-paragraph pastes produce\n\t\t\t\t\t\t// separate paragraph nodes — matching the behaviour of pressing\n\t\t\t\t\t\t// Enter between lines. Using schema.text() collapses all newlines\n\t\t\t\t\t\t// because ProseMirror text nodes cannot contain '\\n'.\n\t\t\t\t\t\tconst paragraphs = text\n\t\t\t\t\t\t\t.split('\\n')\n\t\t\t\t\t\t\t.map((line) =>\n\t\t\t\t\t\t\t\tschema.node('paragraph', null, line ? [schema.text(line)] : []),\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\tconst slice = new Slice(Fragment.fromArray(paragraphs),
|
|
1
|
+
{"version":3,"file":"PlainClipboardExtension.js","sources":["../../../../../src/editor/extensions/plainClipboard/PlainClipboardExtension.ts"],"sourcesContent":["import { Extension } from '@tiptap/core';\nimport { Fragment, Slice } from '@tiptap/pm/model';\nimport { Plugin } from '@tiptap/pm/state';\n\nexport const PlainClipboardExtension = Extension.create({\n\tname: 'plainClipboard',\n\taddProseMirrorPlugins() {\n\t\treturn [\n\t\t\tnew Plugin({\n\t\t\t\tprops: {\n\t\t\t\t\thandlePaste(_view, event) {\n\t\t\t\t\t\tif (event.clipboardData?.files?.length) return false; // let ImagePaste handle\n\t\t\t\t\t\tconst html = event.clipboardData?.getData('text/html');\n\t\t\t\t\t\tconst text = event.clipboardData?.getData('text/plain');\n\t\t\t\t\t\tif (!text || !html) return false;\n\n\t\t\t\t\t\tconst schema = _view.state.schema;\n\t\t\t\t\t\t// Split on each newline so that multi-paragraph pastes produce\n\t\t\t\t\t\t// separate paragraph nodes — matching the behaviour of pressing\n\t\t\t\t\t\t// Enter between lines. Using schema.text() collapses all newlines\n\t\t\t\t\t\t// because ProseMirror text nodes cannot contain '\\n'.\n\t\t\t\t\t\tconst paragraphs = text\n\t\t\t\t\t\t\t.split('\\n')\n\t\t\t\t\t\t\t.map((line) =>\n\t\t\t\t\t\t\t\tschema.node('paragraph', null, line ? [schema.text(line)] : []),\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\tconst slice = new Slice(Fragment.fromArray(paragraphs), 1, 1);\n\t\t\t\t\t\t_view.dispatch(_view.state.tr.replaceSelection(slice));\n\t\t\t\t\t\treturn true;\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t}),\n\t\t];\n\t},\n});\n"],"names":["PlainClipboardExtension","Extension","create","name","addProseMirrorPlugins","Plugin","props","handlePaste","_view","event","_b","clipboardData","_a","files","length","html","_c","getData","text","_d","schema","state","paragraphs","split","map","line","node","slice","Slice","Fragment","fromArray","dispatch","tr","replaceSelection"],"mappings":"oLAIaA,EAA0BC,EAAUC,OAAO,CACvDC,KAAM,iBACNC,sBAAqBA,IACb,CACN,IAAIC,EAAO,CACVC,MAAO,CACNC,YAAYC,EAAOC,eAClB,WAAIC,EAAqB,UAArBD,EAAME,qBAAe,IAAAC,OAAA,EAAAA,EAAAC,4BAAOC,OAAQ,OAAO,EAC/C,MAAMC,EAA0B,QAAnBC,EAAAP,EAAME,qBAAa,IAAAK,OAAA,EAAAA,EAAEC,QAAQ,aACpCC,EAA0B,QAAnBC,EAAAV,EAAME,qBAAa,IAAAQ,OAAA,EAAAA,EAAEF,QAAQ,cAC1C,IAAKC,IAASH,EAAM,OAAO,EAE3B,MAAMK,EAASZ,EAAMa,MAAMD,OAKrBE,EAAaJ,EACjBK,MAAM,MACNC,KAAKC,GACLL,EAAOM,KAAK,YAAa,KAAMD,EAAO,CAACL,EAAOF,KAAKO,IAAS,MAExDE,EAAQ,IAAIC,EAAMC,EAASC,UAAUR,GAAa,EAAG,GAE3D,OADAd,EAAMuB,SAASvB,EAAMa,MAAMW,GAAGC,iBAAiBN,KACxC,CACR"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{jsx as e,Fragment as
|
|
1
|
+
import{jsx as e,Fragment as n,jsxs as r}from"react/jsx-runtime";import{forwardRef as t,useState as o,useRef as l,useCallback as i,useImperativeHandle as c,useEffect as s}from"react";import{DropdownContainer as d,DropdownItem as m,SlashLabel as u,SlashDescription as a}from"../editorDropdown.styles.js";const h=t(((t,h)=>{let{items:p,query:y,command:w,renderItem:g,renderDropdown:f}=t;const[k,b]=o(0),j=l(null),D=i((e=>{const n=j.current;if(!n)return;const r=n.children[e];null==r||r.scrollIntoView({block:"nearest"})}),[]),v=e=>{p[e]&&w(p[e])};return c(h,(()=>({onKeyDown:e=>{let{event:n}=e;return"ArrowUp"===n.key?(b((e=>{const n=(e+p.length-1)%p.length;return D(n),n})),!0):"ArrowDown"===n.key?(b((e=>{const n=(e+1)%p.length;return D(n),n})),!0):"Enter"===n.key&&(v(k),!0)}}))),s((()=>b(0)),[p]),p.length?f?e(n,{children:f({items:p,query:y,activeIndex:k,onSelect:e=>w(e)})}):e(d,Object.assign({ref:j},{children:p.map(((t,o)=>e(m,Object.assign({$isActive:o===k,onMouseEnter:()=>b(o),onClick:()=>v(o)},{children:g?g(t,o===k):r(n,{children:[e(u,{children:t.label}),t.description&&e(a,{children:t.description})]})}),t.id)))})):null}));h.displayName="SlashCommandMenu";export{h as SlashCommandMenu};
|
|
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\tuseEffect,\n\tuseImperativeHandle,\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\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((
|
|
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","SlashLabel","label","description","SlashDescription","id","displayName"],"mappings":"8SAgCO,MAAMA,EAAmBC,GAC/B,CAAAC,EAAwDC,KAAO,IAA9DC,MAAEA,EAAKC,MAAEA,EAAKC,QAAEA,EAAOC,WAAEA,EAAUC,eAAEA,GAAgBN,EACrD,MAAOO,EAAeC,GAAoBC,EAAS,GAC7CC,EAAeC,EAAuB,MAEtCC,EAAgBC,GAAaC,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,EAAoBtB,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,GAAU,IAAMvB,EAAiB,IAAI,CAACN,IAEjCA,EAAM4B,OAGPxB,EAEF0B,EACEC,EAAA,CAAAf,SAAAZ,EAAe,CACfJ,QACAC,QACA+B,YAAa3B,EACb4B,SAAWlB,GAASb,EAAQa,OAO/Be,EAACI,EAAiBC,OAAAC,OAAA,CAACrC,IAAKS,aACtBR,EAAMqC,KAAI,CAACtB,EAAMK,IACjBU,EAACQ,EAAYH,OAAAC,OAAA,CAAAG,UAEDnB,IAAMf,EACjBmC,aAAcA,IAAMlC,EAAiBc,GACrCqB,QAASA,IAAMtB,EAAOC,IAAE,CAAAJ,SAEvBb,EACAA,EAAWY,EAAMK,IAAMf,GAEvBqC,EACCX,EAAA,CAAAf,SAAA,CAAAc,EAACa,EAAY,CAAA3B,SAAAD,EAAK6B,QACjB7B,EAAK8B,aACLf,EAACgB,EAAkB,CAAA9B,SAAAD,EAAK8B,mBAXtB9B,EAAKgC,SApBY,IAqCL,IAIvBnD,EAAiBoD,YAAc"}
|
|
@@ -3,6 +3,7 @@ export declare const DropdownItem: import("styled-components").StyledComponent<"
|
|
|
3
3
|
$isActive?: boolean | undefined;
|
|
4
4
|
}, never>;
|
|
5
5
|
export declare const MentionAvatar: import("styled-components").StyledComponent<"img", any, {}, never>;
|
|
6
|
+
export declare const MentionAvatarFallback: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
6
7
|
export declare const MentionLabel: import("styled-components").StyledComponent<"span", any, {}, never>;
|
|
7
8
|
export declare const MentionPresenceDot: import("styled-components").StyledComponent<"span", any, {
|
|
8
9
|
$online?: boolean | undefined;
|