@cometchat/chat-uikit-react 6.3.12 → 6.4.0
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/assets/bin.svg +1 -0
- package/dist/assets/format_blockquote.svg +3 -0
- package/dist/assets/format_bold.svg +5 -0
- package/dist/assets/format_code.svg +3 -0
- package/dist/assets/format_code_block.svg +5 -0
- package/dist/assets/format_italic.svg +3 -0
- package/dist/assets/format_link.svg +3 -0
- package/dist/assets/format_ordered_list.svg +5 -0
- package/dist/assets/format_strikethrough.svg +5 -0
- package/dist/assets/format_toggle.svg +1 -0
- package/dist/assets/format_underline.svg +5 -0
- package/dist/assets/format_unordered_list.svg +5 -0
- package/dist/assets/pause_circle.svg +1 -0
- package/dist/assets/warning-small.svg +0 -0
- package/dist/index.d.ts +366 -47
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/styles/CometChatCompactMessageComposer.css +1111 -0
- package/dist/styles/CometChatConversations.css +37 -1
- package/dist/styles/CometChatDocumentBubble.css +0 -1
- package/dist/styles/CometChatFormattingToolbar.css +257 -0
- package/dist/styles/CometChatFullScreenViewer.css +2 -2
- package/dist/styles/CometChatLinkDialog.css +191 -0
- package/dist/styles/CometChatLinkPopover.css +128 -0
- package/dist/styles/CometChatMarkdownFormatter.css +141 -0
- package/dist/styles/CometChatMediaRecorder.css +73 -1
- package/dist/styles/CometChatMessageComposer.css +210 -3
- package/dist/styles/CometChatMessagePreview.css +10 -0
- package/dist/styles/CometChatSearch.css +11 -0
- package/dist/styles/CometChatTextBubble.css +267 -3
- package/dist/styles/LinkPreview.css +1 -1
- package/dist/styles/components/CometChatCompactMessageComposer.css +1111 -0
- package/dist/styles/components/CometChatConversations.css +37 -1
- package/dist/styles/components/CometChatDocumentBubble.css +0 -1
- package/dist/styles/components/CometChatFormattingToolbar.css +257 -0
- package/dist/styles/components/CometChatFullScreenViewer.css +2 -2
- package/dist/styles/components/CometChatLinkDialog.css +191 -0
- package/dist/styles/components/CometChatLinkPopover.css +128 -0
- package/dist/styles/components/CometChatMarkdownFormatter.css +141 -0
- package/dist/styles/components/CometChatMediaRecorder.css +73 -1
- package/dist/styles/components/CometChatMessageComposer.css +210 -3
- package/dist/styles/components/CometChatMessagePreview.css +10 -0
- package/dist/styles/components/CometChatSearch.css +11 -0
- package/dist/styles/components/CometChatTextBubble.css +267 -3
- package/dist/styles/components/LinkPreview.css +1 -1
- package/dist/styles/components/index.css +6 -5
- package/dist/styles/css-variables.css +1 -0
- package/dist/styles/index.css +6 -5
- package/dist/types/CometChatUIKit/CometChatUIKitUtility.d.ts +13 -0
- package/dist/types/CometChatUIKit/UIKitSettings.d.ts +0 -21
- package/dist/types/components/BaseComponents/CometChatImageBubble/useCometChatImageBubble.d.ts +0 -1
- package/dist/types/components/BaseComponents/CometChatModerationView/CometChatModerationView.d.ts +3 -1
- package/dist/types/components/CometChatCompactMessageComposer/CometChatCompactMessageComposer.d.ts +247 -0
- package/dist/types/components/CometChatFormattingToolbar/CometChatFormattingToolbar.d.ts +29 -0
- package/dist/types/components/CometChatLinkDialog/CometChatLinkDialog.d.ts +22 -0
- package/dist/types/components/CometChatLinkPopover/CometChatLinkPopover.d.ts +24 -0
- package/dist/types/components/CometChatLinkPopover/index.d.ts +1 -0
- package/dist/types/components/useRichTextComposer/useRichTextComposer.d.ts +138 -0
- package/dist/types/formatters/CometChatFormatters/CometChatMarkdownFormatter/CometChatMarkdownFormatter.d.ts +109 -0
- package/dist/types/formatters/CometChatFormatters/CometChatRichTextFormatter.d.ts +32 -0
- package/dist/types/formatters/CometChatFormatters/CometChatUrlsFormatter/CometChatUrlsFormatter.d.ts +9 -3
- package/dist/types/formatters/index.d.ts +2 -0
- package/dist/types/index.d.ts +1 -1
- package/dist/types/utils/EmojiShortcodeUtils.d.ts +11 -0
- package/dist/types/utils/HtmlToMarkdown.d.ts +52 -0
- package/dist/types/utils/MarkdownPatternDetector.d.ts +108 -0
- package/dist/types/utils/MessageUtils.d.ts +6 -0
- package/dist/types/utils/RichTextFormatting.d.ts +143 -0
- package/dist/types/utils/util.d.ts +1 -1
- package/package.json +2 -2
- package/dist/types/utils/useSecureMedia.d.ts +0 -19
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* HTML to Markdown Converter
|
|
3
|
+
*
|
|
4
|
+
* Converts rich text HTML from the message composer to markdown
|
|
5
|
+
* for storage and transmission.
|
|
6
|
+
*
|
|
7
|
+
* Conversion rules:
|
|
8
|
+
* - <b>, <strong> → **text**
|
|
9
|
+
* - <i>, <em> → _text_
|
|
10
|
+
* - <s>, <strike>, <del> → ~~text~~
|
|
11
|
+
* - <u> → <u>text</u> (HTML-style underline)
|
|
12
|
+
* - <code> (not in pre) → `text`
|
|
13
|
+
* - <pre><code> → ```text```
|
|
14
|
+
* - <blockquote> → > text
|
|
15
|
+
* - <a href="url">text</a> → [text](url)
|
|
16
|
+
* - <ol><li> → 1. text
|
|
17
|
+
* - <ul><li> → • text
|
|
18
|
+
*/
|
|
19
|
+
/**
|
|
20
|
+
* Convert HTML string to markdown
|
|
21
|
+
*/
|
|
22
|
+
export declare function htmlToMarkdown(html: string): string;
|
|
23
|
+
/**
|
|
24
|
+
* Remove escape backslashes from markdown text before sending.
|
|
25
|
+
* Preserves literal markdown characters that were escaped by the user.
|
|
26
|
+
*
|
|
27
|
+
* Rules:
|
|
28
|
+
* - Single backslash before markdown character: remove backslash, keep character
|
|
29
|
+
* - Even number of backslashes: keep half of them (they escape each other)
|
|
30
|
+
* - Odd number of backslashes: keep (n-1)/2 backslashes, last one escapes the markdown char
|
|
31
|
+
*
|
|
32
|
+
* Examples:
|
|
33
|
+
* - \* → *
|
|
34
|
+
* - \\* → \*
|
|
35
|
+
* - \\\* → \*
|
|
36
|
+
* - \\\\* → \\*
|
|
37
|
+
*
|
|
38
|
+
* @param text - Markdown text that may contain escape sequences
|
|
39
|
+
* @returns Text with escape backslashes removed
|
|
40
|
+
*/
|
|
41
|
+
export declare function removeEscapeBackslashes(text: string): string;
|
|
42
|
+
/**
|
|
43
|
+
* Clean up markdown output
|
|
44
|
+
* - Remove excessive newlines
|
|
45
|
+
* - Trim whitespace
|
|
46
|
+
*/
|
|
47
|
+
export declare function cleanMarkdown(markdown: string): string;
|
|
48
|
+
/**
|
|
49
|
+
* Convert HTML to clean markdown
|
|
50
|
+
* Removes escape backslashes before sending (Requirement 12.2)
|
|
51
|
+
*/
|
|
52
|
+
export declare function convertHtmlToMarkdown(html: string): string;
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MarkdownPatternDetector - Utility for detecting and validating markdown syntax patterns
|
|
3
|
+
* in contenteditable elements for automatic conversion to rich text formatting.
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Represents a markdown pattern definition
|
|
7
|
+
*/
|
|
8
|
+
export interface MarkdownPattern {
|
|
9
|
+
type: 'bold' | 'italic' | 'underline' | 'strikethrough' | 'codeInline' | 'codeBlock' | 'link';
|
|
10
|
+
openDelimiter: string;
|
|
11
|
+
closeDelimiter: string;
|
|
12
|
+
priority: number;
|
|
13
|
+
/** If true, use custom detection logic instead of standard delimiter matching */
|
|
14
|
+
customDetection?: boolean;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Represents a detected markdown pattern match
|
|
18
|
+
*/
|
|
19
|
+
export interface PatternMatch {
|
|
20
|
+
pattern: MarkdownPattern;
|
|
21
|
+
startOffset: number;
|
|
22
|
+
endOffset: number;
|
|
23
|
+
contentStart: number;
|
|
24
|
+
contentEnd: number;
|
|
25
|
+
content: string;
|
|
26
|
+
linkUrl?: string;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Context information for pattern detection
|
|
30
|
+
*/
|
|
31
|
+
export interface DetectionContext {
|
|
32
|
+
text: string;
|
|
33
|
+
cursorOffset: number;
|
|
34
|
+
triggerChar: string;
|
|
35
|
+
scopeStart: number;
|
|
36
|
+
scopeEnd: number;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Supported markdown patterns ordered by priority (highest first)
|
|
40
|
+
*/
|
|
41
|
+
export declare const MARKDOWN_PATTERNS: MarkdownPattern[];
|
|
42
|
+
/**
|
|
43
|
+
* Map of trigger characters to their associated patterns for efficient lookup
|
|
44
|
+
*/
|
|
45
|
+
export declare const TRIGGER_CHARS: Record<string, MarkdownPattern[]>;
|
|
46
|
+
/**
|
|
47
|
+
* Detects markdown patterns in text at cursor position
|
|
48
|
+
*
|
|
49
|
+
* @param context - Detection context with text, cursor position, and scope boundaries
|
|
50
|
+
* @returns PatternMatch if valid pattern found, null otherwise
|
|
51
|
+
*/
|
|
52
|
+
export declare function detectMarkdownPattern(context: DetectionContext): PatternMatch | null;
|
|
53
|
+
/**
|
|
54
|
+
* Validates that a pattern match is properly formed
|
|
55
|
+
*
|
|
56
|
+
* @param match - Pattern match to validate
|
|
57
|
+
* @param context - Detection context
|
|
58
|
+
* @returns true if pattern is valid, false otherwise
|
|
59
|
+
*/
|
|
60
|
+
export declare function validatePattern(match: PatternMatch, context: DetectionContext): boolean;
|
|
61
|
+
/**
|
|
62
|
+
* Checks if a position in text is within an escape sequence
|
|
63
|
+
*
|
|
64
|
+
* @param text - Full text content
|
|
65
|
+
* @param position - Position to check
|
|
66
|
+
* @returns true if position is escaped, false otherwise
|
|
67
|
+
*/
|
|
68
|
+
export declare function isEscaped(text: string, position: number): boolean;
|
|
69
|
+
/**
|
|
70
|
+
* Finds scope boundaries (paragraph/block element) for pattern matching
|
|
71
|
+
*
|
|
72
|
+
* @param element - Container element
|
|
73
|
+
* @param cursorNode - Current cursor node
|
|
74
|
+
* @param cursorOffset - Current cursor offset
|
|
75
|
+
* @returns Object with start and end offsets of the scope
|
|
76
|
+
*/
|
|
77
|
+
export declare function findScopeBoundaries(element: HTMLElement, cursorNode: Node, cursorOffset: number): {
|
|
78
|
+
start: number;
|
|
79
|
+
end: number;
|
|
80
|
+
};
|
|
81
|
+
/**
|
|
82
|
+
* Checks if the cursor is currently inside a mention element.
|
|
83
|
+
* Mention elements use `<span class="cometchat-mentions">`.
|
|
84
|
+
*
|
|
85
|
+
* @param cursorNode - The DOM node where the cursor is positioned
|
|
86
|
+
* @param containerElement - The contenteditable container element
|
|
87
|
+
* @returns true if cursor is inside a mention span, false otherwise
|
|
88
|
+
*/
|
|
89
|
+
export declare function isCursorInsideMention(cursorNode: Node, containerElement: HTMLElement): boolean;
|
|
90
|
+
/**
|
|
91
|
+
* Checks if the cursor is currently inside a link (anchor) element.
|
|
92
|
+
*
|
|
93
|
+
* @param cursorNode - The DOM node where the cursor is positioned
|
|
94
|
+
* @param containerElement - The contenteditable container element
|
|
95
|
+
* @returns true if cursor is inside an <a> element, false otherwise
|
|
96
|
+
*/
|
|
97
|
+
export declare function isCursorInsideLink(cursorNode: Node, containerElement: HTMLElement): boolean;
|
|
98
|
+
/**
|
|
99
|
+
* Checks if a pattern match spans across a mention or link element boundary.
|
|
100
|
+
* This prevents markdown patterns from being matched when the opening delimiter
|
|
101
|
+
* is outside a mention/link and the closing delimiter is inside (or vice versa).
|
|
102
|
+
*
|
|
103
|
+
* @param containerElement - The contenteditable container element
|
|
104
|
+
* @param startOffset - Text offset of the pattern start (opening delimiter)
|
|
105
|
+
* @param endOffset - Text offset of the pattern end (closing delimiter)
|
|
106
|
+
* @returns true if the pattern crosses a mention or link boundary, false otherwise
|
|
107
|
+
*/
|
|
108
|
+
export declare function patternCrossesMentionOrLink(containerElement: HTMLElement, startOffset: number, endOffset: number): boolean;
|
|
@@ -29,6 +29,12 @@ export declare class MessageUtils {
|
|
|
29
29
|
* @returns {JSX.Element} The default view for moderated messages.
|
|
30
30
|
*/
|
|
31
31
|
getModeratedMessageBottomView(): JSX.Element;
|
|
32
|
+
/**
|
|
33
|
+
* Retrieves the bottom view for permission denied messages
|
|
34
|
+
*
|
|
35
|
+
* @returns {JSX.Element} The default view for permission denied messages.
|
|
36
|
+
*/
|
|
37
|
+
getPermissionDeniedMessageBottomView(): JSX.Element;
|
|
32
38
|
/**
|
|
33
39
|
* Retrieves the bubble wrapper for a message based on the provided template.
|
|
34
40
|
*
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
export type FormatType = 'bold' | 'italic' | 'underline' | 'strikethrough' | 'link' | 'orderedList' | 'unorderedList' | 'blockquote' | 'codeInline' | 'codeBlock';
|
|
2
|
+
/**
|
|
3
|
+
* Creates a rich text formatting utility bound to a specific document context
|
|
4
|
+
* Supports iframe embedding by accepting document/window from IframeContext
|
|
5
|
+
*/
|
|
6
|
+
export declare function createRichTextFormatter(getDocument: () => Document, getWindow: () => Window): {
|
|
7
|
+
getSelection: () => Selection | null;
|
|
8
|
+
saveSelection: () => Range | null;
|
|
9
|
+
restoreSelection: (range: Range | null) => void;
|
|
10
|
+
hasSelection: () => boolean;
|
|
11
|
+
getSelectedText: (savedRange?: Range | null) => string;
|
|
12
|
+
isFormatted: (formatType: FormatType, containerElement: HTMLElement) => boolean;
|
|
13
|
+
isFormattingModeActive: () => boolean;
|
|
14
|
+
getActiveFormats: (containerElement: HTMLElement) => FormatType[];
|
|
15
|
+
getActiveFormattingModes: () => FormatType[];
|
|
16
|
+
findFormattingAncestor: () => HTMLElement | null;
|
|
17
|
+
applyFormat: () => void;
|
|
18
|
+
removeFormat: () => void;
|
|
19
|
+
toggleFormat: (formatType: FormatType, containerElement: HTMLElement) => void;
|
|
20
|
+
toggleFormattingMode: () => void;
|
|
21
|
+
toggleBold: (containerElement: HTMLElement) => void;
|
|
22
|
+
toggleItalic: (containerElement: HTMLElement) => void;
|
|
23
|
+
toggleUnderline: (containerElement: HTMLElement) => void;
|
|
24
|
+
toggleStrikethrough: (containerElement: HTMLElement) => void;
|
|
25
|
+
insertLink: (url: string, displayText: string | undefined, containerElement: HTMLElement) => void;
|
|
26
|
+
updateLink: (url: string, displayText: string | undefined, containerElement: HTMLElement) => void;
|
|
27
|
+
removeLink: (containerElement: HTMLElement) => void;
|
|
28
|
+
isInsideLink: (containerElement: HTMLElement) => boolean;
|
|
29
|
+
toggleOrderedList: (containerElement: HTMLElement) => void;
|
|
30
|
+
toggleUnorderedList: (containerElement: HTMLElement) => void;
|
|
31
|
+
fixOrderedListContinuation: (containerElement: HTMLElement) => void;
|
|
32
|
+
isInsideList: (listType: "orderedList" | "unorderedList", containerElement: HTMLElement) => HTMLElement | null;
|
|
33
|
+
isInsideAnyList: (containerElement: HTMLElement) => HTMLElement | null;
|
|
34
|
+
getCurrentListItem: (containerElement: HTMLElement) => HTMLLIElement | null;
|
|
35
|
+
isCurrentListItemEmpty: (containerElement: HTMLElement) => boolean;
|
|
36
|
+
isCursorAtListItemStart: (containerElement: HTMLElement) => boolean;
|
|
37
|
+
handleListBackspace: (containerElement: HTMLElement) => boolean;
|
|
38
|
+
handleListEnter: (containerElement: HTMLElement) => boolean;
|
|
39
|
+
handleListTab: (containerElement: HTMLElement, shiftKey: boolean) => boolean;
|
|
40
|
+
handleCodeBlockEnter: (containerElement: HTMLElement) => boolean;
|
|
41
|
+
handleCodeBlockBackspace: (containerElement: HTMLElement) => boolean;
|
|
42
|
+
handleAutoListTrigger: (containerElement: HTMLElement) => "orderedList" | "unorderedList" | null;
|
|
43
|
+
applyListInlineStyles: (containerElement: HTMLElement) => void;
|
|
44
|
+
toggleBlockquote: (containerElement: HTMLElement) => void;
|
|
45
|
+
isInsideBlockquote: (containerElement: HTMLElement) => HTMLElement | null;
|
|
46
|
+
toggleCodeInline: (containerElement: HTMLElement) => void;
|
|
47
|
+
toggleCodeBlock: (containerElement: HTMLElement) => void;
|
|
48
|
+
isInsideCodeInline: (containerElement: HTMLElement) => HTMLElement | null;
|
|
49
|
+
isInsideCodeBlock: (containerElement: HTMLElement) => HTMLElement | null;
|
|
50
|
+
handleInlineCodePreservation: (containerElement: HTMLElement, wasInsideInlineCode: boolean) => void;
|
|
51
|
+
clearFormattingModes: () => void;
|
|
52
|
+
resetFontContext: (containerElement?: HTMLElement) => void;
|
|
53
|
+
handleKeyboardShortcut: (event: KeyboardEvent, containerElement: HTMLElement) => boolean;
|
|
54
|
+
handleArrowKeyInCode: (event: KeyboardEvent, containerElement: HTMLElement) => boolean;
|
|
55
|
+
getPlainText: (htmlContent: string) => string;
|
|
56
|
+
normalizeHtml: (htmlContent: string) => string;
|
|
57
|
+
trimRichTextWhitespace: (html: string | null | undefined) => string;
|
|
58
|
+
handleMarkdownShortcuts: (containerElement: HTMLElement, onBeforeConversion?: () => void) => boolean;
|
|
59
|
+
clearPendingFormats: () => void;
|
|
60
|
+
getPendingFormats: () => FormatType[];
|
|
61
|
+
getTextOffsetAtCursor: (containerElement: HTMLElement) => number;
|
|
62
|
+
setCursorByTextOffset: (containerElement: HTMLElement, offset: number) => void;
|
|
63
|
+
convertMarkdownToFormat: (containerElement: HTMLElement, startOffset: number, endOffset: number, contentStart: number, contentEnd: number, formatType: FormatType, linkUrl?: string) => void;
|
|
64
|
+
positionCursorAfterFormat: (containerElement: HTMLElement, formattedNode: Node) => void;
|
|
65
|
+
applyMarkdownConversion: (containerElement: HTMLElement, match: {
|
|
66
|
+
startOffset: number;
|
|
67
|
+
endOffset: number;
|
|
68
|
+
contentStart: number;
|
|
69
|
+
contentEnd: number;
|
|
70
|
+
linkUrl?: string;
|
|
71
|
+
}, formatType: FormatType) => void;
|
|
72
|
+
};
|
|
73
|
+
/**
|
|
74
|
+
* React hook for rich text formatting
|
|
75
|
+
*/
|
|
76
|
+
export declare function useRichTextFormatting(getDocument: () => Document, getWindow: () => Window): {
|
|
77
|
+
getSelection: () => Selection | null;
|
|
78
|
+
saveSelection: () => Range | null;
|
|
79
|
+
restoreSelection: (range: Range | null) => void;
|
|
80
|
+
hasSelection: () => boolean;
|
|
81
|
+
getSelectedText: (savedRange?: Range | null) => string;
|
|
82
|
+
isFormatted: (formatType: FormatType, containerElement: HTMLElement) => boolean;
|
|
83
|
+
isFormattingModeActive: () => boolean;
|
|
84
|
+
getActiveFormats: (containerElement: HTMLElement) => FormatType[];
|
|
85
|
+
getActiveFormattingModes: () => FormatType[];
|
|
86
|
+
findFormattingAncestor: () => HTMLElement | null;
|
|
87
|
+
applyFormat: () => void;
|
|
88
|
+
removeFormat: () => void;
|
|
89
|
+
toggleFormat: (formatType: FormatType, containerElement: HTMLElement) => void;
|
|
90
|
+
toggleFormattingMode: () => void;
|
|
91
|
+
toggleBold: (containerElement: HTMLElement) => void;
|
|
92
|
+
toggleItalic: (containerElement: HTMLElement) => void;
|
|
93
|
+
toggleUnderline: (containerElement: HTMLElement) => void;
|
|
94
|
+
toggleStrikethrough: (containerElement: HTMLElement) => void;
|
|
95
|
+
insertLink: (url: string, displayText: string | undefined, containerElement: HTMLElement) => void;
|
|
96
|
+
updateLink: (url: string, displayText: string | undefined, containerElement: HTMLElement) => void;
|
|
97
|
+
removeLink: (containerElement: HTMLElement) => void;
|
|
98
|
+
isInsideLink: (containerElement: HTMLElement) => boolean;
|
|
99
|
+
toggleOrderedList: (containerElement: HTMLElement) => void;
|
|
100
|
+
toggleUnorderedList: (containerElement: HTMLElement) => void;
|
|
101
|
+
fixOrderedListContinuation: (containerElement: HTMLElement) => void;
|
|
102
|
+
isInsideList: (listType: "orderedList" | "unorderedList", containerElement: HTMLElement) => HTMLElement | null;
|
|
103
|
+
isInsideAnyList: (containerElement: HTMLElement) => HTMLElement | null;
|
|
104
|
+
getCurrentListItem: (containerElement: HTMLElement) => HTMLLIElement | null;
|
|
105
|
+
isCurrentListItemEmpty: (containerElement: HTMLElement) => boolean;
|
|
106
|
+
isCursorAtListItemStart: (containerElement: HTMLElement) => boolean;
|
|
107
|
+
handleListBackspace: (containerElement: HTMLElement) => boolean;
|
|
108
|
+
handleListEnter: (containerElement: HTMLElement) => boolean;
|
|
109
|
+
handleListTab: (containerElement: HTMLElement, shiftKey: boolean) => boolean;
|
|
110
|
+
handleCodeBlockEnter: (containerElement: HTMLElement) => boolean;
|
|
111
|
+
handleCodeBlockBackspace: (containerElement: HTMLElement) => boolean;
|
|
112
|
+
handleAutoListTrigger: (containerElement: HTMLElement) => "orderedList" | "unorderedList" | null;
|
|
113
|
+
applyListInlineStyles: (containerElement: HTMLElement) => void;
|
|
114
|
+
toggleBlockquote: (containerElement: HTMLElement) => void;
|
|
115
|
+
isInsideBlockquote: (containerElement: HTMLElement) => HTMLElement | null;
|
|
116
|
+
toggleCodeInline: (containerElement: HTMLElement) => void;
|
|
117
|
+
toggleCodeBlock: (containerElement: HTMLElement) => void;
|
|
118
|
+
isInsideCodeInline: (containerElement: HTMLElement) => HTMLElement | null;
|
|
119
|
+
isInsideCodeBlock: (containerElement: HTMLElement) => HTMLElement | null;
|
|
120
|
+
handleInlineCodePreservation: (containerElement: HTMLElement, wasInsideInlineCode: boolean) => void;
|
|
121
|
+
clearFormattingModes: () => void;
|
|
122
|
+
resetFontContext: (containerElement?: HTMLElement) => void;
|
|
123
|
+
handleKeyboardShortcut: (event: KeyboardEvent, containerElement: HTMLElement) => boolean;
|
|
124
|
+
handleArrowKeyInCode: (event: KeyboardEvent, containerElement: HTMLElement) => boolean;
|
|
125
|
+
getPlainText: (htmlContent: string) => string;
|
|
126
|
+
normalizeHtml: (htmlContent: string) => string;
|
|
127
|
+
trimRichTextWhitespace: (html: string | null | undefined) => string;
|
|
128
|
+
handleMarkdownShortcuts: (containerElement: HTMLElement, onBeforeConversion?: () => void) => boolean;
|
|
129
|
+
clearPendingFormats: () => void;
|
|
130
|
+
getPendingFormats: () => FormatType[];
|
|
131
|
+
getTextOffsetAtCursor: (containerElement: HTMLElement) => number;
|
|
132
|
+
setCursorByTextOffset: (containerElement: HTMLElement, offset: number) => void;
|
|
133
|
+
convertMarkdownToFormat: (containerElement: HTMLElement, startOffset: number, endOffset: number, contentStart: number, contentEnd: number, formatType: FormatType, linkUrl?: string) => void;
|
|
134
|
+
positionCursorAfterFormat: (containerElement: HTMLElement, formattedNode: Node) => void;
|
|
135
|
+
applyMarkdownConversion: (containerElement: HTMLElement, match: {
|
|
136
|
+
startOffset: number;
|
|
137
|
+
endOffset: number;
|
|
138
|
+
contentStart: number;
|
|
139
|
+
contentEnd: number;
|
|
140
|
+
linkUrl?: string;
|
|
141
|
+
}, formatType: FormatType) => void;
|
|
142
|
+
};
|
|
143
|
+
export default useRichTextFormatting;
|
|
@@ -32,7 +32,7 @@ export declare function isSafari(): boolean;
|
|
|
32
32
|
*/
|
|
33
33
|
export declare function isURL(text: string): boolean;
|
|
34
34
|
export declare function getThemeVariable(name: string): string;
|
|
35
|
-
export declare function getThemeMode(): "
|
|
35
|
+
export declare function getThemeMode(): "light" | "dark";
|
|
36
36
|
/**
|
|
37
37
|
* Function to convert audio forat from webm to wav
|
|
38
38
|
* @param file
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cometchat/chat-uikit-react",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.4.0",
|
|
4
4
|
"description": "Ready-to-use Chat UI Components for React(Javascript/Web)",
|
|
5
5
|
"author": "CometChat",
|
|
6
6
|
"exports": {
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
"./css-variables.css": "./dist/styles/css-variables.css"
|
|
9
9
|
},
|
|
10
10
|
"dependencies": {
|
|
11
|
-
"@cometchat/chat-sdk-javascript": "^4.1.
|
|
11
|
+
"@cometchat/chat-sdk-javascript": "^4.1.8",
|
|
12
12
|
"@rollup/plugin-json": "^6.1.0",
|
|
13
13
|
"rxjs": "^7.8.1",
|
|
14
14
|
"react-markdown": "^10.1.0",
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
export interface UseSecureMediaResult {
|
|
2
|
-
resolvedUrl: string | null;
|
|
3
|
-
isLoading: boolean;
|
|
4
|
-
error: Error | null;
|
|
5
|
-
}
|
|
6
|
-
/**
|
|
7
|
-
* Checks whether the given URL requires secure presigned access.
|
|
8
|
-
*/
|
|
9
|
-
export declare function requiresSecureMediaAccess(url: string): boolean;
|
|
10
|
-
/**
|
|
11
|
-
* Resolves a media URL to a presigned URL if secure access is required, else returns as-is.
|
|
12
|
-
* For imperative/non-hook contexts (downloads, WaveSurfer load, etc.).
|
|
13
|
-
*/
|
|
14
|
-
export declare function resolveSecureUrl(url: string): Promise<string>;
|
|
15
|
-
/**
|
|
16
|
-
* React hook that resolves a media URL to a presigned URL if secure access is required.
|
|
17
|
-
* Handles cancellation on unmount/url change.
|
|
18
|
-
*/
|
|
19
|
-
export declare function useSecureMedia(url: string | null): UseSecureMediaResult;
|