Skip to content

Commit 8839375

Browse files
committed
Merge branch 'dev' into main
2 parents d8ed0a5 + 6216397 commit 8839375

File tree

28 files changed

+211
-130
lines changed

28 files changed

+211
-130
lines changed

apps/client/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "@deepnotes/client",
33
"description": "DeepNotes",
44
"homepage": "https://deepnotes.app",
5-
"version": "1.0.4",
5+
"version": "1.0.5",
66
"author": "Gustavo Toyota <[email protected]>",
77
"dependencies": {
88
"@_ueberdosis/prosemirror-tables": "1.1.3",
@@ -54,6 +54,7 @@
5454
"dotenv": "16.0.3",
5555
"dotenv-expand": "9.0.0",
5656
"downloadjs": "^1.4.7",
57+
"electron-context-menu": "^3.6.1",
5758
"electron-log": "^4.4.8",
5859
"electron-updater": "4.3.1",
5960
"express": "4.18.2",
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
#Mon Jul 24 09:09:25 AMT 2023
2-
VERSION_CODE=41
1+
#Wed Jul 26 15:09:36 AMT 2023
2+
VERSION_CODE=42

apps/client/src-capacitor/ios/App/App.xcodeproj/project.pbxproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -355,7 +355,7 @@
355355
INFOPLIST_KEY_LSApplicationCategoryType = "public.app-category.productivity";
356356
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
357357
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
358-
MARKETING_VERSION = 1.0.2;
358+
MARKETING_VERSION = 1.0.3;
359359
OTHER_SWIFT_FLAGS = "$(inherited) \"-D\" \"COCOAPODS\" \"-DDEBUG\"";
360360
PRODUCT_BUNDLE_IDENTIFIER = app.deepnotes;
361361
PRODUCT_NAME = "$(TARGET_NAME)";
@@ -382,7 +382,7 @@
382382
INFOPLIST_KEY_LSApplicationCategoryType = "public.app-category.productivity";
383383
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
384384
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
385-
MARKETING_VERSION = 1.0.2;
385+
MARKETING_VERSION = 1.0.3;
386386
PRODUCT_BUNDLE_IDENTIFIER = app.deepnotes;
387387
PRODUCT_NAME = "$(TARGET_NAME)";
388388
PROVISIONING_PROFILE_SPECIFIER = "";

apps/client/src-electron/electron-main.ts

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,14 @@
1-
import { app, BrowserWindow, ipcMain, nativeTheme } from 'electron';
1+
import { app, BrowserWindow, ipcMain, nativeTheme, shell } from 'electron';
22
import cookie from 'cookie';
33
import path from 'path';
44
import os from 'os';
55
import log from 'electron-log';
66
import { autoUpdater } from 'electron-updater';
7+
import contextMenu from 'electron-context-menu';
8+
9+
contextMenu({
10+
showSaveImageAs: true,
11+
});
712

813
log.transports.file.level = 'info';
914

@@ -83,15 +88,8 @@ function createWindow() {
8388
}
8489

8590
mainWindow.webContents.setWindowOpenHandler((details) => {
86-
return {
87-
action: 'allow',
88-
overrideBrowserWindowOptions: {
89-
autoHideMenuBar: true,
90-
webPreferences: {
91-
devTools: false,
92-
},
93-
},
94-
};
91+
shell.openExternal(details.url);
92+
return { action: 'deny' };
9593
});
9694

9795
mainWindow.on('closed', () => {

apps/client/src/code/pages/composables/use-page-navigation-interception.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,11 +60,12 @@ export function usePageNavigationInterception() {
6060
event.preventDefault(); // Prevent default
6161

6262
const matches =
63-
href.match(/\/(?:pages|groups)\/([\w-]{21})(?:\?note=([\w-]{21}))?/) ??
64-
[];
63+
href.match(
64+
/\/(?:pages|groups)\/([\w-]{21})(?:\?(?:note|elem)=([\w-]{21}))?/,
65+
) ?? [];
6566

6667
const id = matches[1];
67-
const noteId = matches[2];
68+
const elemId = matches[2];
6869

6970
if (href.includes('/groups/')) {
7071
await internals.pages.goToGroup(id, {
@@ -75,7 +76,7 @@ export function usePageNavigationInterception() {
7576
await internals.pages.goToPage(id, {
7677
fromParent: true,
7778
openInNewTab: isCtrlDown(event),
78-
noteId,
79+
elemId,
7980
});
8081
}
8182
} catch (error) {

apps/client/src/code/pages/page/elems/find-and-replace.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ export class PageFindAndReplace {
163163
editor.commands.setTextSelection(result);
164164
editor.commands.focus(undefined, { scrollIntoView: false });
165165

166-
scrollIntoView(resultElems[this.resultIndex] as HTMLElement, {
166+
scrollIntoView(resultElems[this.resultIndex], {
167167
centerCamera: true,
168168
});
169169
}

apps/client/src/code/pages/page/notes/note.ts

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ export interface INoteReact extends IRegionReact, IElemReact {
109109
color: ComputedRef<string>;
110110

111111
link: {
112+
url: ComputedRef<string>;
112113
external: ComputedRef<boolean>;
113114
};
114115

@@ -460,7 +461,7 @@ export class PageNote extends PageElem() implements IPageRegion {
460461
return 'default';
461462
}
462463

463-
if (this.react.collab.link) {
464+
if (this.react.link.url) {
464465
return 'pointer';
465466
}
466467

@@ -476,26 +477,24 @@ export class PageNote extends PageElem() implements IPageRegion {
476477
),
477478

478479
link: {
479-
external: computed(() => {
480-
if (this.react.collab.link == null) {
481-
return false;
480+
url: computed(() => {
481+
if (!this.react.collab.link) {
482+
return '';
482483
}
483484

484-
if (
485-
!this.react.collab.link.startsWith('http://') &&
486-
!this.react.collab.link.startsWith('https://')
487-
) {
488-
return false;
485+
if (this.react.collab.link.startsWith('/')) {
486+
return `https://deepnotes.app${this.react.collab.link}`;
489487
}
490488

491-
if (
492-
this.react.collab.link.startsWith('http://deepnotes.app/pages/')
493-
) {
494-
return false;
489+
if (!this.react.collab.link.includes('://')) {
490+
return `https://deepnotes.app/${this.react.collab.link}`;
495491
}
496492

497-
return true;
493+
return this.react.collab.link;
498494
}),
495+
external: computed(
496+
() => !this.react.link.url.startsWith('https://deepnotes.app/pages/'),
497+
),
499498
},
500499

501500
editors: computed(() => {

apps/client/src/code/pages/page/page.ts

Lines changed: 20 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -300,18 +300,26 @@ export class Page implements IPageRegion {
300300

301301
mainLogger.sub('page.finishSetup').info('All notes loaded');
302302

303-
const noteId = (route().value.query.note as string) ?? '';
304-
305-
if (isNanoID(noteId)) {
306-
const note = this.notes.fromId(noteId);
307-
308-
if (note != null) {
309-
this.selection.set(note);
310-
311-
const noteElem = note.getElem('note-frame');
312-
313-
if (noteElem != null) {
314-
scrollIntoView(noteElem, { animate: false, centerCamera: true });
303+
const elemId =
304+
((route().value.query.note ?? route().value.query.elem) as string) ??
305+
'';
306+
307+
if (isNanoID(elemId)) {
308+
const elem = this.notes.fromId(elemId) ?? this.arrows.fromId(elemId);
309+
310+
if (elem != null) {
311+
this.selection.set(elem);
312+
313+
const elemElem =
314+
elem.type === 'note'
315+
? elem.getElem('note-frame')
316+
: elem.getHitboxElem();
317+
318+
if (elemElem != null) {
319+
scrollIntoView(elemElem, {
320+
animate: false,
321+
centerCamera: true,
322+
});
315323
}
316324
}
317325
}

apps/client/src/code/pages/pages.ts

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -201,14 +201,14 @@ export class Pages {
201201

202202
async goToPage(
203203
pageId: string,
204-
params?: { fromParent?: boolean; openInNewTab?: boolean; noteId?: string },
204+
params?: { fromParent?: boolean; openInNewTab?: boolean; elemId?: string },
205205
) {
206206
mainLogger.sub('Pages.goToPage').info('pageId: %s', pageId);
207207

208208
if (params?.openInNewTab) {
209209
window.open(
210210
multiModePath(
211-
`/pages/${pageId}${params?.noteId ? `?note=${params?.noteId}` : ''}`,
211+
`/pages/${pageId}${params?.elemId ? `?elem=${params?.elemId}` : ''}`,
212212
),
213213
'_blank',
214214
);
@@ -220,7 +220,7 @@ export class Pages {
220220
await router().push({
221221
name: 'page',
222222
params: { pageId },
223-
query: { note: params?.noteId },
223+
query: { elem: params?.elemId },
224224
});
225225

226226
const cachedPage = this.pageCache.get(pageId);
@@ -229,17 +229,22 @@ export class Pages {
229229
cachedPage != null &&
230230
cachedPage.react.status === 'success' &&
231231
!cachedPage.react.loading &&
232-
isNanoID(params?.noteId ?? '')
232+
isNanoID(params?.elemId ?? '')
233233
) {
234-
const note = cachedPage.notes.fromId(params?.noteId!);
234+
const elem =
235+
cachedPage.notes.fromId(params?.elemId!) ??
236+
cachedPage.arrows.fromId(params?.elemId!);
235237

236-
if (note != null) {
237-
cachedPage.selection.set(note);
238+
if (elem != null) {
239+
cachedPage.selection.set(elem);
238240

239-
const noteElem = note.getElem('note-frame');
241+
const elemElem =
242+
elem.type === 'note'
243+
? elem.getElem('note-frame')
244+
: elem.getHitboxElem();
240245

241-
if (noteElem != null) {
242-
scrollIntoView(noteElem, { centerCamera: true });
246+
if (elemElem != null) {
247+
scrollIntoView(elemElem, { centerCamera: true });
243248
}
244249
}
245250
}

apps/client/src/code/utils/scroll-into-view.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,17 +15,17 @@ function easeInOutQuint(x: number): number {
1515
}
1616

1717
export function scrollIntoView(
18-
target: HTMLElement,
18+
target: Element,
1919
params?: { animate?: boolean; centerCamera?: boolean },
2020
) {
21-
let ancestor: HTMLElement | null = target.parentElement;
21+
let ancestor: Element | null = target.parentElement;
2222

2323
const targetRect = domRectScreenToWorld(target.getBoundingClientRect());
2424

25-
const scrollElems: { elem: HTMLElement; from: IVec2; to: IVec2 }[] = [];
25+
const scrollElems: { elem: Element; from: IVec2; to: IVec2 }[] = [];
2626

2727
while (ancestor != null) {
28-
if (hasScrollbar(ancestor)) {
28+
if (hasScrollbar(ancestor as HTMLElement)) {
2929
const ancestorRect = domRectScreenToWorld(
3030
ancestor.getBoundingClientRect(),
3131
);

0 commit comments

Comments
 (0)