-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #32 from CodeDead/release/2.1.0
Release/2.1.0
- Loading branch information
Showing
29 changed files
with
981 additions
and
581 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,3 +4,4 @@ node_modules | |
build | ||
src/serviceWorker.js | ||
README.md | ||
.eslintcache |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -33,3 +33,5 @@ dist/* | |
!.yarn/sdks | ||
!.yarn/versions | ||
.pnp.* | ||
|
||
.eslintcache |
This file was deleted.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,52 @@ | ||
import React from 'react'; | ||
import { Item, Menu, MenuProvider } from 'react-contexify'; | ||
import { Item, Menu, useContextMenu } from 'react-contexify'; | ||
import CopyIcon from '@material-ui/icons/FileCopy'; | ||
import PasteIcon from '@material-ui/icons/Assignment'; | ||
|
||
const CopyPasteMenu = ({ | ||
id, children, copyData, pasteData, copy, paste, | ||
}) => ( | ||
<> | ||
<MenuProvider id={`copyPasteMenu${id}`} style={{ width: '100%' }}> | ||
{children} | ||
</MenuProvider> | ||
<Menu id={`copyPasteMenu${id}`}> | ||
<Item onClick={() => copyData()}> | ||
<CopyIcon /> | ||
{' '} | ||
{copy} | ||
</Item> | ||
<Item onClick={() => pasteData()}> | ||
<PasteIcon /> | ||
{' '} | ||
{paste} | ||
</Item> | ||
</Menu> | ||
</> | ||
); | ||
}) => { | ||
const MENU_ID = `copyPasteMenu${id}`; | ||
|
||
const { show } = useContextMenu({ | ||
id: MENU_ID, | ||
}); | ||
|
||
/** | ||
* Handle the context menu event | ||
* @param event The event argument | ||
*/ | ||
const handleContextMenu = (event) => { | ||
event.preventDefault(); | ||
show(event, { | ||
props: { | ||
key: 'value', | ||
}, | ||
}); | ||
}; | ||
|
||
return ( | ||
<> | ||
<div | ||
style={{ width: '100%' }} | ||
onContextMenu={handleContextMenu} | ||
> | ||
{children} | ||
</div> | ||
<Menu id={MENU_ID}> | ||
<Item onClick={() => copyData()}> | ||
<CopyIcon /> | ||
{' '} | ||
{copy} | ||
</Item> | ||
<Item onClick={() => pasteData()}> | ||
<PasteIcon /> | ||
{' '} | ||
{paste} | ||
</Item> | ||
</Menu> | ||
</> | ||
); | ||
}; | ||
|
||
export default CopyPasteMenu; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.