60 lines
2.1 KiB
TypeScript
60 lines
2.1 KiB
TypeScript
// Module ID: 7371
|
|
// Function ID: 7372
|
|
// Name: AutocompleteBoundaryUtils
|
|
// Dependencies: [5404, 1085, 2]
|
|
// Exports: boundAutocompleteWord
|
|
|
|
// Module 7371 (AutocompleteBoundaryUtils)
|
|
import Constants from "Constants" /* 1085 */;
|
|
import ChannelAutocompleteConstants from "ChannelAutocompleteConstants" /* 5404 */;
|
|
import size from "module_2" /* 2 */;
|
|
|
|
let CHANNEL_SENTINEL;
|
|
let COMMAND_SENTINEL;
|
|
let EMOJI_SENTINEL;
|
|
let MENTION_SENTINEL;
|
|
let REACTION_START_SENTINEL;
|
|
function isAutocompleteSeparatingBoundary(c22, selectionStart) {
|
|
let isMatch = 0 === selectionStart || WHITESPACE_RE.test(c22[selectionStart - 1]);
|
|
if (!isMatch) {
|
|
const hasItem = null != tmp3 && set.has(tmp3);
|
|
isMatch = hasItem;
|
|
}
|
|
return isMatch;
|
|
}
|
|
function getAutocompleteToken(c22) {
|
|
let num = 0;
|
|
if (0 < c22.length) {
|
|
while (true) {
|
|
if (isAutocompleteSeparatingBoundary(c22, num)) {
|
|
for (const item10013 of closure_1) {
|
|
if (c22.startsWith(item10013, num)) {
|
|
let substr = c22.slice(num);
|
|
obj.return();
|
|
return substr;
|
|
}
|
|
}
|
|
}
|
|
num = num + 1;
|
|
}
|
|
}
|
|
return c22;
|
|
}
|
|
({ CHANNEL_SENTINEL, COMMAND_SENTINEL, EMOJI_SENTINEL, MENTION_SENTINEL, REACTION_START_SENTINEL } = ChannelAutocompleteConstants);
|
|
const WHITESPACE_RE = Constants.WHITESPACE_RE;
|
|
const items = [REACTION_START_SENTINEL, MENTION_SENTINEL, CHANNEL_SENTINEL, EMOJI_SENTINEL, COMMAND_SENTINEL];
|
|
let closure_1 = items.sort((arg0, arg1) => arg1.length - arg0.length);
|
|
const items1 = ["("];
|
|
const set = new Set(items1);
|
|
const result = size.fileFinishedImporting("modules/channel_autocomplete/AutocompleteBoundaryUtils.tsx");
|
|
|
|
export const AUTOCOMPLETE_BOUNDARY_CHARACTERS = items1;
|
|
export const AUTOCOMPLETE_BOUNDARY_CHARACTERS_SET = set;
|
|
export { isAutocompleteSeparatingBoundary };
|
|
export { getAutocompleteToken };
|
|
export const boundAutocompleteWord = function boundAutocompleteWord(c22, arr) {
|
|
arr = getAutocompleteToken(c22);
|
|
const diff = c22.length - arr.length;
|
|
const obj = { word: arr, fullWord: arr.slice(diff), didTrimPrefix: diff > 0 };
|
|
return obj;
|
|
};
|