refactor(share): integrate with client

This commit is contained in:
Elian Doran 2025-06-09 14:13:35 +03:00
parent 3def1a1e57
commit 8bdf3626f0
No known key found for this signature in database
8 changed files with 16 additions and 15 deletions

View File

@ -25,6 +25,7 @@
"@triliumnext/codemirror": "workspace:*", "@triliumnext/codemirror": "workspace:*",
"@triliumnext/commons": "workspace:*", "@triliumnext/commons": "workspace:*",
"@triliumnext/highlightjs": "workspace:*", "@triliumnext/highlightjs": "workspace:*",
"@triliumnext/share-theme": "workspace:*",
"autocomplete.js": "0.38.1", "autocomplete.js": "0.38.1",
"bootstrap": "5.3.6", "bootstrap": "5.3.6",
"boxicons": "2.1.4", "boxicons": "2.1.4",

View File

@ -1,5 +1,6 @@
import "normalize.css"; import "normalize.css";
import "@triliumnext/ckeditor5/content.css"; import "@triliumnext/ckeditor5/content.css";
import "@triliumnext/share-theme/styles/index.css";
/** /**
* Fetch note with given ID from backend * Fetch note with given ID from backend

View File

@ -34,14 +34,17 @@
"src/**/*.ts" "src/**/*.ts"
], ],
"references": [ "references": [
{
"path": "../../packages/share-theme"
},
{ {
"path": "../../packages/highlightjs/tsconfig.lib.json" "path": "../../packages/highlightjs/tsconfig.lib.json"
}, },
{ {
"path": "../../packages/codemirror/tsconfig.lib.json" "path": "../../packages/commons/tsconfig.lib.json"
}, },
{ {
"path": "../../packages/commons/tsconfig.lib.json" "path": "../../packages/codemirror/tsconfig.lib.json"
}, },
{ {
"path": "../../packages/ckeditor5/tsconfig.lib.json" "path": "../../packages/ckeditor5/tsconfig.lib.json"

View File

@ -252,11 +252,6 @@
"glob": "**/*", "glob": "**/*",
"input": "packages/share-theme/src/templates", "input": "packages/share-theme/src/templates",
"output": "share-theme/templates" "output": "share-theme/templates"
},
{
"glob": "**/*",
"input": "packages/share-theme/dist",
"output": "share-theme/public"
} }
] ]
} }

View File

@ -12,7 +12,11 @@
<% } else { %> <% } else { %>
<link rel="shortcut icon" href="../favicon.ico"> <link rel="shortcut icon" href="../favicon.ico">
<% } %> <% } %>
<link href="assets/styles.css" rel="stylesheet"> <script src="<%= appPath %>/share.js" type="module"></script>
<link href="<%= assetPath %>/src/share.css" rel="stylesheet">
<% if (!note.isLabelTruthy("shareOmitDefaultCss")) { %>
<link href="<%= assetPath %>/stylesheets/share.css" rel="stylesheet">
<% } %>
<% for (const cssRelation of note.getRelations("shareCss")) { %> <% for (const cssRelation of note.getRelations("shareCss")) { %>
<link href="api/notes/<%= cssRelation.value %>/download" rel="stylesheet"> <link href="api/notes/<%= cssRelation.value %>/download" rel="stylesheet">
<% } %> <% } %>

View File

@ -48,7 +48,6 @@ async function register(app: express.Application) {
app.use(`/assets/vX/stylesheets`, express.static(path.join(srcRoot, "public/stylesheets"))); app.use(`/assets/vX/stylesheets`, express.static(path.join(srcRoot, "public/stylesheets")));
app.use(`/${assetUrlFragment}/libraries`, persistentCacheStatic(path.join(srcRoot, "public/libraries"))); app.use(`/${assetUrlFragment}/libraries`, persistentCacheStatic(path.join(srcRoot, "public/libraries")));
app.use(`/assets/vX/libraries`, express.static(path.join(srcRoot, "..", "libraries"))); app.use(`/assets/vX/libraries`, express.static(path.join(srcRoot, "..", "libraries")));
app.use(`/share/assets`, express.static(path.join(resourceDir, "share-theme", "public")));
} }
export default { export default {

View File

@ -12,6 +12,7 @@
}, },
"exports": { "exports": {
"./templates/*": "./src/templates/*", "./templates/*": "./src/templates/*",
"./styles/*": "./src/styles/*",
"./*": "./dist/*" "./*": "./dist/*"
}, },
"author": "", "author": "",

View File

@ -11,6 +11,9 @@
<link rel="shortcut icon" href="<% if (note.hasRelation("shareFavicon")) { %>api/notes/<%= note.getRelation("shareFavicon").value %>/download<% } else { %>../favicon.ico<% } %>"> <link rel="shortcut icon" href="<% if (note.hasRelation("shareFavicon")) { %>api/notes/<%= note.getRelation("shareFavicon").value %>/download<% } else { %>../favicon.ico<% } %>">
<script src="<%= appPath %>/share.js" type="module"></script> <script src="<%= appPath %>/share.js" type="module"></script>
<link href="../<%= assetPath %>/libraries/normalize.min.css" rel="stylesheet"> <link href="../<%= assetPath %>/libraries/normalize.min.css" rel="stylesheet">
<% if (!note.isLabelTruthy("shareOmitDefaultCss")) { %>
<link href="<%= assetPath %>/stylesheets/share.css" rel="stylesheet">
<% } %>
<% if (note.hasLabel("shareSwagger")) { %> <% if (note.hasLabel("shareSwagger")) { %>
<!-- TODO: make these note IDs customizable --> <!-- TODO: make these note IDs customizable -->
@ -51,15 +54,9 @@ const customServerYml = `- url: "{protocol}://{domain}:{port}/etapi"
<% if (note.type === "text" || note.type === "book") { %> <% if (note.type === "text" || note.type === "book") { %>
<link href="../<%= assetPath %>/libraries/ckeditor/ckeditor-content.css" rel="stylesheet"> <link href="../<%= assetPath %>/libraries/ckeditor/ckeditor-content.css" rel="stylesheet">
<% } %> <% } %>
<% if (!note.isLabelTruthy("shareOmitDefaultCss")) { %>
<link href="assets/styles.css" rel="stylesheet">
<% } %>
<% for (const cssRelation of note.getRelations("shareCss")) { %> <% for (const cssRelation of note.getRelations("shareCss")) { %>
<link href="api/notes/<%= cssRelation.value %>/download" rel="stylesheet"> <link href="api/notes/<%= cssRelation.value %>/download" rel="stylesheet">
<% } %> <% } %>
<% if (!note.isLabelTruthy("shareOmitDefaultCss")) { %>
<script type="module" src="assets/scripts.js"></script>
<% } %>
<% for (const jsRelation of note.getRelations("shareJs")) { %> <% for (const jsRelation of note.getRelations("shareJs")) { %>
<script type="module" src="api/notes/<%= jsRelation.value %>/download"></script> <script type="module" src="api/notes/<%= jsRelation.value %>/download"></script>
<% } %> <% } %>