moving canvas_note_share to src/share and add routes

This commit is contained in:
Tom 2022-05-09 16:38:23 +02:00
parent 83f1a68bfd
commit f85ed672cc
3 changed files with 13 additions and 2 deletions

View File

@ -1,4 +1,10 @@
// const {elements, appState, files} = window.triliumExcalidraw;
/**
* this is used as a "standalone js" file and required by a shared note directly via script-tags
*
* data input comes via window variable as follow
* const {elements, appState, files} = window.triliumExcalidraw;
*/
document.getElementById("excalidraw-app").style.height = appState.height+"px";
const App = () => {

View File

@ -114,7 +114,7 @@ document.addEventListener("DOMContentLoaded", function() {
<div id="excalidraw-app"></div>
<hr>
<a href="api/images/${note.noteId}/${note.title}?utc=${note.utcDateModified}">Get Image Link</a>
<script src="../../libraries/excalidraw/canvas_note_share.js"></script>
<script src="./canvas_note_share.js"></script>
</div>`;
}
else {

View File

@ -1,3 +1,6 @@
const express = require('express');
const path = require('path');
const shaca = require("./shaca/shaca");
const shacaLoader = require("./shaca/shaca_loader");
const shareRoot = require("./share_root");
@ -55,6 +58,8 @@ function register(router) {
});
}
router.use('/share/canvas_note_share.js', express.static(path.join(__dirname, 'canvas_note_share.js')));
router.get(['/share', '/share/'], (req, res, next) => {
shacaLoader.ensureLoad();