Skip to content

Commit e3e49da

Browse files
committed
Make 'view source' work
1 parent 4b904d9 commit e3e49da

4 files changed

Lines changed: 45 additions & 0 deletions

File tree

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
.mx_ViewSource pre {
2+
text-align: left;
3+
}

‎src/skins/vector/skindex.js‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ skin['organisms.RoomDirectory'] = require('./views/organisms/RoomDirectory');
8080
skin['organisms.RoomList'] = require('./views/organisms/RoomList');
8181
skin['organisms.RoomView'] = require('./views/organisms/RoomView');
8282
skin['organisms.UserSettings'] = require('./views/organisms/UserSettings');
83+
skin['organisms.ViewSource'] = require('./views/organisms/ViewSource');
8384
skin['pages.MatrixChat'] = require('./views/pages/MatrixChat');
8485
skin['templates.Login'] = require('./views/templates/Login');
8586
skin['templates.Register'] = require('./views/templates/Register');

‎src/skins/vector/views/molecules/MessageContextMenu.js‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ var React = require('react');
2020

2121
var MatrixClientPeg = require('matrix-react-sdk/lib/MatrixClientPeg');
2222
var dis = require('matrix-react-sdk/lib/dispatcher');
23+
var sdk = require('matrix-react-sdk')
24+
var Modal = require('matrix-react-sdk/lib/Modal');
2325

2426
module.exports = React.createClass({
2527
displayName: 'MessageContextMenu',
@@ -43,6 +45,11 @@ module.exports = React.createClass({
4345
},
4446

4547
onViewSourceClick: function() {
48+
var ViewSource = sdk.getComponent('organisms.ViewSource');
49+
Modal.createDialog(ViewSource, {
50+
mxEvent: this.props.mxEvent
51+
});
52+
if (this.props.onFinished) this.props.onFinished();
4653
},
4754

4855
render: function() {
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
/*
2+
Copyright 2015 OpenMarket Ltd
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
*/
16+
17+
'use strict';
18+
19+
var React = require('react');
20+
21+
module.exports = React.createClass({
22+
displayName: 'ViewSource',
23+
24+
render: function() {
25+
return (
26+
<div className="mx_ViewSource">
27+
<pre>
28+
{JSON.stringify(this.props.mxEvent.event, null, 2)}
29+
</pre>
30+
</div>
31+
);
32+
}
33+
});
34+

0 commit comments

Comments
 (0)