aboutsummaryrefslogtreecommitdiffstats
path: root/src/features/todos/components/TodosWebview.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/features/todos/components/TodosWebview.js')
-rw-r--r--src/features/todos/components/TodosWebview.js15
1 files changed, 8 insertions, 7 deletions
diff --git a/src/features/todos/components/TodosWebview.js b/src/features/todos/components/TodosWebview.js
index b31c7d858..1d423544b 100644
--- a/src/features/todos/components/TodosWebview.js
+++ b/src/features/todos/components/TodosWebview.js
@@ -7,14 +7,15 @@ import classnames from 'classnames';
7 7
8import { TODOS_PARTITION_ID } from '../../../config'; 8import { TODOS_PARTITION_ID } from '../../../config';
9 9
10const styles = (theme) => ({ 10const styles = theme => ({
11 root: { 11 root: {
12 background: theme.colorBackground, 12 background: theme.colorBackground,
13 position: 'relative', 13 position: 'relative',
14 borderLeft: [1, 'solid', theme.todos.todosLayer.borderLeftColor], 14 borderLeft: [1, 'solid', theme.todos.todosLayer.borderLeftColor],
15 zIndex: 300, 15 zIndex: 300,
16 16
17 transform: ({ isVisible, width, isTodosServiceActive }) => `translateX(${isVisible || isTodosServiceActive ? 0 : width}px)`, 17 transform: ({ isVisible, width, isTodosServiceActive }) =>
18 `translateX(${isVisible || isTodosServiceActive ? 0 : width}px)`,
18 19
19 '& webview': { 20 '& webview': {
20 height: '100%', 21 height: '100%',
@@ -79,7 +80,7 @@ class TodosWebview extends Component {
79 this.node.addEventListener('mouseleave', this.stopResize.bind(this)); 80 this.node.addEventListener('mouseleave', this.stopResize.bind(this));
80 } 81 }
81 82
82 startResize = (event) => { 83 startResize = event => {
83 this.setState({ 84 this.setState({
84 isDragging: true, 85 isDragging: true,
85 initialPos: event.clientX, 86 initialPos: event.clientX,
@@ -126,7 +127,7 @@ class TodosWebview extends Component {
126 startListeningToIpcMessages() { 127 startListeningToIpcMessages() {
127 const { handleClientMessage } = this.props; 128 const { handleClientMessage } = this.props;
128 if (!this.webview) return; 129 if (!this.webview) return;
129 this.webview.addEventListener('ipc-message', (e) => { 130 this.webview.addEventListener('ipc-message', e => {
130 // console.log(e); 131 // console.log(e);
131 handleClientMessage({ channel: e.channel, message: e.args[0] }); 132 handleClientMessage({ channel: e.channel, message: e.args[0] });
132 }); 133 });
@@ -159,7 +160,7 @@ class TodosWebview extends Component {
159 })} 160 })}
160 style={{ width: displayedWidth }} 161 style={{ width: displayedWidth }}
161 onMouseUp={() => this.stopResize()} 162 onMouseUp={() => this.stopResize()}
162 ref={(node) => { 163 ref={node => {
163 this.node = node; 164 this.node = node;
164 }} 165 }}
165 id="todos-panel" 166 id="todos-panel"
@@ -170,7 +171,7 @@ class TodosWebview extends Component {
170 left: delta, 171 left: delta,
171 ...(isDragging ? { width: 600, marginLeft: -200 } : {}), 172 ...(isDragging ? { width: 600, marginLeft: -200 } : {}),
172 }} // This hack is required as resizing with webviews beneath behaves quite bad 173 }} // This hack is required as resizing with webviews beneath behaves quite bad
173 onMouseDown={(e) => this.startResize(e)} 174 onMouseDown={e => this.startResize(e)}
174 /> 175 />
175 {isDragging && ( 176 {isDragging && (
176 <div 177 <div
@@ -188,7 +189,7 @@ class TodosWebview extends Component {
188 }} 189 }}
189 partition={TODOS_PARTITION_ID} 190 partition={TODOS_PARTITION_ID}
190 preload="./features/todos/preload.js" 191 preload="./features/todos/preload.js"
191 ref={(webview) => { 192 ref={webview => {
192 this.webview = webview ? webview.view : null; 193 this.webview = webview ? webview.view : null;
193 }} 194 }}
194 useragent={userAgent} 195 useragent={userAgent}