@cometchat/chat-uikit-react 6.3.13 → 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 +360 -6
- 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/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/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/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 -0
- 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/RichTextFormatting.d.ts +143 -0
- package/dist/types/utils/util.d.ts +1 -1
- package/package.json +1 -1
|
@@ -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
|