Merge branch 'develop' into webpack

This commit is contained in:
Jin 2025-03-28 23:00:59 +01:00
commit 534c146542
9 changed files with 414 additions and 49 deletions

View File

@ -10,7 +10,7 @@
"license": "ISC", "license": "ISC",
"dependencies": { "dependencies": {
"better-sqlite3": "^11.1.2", "better-sqlite3": "^11.1.2",
"mime-types": "^2.1.34", "mime-types": "^3.0.0",
"sanitize-filename": "^1.6.3", "sanitize-filename": "^1.6.3",
"tsx": "^4.19.3", "tsx": "^4.19.3",
"yargs": "^17.3.1" "yargs": "^17.3.1"
@ -762,19 +762,19 @@
} }
}, },
"node_modules/mime-db": { "node_modules/mime-db": {
"version": "1.52.0", "version": "1.54.0",
"resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.54.0.tgz",
"integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==", "integrity": "sha512-aU5EJuIN2WDemCcAp2vFBfp/m4EAhWJnUNSSw0ixs7/kXbd6Pg64EmwJkNdFhB8aWt1sH2CTXrLxo/iAGV3oPQ==",
"engines": { "engines": {
"node": ">= 0.6" "node": ">= 0.6"
} }
}, },
"node_modules/mime-types": { "node_modules/mime-types": {
"version": "2.1.35", "version": "3.0.1",
"resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz", "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-3.0.1.tgz",
"integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==", "integrity": "sha512-xRc4oEhT6eaBpU1XF7AjpOFD+xQmXNB5OVKwp4tqCuBpHLS/ZbBDrc07mYTDqVMg6PfxUjjNp85O6Cd2Z/5HWA==",
"dependencies": { "dependencies": {
"mime-db": "1.52.0" "mime-db": "^1.54.0"
}, },
"engines": { "engines": {
"node": ">= 0.6" "node": ">= 0.6"
@ -1594,16 +1594,16 @@
"integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==" "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg=="
}, },
"mime-db": { "mime-db": {
"version": "1.52.0", "version": "1.54.0",
"resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.54.0.tgz",
"integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==" "integrity": "sha512-aU5EJuIN2WDemCcAp2vFBfp/m4EAhWJnUNSSw0ixs7/kXbd6Pg64EmwJkNdFhB8aWt1sH2CTXrLxo/iAGV3oPQ=="
}, },
"mime-types": { "mime-types": {
"version": "2.1.35", "version": "3.0.1",
"resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz", "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-3.0.1.tgz",
"integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==", "integrity": "sha512-xRc4oEhT6eaBpU1XF7AjpOFD+xQmXNB5OVKwp4tqCuBpHLS/ZbBDrc07mYTDqVMg6PfxUjjNp85O6Cd2Z/5HWA==",
"requires": { "requires": {
"mime-db": "1.52.0" "mime-db": "^1.54.0"
} }
}, },
"mimic-response": { "mimic-response": {

View File

@ -18,7 +18,7 @@
"homepage": "https://github.com/TriliumNext/Notes/blob/master/dump-db/README.md", "homepage": "https://github.com/TriliumNext/Notes/blob/master/dump-db/README.md",
"dependencies": { "dependencies": {
"better-sqlite3": "^11.1.2", "better-sqlite3": "^11.1.2",
"mime-types": "^2.1.34", "mime-types": "^3.0.0",
"sanitize-filename": "^1.6.3", "sanitize-filename": "^1.6.3",
"tsx": "^4.19.3", "tsx": "^4.19.3",
"yargs": "^17.3.1" "yargs": "^17.3.1"

380
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -70,7 +70,6 @@
"dependencies": { "dependencies": {
"@braintree/sanitize-url": "7.1.1", "@braintree/sanitize-url": "7.1.1",
"@electron/remote": "2.1.2", "@electron/remote": "2.1.2",
"@excalidraw/excalidraw": "0.18.0",
"@highlightjs/cdn-assets": "11.11.1", "@highlightjs/cdn-assets": "11.11.1",
"@mermaid-js/layout-elk": "0.1.7", "@mermaid-js/layout-elk": "0.1.7",
"@triliumnext/express-partial-content": "1.0.1", "@triliumnext/express-partial-content": "1.0.1",
@ -127,14 +126,12 @@
"leaflet-gpx": "2.1.2", "leaflet-gpx": "2.1.2",
"marked": "15.0.7", "marked": "15.0.7",
"mermaid": "11.6.0", "mermaid": "11.6.0",
"mime-types": "2.1.35", "mime-types": "3.0.1",
"multer": "1.4.5-lts.2", "multer": "1.4.5-lts.2",
"normalize-strings": "1.1.1", "normalize-strings": "1.1.1",
"normalize.css": "8.0.1", "normalize.css": "8.0.1",
"panzoom": "9.4.3", "panzoom": "9.4.3",
"rand-token": "1.0.1", "rand-token": "1.0.1",
"react": "18.3.1",
"react-dom": "18.3.1",
"safe-compare": "1.1.4", "safe-compare": "1.1.4",
"sanitize-filename": "1.6.3", "sanitize-filename": "1.6.3",
"sanitize-html": "2.15.0", "sanitize-html": "2.15.0",
@ -164,6 +161,7 @@
"@electron-forge/plugin-auto-unpack-natives": "7.8.0", "@electron-forge/plugin-auto-unpack-natives": "7.8.0",
"@electron/rebuild": "3.7.1", "@electron/rebuild": "3.7.1",
"@eslint/js": "9.23.0", "@eslint/js": "9.23.0",
"@excalidraw/excalidraw": "0.18.0",
"@fullcalendar/core": "6.1.15", "@fullcalendar/core": "6.1.15",
"@fullcalendar/daygrid": "6.1.15", "@fullcalendar/daygrid": "6.1.15",
"@fullcalendar/interaction": "6.1.15", "@fullcalendar/interaction": "6.1.15",
@ -196,7 +194,7 @@
"@types/leaflet-gpx": "1.3.7", "@types/leaflet-gpx": "1.3.7",
"@types/mime-types": "2.1.4", "@types/mime-types": "2.1.4",
"@types/multer": "1.4.12", "@types/multer": "1.4.12",
"@types/node": "22.13.13", "@types/node": "22.13.14",
"@types/react": "18.3.20", "@types/react": "18.3.20",
"@types/react-dom": "18.3.5", "@types/react-dom": "18.3.5",
"@types/safe-compare": "1.1.2", "@types/safe-compare": "1.1.2",
@ -216,10 +214,11 @@
"@vitest/coverage-v8": "3.0.9", "@vitest/coverage-v8": "3.0.9",
"autoprefixer": "10.4.21", "autoprefixer": "10.4.21",
"bootstrap": "5.3.3", "bootstrap": "5.3.3",
"copy-webpack-plugin": "13.0.0",
"cross-env": "7.0.3", "cross-env": "7.0.3",
"css-loader": "7.1.2", "css-loader": "7.1.2",
"dprint": "0.49.1", "dprint": "0.49.1",
"electron": "35.0.3", "electron": "35.1.2",
"eslint": "9.23.0", "eslint": "9.23.0",
"esm": "3.2.25", "esm": "3.2.25",
"globals": "16.0.0", "globals": "16.0.0",
@ -234,6 +233,8 @@
"nodemon": "3.1.9", "nodemon": "3.1.9",
"postcss-loader": "8.1.1", "postcss-loader": "8.1.1",
"rcedit": "4.0.1", "rcedit": "4.0.1",
"react": "18.3.1",
"react-dom": "18.3.1",
"rimraf": "6.0.1", "rimraf": "6.0.1",
"sass": "1.86.0", "sass": "1.86.0",
"sass-loader": "16.0.5", "sass-loader": "16.0.5",

View File

@ -6,4 +6,14 @@ describe("Link", () => {
const output = parseNavigationStateFromUrl("http://localhost:8080/#?searchString=hello"); const output = parseNavigationStateFromUrl("http://localhost:8080/#?searchString=hello");
expect(output).toMatchObject({ searchString: "hello" }); expect(output).toMatchObject({ searchString: "hello" });
}); });
it("parses searchString with hash", () => {
const output = parseNavigationStateFromUrl("https://github.com/orgs/TriliumNext/discussions/1526#discussioncomment-12656660");
expect(output).toStrictEqual({});
});
it("parses notePath", () => {
const output = parseNavigationStateFromUrl(`#root/WWaBNf3SSA1b/mQ2tIzLVFKHL`);
expect(output).toMatchObject({ notePath: "root/WWaBNf3SSA1b/mQ2tIzLVFKHL", noteId: "mQ2tIzLVFKHL" });
});
}); });

View File

@ -238,10 +238,14 @@ export function parseNavigationStateFromUrl(url: string | undefined) {
} }
} }
if (!notePath.match(/^[_a-z0-9]{4,}(\/[_a-z0-9]{4,})*$/i)) { if (searchString) {
return { searchString } return { searchString }
} }
if (!notePath.match(/^[_a-z0-9]{4,}(\/[_a-z0-9]{4,})*$/i)) {
return {};
}
return { return {
notePath, notePath,
noteId: treeService.getNoteIdFromUrl(notePath), noteId: treeService.getNoteIdFromUrl(notePath),

View File

@ -2,6 +2,7 @@ import TypeWidget from "./type_widget.js";
import utils from "../../services/utils.js"; import utils from "../../services/utils.js";
import linkService from "../../services/link.js"; import linkService from "../../services/link.js";
import server from "../../services/server.js"; import server from "../../services/server.js";
import asset_path from "../../../../services/asset_path.js";
import type FNote from "../../entities/fnote.js"; import type FNote from "../../entities/fnote.js";
import type { ExcalidrawElement, Theme } from "@excalidraw/excalidraw/element/types"; import type { ExcalidrawElement, Theme } from "@excalidraw/excalidraw/element/types";
import type { AppState, BinaryFileData, ExcalidrawImperativeAPI, ExcalidrawProps, LibraryItem, SceneData } from "@excalidraw/excalidraw/types"; import type { AppState, BinaryFileData, ExcalidrawImperativeAPI, ExcalidrawProps, LibraryItem, SceneData } from "@excalidraw/excalidraw/types";
@ -129,9 +130,9 @@ export default class ExcalidrawTypeWidget extends TypeWidget {
this.SCENE_VERSION_INITIAL = -1; // -1 indicates that it is fresh. excalidraw scene version is always >0 this.SCENE_VERSION_INITIAL = -1; // -1 indicates that it is fresh. excalidraw scene version is always >0
this.SCENE_VERSION_ERROR = -2; // -2 indicates error this.SCENE_VERSION_ERROR = -2; // -2 indicates error
// ensure that assets are loaded from trilium // currently required by excalidraw, in order to allows self-hosting fonts locally.
// TODO: // this avoids making excalidraw load the fonts from an external CDN.
(window as any).EXCALIDRAW_ASSET_PATH = `${window.location.origin}/node_modules/@excalidraw/excalidraw/dist/`; (window as any).EXCALIDRAW_ASSET_PATH = `${window.location.origin}/${asset_path}/app-dist/excalidraw/`;
// temporary vars // temporary vars
this.currentNoteId = ""; this.currentNoteId = "";

View File

@ -47,6 +47,11 @@ const TPL = `
height: 100%; height: 100%;
} }
/* Workaround for #1327 */
body.desktop.electron .note-detail-editable-text {
letter-spacing: -0.01px;
}
body.mobile .note-detail-editable-text { body.mobile .note-detail-editable-text {
padding-left: 4px; padding-left: 4px;
} }

View File

@ -4,6 +4,7 @@ import autoprefixer from "autoprefixer";
import assetPath from "./src/services/asset_path.js"; import assetPath from "./src/services/asset_path.js";
import miniCssExtractPlugin from "mini-css-extract-plugin"; import miniCssExtractPlugin from "mini-css-extract-plugin";
import type { Configuration } from "webpack"; import type { Configuration } from "webpack";
import CopyPlugin from "copy-webpack-plugin";
const rootDir = path.dirname(fileURLToPath(import.meta.url)); const rootDir = path.dirname(fileURLToPath(import.meta.url));
const config: Configuration = { const config: Configuration = {
@ -26,6 +27,15 @@ const config: Configuration = {
new miniCssExtractPlugin({ new miniCssExtractPlugin({
// TriliumNextTODO: enable this, once webpack build outputs into the "build" folder, instead of "src/public/app-dist" folder => @pano9000 // TriliumNextTODO: enable this, once webpack build outputs into the "build" folder, instead of "src/public/app-dist" folder => @pano9000
//filename: "../stylesheets/[name].css" //filename: "../stylesheets/[name].css"
}),
new CopyPlugin({
patterns: [
{
context: "node_modules/@excalidraw/excalidraw/dist/prod/fonts/",
from: "**/*",
to: "excalidraw/fonts/"
}
]
}) })
], ],
module: { module: {