Use React on main page
This commit is contained in:
@@ -3,25 +3,16 @@
|
|||||||
|
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<title>Mattermost</title>
|
<title>electron-mattermost</title>
|
||||||
|
<script src="node_modules/react/dist/react.min.js"></script>
|
||||||
|
<script src="node_modules/react-dom/dist/react-dom.min.js"></script>
|
||||||
|
<script src="node_modules/react-bootstrap/dist/react-bootstrap.min.js"></script>
|
||||||
|
<link rel="stylesheet" href="node_modules/bootstrap/dist/css/bootstrap.min.css">
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
<!--
|
<div id="content"></div>
|
||||||
'disablewebsecurity' is necessary to display external images.
|
<script src="build/index.js"></script>
|
||||||
However, it allows also CSS/JavaScript.
|
|
||||||
So webview should use 'allowDisplayingInsecureContent' as same as BrowserWindow.
|
|
||||||
-->
|
|
||||||
<webview id="mainWebview" autosize="on" preload="webview/mattermost.js"></webview>
|
|
||||||
<style>
|
|
||||||
webview {
|
|
||||||
position: absolute;
|
|
||||||
top: 0;
|
|
||||||
right: 0;
|
|
||||||
bottom: 0;
|
|
||||||
left: 0;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
<script src="./index.js"></script>
|
<script src="./index.js"></script>
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
|
25
src/index.jsx
Normal file
25
src/index.jsx
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
'use strict';
|
||||||
|
|
||||||
|
var MainPage = React.createClass({
|
||||||
|
render: function() {
|
||||||
|
var style = {
|
||||||
|
position: 'absolute',
|
||||||
|
top: 0,
|
||||||
|
right: 0,
|
||||||
|
bottom: 0,
|
||||||
|
left: 0
|
||||||
|
};
|
||||||
|
// 'disablewebsecurity' is necessary to display external images.
|
||||||
|
// However, it allows also CSS/JavaScript.
|
||||||
|
// So webview should use 'allowDisplayingInsecureContent' as same as BrowserWindow.
|
||||||
|
return (
|
||||||
|
<webview style={ style } id="mainWebview" autosize="on" preload="webview/mattermost.js"></webview>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
ReactDOM.render(
|
||||||
|
<MainPage />,
|
||||||
|
document.getElementById('content')
|
||||||
|
);
|
Reference in New Issue
Block a user