mirror of
https://github.com/TriliumNext/Notes.git
synced 2025-07-27 18:12:29 +08:00
Merge pull request #1537 from TriliumNext/build_webpack-excalidraw-font
build: use webpack for excalidraw
This commit is contained in:
commit
83890ba130
239
package-lock.json
generated
239
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -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",
|
||||||
@ -134,8 +133,6 @@
|
|||||||
"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",
|
||||||
@ -166,6 +163,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",
|
||||||
@ -218,6 +216,7 @@
|
|||||||
"@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",
|
||||||
@ -235,6 +234,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",
|
||||||
|
@ -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 = "";
|
||||||
|
@ -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: {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user