highlight <code/> blocks via highlight.js
This commit is contained in:
parent
b6e9c1eaab
commit
da97185fcd
5 changed files with 40 additions and 1 deletions
1
src/skins/vector/css/github.css
Symbolic link
1
src/skins/vector/css/github.css
Symbolic link
|
@ -0,0 +1 @@
|
|||
../../../../node_modules/matrix-react-sdk/node_modules/highlight.js/styles/github.css
|
|
@ -25,6 +25,20 @@ module.exports = React.createClass({
|
|||
displayName: 'MNoticeTile',
|
||||
mixins: [MNoticeTileController],
|
||||
|
||||
componentDidMount: function() {
|
||||
HtmlUtils.highlightDom(this.getDOMNode());
|
||||
},
|
||||
|
||||
componentDidUpdate: function() {
|
||||
HtmlUtils.highlightDom(this.getDOMNode());
|
||||
},
|
||||
|
||||
shouldComponentUpdate: function(nextProps) {
|
||||
// exploit that events are immutable :)
|
||||
return (nextProps.mxEvent.getId() !== this.props.mxEvent.getId() ||
|
||||
nextProps.searchTerm !== this.props.searchTerm);
|
||||
},
|
||||
|
||||
// XXX: fix horrible duplication with MTextTile
|
||||
render: function() {
|
||||
var content = this.props.mxEvent.getContent();
|
||||
|
|
|
@ -25,6 +25,20 @@ module.exports = React.createClass({
|
|||
displayName: 'MTextTile',
|
||||
mixins: [MTextTileController],
|
||||
|
||||
componentDidMount: function() {
|
||||
HtmlUtils.highlightDom(this.getDOMNode());
|
||||
},
|
||||
|
||||
componentDidUpdate: function() {
|
||||
HtmlUtils.highlightDom(this.getDOMNode());
|
||||
},
|
||||
|
||||
shouldComponentUpdate: function(nextProps) {
|
||||
// exploit that events are immutable :)
|
||||
return (nextProps.mxEvent.getId() !== this.props.mxEvent.getId() ||
|
||||
nextProps.searchTerm !== this.props.searchTerm);
|
||||
},
|
||||
|
||||
render: function() {
|
||||
var content = this.props.mxEvent.getContent();
|
||||
var body = HtmlUtils.bodyToHtml(content, this.props.searchTerm);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue