Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use a separate experimental feature for Enter key #2811

Merged
merged 3 commits into from
Sep 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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';
Loading