{"action":"created","issue":{"url":"https://api.github.com/repos/facebook/draft-js/issues/666","repository_url":"https://api.github.com/repos/facebook/draft-js","labels_url":"https://api.github.com/repos/facebook/draft-js/issues/666/labels{/name}","comments_url":"https://api.github.com/repos/facebook/draft-js/issues/666/comments","events_url":"https://api.github.com/repos/facebook/draft-js/issues/666/events","html_url":"https://github.com/facebook/draft-js/pull/666","id":177688102,"number":666,"title":"Fix dead key deletion","user":{"login":"spicyj","id":6820,"avatar_url":"https://avatars.githubusercontent.com/u/6820?v=3","gravatar_id":"","url":"https://api.github.com/users/spicyj","html_url":"https://github.com/spicyj","followers_url":"https://api.github.com/users/spicyj/followers","following_url":"https://api.github.com/users/spicyj/following{/other_user}","gists_url":"https://api.github.com/users/spicyj/gists{/gist_id}","starred_url":"https://api.github.com/users/spicyj/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/spicyj/subscriptions","organizations_url":"https://api.github.com/users/spicyj/orgs","repos_url":"https://api.github.com/users/spicyj/repos","events_url":"https://api.github.com/users/spicyj/events{/privacy}","received_events_url":"https://api.github.com/users/spicyj/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/facebook/draft-js/labels/CLA%20Signed","name":"CLA Signed","color":"009900"},{"url":"https://api.github.com/repos/facebook/draft-js/labels/GH%20Review:%20review-needed","name":"GH Review: review-needed","color":"fbca04"}],"state":"open","locked":false,"assignee":{"login":"flarnie","id":1114467,"avatar_url":"https://avatars.githubusercontent.com/u/1114467?v=3","gravatar_id":"","url":"https://api.github.com/users/flarnie","html_url":"https://github.com/flarnie","followers_url":"https://api.github.com/users/flarnie/followers","following_url":"https://api.github.com/users/flarnie/following{/other_user}","gists_url":"https://api.github.com/users/flarnie/gists{/gist_id}","starred_url":"https://api.github.com/users/flarnie/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/flarnie/subscriptions","organizations_url":"https://api.github.com/users/flarnie/orgs","repos_url":"https://api.github.com/users/flarnie/repos","events_url":"https://api.github.com/users/flarnie/events{/privacy}","received_events_url":"https://api.github.com/users/flarnie/received_events","type":"User","site_admin":false},"assignees":[{"login":"flarnie","id":1114467,"avatar_url":"https://avatars.githubusercontent.com/u/1114467?v=3","gravatar_id":"","url":"https://api.github.com/users/flarnie","html_url":"https://github.com/flarnie","followers_url":"https://api.github.com/users/flarnie/followers","following_url":"https://api.github.com/users/flarnie/following{/other_user}","gists_url":"https://api.github.com/users/flarnie/gists{/gist_id}","starred_url":"https://api.github.com/users/flarnie/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/flarnie/subscriptions","organizations_url":"https://api.github.com/users/flarnie/orgs","repos_url":"https://api.github.com/users/flarnie/repos","events_url":"https://api.github.com/users/flarnie/events{/privacy}","received_events_url":"https://api.github.com/users/flarnie/received_events","type":"User","site_admin":false}],"milestone":null,"comments":5,"created_at":"2016-09-19T00:37:08Z","updated_at":"2016-10-13T17:10:21Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/facebook/draft-js/pulls/666","html_url":"https://github.com/facebook/draft-js/pull/666","diff_url":"https://github.com/facebook/draft-js/pull/666.diff","patch_url":"https://github.com/facebook/draft-js/pull/666.patch"},"body":"If you type Option-E, Backspace, then the in-progress accented character should be deleted. Similarly, in 2-Set Korean, if you press A, Backspace, the character should be deleted. Both of these don't work correctly yet, but this commit fixes it.\n\nCurrently, when you press Backspace, we are in composition mode and we receive a compositionend event then a keydown event for the backspace. Our composition handler doesn't exist composition mode immediately but rather waits 20ms to see if it gets a compositionstart event immediately (and if so, does not exit). It seems like if we receive a compositionend event then a keydown, we always want to exit composition mode immediately and re-interpret the keydown in edit mode. Here I do so.\n\nThis change is made trickier by the fact that each event handler reads from `this.props.editorState`, which doesn't get updated until the next rerender (that is, not synchronously). To combat this, we store the most current editor state in an instance variable and refer to it from all of the event handlers. (If we don't do this then the backspace isn't interpreted correctly by editOnKeyDown because the character data from compositionend hasn't been inserted into the editor state, so we'd end up effectively dropping the entire composition as well as deleting the preceding character.) In this commit, only editOnKeyDown needs the latest state but I changed the others for consistency. In cases where the parent always updates editorState in the same tick (as we recommend in the docs), there should be no behavior change.\n\nNote: This also brings us closer to being able to handle cases where we don't always receive editorState synchronously -- instead we could store our own copy of the editorState locally but overwrite it with props when we receive new ones. It doesn't work yet though.\n\nTest Plan: In plaintext example, type Option-E, Backspace (with US keyboard) or A, O, Backspace, Backspace (with 2-Set Korean keyboard). In both cases, the entire composition is deleted correctly.\n\ncc @hellendag"},"comment":{"url":"https://api.github.com/repos/facebook/draft-js/issues/comments/253576568","html_url":"https://github.com/facebook/draft-js/pull/666#issuecomment-253576568","issue_url":"https://api.github.com/repos/facebook/draft-js/issues/666","id":253576568,"user":{"login":"spicyj","id":6820,"avatar_url":"https://avatars.githubusercontent.com/u/6820?v=3","gravatar_id":"","url":"https://api.github.com/users/spicyj","html_url":"https://github.com/spicyj","followers_url":"https://api.github.com/users/spicyj/followers","following_url":"https://api.github.com/users/spicyj/following{/other_user}","gists_url":"https://api.github.com/users/spicyj/gists{/gist_id}","starred_url":"https://api.github.com/users/spicyj/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/spicyj/subscriptions","organizations_url":"https://api.github.com/users/spicyj/orgs","repos_url":"https://api.github.com/users/spicyj/repos","events_url":"https://api.github.com/users/spicyj/events{/privacy}","received_events_url":"https://api.github.com/users/spicyj/received_events","type":"User","site_admin":false},"created_at":"2016-10-13T17:10:21Z","updated_at":"2016-10-13T17:10:21Z","body":"I decided to go with just adding `@preventMunge` because I don't want clients of DraftEditor thinking that it's okay to use these properties so I want to keep the underscore. Going to test in www."}}
{"actor":{"display_login":"spicyj"}}