mirror of
https://github.com/zadam/trilium.git
synced 2025-11-11 15:55:52 +01:00
Compare commits
22 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
48608adbd3 | ||
|
|
362ecba98d | ||
|
|
a13892da66 | ||
|
|
e8dc19a1a6 | ||
|
|
cc326547d1 | ||
|
|
a45b147462 | ||
|
|
4e73f20165 | ||
|
|
80c77eeb18 | ||
|
|
c30282fbd0 | ||
|
|
7b8f1ed6ec | ||
|
|
118e11c3fd | ||
|
|
b54765113e | ||
|
|
ed08893996 | ||
|
|
20286d53c8 | ||
|
|
9c1a34fe7c | ||
|
|
e70c6b69b8 | ||
|
|
9b69b0ad0d | ||
|
|
3776c40b8d | ||
|
|
c7369bc9b3 | ||
|
|
b741662fde | ||
|
|
624610b17c | ||
|
|
de004bd8ba |
54
.github/workflows/playwright.yml
vendored
54
.github/workflows/playwright.yml
vendored
@@ -4,6 +4,7 @@ on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
- hotfix
|
||||
paths-ignore:
|
||||
- "apps/website/**"
|
||||
pull_request:
|
||||
@@ -13,8 +14,24 @@ permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
main:
|
||||
runs-on: ubuntu-latest
|
||||
e2e:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include:
|
||||
- name: linux-x64
|
||||
os: ubuntu-22.04
|
||||
arch: x64
|
||||
- name: linux-arm64
|
||||
os: ubuntu-24.04-arm
|
||||
arch: arm64
|
||||
runs-on: ${{ matrix.os }}
|
||||
name: E2E tests on ${{ matrix.name }}
|
||||
env:
|
||||
TRILIUM_DOCKER: 1
|
||||
TRILIUM_PORT: 8082
|
||||
TRILIUM_DATA_DIR: "${{ github.workspace }}/apps/server/spec/db"
|
||||
TRILIUM_INTEGRATION_TEST: memory
|
||||
steps:
|
||||
- uses: actions/checkout@v5
|
||||
with:
|
||||
@@ -29,9 +46,34 @@ jobs:
|
||||
|
||||
- name: Install dependencies
|
||||
run: pnpm install --frozen-lockfile
|
||||
- run: pnpm exec playwright install --with-deps
|
||||
|
||||
- run: pnpm --filter server-e2e e2e
|
||||
- name: Install Playwright browsers
|
||||
run: pnpm exec playwright install --with-deps
|
||||
|
||||
- name: Build the server
|
||||
uses: ./.github/actions/build-server
|
||||
with:
|
||||
os: linux
|
||||
arch: ${{ matrix.arch }}
|
||||
|
||||
- name: Unpack and start the server
|
||||
run: |
|
||||
version=$(node --eval "console.log(require('./package.json').version)")
|
||||
file=$(find ./upload -name '*.tar.xz' -print -quit)
|
||||
name=$(basename "$file" .tar.xz)
|
||||
mkdir -p ./server-dist
|
||||
tar -xvf "$file" -C ./server-dist
|
||||
server_dir="./server-dist/TriliumNotes-Server-$version-linux-${{ matrix.arch }}"
|
||||
if [ ! -d "$server_dir" ]; then
|
||||
echo Missing dir.
|
||||
exit 1
|
||||
fi
|
||||
cd "$server_dir"
|
||||
"./trilium.sh" &
|
||||
sleep 10
|
||||
|
||||
- name: Server end-to-end tests
|
||||
run: pnpm --filter server-e2e e2e
|
||||
|
||||
- name: Upload test report
|
||||
if: failure()
|
||||
@@ -39,3 +81,7 @@ jobs:
|
||||
with:
|
||||
name: e2e report
|
||||
path: apps/server-e2e/test-output
|
||||
|
||||
- name: Kill the server
|
||||
if: always()
|
||||
run: pkill -f trilium || true
|
||||
|
||||
@@ -24,7 +24,9 @@ export async function formatCodeBlocks($container: JQuery<HTMLElement>) {
|
||||
continue;
|
||||
}
|
||||
|
||||
applyCopyToClipboardButton($(codeBlock));
|
||||
if (glob.device !== "print") {
|
||||
applyCopyToClipboardButton($(codeBlock));
|
||||
}
|
||||
|
||||
if (syntaxHighlightingEnabled) {
|
||||
applySingleBlockSyntaxHighlight($(codeBlock), normalizedMimeType);
|
||||
|
||||
@@ -2045,7 +2045,7 @@ body.zen .title-row .icon-action,
|
||||
body.zen .promoted-attributes-widget,
|
||||
body.zen .floating-buttons-children > *:not(.bx-edit-alt),
|
||||
body.zen .action-button,
|
||||
body.zen .note-list-widget:not(.full-height) {
|
||||
body.zen .note-split:not(.type-book) .note-list-widget {
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
|
||||
@@ -498,7 +498,7 @@ li.dropdown-item a.dropdown-item-button:focus-visible {
|
||||
transition: background-color 200ms ease-out;
|
||||
}
|
||||
|
||||
:root .note-list .note-book-card:active {
|
||||
:root .note-list.grid-view .note-book-card:active {
|
||||
transform: scale(.98);
|
||||
}
|
||||
|
||||
|
||||
@@ -123,8 +123,12 @@
|
||||
*/
|
||||
|
||||
/* The container */
|
||||
div.note-detail-empty {
|
||||
max-width: 70%;
|
||||
|
||||
.note-split.empty-note {
|
||||
--max-content-width: 70%;
|
||||
}
|
||||
|
||||
.note-split.empty-note div.note-detail {
|
||||
margin: 50px auto;
|
||||
}
|
||||
|
||||
|
||||
@@ -58,8 +58,6 @@ export async function changeEvent(note: FNote, { startDate, endDate, startTime,
|
||||
startAttribute = note.getAttributes("label").filter(attr => attr.name == "calendar:startTime").shift()?.value||"startTime";
|
||||
endAttribute = note.getAttributes("label").filter(attr => attr.name == "calendar:endTime").shift()?.value||"endTime";
|
||||
|
||||
if (startTime && endTime) {
|
||||
setAttribute(note, "label", startAttribute, startTime);
|
||||
setAttribute(note, "label", endAttribute, endTime);
|
||||
}
|
||||
setAttribute(note, "label", startAttribute, startTime);
|
||||
setAttribute(note, "label", endAttribute, endTime);
|
||||
}
|
||||
|
||||
@@ -8,6 +8,11 @@ import TypeWidget from "../type_widgets/type_widget.js";
|
||||
const TPL = /*html*/`\
|
||||
<div class="popup-editor-dialog modal fade mx-auto" tabindex="-1" role="dialog">
|
||||
<style>
|
||||
/** Reduce the z-index of modals so that ckeditor popups are properly shown on top of it. */
|
||||
body.popup-editor-open > .modal-backdrop { z-index: 998; }
|
||||
body.popup-editor-open .popup-editor-dialog { z-index: 999; }
|
||||
body.popup-editor-open .ck-clipboard-drop-target-line { z-index: 1000; }
|
||||
|
||||
body.desktop .modal.popup-editor-dialog .modal-dialog {
|
||||
max-width: 75vw;
|
||||
}
|
||||
@@ -137,11 +142,6 @@ export default class PopupEditorDialog extends Container<BasicWidget> {
|
||||
}
|
||||
|
||||
$dialog.on("shown.bs.modal", async () => {
|
||||
// Reduce the z-index of modals so that ckeditor popups are properly shown on top of it.
|
||||
// The backdrop instance is not shared so it's OK to make a one-off modification.
|
||||
$("body > .modal-backdrop").css("z-index", "998");
|
||||
$dialog.css("z-index", "999");
|
||||
|
||||
await this.handleEventInChildren("activeContextChanged", { noteContext: this.noteContext });
|
||||
this.setVisibility(true);
|
||||
await this.handleEventInChildren("focusOnDetail", { ntxId: this.noteContext.ntxId });
|
||||
@@ -162,9 +162,12 @@ export default class PopupEditorDialog extends Container<BasicWidget> {
|
||||
if (visible) {
|
||||
$bodyItems.fadeIn();
|
||||
this.$modalHeader.children().show();
|
||||
document.body.classList.add("popup-editor-open");
|
||||
|
||||
} else {
|
||||
$bodyItems.hide();
|
||||
this.$modalHeader.children().hide();
|
||||
document.body.classList.remove("popup-editor-open");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -52,7 +52,7 @@ export default class NoteWrapperWidget extends FlexContainer<BasicWidget> {
|
||||
|
||||
const note = this.noteContext?.note;
|
||||
if (!note) {
|
||||
this.$widget.addClass("bgfx");
|
||||
this.$widget.addClass("bgfx empty-note");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -27,15 +27,16 @@ interface CKEditorOpts {
|
||||
onClick?: (e: MouseEvent, pos?: ModelPosition | null) => void;
|
||||
onKeyDown?: (e: KeyboardEvent) => void;
|
||||
onBlur?: () => void;
|
||||
onInitialized?: (editorInstance: CKTextEditor) => void;
|
||||
}
|
||||
|
||||
export default function CKEditor({ apiRef, currentValue, editor, config, disableNewlines, disableSpellcheck, onChange, onClick, ...restProps }: CKEditorOpts) {
|
||||
export default function CKEditor({ apiRef, currentValue, editor, config, disableNewlines, disableSpellcheck, onChange, onClick, onInitialized, ...restProps }: CKEditorOpts) {
|
||||
const editorContainerRef = useRef<HTMLDivElement>(null);
|
||||
const textEditorRef = useRef<CKTextEditor>(null);
|
||||
useImperativeHandle(apiRef, () => {
|
||||
return {
|
||||
focus() {
|
||||
editorContainerRef.current?.focus();
|
||||
textEditorRef.current?.editing.view.focus();
|
||||
textEditorRef.current?.model.change((writer) => {
|
||||
const documentRoot = textEditorRef.current?.editing.model.document.getRoot();
|
||||
if (documentRoot) {
|
||||
@@ -83,6 +84,8 @@ export default function CKEditor({ apiRef, currentValue, editor, config, disable
|
||||
if (currentValue) {
|
||||
textEditor.setData(currentValue);
|
||||
}
|
||||
|
||||
onInitialized?.(textEditor);
|
||||
});
|
||||
}, []);
|
||||
|
||||
|
||||
@@ -238,11 +238,6 @@ export default function AttributeEditor({ api, note, componentId, notePath, ntxI
|
||||
}
|
||||
});
|
||||
|
||||
// Focus on show.
|
||||
useEffect(() => {
|
||||
setTimeout(() => editorRef.current?.focus(), 0);
|
||||
}, []);
|
||||
|
||||
// Interaction with CKEditor.
|
||||
useLegacyImperativeHandlers(useMemo(() => ({
|
||||
loadReferenceLinkTitle: async ($el: JQuery<HTMLElement>, href: string) => {
|
||||
@@ -363,6 +358,7 @@ export default function AttributeEditor({ api, note, componentId, notePath, ntxI
|
||||
}}
|
||||
onKeyDown={() => attributeDetailWidget.hide()}
|
||||
onBlur={() => save()}
|
||||
onInitialized={() => editorRef.current?.focus()}
|
||||
disableNewlines disableSpellcheck
|
||||
/>
|
||||
|
||||
|
||||
@@ -108,6 +108,8 @@ const config: ForgeConfig = {
|
||||
"--share=network",
|
||||
// System notifications with libnotify
|
||||
"--talk-name=org.freedesktop.Notifications",
|
||||
// System tray
|
||||
"--talk-name=org.kde.StatusNotifierWatcher"
|
||||
],
|
||||
modules: [
|
||||
{
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
"build": "tsx scripts/build.ts",
|
||||
"start-prod": "pnpm build && cross-env TRILIUM_DATA_DIR=data TRILIUM_PORT=37841 ELECTRON_IS_DEV=0 electron dist",
|
||||
"electron-forge:make": "pnpm build && electron-forge make dist",
|
||||
"electron-forge:make-flatpak": "pnpm build && electron-forge make dist --targets=@electron-forge/maker-flatpak",
|
||||
"electron-forge:make-flatpak": "pnpm build && DEBUG=* electron-forge make dist --targets=@electron-forge/maker-flatpak",
|
||||
"electron-forge:package": "pnpm build && electron-forge package dist",
|
||||
"electron-forge:start": "pnpm build && electron-forge start dist",
|
||||
"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"
|
||||
|
||||
@@ -39,11 +39,16 @@ async function main() {
|
||||
app.commandLine.appendSwitch("disable-smooth-scrolling");
|
||||
}
|
||||
|
||||
// Electron 36 crashes with "Using GTK 2/3 and GTK 4 in the same process is not supported" on some distributions.
|
||||
// See https://github.com/electron/electron/issues/46538 for more info.
|
||||
if (process.platform === "linux") {
|
||||
app.setName(PRODUCT_NAME);
|
||||
|
||||
// Electron 36 crashes with "Using GTK 2/3 and GTK 4 in the same process is not supported" on some distributions.
|
||||
// See https://github.com/electron/electron/issues/46538 for more info.
|
||||
app.commandLine.appendSwitch("gtk-version", "3");
|
||||
|
||||
// Enable global shortcuts in Flatpak
|
||||
// the app runs in a Wayland session.
|
||||
app.commandLine.appendSwitch("enable-features", "GlobalShortcutsPortal");
|
||||
}
|
||||
|
||||
// Quit when all windows are closed, except on macOS. There, it's common
|
||||
|
||||
@@ -20,10 +20,10 @@ fi
|
||||
# Debug output
|
||||
echo "Selected Arch: $ARCH"
|
||||
|
||||
# Set Node.js version and architecture-specific filename
|
||||
NODE_VERSION=22.16.0
|
||||
|
||||
script_dir=$(realpath $(dirname $0))
|
||||
|
||||
# Set Node.js version and architecture-specific filename
|
||||
NODE_VERSION=$(cat "../../.nvmrc")
|
||||
BUILD_DIR="$script_dir/../dist"
|
||||
DIST_DIR="$script_dir/../out"
|
||||
|
||||
|
||||
@@ -159,7 +159,7 @@ function getEditedNotesOnDate(req: Request) {
|
||||
SELECT noteId FROM notes
|
||||
WHERE
|
||||
(notes.dateCreated LIKE :date OR notes.dateModified LIKE :date)
|
||||
AND (noteId NOT LIKE '_%')
|
||||
AND (notes.noteId NOT LIKE '\\_%' ESCAPE '\\')
|
||||
UNION ALL
|
||||
SELECT noteId FROM revisions
|
||||
WHERE revisions.dateCreated LIKE :date
|
||||
|
||||
Reference in New Issue
Block a user