diff --git a/package-lock.json b/package-lock.json index ccddf1960b39..dfa1bd878455 100644 --- a/package-lock.json +++ b/package-lock.json @@ -20947,19 +20947,18 @@ } }, "expensify-common": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/expensify-common/-/expensify-common-1.0.1.tgz", - "integrity": "sha512-QitZnBwJKSAPt+qpCMfuf8KFI3NxR0VU0r5h/92hox9p0Dv2bq1DS5dvRGNxQ9SxugtnSPk4YnKyRwKdRNcASQ==", + "version": "git://github.com/Expensify/expensify-common.git#c3465bf615390a2844087ec7f2343b0607ea484c", + "from": "git://github.com/Expensify/expensify-common.git#c3465bf615390a2844087ec7f2343b0607ea484c", "requires": { "classnames": "2.3.1", "clipboard": "2.0.4", "html-entities": "^1.3.1", - "jquery": "3.3.1", + "jquery": "3.6.0", "lodash": "4.17.21", "prop-types": "15.7.2", "react": "16.12.0", "react-dom": "16.12.0", - "semver": "^7.3.4", + "semver": "^7.3.5", "simply-deferred": "git+https://github.com/Expensify/simply-deferred.git#77a08a95754660c7bd6e0b6979fdf84e8e831bf5", "underscore": "1.13.1" }, @@ -20969,6 +20968,19 @@ "resolved": "https://registry.npmjs.org/classnames/-/classnames-2.3.1.tgz", "integrity": "sha512-OlQdbZ7gLfGarSqxesMesDa5uz7KFbID8Kpq/SxIoNGDqY8lSYs0D+hhtBXhcdB3rcbXArFr7vlHheLk1voeNA==" }, + "jquery": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/jquery/-/jquery-3.6.0.tgz", + "integrity": "sha512-JVzAR/AjBvVt2BmYhxRCSYysDsPcssdmTFnzyLEts9qNwmjmu4JTAMYubEfwVOSwpQ1I1sKKFcxhZCI2buerfw==" + }, + "lru-cache": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", + "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", + "requires": { + "yallist": "^4.0.0" + } + }, "react": { "version": "16.12.0", "resolved": "https://registry.npmjs.org/react/-/react-16.12.0.tgz", @@ -20990,10 +21002,23 @@ "scheduler": "^0.18.0" } }, + "semver": { + "version": "7.3.5", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.5.tgz", + "integrity": "sha512-PoeGJYh8HK4BTO/a9Tf6ZG3veo/A7ZVsYrSA6J8ny9nb3B1VrpkuN+z9OE5wfE5p6H4LchYZsegiQgbJD94ZFQ==", + "requires": { + "lru-cache": "^6.0.0" + } + }, "underscore": { "version": "1.13.1", "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.13.1.tgz", "integrity": "sha512-hzSoAVtJF+3ZtiFX0VgfFPHEDRm7Y/QPjGyNo4TVdnDTdft3tr8hEkD25a1jC+TjTuE7tkHGKkhwCgs9dgBB2g==" + }, + "yallist": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", + "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==" } } }, diff --git a/package.json b/package.json index a388bd8d524f..3bc019258382 100644 --- a/package.json +++ b/package.json @@ -58,7 +58,7 @@ "electron-log": "^4.3.5", "electron-serve": "^1.0.0", "electron-updater": "^4.3.4", - "expensify-common": "^1.0.1", + "expensify-common": "git://github.com/Expensify/expensify-common.git#c3465bf615390a2844087ec7f2343b0607ea484c", "file-loader": "^6.0.0", "html-entities": "^1.3.1", "lodash": "4.17.21", diff --git a/src/pages/home/report/ReportActionCompose.js b/src/pages/home/report/ReportActionCompose.js index ad70a94168f0..b61c30187a41 100755 --- a/src/pages/home/report/ReportActionCompose.js +++ b/src/pages/home/report/ReportActionCompose.js @@ -297,7 +297,7 @@ class ReportActionCompose extends React.Component { if (reportActionKey !== -1 && this.props.reportActions[reportActionKey]) { const {reportActionID, message} = this.props.reportActions[reportActionKey]; - saveReportActionDraft(this.props.reportID, reportActionID, _.last(message).text); + saveReportActionDraft(this.props.reportID, reportActionID, _.last(message).html); } } } diff --git a/src/pages/home/report/ReportActionContextMenu.js b/src/pages/home/report/ReportActionContextMenu.js index c38b8d7db847..fbaf88130cbb 100755 --- a/src/pages/home/report/ReportActionContextMenu.js +++ b/src/pages/home/report/ReportActionContextMenu.js @@ -147,13 +147,13 @@ class ReportActionContextMenu extends React.Component { } /** - * Gets the text (not HTML) portion of the message in an action. + * Gets the markdown version of the message in an action. * * @return {String} */ getActionText() { const message = _.last(lodashGet(this.props.reportAction, 'message', null)); - return lodashGet(message, 'text', ''); + return lodashGet(message, 'html', ''); } confirmDeleteAndHideModal() { diff --git a/src/pages/home/report/ReportActionItemMessageEdit.js b/src/pages/home/report/ReportActionItemMessageEdit.js index 2a7d49b5e2c8..9db04402951c 100644 --- a/src/pages/home/report/ReportActionItemMessageEdit.js +++ b/src/pages/home/report/ReportActionItemMessageEdit.js @@ -2,6 +2,7 @@ import React from 'react'; import {View} from 'react-native'; import PropTypes from 'prop-types'; import _ from 'underscore'; +import ExpensiMark from 'expensify-common/lib/ExpensiMark'; import ReportActionPropTypes from './ReportActionPropTypes'; import styles from '../../../styles/styles'; import TextInputFocusable from '../../../components/TextInputFocusable'; @@ -39,11 +40,14 @@ class ReportActionItemMessageEdit extends React.Component { this.triggerSaveOrCancel = this.triggerSaveOrCancel.bind(this); this.onSelectionChange = this.onSelectionChange.bind(this); + const parser = new ExpensiMark(); + const draftMessage = parser.htmlToMarkdown(this.props.draftMessage); + this.state = { - draft: this.props.draftMessage, + draft: draftMessage, selection: { - start: this.props.draftMessage.length, - end: this.props.draftMessage.length, + start: draftMessage.length, + end: draftMessage.length, }, }; } @@ -119,7 +123,7 @@ class ReportActionItemMessageEdit extends React.Component { ref={el => this.textInput = el} onChangeText={this.updateDraft} // Debounced saveDraftComment onKeyPress={this.triggerSaveOrCancel} - defaultValue={this.props.draftMessage} + defaultValue={this.state.draft} maxLines={16} // This is the same that slack has style={[styles.textInputCompose, styles.flex4]} onFocus={() => {