This repository has been archived by the owner on Jul 12, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 236
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add option for disabling spellcheck (#87)
- Loading branch information
1 parent
42767a2
commit ecf66cc
Showing
12 changed files
with
117 additions
and
3 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
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
35 changes: 35 additions & 0 deletions
35
...renderer/components/overlays/pref-overlay/entries-pref/spellcheck-pref/SpellcheckPref.tsx
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 |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import React, { ReactElement } from "react"; | ||
|
||
import { translations } from "../../../../../utils/i18n"; | ||
|
||
export interface StateProps { | ||
enableSpellcheck: boolean; | ||
} | ||
|
||
export interface DispatchProps { | ||
updateSpellcheckPref: (enableSpellcheck: boolean) => void; | ||
} | ||
|
||
type Props = StateProps & DispatchProps; | ||
|
||
/** | ||
* Preference fieldset for enabling or disabling spellcheck | ||
*/ | ||
export default function SpellcheckPref(props: Props): ReactElement { | ||
const { enableSpellcheck, updateSpellcheckPref } = props; | ||
|
||
const toggleEnableSpellcheck = (): void => updateSpellcheckPref(!enableSpellcheck); | ||
|
||
return ( | ||
<label htmlFor="checkbox-spellcheck"> | ||
<input | ||
type="checkbox" | ||
name="checkbox-spellcheck" | ||
id="checkbox-spellcheck" | ||
checked={enableSpellcheck} | ||
onChange={toggleEnableSpellcheck} | ||
/> | ||
{translations["enable-spellcheck"]} | ||
</label> | ||
); | ||
} |
16 changes: 16 additions & 0 deletions
16
...components/overlays/pref-overlay/entries-pref/spellcheck-pref/SpellcheckPrefContainer.tsx
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 |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import { connect } from "react-redux"; | ||
|
||
import { updateSpellcheckPref } from "../../../../../store/app/actionCreators"; | ||
import { RootState, ThunkDispatchT } from "../../../../../store/store"; | ||
import SpellcheckPref, { DispatchProps, StateProps } from "./SpellcheckPref"; | ||
|
||
const mapStateToProps = (state: RootState): StateProps => ({ | ||
enableSpellcheck: state.app.enableSpellcheck, | ||
}); | ||
|
||
const mapDispatchToProps = (dispatch: ThunkDispatchT): DispatchProps => ({ | ||
updateSpellcheckPref: (enableSpellcheck: boolean): void => | ||
dispatch(updateSpellcheckPref(enableSpellcheck)), | ||
}); | ||
|
||
export default connect(mapStateToProps, mapDispatchToProps)(SpellcheckPref); |
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