Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate ReportActionCompose to function #18648

Merged
Show file tree
Hide file tree
Changes from 79 commits
Commits
Show all changes
111 commits
Select commit Hold shift + click to select a range
f846039
refactor: in-progress - migrate ReportActionCompose from class to fun…
stas-kravchuk May 5, 2023
fc5bab7
refactor: in-progress - add few comments, minor changes in callbacks …
stas-kravchuk May 8, 2023
0711917
refactor: WIP - move few functions out of component, replace some use…
stas-kravchuk May 8, 2023
c116987
refactor: WIP - move code from ReportActionComposeF to ReportAction c…
stas-kravchuk May 8, 2023
25707c5
refactor: WIP - remove prevProps useref - replace it with useffect lo…
stas-kravchuk May 9, 2023
6225871
refactor: rewrite few const and callback to useMemo
stas-kravchuk May 9, 2023
8e51311
merge main into branch
stas-kravchuk May 10, 2023
df2c91a
refactor: prettier changes, moved onDrop event to separate useCallback
stas-kravchuk May 10, 2023
56d8f98
merge main into branch
stas-kravchuk May 11, 2023
57cec6a
merge main into branch
stas-kravchuk May 11, 2023
d4812a9
fix: return personalDetails onyx prop after merge conflict fix
stas-kravchuk May 11, 2023
bc662c0
fix: fix bug with ENTER press when suggestions exist, prettier style fix
stas-kravchuk May 15, 2023
83c3339
merge main into branch
stas-kravchuk May 15, 2023
fcc9b09
refactor: change isEmptyChat to useMemo from useCallback
stas-kravchuk May 16, 2023
5fba379
merge main into branch
stas-kravchuk May 16, 2023
c974548
Merge branch 'main' into @stas-kravchuk/16263-migrate-reportactioncom…
May 25, 2023
fde9665
Merge branch 'main' into @stas-kravchuk/16263-migrate-reportactioncom…
May 26, 2023
d7ad673
fix: import
May 26, 2023
fd5fdf9
use "useKeyboardShortcut" instead of manually subscribing
May 26, 2023
5a66c1e
simplify arrow key handling
May 26, 2023
f819841
Merge branch 'main' into @stas-kravchuk/16263-migrate-reportactioncom…
Jun 1, 2023
72c6834
fix: 2 minor issues
Jun 1, 2023
f87612c
Merge branch 'main' into @stas-kravchuk/16263-migrate-reportactioncom…
Jun 2, 2023
2d9e18c
Merge branch 'main' into @stas-kravchuk/16263-migrate-reportactioncom…
Jun 6, 2023
cf07829
Merge branch 'main' into @stas-kravchuk/16263-migrate-reportactioncom…
Jun 11, 2023
bd7a73f
fix: remaining issues
Jun 11, 2023
7d16b75
add remaining hook dependencies
Jun 11, 2023
5f3035a
fix: prettier
Jun 11, 2023
c268868
Merge branch 'main' into @stas-kravchuk/16263-migrate-reportactioncom…
Jun 13, 2023
a88f2ec
Merge branch 'main' into @stas-kravchuk/16263-migrate-reportactioncom…
Jun 14, 2023
f49c7f4
Merge branch 'main' into @stas-kravchuk/16263-migrate-reportactioncom…
Jun 17, 2023
09850e3
Merge branch 'main' into @stas-kravchuk/16263-migrate-reportactioncom…
Jun 19, 2023
ad7f2be
extract translate from props
Jun 19, 2023
173addb
fix: minor issues
Jun 19, 2023
5ef0e1f
remove useKeyboardShortcut import
Jun 19, 2023
c123090
update conciergePlaceholderRandomIndex only on mount
Jun 19, 2023
7bb3469
fix: emoji suggestions
Jun 19, 2023
db011b0
Merge branch 'main' into @stas-kravchuk/16263-migrate-reportactioncom…
Jun 21, 2023
2311b4e
Merge branch 'main' into @stas-kravchuk/16263-migrate-reportactioncom…
Jun 21, 2023
848a027
fix: useArrowKeyFocusManager not working
Jun 21, 2023
af90cc0
make consistent with main
Jun 21, 2023
0c3ab67
fix: mentions not working in multiline
Jun 21, 2023
dfb1c97
Merge branch 'main' into @stas-kravchuk/16263-migrate-reportactioncom…
Jun 26, 2023
d601305
Merge branch 'main' into @stas-kravchuk/16263-migrate-reportactioncom…
Jun 26, 2023
a4d8299
Merge branch 'main' into @stas-kravchuk/16263-migrate-reportactioncom…
Jul 2, 2023
6e79e69
fix wrong prop
Jul 2, 2023
1a9f97f
update package-lock
Jul 2, 2023
1e002f9
fix: arrow up to edit not working
Jul 2, 2023
33bc4f6
Merge branch 'main' into @stas-kravchuk/16263-migrate-reportactioncom…
Jul 6, 2023
f4898d2
Merge branch 'main' into @stas-kravchuk/16263-migrate-reportactioncom…
Jul 9, 2023
f098e23
Merge branch 'main' into @stas-kravchuk/16263-migrate-reportactioncom…
chrispader Jul 11, 2023
4543b2c
fix: dependency array
chrispader Jul 11, 2023
b96ec4b
Merge branch 'main' into @stas-kravchuk/16263-migrate-reportactioncom…
Jul 12, 2023
6305d82
Merge branch 'main' into @stas-kravchuk/16263-migrate-reportactioncom…
chrispader Jul 17, 2023
5b99dc1
Merge branch 'main' into @stas-kravchuk/16263-migrate-reportactioncom…
chrispader Jul 18, 2023
d88ff5c
Merge branch 'main' into @stas-kravchuk/16263-migrate-reportactioncom…
chrispader Jul 25, 2023
e616e17
fix: usePrevious calls
chrispader Jul 25, 2023
5c8b6c4
Merge branch 'main' into @stas-kravchuk/16263-migrate-reportactioncom…
chrispader Jul 27, 2023
7a77a84
Merge branch 'main' into @stas-kravchuk/16263-migrate-reportactioncom…
Aug 2, 2023
d8572d5
Merge branch 'main' into @stas-kravchuk/16263-migrate-reportactioncom…
Aug 4, 2023
722c10c
fix: use prop destructuring
Aug 4, 2023
da53e91
Merge branch 'main' into @stas-kravchuk/16263-migrate-reportactioncom…
Aug 5, 2023
a1e5357
fix: commentRef value not referenced
Aug 5, 2023
9dfa881
remove console.log
Aug 5, 2023
e57c373
MacOS: Add 'Paste as Plain Text' to context menu
ygshbht Aug 1, 2023
8c31352
MacOS: Update keyboard shortcuts for paste operations in context menu
ygshbht Aug 1, 2023
0093a43
MacOS: Add accelerator for 'Paste and Match Style' in app menu
ygshbht Aug 1, 2023
db8ffb4
Desktop: Add 'Paste as Plain Text' to macOS Edit menu with translations
ygshbht Aug 1, 2023
19dad62
Desktop: Change hardcoded accelerator for pasteAsPlainText to a constant
ygshbht Aug 1, 2023
4aa33f6
Lint code: Apply suggestions from code review
ygshbht Aug 2, 2023
c5c945f
More code linting
ygshbht Aug 2, 2023
4eabbd6
Desktop: Update accelerator for 'Paste and Match Style' to use constant
ygshbht Aug 2, 2023
0f73e30
Desktop: Refactor - Extract 'paste as plain text' logic to separate f…
ygshbht Aug 2, 2023
bf8d375
Update 'Paste as Plain Text' menu item visibility and action
ygshbht Aug 2, 2023
5ef5915
Desktop: Add constant for 'Paste as Plain Text' menu item ID
ygshbht Aug 2, 2023
c394e65
Desktop: Refactoring
ygshbht Aug 3, 2023
1c788be
Desktop: Formatting
ygshbht Aug 3, 2023
160e0eb
fix: Wrong position of emoji picker modal
Krishna2323 Aug 3, 2023
412484a
apply changes from #19011
Aug 6, 2023
db130a3
Merge branch 'main' of github.com:Expensify/App into @stas-kravchuk/1…
hannojg Aug 8, 2023
1d7400e
fix issues after merge
hannojg Aug 8, 2023
47298d4
fix ref usage
hannojg Aug 8, 2023
937fa8e
Merge branch 'main' of github.com:Expensify/App into @stas-kravchuk/1…
hannojg Aug 10, 2023
5b96e67
reapply https://github.com/Expensify/App/pull/24223
hannojg Aug 10, 2023
16e5d87
Merge branch 'main' of github.com:Expensify/App into @stas-kravchuk/1…
hannojg Aug 11, 2023
090dde9
fix send button styles
hannojg Aug 11, 2023
23dafce
fix re-focus once modal closes
hannojg Aug 11, 2023
c203ccf
reset index to zero
hannojg Aug 11, 2023
6a2af57
remove debug statement
hannojg Aug 11, 2023
b57d8cb
fix comment darft tab synchronisation
hannojg Aug 11, 2023
5dbb34f
Merge branch 'main' of github.com:Expensify/App into @stas-kravchuk/1…
hannojg Aug 11, 2023
bddc3fb
reapply https://github.com/Expensify/App/pull/23258
hannojg Aug 11, 2023
56a64a3
Merge branch 'main' of github.com:Expensify/App into @stas-kravchuk/1…
hannojg Aug 15, 2023
8554863
reapply https://github.com/Expensify/App/commit/1b9d86952111f755d5fe6…
hannojg Aug 15, 2023
e209754
reset emoji index, fix crash
hannojg Aug 15, 2023
2671883
Update src/pages/home/report/ReportActionCompose.js
hannojg Aug 15, 2023
479f317
rename callback
hannojg Aug 15, 2023
cd6d115
remove deprecated comment
hannojg Aug 15, 2023
a96be82
remove redundant code
hannojg Aug 15, 2023
dc4ceea
clearer naming
hannojg Aug 15, 2023
a6c309e
remove debounce from showPopoverMenu
hannojg Aug 15, 2023
6d30eb2
Update src/pages/home/report/ReportActionCompose.js
Szymon20000 Aug 17, 2023
cbfb26b
Merge branch 'main' into @stas-kravchuk/16263-migrate-reportactioncom…
Szymon20000 Aug 17, 2023
3918f84
Update ReportActionCompose.js
Szymon20000 Aug 17, 2023
e11f6e4
Update ReportActionCompose.js
Szymon20000 Aug 17, 2023
6c40eb1
prettier signed
Aug 17, 2023
af0ea24
Update src/pages/home/report/ReportActionCompose.js
Szymon20000 Aug 17, 2023
d32859c
Merge remote-tracking branch 'origin/main' into @stas-kravchuk/16263-…
Szymon20000 Aug 18, 2023
0fd1d9d
linting
Szymon20000 Aug 18, 2023
db53793
linting
Szymon20000 Aug 18, 2023
cea152b
linting 3
Szymon20000 Aug 18, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 30 additions & 4 deletions desktop/main.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const {app, dialog, BrowserWindow, Menu, MenuItem, shell, ipcMain} = require('electron');
const {app, dialog, clipboard, BrowserWindow, Menu, MenuItem, shell, ipcMain} = require('electron');
const _ = require('underscore');
const serve = require('electron-serve');
const contextMenu = require('electron-context-menu');
Expand All @@ -12,6 +12,7 @@ const CONST = require('../src/CONST').default;
const Localize = require('../src/libs/Localize');

const port = process.env.PORT || 8080;
const {DESKTOP_SHORTCUT_ACCELERATOR} = CONST;

app.setName('New Expensify');

Expand All @@ -25,16 +26,32 @@ app.setName('New Expensify');
// See: https://github.com/electron/electron/issues/22597
app.commandLine.appendSwitch('enable-network-information-downlink-max');

/**
* Inserts the plain text from the clipboard into the provided browser window's web contents.
*
* @param {BrowserWindow} browserWindow - The Electron BrowserWindow instance where the text should be inserted.
*/
function pasteAsPlainText(browserWindow) {
const text = clipboard.readText();
browserWindow.webContents.insertText(text);
}

// Initialize the right click menu
// See https://github.com/sindresorhus/electron-context-menu
// Add the Paste and Match Style command to the context menu
contextMenu({
append: (defaultActions, parameters) => [
append: (defaultActions, parameters, browserWindow) => [
new MenuItem({
// Only enable the menu item for Editable context which supports paste
visible: parameters.isEditable && parameters.editFlags.canPaste,
role: 'pasteAndMatchStyle',
accelerator: 'CmdOrCtrl+Shift+V',
accelerator: DESKTOP_SHORTCUT_ACCELERATOR.PASTE_AND_MATCH_STYLE,
}),
new MenuItem({
label: Localize.translate(CONST.LOCALES.DEFAULT, 'desktopApplicationMenu.pasteAsPlainText'),
visible: parameters.isEditable && parameters.editFlags.canPaste && clipboard.readText().length > 0,
accelerator: DESKTOP_SHORTCUT_ACCELERATOR.PASTE_AS_PLAIN_TEXT,
click: () => pasteAsPlainText(browserWindow),
}),
],
});
Expand Down Expand Up @@ -323,7 +340,16 @@ const mainWindow = () => {
{id: 'cut', role: 'cut'},
{id: 'copy', role: 'copy'},
{id: 'paste', role: 'paste'},
{id: 'pasteAndMatchStyle', role: 'pasteAndMatchStyle'},
{
id: 'pasteAndMatchStyle',
role: 'pasteAndMatchStyle',
accelerator: DESKTOP_SHORTCUT_ACCELERATOR.PASTE_AND_MATCH_STYLE,
},
{
id: 'pasteAsPlainText',
accelerator: DESKTOP_SHORTCUT_ACCELERATOR.PASTE_AS_PLAIN_TEXT,
click: () => pasteAsPlainText(browserWindow),
},
{id: 'delete', role: 'delete'},
{id: 'selectAll', role: 'selectAll'},
{type: 'separator'},
Expand Down
5 changes: 5 additions & 0 deletions src/CONST.js
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,11 @@ const CONST = {
MAX_AGE: 150,
},

DESKTOP_SHORTCUT_ACCELERATOR: {
PASTE_AND_MATCH_STYLE: 'Option+Shift+CmdOrCtrl+V',
PASTE_AS_PLAIN_TEXT: 'CmdOrCtrl+Shift+V',
},

// This is used to enable a rotation/transform style to any component.
DIRECTION: {
LEFT: 'left',
Expand Down
6 changes: 3 additions & 3 deletions src/components/EmojiPicker/EmojiPicker.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ const EmojiPicker = forwardRef((props, ref) => {
vertical: 0,
});
const [reportAction, setReportAction] = useState({});
const emojiPopoverAnchorOrigin = useRef(DEFAULT_ANCHOR_ORIGIN);
const [emojiPopoverAnchorOrigin, setEmojiPopoverAnchorOrigin] = useState(DEFAULT_ANCHOR_ORIGIN);
const emojiPopoverAnchor = useRef(null);
const onModalHide = useRef(() => {});
const onEmojiSelected = useRef(() => {});
Expand Down Expand Up @@ -58,7 +58,7 @@ const EmojiPicker = forwardRef((props, ref) => {
onWillShow();
setIsEmojiPickerVisible(true);
setEmojiPopoverAnchorPosition(value);
emojiPopoverAnchorOrigin.current = anchorOrigin || DEFAULT_ANCHOR_ORIGIN;
setEmojiPopoverAnchorOrigin(anchorOrigin || DEFAULT_ANCHOR_ORIGIN);
setReportAction(reportActionValue);
});
};
Expand Down Expand Up @@ -161,7 +161,7 @@ const EmojiPicker = forwardRef((props, ref) => {
width: CONST.EMOJI_PICKER_SIZE.WIDTH,
height: CONST.EMOJI_PICKER_SIZE.HEIGHT,
}}
anchorAlignment={emojiPopoverAnchorOrigin.current}
anchorAlignment={emojiPopoverAnchorOrigin}
outerStyle={StyleUtils.getOuterModalStyle(props.windowHeight, props.viewportOffsetTop)}
innerContainerStyle={styles.popoverInnerContainer}
avoidKeyboard
Expand Down
1 change: 1 addition & 0 deletions src/languages/en.js
Original file line number Diff line number Diff line change
Expand Up @@ -1427,6 +1427,7 @@ export default {
copy: 'Copy',
paste: 'Paste',
pasteAndMatchStyle: 'Paste and Match Style',
pasteAsPlainText: 'Paste as Plain Text',
delete: 'Delete',
selectAll: 'Select All',
speechSubmenu: 'Speech',
Expand Down
1 change: 1 addition & 0 deletions src/languages/es.js
Original file line number Diff line number Diff line change
Expand Up @@ -1438,6 +1438,7 @@ export default {
copy: 'Copiar',
paste: 'Pegar',
pasteAndMatchStyle: 'Pegar adaptando el estilo',
pasteAsPlainText: 'Pegar como texto sin formato',
delete: 'Eliminar',
selectAll: 'Seleccionar todo',
speechSubmenu: 'Voz',
Expand Down
Loading
Loading