This repository has been archived by the owner on Jun 20, 2022. It is now read-only.
/
index.html
269 lines (221 loc) · 10.3 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html ng-app="app">
<head>
<meta charset="utf-8"/>
<meta content="IE=edge" http-equiv="X-UA-Compatible"/>
<meta content="width=device-width, initial-scale=1" name="viewport"/>
<meta name="theme-color" content="#ffffff">
<title>Notes</title>
<script>
try {
const {ipcRenderer} = require('electron');
window.ipcRenderer = ipcRenderer;
// https://github.com/electron/electron/blob/master/docs/faq.md#i-can-not-use-jqueryrequirejsmeteorangularjs-in-electron
window.nodeRequire = require;
delete window.require;
delete window.exports;
delete window.module;
ipcRenderer.on('update-available', function (event, message) {
var controllerElement = document.querySelector('#home');
var controllerScope = angular.element(controllerElement).scope();
controllerScope.onUpdateAvailable(message);
});
// Download data archive
ipcRenderer.on('download-backup', function (event, message) {
var desktopManager = angular.element(document).injector().get('desktopManager');
desktopManager.desktop_didBeginBackup();
let data = desktopManager.desktop_requestBackupFile((data) => {
event.sender.send('data-archive', data);
});
});
ipcRenderer.on('finished-saving-backup', (event, message) => {
var desktopManager = angular.element(document).injector().get('desktopManager');
desktopManager.desktop_didFinishBackup(message.success);
})
}
catch (e) {
console.log(e);
}
// load zip library (for exporting items as zip)
var scriptTag = document.createElement('script');
scriptTag.src = "./vendor/zip/zip.js";
scriptTag.async = true;
var headTag = document.getElementsByTagName('head')[0];
headTag.appendChild(scriptTag);
scriptTag.onload = function() {
zip.workerScriptsPath = "./vendor/zip/";
}
window._default_sf_server = "https://sync.standardnotes.org";
window._extensions_manager_location = "extensions/extensions-manager/dist/index.html";
window._batch_manager_location = "extensions/batch-manager/dist/index.html";
</script>
<script src="standard-notes-web/javascripts/compiled.js" debug="false"></script>
<link rel="stylesheet" media="all" href="standard-notes-web/stylesheets/app.css" debug="false" />
<script>
const {remote, app} = window.nodeRequire('electron');
const Store = window.nodeRequire('./javascripts/main/store.js');
var userDataPath = remote.app.getPath('userData');
let useSystemMenuBar = Store.instance().get("useSystemMenuBar");
angular.element(document).ready(function () {
try {
window.nodeRequire("./javascripts/render/spellcheck.js")
} catch (e) {
console.error(e);
}
var desktopManager = angular.element(document).injector().get('desktopManager');
desktopManager.desktop_setApplicationDataPath(userDataPath);
ipcRenderer.on('window-blurred', function (event, message) {
desktopManager.desktop_windowLostFocus();
});
ipcRenderer.on('window-focused', function (event, message) {
desktopManager.desktop_windowGainedFocus();
});
/*
Responses from packageManager
*/
ipcRenderer.on('install-component-complete', function (event, data) {
// console.log("install-component-complete", data.component.content.name, data.error && data.error.tag);
desktopManager.desktop_onComponentInstallationComplete(data.component, data.error);
});
/*
Actions triggered from the web code
*/
/* Handled by PackageManager */
desktopManager.desktop_setComponentInstallationSyncHandler((componentsData) => {
ipcRenderer.send("sync-components", componentsData);
})
desktopManager.desktop_setInstallComponentHandler((componentData) => {
ipcRenderer.send("install-component", componentData);
});
desktopManager.desktop_setSearchHandler((text) => {
ipcRenderer.send("search-text", text);
});
/* Handled by ArchiveManager */
desktopManager.desktop_setInitialDataLoadHandler(() => {
ipcRenderer.send("initial-data-loaded");
})
desktopManager.desktop_setMajorDataChangeHandler(() => {
ipcRenderer.send("major-data-change");
})
/*
Title bar events
*/
document.getElementById("menu-btn").addEventListener("click", (e) => {
ipcRenderer.send("display-app-menu", { x: e.x, y: e.y })
});
document.getElementById("min-btn").addEventListener("click", (e) => {
remote.getCurrentWindow().minimize();
});
document.getElementById("max-btn").addEventListener("click", (e) => {
const currentWindow = remote.getCurrentWindow();
if(currentWindow.isMaximized()) {
currentWindow.unmaximize();
} else {
currentWindow.maximize();
}
});
document.getElementById("close-btn").addEventListener("click", (e) => {
remote.getCurrentWindow().close();
});
});
// For Mac inset window
var sheet = window.document.styleSheets[0];
let isMacOS = process.platform == "darwin";
if(isMacOS) {
sheet.insertRule('#tags-column { padding-top: 25px !important; }', sheet.cssRules.length);
}
if(isMacOS || useSystemMenuBar) {
// !important is important here because #desktop-title-bar has display: flex.
sheet.insertRule('#desktop-title-bar { display: none !important; }', sheet.cssRules.length);
} else {
// Use custom title bar. Take the sn-titlebar-height off of the app content height so its not overflowing
sheet.insertRule('.main-ui-view { height: calc(100vh - var(--sn-desktop-titlebar-height)) !important; min-height: calc(100vh - var(--sn-desktop-titlebar-height)) !important; }', sheet.cssRules.length);
}
// disable drag-n-drop of file in the app
document.addEventListener('dragover', event => event.preventDefault())
document.addEventListener('drop', event => event.preventDefault())
</script>
<style>
.editor-content .editable {
font-family: Menlo, Consolas, 'DejaVu Sans Mono', monospace;
font-size: 16px;
}
:root {
--sn-desktop-titlebar-height: 35px;
--sn-desktop-titlebar-icon-font-size: 16px;
}
/* To offset frameless window nav buttons on Mac */
.mac-desktop #editor-column, .mac-desktop #notes-column {
transition: 0.15s padding ease;
}
.mac-desktop #app.collapsed-notes.collapsed-tags #editor-column {
padding-top: 18px;
}
.mac-desktop #app.collapsed-tags #notes-column {
padding-top: 18px;
}
panel-resizer {
-webkit-app-region: no-drag;
}
#desktop-title-bar {
-webkit-app-region: drag;
padding: 0;
margin: 0;
height: var(--sn-desktop-titlebar-height);
line-height: var(--sn-desktop-titlebar-height);
vertical-align: middle;
background: var(--sn-stylekit-contrast-background-color) !important;
border-bottom: 1px solid var(--sn-stylekit-contrast-border-color);
display: flex;
justify-content: space-between;
}
#desktop-title-bar button {
-webkit-app-region: no-drag;
margin: 0;
background: none;
border: none;
padding: 0 10px;
color: var(--sn-stylekit-contrast-foreground-color);
vertical-align: middle;
height: 100%;
}
#desktop-title-bar button svg {
max-width: var(--sn-desktop-titlebar-icon-font-size);
}
#desktop-title-bar button:hover svg {
color: var(--sn-stylekit-info-color);
}
#desktop-title-bar .title-bar-left-buttons, #desktop-title-bar .title-bar-right-buttons {
font-size: 0;
}
/* Required for BrowserWindow titleBarStyle: 'hiddenInset' */
.mac-desktop .tags, .mac-desktop #tags-title-bar, .mac-desktop #notes-title-bar, .mac-desktop #editor-title-bar, .mac-desktop #lock-screen {
-webkit-app-region: drag;
}
input, .tags .content, .component-view-container {
-webkit-app-region: no-drag;
}
</style>
</head>
<body ng-class="bodyClass">
<div id="desktop-title-bar">
<div class="title-bar-left-buttons">
<button id="menu-btn">
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-menu"><line x1="3" y1="12" x2="21" y2="12"></line><line x1="3" y1="6" x2="21" y2="6"></line><line x1="3" y1="18" x2="21" y2="18"></line></svg>
</button>
</div>
<div class="title-bar-right-buttons">
<button id="min-btn">
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-minus"><line x1="5" y1="12" x2="19" y2="12"></line></svg>
</button>
<button id="max-btn">
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" y1="3" x2="14" y2="10"></line><line x1="3" y1="21" x2="10" y2="14"></line></svg>
</button>
<button id="close-btn">
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-x"><line x1="18" y1="6" x2="6" y2="18"></line><line x1="6" y1="6" x2="18" y2="18"></line></svg>
</button>
</div>
</div>
<div id="home" ng-controller="HomeCtrl" ng-include="'home.html'"></div>
</body>
</html>