diff --git a/README.md b/README.md index 58e301a..8d60655 100644 --- a/README.md +++ b/README.md @@ -2,15 +2,16 @@ A free and open source command snippets manager for organize and copy fast. -Forked from [gurayyarar/SnipCommand](https://github.com/gurayyarar/SnipCommand). +Forked from [gurayyarar/SnipCommand](https://github.com/gurayyarar/SnipCommand) and added some new features. ## Releases -Visit the [this link](https://github.com/rotten77/SnipCommand/releases) +* [rotten77 / SnipCommand 0.1.3](https://github.com/rotten77/SnipCommand/releases/tag/v0.1.3) + * New: Autoclose (File > Preferences > Settings) * [rotten77 / SnipCommand 0.1.2](https://github.com/rotten77/SnipCommand/releases/tag/v0.1.2) - * New: Autocopy settings (File > Preferences >Settings) + * New: Autocopy settings (File > Preferences > Settings) * Fix: Long string breaks design diff --git a/documentation/CHANGELOGS.md b/documentation/CHANGELOGS.md index 96e2056..29d01f4 100644 --- a/documentation/CHANGELOGS.md +++ b/documentation/CHANGELOGS.md @@ -1,5 +1,11 @@ # CHANGELOGS +### v0.1.3 +**October 7, 2021** + +- New: Autoclose (File > Preferences >Settings) + + ### v0.1.2 **October 5, 2021** diff --git a/package.json b/package.json index 906ad5f..21663fc 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "snipcommand", - "version": "0.1.2", + "version": "0.1.3", "description": "A free and open source command snippets manager for organize and copy fast.", "private": true, "main": "public/electron.js", @@ -11,23 +11,23 @@ "@testing-library/react": "^9.3.2", "@testing-library/user-event": "^7.1.2", "electron-is-dev": "^1.2.0", - "electron-store": "^6.0.0", - "generate-password": "^1.5.1", + "electron-store": "^6.0.1", + "generate-password": "^1.6.1", "lodash": "^4.17.19", "lowdb": "^1.0.0", - "markdown-it": "^11.0.0", - "moment": "^2.27.0", + "markdown-it": "^11.0.1", + "moment": "^2.29.1", "node-sass": "^4.14.1", - "noty": "^3.2.0-beta", + "noty": "^3.2.0-beta-deprecated", "prop-types": "^15.7.2", - "react": "^16.13.1", - "react-dom": "^16.13.1", - "react-markdown-editor-lite": "^1.2.2", - "react-redux": "^7.2.0", + "react": "^16.14.0", + "react-dom": "^16.14.0", + "react-markdown-editor-lite": "^1.3.1", + "react-redux": "^7.2.5", "react-scripts": "3.4.1", - "redux": "^4.0.5", + "redux": "^4.1.1", "redux-thunk": "^2.3.0", - "shortid": "^2.2.15" + "shortid": "^2.2.16" }, "scripts": { "start": "rescripts start", @@ -56,11 +56,11 @@ "@rescripts/cli": "^0.0.14", "@rescripts/rescript-env": "^0.0.12", "concurrently": "^5.2.0", - "cross-env": "^7.0.2", - "electron": "^9.1.0", - "electron-builder": "^22.7.0", - "typescript": "^3.9.7", - "wait-on": "^5.1.0" + "cross-env": "^7.0.3", + "electron": "^9.4.4", + "electron-builder": "^22.11.7", + "typescript": "^3.9.10", + "wait-on": "^5.3.0" }, "keywords": [ "command", @@ -124,7 +124,9 @@ }, "linux": { "icon": "public/images/logo/snip_command.png", - "target": ["AppImage"] + "target": [ + "AppImage" + ] } } -} \ No newline at end of file +} diff --git a/src/components/CommandListItem/index.js b/src/components/CommandListItem/index.js index d5e19ca..22c2e1d 100644 --- a/src/components/CommandListItem/index.js +++ b/src/components/CommandListItem/index.js @@ -26,6 +26,7 @@ class CommandListItem extends Component { const {item} = this.props; const {formValues} = this.state; let onClickAction = StorageHelpers.preference.get('onClickAction'); + let autoClose = StorageHelpers.preference.get('autoClose'); if(item.command.match(new RegExp(`\\[s\\s*(.*?)\\s*\\/]`, 'g'))) { onClickAction = 'open'; @@ -35,6 +36,11 @@ class CommandListItem extends Component { const willCopyVal = CommandHelpers.replacedCommand(item.command, formValues); clipboard.writeText(willCopyVal); NotyHelpers.open('The command copied your clipboard!', 'info', 3000); + + if(autoClose === true) { + const { remote } = require('electron') + remote.BrowserWindow.getFocusedWindow().minimize(); + } } else { this.setState({showGeneratorModal: true}); } diff --git a/src/components/SettingsModal/index.js b/src/components/SettingsModal/index.js index 77a2b50..fb541eb 100644 --- a/src/components/SettingsModal/index.js +++ b/src/components/SettingsModal/index.js @@ -19,7 +19,8 @@ class SettingsModal extends React.Component { backupDirectory: '', backupFiles: [], appTheme: 'light', - onClickAction: 'open' + onClickAction: 'open', + autoClose: false } componentDidMount() { @@ -27,7 +28,8 @@ class SettingsModal extends React.Component { const backupDirectory = StorageHelpers.preference.get('backupPath'); const appTheme = StorageHelpers.preference.get('appTheme') || 'light'; const onClickAction = StorageHelpers.preference.get('onClickAction') || 'open'; - this.setState({dbDirectory, backupDirectory, appTheme, onClickAction}); + const autoClose = StorageHelpers.preference.get('autoClose') || false; + this.setState({dbDirectory, backupDirectory, appTheme, onClickAction, autoClose}); this.listBackupFiles(); } @@ -121,8 +123,13 @@ class SettingsModal extends React.Component { this.setState({onClickAction}); } + changeAutoClose = autoClose => { + StorageHelpers.preference.set('autoClose', autoClose); + this.setState({autoClose}); + } + render() { - const {dbDirectory, backupDirectory, backupFiles, appTheme, onClickAction} = this.state; + const {dbDirectory, backupDirectory, backupFiles, appTheme, onClickAction, autoClose} = this.state; const {show, onClose, selectedTab} = this.props; return ( @@ -273,7 +280,7 @@ class SettingsModal extends React.Component {