Skip to content
This repository has been archived by the owner on Feb 6, 2023. It is now read-only.

Commit

Permalink
Remove draft_accept_selection_after_refocus flag
Browse files Browse the repository at this point in the history
Summary: Don't need this any more. Chrome 60 is out.

Reviewed By: zpao

Differential Revision: D5674557

fbshipit-source-id: 878f620f6e91aa1271d13ffa644cd47540b21e76
  • Loading branch information
sophiebits authored and facebook-github-bot committed Sep 15, 2017
1 parent 2cc61e1 commit 19b9b1c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
11 changes: 7 additions & 4 deletions src/component/handlers/edit/editOnFocus.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@

import type DraftEditor from 'DraftEditor.react';

var DraftFeatureFlags = require('DraftFeatureFlags');
var EditorState = require('EditorState');
var UserAgent = require('UserAgent');

function editOnFocus(editor: DraftEditor, e: SyntheticFocusEvent<>): void {
var editorState = editor._latestEditorState;
Expand All @@ -34,10 +34,13 @@ function editOnFocus(editor: DraftEditor, e: SyntheticFocusEvent<>): void {
// selection here instead of simply accepting it in order to preserve the
// old cursor position. See https://crbug.com/540004.
// But it looks like this is fixed in Chrome 60.0.3081.0.
if (DraftFeatureFlags.draft_accept_selection_after_refocus) {
editor.update(EditorState.acceptSelection(editorState, selection));
} else {
// Other browsers also don't have this bug, so we prefer to acceptSelection
// when possible, to ensure that unfocusing and refocusing a Draft editor
// doesn't preserve the selection, matching how textareas work.
if (UserAgent.isBrowser('Chrome < 60.0.3081.0')) {
editor.update(EditorState.forceSelection(editorState, selection));
} else {
editor.update(EditorState.acceptSelection(editorState, selection));
}
}

Expand Down
1 change: 0 additions & 1 deletion src/component/utils/DraftFeatureFlags-core.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
'use strict';

var DraftFeatureFlags = {
draft_accept_selection_after_refocus: false,
draft_killswitch_allow_nontextnodes: false,
draft_segmented_entities_behavior: false,
};
Expand Down

0 comments on commit 19b9b1c

Please sign in to comment.