Skip to content

Commit fa670e4

Browse files
committed
r0b08x [chore] 12/5/2020, 7:29:41 AM
1 parent c43ce4c commit fa670e4

File tree

18 files changed

+271
-23
lines changed

18 files changed

+271
-23
lines changed

LICENSE

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11

2-
@license p3x-onenote v2020.10.185
2+
@license p3x-onenote v2020.10.187
33

44
📚 P3X OneNote Linux
55

README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212

1313

14-
# 📚 P3X OneNote Linux v2020.10.185
14+
# 📚 P3X OneNote Linux v2020.10.187
1515

1616

1717

@@ -235,7 +235,7 @@ All my domains ([patrikx3.com](https://patrikx3.com) and [corifeus.com](https://
235235

236236
---
237237

238-
[**P3X-ONENOTE**](https://corifeus.com/onenote) Build v2020.10.185
238+
[**P3X-ONENOTE**](https://corifeus.com/onenote) Build v2020.10.187
239239

240240
[![Donate for Corifeus / P3X](https://img.shields.io/badge/Donate-Corifeus-003087.svg)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=QZVM4V6HVZJW6) [![Contact Corifeus / P3X](https://img.shields.io/badge/Contact-P3X-ff9900.svg)](https://www.patrikx3.com/en/front/contact) [![Like Corifeus @ Facebook](https://img.shields.io/badge/LIKE-Corifeus-3b5998.svg)](https://www.facebook.com/corifeus.software)
241241

artifacts/arm.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ All my domains ([patrikx3.com](https://patrikx3.com) and [corifeus.com](https://
2525

2626
---
2727

28-
[**P3X-ONENOTE**](https://corifeus.com/onenote) Build v2020.10.185
28+
[**P3X-ONENOTE**](https://corifeus.com/onenote) Build v2020.10.187
2929

3030
[![Donate for Corifeus / P3X](https://img.shields.io/badge/Donate-Corifeus-003087.svg)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=QZVM4V6HVZJW6) [![Contact Corifeus / P3X](https://img.shields.io/badge/Contact-P3X-ff9900.svg)](https://www.patrikx3.com/en/front/contact) [![Like Corifeus @ Facebook](https://img.shields.io/badge/LIKE-Corifeus-3b5998.svg)](https://www.facebook.com/corifeus.software)
3131

artifacts/new-language.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ All my domains ([patrikx3.com](https://patrikx3.com) and [corifeus.com](https://
2525

2626
---
2727

28-
[**P3X-ONENOTE**](https://corifeus.com/onenote) Build v2020.10.185
28+
[**P3X-ONENOTE**](https://corifeus.com/onenote) Build v2020.10.187
2929

3030
[![Donate for Corifeus / P3X](https://img.shields.io/badge/Donate-Corifeus-003087.svg)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=QZVM4V6HVZJW6) [![Contact Corifeus / P3X](https://img.shields.io/badge/Contact-P3X-ff9900.svg)](https://www.patrikx3.com/en/front/contact) [![Like Corifeus @ Facebook](https://img.shields.io/badge/LIKE-Corifeus-3b5998.svg)](https://www.facebook.com/corifeus.software)
3131

artifacts/npm.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ All my domains ([patrikx3.com](https://patrikx3.com) and [corifeus.com](https://
3838

3939
---
4040

41-
[**P3X-ONENOTE**](https://corifeus.com/onenote) Build v2020.10.185
41+
[**P3X-ONENOTE**](https://corifeus.com/onenote) Build v2020.10.187
4242

4343
[![Donate for Corifeus / P3X](https://img.shields.io/badge/Donate-Corifeus-003087.svg)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=QZVM4V6HVZJW6) [![Contact Corifeus / P3X](https://img.shields.io/badge/Contact-P3X-ff9900.svg)](https://www.patrikx3.com/en/front/contact) [![Like Corifeus @ Facebook](https://img.shields.io/badge/LIKE-Corifeus-3b5998.svg)](https://www.facebook.com/corifeus.software)
4444

changelog.md

+4-1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@
77

88
## Change log
99

10+
### v2020.10.187
11+
* FEATURE: Add bookmarks menu.
12+
1013
### v2020.10.179
1114
* BUILD: Removed 32 bit version in Linux.
1215

@@ -207,7 +210,7 @@ All my domains ([patrikx3.com](https://patrikx3.com) and [corifeus.com](https://
207210

208211
---
209212

210-
[**P3X-ONENOTE**](https://corifeus.com/onenote) Build v2020.10.185
213+
[**P3X-ONENOTE**](https://corifeus.com/onenote) Build v2020.10.187
211214

212215
[![Donate for Corifeus / P3X](https://img.shields.io/badge/Donate-Corifeus-003087.svg)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=QZVM4V6HVZJW6) [![Contact Corifeus / P3X](https://img.shields.io/badge/Contact-P3X-ff9900.svg)](https://www.patrikx3.com/en/front/contact) [![Like Corifeus @ Facebook](https://img.shields.io/badge/LIKE-Corifeus-3b5998.svg)](https://www.facebook.com/corifeus.software)
213216

package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "p3x-onenote",
3-
"version": "2020.10.185",
3+
"version": "2020.10.187",
44
"description": "📚 P3X OneNote Linux",
55
"main": "src/electron/app.js",
66
"corifeus": {
@@ -55,7 +55,7 @@
5555
"corifeus-utils": "^2020.10.139",
5656
"electron-updater": "^4.3.5",
5757
"opencollective": "^1.0.3",
58-
"semver": "^7.3.2",
58+
"semver": "^7.3.4",
5959
"fontsource-roboto": "^3.0.3",
6060
"electron": "^11.0.3"
6161
},

src/electron/app.js

+1
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ global.p3x = {
4343
menus: undefined,
4444
mainMenu: undefined,
4545
setVisible: undefined,
46+
bookmarksEditMode: false,
4647
createWindow: {
4748
onenote: undefined,
4849
},

src/electron/main/create/menu.js

+50
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,61 @@ function mainMenu() {
4141
languageCheckbox.push(transMenu)
4242
}
4343

44+
const bookmarksMenu = [
45+
{
46+
label: global.p3x.onenote.lang.bookmarks.add,
47+
click: () => {
48+
global.p3x.onenote.window.onenote.webContents.send('p3x-onenote-action-bookmark-add', {
49+
edit: false,
50+
})
51+
}
52+
},
53+
]
54+
55+
const bookmarks = global.p3x.onenote.conf.get('bookmarks') || []
56+
57+
if (bookmarks.length > 0) {
58+
bookmarksMenu.push({
59+
label: global.p3x.onenote.lang.bookmarks.edit,
60+
type: 'checkbox',
61+
checked: global.p3x.onenote.bookmarksEditMode,
62+
click: () => {
63+
global.p3x.onenote.bookmarksEditMode = !global.p3x.onenote.bookmarksEditMode
64+
}
65+
})
66+
bookmarksMenu.push({
67+
type: 'separator'
68+
})
69+
}
70+
71+
for(let bookmarkIndex in bookmarks) {
72+
const bookmark = bookmarks[bookmarkIndex]
73+
const thisBookmarkIndex = bookmarkIndex
74+
bookmarksMenu.push({
75+
label: bookmark.title,
76+
click: () => {
77+
if (global.p3x.onenote.bookmarksEditMode !== true) {
78+
global.p3x.onenote.window.onenote.webContents.send('p3x-onenote-action-bookmark-open', bookmark)
79+
} else {
80+
global.p3x.onenote.window.onenote.webContents.send('p3x-onenote-action-bookmark-add', {
81+
edit: true,
82+
index: thisBookmarkIndex,
83+
model: bookmark,
84+
})
85+
}
86+
}
87+
})
88+
}
89+
4490
const template = [
4591
{
4692
label: global.p3x.onenote.title,
4793
submenu: menus.default(),
4894
},
95+
{
96+
label: global.p3x.onenote.lang.bookmarks.title,
97+
submenu: bookmarksMenu
98+
},
4999
{
50100
label: p3x.onenote.lang.menu.action,
51101
submenu: [

src/electron/main/ipc-main.js

+20-1
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,30 @@ ipcMain.on('did-finish-load', function () {
66
});
77

88
ipcMain.on('p3x-onenote-save', function (event, data) {
9-
// console.log('p3x-onenote-save', data)
109
global.p3x.onenote.conf.set('webview-onenote', data);
1110
//global.p3x.onenote.conf.set('window-bounds', global.p3x.onenote.window.onenote.getBounds());
1211
})
1312

13+
ipcMain.on('p3x-onenote-action-bookmark-result', function (event, data) {
14+
//console.log('p3x-onenote-action-bookmark-result', data)
15+
const bookmarks = global.p3x.onenote.conf.get('bookmarks') || []
16+
if (data.opts.edit !== true) {
17+
bookmarks.push(data.model)
18+
} else {
19+
if (data.delete === true) {
20+
bookmarks.splice(data.opts.index, 1);
21+
} else {
22+
bookmarks[data.opts.index] = data.model
23+
}
24+
}
25+
26+
global.p3x.onenote.conf.set('bookmarks', bookmarks)
27+
28+
global.p3x.onenote.mainMenu();
29+
global.p3x.onenote.mainTray()
30+
})
31+
32+
1433
ipcMain.on('p3x-debug', (event, data) => {
1534
console.log(data)
1635
})

src/electron/window/onenote/angular/prompt/index.js

+92-1
Original file line numberDiff line numberDiff line change
@@ -88,18 +88,109 @@ global.p3x.onenote.ng.factory('p3xOnenotePrompt', ($mdDialog) => {
8888
</md-dialog-content>
8989
9090
<md-dialog-actions>
91+
<md-button ng-click="cancel()" class="md-primary">
92+
${p3x.onenote.lang.button.cancel}
93+
</md-button>
9194
<md-button ng-click="exit('external')" class="md-primary">
9295
${p3x.onenote.lang.dialog.redirect.urlExternal}
9396
</md-button>
9497
<md-button ng-click="exit('internal')" class="md-primary">
9598
${p3x.onenote.lang.dialog.redirect.urlInternal}
9699
</md-button>
100+
</md-dialog-actions>
101+
</md-dialog>`,
102+
controller: function ($mdDialog, $scope) {
103+
$scope.exit = (answer) => {
104+
$mdDialog.hide(answer);
105+
}
106+
107+
$scope.cancel = $mdDialog.cancel
108+
}
109+
});
110+
111+
}
112+
113+
this.bookmarks = (opts) => {
114+
let deleteButton = ''
115+
if (opts.edit === true) {
116+
deleteButton = `
117+
<md-button ng-click="delete()" class="md-primary">
118+
${p3x.onenote.lang.button.delete}
119+
</md-button>
120+
`
121+
}
122+
return $mdDialog.show({
123+
template: `
124+
<form novalidate name="urlForm" ng-submit="submit()">
125+
<md-dialog style="min-width: 320px">
126+
127+
<md-dialog-content>
128+
<md-content layout-padding>
129+
<h3 flex>
130+
${p3x.onenote.lang.bookmarks.add}
131+
</h3>
132+
<div>
133+
<md-input-container class="md-block">
134+
<label> ${p3x.onenote.lang.bookmarks.form.title}</label>
135+
<input required ng-model="model.title" name="title"/>
136+
137+
<div ng-messages="urlForm.title.$error">
138+
<div ng-message="required">${p3x.onenote.lang.validation.required}</div>
139+
</div>
140+
</md-input-container>
141+
<md-input-container class="md-block">
142+
<label> ${p3x.onenote.lang.bookmarks.form.url}</label>
143+
<input type="url" required ng-model="model.url" name="url"/>
144+
145+
<div ng-messages="urlForm.url.$error">
146+
<div ng-message="required">${p3x.onenote.lang.validation.required}</div>
147+
<div ng-message="url">${p3x.onenote.lang.validation.url}</div>
148+
</div>
149+
</md-input-container>
150+
</div>
151+
</md-content>
152+
</md-dialog-content>
153+
154+
<md-dialog-actions>
97155
<md-button ng-click="cancel()" class="md-primary">
98156
${p3x.onenote.lang.button.cancel}
99157
</md-button>
158+
${deleteButton}
159+
<md-button type="submit" class="md-primary">
160+
${p3x.onenote.lang.button.save}
161+
</md-button>
100162
</md-dialog-actions>
101-
</md-dialog>`,
163+
</md-dialog>
164+
</form>
165+
`,
102166
controller: function ($mdDialog, $scope) {
167+
168+
$scope.model = {
169+
title: undefined,
170+
url: undefined,
171+
}
172+
173+
if (opts.model) {
174+
$scope.model = opts.model
175+
}
176+
177+
$scope.submit = () => {
178+
if ($scope.urlForm.$valid) {
179+
$mdDialog.hide({
180+
opts: opts,
181+
model: $scope.model,
182+
});
183+
}
184+
}
185+
186+
$scope.delete = () => {
187+
$mdDialog.hide({
188+
delete: true,
189+
opts: opts,
190+
model: $scope.model,
191+
});
192+
}
193+
103194
$scope.exit = (answer) => {
104195
$mdDialog.hide(answer);
105196
}

src/electron/window/onenote/index.html

+1-2
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@
55

66
<meta charset="utf-8">
77
<meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no">
8-
<meta http-equiv="Content-Security-Policy" content="unsafe-inline">
9-
<link rel="stylesheet" href="../../../../node_modules/fontsource-roboto/latin.css"/>
8+
<link rel="stylesheet" href="../../../../node_modules/fontsource-roboto/index.css"/>
109
<link rel="stylesheet" href="../../../../node_modules/angular/angular-csp.css">
1110
<link rel="stylesheet" href="../../../../node_modules/angular-material/angular-material.css">
1211
<link rel="stylesheet" href="../../../../node_modules/@fortawesome/fontawesome-free/css/all.css">

src/electron/window/onenote/ipc/handler.js

+20
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,26 @@ const handler = (options) => {
8383
}
8484
})
8585

86+
ipcRenderer.on('p3x-onenote-action-bookmark-open', (event, data) => {
87+
global.p3x.onenote.webview.src = data.url
88+
})
89+
90+
ipcRenderer.on('p3x-onenote-action-bookmark-add', async (event, data) => {
91+
try {
92+
const result = await global.p3x.onenote.prompt.bookmarks(data);
93+
ipcRenderer.send('p3x-onenote-action-bookmark-result', result);
94+
95+
} catch (e) {
96+
if (e !== undefined) {
97+
alert(e.message)
98+
console.error(e);
99+
}
100+
}
101+
})
102+
103+
104+
105+
86106
}
87107

88108
module.exports = handler

src/translation/de-DE.js

+15-2
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ const translation = {
7575
save: 'Speichern',
7676
clear: 'Neu',
7777
go: 'Los',
78-
78+
delete: 'Löschen',
7979
},
8080
menu: {
8181
action: 'Bearbeiten',
@@ -134,7 +134,20 @@ const translation = {
134134
return 'Heruntergeladen ' + opts.progressObj.percent + '%'
135135
},
136136
'update-downloaded': 'Aktuellste Version geladen. Neustarten um den Updatevorgang abzuschließen.'
137-
}
137+
},
138+
bookmarks: {
139+
title: 'Lesezeichen',
140+
add: 'Lesezeichen hinzufügen',
141+
edit: 'Lesezeichen bearbeiten',
142+
form: {
143+
title: 'Titel',
144+
url: 'URL'
145+
}
146+
},
147+
validation: {
148+
required: 'Erforderlich',
149+
url: 'Ungültige URL',
150+
},
138151
};
139152

140153
module.exports = translation;

src/translation/en-US.js

+15-2
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ const translation = {
7676
save: 'Save',
7777
clear: 'Clear',
7878
go: 'Go',
79-
79+
delete: 'Delete',
8080
},
8181
menu: {
8282
action: 'Action',
@@ -135,7 +135,20 @@ const translation = {
135135
return 'Downloaded ' + opts.progressObj.percent + '%'
136136
},
137137
'update-downloaded': 'Update downloaded. You may restart the app to update.'
138-
}
138+
},
139+
bookmarks: {
140+
title: 'Bookmarks',
141+
add: 'Add bookmark',
142+
edit: 'Edit bookmarks',
143+
form: {
144+
title: 'Title',
145+
url: 'URL'
146+
}
147+
},
148+
validation: {
149+
required: 'Required',
150+
url: 'Invalid url',
151+
},
139152
};
140153

141154
module.exports = translation;

0 commit comments

Comments
 (0)