@@ -80,42 +80,41 @@ class UpdateDraftEditorFlags extends React.Component<{
8080 }
8181 _update ( ) {
8282 const editor = this . props . editor ;
83- if ( gkx ( 'draft_js_remove_componentwillupdate' ) ) {
84- /**
85- * Sometimes a render triggers a 'focus' or other event, and that will
86- * schedule a second render pass.
87- * In order to make sure the second render pass gets the latest editor
88- * state, we update it here.
89- * Example:
90- * render #1
91- * +
92- * |
93- * | cWU -> Nothing ... latestEditorState = STALE_STATE :(
94- * |
95- * | render -> this.props.editorState = FRESH_STATE
96- * | + *and* set latestEditorState = FRESH_STATE
97- * |
98- * | |
99- * | +--> triggers 'focus' event, calling 'handleFocus' with latestEditorState
100- * | +
101- * | |
102- * +>cdU -> latestEditorState = FRESH_STATE | the 'handleFocus' call schedules render #2
103- * | with latestEditorState, which is FRESH_STATE
104- * |
105- * render #2 <--------------------------------------+
106- * +
107- * |
108- * | cwU -> nothing updates
109- * |
110- * | render -> this.props.editorState = FRESH_STATE which was passed in above
111- * |
112- * +>cdU fires and resets latestEditorState = FRESH_STATE
113- * ---
114- * Note that if we don't set latestEditorState in 'render' in the above
115- * diagram, then STALE_STATE gets passed to render #2.
116- */
117- editor . _latestEditorState = this . props . editorState ;
118- }
83+ /**
84+ * Sometimes a render triggers a 'focus' or other event, and that will
85+ * schedule a second render pass.
86+ * In order to make sure the second render pass gets the latest editor
87+ * state, we update it here.
88+ * Example:
89+ * render #1
90+ * +
91+ * |
92+ * | cWU -> Nothing ... latestEditorState = STALE_STATE :(
93+ * |
94+ * | render -> this.props.editorState = FRESH_STATE
95+ * | + *and* set latestEditorState = FRESH_STATE
96+ * |
97+ * | |
98+ * | +--> triggers 'focus' event, calling 'handleFocus' with latestEditorState
99+ * | +
100+ * | |
101+ * +>cdU -> latestEditorState = FRESH_STATE | the 'handleFocus' call schedules render #2
102+ * | with latestEditorState, which is FRESH_STATE
103+ * |
104+ * render #2 <--------------------------------------+
105+ * +
106+ * |
107+ * | cwU -> nothing updates
108+ * |
109+ * | render -> this.props.editorState = FRESH_STATE which was passed in above
110+ * |
111+ * +>cdU fires and resets latestEditorState = FRESH_STATE
112+ * ---
113+ * Note that if we don't set latestEditorState in 'render' in the above
114+ * diagram, then STALE_STATE gets passed to render #2.
115+ */
116+ editor . _latestEditorState = this . props . editorState ;
117+
119118 /**
120119 * The reason we set this 'blockSelectEvents' flag is that IE will fire a
121120 * 'selectionChange' event when we programmatically change the selection,
@@ -444,26 +443,10 @@ class DraftEditor extends React.Component<DraftEditorProps, State> {
444443 }
445444 }
446445
447- /**
448- * Prevent selection events from affecting the current editor state. This
449- * is mostly intended to defend against IE, which fires off `selectionchange`
450- * events regardless of whether the selection is set via the browser or
451- * programmatically. We only care about selection events that occur because
452- * of browser interaction, not re-renders and forced selections.
453- */
454- componentWillUpdate ( nextProps : DraftEditorProps ) : void {
455- if ( ! gkx ( 'draft_js_remove_componentwillupdate' ) ) {
456- // we are using the GK to phase out setting this here
457- this . _latestEditorState = nextProps . editorState ;
458- }
459- }
460-
461446 componentDidUpdate ( ) : void {
462447 this. _blockSelectEvents = false ;
463- if ( gkx ( 'draft_js_remove_componentwillupdate' ) ) {
464- // moving this here, when it was previously set in componentWillUpdate
465- this . _latestEditorState = this . props . editorState ;
466- }
448+ // moving this here, when it was previously set in componentWillUpdate
449+ this . _latestEditorState = this . props . editorState ;
467450 this . _latestCommittedEditorState = this . props . editorState ;
468451 }
469452
0 commit comments