Update dialog flow and logic.

This commit is contained in:
Kenshin 2017-01-11 12:09:22 +08:00
parent aa658e43bf
commit 0b2ffda0f2

View File

@ -22,7 +22,7 @@ export default class Dialog extends React.Component {
// save dialog focus option
save() {
console.log( "dialog click submit button.", storage.current )
storage.Set( STORAGE_MODE.focus );
storage.Set( storage.current.mode );
chrome.runtime.sendMessage({ type: "shortcuts" });
new Notify().Render( 0, "更新成功!" );
this.close( false );
@ -33,9 +33,7 @@ export default class Dialog extends React.Component {
}
render() {
let Option;
if ( this.props.type == STORAGE_MODE.focus ) Option = FocusOpt;
else Option = ReadOpt;
const Option = this.props.type == STORAGE_MODE.focus ? FocusOpt : ReadOpt;
return (
<sr-dialog>
<sr-dialog-content>
@ -58,7 +56,7 @@ export default class Dialog extends React.Component {
* Roll back when cancel button click
*/
function rollback() {
storage.Restore( STORAGE_MODE.focus );
storage.Restore( storage.current.mode );
$( ".ks-simpread-bg" ).css({ "background-color" : storage.current.bgcolor });
}