Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[wip] Migrate to React #91

Open
wants to merge 47 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
cfaec8b
Start migrating to React
ryanscottaudio Apr 11, 2017
1b00a01
Merge
ryanscottaudio Apr 12, 2017
c9eca4c
Switch more components to React
ryanscottaudio Apr 12, 2017
ed50734
add proptypes
ryanscottaudio Apr 12, 2017
3b90046
Some linting
ryanscottaudio Apr 12, 2017
97131ef
return undefined
ryanscottaudio Apr 13, 2017
9b50886
Update travis to node 6
ryanscottaudio Apr 13, 2017
0f820b2
Install react-test-renderer
ryanscottaudio Apr 13, 2017
0797393
camelCase contentEditable
ryanscottaudio Apr 13, 2017
e608959
Move more to react
ryanscottaudio Apr 19, 2017
14869d4
Move outer code to flow
ryanscottaudio Apr 24, 2017
caf1cb4
Lint/flow
ryanscottaudio Apr 25, 2017
8ac3a99
Add spread operator plugin
ryanscottaudio Apr 25, 2017
9cef906
Switch back to old test command
ryanscottaudio Apr 25, 2017
41bfea4
Add example back in
ryanscottaudio Apr 25, 2017
1679d41
Fix calling class as function issue
ryanscottaudio Apr 25, 2017
4d619f3
Lint
ryanscottaudio Apr 25, 2017
6b3f1c6
Avoid using delegateTarget which is unique to ddeku
ryanscottaudio Apr 25, 2017
4a705ab
Fix fsF
ryanscottaudio Apr 25, 2017
aa7791b
Start trying to use jsdom in tests since enzyme's iframes never call …
ryanscottaudio Apr 25, 2017
8de740c
Use jsdom 9
ryanscottaudio Apr 25, 2017
852c1de
Remove jsdom; react-dom can render fine without it
ryanscottaudio Apr 25, 2017
8c321c0
Add faucet back in
ryanscottaudio Apr 25, 2017
bedeb18
Fix instagram fixture
ryanscottaudio Apr 25, 2017
b92be99
Fix more tests
ryanscottaudio Apr 25, 2017
58e2832
Break out stripper function
ryanscottaudio Apr 25, 2017
65c6496
Pipe browser tests to faucet (needed for tests to fail correctly in t…
ellell Apr 26, 2017
6348248
Fix expected iframe allowfullscren value
ellell Apr 26, 2017
0713603
Bubble mouseup event in test
ellell Apr 26, 2017
0a8aaea
move event callbacks outside of render, can use ref instead of delega…
ellell Apr 26, 2017
dd0278c
Fix for mouseup event not firing on child elements of <article>
ellell Apr 26, 2017
b373235
Fix typo in test
ellell Apr 26, 2017
505d5ed
Fix cut/paste update
ellell Apr 26, 2017
19a7c05
cleanup before rendering app in new test
ellell Apr 26, 2017
6505a7f
Fix setting selection in test (was incorrect because of react comment…
ellell Apr 26, 2017
d6eb887
Fix custom keydown, need persist to get access to .metaKey for example
ellell Apr 26, 2017
3d7c1e6
Fix node test command
ellell Apr 26, 2017
abafdd5
Fix lint/flow
ellell Apr 26, 2017
b164102
Fix error where articleElm is null
ellell Apr 26, 2017
cd07848
Only render when props have changed
ellell Apr 26, 2017
3e955bb
Strip react before diffing innerhtml
ryanscottaudio Apr 26, 2017
9261dcc
Update readme
ryanscottaudio Apr 26, 2017
8c52475
Use string replacement to strip react tags
ryanscottaudio Apr 26, 2017
1febc68
remove removal of react root for faster diffing
ryanscottaudio Apr 26, 2017
8ac6290
Dont check items against each other because they're arrays
ryanscottaudio Apr 26, 2017
26d3ed4
Add deep check back in
ryanscottaudio Apr 27, 2017
0d8d0c8
remove deepequal
ryanscottaudio Apr 27, 2017
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import setupHtmlToArticleJson from 'html-to-article-json';
import setupArticle from 'article-json-react-render';
import { map } from 'immutable-array-methods';
import { setIn } from 'immutable-object-methods';
import deepEqual from 'deep-equal';

import stripReact from './strip-react';
import type { ElementsType, TextItemType, GetCustomKeyDownType } from './types';
Expand Down Expand Up @@ -116,7 +117,8 @@ const setup = ({ customTextFormattings, parseFigureProps, customCaption }: Setup
// Check props first without rendering,
// no need to go through with rendering if we know nothing has changed.
const propsHasUpdated = this.props.selections !== nextProps.selections ||
this.props.contentEditable !== nextProps.contentEditable;
this.props.contentEditable !== nextProps.contentEditable ||
!deepEqual(this.props.items, nextProps.items, { strict: true });
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ryanscottaudio Hey, did this make a performance difference? Realizing now it might do that in the example, but where we use this in our editor we're using immutable data, so just checking this.props.items !== nextProps.items used to be enough before at least.


if (!propsHasUpdated) {
return false;
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
"dependencies": {
"article-json-react-embeds": "^1.0.0",
"article-json-react-render": "^1.0.0",
"deep-equal": "^1.0.1",
"dift": "^0.1.12",
"embeds": "^2.5.1",
"get-selection-range-from-elm": "^2.0.1",
Expand Down