mirror of
https://github.com/TriliumNext/Notes.git
synced 2025-07-27 18:12:29 +08:00
chore(server): serve ck-content for share
This commit is contained in:
parent
8a23c3987e
commit
9cb56a4875
@ -5,6 +5,7 @@ import express from "express";
|
|||||||
import { getResourceDir, isDev } from "../services/utils.js";
|
import { getResourceDir, isDev } from "../services/utils.js";
|
||||||
import type serveStatic from "serve-static";
|
import type serveStatic from "serve-static";
|
||||||
import proxy from "express-http-proxy";
|
import proxy from "express-http-proxy";
|
||||||
|
import contentCss from "@triliumnext/ckeditor5/content.css";
|
||||||
|
|
||||||
const persistentCacheStatic = (root: string, options?: serveStatic.ServeStaticOptions<express.Response<unknown, Record<string, unknown>>>) => {
|
const persistentCacheStatic = (root: string, options?: serveStatic.ServeStaticOptions<express.Response<unknown, Record<string, unknown>>>) => {
|
||||||
if (!isDev) {
|
if (!isDev) {
|
||||||
@ -20,6 +21,8 @@ async function register(app: express.Application) {
|
|||||||
const srcRoot = path.join(path.dirname(fileURLToPath(import.meta.url)), "..");
|
const srcRoot = path.join(path.dirname(fileURLToPath(import.meta.url)), "..");
|
||||||
const resourceDir = getResourceDir();
|
const resourceDir = getResourceDir();
|
||||||
|
|
||||||
|
app.use(`/${assetPath}/libraries/ckeditor/ckeditor-content.css`, (req, res) => res.contentType("text/css").send(contentCss));
|
||||||
|
|
||||||
if (isDev) {
|
if (isDev) {
|
||||||
const publicUrl = process.env.TRILIUM_PUBLIC_SERVER;
|
const publicUrl = process.env.TRILIUM_PUBLIC_SERVER;
|
||||||
if (!publicUrl) {
|
if (!publicUrl) {
|
||||||
|
5
apps/server/src/types.d.ts
vendored
5
apps/server/src/types.d.ts
vendored
@ -22,3 +22,8 @@ declare module "is-animated" {
|
|||||||
function isAnimated(buffer: Buffer): boolean;
|
function isAnimated(buffer: Buffer): boolean;
|
||||||
export default isAnimated;
|
export default isAnimated;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
declare module "@triliumnext/ckeditor5/content.css" {
|
||||||
|
const content: string;
|
||||||
|
export default content;
|
||||||
|
}
|
||||||
|
@ -33,6 +33,9 @@
|
|||||||
"src/**/*.spec.jsx"
|
"src/**/*.spec.jsx"
|
||||||
],
|
],
|
||||||
"references": [
|
"references": [
|
||||||
|
{
|
||||||
|
"path": "../../packages/ckeditor5/tsconfig.lib.json"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"path": "../../packages/turndown-plugin-gfm/tsconfig.lib.json"
|
"path": "../../packages/turndown-plugin-gfm/tsconfig.lib.json"
|
||||||
},
|
},
|
||||||
|
@ -3,6 +3,9 @@
|
|||||||
"files": [],
|
"files": [],
|
||||||
"include": [],
|
"include": [],
|
||||||
"references": [
|
"references": [
|
||||||
|
{
|
||||||
|
"path": "../../packages/ckeditor5"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"path": "../../packages/turndown-plugin-gfm"
|
"path": "../../packages/turndown-plugin-gfm"
|
||||||
},
|
},
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
const { NxAppWebpackPlugin } = require('@nx/webpack/app-plugin');
|
const { NxAppWebpackPlugin } = require('@nx/webpack/app-plugin');
|
||||||
const CopyPlugin = require('copy-webpack-plugin');
|
const CopyPlugin = require('copy-webpack-plugin');
|
||||||
const { join, default: path } = require('path');
|
const { join } = require('path');
|
||||||
|
|
||||||
const outputDir = join(__dirname, 'dist');
|
const outputDir = join(__dirname, 'dist');
|
||||||
|
|
||||||
@ -48,6 +48,14 @@ module.exports = {
|
|||||||
output: {
|
output: {
|
||||||
path: outputDir
|
path: outputDir
|
||||||
},
|
},
|
||||||
|
module: {
|
||||||
|
rules: [
|
||||||
|
{
|
||||||
|
test: /\.css$/i,
|
||||||
|
type: "asset/source"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
plugins: [
|
plugins: [
|
||||||
new NxAppWebpackPlugin({
|
new NxAppWebpackPlugin({
|
||||||
target: 'node',
|
target: 'node',
|
||||||
|
@ -10,6 +10,7 @@
|
|||||||
"exports": {
|
"exports": {
|
||||||
"./package.json": "./package.json",
|
"./package.json": "./package.json",
|
||||||
"./emoji_definitions/": "./src/emoji_definitions/",
|
"./emoji_definitions/": "./src/emoji_definitions/",
|
||||||
|
"./content.css": "./dist/content.css",
|
||||||
".": {
|
".": {
|
||||||
"development": "./src/index.ts",
|
"development": "./src/index.ts",
|
||||||
"types": "./dist/index.d.ts",
|
"types": "./dist/index.d.ts",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user