Skip to content

Commit 139c60a

Browse files
authored
Hotfix (#7679)
2 parents 40568ac + 25563c6 commit 139c60a

File tree

17 files changed

+186
-81
lines changed

17 files changed

+186
-81
lines changed

.github/workflows/playwright.yml

Lines changed: 50 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ on:
44
push:
55
branches:
66
- main
7+
- hotfix
78
paths-ignore:
89
- "apps/website/**"
910
pull_request:
@@ -13,8 +14,24 @@ permissions:
1314
contents: read
1415

1516
jobs:
16-
main:
17-
runs-on: ubuntu-latest
17+
e2e:
18+
strategy:
19+
fail-fast: false
20+
matrix:
21+
include:
22+
- name: linux-x64
23+
os: ubuntu-22.04
24+
arch: x64
25+
- name: linux-arm64
26+
os: ubuntu-24.04-arm
27+
arch: arm64
28+
runs-on: ${{ matrix.os }}
29+
name: E2E tests on ${{ matrix.name }}
30+
env:
31+
TRILIUM_DOCKER: 1
32+
TRILIUM_PORT: 8082
33+
TRILIUM_DATA_DIR: "${{ github.workspace }}/apps/server/spec/db"
34+
TRILIUM_INTEGRATION_TEST: memory
1835
steps:
1936
- uses: actions/checkout@v5
2037
with:
@@ -29,13 +46,42 @@ jobs:
2946

3047
- name: Install dependencies
3148
run: pnpm install --frozen-lockfile
32-
- run: pnpm exec playwright install --with-deps
3349

34-
- run: pnpm --filter server-e2e e2e
50+
- name: Install Playwright browsers
51+
run: pnpm exec playwright install --with-deps
52+
53+
- name: Build the server
54+
uses: ./.github/actions/build-server
55+
with:
56+
os: linux
57+
arch: ${{ matrix.arch }}
58+
59+
- name: Unpack and start the server
60+
run: |
61+
version=$(node --eval "console.log(require('./package.json').version)")
62+
file=$(find ./upload -name '*.tar.xz' -print -quit)
63+
name=$(basename "$file" .tar.xz)
64+
mkdir -p ./server-dist
65+
tar -xvf "$file" -C ./server-dist
66+
server_dir="./server-dist/TriliumNotes-Server-$version-linux-${{ matrix.arch }}"
67+
if [ ! -d "$server_dir" ]; then
68+
echo Missing dir.
69+
exit 1
70+
fi
71+
cd "$server_dir"
72+
"./trilium.sh" &
73+
sleep 10
74+
75+
- name: Server end-to-end tests
76+
run: pnpm --filter server-e2e e2e
3577

3678
- name: Upload test report
3779
if: failure()
3880
uses: actions/upload-artifact@v5
3981
with:
4082
name: e2e report
4183
path: apps/server-e2e/test-output
84+
85+
- name: Kill the server
86+
if: always()
87+
run: pkill -f trilium || true

apps/client/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@triliumnext/client",
3-
"version": "0.99.4",
3+
"version": "0.99.5",
44
"description": "JQuery-based client for TriliumNext, used for both web and desktop (via Electron)",
55
"private": true,
66
"license": "AGPL-3.0-only",

apps/client/src/services/syntax_highlight.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,9 @@ export async function formatCodeBlocks($container: JQuery<HTMLElement>) {
2424
continue;
2525
}
2626

27-
applyCopyToClipboardButton($(codeBlock));
27+
if (glob.device !== "print") {
28+
applyCopyToClipboardButton($(codeBlock));
29+
}
2830

2931
if (syntaxHighlightingEnabled) {
3032
applySingleBlockSyntaxHighlight($(codeBlock), normalizedMimeType);

apps/client/src/widgets/collections/calendar/api.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,6 @@ export async function changeEvent(note: FNote, { startDate, endDate, startTime,
5858
startAttribute = note.getAttributes("label").filter(attr => attr.name == "calendar:startTime").shift()?.value||"startTime";
5959
endAttribute = note.getAttributes("label").filter(attr => attr.name == "calendar:endTime").shift()?.value||"endTime";
6060

61-
if (startTime && endTime) {
62-
setAttribute(note, "label", startAttribute, startTime);
63-
setAttribute(note, "label", endAttribute, endTime);
64-
}
61+
setAttribute(note, "label", startAttribute, startTime);
62+
setAttribute(note, "label", endAttribute, endTime);
6563
}

apps/client/src/widgets/dialogs/popup_editor.ts

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@ import Container from "../containers/container.js";
77
const TPL = /*html*/`\
88
<div class="popup-editor-dialog modal fade mx-auto" tabindex="-1" role="dialog">
99
<style>
10+
/** Reduce the z-index of modals so that ckeditor popups are properly shown on top of it. */
11+
body.popup-editor-open > .modal-backdrop { z-index: 998; }
12+
body.popup-editor-open .popup-editor-dialog { z-index: 999; }
13+
body.popup-editor-open .ck-clipboard-drop-target-line { z-index: 1000; }
14+
1015
body.desktop .modal.popup-editor-dialog .modal-dialog {
1116
max-width: 75vw;
1217
}
@@ -136,11 +141,6 @@ export default class PopupEditorDialog extends Container<BasicWidget> {
136141
}
137142

138143
$dialog.on("shown.bs.modal", async () => {
139-
// Reduce the z-index of modals so that ckeditor popups are properly shown on top of it.
140-
// The backdrop instance is not shared so it's OK to make a one-off modification.
141-
$("body > .modal-backdrop").css("z-index", "998");
142-
$dialog.css("z-index", "999");
143-
144144
await this.handleEventInChildren("activeContextChanged", { noteContext: this.noteContext });
145145
this.setVisibility(true);
146146
await this.handleEventInChildren("focusOnDetail", { ntxId: this.noteContext.ntxId });
@@ -161,9 +161,12 @@ export default class PopupEditorDialog extends Container<BasicWidget> {
161161
if (visible) {
162162
$bodyItems.fadeIn();
163163
this.$modalHeader.children().show();
164+
document.body.classList.add("popup-editor-open");
165+
164166
} else {
165167
$bodyItems.hide();
166168
this.$modalHeader.children().hide();
169+
document.body.classList.remove("popup-editor-open");
167170
}
168171
}
169172

apps/client/src/widgets/react/CKEditor.tsx

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ export interface CKEditorApi {
66
focus(): void;
77
/**
88
* Imperatively sets the text in the editor.
9-
*
9+
*
1010
* Prefer setting `currentValue` prop where possible.
11-
*
11+
*
1212
* @param text text to set in the editor
1313
*/
1414
setText(text: string): void;
@@ -27,15 +27,16 @@ interface CKEditorOpts {
2727
onClick?: (e: MouseEvent, pos?: ModelPosition | null) => void;
2828
onKeyDown?: (e: KeyboardEvent) => void;
2929
onBlur?: () => void;
30+
onInitialized?: (editorInstance: CKTextEditor) => void;
3031
}
3132

32-
export default function CKEditor({ apiRef, currentValue, editor, config, disableNewlines, disableSpellcheck, onChange, onClick, ...restProps }: CKEditorOpts) {
33-
const editorContainerRef = useRef<HTMLDivElement>(null);
33+
export default function CKEditor({ apiRef, currentValue, editor, config, disableNewlines, disableSpellcheck, onChange, onClick, onInitialized, ...restProps }: CKEditorOpts) {
34+
const editorContainerRef = useRef<HTMLDivElement>(null);
3435
const textEditorRef = useRef<CKTextEditor>(null);
3536
useImperativeHandle(apiRef, () => {
3637
return {
3738
focus() {
38-
editorContainerRef.current?.focus();
39+
textEditorRef.current?.editing.view.focus();
3940
textEditorRef.current?.model.change((writer) => {
4041
const documentRoot = textEditorRef.current?.editing.model.document.getRoot();
4142
if (documentRoot) {
@@ -83,6 +84,8 @@ export default function CKEditor({ apiRef, currentValue, editor, config, disable
8384
if (currentValue) {
8485
textEditor.setData(currentValue);
8586
}
87+
88+
onInitialized?.(textEditor);
8689
});
8790
}, []);
8891

@@ -103,4 +106,4 @@ export default function CKEditor({ apiRef, currentValue, editor, config, disable
103106
{...restProps}
104107
/>
105108
)
106-
}
109+
}

apps/client/src/widgets/ribbon/OwnedAttributesTab.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,4 @@ export default function OwnedAttributesTab({ note, hidden, activate, ntxId, ...r
2626
)}
2727
</div>
2828
)
29-
}
29+
}

apps/client/src/widgets/ribbon/components/AttributeEditor.tsx

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -238,11 +238,6 @@ export default function AttributeEditor({ api, note, componentId, notePath, ntxI
238238
}
239239
});
240240

241-
// Focus on show.
242-
useEffect(() => {
243-
setTimeout(() => editorRef.current?.focus(), 0);
244-
}, []);
245-
246241
// Interaction with CKEditor.
247242
useLegacyImperativeHandlers(useMemo(() => ({
248243
loadReferenceLinkTitle: async ($el: JQuery<HTMLElement>, href: string) => {
@@ -363,6 +358,7 @@ export default function AttributeEditor({ api, note, componentId, notePath, ntxI
363358
}}
364359
onKeyDown={() => attributeDetailWidget.hide()}
365360
onBlur={() => save()}
361+
onInitialized={() => editorRef.current?.focus()}
366362
disableNewlines disableSpellcheck
367363
/>
368364

apps/desktop/electron-forge/forge.config.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,8 @@ const config: ForgeConfig = {
108108
"--share=network",
109109
// System notifications with libnotify
110110
"--talk-name=org.freedesktop.Notifications",
111+
// System tray
112+
"--talk-name=org.kde.StatusNotifierWatcher"
111113
],
112114
modules: [
113115
{

apps/desktop/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@triliumnext/desktop",
3-
"version": "0.99.4",
3+
"version": "0.99.5",
44
"description": "Build your personal knowledge base with Trilium Notes",
55
"private": true,
66
"main": "src/main.ts",
@@ -16,7 +16,7 @@
1616
"build": "tsx scripts/build.ts",
1717
"start-prod": "pnpm build && cross-env TRILIUM_DATA_DIR=data TRILIUM_PORT=37841 ELECTRON_IS_DEV=0 electron dist",
1818
"electron-forge:make": "pnpm build && electron-forge make dist",
19-
"electron-forge:make-flatpak": "pnpm build && electron-forge make dist --targets=@electron-forge/maker-flatpak",
19+
"electron-forge:make-flatpak": "pnpm build && DEBUG=* electron-forge make dist --targets=@electron-forge/maker-flatpak",
2020
"electron-forge:package": "pnpm build && electron-forge package dist",
2121
"electron-forge:start": "pnpm build && electron-forge start dist",
2222
"e2e": "pnpm build && cross-env TRILIUM_INTEGRATION_TEST=memory-no-store TRILIUM_PORT=8082 TRILIUM_DATA_DIR=data-e2e ELECTRON_IS_DEV=0 playwright test"

0 commit comments

Comments
 (0)