Skip to content

Commit

Permalink
Use a separate experimental feature for Enter key (#2811)
Browse files Browse the repository at this point in the history
Co-authored-by: Bryan Valverde U <[email protected]>
  • Loading branch information
JiuqingSong and BryanValverdeU authored Sep 27, 2024
1 parent 33531e1 commit 12d27df
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ const initialState: OptionState = {
handleTabKey: true,
},
customReplacements: emojiReplacements,
experimentalFeatures: new Set<ExperimentalFeature>(['PersistCache']),
experimentalFeatures: new Set<ExperimentalFeature>(['PersistCache', 'HandleEnterKey']),
};

export class EditorOptionsPlugin extends SidePanePluginImpl<OptionsPane, OptionPaneProps> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,13 @@ export interface DefaultFormatProps {

export class ExperimentalFeatures extends React.Component<DefaultFormatProps, {}> {
render() {
return this.renderFeature('PersistCache');
return (
<>
{this.renderFeature('PersistCache')}
{this.renderFeature('HandleEnterKey')}
{this.renderFeature('LegacyImageSelection')}
</>
);
}

private renderFeature(featureName: ExperimentalFeature): JSX.Element {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ export class EditPlugin implements EditorPlugin {
*/
initialize(editor: IEditor) {
this.editor = editor;
this.handleNormalEnter = this.editor.isExperimentalFeatureEnabled('PersistCache');
this.handleNormalEnter = this.editor.isExperimentalFeatureEnabled('HandleEnterKey');

if (editor.getEnvironment().isAndroid) {
this.disposer = this.editor.attachDomEvent({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ describe('EditPlugin', () => {

it('Enter, normal enter enabled', () => {
isExperimentalFeatureEnabledSpy.and.callFake(
(featureName: string) => featureName == 'PersistCache'
(featureName: string) => featureName == 'HandleEnterKey'
);
plugin = new EditPlugin();
const rawEvent = { which: 13, key: 'Enter' } as any;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,8 @@ export type ExperimentalFeature =
/**
* Workaround for the Legacy Image Edit
*/
| 'LegacyImageSelection';
| 'LegacyImageSelection'
/**
* Use Content Model handle ENTER key
*/
| 'HandleEnterKey';

0 comments on commit 12d27df

Please sign in to comment.