-
Notifications
You must be signed in to change notification settings - Fork 166
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into u/jisong/keyboardenter
- Loading branch information
Showing
33 changed files
with
700 additions
and
307 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
42 changes: 42 additions & 0 deletions
42
demo/scripts/controlsV2/sidePane/editorOptions/ExperimentalFeatures.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,42 @@ | ||
import * as React from 'react'; | ||
import { ExperimentalFeature } from 'roosterjs-content-model-types'; | ||
import { OptionState } from './OptionState'; | ||
|
||
export interface DefaultFormatProps { | ||
state: OptionState; | ||
resetState: (callback: (state: OptionState) => void, resetEditor: boolean) => void; | ||
} | ||
|
||
export class ExperimentalFeatures extends React.Component<DefaultFormatProps, {}> { | ||
render() { | ||
return this.renderFeature('PersistCache'); | ||
} | ||
|
||
private renderFeature(featureName: ExperimentalFeature): JSX.Element { | ||
let checked = this.props.state.experimentalFeatures.has(featureName); | ||
|
||
return ( | ||
<div> | ||
<input | ||
type="checkbox" | ||
id={featureName} | ||
checked={checked} | ||
onChange={() => this.onFeatureClick(featureName)} | ||
/> | ||
<label htmlFor={featureName}>{featureName}</label> | ||
</div> | ||
); | ||
} | ||
|
||
private onFeatureClick = (featureName: ExperimentalFeature) => { | ||
this.props.resetState(state => { | ||
let checkbox = document.getElementById(featureName) as HTMLInputElement; | ||
|
||
if (checkbox.checked) { | ||
state.experimentalFeatures.add(featureName); | ||
} else { | ||
state.experimentalFeatures.delete(featureName); | ||
} | ||
}, true); | ||
}; | ||
} |
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.