mirror of
https://github.com/TriliumNext/Notes.git
synced 2025-07-27 10:02:59 +08:00
refactor(deps): get rid of print-this
This commit is contained in:
parent
ac5f911d4f
commit
2cc7113c2c
@ -81,7 +81,6 @@ const copy = async () => {
|
|||||||
"node_modules/mermaid/dist/",
|
"node_modules/mermaid/dist/",
|
||||||
"node_modules/jquery/dist/",
|
"node_modules/jquery/dist/",
|
||||||
"node_modules/jquery-hotkeys/",
|
"node_modules/jquery-hotkeys/",
|
||||||
"node_modules/print-this/",
|
|
||||||
"node_modules/split.js/dist/",
|
"node_modules/split.js/dist/",
|
||||||
"node_modules/panzoom/dist/",
|
"node_modules/panzoom/dist/",
|
||||||
"node_modules/i18next/",
|
"node_modules/i18next/",
|
||||||
|
21
package-lock.json
generated
21
package-lock.json
generated
@ -78,7 +78,6 @@
|
|||||||
"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",
|
||||||
"print-this": "2.0.0",
|
|
||||||
"rand-token": "1.0.1",
|
"rand-token": "1.0.1",
|
||||||
"react": "18.3.1",
|
"react": "18.3.1",
|
||||||
"react-dom": "18.3.1",
|
"react-dom": "18.3.1",
|
||||||
@ -12681,15 +12680,6 @@
|
|||||||
"url": "https://github.com/sponsors/sindresorhus"
|
"url": "https://github.com/sponsors/sindresorhus"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/opencollective-postinstall": {
|
|
||||||
"version": "2.0.3",
|
|
||||||
"resolved": "https://registry.npmjs.org/opencollective-postinstall/-/opencollective-postinstall-2.0.3.tgz",
|
|
||||||
"integrity": "sha512-8AV/sCtuzUeTo8gQK5qDZzARrulB3egtLzFgteqB2tcT4Mw7B8Kt7JcDHmltjz6FOAHsvTevk70gZEbhM4ZS9Q==",
|
|
||||||
"license": "MIT",
|
|
||||||
"bin": {
|
|
||||||
"opencollective-postinstall": "index.js"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/ora": {
|
"node_modules/ora": {
|
||||||
"version": "5.4.1",
|
"version": "5.4.1",
|
||||||
"resolved": "https://registry.npmjs.org/ora/-/ora-5.4.1.tgz",
|
"resolved": "https://registry.npmjs.org/ora/-/ora-5.4.1.tgz",
|
||||||
@ -13495,17 +13485,6 @@
|
|||||||
"url": "https://github.com/prettier/prettier?sponsor=1"
|
"url": "https://github.com/prettier/prettier?sponsor=1"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/print-this": {
|
|
||||||
"version": "2.0.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/print-this/-/print-this-2.0.0.tgz",
|
|
||||||
"integrity": "sha512-/v1/tXs4BQGpEF7OYKe05h4xiQR09Q4HgASL28pngx6aedCQaB1OlHs8t9RDVgUayXHDWHG9V5EBjPlXb46k4w==",
|
|
||||||
"hasInstallScript": true,
|
|
||||||
"license": "MIT",
|
|
||||||
"dependencies": {
|
|
||||||
"jquery": ">=1.11",
|
|
||||||
"opencollective-postinstall": "^2.0.2"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/proc-log": {
|
"node_modules/proc-log": {
|
||||||
"version": "2.0.1",
|
"version": "2.0.1",
|
||||||
"resolved": "https://registry.npmjs.org/proc-log/-/proc-log-2.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/proc-log/-/proc-log-2.0.1.tgz",
|
||||||
|
@ -123,7 +123,6 @@
|
|||||||
"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",
|
||||||
"print-this": "2.0.0",
|
|
||||||
"rand-token": "1.0.1",
|
"rand-token": "1.0.1",
|
||||||
"react": "18.3.1",
|
"react": "18.3.1",
|
||||||
"react-dom": "18.3.1",
|
"react-dom": "18.3.1",
|
||||||
|
@ -51,10 +51,6 @@ const RELATION_MAP: Library = {
|
|||||||
css: ["stylesheets/relation_map.css"]
|
css: ["stylesheets/relation_map.css"]
|
||||||
};
|
};
|
||||||
|
|
||||||
const PRINT_THIS: Library = {
|
|
||||||
js: ["node_modules/print-this/printThis.js"]
|
|
||||||
};
|
|
||||||
|
|
||||||
const CALENDAR_WIDGET: Library = {
|
const CALENDAR_WIDGET: Library = {
|
||||||
css: ["stylesheets/calendar.css"]
|
css: ["stylesheets/calendar.css"]
|
||||||
};
|
};
|
||||||
@ -193,7 +189,6 @@ export default {
|
|||||||
CODE_MIRROR,
|
CODE_MIRROR,
|
||||||
ESLINT,
|
ESLINT,
|
||||||
RELATION_MAP,
|
RELATION_MAP,
|
||||||
PRINT_THIS,
|
|
||||||
CALENDAR_WIDGET,
|
CALENDAR_WIDGET,
|
||||||
KATEX,
|
KATEX,
|
||||||
WHEEL_ZOOM,
|
WHEEL_ZOOM,
|
||||||
|
@ -250,46 +250,7 @@ export default class NoteDetailWidget extends NoteContextAwareWidget {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
await libraryLoader.requireLibrary(libraryLoader.PRINT_THIS);
|
window.print();
|
||||||
|
|
||||||
let $promotedAttributes = $("");
|
|
||||||
|
|
||||||
if (this.note.getPromotedDefinitionAttributes().length > 0) {
|
|
||||||
$promotedAttributes = (await attributeRenderer.renderNormalAttributes(this.note)).$renderedAttributes;
|
|
||||||
}
|
|
||||||
|
|
||||||
const { assetPath } = window.glob;
|
|
||||||
const cssToLoad = [
|
|
||||||
`${assetPath}/node_modules/codemirror/lib/codemirror.css`,
|
|
||||||
`${assetPath}/libraries/ckeditor/ckeditor-content.css`,
|
|
||||||
`${assetPath}/node_modules/bootstrap/dist/css/bootstrap.min.css`,
|
|
||||||
`${assetPath}/node_modules/katex/dist/katex.min.css`,
|
|
||||||
`${assetPath}/stylesheets/print.css`,
|
|
||||||
`${assetPath}/stylesheets/relation_map.css`,
|
|
||||||
`${assetPath}/stylesheets/ckeditor-theme.css`
|
|
||||||
];
|
|
||||||
|
|
||||||
if (isSyntaxHighlightEnabled()) {
|
|
||||||
cssToLoad.push(getStylesheetUrl("default:vs"));
|
|
||||||
}
|
|
||||||
|
|
||||||
this.$widget.find(".note-detail-printable:visible").printThis({
|
|
||||||
header: $("<div>").append($("<h2>").text(this.note.title)).append($promotedAttributes).prop("outerHTML"),
|
|
||||||
|
|
||||||
footer: `
|
|
||||||
<script src="${assetPath}/node_modules/katex/dist/katex.min.js"></script>
|
|
||||||
<script src="${assetPath}/node_modules/katex/dist/contrib/mhchem.min.js"></script>
|
|
||||||
<script src="${assetPath}/node_modules/katex/dist/contrib/auto-render.min.js"></script>
|
|
||||||
<script>
|
|
||||||
document.body.className += ' ck-content printed-content';
|
|
||||||
|
|
||||||
renderMathInElement(document.body, {trust: true});
|
|
||||||
</script>
|
|
||||||
`,
|
|
||||||
importCSS: false,
|
|
||||||
loadCSS: cssToLoad,
|
|
||||||
debug: true
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async exportAsPdfEvent() {
|
async exportAsPdfEvent() {
|
||||||
|
@ -66,8 +66,6 @@ async function register(app: express.Application) {
|
|||||||
|
|
||||||
app.use(`/${assetPath}/node_modules/jquery-hotkeys/`, persistentCacheStatic(path.join(srcRoot, "..", "node_modules/jquery-hotkeys/")));
|
app.use(`/${assetPath}/node_modules/jquery-hotkeys/`, persistentCacheStatic(path.join(srcRoot, "..", "node_modules/jquery-hotkeys/")));
|
||||||
|
|
||||||
app.use(`/${assetPath}/node_modules/print-this/`, persistentCacheStatic(path.join(srcRoot, "..", "node_modules/print-this/")));
|
|
||||||
|
|
||||||
app.use(`/${assetPath}/node_modules/split.js/dist/`, persistentCacheStatic(path.join(srcRoot, "..", "node_modules/split.js/dist/")));
|
app.use(`/${assetPath}/node_modules/split.js/dist/`, persistentCacheStatic(path.join(srcRoot, "..", "node_modules/split.js/dist/")));
|
||||||
|
|
||||||
app.use(`/${assetPath}/node_modules/panzoom/dist/`, persistentCacheStatic(path.join(srcRoot, "..", "node_modules/panzoom/dist/")));
|
app.use(`/${assetPath}/node_modules/panzoom/dist/`, persistentCacheStatic(path.join(srcRoot, "..", "node_modules/panzoom/dist/")));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user