@chayns-components/emoji-input 5.0.0-beta.112 → 5.0.0-beta.1122
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/README.md +4 -15
- package/lib/{api → cjs/api}/item-storage/get.js +4 -5
- package/lib/cjs/api/item-storage/get.js.map +1 -0
- package/lib/{api → cjs/api}/item-storage/put.js +5 -6
- package/lib/cjs/api/item-storage/put.js.map +1 -0
- package/lib/cjs/components/emoji-input/EmojiInput.js +536 -0
- package/lib/cjs/components/emoji-input/EmojiInput.js.map +1 -0
- package/lib/cjs/components/emoji-input/EmojiInput.styles.js +131 -0
- package/lib/cjs/components/emoji-input/EmojiInput.styles.js.map +1 -0
- package/lib/cjs/components/emoji-input/prefix-element/PrefixElement.js +44 -0
- package/lib/cjs/components/emoji-input/prefix-element/PrefixElement.js.map +1 -0
- package/lib/cjs/components/emoji-input/prefix-element/PrefixElement.styles.js +64 -0
- package/lib/cjs/components/emoji-input/prefix-element/PrefixElement.styles.js.map +1 -0
- package/lib/{components → cjs/components}/emoji-picker/EmojiPicker.js +8 -11
- package/lib/cjs/components/emoji-picker/EmojiPicker.js.map +1 -0
- package/lib/{components → cjs/components}/emoji-picker/EmojiPicker.styles.js +3 -5
- package/lib/cjs/components/emoji-picker/EmojiPicker.styles.js.map +1 -0
- package/lib/cjs/components/emoji-picker/emoji-picker-categories/EmojiPickerCategories.js +101 -0
- package/lib/cjs/components/emoji-picker/emoji-picker-categories/EmojiPickerCategories.js.map +1 -0
- package/lib/{components → cjs/components}/emoji-picker/emoji-picker-categories/EmojiPickerCategories.styles.js +4 -6
- package/lib/cjs/components/emoji-picker/emoji-picker-categories/EmojiPickerCategories.styles.js.map +1 -0
- package/lib/cjs/components/emoji-picker/emoji-picker-emojis/EmojiPickerEmojis.js +239 -0
- package/lib/cjs/components/emoji-picker/emoji-picker-emojis/EmojiPickerEmojis.js.map +1 -0
- package/lib/cjs/components/emoji-picker/emoji-picker-emojis/EmojiPickerEmojis.styles.js +66 -0
- package/lib/cjs/components/emoji-picker/emoji-picker-emojis/EmojiPickerEmojis.styles.js.map +1 -0
- package/lib/{components → cjs/components}/emoji-picker/emoji-picker-emojis/emoji/Emoji.js +60 -33
- package/lib/cjs/components/emoji-picker/emoji-picker-emojis/emoji/Emoji.js.map +1 -0
- package/lib/{components → cjs/components}/emoji-picker/emoji-picker-emojis/emoji/Emoji.styles.js +6 -3
- package/lib/cjs/components/emoji-picker/emoji-picker-emojis/emoji/Emoji.styles.js.map +1 -0
- package/lib/cjs/components/emoji-picker/emoji-picker-emojis/emoji/skin-tone-popup/SkinTonePopup.js +129 -0
- package/lib/cjs/components/emoji-picker/emoji-picker-emojis/emoji/skin-tone-popup/SkinTonePopup.js.map +1 -0
- package/lib/cjs/components/emoji-picker/emoji-picker-emojis/emoji/skin-tone-popup/SkinTonePopup.styles.js +98 -0
- package/lib/cjs/components/emoji-picker/emoji-picker-emojis/emoji/skin-tone-popup/SkinTonePopup.styles.js.map +1 -0
- package/lib/cjs/components/emoji-picker-popup/EmojiPickerPopup.js +51 -0
- package/lib/cjs/components/emoji-picker-popup/EmojiPickerPopup.js.map +1 -0
- package/lib/cjs/components/emoji-picker-popup/EmojiPickerPopup.styles.js +15 -0
- package/lib/cjs/components/emoji-picker-popup/EmojiPickerPopup.styles.js.map +1 -0
- package/lib/{constants → cjs/constants}/alignment.js +2 -4
- package/lib/cjs/constants/alignment.js.map +1 -0
- package/lib/{constants → cjs/constants}/categories.js +1 -2
- package/lib/cjs/constants/categories.js.map +1 -0
- package/lib/{constants → cjs/constants}/emoji.js +4 -8
- package/lib/cjs/constants/emoji.js.map +1 -0
- package/lib/cjs/constants/externalServerUrl.js +8 -0
- package/lib/cjs/constants/externalServerUrl.js.map +1 -0
- package/lib/cjs/constants/regex.js +15 -0
- package/lib/cjs/constants/regex.js.map +1 -0
- package/lib/{hooks → cjs/hooks}/emojiHistory.js +13 -15
- package/lib/cjs/hooks/emojiHistory.js.map +1 -0
- package/lib/{index.js → cjs/index.js} +1 -1
- package/lib/cjs/index.js.map +1 -0
- package/lib/cjs/types/api.js.map +1 -0
- package/lib/cjs/types/category.js.map +1 -0
- package/lib/{utils → cjs/utils}/emoji.js +14 -6
- package/lib/cjs/utils/emoji.js.map +1 -0
- package/lib/cjs/utils/environment.js.map +1 -0
- package/lib/cjs/utils/font.js.map +1 -0
- package/lib/cjs/utils/insert.js +110 -0
- package/lib/cjs/utils/insert.js.map +1 -0
- package/lib/cjs/utils/number.js +17 -0
- package/lib/cjs/utils/number.js.map +1 -0
- package/lib/cjs/utils/selection.js +281 -0
- package/lib/cjs/utils/selection.js.map +1 -0
- package/lib/cjs/utils/text.js +57 -0
- package/lib/cjs/utils/text.js.map +1 -0
- package/lib/esm/api/item-storage/get.js +30 -0
- package/lib/esm/api/item-storage/get.js.map +1 -0
- package/lib/esm/api/item-storage/put.js +35 -0
- package/lib/esm/api/item-storage/put.js.map +1 -0
- package/lib/esm/components/emoji-input/EmojiInput.js +518 -0
- package/lib/esm/components/emoji-input/EmojiInput.js.map +1 -0
- package/lib/esm/components/emoji-input/EmojiInput.styles.js +151 -0
- package/lib/esm/components/emoji-input/EmojiInput.styles.js.map +1 -0
- package/lib/esm/components/emoji-input/prefix-element/PrefixElement.js +38 -0
- package/lib/esm/components/emoji-input/prefix-element/PrefixElement.js.map +1 -0
- package/lib/esm/components/emoji-input/prefix-element/PrefixElement.styles.js +69 -0
- package/lib/esm/components/emoji-input/prefix-element/PrefixElement.styles.js.map +1 -0
- package/lib/esm/components/emoji-picker/EmojiPicker.js +40 -0
- package/lib/esm/components/emoji-picker/EmojiPicker.js.map +1 -0
- package/lib/esm/components/emoji-picker/EmojiPicker.styles.js +16 -0
- package/lib/esm/components/emoji-picker/EmojiPicker.styles.js.map +1 -0
- package/lib/esm/components/emoji-picker/emoji-picker-categories/EmojiPickerCategories.js +96 -0
- package/lib/esm/components/emoji-picker/emoji-picker-categories/EmojiPickerCategories.js.map +1 -0
- package/lib/esm/components/emoji-picker/emoji-picker-categories/EmojiPickerCategories.styles.js +18 -0
- package/lib/esm/components/emoji-picker/emoji-picker-categories/EmojiPickerCategories.styles.js.map +1 -0
- package/lib/esm/components/emoji-picker/emoji-picker-emojis/EmojiPickerEmojis.js +240 -0
- package/lib/esm/components/emoji-picker/emoji-picker-emojis/EmojiPickerEmojis.js.map +1 -0
- package/lib/esm/components/emoji-picker/emoji-picker-emojis/EmojiPickerEmojis.styles.js +74 -0
- package/lib/esm/components/emoji-picker/emoji-picker-emojis/EmojiPickerEmojis.styles.js.map +1 -0
- package/lib/esm/components/emoji-picker/emoji-picker-emojis/emoji/Emoji.js +136 -0
- package/lib/esm/components/emoji-picker/emoji-picker-emojis/emoji/Emoji.js.map +1 -0
- package/lib/esm/components/emoji-picker/emoji-picker-emojis/emoji/Emoji.styles.js +20 -0
- package/lib/esm/components/emoji-picker/emoji-picker-emojis/emoji/Emoji.styles.js.map +1 -0
- package/lib/esm/components/emoji-picker/emoji-picker-emojis/emoji/skin-tone-popup/SkinTonePopup.js +121 -0
- package/lib/esm/components/emoji-picker/emoji-picker-emojis/emoji/skin-tone-popup/SkinTonePopup.js.map +1 -0
- package/lib/esm/components/emoji-picker/emoji-picker-emojis/emoji/skin-tone-popup/SkinTonePopup.styles.js +98 -0
- package/lib/esm/components/emoji-picker/emoji-picker-emojis/emoji/skin-tone-popup/SkinTonePopup.styles.js.map +1 -0
- package/lib/esm/components/emoji-picker-popup/EmojiPickerPopup.js +43 -0
- package/lib/esm/components/emoji-picker-popup/EmojiPickerPopup.js.map +1 -0
- package/lib/esm/components/emoji-picker-popup/EmojiPickerPopup.styles.js +8 -0
- package/lib/esm/components/emoji-picker-popup/EmojiPickerPopup.styles.js.map +1 -0
- package/lib/esm/constants/alignment.js +13 -0
- package/lib/esm/constants/alignment.js.map +1 -0
- package/lib/esm/constants/categories.js +13 -0
- package/lib/esm/constants/categories.js.map +1 -0
- package/lib/esm/constants/emoji-de-DE.json +3827 -0
- package/lib/esm/constants/emoji.js +3798 -0
- package/lib/esm/constants/emoji.js.map +1 -0
- package/lib/esm/constants/externalServerUrl.js +2 -0
- package/lib/esm/constants/externalServerUrl.js.map +1 -0
- package/lib/esm/constants/regex.js +9 -0
- package/lib/esm/constants/regex.js.map +1 -0
- package/lib/esm/hooks/emojiHistory.js +83 -0
- package/lib/esm/hooks/emojiHistory.js.map +1 -0
- package/lib/{index.d.ts → esm/index.js} +1 -0
- package/lib/esm/index.js.map +1 -0
- package/lib/esm/types/api.js +2 -0
- package/lib/esm/types/api.js.map +1 -0
- package/lib/esm/types/category.js +2 -0
- package/lib/esm/types/category.js.map +1 -0
- package/lib/esm/utils/emoji.js +92 -0
- package/lib/esm/utils/emoji.js.map +1 -0
- package/lib/esm/utils/environment.js +24 -0
- package/lib/esm/utils/environment.js.map +1 -0
- package/lib/esm/utils/font.js +10 -0
- package/lib/esm/utils/font.js.map +1 -0
- package/lib/esm/utils/insert.js +104 -0
- package/lib/esm/utils/insert.js.map +1 -0
- package/lib/esm/utils/number.js +10 -0
- package/lib/esm/utils/number.js.map +1 -0
- package/lib/esm/utils/selection.js +263 -0
- package/lib/esm/utils/selection.js.map +1 -0
- package/lib/esm/utils/text.js +48 -0
- package/lib/esm/utils/text.js.map +1 -0
- package/lib/types/components/emoji-input/EmojiInput.d.ts +96 -0
- package/lib/types/components/emoji-input/EmojiInput.styles.d.ts +26 -0
- package/lib/types/components/emoji-input/prefix-element/PrefixElement.d.ts +8 -0
- package/lib/types/components/emoji-input/prefix-element/PrefixElement.styles.d.ts +12 -0
- package/lib/types/components/emoji-picker/EmojiPicker.styles.d.ts +5 -0
- package/lib/types/components/emoji-picker/emoji-picker-categories/EmojiPickerCategories.styles.d.ts +6 -0
- package/lib/types/components/emoji-picker/emoji-picker-emojis/EmojiPickerEmojis.styles.d.ts +9 -0
- package/lib/{components → types/components}/emoji-picker/emoji-picker-emojis/emoji/Emoji.d.ts +5 -0
- package/lib/types/components/emoji-picker/emoji-picker-emojis/emoji/Emoji.styles.d.ts +6 -0
- package/lib/types/components/emoji-picker/emoji-picker-emojis/emoji/skin-tone-popup/SkinTonePopup.styles.d.ts +22 -0
- package/lib/{components → types/components}/emoji-picker-popup/EmojiPickerPopup.d.ts +0 -13
- package/lib/types/components/emoji-picker-popup/EmojiPickerPopup.styles.d.ts +1 -0
- package/lib/types/constants/regex.d.ts +8 -0
- package/lib/types/index.d.ts +6 -0
- package/lib/{utils → types/utils}/emoji.d.ts +2 -0
- package/lib/{utils → types/utils}/insert.d.ts +8 -1
- package/lib/types/utils/number.d.ts +1 -0
- package/lib/types/utils/selection.d.ts +23 -0
- package/lib/types/utils/text.d.ts +3 -0
- package/package.json +49 -31
- package/lib/api/item-storage/get.js.map +0 -1
- package/lib/api/item-storage/put.js.map +0 -1
- package/lib/components/emoji-input/EmojiInput.d.ts +0 -53
- package/lib/components/emoji-input/EmojiInput.js +0 -159
- package/lib/components/emoji-input/EmojiInput.js.map +0 -1
- package/lib/components/emoji-input/EmojiInput.styles.d.ts +0 -13
- package/lib/components/emoji-input/EmojiInput.styles.js +0 -145
- package/lib/components/emoji-input/EmojiInput.styles.js.map +0 -1
- package/lib/components/emoji-picker/EmojiPicker.js.map +0 -1
- package/lib/components/emoji-picker/EmojiPicker.styles.d.ts +0 -5
- package/lib/components/emoji-picker/EmojiPicker.styles.js.map +0 -1
- package/lib/components/emoji-picker/emoji-picker-categories/EmojiPickerCategories.js +0 -51
- package/lib/components/emoji-picker/emoji-picker-categories/EmojiPickerCategories.js.map +0 -1
- package/lib/components/emoji-picker/emoji-picker-categories/EmojiPickerCategories.styles.d.ts +0 -2
- package/lib/components/emoji-picker/emoji-picker-categories/EmojiPickerCategories.styles.js.map +0 -1
- package/lib/components/emoji-picker/emoji-picker-emojis/EmojiPickerEmojis.js +0 -131
- package/lib/components/emoji-picker/emoji-picker-emojis/EmojiPickerEmojis.js.map +0 -1
- package/lib/components/emoji-picker/emoji-picker-emojis/EmojiPickerEmojis.styles.d.ts +0 -7
- package/lib/components/emoji-picker/emoji-picker-emojis/EmojiPickerEmojis.styles.js +0 -99
- package/lib/components/emoji-picker/emoji-picker-emojis/EmojiPickerEmojis.styles.js.map +0 -1
- package/lib/components/emoji-picker/emoji-picker-emojis/emoji/Emoji.js.map +0 -1
- package/lib/components/emoji-picker/emoji-picker-emojis/emoji/Emoji.styles.d.ts +0 -1
- package/lib/components/emoji-picker/emoji-picker-emojis/emoji/Emoji.styles.js.map +0 -1
- package/lib/components/emoji-picker/emoji-picker-emojis/emoji/skin-tone-popup/SkinTonePopup.js +0 -74
- package/lib/components/emoji-picker/emoji-picker-emojis/emoji/skin-tone-popup/SkinTonePopup.js.map +0 -1
- package/lib/components/emoji-picker/emoji-picker-emojis/emoji/skin-tone-popup/SkinTonePopup.styles.d.ts +0 -11
- package/lib/components/emoji-picker/emoji-picker-emojis/emoji/skin-tone-popup/SkinTonePopup.styles.js +0 -104
- package/lib/components/emoji-picker/emoji-picker-emojis/emoji/skin-tone-popup/SkinTonePopup.styles.js.map +0 -1
- package/lib/components/emoji-picker-popup/EmojiPickerPopup.js +0 -150
- package/lib/components/emoji-picker-popup/EmojiPickerPopup.js.map +0 -1
- package/lib/components/emoji-picker-popup/EmojiPickerPopup.styles.d.ts +0 -7
- package/lib/components/emoji-picker-popup/EmojiPickerPopup.styles.js +0 -97
- package/lib/components/emoji-picker-popup/EmojiPickerPopup.styles.js.map +0 -1
- package/lib/constants/alignment.js.map +0 -1
- package/lib/constants/categories.js.map +0 -1
- package/lib/constants/emoji.js.map +0 -1
- package/lib/constants/externalServerUrl.js +0 -9
- package/lib/constants/externalServerUrl.js.map +0 -1
- package/lib/hooks/emojiHistory.js.map +0 -1
- package/lib/index.js.map +0 -1
- package/lib/types/api.js.map +0 -1
- package/lib/types/category.js.map +0 -1
- package/lib/utils/emoji.js.map +0 -1
- package/lib/utils/environment.js.map +0 -1
- package/lib/utils/font.js.map +0 -1
- package/lib/utils/insert.js +0 -50
- package/lib/utils/insert.js.map +0 -1
- package/lib/utils/selection.d.ts +0 -2
- package/lib/utils/selection.js +0 -43
- package/lib/utils/selection.js.map +0 -1
- /package/lib/{constants → cjs/constants}/emoji-de-DE.json +0 -0
- /package/lib/{types → cjs/types}/api.js +0 -0
- /package/lib/{types → cjs/types}/category.js +0 -0
- /package/lib/{utils → cjs/utils}/environment.js +0 -0
- /package/lib/{utils → cjs/utils}/font.js +0 -0
- /package/lib/{api → types/api}/item-storage/get.d.ts +0 -0
- /package/lib/{api → types/api}/item-storage/put.d.ts +0 -0
- /package/lib/{components → types/components}/emoji-picker/EmojiPicker.d.ts +0 -0
- /package/lib/{components → types/components}/emoji-picker/emoji-picker-categories/EmojiPickerCategories.d.ts +0 -0
- /package/lib/{components → types/components}/emoji-picker/emoji-picker-emojis/EmojiPickerEmojis.d.ts +0 -0
- /package/lib/{components → types/components}/emoji-picker/emoji-picker-emojis/emoji/skin-tone-popup/SkinTonePopup.d.ts +0 -0
- /package/lib/{constants → types/constants}/alignment.d.ts +0 -0
- /package/lib/{constants → types/constants}/categories.d.ts +0 -0
- /package/lib/{constants → types/constants}/emoji.d.ts +0 -0
- /package/lib/{constants → types/constants}/externalServerUrl.d.ts +0 -0
- /package/lib/{hooks → types/hooks}/emojiHistory.d.ts +0 -0
- /package/lib/types/{api.d.ts → types/api.d.ts} +0 -0
- /package/lib/types/{category.d.ts → types/category.d.ts} +0 -0
- /package/lib/{utils → types/utils}/environment.d.ts +0 -0
- /package/lib/{utils → types/utils}/font.d.ts +0 -0
|
@@ -0,0 +1,263 @@
|
|
|
1
|
+
import { clamp } from './number';
|
|
2
|
+
import { getElementTextLength } from './text';
|
|
3
|
+
let childIndex = -1;
|
|
4
|
+
let endOffset = -1;
|
|
5
|
+
let startOffset = -1;
|
|
6
|
+
export const saveSelection = function (element) {
|
|
7
|
+
let {
|
|
8
|
+
shouldIgnoreEmptyTextNodes
|
|
9
|
+
} = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
10
|
+
const selection = window.getSelection();
|
|
11
|
+
if (!selection) {
|
|
12
|
+
return;
|
|
13
|
+
}
|
|
14
|
+
const {
|
|
15
|
+
anchorNode
|
|
16
|
+
} = selection;
|
|
17
|
+
if (!anchorNode) {
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
const range = selection.getRangeAt(0);
|
|
21
|
+
let childNodesArray = Array.from(element.childNodes);
|
|
22
|
+
if (shouldIgnoreEmptyTextNodes) {
|
|
23
|
+
childNodesArray = childNodesArray.filter(_ref => {
|
|
24
|
+
let {
|
|
25
|
+
nodeType,
|
|
26
|
+
nodeValue
|
|
27
|
+
} = _ref;
|
|
28
|
+
return nodeType !== Node.TEXT_NODE || nodeValue !== '' && nodeValue !== '\u200B';
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
childIndex = childNodesArray.indexOf(anchorNode);
|
|
32
|
+
endOffset = range.endOffset;
|
|
33
|
+
startOffset = range.startOffset;
|
|
34
|
+
};
|
|
35
|
+
export const restoreSelection = element => {
|
|
36
|
+
// Search for \u200C in child nodes. If found, set the childIndex, startOffset, and endOffset to the
|
|
37
|
+
// position of the \u200C character. Also remove the \u200C character from the child node. If not found,
|
|
38
|
+
// the childIndex, startOffset, and endOffset will be like before.
|
|
39
|
+
const childNodesArray = Array.from(element.childNodes);
|
|
40
|
+
let hasFoundNoJoiner = false;
|
|
41
|
+
childNodesArray.forEach(node => {
|
|
42
|
+
if (!hasFoundNoJoiner && node.nodeType === Node.TEXT_NODE && typeof node.nodeValue === 'string') {
|
|
43
|
+
const noJoinerIndex = node.nodeValue.indexOf('\u200C');
|
|
44
|
+
if (noJoinerIndex !== -1) {
|
|
45
|
+
hasFoundNoJoiner = true;
|
|
46
|
+
childIndex = childNodesArray.indexOf(node);
|
|
47
|
+
startOffset = noJoinerIndex;
|
|
48
|
+
endOffset = noJoinerIndex;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
// Remove all no joiner characters from the child nodes if no joiner was found
|
|
54
|
+
if (hasFoundNoJoiner) {
|
|
55
|
+
childNodesArray.forEach(node => {
|
|
56
|
+
if (node.nodeType === Node.TEXT_NODE && typeof node.nodeValue === 'string') {
|
|
57
|
+
// eslint-disable-next-line no-param-reassign
|
|
58
|
+
node.nodeValue = node.nodeValue.replace(/\u200C/g, '');
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
let childNode = element.childNodes[childIndex];
|
|
63
|
+
const selection = window.getSelection();
|
|
64
|
+
if (!childNode || !element || !selection) {
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
// noinspection SuspiciousTypeOfGuard
|
|
69
|
+
if (typeof childNode.nodeValue !== 'string') {
|
|
70
|
+
const elementTextLength = getElementTextLength(childNode);
|
|
71
|
+
if (childNode.nextSibling) {
|
|
72
|
+
childNode = childNode.nextSibling;
|
|
73
|
+
if (childNode.nodeType === Node.TEXT_NODE && childNode.nodeValue) {
|
|
74
|
+
endOffset -= elementTextLength;
|
|
75
|
+
startOffset -= elementTextLength;
|
|
76
|
+
if (childNode.nodeValue.charCodeAt(endOffset) === 8203) {
|
|
77
|
+
endOffset += 1;
|
|
78
|
+
startOffset += 1;
|
|
79
|
+
}
|
|
80
|
+
} else {
|
|
81
|
+
const textNode = document.createTextNode('\u200B');
|
|
82
|
+
childNode.parentNode?.insertBefore(textNode, childNode.nextSibling);
|
|
83
|
+
childNode = textNode;
|
|
84
|
+
endOffset = textNode.length;
|
|
85
|
+
startOffset = textNode.length;
|
|
86
|
+
}
|
|
87
|
+
} else {
|
|
88
|
+
const textNode = document.createTextNode('\u200B');
|
|
89
|
+
childNode.parentNode?.insertBefore(textNode, childNode.nextSibling);
|
|
90
|
+
childNode = textNode;
|
|
91
|
+
endOffset = textNode.length;
|
|
92
|
+
startOffset = textNode.length;
|
|
93
|
+
}
|
|
94
|
+
} else if (childNode.nodeValue && endOffset > childNode.nodeValue.length) {
|
|
95
|
+
if (childNode.nextSibling?.nodeValue) {
|
|
96
|
+
let elementTextLength = childNode.nodeValue.length;
|
|
97
|
+
childNode = childNode.nextSibling;
|
|
98
|
+
|
|
99
|
+
// noinspection SuspiciousTypeOfGuard
|
|
100
|
+
if (typeof childNode.nodeValue !== 'string') {
|
|
101
|
+
elementTextLength += getElementTextLength(childNode);
|
|
102
|
+
if (childNode.nextSibling?.nodeValue) {
|
|
103
|
+
childNode = childNode.nextSibling;
|
|
104
|
+
if (childNode.nodeType === Node.TEXT_NODE && childNode.nodeValue) {
|
|
105
|
+
endOffset -= elementTextLength;
|
|
106
|
+
startOffset -= elementTextLength;
|
|
107
|
+
if (childNode.nodeValue.charCodeAt(endOffset) === 8203) {
|
|
108
|
+
endOffset += 1;
|
|
109
|
+
startOffset += 1;
|
|
110
|
+
}
|
|
111
|
+
} else {
|
|
112
|
+
const textNode = document.createTextNode('\u200B');
|
|
113
|
+
childNode.parentNode?.insertBefore(textNode, childNode.nextSibling);
|
|
114
|
+
childNode = textNode;
|
|
115
|
+
endOffset = textNode.length;
|
|
116
|
+
startOffset = textNode.length;
|
|
117
|
+
}
|
|
118
|
+
} else {
|
|
119
|
+
const textNode = document.createTextNode('\u200B');
|
|
120
|
+
childNode.parentNode?.insertBefore(textNode, childNode.nextSibling);
|
|
121
|
+
childNode = textNode;
|
|
122
|
+
endOffset = textNode.length;
|
|
123
|
+
startOffset = textNode.length;
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
} else {
|
|
127
|
+
endOffset = childNode.nodeValue.length;
|
|
128
|
+
startOffset = childNode.nodeValue.length;
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
const range = document.createRange();
|
|
132
|
+
|
|
133
|
+
// noinspection SuspiciousTypeOfGuard
|
|
134
|
+
if (typeof childNode.nodeValue === 'string') {
|
|
135
|
+
startOffset = clamp(startOffset, 0, childNode.nodeValue.length);
|
|
136
|
+
endOffset = clamp(endOffset, 0, childNode.nodeValue.length);
|
|
137
|
+
}
|
|
138
|
+
try {
|
|
139
|
+
range.setStart(childNode, startOffset);
|
|
140
|
+
range.setEnd(childNode, endOffset);
|
|
141
|
+
} catch (error) {
|
|
142
|
+
// Do nothing
|
|
143
|
+
}
|
|
144
|
+
selection.removeAllRanges();
|
|
145
|
+
selection.addRange(range);
|
|
146
|
+
range.collapse(true);
|
|
147
|
+
};
|
|
148
|
+
export const insertInvisibleCursorMarker = () => {
|
|
149
|
+
const selection = window.getSelection();
|
|
150
|
+
if (!selection || selection.rangeCount === 0) {
|
|
151
|
+
return;
|
|
152
|
+
}
|
|
153
|
+
const range = selection.getRangeAt(0);
|
|
154
|
+
const textNode = range.startContainer;
|
|
155
|
+
const offset = range.startOffset;
|
|
156
|
+
|
|
157
|
+
// noinspection JSDeprecatedSymbols
|
|
158
|
+
document.execCommand('delete', false);
|
|
159
|
+
const span = document.createElement('span');
|
|
160
|
+
span.style.display = 'inline-block';
|
|
161
|
+
span.style.width = '0';
|
|
162
|
+
span.style.height = '0';
|
|
163
|
+
span.className = 'invisible-cursor-marker';
|
|
164
|
+
const parent = textNode.parentNode;
|
|
165
|
+
if (parent) {
|
|
166
|
+
if (textNode.nodeType === Node.TEXT_NODE) {
|
|
167
|
+
const textContent = textNode.textContent || '';
|
|
168
|
+
const beforeText = textContent.slice(0, offset);
|
|
169
|
+
const afterText = textContent.slice(offset);
|
|
170
|
+
textNode.textContent = beforeText;
|
|
171
|
+
parent.insertBefore(span, textNode.nextSibling);
|
|
172
|
+
const afterTextNode = document.createTextNode(afterText);
|
|
173
|
+
parent.insertBefore(afterTextNode, span.nextSibling);
|
|
174
|
+
setTimeout(() => {
|
|
175
|
+
// Set cursor to cursor element
|
|
176
|
+
const newRange = document.createRange();
|
|
177
|
+
newRange.setStartAfter(span);
|
|
178
|
+
newRange.setEndAfter(span);
|
|
179
|
+
selection.removeAllRanges();
|
|
180
|
+
selection.addRange(newRange);
|
|
181
|
+
|
|
182
|
+
// Remove cursor element
|
|
183
|
+
span.remove();
|
|
184
|
+
}, 10);
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
};
|
|
188
|
+
export const moveSelectionOffset = distance => {
|
|
189
|
+
endOffset += distance;
|
|
190
|
+
startOffset += distance;
|
|
191
|
+
};
|
|
192
|
+
export const setChildIndex = index => {
|
|
193
|
+
childIndex = index;
|
|
194
|
+
};
|
|
195
|
+
|
|
196
|
+
/**
|
|
197
|
+
* This function returns the code of the character that will be removed by the KeyDown event in the
|
|
198
|
+
* next step, if the "Backspace" or "Delete" key was pressed and there is no selection of multiple
|
|
199
|
+
* characters.
|
|
200
|
+
*
|
|
201
|
+
* @param event - Keyboard event from "onKeyDown"
|
|
202
|
+
*/
|
|
203
|
+
export const getCharCodeThatWillBeDeleted = event => {
|
|
204
|
+
const range = window.getSelection()?.getRangeAt(0);
|
|
205
|
+
|
|
206
|
+
/**
|
|
207
|
+
* At this point the function is aborted if there is no selection range, several characters have
|
|
208
|
+
* been selected and therefore no single letter is removed or neither the "Backspace" nor the
|
|
209
|
+
* "Delete" key has been pressed.
|
|
210
|
+
*/
|
|
211
|
+
if (!range || range.endOffset !== range.startOffset || event.key !== 'Backspace' && event.key !== 'Delete' && event.key !== 'Unidentified') {
|
|
212
|
+
return null;
|
|
213
|
+
}
|
|
214
|
+
if (event.key === 'Backspace' || event.key === 'Unidentified') {
|
|
215
|
+
const {
|
|
216
|
+
nodeValue,
|
|
217
|
+
previousSibling
|
|
218
|
+
} = range.startContainer;
|
|
219
|
+
if (range.startOffset > 0) {
|
|
220
|
+
return nodeValue?.charCodeAt(range.startOffset - 1);
|
|
221
|
+
}
|
|
222
|
+
return previousSibling?.nodeValue?.charCodeAt(previousSibling.nodeValue.length - 1);
|
|
223
|
+
}
|
|
224
|
+
const {
|
|
225
|
+
nextSibling,
|
|
226
|
+
nodeValue
|
|
227
|
+
} = range.endContainer;
|
|
228
|
+
if (range.endOffset < (nodeValue?.length ?? 0)) {
|
|
229
|
+
return nodeValue?.charCodeAt(range.endOffset);
|
|
230
|
+
}
|
|
231
|
+
return nextSibling?.nodeValue?.charCodeAt(0);
|
|
232
|
+
};
|
|
233
|
+
export const findAndSelectText = _ref2 => {
|
|
234
|
+
let {
|
|
235
|
+
editorElement,
|
|
236
|
+
searchText
|
|
237
|
+
} = _ref2;
|
|
238
|
+
if (!editorElement.textContent?.includes(searchText)) {
|
|
239
|
+
return null;
|
|
240
|
+
}
|
|
241
|
+
const range = document.createRange();
|
|
242
|
+
let startNode = null;
|
|
243
|
+
let offset = -1;
|
|
244
|
+
const searchNodesForText = node => {
|
|
245
|
+
if (node.nodeType === Node.TEXT_NODE) {
|
|
246
|
+
const index = node.textContent?.indexOf(searchText);
|
|
247
|
+
if (typeof index === 'number' && index !== -1) {
|
|
248
|
+
startNode = node;
|
|
249
|
+
offset = index;
|
|
250
|
+
range.setStart(node, index);
|
|
251
|
+
range.setEnd(node, index + searchText.length);
|
|
252
|
+
return true;
|
|
253
|
+
}
|
|
254
|
+
} else if (node.nodeName !== 'LC_MENTION') {
|
|
255
|
+
return Array.from(node.childNodes).some(searchNodesForText);
|
|
256
|
+
}
|
|
257
|
+
return false;
|
|
258
|
+
};
|
|
259
|
+
searchNodesForText(editorElement);
|
|
260
|
+
if (startNode && offset !== -1) return range;
|
|
261
|
+
return null;
|
|
262
|
+
};
|
|
263
|
+
//# sourceMappingURL=selection.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"selection.js","names":["clamp","getElementTextLength","childIndex","endOffset","startOffset","saveSelection","element","shouldIgnoreEmptyTextNodes","arguments","length","undefined","selection","window","getSelection","anchorNode","range","getRangeAt","childNodesArray","Array","from","childNodes","filter","_ref","nodeType","nodeValue","Node","TEXT_NODE","indexOf","restoreSelection","hasFoundNoJoiner","forEach","node","noJoinerIndex","replace","childNode","elementTextLength","nextSibling","charCodeAt","textNode","document","createTextNode","parentNode","insertBefore","createRange","setStart","setEnd","error","removeAllRanges","addRange","collapse","insertInvisibleCursorMarker","rangeCount","startContainer","offset","execCommand","span","createElement","style","display","width","height","className","parent","textContent","beforeText","slice","afterText","afterTextNode","setTimeout","newRange","setStartAfter","setEndAfter","remove","moveSelectionOffset","distance","setChildIndex","index","getCharCodeThatWillBeDeleted","event","key","previousSibling","endContainer","findAndSelectText","_ref2","editorElement","searchText","includes","startNode","searchNodesForText","nodeName","some"],"sources":["../../../src/utils/selection.ts"],"sourcesContent":["import type { KeyboardEvent } from 'react';\nimport { clamp } from './number';\nimport { getElementTextLength } from './text';\n\nlet childIndex = -1;\nlet endOffset = -1;\nlet startOffset = -1;\n\ninterface SaveSelectionOptions {\n shouldIgnoreEmptyTextNodes?: boolean;\n}\n\nexport const saveSelection = (\n element: HTMLDivElement,\n { shouldIgnoreEmptyTextNodes }: SaveSelectionOptions = {},\n) => {\n const selection = window.getSelection();\n\n if (!selection) {\n return;\n }\n\n const { anchorNode } = selection;\n\n if (!anchorNode) {\n return;\n }\n\n const range = selection.getRangeAt(0);\n\n let childNodesArray = Array.from(element.childNodes);\n\n if (shouldIgnoreEmptyTextNodes) {\n childNodesArray = childNodesArray.filter(\n ({ nodeType, nodeValue }) =>\n nodeType !== Node.TEXT_NODE || (nodeValue !== '' && nodeValue !== '\\u200B'),\n );\n }\n\n childIndex = childNodesArray.indexOf(anchorNode as ChildNode);\n\n endOffset = range.endOffset;\n startOffset = range.startOffset;\n};\n\nexport const restoreSelection = (element: HTMLDivElement) => {\n // Search for \\u200C in child nodes. If found, set the childIndex, startOffset, and endOffset to the\n // position of the \\u200C character. Also remove the \\u200C character from the child node. If not found,\n // the childIndex, startOffset, and endOffset will be like before.\n const childNodesArray = Array.from(element.childNodes);\n\n let hasFoundNoJoiner = false;\n\n childNodesArray.forEach((node) => {\n if (\n !hasFoundNoJoiner &&\n node.nodeType === Node.TEXT_NODE &&\n typeof node.nodeValue === 'string'\n ) {\n const noJoinerIndex = node.nodeValue.indexOf('\\u200C');\n\n if (noJoinerIndex !== -1) {\n hasFoundNoJoiner = true;\n\n childIndex = childNodesArray.indexOf(node);\n startOffset = noJoinerIndex;\n endOffset = noJoinerIndex;\n }\n }\n });\n\n // Remove all no joiner characters from the child nodes if no joiner was found\n if (hasFoundNoJoiner) {\n childNodesArray.forEach((node) => {\n if (node.nodeType === Node.TEXT_NODE && typeof node.nodeValue === 'string') {\n // eslint-disable-next-line no-param-reassign\n node.nodeValue = node.nodeValue.replace(/\\u200C/g, '');\n }\n });\n }\n\n let childNode = element.childNodes[childIndex];\n\n const selection = window.getSelection();\n\n if (!childNode || !element || !selection) {\n return;\n }\n\n // noinspection SuspiciousTypeOfGuard\n if (typeof childNode.nodeValue !== 'string') {\n const elementTextLength = getElementTextLength(childNode as Element);\n\n if (childNode.nextSibling) {\n childNode = childNode.nextSibling;\n\n if (childNode.nodeType === Node.TEXT_NODE && childNode.nodeValue) {\n endOffset -= elementTextLength;\n startOffset -= elementTextLength;\n\n if (childNode.nodeValue.charCodeAt(endOffset) === 8203) {\n endOffset += 1;\n startOffset += 1;\n }\n } else {\n const textNode = document.createTextNode('\\u200B');\n\n childNode.parentNode?.insertBefore(textNode, childNode.nextSibling);\n\n childNode = textNode;\n\n endOffset = textNode.length;\n startOffset = textNode.length;\n }\n } else {\n const textNode = document.createTextNode('\\u200B');\n\n childNode.parentNode?.insertBefore(textNode, childNode.nextSibling);\n\n childNode = textNode;\n\n endOffset = textNode.length;\n startOffset = textNode.length;\n }\n } else if (childNode.nodeValue && endOffset > childNode.nodeValue.length) {\n if (childNode.nextSibling?.nodeValue) {\n let elementTextLength = childNode.nodeValue.length;\n\n childNode = childNode.nextSibling;\n\n // noinspection SuspiciousTypeOfGuard\n if (typeof childNode.nodeValue !== 'string') {\n elementTextLength += getElementTextLength(childNode as Element);\n\n if (childNode.nextSibling?.nodeValue) {\n childNode = childNode.nextSibling;\n\n if (childNode.nodeType === Node.TEXT_NODE && childNode.nodeValue) {\n endOffset -= elementTextLength;\n startOffset -= elementTextLength;\n\n if (childNode.nodeValue.charCodeAt(endOffset) === 8203) {\n endOffset += 1;\n startOffset += 1;\n }\n } else {\n const textNode = document.createTextNode('\\u200B');\n\n childNode.parentNode?.insertBefore(textNode, childNode.nextSibling);\n\n childNode = textNode;\n\n endOffset = textNode.length;\n startOffset = textNode.length;\n }\n } else {\n const textNode = document.createTextNode('\\u200B');\n\n childNode.parentNode?.insertBefore(textNode, childNode.nextSibling);\n\n childNode = textNode;\n\n endOffset = textNode.length;\n startOffset = textNode.length;\n }\n }\n } else {\n endOffset = childNode.nodeValue.length;\n startOffset = childNode.nodeValue.length;\n }\n }\n\n const range = document.createRange();\n\n // noinspection SuspiciousTypeOfGuard\n if (typeof childNode.nodeValue === 'string') {\n startOffset = clamp(startOffset, 0, childNode.nodeValue.length);\n endOffset = clamp(endOffset, 0, childNode.nodeValue.length);\n }\n\n try {\n range.setStart(childNode, startOffset);\n range.setEnd(childNode, endOffset);\n } catch (error) {\n // Do nothing\n }\n\n selection.removeAllRanges();\n selection.addRange(range);\n\n range.collapse(true);\n};\n\nexport const insertInvisibleCursorMarker = (): void => {\n const selection = window.getSelection();\n\n if (!selection || selection.rangeCount === 0) {\n return;\n }\n\n const range = selection.getRangeAt(0);\n const textNode = range.startContainer;\n const offset = range.startOffset;\n\n // noinspection JSDeprecatedSymbols\n document.execCommand('delete', false);\n\n const span = document.createElement('span');\n span.style.display = 'inline-block';\n span.style.width = '0';\n span.style.height = '0';\n span.className = 'invisible-cursor-marker';\n\n const parent = textNode.parentNode;\n\n if (parent) {\n if (textNode.nodeType === Node.TEXT_NODE) {\n const textContent = textNode.textContent || '';\n const beforeText = textContent.slice(0, offset);\n const afterText = textContent.slice(offset);\n\n textNode.textContent = beforeText;\n\n parent.insertBefore(span, textNode.nextSibling);\n const afterTextNode = document.createTextNode(afterText);\n parent.insertBefore(afterTextNode, span.nextSibling);\n\n setTimeout(() => {\n // Set cursor to cursor element\n const newRange = document.createRange();\n newRange.setStartAfter(span);\n newRange.setEndAfter(span);\n selection.removeAllRanges();\n selection.addRange(newRange);\n\n // Remove cursor element\n span.remove();\n }, 10);\n }\n }\n};\n\nexport const moveSelectionOffset = (distance: number) => {\n endOffset += distance;\n startOffset += distance;\n};\n\nexport const setChildIndex = (index: number) => {\n childIndex = index;\n};\n\n/**\n * This function returns the code of the character that will be removed by the KeyDown event in the\n * next step, if the \"Backspace\" or \"Delete\" key was pressed and there is no selection of multiple\n * characters.\n *\n * @param event - Keyboard event from \"onKeyDown\"\n */\nexport const getCharCodeThatWillBeDeleted = (event: KeyboardEvent<HTMLDivElement>) => {\n const range = window.getSelection()?.getRangeAt(0);\n\n /**\n * At this point the function is aborted if there is no selection range, several characters have\n * been selected and therefore no single letter is removed or neither the \"Backspace\" nor the\n * \"Delete\" key has been pressed.\n */\n if (\n !range ||\n range.endOffset !== range.startOffset ||\n (event.key !== 'Backspace' && event.key !== 'Delete' && event.key !== 'Unidentified')\n ) {\n return null;\n }\n\n if (event.key === 'Backspace' || event.key === 'Unidentified') {\n const { nodeValue, previousSibling } = range.startContainer;\n\n if (range.startOffset > 0) {\n return nodeValue?.charCodeAt(range.startOffset - 1);\n }\n\n return previousSibling?.nodeValue?.charCodeAt(previousSibling.nodeValue.length - 1);\n }\n\n const { nextSibling, nodeValue } = range.endContainer;\n\n if (range.endOffset < (nodeValue?.length ?? 0)) {\n return nodeValue?.charCodeAt(range.endOffset);\n }\n\n return nextSibling?.nodeValue?.charCodeAt(0);\n};\n\ninterface FindAndSelectTextOptions {\n editorElement: HTMLDivElement;\n searchText: string;\n}\n\nexport const findAndSelectText = ({\n editorElement,\n searchText,\n}: FindAndSelectTextOptions): Range | null => {\n if (!editorElement.textContent?.includes(searchText)) {\n return null;\n }\n\n const range = document.createRange();\n\n let startNode: Node | null = null;\n let offset = -1;\n\n const searchNodesForText = (node: Node) => {\n if (node.nodeType === Node.TEXT_NODE) {\n const index = node.textContent?.indexOf(searchText);\n\n if (typeof index === 'number' && index !== -1) {\n startNode = node;\n offset = index;\n\n range.setStart(node, index);\n range.setEnd(node, index + searchText.length);\n\n return true;\n }\n } else if (node.nodeName !== 'LC_MENTION') {\n return Array.from(node.childNodes).some(searchNodesForText);\n }\n\n return false;\n };\n\n searchNodesForText(editorElement);\n\n if (startNode && offset !== -1) return range;\n\n return null;\n};\n"],"mappings":"AACA,SAASA,KAAK,QAAQ,UAAU;AAChC,SAASC,oBAAoB,QAAQ,QAAQ;AAE7C,IAAIC,UAAU,GAAG,CAAC,CAAC;AACnB,IAAIC,SAAS,GAAG,CAAC,CAAC;AAClB,IAAIC,WAAW,GAAG,CAAC,CAAC;AAMpB,OAAO,MAAMC,aAAa,GAAG,SAAAA,CACzBC,OAAuB,EAEtB;EAAA,IADD;IAAEC;EAAiD,CAAC,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,CAAC,CAAC;EAEzD,MAAMG,SAAS,GAAGC,MAAM,CAACC,YAAY,CAAC,CAAC;EAEvC,IAAI,CAACF,SAAS,EAAE;IACZ;EACJ;EAEA,MAAM;IAAEG;EAAW,CAAC,GAAGH,SAAS;EAEhC,IAAI,CAACG,UAAU,EAAE;IACb;EACJ;EAEA,MAAMC,KAAK,GAAGJ,SAAS,CAACK,UAAU,CAAC,CAAC,CAAC;EAErC,IAAIC,eAAe,GAAGC,KAAK,CAACC,IAAI,CAACb,OAAO,CAACc,UAAU,CAAC;EAEpD,IAAIb,0BAA0B,EAAE;IAC5BU,eAAe,GAAGA,eAAe,CAACI,MAAM,CACpCC,IAAA;MAAA,IAAC;QAAEC,QAAQ;QAAEC;MAAU,CAAC,GAAAF,IAAA;MAAA,OACpBC,QAAQ,KAAKE,IAAI,CAACC,SAAS,IAAKF,SAAS,KAAK,EAAE,IAAIA,SAAS,KAAK,QAAS;IAAA,CACnF,CAAC;EACL;EAEAtB,UAAU,GAAGe,eAAe,CAACU,OAAO,CAACb,UAAuB,CAAC;EAE7DX,SAAS,GAAGY,KAAK,CAACZ,SAAS;EAC3BC,WAAW,GAAGW,KAAK,CAACX,WAAW;AACnC,CAAC;AAED,OAAO,MAA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GEX, BB_NER_REPLACE_REGEX, HTML_A_TAG_REGEX, HTML_BOLD_REGEX, HTML_LC_MENTION_REGEX, HTML_NER_IGNORE_REGEX, HTML_NER_REPLACE_REGEX } from '../constants/regex';
|
|
2
|
+
import { escapeHTML, unescapeHTML } from './emoji';
|
|
3
|
+
export const convertTextToHTML = text => {
|
|
4
|
+
const element = document.createElement('div');
|
|
5
|
+
element.style.position = 'absolute';
|
|
6
|
+
element.style.opacity = '0';
|
|
7
|
+
element.contentEditable = 'true';
|
|
8
|
+
element.innerText = text;
|
|
9
|
+
document.body.appendChild(element);
|
|
10
|
+
let result = element.innerHTML;
|
|
11
|
+
document.body.removeChild(element);
|
|
12
|
+
result = unescapeHTML(result);
|
|
13
|
+
result = result.replace(HTML_A_TAG_REGEX, '$1').replace(BB_LC_MENTION_REGEX, '<lc_mention contenteditable="false" id="$1"><span>@</span>$2</lc_mention>').replace(BB_NER_IGNORE_REGEX, '<nerIgnore contenteditable="false">$1</nerIgnore>').replace(BB_NER_REPLACE_REGEX, (_, prefix, type, value, entity) => {
|
|
14
|
+
const prefixAttr = prefix ? `prefix="${prefix}" ` : '';
|
|
15
|
+
return `<nerReplace contenteditable="false" ${prefixAttr}type="${type}" value="${value}">${entity}</nerReplace>`;
|
|
16
|
+
});
|
|
17
|
+
return result;
|
|
18
|
+
};
|
|
19
|
+
export const convertHTMLToText = text => {
|
|
20
|
+
let result = text;
|
|
21
|
+
result = result.replace(HTML_A_TAG_REGEX, '$1').replace(HTML_BOLD_REGEX, '[b]$1[/b]').replace(HTML_LC_MENTION_REGEX, '[lc_mention id="$1"]$2[/lc_mention]').replace(HTML_NER_IGNORE_REGEX, '[nerIgnore]$1[/nerIgnore]').replace(HTML_NER_REPLACE_REGEX, (_, prefix, type, value, entity) => {
|
|
22
|
+
const prefixAttr = prefix ? `prefix="${prefix}" ` : '';
|
|
23
|
+
return `[nerReplace ${prefixAttr}type="${type}" value="${value}"]${entity}[/nerReplace]`;
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
// eslint-disable-next-line no-irregular-whitespace
|
|
27
|
+
result = result.replace(//g, '');
|
|
28
|
+
result = escapeHTML(result);
|
|
29
|
+
const element = document.createElement('div');
|
|
30
|
+
element.style.position = 'absolute';
|
|
31
|
+
element.style.opacity = '0';
|
|
32
|
+
element.contentEditable = 'true';
|
|
33
|
+
element.innerHTML = result;
|
|
34
|
+
document.body.appendChild(element);
|
|
35
|
+
result = element.innerText;
|
|
36
|
+
document.body.removeChild(element);
|
|
37
|
+
return result;
|
|
38
|
+
};
|
|
39
|
+
export const getElementTextLength = element => {
|
|
40
|
+
let textLength = 0;
|
|
41
|
+
try {
|
|
42
|
+
textLength = convertHTMLToText(element.outerHTML).length;
|
|
43
|
+
} catch (e) {
|
|
44
|
+
// Do nothing
|
|
45
|
+
}
|
|
46
|
+
return textLength;
|
|
47
|
+
};
|
|
48
|
+
//# sourceMappingURL=text.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"text.js","names":["BB_LC_MENTION_REGEX","BB_NER_IGNORE_REGEX","BB_NER_REPLACE_REGEX","HTML_A_TAG_REGEX","HTML_BOLD_REGEX","HTML_LC_MENTION_REGEX","HTML_NER_IGNORE_REGEX","HTML_NER_REPLACE_REGEX","escapeHTML","unescapeHTML","convertTextToHTML","text","element","document","createElement","style","position","opacity","contentEditable","innerText","body","appendChild","result","innerHTML","removeChild","replace","_","prefix","type","value","entity","prefixAttr","convertHTMLToText","getElementTextLength","textLength","outerHTML","length","e"],"sources":["../../../src/utils/text.ts"],"sourcesContent":["import {\n BB_LC_MENTION_REGEX,\n BB_NER_IGNORE_REGEX,\n BB_NER_REPLACE_REGEX,\n HTML_A_TAG_REGEX,\n HTML_BOLD_REGEX,\n HTML_LC_MENTION_REGEX,\n HTML_NER_IGNORE_REGEX,\n HTML_NER_REPLACE_REGEX,\n} from '../constants/regex';\nimport { escapeHTML, unescapeHTML } from './emoji';\n\nexport const convertTextToHTML = (text: string) => {\n const element = document.createElement('div');\n\n element.style.position = 'absolute';\n element.style.opacity = '0';\n\n element.contentEditable = 'true';\n element.innerText = text;\n\n document.body.appendChild(element);\n\n let result = element.innerHTML;\n\n document.body.removeChild(element);\n\n result = unescapeHTML(result);\n\n result = result\n .replace(HTML_A_TAG_REGEX, '$1')\n .replace(\n BB_LC_MENTION_REGEX,\n '<lc_mention contenteditable=\"false\" id=\"$1\"><span>@</span>$2</lc_mention>',\n )\n .replace(BB_NER_IGNORE_REGEX, '<nerIgnore contenteditable=\"false\">$1</nerIgnore>')\n .replace(\n BB_NER_REPLACE_REGEX,\n (_, prefix: string | undefined, type: string, value: string, entity: string) => {\n const prefixAttr = prefix ? `prefix=\"${prefix}\" ` : '';\n\n return `<nerReplace contenteditable=\"false\" ${prefixAttr}type=\"${type}\" value=\"${value}\">${entity}</nerReplace>`;\n },\n );\n\n return result;\n};\n\nexport const convertHTMLToText = (text: string) => {\n let result = text;\n\n result = result\n .replace(HTML_A_TAG_REGEX, '$1')\n .replace(HTML_BOLD_REGEX, '[b]$1[/b]')\n .replace(HTML_LC_MENTION_REGEX, '[lc_mention id=\"$1\"]$2[/lc_mention]')\n .replace(HTML_NER_IGNORE_REGEX, '[nerIgnore]$1[/nerIgnore]')\n .replace(\n HTML_NER_REPLACE_REGEX,\n (_, prefix: string | undefined, type: string, value: string, entity: string) => {\n const prefixAttr = prefix ? `prefix=\"${prefix}\" ` : '';\n\n return `[nerReplace ${prefixAttr}type=\"${type}\" value=\"${value}\"]${entity}[/nerReplace]`;\n },\n );\n\n // eslint-disable-next-line no-irregular-whitespace\n result = result.replace(//g, '');\n\n result = escapeHTML(result);\n\n const element = document.createElement('div');\n\n element.style.position = 'absolute';\n element.style.opacity = '0';\n\n element.contentEditable = 'true';\n element.innerHTML = result;\n\n document.body.appendChild(element);\n\n result = element.innerText;\n\n document.body.removeChild(element);\n\n return result;\n};\n\nexport const getElementTextLength = (element: Element) => {\n let textLength = 0;\n\n try {\n textLength = convertHTMLToText(element.out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,CAACpB,OAAO,CAACuB,SAAS,CAAC,CAACC,MAAM;EAC5D,CAAC,CAAC,OAAOC,CAAC,EAAE;IACR;EAAA;EAGJ,OAAOH,UAAU;AACrB,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import React, { ChangeEvent, CSSProperties, FocusEventHandler, KeyboardEventHandler, ReactElement, ReactNode } from 'react';
|
|
2
|
+
import type { PopupAlignment } from '../../constants/alignment';
|
|
3
|
+
export type EmojiInputProps = {
|
|
4
|
+
/**
|
|
5
|
+
* Access token of the logged-in user. Is needed to load and save the history of the emojis.
|
|
6
|
+
*/
|
|
7
|
+
accessToken?: string;
|
|
8
|
+
/**
|
|
9
|
+
* Sets the height of the input field to a fixed value. If this value is not set, the component will use the needed height until the maximum height is reached.
|
|
10
|
+
*/
|
|
11
|
+
height?: CSSProperties['height'];
|
|
12
|
+
/**
|
|
13
|
+
* HTML id of the input element
|
|
14
|
+
*/
|
|
15
|
+
inputId?: string;
|
|
16
|
+
/**
|
|
17
|
+
* Disables the input so that it cannot be changed anymore
|
|
18
|
+
*/
|
|
19
|
+
isDisabled?: boolean;
|
|
20
|
+
/**
|
|
21
|
+
* Sets the maximum height of the input field.
|
|
22
|
+
*/
|
|
23
|
+
maxHeight?: CSSProperties['maxHeight'];
|
|
24
|
+
/**
|
|
25
|
+
* Function that is executed when the input field loses focus.
|
|
26
|
+
*/
|
|
27
|
+
onBlur?: FocusEventHandler<HTMLDivElement>;
|
|
28
|
+
/**
|
|
29
|
+
* Function that is executed when the input field gets the focus.
|
|
30
|
+
*/
|
|
31
|
+
onFocus?: FocusEventHandler<HTMLDivElement>;
|
|
32
|
+
/**
|
|
33
|
+
* Function that is executed when the text of the input changes. In addition to the original
|
|
34
|
+
* event, the original text is returned as second parameter, in which the internally used HTML
|
|
35
|
+
* elements have been converted back to BB codes.
|
|
36
|
+
*/
|
|
37
|
+
onInput?: (event: ChangeEvent<HTMLDivElement>, originalText: string) => void;
|
|
38
|
+
/**
|
|
39
|
+
* Function that is executed when a key is pressed down.
|
|
40
|
+
*/
|
|
41
|
+
onKeyDown?: KeyboardEventHandler<HTMLDivElement>;
|
|
42
|
+
/**
|
|
43
|
+
* Function to be executed if the prefixElement is removed.
|
|
44
|
+
*/
|
|
45
|
+
onPrefixElementRemove?: () => void;
|
|
46
|
+
/**
|
|
47
|
+
* Function that is executed when the visibility of the popup changes.
|
|
48
|
+
* @param {boolean} isVisible - Whether the popup is visible or not
|
|
49
|
+
*/
|
|
50
|
+
onPopupVisibilityChange?: (isVisible: boolean) => void;
|
|
51
|
+
/**
|
|
52
|
+
* Person id of the logged-in user. Is needed to load and save the history of the emojis.
|
|
53
|
+
*/
|
|
54
|
+
personId?: string;
|
|
55
|
+
/**
|
|
56
|
+
* Placeholder for the input field
|
|
57
|
+
*/
|
|
58
|
+
placeholder?: string | ReactElement;
|
|
59
|
+
/**
|
|
60
|
+
* Sets the alignment of the popup to a fixed value. If this value is not set, the component
|
|
61
|
+
* calculates the best position on its own. Use the imported 'PopupAlignment' enum to set this
|
|
62
|
+
* value.
|
|
63
|
+
*/
|
|
64
|
+
popupAlignment?: PopupAlignment;
|
|
65
|
+
/**
|
|
66
|
+
* Element that is rendered before the input field but the placeholder is still visible.
|
|
67
|
+
*/
|
|
68
|
+
prefixElement?: string;
|
|
69
|
+
/**
|
|
70
|
+
* Element that is rendered inside the EmojiInput on the right side.
|
|
71
|
+
*/
|
|
72
|
+
rightElement?: ReactNode;
|
|
73
|
+
/**
|
|
74
|
+
* Whether the placeholder should be shown after the input has focus.
|
|
75
|
+
*/
|
|
76
|
+
shouldHidePlaceholderOnFocus?: boolean;
|
|
77
|
+
/**
|
|
78
|
+
* Prevents the EmojiPickerPopup icon from being displayed
|
|
79
|
+
*/
|
|
80
|
+
shouldPreventEmojiPicker?: boolean;
|
|
81
|
+
/**
|
|
82
|
+
* The plain text value of the input field. Instead of HTML elements BB codes must be used at
|
|
83
|
+
* this point. These are then converted by the input field into corresponding HTML elements.
|
|
84
|
+
*/
|
|
85
|
+
value: string;
|
|
86
|
+
};
|
|
87
|
+
export type EmojiInputRef = {
|
|
88
|
+
insertTextAtCursorPosition: (text: string) => void;
|
|
89
|
+
replaceText: (searchText: string, replaceText: string) => void;
|
|
90
|
+
startProgress: (durationInSeconds: number) => void;
|
|
91
|
+
stopProgress: () => void;
|
|
92
|
+
focus: () => void;
|
|
93
|
+
blur: () => void;
|
|
94
|
+
};
|
|
95
|
+
declare const EmojiInput: React.ForwardRefExoticComponent<EmojiInputProps & React.RefAttributes<EmojiInputRef>>;
|
|
96
|
+
export default EmojiInput;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { BrowserName, WithTheme } from '@chayns-components/core';
|
|
2
|
+
type StyledEmojiInputProps = WithTheme<{
|
|
3
|
+
$isDisabled?: boolean;
|
|
4
|
+
$shouldChangeColor: boolean;
|
|
5
|
+
}>;
|
|
6
|
+
export declare const StyledEmojiInput: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, StyledEmojiInputProps>> & string;
|
|
7
|
+
export declare const StyledMotionEmojiInputProgress: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<Omit<Omit<import("motion/react").HTMLMotionProps<"div">, "ref"> & import("react").RefAttributes<HTMLDivElement>, "ref"> & {
|
|
8
|
+
ref?: ((instance: HTMLDivElement | null) => void | import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | import("react").RefObject<HTMLDivElement> | null | undefined;
|
|
9
|
+
}, {
|
|
10
|
+
theme: import("@chayns-components/core").Theme;
|
|
11
|
+
}>> & string & Omit<import("motion/react").ForwardRefComponent<HTMLDivElement, import("motion/react").HTMLMotionProps<"div">>, keyof import("react").Component<any, {}, any>>;
|
|
12
|
+
export declare const StyledEmojiInputContent: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
13
|
+
type StyledEmojiInputEditorProps = WithTheme<{
|
|
14
|
+
$shouldShowContent: boolean;
|
|
15
|
+
$browser: BrowserName;
|
|
16
|
+
}>;
|
|
17
|
+
export declare const StyledMotionEmojiInputEditor: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<Omit<Omit<import("motion/react").HTMLMotionProps<"div">, "ref"> & import("react").RefAttributes<HTMLDivElement>, "ref"> & {
|
|
18
|
+
ref?: ((instance: HTMLDivElement | null) => void | import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | import("react").RefObject<HTMLDivElement> | null | undefined;
|
|
19
|
+
}, StyledEmojiInputEditorProps>> & string & Omit<import("motion/react").ForwardRefComponent<HTMLDivElement, import("motion/react").HTMLMotionProps<"div">>, keyof import("react").Component<any, {}, any>>;
|
|
20
|
+
export declare const StyledEmojiInputRightWrapper: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
21
|
+
type StyledEmojiInputLabelProps = WithTheme<{
|
|
22
|
+
$maxWidth: number;
|
|
23
|
+
$offsetWidth?: number;
|
|
24
|
+
}>;
|
|
25
|
+
export declare const StyledEmojiInputLabel: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").LabelHTMLAttributes<HTMLLabelElement>, HTMLLabelElement>, StyledEmojiInputLabelProps>> & string;
|
|
26
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type Dispatch, type FC, type RefObject, type SetStateAction } from 'react';
|
|
2
|
+
export type PrefixElementProps = {
|
|
3
|
+
prefixElementRef: RefObject<HTMLDivElement>;
|
|
4
|
+
element: string;
|
|
5
|
+
setIsPrefixAnimationFinished: Dispatch<SetStateAction<boolean>>;
|
|
6
|
+
};
|
|
7
|
+
declare const PrefixElement: FC<PrefixElementProps>;
|
|
8
|
+
export default PrefixElement;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { WithTheme } from '@chayns-components/core';
|
|
2
|
+
type StyledPrefixElementProps = WithTheme<{
|
|
3
|
+
$shouldShow: boolean;
|
|
4
|
+
}>;
|
|
5
|
+
export declare const StyledPrefixElement: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, StyledPrefixElementProps>> & string;
|
|
6
|
+
export declare const StyledPrefixElementPseudo: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
7
|
+
export declare const StyledPrefixElementLetterWrapper: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
8
|
+
type StyledPrefixElementLetterProps = WithTheme<{
|
|
9
|
+
$index: number;
|
|
10
|
+
}>;
|
|
11
|
+
export declare const StyledPrefixElementLetter: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, StyledPrefixElementLetterProps>> & string;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export declare const emojiPickerSize: {
|
|
2
|
+
height: number;
|
|
3
|
+
width: number;
|
|
4
|
+
};
|
|
5
|
+
export declare const StyledEmojiPicker: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
package/lib/types/components/emoji-picker/emoji-picker-categories/EmojiPickerCategories.styles.d.ts
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export declare const StyledEmojiPickerCategories: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
2
|
+
export declare const StyledMotionEmojiPickerCategory: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<Omit<Omit<import("motion/react").HTMLMotionProps<"div">, "ref"> & import("react").RefAttributes<HTMLDivElement>, "ref"> & {
|
|
3
|
+
ref?: ((instance: HTMLDivElement | null) => void | import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | import("react").RefObject<HTMLDivElement> | null | undefined;
|
|
4
|
+
}, {
|
|
5
|
+
theme: import("@chayns-components/core").Theme;
|
|
6
|
+
}>> & string & Omit<import("motion/react").ForwardRefComponent<HTMLDivElement, import("motion/react").HTMLMotionProps<"div">>, keyof import("react").Component<any, {}, any>>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { BrowserName, WithTheme } from '@chayns-components/core';
|
|
2
|
+
type StyledEmojiPickerEmojisProps = WithTheme<{
|
|
3
|
+
$shouldPreventScroll: boolean;
|
|
4
|
+
$shouldShowNoContentInfo: boolean;
|
|
5
|
+
$browser: BrowserName;
|
|
6
|
+
}>;
|
|
7
|
+
export declare const StyledEmojiPickerEmojis: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, StyledEmojiPickerEmojisProps>> & string;
|
|
8
|
+
export declare const StyledEmojiPickerEmojisNoContentInfo: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
9
|
+
export {};
|
package/lib/{components → types/components}/emoji-picker/emoji-picker-emojis/emoji/Emoji.d.ts
RENAMED
|
@@ -1,9 +1,14 @@
|
|
|
1
1
|
import { FC } from 'react';
|
|
2
2
|
export type EmojiProps = {
|
|
3
3
|
emoji: string;
|
|
4
|
+
isSelected: boolean;
|
|
5
|
+
name: string;
|
|
6
|
+
index: number;
|
|
4
7
|
isSkinToneSupported: boolean;
|
|
5
8
|
onPopupVisibilityChange: (isVisible: boolean) => void;
|
|
6
9
|
onSelect: (emoji: string) => void;
|
|
10
|
+
onRightClick: (newIndex: number) => void;
|
|
11
|
+
shouldShowSkinTonePopup: boolean;
|
|
7
12
|
};
|
|
8
13
|
declare const Emoji: FC<EmojiProps>;
|
|
9
14
|
export default Emoji;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { WithTheme } from '@chayns-components/core';
|
|
2
|
+
type StyledEmojiProps = WithTheme<{
|
|
3
|
+
$isSelected: boolean;
|
|
4
|
+
}>;
|
|
5
|
+
export declare const StyledEmoji: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, StyledEmojiProps>> & string;
|
|
6
|
+
export {};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { WithTheme } from '@chayns-components/core';
|
|
2
|
+
import { AnchorAlignment } from '../../../../../constants/alignment';
|
|
3
|
+
export declare const StyledMotionSkinTonePopup: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<Omit<Omit<import("motion/react").HTMLMotionProps<"div">, "ref"> & import("react").RefAttributes<HTMLDivElement>, "ref"> & {
|
|
4
|
+
ref?: ((instance: HTMLDivElement | null) => void | import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | import("react").RefObject<HTMLDivElement> | null | undefined;
|
|
5
|
+
}, {
|
|
6
|
+
theme: import("@chayns-components/core").Theme;
|
|
7
|
+
}>> & string & Omit<import("motion/react").ForwardRefComponent<HTMLDivElement, import("motion/react").HTMLMotionProps<"div">>, keyof import("react").Component<any, {}, any>>;
|
|
8
|
+
export declare const skinTonePopupContentSize: {
|
|
9
|
+
height: number;
|
|
10
|
+
width: number;
|
|
11
|
+
};
|
|
12
|
+
type StyledSkinTonePopupContentProps = WithTheme<{
|
|
13
|
+
$anchorAlignment: AnchorAlignment;
|
|
14
|
+
$anchorOffset: number;
|
|
15
|
+
}>;
|
|
16
|
+
export declare const StyledSkinTonePopupContent: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, StyledSkinTonePopupContentProps>> & string;
|
|
17
|
+
type StyledSkinTonePopupContentEmojiProps = WithTheme<{
|
|
18
|
+
$isSelected: boolean;
|
|
19
|
+
}>;
|
|
20
|
+
export declare const StyledSkinTonePopupContentEmoji: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, StyledSkinTonePopupContentEmojiProps>> & string;
|
|
21
|
+
export declare const StyledSkinTonePopupOverlay: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
22
|
+
export {};
|
|
@@ -1,16 +1,9 @@
|
|
|
1
1
|
import { FC } from 'react';
|
|
2
|
-
import { PopupAlignment } from '../../constants/alignment';
|
|
3
2
|
export type EmojiPickerPopupProps = {
|
|
4
3
|
/**
|
|
5
4
|
* Access token of the logged-in user. Is needed to load and save the history of the emojis.
|
|
6
5
|
*/
|
|
7
6
|
accessToken?: string;
|
|
8
|
-
/**
|
|
9
|
-
* Sets the alignment of the popup to a fixed value. If this value is not set, the component
|
|
10
|
-
* calculates the best position on its own. Use the imported 'PopupAlignment' enum to set this
|
|
11
|
-
* value.
|
|
12
|
-
*/
|
|
13
|
-
alignment?: PopupAlignment;
|
|
14
7
|
/**
|
|
15
8
|
* Function that is executed when the visibility of the popup changes.
|
|
16
9
|
* @param {boolean} isVisible - Whether the popup is visible or not
|
|
@@ -26,11 +19,5 @@ export type EmojiPickerPopupProps = {
|
|
|
26
19
|
*/
|
|
27
20
|
onSelect: (emoji: string) => void;
|
|
28
21
|
};
|
|
29
|
-
export type PopupPosition = {
|
|
30
|
-
bottom?: number;
|
|
31
|
-
left?: number;
|
|
32
|
-
right?: number;
|
|
33
|
-
top?: number;
|
|
34
|
-
};
|
|
35
22
|
declare const EmojiPickerPopup: FC<EmojiPickerPopupProps>;
|
|
36
23
|
export default EmojiPickerPopup;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const StyledEmojiPickerPopup: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export declare const BB_LC_MENTION_REGEX: RegExp;
|
|
2
|
+
export declare const BB_NER_IGNORE_REGEX: RegExp;
|
|
3
|
+
export declare const BB_NER_REPLACE_REGEX: RegExp;
|
|
4
|
+
export declare const HTML_LC_MENTION_REGEX: RegExp;
|
|
5
|
+
export declare const HTML_NER_IGNORE_REGEX: RegExp;
|
|
6
|
+
export declare const HTML_NER_REPLACE_REGEX: RegExp;
|
|
7
|
+
export declare const HTML_BOLD_REGEX: RegExp;
|
|
8
|
+
export declare const HTML_A_TAG_REGEX: RegExp;
|