Compare commits

...

8 Commits

Author SHA1 Message Date
Chloe Lee
8dba8d6496
Merge d1a442640d2ab9529bab1a705da06d850c6e81cd into c3b4c2f7d468e109c05040c50307b11ff4068274 2026-02-01 15:47:48 +02:00
Elian Doran
c3b4c2f7d4
fix(desktop): background effects interferes with native title bar
Some checks are pending
Checks / main (push) Waiting to run
CodeQL Advanced / Analyze (actions) (push) Waiting to run
CodeQL Advanced / Analyze (javascript-typescript) (push) Waiting to run
Dev / Test development (push) Waiting to run
Dev / Build Docker image (push) Blocked by required conditions
Dev / Check Docker build (Dockerfile) (push) Blocked by required conditions
Dev / Check Docker build (Dockerfile.alpine) (push) Blocked by required conditions
/ Check Docker build (Dockerfile) (push) Waiting to run
/ Check Docker build (Dockerfile.alpine) (push) Waiting to run
/ Build Docker images (Dockerfile, ubuntu-24.04-arm, linux/arm64) (push) Blocked by required conditions
/ Build Docker images (Dockerfile.alpine, ubuntu-latest, linux/amd64) (push) Blocked by required conditions
/ Build Docker images (Dockerfile.legacy, ubuntu-24.04-arm, linux/arm/v7) (push) Blocked by required conditions
/ Build Docker images (Dockerfile.legacy, ubuntu-24.04-arm, linux/arm/v8) (push) Blocked by required conditions
/ Merge manifest lists (push) Blocked by required conditions
playwright / E2E tests on linux-arm64 (push) Waiting to run
playwright / E2E tests on linux-x64 (push) Waiting to run
2026-02-01 15:47:07 +02:00
Elian Doran
14f521fdd7
Revert "chore(ci): try to fix flaky "Merge manifest lists""
This reverts commit eea4cbbd6cf14ff878983bbbc41e2cd6a75596c3.
2026-02-01 11:53:57 +02:00
chloelee767
d1a442640d fix duplicate dep in ckeditor5/package.json 2026-02-01 17:10:42 +08:00
chloelee767
ea66875db6 add __screenshots__ dir to gitignore 2026-01-31 23:43:29 +08:00
chloelee767
4ecdb097b3 add unit test 2026-01-31 23:43:29 +08:00
chloelee767
6bd80d3a16 update comment 2026-01-31 23:40:23 +08:00
chloelee767
c9ea0f9f7f disable @ to insert links in code blocks 2026-01-31 23:40:23 +08:00
9 changed files with 644 additions and 110 deletions

View File

@ -271,16 +271,13 @@ jobs:
REF_NAME=$(echo "${GITHUB_REF}" | sed 's/refs\/heads\///' | sed 's/refs\/tags\///')
# Create and push the manifest list with both the branch/tag name and the commit SHA
# Note: Images are only pushed to GHCR during build, so we always reference GHCR sources
# and copy to DockerHub using imagetools create
docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \
-t ${{ env.GHCR_REGISTRY }}/${{ env.IMAGE_NAME }}:${REF_NAME} \
$(printf '${{ env.GHCR_REGISTRY }}/${{ env.IMAGE_NAME }}@sha256:%s ' *)
# Copy from GHCR to DockerHub (source digests only exist on GHCR)
docker buildx imagetools create \
docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \
-t ${{ env.DOCKERHUB_REGISTRY }}/${{ env.IMAGE_NAME }}:${REF_NAME} \
$(printf '${{ env.GHCR_REGISTRY }}/${{ env.IMAGE_NAME }}@sha256:%s ' *)
$(printf '${{ env.DOCKERHUB_REGISTRY }}/${{ env.IMAGE_NAME }}@sha256:%s ' *)
# If the ref is a tag, also tag the image as stable as this is part of a 'release'
# and only go in the `if` if there is NOT a `-` in the tag's name, due to tagging of `-alpha`, `-beta`, etc...
@ -290,10 +287,9 @@ jobs:
-t ${{ env.GHCR_REGISTRY }}/${{ env.IMAGE_NAME }}:stable \
$(printf '${{ env.GHCR_REGISTRY }}/${{ env.IMAGE_NAME }}@sha256:%s ' *)
# Copy stable tag from GHCR to DockerHub
docker buildx imagetools create \
docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \
-t ${{ env.DOCKERHUB_REGISTRY }}/${{ env.IMAGE_NAME }}:stable \
$(printf '${{ env.GHCR_REGISTRY }}/${{ env.IMAGE_NAME }}@sha256:%s ' *)
$(printf '${{ env.DOCKERHUB_REGISTRY }}/${{ env.IMAGE_NAME }}@sha256:%s ' *)
# Small delay to ensure stable tag is fully propagated
sleep 5
@ -305,7 +301,7 @@ jobs:
docker buildx imagetools create \
-t ${{ env.DOCKERHUB_REGISTRY }}/${{ env.IMAGE_NAME }}:latest \
${{ env.GHCR_REGISTRY }}/${{ env.IMAGE_NAME }}:stable
${{ env.DOCKERHUB_REGISTRY }}/${{ env.IMAGE_NAME }}:stable
fi

1
.gitignore vendored
View File

@ -36,6 +36,7 @@ Thumbs.db
vite.config.*.timestamp*
vitest.config.*.timestamp*
test-output
**/__screenshots__/
apps/*/data*
apps/*/out

View File

@ -237,18 +237,19 @@ function getWindowExtraOpts() {
// Linux or other platforms.
extraOpts.frame = false;
}
}
// Window effects (Mica)
if (optionService.getOptionBool("backgroundEffects")) {
if (isMac) {
extraOpts.transparent = true;
extraOpts.visualEffectState = "active";
} else if (isWindows) {
extraOpts.backgroundMaterial = "auto";
} else {
// Linux or other platforms.
extraOpts.transparent = true;
// Window effects (Mica on Windows and Vibrancy on macOS)
// These only work if native title bar is not enabled.
if (optionService.getOptionBool("backgroundEffects")) {
if (isMac) {
extraOpts.transparent = true;
extraOpts.visualEffectState = "active";
} else if (isWindows) {
extraOpts.backgroundMaterial = "auto";
} else {
// Linux or other platforms.
extraOpts.transparent = true;
}
}
}

View File

@ -17,6 +17,15 @@
},
"devDependencies": {
"@smithy/middleware-retry": "4.4.29",
"@types/jquery": "3.5.33"
"@types/jquery": "3.5.33",
"@vitest/browser": "4.0.17",
"@vitest/coverage-istanbul": "4.0.17",
"vite-plugin-svgo": "2.0.0",
"vitest": "4.0.17",
"webdriverio": "9.23.0"
},
"scripts": {
"test": "vitest",
"test:debug": "vitest --inspect-brk --no-file-parallelism --browser.headless=false"
}
}

View File

@ -31,6 +31,7 @@ import CodeBlockLanguageDropdown from "./plugins/code_block_language_dropdown.js
import MoveBlockUpDownPlugin from "./plugins/move_block_updown.js";
import ScrollOnUndoRedoPlugin from "./plugins/scroll_on_undo_redo.js"
import InlineCodeNoSpellcheck from "./plugins/inline_code_no_spellcheck.js";
import DisableMentionInCodeBlock from "./plugins/disable_mention_in_codeblock.js";
/**
* Plugins that are specific to Trilium and not part of the CKEditor 5 core, included in both text editors but not in the attribute editor.
@ -53,6 +54,7 @@ const TRILIUM_PLUGINS: typeof Plugin[] = [
MoveBlockUpDownPlugin,
ScrollOnUndoRedoPlugin,
InlineCodeNoSpellcheck,
DisableMentionInCodeBlock,
];
/**

View File

@ -0,0 +1,23 @@
import { Plugin } from "ckeditor5";
/**
* Disables the mention feature inside code blocks.
* This prevents the autocomplete popup from appearing when typing `@` or `/` within code blocks.
*/
export default class DisableMentionInCodeBlock extends Plugin {
public static get pluginName() {
return "DisableMentionInCodeBlock" as const;
}
init() {
const editor = this.editor;
const schema = editor.model.schema;
// Disallow mention attribute inside code blocks
schema.addAttributeCheck((context, attributeName) => {
if (attributeName === 'mention' && context.endsWith('codeBlock $text')) {
return false;
}
});
}
}

View File

@ -0,0 +1,65 @@
import { ClassicEditor, CodeBlock, Mention } from 'ckeditor5';
import DisableMentionInCodeBlock from '../src/plugins/disable_mention_in_codeblock.js';
import { describe, beforeEach, it, afterEach, expect } from "vitest";
describe( 'DisableMentionInCodeBlock', () => {
let editorElement: HTMLDivElement, editor: ClassicEditor;
beforeEach( async () => {
editorElement = document.createElement( 'div' );
document.body.appendChild( editorElement );
return ClassicEditor
.create( editorElement, {
plugins: [ CodeBlock, Mention, DisableMentionInCodeBlock ],
licenseKey: "GPL"
} )
.then( newEditor => {
editor = newEditor;
} );
} );
afterEach( () => {
editorElement.remove();
return editor.destroy();
} );
it( 'should be loaded', () => {
expect( editor.plugins.get( DisableMentionInCodeBlock ) ).to.instanceOf( DisableMentionInCodeBlock );
} );
it( 'has proper name', () => {
expect( DisableMentionInCodeBlock.pluginName ).to.equal( 'DisableMentionInCodeBlock' );
} );
it( 'should prevent mention attribute inside code blocks', () => {
const schema = editor.model.schema;
// Test that mention attribute is disallowed in code block context
const context = schema.createContext( [ 'codeBlock', '$text' ] );
const isAllowed = schema.checkAttribute( context, 'mention' );
expect( isAllowed ).to.be.false;
} );
it( 'should allow mention attribute outside code blocks', () => {
const schema = editor.model.schema;
// Test that mention attribute is still allowed in regular paragraphs
const context = schema.createContext( [ 'paragraph', '$text' ] );
const isAllowed = schema.checkAttribute( context, 'mention' );
expect( isAllowed ).to.be.true;
} );
it( 'should allow mention attribute in list items', () => {
const schema = editor.model.schema;
// Test that mention attribute is still allowed in list items
const context = schema.createContext( [ 'listItem', '$text' ] );
const isAllowed = schema.checkAttribute( context, 'mention' );
expect( isAllowed ).to.be.true;
} );
} );

View File

@ -0,0 +1,43 @@
/**
* @license Copyright (c) 2023-2024, CKSource Holding sp. z o.o. All rights reserved.
* For licensing, see LICENSE.md.
*/
import { defineConfig } from 'vitest/config';
import svg from 'vite-plugin-svgo';
import { webdriverio } from "@vitest/browser-webdriverio";
export default defineConfig( {
plugins: [
svg()
],
test: {
browser: {
enabled: true,
provider: webdriverio(),
headless: true,
ui: false,
instances: [ { browser: 'chrome' } ]
},
include: [
'tests/**/*.[jt]s'
],
exclude: [
'tests/setup.ts'
],
globals: true,
watch: false,
coverage: {
thresholds: {
lines: 100,
functions: 100,
branches: 100,
statements: 100
},
provider: 'istanbul',
include: [
'src'
]
}
}
} );

572
pnpm-lock.yaml generated

File diff suppressed because it is too large Load Diff