- Jan 28, 2017
-
- Jan 27, 2017
-
-
Flarnie Marchan authored
-
Flarnie Marchan authored
This fixes a minor flow error coming up in a FB use case, and makes the overall typing more consistent in this file.
-
Flarnie Marchan authored
In one case it seems the return type was just incorrect. We also clarified the comments for 'keyBindingFn' in order to avoid confusion - previously due to some Flow issues we had almost changed this flow type to be incorrect. See https://github.com/facebook/draft-js/pull/894 Also fixes a hanging comma lint.
-
Flarnie Marchan authored
This fixes some issues with the fix originally merged from PR #667[2] Credit to @balpert and @srmcconomy for this fix. For now I'm getting them back in sync. Also thanks to @davidchang for pinging me about landing this, @colinjeane for reporting this bug in #917 and submitting a nearly identical fix: https://github.com/facebook/draft-js/pull/919 @colinjeane since we already had this fixed internally I'm going to use our approach to keep things in sync. fixes #917, #849 [2]: https://github.com/facebook/draft-js/pull/667 We also had to tweak this compared to the current internal version to accomodate a recent change that makes 'editOnBeforeInput' and the other handlers take 'editor' as an explicit argument instead of assumming 'this' will be the editor; https://github.com/facebook/draft-js/commit/e64c2c3f2a3654b925b18baff448100cfbbf3738 Note that we are updating the version of 'fbjs' required in order to get access to the 'setImmediate' polyfill.
-
- Dec 21, 2016
-
-
Brian Ng authored
-
- Dec 20, 2016
-
-
Tyler Craft authored
* EditorState.set() * inherited
-
Tyler Craft authored
-
Tyler Craft authored
-
Tyler Craft authored
-
- Dec 16, 2016
-
-
Flarnie Marchan authored
-
- Dec 15, 2016
-
-
Tam Love authored
* Update Readme.md Updated Readme.md to include a Getting Started section using information from the documentation. * Update Readme.md Adjusted some headings to be H3 to appear as sub-headings in the Getting Started section to provide better reading flow.
-
Colin Jeanne authored
-
- Dec 14, 2016
-
-
Flarnie Marchan authored
Facebook has renamed these; just keeping things in sync.
-
- Dec 11, 2016
-
-
Oscar Morrison authored
Simplifies code and minimizes new concepts.
-
- Dec 10, 2016
-
-
Flarnie Marchan authored
Private methods should not be called as public methods. A recent PR (https://github.com/facebook/draft-js/pull/814) added warnings to the public-but-deprecated API of DraftEntity, and then moved the logic for those methods into private methods that can be called within the Draft.js framework. These methods are "private" in the sense that we are only calling them within Draft. They should not be used outside of the Draft library, because they will be removed in an upcoming version of the library. We have a transform step that causes issues when an underscore-prefixed method is called outside of it's module, so changing the method names seems like the easiest way to deal with this issue and still send the message that they are private. There is a way to turn off the transformation step on a file-by-file basis but that would lead to touching more files than this approach, and this code will be deprecated in the next release anyway.
-
Flarnie Marchan authored
* Fix trailing comma lints I'm not sure why ESLint didn't catch these at some point on Github - but in any case we are fixing it now. I ran the `trailing-commas.js` js-codemod and it only touched one file for some reason. Probably I missed something about the jscodeshift API. In any case, I fixed the other lints that our internal linter was catching. * Use DraftEntity type instead of EntityMap type in helpers While supporting both the old and new APIs in Draft.js for Entity manipulation, we are calling to the old DraftEntity module under the hood instead of using the new system that would use an Immutable.js OrderedMap called the EntityMap. The DraftEntity module now has private methods for entity manipulation that don't warn, and the public API which we are deprecating has warnings and then calls the private methods. In short, there are places where the flow typing wasn't right because it was expecting EntityMap, and not DraftEntity. I don't know why flow didn't catch this when we merged https://github.com/facebook/draft-js/pull/814 test plan: `flow src` * Fix flow error caused by passing command to RichUtils.handleKeyCommand The 'handleKeyCommand' takes either a 'DraftEditorCommand' type or any string. This allows users to have their own custom editor command types. I'm not sure how common this is, but our current flow typing allows it. The flow typing of 'RichUtils.handleKeyCommand' is more strict - it only allows 'DraftEditorCommand' types, and not custom strings. This causes an issue in one of our use cases, where we pass the 'command' received in 'handleKeyCommand' through to 'RichUtils.handleKeyCommand'. It seems like the 'RichUtils.handleKeyCommand' should have an API similar to 'DraftEditor.handleKeyCommand', and so we're loosening the flow type on 'RichTuils.handleKeyCommand'. Test Plan: `flow` * Fix flow error with DraftEditor.setClipboard This was causing flow errors in our internal code because we expect that 'null' or 'undefined' is ok as an argument to 'setClipboard'. Test Plan: `flow src` * Fix flow and lint errors in CharacterMetadata Again - I'm not sure why the github CI didn't catch these issues earlier. I wonder if the issue with the typing of Immutable.OrderedMap relates to the version of Immutable.js we are using or something.
-
- Dec 09, 2016
-
-
Eric Famiglietti authored
-
- Dec 06, 2016
-
-
Ben Alpert authored
My slip.
-
Ben Alpert authored
Fixes #92. If an onChange handler replaces every "x" with an "abc", then when you type "x", we trigger onChange from beforeinput and rerender immediately with the content "abc", then the browser still inserts an "x" character! This fix is surprisingly simple: instead of triggering an update during beforeinput, we simply wait until the input event to do so. This means that when we rerender, the browser would have already inserted the "x" character and React will correctly delete it when rerendering. Test Plan: In plaintext example, change the handler to ``` this.onChange = (editorState) => { var content = editorState.getCurrentContent(); return this.setState({ editorState: EditorState.set(editorState, { currentContent: Modifier.removeInlineStyle(content, content.getSelectionAfter(), 'OVERFLOW'); }), }); }; ``` then type. Characters don't get duplicated like they did before.
-
- Dec 04, 2016
-
-
Flarnie Marchan authored
* Add warnings and comments about deprecating old Entity API We are deprecating the old DraftEntity API. Why? Because - currently changing or adding entities won't trigger a re-render - the use of a non-Immutable storage for entities doesn't fit well with the rest of the Draft architecture - moves Entity storage out of global module; this just makes more sense as an API, rather than having it globally available. This moves the logic for the old API into private methods, and adds warnings and comments around the public-but-deprecated API methods. We then use the private methods internally while we still support both APIs. A future version of Draft will actually remove the old API completely, and these warnings and comments will help folks make updates to their code to prepare. We will release more documentation about this soon. * Update syntax of tex example This example was still using the old syntax, and the new warnings we added alerted us to this fact when doing manual testing.
-
Flarnie Marchan authored
As part of the changing API the signature of contentState.createFromBlockArray changed. At some point (recently I think) this was changed to no longer support the old API, and we didn't quite have the 0.9.1 style examples in place, so it wasn't caught. This adjusts the 'createFromBlockArray' to work with both the old and new APIs.
-
- Dec 03, 2016
-
-
Mitermayer Reis authored
adding-missing-type-definition-to-blockrendermap - Adding missing type for DefaultBlockRenderMap (#831)
-
Mitermayer Reis authored
* Making sure that pasted paragraphs are not converged when pasting * Adding documentation for introducing alias * Simplifying the logic * Adding flow types * Updaing docs
-
- Dec 02, 2016
-
-
Tobias Andersen authored
* Add convertFromHTML example for 0.9.1 * Update docs with convertFromHTML example * Remove image from convertFromHTML example in 0-9-1 * Update 0.9.1 convertFromHTML example to use the old Entity API * Fix link to convertToHTML example in docs
-
Tobias Andersen authored
* Move current examples into draft-0-10-0 dir * Add examples for version 0.9.1 into draft-0-9-1 dir * Use unminified version of react in all examples * Update file paths for examples * Update paths in gitignore, 'tex' package.json, and draftjs docs - updates the .gitignore to ignore node_modules in both the new locations of the 'tex' example - updates a path in the script used for the draft js docs website, which pulls styles from the 'rich' example for some reason - updates the path for 'npm install' in the 'tex' examples - updates all links in the markdown used to generate the draft js docs.
-
- Nov 29, 2016
-
-
Ben Alpert authored
-
Ben Alpert authored
* Change handlers to pass `editor` as an argument This allows Flow to type them better and catch bugs. * Fix Flow errors exposed by added types No behavior change.
-
Ben Alpert authored
(Landed at Facebook as D4056089 over a month ago, copying back out.) Summary: If we have a state update enqueued but the rerender hasn't happened, and a select event comes in, we can't do anything useful with it because although we could compare the last rendered editor state with the DOM selection, we can't make a rational choice for how to update the latest queued editor state with the DOM selection. (Previously, this code was throwing away any content change which would lead to a loss of inserted chars in many Windows IME scenarios.) In particular, if you type in Korean w/ Windows IME then press space, * compositionend arrives, causing us to set a 20ms timeout for resolving the composition, * at that time, the text is already inserted in the DOM * then keydown 32 comes in, which (due to my recent changes) makes the composition resolve immediately * we enqueue a rerender with the composed text * our 'select' polyfill also turns the keydown into a select event, and that select event has the *new* cursor position corresponding to the text that is already inserted to the DOM Basically, the DOM has 안녕하세요, the last editorstate is "" with selection [0, 0], the queued editorstate is "안녕하세요" with selection [5, 5], and you get a selection event [5, 5]. Since there's nothing useful we can do with this, we now ignore the selection event. The risk here is that we now are ignoring important selection events and the editor state selection lags behind the DOM selection. isaac and I don't know of any scenarios in which this would matter -- if we do find some, we might be able to instead change this code to re-check the selection after a rerender to make sure that we have the latest selection. Test Plan: Type dkssudgktpdy then Space with Korean keyboard on Windows Chrome, Windows Firefox, Windows IE, Windows Edge, Mac Chrome, Mac Firefox. It either does the right thing (inserting "안녕하세요 ") or it does the same thing as cstools which doesn't have any of my changes from this week. Type normally, move the cursor, select all, copy, backspace, repeated backspace in the same browsers.
-
Iroshan Vithanage authored
-
- Nov 28, 2016
-
-
Flarnie Marchan authored
A previous PR had completely removed 'DraftEntity' the module and moved control over entities into ContentState.[1] This changed several public APIs of Draft.js in a non-backwards compabible way. [1]: https://github.com/facebook/draft-js/pull/376 To make it easier to migrate multiple use cases to the new Draft.js API, and because the transition is too complex for a simple codemod, we are releasing a version that supports both the new and the old API and then later releasing a version that breaks the old API completely. In order to renew support for the old API while also supporting the new API, this PR - restores the DraftEntity module and associated tests/mocks - calls into DraftEntity methods under the hood of the new API We tried to leave as much of the new API code in place and unchanged as possible, so that things will be easier when we are fully removing DraftEntity and switching to the new approach. Next steps: - A PR to add warnings and comments about the deprecation of the old API - Add this, the warnings, and other recent PRs to 0.10.0 alpha version - Add documentation about migrating from deprecated to new API - Release 0.10.0; support both APIs - Make PR that basically undoes this one, moving entity control into ContentState, and release that as version 0.11.0, with warning that it no longer supports the deprecated API.
-
- Nov 27, 2016
-
-
Flarnie Marchan authored
Flow wasn't finding the 'ReactDOM' node module. In the past it was (I assume) finding this dependency inside of the React package - but in React 15.4.0 the "secret" copy of ReactDOM was split out completely into it's own module.[1] It seems like we should be able to use `scripts/module_map.js` to specify the mapping of `ReactDOM` to `react-dom` but updating that was not making a difference to Flow, so I added a mapping option to the flow config. [1]: https://facebook.github.io/react/blog/2016/11/16/react-v15.4.0.html#separating-react-and-react-dom
-
- Nov 26, 2016
-
-
Paul O’Shannessy authored
-
- Nov 23, 2016
-
-
StGeass authored
Fix advanced topics custom block render docs: Remove extra line in default block render map list (#803)
-
- Nov 22, 2016
-
-
Flarnie Marchan authored
It appears that some change in React 15.4.0 is causing builds to fail in CI. [See issue #779.](https://github.com/facebook/draft-js/issues/799) While we figure that out, let's limit the versions that will be used.
-
- Nov 16, 2016
-
-
- Nov 09, 2016
-
-
David Chang authored
[documentation] Include reference to example for convertFromHTML
-
Stefan Theard authored
-
- Nov 08, 2016
-
-
Stefan Theard authored
This doc page is the first place people find when looking for information on convertFromHTML but the original code sample is not very useful. This hopefully will give people a better idea of how to use the function and then a reference to where I found the code snippet. Should close #236 as well.
-
- Nov 04, 2016
-
-
David Chang authored
Update api docs for EditorState.setInlineStyleOverride
-