{"push_id":2357817183,"size":12,"distinct_size":12,"ref":"refs/heads/master","head":"084bdb66473dc1bfbefe375cf6cd739742afbc42","before":"558352c81f32abf29d073038b5bf4a2dc8f69189","commits":[{"sha":"d1448831223d7b742b8461b73059ee58daf079b6","author":{"name":"Flarnie Marchan","email":"816573d5361b6026c5a0fc81a5bd206ffc2a6733@fb.com"},"message":"try disabling 'blockSelectEvents' flag\n\nSummary:\nIn the past Draft.js set a 'blockSelectEvents' flag on 'componentWillUpdate'\nand unset it in 'componentDidUpdate'.\n\nThe reason for this, according to comments in the code, was that IE will fire\na 'selectionChange' event when we programmatically change the selection,\nmeaning it would trigger a new select event while we are in the middle of\nupdating.\n\n**Edit:**\nWe found that the 'selection.addRange' was what triggered the stray `selectionchange` event in IE, for the record.[1] Thanks sophiebits for the tip about that.\n\nWhen manually testing, I saw no bugs or inconsistencies introduced when the extra 'selectionchange' event fired in IE. The event would go into React, and yet it was never logged as triggering a handler in Draft.js.\n\nSo either that `selectionchange` event was not one that Draft.js. listened to, or React ignores/defers it because it's in the middle of a commit.\n\nThis diff does two things:\n- Add logging to verify if we ever actually use the `blockSelectEvents` flag in practice. Is it actually blocking anything??? And if not, as I suspect, then;\n- We can just remove it. This also removes it under a GK, so we can test on 50% employees first and see if they experience any bugs.\n\nLastly - I do want to add tests for this. It is error-prone and time consuming to set up and repeately do manual testing. Going to put together an outline of what I think the test should look like in a follow-up diff.\n\n ---\n[1]: Here are the logs I recorded, for posterity\n```\n// inside of DraftEditor#focus\ncalling forceSelection\ncalling udpate with new editor state and new selection\ncomponentWillUpdate fired!\nThis is where blockSelectEvents would be set to true~~~\na leaf is about to call setDraftEditorSelection\nremoving all ranges from the selection\ncalling range.setStart\n**calling selection.addRange**\n**React got an event of type topSelectionChange**\n**window got an event of 'selectionchange'**\ncomponentDidUpdate fired\nThis is where blockSelectEvents would be set to false~~~\nReact got an event of type topBlur\nReact got an event of type topFocus\nDraft got an event of onFocus\nDraft returned early because currentSelection already matches the updated selection\n```\n\nReviewed By: sophiebits\n\nDifferential Revision: D6866079\n\nfbshipit-source-id: 01034c6404df892224f5c18a45cba744a64d6e38","distinct":true,"url":"https://api.github.com/repos/mitermayer/draft-js/commits/d1448831223d7b742b8461b73059ee58daf079b6"},{"sha":"788595984da7c1e00d1071ea82b063ff87140be4","author":{"name":"Flarnie Marchan","email":"816573d5361b6026c5a0fc81a5bd206ffc2a6733@fb.com"},"message":"Remove 'componentWillUpdate' under GK\n\nSummary:\nThe last thing we do inside 'componentWillUpdate' in DraftEditor is update the\n'_latestEditorState'.\n\nThis was introduced in https://github.com/facebook/draft-js/pull/666 and that\nPR has a great explanation in the comments.\n\n**BUT** when manually testing this, the bug with dead key deletion and korean\nIME deletion not working was still happening, even with the current state of\nthings. So that was interesting. It doesn't seem to fix the thing we originally\nintended, unless I'm missing something.\n\nIn a later change (https://our.intern.facebook.com/intern/diff/D4778712/)\npasses latestEditorState to handlers, so that they can use the latest editor\nstate instead of stale editor state. This fixed many bugs in our own uses of\nDraft.js.\n\nAnd since there are many untested IME cases, it could be that some situations\nare still improved by storing and tracking the '_latestEditorState'.\n\nWe already set '_latestEditorState' inside 'update' and that is always called\nbefore 'componentWillUpdate'. My first approach is to just rely on that and\nremove the updating in 'componentWillUpdate'.\n\nUpdating '_latestEditorState' in 'componentWillUpdate' does potentially give\nus important info though; if the 'onChange' handler mutated the editorState\nthen we will need to use that, and we get it in 'componentWillUpdate'.\n\nIf we want to maintain this, then I propose the following;\n- Move '_latestEditorState' into state in 'DraftEditor' and create a public\n  getter method to access it.\n- Update it in the new static method 'getDerivedStateFromProps' and then use\n  the polyfill wrapper to make Draft.js backwards compatible.\nI'd rather skip that if it turns out we don't rely on '_latestEditorState'\nbeing updated after 'onChange' is called. With so many uses and so few tests,\nthe only way to know is to try it. :)\n\nFollow-up action items:\n- Add a unit test for latestEditorState being used and passed to handlers.\n- Open the GK to 70% employees and let that sit for a couple of days, to verify\n  that this doesn't cause major problems. Continue roll-out and remove GK.\n- Add inline comments explaining why we track and use '_latestEditorState'.\n\nDepends on D6866079\n\nReviewed By: sophiebits\n\nDifferential Revision: D6873303\n\nfbshipit-source-id: 5df00598ea20d826f96d70eddcfe7043cf18a18b","distinct":true,"url":"https://api.github.com/repos/mitermayer/draft-js/commits/788595984da7c1e00d1071ea82b063ff87140be4"},{"sha":"900ef767ca4d89198eb7e8da0e9deda337e96995","author":{"name":"Guilherme Miranda","email":"cff2bb8b981abf25bc22b67449f8b24e3a345205@users.noreply.github.com"},"message":"Fixing tex example\n\nSummary:\n**Summary**\n\nFixing issue #1408\nCloses https://github.com/facebook/draft-js/pull/1504\n\nDifferential Revision: D6924656\n\nfbshipit-source-id: 6f12a01c1bed709cfb7da601b1dbf404d5b038a3","distinct":true,"url":"https://api.github.com/repos/mitermayer/draft-js/commits/900ef767ca4d89198eb7e8da0e9deda337e96995"},{"sha":"3a3d34bdd0f7772f666878c46b922da48d8ed067","author":{"name":"Matthew Mans","email":"b171613bc7b45d7137a9576acd1051a2308ae77b@fb.com"},"message":"expose start/end positions of a decorated component within a contentBlock\n\nSummary: In some cases, it's valuable to expose the current position of a decorated component within its content block for styling purposes. (Example: Apply certain styling to a decorated component if a certain entitiy is directly next to that component).\n\nReviewed By: flarnie\n\nDifferential Revision: D6712533\n\nfbshipit-source-id: ea25ae65fafba5283a344a091ac2346fcd4e9bb3","distinct":true,"url":"https://api.github.com/repos/mitermayer/draft-js/commits/3a3d34bdd0f7772f666878c46b922da48d8ed067"},{"sha":"0a1f981a42ba665471bf35e3955560988de24c78","author":{"name":"Alan Norbauer","email":"c435349be01bc96f7139677646c952da26dab9cd@gmail.com"},"message":"Bundle size stats + Misc changes\n\nSummary:\n**Summary**\n\nMisc changes that:\n1. Make the dev environment work on Windows and Node v9.\n1. Upgrade Webpack and UglifyJS.\n1. Build now outputs build stats to the `meta/bundle-size-stats directory/` dir.\n    1. The build stats are named the current package version, e.g. the current one is `version-0.10.5.json`.\n    1. An example of this file can be seen here: https://files.terriblefish.com/version-0.10.5.json\n    1. This json file can be visualized in any of the various tools online, e.g. [the official tool](https://webpack.github.io/analyse) which is great for visualizing module dependencies and [this one from Chris Bateman](http://chrisbateman.github.io/webpack-visualizer/) that makes visualizing file sizes really nice.\n\n**Test Plan**\n\n`npm test`, `npm run lint`, and `npm run flow` all pass\n\n**Misc**\n* I don't think any of these changes need tests\n* No API changes\nCloses https://github.com/facebook/draft-js/pull/1644\n\nReviewed By: flarnie\n\nDifferential Revision: D6950926\n\nPulled By: flarnie\n\nfbshipit-source-id: 47de3b030087af010a19694caeca3de13d16a099","distinct":true,"url":"https://api.github.com/repos/mitermayer/draft-js/commits/0a1f981a42ba665471bf35e3955560988de24c78"},{"sha":"e65a8e61d6151ac4e0db8ac8a8635844a5fcdef7","author":{"name":"cbeninati","email":"04f8b1a21db4853371acbaa748acd7bbd7c6064d@users.noreply.github.com"},"message":"Match block and inline examples for consistency.\n\nSummary:\n**Summary**\n\nA simple update to keep the examples consistent.\nIt could have gone either way, so I updated the second example to match the first.\n\n**Test Plan**\nN/A\nCloses https://github.com/facebook/draft-js/pull/1648\n\nDifferential Revision: D6976848\n\nfbshipit-source-id: c6e4047d9f41b8776a1c7f50457495cfb0ee20ea","distinct":true,"url":"https://api.github.com/repos/mitermayer/draft-js/commits/e65a8e61d6151ac4e0db8ac8a8635844a5fcdef7"},{"sha":"a6317e60b06519d3c00a2c0621701f3da0837a88","author":{"name":"Flarnie Marchan","email":"816573d5361b6026c5a0fc81a5bd206ffc2a6733@fb.com"},"message":"Widen logging and add stack trace for IE selection bug\n\nSummary:\nWe are hoping to remove this flag that was meant to fix an IE selection bug. It\nblocks selection events from being handled while React is rendering - the thing\nis, this has never been a problem that we can see.\n\nWe are logging to see if real users actually hit this bug and if the flag\nprevents a bad state in that case.\n\nIf we find that the flag is never hit, then it will soon be removed, unlocking\nremoval of a deprecated lifecycle method.\n\nReviewed By: sophiebits\n\nDifferential Revision: D6971850\n\nfbshipit-source-id: 8874b21161de3b3f0f568baca2a8c0278b01fa54","distinct":true,"url":"https://api.github.com/repos/mitermayer/draft-js/commits/a6317e60b06519d3c00a2c0621701f3da0837a88"},{"sha":"90a8f22557a331e7301662d01b0e868290e13c31","author":{"name":"Flarnie Marchan","email":"816573d5361b6026c5a0fc81a5bd206ffc2a6733@fb.com"},"message":"Update 'latestEditorState' in render too\n\nSummary:\n**tldr;** Handlers can get called after cWU and before cDU, and they use the\ncached 'latestEditorState'. For them to get the fresh version of the state,\nwe need to update 'latestEditorState' in 'render' because that happens before\nthe handlers get called.\n\n**The whole story;**\nWe are trying to remove cWU from `DraftEditor.react.js`. One thing which\ncurrently happens there is that `latestEditorState` gets set to the\nnextProps.editorState, so whatever is passed in by the parent. For more context\non the initial attempt at changing this, see\nhttps://our.intern.facebook.com/intern/diff/D6873303/\n\nThis change introduced one bug that manifested in various ways - see T26034821\nand T26020049. I'll focus on T26020049, which broke\n`<AdsBulkTokenizedTextInputWithFieldsSelector>`.\n\n`<AdsBulkTok...FieldsSelection>` has a button for adding a new token, and when\nyou hit that button it passes `<DraftEditor>` an updated editorState as a prop.\nThis triggers render #1, and during that render we update the browser\nselection, which triggers `focus` and `blur` events. These each trigger another\nrender of `<DraftEditor>`; renders #2 and #3. Here is how it looks on a\ntimeline:\n```\nrender #1\n+\n|\n| cWU -> latestEditorState = FRESH_STATE\n|\n| render -> this.props.editorState = FRESH_STATE\n| +\n| |\n| +--> triggers 'focus' event, calling 'handleFocus' with latestEditorState\n|                   +\n|                   |\n+>cDU fires         | the 'handleFocus' call schedules render #2\n                    | with latestEditorState, which is FRESH_STATE\n                    |\nrender #2  <--------+\n+\n|\n| cWU -> latestEditorState = FRESH_STATE\n|\n| render -> this.props.editorState = FRESH_STATE\n|\n+>cDU fires\n```\nWhen we move the update of latestEditorState to cDM, things go awry like this;\n```\nrender #1\n+\n|\n| cWU -> Nothing ... latestEditorState = STALE_STATE :(\n|\n| render -> this.props.editorState = FRESH_STATE\n| +\n| |\n| +--> triggers 'focus' event, calling 'handleFocus' with latestEditorState\n|                                                +\n|                                                |\n+>cDU -> latestEditorState = FRESH_STATE         | the 'handleFocus' call schedules render #2\n                                                 | with latestEditorState, which is STALE_STATE :(\n                                                 |\nrender #2 <--------------------------------------+\n+\n|\n| cWU -> nothing updates\n|\n| render -> this.props.editorState = STALE_STATE :(  because this was passed in above\n|\n+>cDU fires and resets latestEditorState = STALE_STATE :(\n```\n\nSo we can fix things by updating latestEditorState inside the `render` method,\nlike so;\n```\nrender #1\n+\n|\n| cWU -> Nothing ... latestEditorState = STALE_STATE :(\n|\n| render -> this.props.editorState = FRESH_STATE\n| +         *and* set latestEditorState = FRESH_STATE\n  |\n| |\n| +--> triggers 'focus' event, calling 'handleFocus' with latestEditorState\n|                                                +\n|                                                |\n+>cDU -> latestEditorState = FRESH_STATE         | the 'handleFocus' call schedules render #2\n                                                 | with latestEditorState, which is FRESH_STATE\n                                                 |\nrender #2 <--------------------------------------+\n+\n|\n| cWU -> nothing updates\n|\n| render -> this.props.editorState = FRESH_STATE which was passed in above\n|\n+>cDU fires and resets latestEditorState = FRESH_STATE\n```\n\nOne possible issue would be if `render` fired and then was never completed, in\nasync. mode, but since Draft is intended to always be run in sync. mode I'm not\nworried about that.\n\nReviewed By: mitermayer\n\nDifferential Revision: D6994261\n\nfbshipit-source-id: 80986b853a57f64aa5aafbe667b4d94171d5271c","distinct":true,"url":"https://api.github.com/repos/mitermayer/draft-js/commits/90a8f22557a331e7301662d01b0e868290e13c31"},{"sha":"6cc2d857082ec62ecf67bf6bf51cd176fec95548","author":{"name":"Michael Baldwin","email":"291ff73ee035e7147930669d208bf83ca94b53fb@mail.gvsu.edu"},"message":"added favicon to website\n\nSummary:\n**Summary**\n\n- flarnie kedromelon finishes up #965 by adding the favicon to the website\n- thanks to kedromelon for the great favicon! 🎉\n\n<img width=\"681\" alt=\"screen shot 2017-11-22 at 11 58 00\" src=\"https://user-images.githubusercontent.com/10538297/33140139-1c883108-cf7d-11e7-9ee6-da097eb32e29.png\">\n\n<img width=\"660\" alt=\"screen shot 2017-11-22 at 11 57 46\" src=\"https://user-images.githubusercontent.com/10538297/33140149-25071ccc-cf7d-11e7-8c49-043645f9294c.png\">\n\n**Test Plan**\n\n- not applicable\nCloses https://github.com/facebook/draft-js/pull/1526\n\nReviewed By: flarnie\n\nDifferential Revision: D6976891\n\nPulled By: flarnie\n\nfbshipit-source-id: 73a544ee6860f203361089e741007b93e8ba651e","distinct":true,"url":"https://api.github.com/repos/mitermayer/draft-js/commits/6cc2d857082ec62ecf67bf6bf51cd176fec95548"},{"sha":"584d8492c16ed3092d8d0e21e9efa4b9cc3109c5","author":{"name":"Thibaud Colas","email":"23d00d3184cbdeb3c0eb529a72c359d635355a45@gmail.com"},"message":"Remove Node 6 from engines list in package.json\n\nSummary:\n**Summary**\n\nFixes #1650.\n\nTravis is using Node 8 since 247a632ab6420e7809a8f7cf7dd2b31b495bb4c7, and Prettier is already configured in a way that's not Node-6 compatible:\n\nhttps://github.com/facebook/draft-js/blob/a6317e60b06519d3c00a2c0621701f3da0837a88/prettier.config.js#L3\n\nNode 8 is the LTS release line since late october 2017 so I think it's fair to remove support for Node 6.\n\nNB: I see `devEngines` also states support for npm 2 and 3. Node 8 ships with npm 5 by default, so I imagine those 2 versions could be removed as well. Edit: Ah actually I see draft-js is at least partially using yarn since #1568 / #1570.\n\n**Test plan**\n\nNo tests. This is only removing support, it doesn't affect supported versions.\nCloses https://github.com/facebook/draft-js/pull/1652\n\nDifferential Revision: D7013709\n\nfbshipit-source-id: bdb7e105352be2e8f205c36f516b1e6c4cedb591","distinct":true,"url":"https://api.github.com/repos/mitermayer/draft-js/commits/584d8492c16ed3092d8d0e21e9efa4b9cc3109c5"},{"sha":"04c2b9c038cc4086f06bfb734d4cf8e88b4db5d2","author":{"name":"Sophie Alpert","email":"a17c17adfa7dcc819aec5c1bf4ddb7e9fdc9e001@fb.com"},"message":"Move _latestEditorState assignment back to commit phase\n\nSummary: Follow-up to D6994261. I believe this is more correct even though it is kind of a hacky approach.\n\nReviewed By: flarnie\n\nDifferential Revision: D7014753\n\nfbshipit-source-id: 6107352ddbe5a90fa3235aae513a3c5b17574c55","distinct":true,"url":"https://api.github.com/repos/mitermayer/draft-js/commits/04c2b9c038cc4086f06bfb734d4cf8e88b4db5d2"},{"sha":"084bdb66473dc1bfbefe375cf6cd739742afbc42","author":{"name":"Brian Ng","email":"0b1cd401a044e02dfe8640cb5f26fd11ab1317e0@gmail.com"},"message":"Ensure selection collapses if user tries to replace with matching text\n\nSummary:\n**Summary**\n\nThis PR ensures that the selection is always collapsed for the cases where a user replaces the current selection with matching text.\n\nI admittedly didn't really dig into the original issue when fixing the previous crash :)\n\n**Test Plan**\n\nSmall repro:\n\n1. Type in \"abc\"\n1. Select \"c\" from right-to-left\n1. Type \"c\"\n1. Select \"c\" from left-to-right\n1. Type \"c\"\n\nThanks to JLarky for bringing this to my intention!\nCloses https://github.com/facebook/draft-js/pull/1661\n\nDifferential Revision: D7055502\n\nfbshipit-source-id: ee4cf80d292ee715e40c017e4c6bd18f806b0e24","distinct":true,"url":"https://api.github.com/repos/mitermayer/draft-js/commits/084bdb66473dc1bfbefe375cf6cd739742afbc42"}]}
{"actor":{"display_login":"mitermayer"}}