expensify-common 2.0.48 → 2.0.49
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/ExpensiMark.js +3 -3
- package/dist/components/form/element/combobox.js +1 -1
- package/dist/str.js +1 -1
- package/dist/utils.d.ts +3 -3
- package/dist/utils.js +4 -4
- package/package.json +1 -1
package/dist/ExpensiMark.js
CHANGED
|
@@ -724,7 +724,7 @@ class ExpensiMark {
|
|
|
724
724
|
*/
|
|
725
725
|
replace(text, { filterRules = [], shouldEscapeText = true, shouldKeepRawInput = false, disabledRules = [], extras = EXTRAS_DEFAULT } = {}) {
|
|
726
726
|
// This ensures that any html the user puts into the comment field shows as raw html
|
|
727
|
-
let replacedText = shouldEscapeText ? Utils.
|
|
727
|
+
let replacedText = shouldEscapeText ? Utils.escapeText(text) : text;
|
|
728
728
|
const rules = this.getHtmlRuleset(filterRules, disabledRules, shouldKeepRawInput);
|
|
729
729
|
const processRule = (rule) => {
|
|
730
730
|
// Pre-process text before applying regex
|
|
@@ -749,7 +749,7 @@ class ExpensiMark {
|
|
|
749
749
|
catch (e) {
|
|
750
750
|
ExpensiMark.Log.alert('Error replacing text with html in ExpensiMark.replace', { error: e });
|
|
751
751
|
// We want to return text without applying rules if exception occurs during replacing
|
|
752
|
-
return shouldEscapeText ? Utils.
|
|
752
|
+
return shouldEscapeText ? Utils.escapeText(text) : text;
|
|
753
753
|
}
|
|
754
754
|
return replacedText;
|
|
755
755
|
}
|
|
@@ -1099,7 +1099,7 @@ class ExpensiMark {
|
|
|
1099
1099
|
// When the attribute contains HTML and is converted back to MD we need to re-escape it to avoid
|
|
1100
1100
|
// illegal attribute value characters like `," or ' which might break the HTML
|
|
1101
1101
|
originalContent = str_1.default.replaceAll(originalContent, '\n', '');
|
|
1102
|
-
return Utils.
|
|
1102
|
+
return Utils.escapeText(originalContent);
|
|
1103
1103
|
}
|
|
1104
1104
|
/**
|
|
1105
1105
|
* Determines the end position to truncate the HTML content while considering word boundaries.
|
|
@@ -795,7 +795,7 @@ class Combobox extends react_1.default.Component {
|
|
|
795
795
|
};
|
|
796
796
|
const toggleBtnClasses = this.props.bs4 ? 'dropdown-toggle dropdown-toggle-split btn btn-outline-primary' : 'dropdown-toggle btn btn-default';
|
|
797
797
|
return (react_1.default.createElement("div", { className: (0, classnames_1.default)(inputGroupClasses, this.props.extraClasses), onKeyDown: this.handleKeyDown, role: "presentation" },
|
|
798
|
-
react_1.default.createElement("input", { ref: (ref) => (this.value = ref), type: "text", className: (0, classnames_1.default)(['form-control', { error: this.state.hasError }]), disabled: this.state.isDisabled, "aria-label": "...", onChange: this.performSearch, onKeyDown: this.closeDropdownOnTabOut, value: this.props.propertyToDisplay === 'value' ? Utils.
|
|
798
|
+
react_1.default.createElement("input", { ref: (ref) => (this.value = ref), type: "text", className: (0, classnames_1.default)(['form-control', { error: this.state.hasError }]), disabled: this.state.isDisabled, "aria-label": "...", onChange: this.performSearch, onKeyDown: this.closeDropdownOnTabOut, value: this.props.propertyToDisplay === 'value' ? Utils.unescapeText(this.state.currentValue) : Utils.unescapeText(this.state.currentText.replace(/ /g, '')), onFocus: this.openDropdown, autoComplete: "off", placeholder: this.props.placeholder, tabIndex: "0" }),
|
|
799
799
|
react_1.default.createElement("div", { className: (0, classnames_1.default)(inputGroupBtnClasses) },
|
|
800
800
|
react_1.default.createElement("button", { type: "button", className: (0, classnames_1.default)(toggleBtnClasses, { error: this.state.hasError }), disabled: this.state.isDisabled, onClick: this.toggleDropdown, onKeyDown: this.closeDropdownOnTabOut, tabIndex: "-1" },
|
|
801
801
|
!this.props.bs4 && react_1.default.createElement("span", { className: "caret" }),
|
package/dist/str.js
CHANGED
package/dist/utils.d.ts
CHANGED
|
@@ -7,14 +7,14 @@ declare function isNavigatorAvailable(): boolean;
|
|
|
7
7
|
* corresponding HTML entities.
|
|
8
8
|
* Source: https://github.com/lodash/lodash/blob/main/src/escape.ts
|
|
9
9
|
*/
|
|
10
|
-
declare function
|
|
10
|
+
declare function escapeText(string: string): string;
|
|
11
11
|
/**
|
|
12
12
|
* The inverse of `escape`this method converts the HTML entities
|
|
13
13
|
* `&`, `<`, `>`, `"` and `'` in `string` to
|
|
14
14
|
* their corresponding characters.
|
|
15
15
|
* Source: https://github.com/lodash/lodash/blob/main/src/unescape.ts
|
|
16
16
|
* */
|
|
17
|
-
declare function
|
|
17
|
+
declare function unescapeText(string: string): string;
|
|
18
18
|
/**
|
|
19
19
|
* Checks if the given variable is a function
|
|
20
20
|
* @param {*} variableToCheck
|
|
@@ -27,4 +27,4 @@ declare function isFunction(variableToCheck: unknown): boolean;
|
|
|
27
27
|
* @returns {boolean}
|
|
28
28
|
*/
|
|
29
29
|
declare function isObject(obj: unknown): boolean;
|
|
30
|
-
export { isWindowAvailable, isNavigatorAvailable,
|
|
30
|
+
export { isWindowAvailable, isNavigatorAvailable, escapeText, unescapeText, isFunction, isObject };
|
package/dist/utils.js
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.isWindowAvailable = isWindowAvailable;
|
|
4
4
|
exports.isNavigatorAvailable = isNavigatorAvailable;
|
|
5
|
-
exports.
|
|
6
|
-
exports.
|
|
5
|
+
exports.escapeText = escapeText;
|
|
6
|
+
exports.unescapeText = unescapeText;
|
|
7
7
|
exports.isFunction = isFunction;
|
|
8
8
|
exports.isObject = isObject;
|
|
9
9
|
/** Checks if the `window` global object is available. */
|
|
@@ -29,7 +29,7 @@ const reHasUnescapedHtml = RegExp(reUnescapedHtml.source);
|
|
|
29
29
|
* corresponding HTML entities.
|
|
30
30
|
* Source: https://github.com/lodash/lodash/blob/main/src/escape.ts
|
|
31
31
|
*/
|
|
32
|
-
function
|
|
32
|
+
function escapeText(string) {
|
|
33
33
|
return string && reHasUnescapedHtml.test(string) ? string.replace(reUnescapedHtml, (chr) => htmlEscapes[chr]) : string || '';
|
|
34
34
|
}
|
|
35
35
|
const htmlUnescapes = {
|
|
@@ -49,7 +49,7 @@ const reHasEscapedHtml = RegExp(reEscapedHtml.source);
|
|
|
49
49
|
* their corresponding characters.
|
|
50
50
|
* Source: https://github.com/lodash/lodash/blob/main/src/unescape.ts
|
|
51
51
|
* */
|
|
52
|
-
function
|
|
52
|
+
function unescapeText(string) {
|
|
53
53
|
return string && reHasEscapedHtml.test(string) ? string.replace(reEscapedHtml, (entity) => htmlUnescapes[entity] || "'") : string || '';
|
|
54
54
|
}
|
|
55
55
|
/**
|