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

Highlight ViewSource and Devtools ViewSource #5995

Merged
merged 8 commits into from Jan 24, 2018

Conversation

@t3chguy
Copy link
Collaborator

t3chguy commented Jan 17, 2018

Replaces #5863

Fixes #5853

Signed-off-by: Michael Telatynski 7t3chguy@gmail.com

t3chguy added 4 commits Dec 20, 2017
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
…:vector-im/riot-web into t3chguy/highlight_things
Copy link
Contributor

lukebarnard1 left a comment

Looks really good having tested it! (V. happy to see that (obviously) dev tools has likewise has been updated) 😀

import PropTypes from 'prop-types';
import {highlightBlock} from 'highlight.js';

export default class Highlight extends React.Component {

This comment has been minimized.

Copy link
@lukebarnard1

lukebarnard1 Jan 22, 2018

Contributor

I'd suggest renaming this to something more specific, maybe SyntaxHighlight? (For the sake of not confusing this with highlighting messages).

This comment has been minimized.

Copy link
@lukebarnard1

lukebarnard1 Jan 22, 2018

Contributor

(And also rename the related stuff, i.e. the CSS)

export default class Highlight extends React.Component {
static propTypes = {
className: PropTypes.string,
children: PropTypes.node,

This comment has been minimized.

Copy link
@lukebarnard1

lukebarnard1 Jan 22, 2018

Contributor

We don't do this anywhere, but having just seen this thread, I'd be happy to start doing this for clarity of "this component uses its children, see it's in the prop types". (and IRLd with @dbkr and he agreed, although we won't obsess over it.)

}

componentDidUpdate() {
if (this._el) highlightBlock(this._el);

This comment has been minimized.

Copy link
@lukebarnard1

lukebarnard1 Jan 22, 2018

Contributor

I think this componentDidUpdate is redundant, as we only call highlightBlock if we have this._el and we only have this._el if _ref has been called, which itself sets this._el.

So I think you want to highlightBlock in _ref only?

If this isn't true, perhaps a comment would be nice.

This comment has been minimized.

Copy link
@t3chguy

t3chguy Jan 22, 2018

Author Collaborator

I shall investigate this tomorrow after my Networks Exam :D

This comment has been minimized.

Copy link
@t3chguy

t3chguy Jan 23, 2018

Author Collaborator

So @lukebarnard1 componentDidUpdate is used when being reused with new props, but won't work with componentWillReceiveProps because it needs to happen once React is done updating
I'll add a comment

t3chguy added 4 commits Jan 22, 2018
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
@lukebarnard1 lukebarnard1 merged commit 394d4cf into develop Jan 24, 2018
2 checks passed
2 checks passed
continuous-integration/travis-ci/pr The Travis CI build passed
Details
continuous-integration/travis-ci/push The Travis CI build passed
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.