Skip to content

Commit 689dcbe

Browse files
committed
Merge branch 'dev' into main
2 parents fed6cd7 + 2654ee4 commit 689dcbe

File tree

14 files changed

+240
-73
lines changed

14 files changed

+240
-73
lines changed

apps/client/package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@deepnotes/client",
33
"description": "DeepNotes",
4-
"version": "0.0.2",
4+
"version": "1.0.0",
55
"author": "Gustavo Toyota <[email protected]>",
66
"dependencies": {
77
"@_ueberdosis/prosemirror-tables": "1.1.3",
@@ -50,6 +50,7 @@
5050
"compression": "1.7.4",
5151
"cookie": "0.5.0",
5252
"crypto-js": "^4.1.1",
53+
"dotenv": "16.0.3",
5354
"dotenv-expand": "9.0.0",
5455
"downloadjs": "^1.4.7",
5556
"electron-log": "^4.4.8",
@@ -90,6 +91,7 @@
9091
"zod": "3.19.1"
9192
},
9293
"devDependencies": {
94+
"@electron/notarize": "^2.1.0",
9395
"@intlify/vite-plugin-vue-i18n": "3.4.0",
9496
"@quasar/app-vite": "^1.4.3",
9597
"@types/argon2-browser": "^1.18.1",
@@ -105,7 +107,6 @@
105107
"@types/zxcvbn": "4.4.1",
106108
"@vue/devtools": "6.4.5",
107109
"autoprefixer": "10.4.13",
108-
"dotenv": "16.0.3",
109110
"electron": "25.2.0",
110111
"electron-builder": "^24.4.0",
111112
"electron-packager": "^17.1.1",

apps/client/quasar.config.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -327,13 +327,25 @@ module.exports = configure(function (ctx) {
327327

328328
mac: {
329329
target: 'dmg',
330+
331+
hardenedRuntime: true,
332+
gatekeeperAssess: false,
333+
entitlements: 'src-capacitor/ios/App/App/entitlements.mac.plist',
334+
entitlementsInherit:
335+
'src-capacitor/ios/App/App/entitlements.mac.plist',
330336
},
331337
linux: {
332338
target: 'AppImage',
333339
},
334340
win: {
335341
target: 'nsis',
336342
},
343+
344+
dmg: {
345+
sign: false,
346+
},
347+
348+
afterSign: 'src-electron/notarize.js',
337349
},
338350
},
339351

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict>
5+
<key>com.apple.security.cs.allow-jit</key>
6+
<true/>
7+
</dict>
8+
</plist>
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
require('dotenv').config();
2+
const { notarize } = require('@electron/notarize');
3+
4+
exports.default = async function notarizing(context) {
5+
const { electronPlatformName, appOutDir } = context;
6+
if (electronPlatformName !== 'darwin') {
7+
return;
8+
}
9+
10+
const appName = context.packager.appInfo.productFilename;
11+
12+
return await notarize({
13+
appBundleId: 'app.deepnotes',
14+
appPath: `${appOutDir}/${appName}.app`,
15+
appleId: process.env.APPLE_ID,
16+
appleIdPassword: process.env.APPLE_ID_PASSWORD,
17+
teamId: process.env.TEAM_ID,
18+
});
19+
};

apps/client/src/App.vue

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,10 @@ html {
144144
isolation: isolate;
145145
}
146146
147+
a {
148+
text-decoration: none;
149+
}
150+
147151
h1,
148152
h2,
149153
h3 {

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

Lines changed: 82 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -135,36 +135,20 @@ export class Serialization {
135135
arrowMap: new Map(),
136136
};
137137

138-
for (const note of input.notes) {
139-
for (const arrow of internals.pages.react.page.arrows.fromIds(
140-
Array.from(note.incomingArrowIds),
141-
)) {
142-
input.arrows.push(arrow);
143-
}
144-
145-
for (const arrow of internals.pages.react.page.arrows.fromIds(
146-
Array.from(note.outgoingArrowIds),
147-
)) {
148-
input.arrows.push(arrow);
149-
}
150-
}
151-
152-
this._serializeRegion(input, aux.serialObj.root, aux);
138+
this._serializeRegionNotes(input, aux.serialObj.root, aux);
139+
this._serializeRegionArrows(input, aux.serialObj.root, aux);
153140

154141
return aux.serialObj;
155142
}
156-
private _serializeRegion(
143+
144+
private _serializeRegionNotes(
157145
region: IRegionElemsOutput,
158146
serialRegion: ISerialRegionOutput,
159147
aux: SerializationAux,
160148
) {
161149
for (const note of region.notes) {
162150
this._serializeNote(note, serialRegion, aux);
163151
}
164-
165-
for (const arrow of region.arrows) {
166-
this._serializeArrow(arrow, serialRegion, aux);
167-
}
168152
}
169153
private _serializeNote(
170154
note: PageNote,
@@ -203,7 +187,36 @@ export class Serialization {
203187
serialRegion.noteIdxs.push(noteIndex);
204188
aux.noteMap.set(note.id, noteIndex);
205189

206-
this._serializeRegion(note.react, serialNote, aux);
190+
this._serializeRegionNotes(note.react, serialNote, aux);
191+
}
192+
193+
private _serializeRegionArrows(
194+
region: IRegionElemsOutput,
195+
serialRegion: ISerialRegionOutput,
196+
aux: SerializationAux,
197+
note?: PageNote,
198+
) {
199+
for (const arrow of [
200+
...region.arrows,
201+
202+
...internals.pages.react.page.arrows.fromIds(
203+
Array.from(note?.incomingArrowIds ?? []),
204+
),
205+
...internals.pages.react.page.arrows.fromIds(
206+
Array.from(note?.outgoingArrowIds ?? []),
207+
),
208+
]) {
209+
this._serializeArrow(arrow, serialRegion, aux);
210+
}
211+
212+
for (const note of region.notes) {
213+
this._serializeRegionArrows(
214+
note.react,
215+
aux.serialObj.notes[aux.noteMap.get(note.id)!],
216+
aux,
217+
note,
218+
);
219+
}
207220
}
208221
private _serializeArrow(
209222
arrow: PageArrow,
@@ -256,7 +269,15 @@ export class Serialization {
256269
});
257270

258271
internals.pages.react.page.collab.doc.transact(() => {
259-
this._deserializeRegion(
272+
this._deserializeRegionNotes(
273+
serialObj.root,
274+
serialObj,
275+
noteMap,
276+
destRegion.id,
277+
fakeRegionCollab,
278+
);
279+
280+
this._deserializeRegionArrows(
260281
serialObj.root,
261282
serialObj,
262283
noteMap,
@@ -285,7 +306,7 @@ export class Serialization {
285306
),
286307
};
287308
}
288-
private _deserializeRegion(
309+
private _deserializeRegionNotes(
289310
serialRegion: ISerialRegionOutput,
290311
serialObj: ISerialObjectOutput,
291312
noteMap: Map<number, string>,
@@ -302,16 +323,8 @@ export class Serialization {
302323
destRegionCollab,
303324
);
304325
}
305-
306-
for (const arrowIndex of serialRegion.arrowIdxs) {
307-
this._deserializeArrow(
308-
serialObj.arrows[arrowIndex],
309-
noteMap,
310-
destRegionId,
311-
destRegionCollab,
312-
);
313-
}
314326
}
327+
315328
private _deserializeNote(
316329
serialNote: ISerialNoteOutput,
317330
noteIndex: number,
@@ -356,10 +369,46 @@ export class Serialization {
356369

357370
destRegionCollab.noteIds.push(noteId);
358371

359-
this._deserializeRegion(serialNote, serialObj, noteMap, noteId, noteCollab);
372+
this._deserializeRegionNotes(
373+
serialNote,
374+
serialObj,
375+
noteMap,
376+
noteId,
377+
noteCollab,
378+
);
360379

361380
internals.pages.react.page.notes.react.collab[noteId] = noteCollab;
362381
}
382+
383+
private _deserializeRegionArrows(
384+
serialRegion: ISerialRegionOutput,
385+
serialObj: ISerialObjectOutput,
386+
noteMap: Map<number, string>,
387+
destRegionId: string,
388+
destRegionCollab: IRegionCollabOutput,
389+
) {
390+
for (const arrowIndex of serialRegion.arrowIdxs) {
391+
this._deserializeArrow(
392+
serialObj.arrows[arrowIndex],
393+
noteMap,
394+
destRegionId,
395+
destRegionCollab,
396+
);
397+
}
398+
399+
for (const noteIndex of serialRegion.noteIdxs) {
400+
const noteId = noteMap.get(noteIndex)!;
401+
const noteCollab = internals.pages.react.page.notes.react.collab[noteId];
402+
403+
this._deserializeRegionArrows(
404+
serialObj.notes[noteIndex],
405+
serialObj,
406+
noteMap,
407+
noteId,
408+
noteCollab,
409+
);
410+
}
411+
}
363412
private _deserializeArrow(
364413
serialArrow: ISerialArrowOutput,
365414
noteMap: Map<number, string>,

apps/client/src/code/tiptap/inline-math/extension.ts

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,14 @@ import { VueNodeViewRenderer } from '@tiptap/vue-3';
33

44
import NodeView from './NodeView.vue';
55

6+
declare module '@tiptap/core' {
7+
interface Commands<ReturnType> {
8+
inlineMath: {
9+
addInlineMath: () => ReturnType;
10+
};
11+
}
12+
}
13+
614
export const InlineMathExtension = Node.create({
715
name: 'inlineMath',
816

@@ -41,14 +49,19 @@ export const InlineMathExtension = Node.create({
4149
return VueNodeViewRenderer(NodeView);
4250
},
4351

44-
addCommands(): any {
52+
addCommands() {
4553
return {
4654
addInlineMath:
47-
(options: any) =>
48-
({ commands }: any) =>
55+
() =>
56+
({ commands, state }) =>
4957
commands.insertContent({
5058
type: this.name,
51-
attrs: options,
59+
attrs: {
60+
input: state.doc.textBetween(
61+
state.selection.from,
62+
state.selection.to,
63+
),
64+
},
5265
}),
5366
};
5467
},

apps/client/src/code/tiptap/math-block/extension.ts

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,14 @@ import { VueNodeViewRenderer } from '@tiptap/vue-3';
33

44
import NodeView from './NodeView.vue';
55

6+
declare module '@tiptap/core' {
7+
interface Commands<ReturnType> {
8+
mathBlock: {
9+
addMathBlock: () => ReturnType;
10+
};
11+
}
12+
}
13+
614
export const MathBlockExtension = Node.create({
715
name: 'mathBlock',
816

@@ -40,14 +48,19 @@ export const MathBlockExtension = Node.create({
4048
return VueNodeViewRenderer(NodeView);
4149
},
4250

43-
addCommands(): any {
51+
addCommands() {
4452
return {
4553
addMathBlock:
46-
(options: any) =>
47-
({ commands }: any) =>
54+
() =>
55+
({ commands, state }) =>
4856
commands.insertContent({
4957
type: this.name,
50-
attrs: options,
58+
attrs: {
59+
input: state.doc.textBetween(
60+
state.selection.from,
61+
state.selection.to,
62+
),
63+
},
5164
}),
5265
};
5366
},

0 commit comments

Comments
 (0)