mirror of
https://github.com/zadam/trilium.git
synced 2025-11-15 17:55:52 +01:00
import & export fixed
This commit is contained in:
@@ -1,4 +1,7 @@
|
||||
import TabAwareWidget from "./tab_aware_widget.js";
|
||||
import appContext from "../services/app_context.js";
|
||||
import libraryLoader from "../services/library_loader.js";
|
||||
import keyboardActionService from "../services/keyboard_actions.js";
|
||||
|
||||
const TPL = `
|
||||
<div class="dropdown note-actions">
|
||||
@@ -37,7 +40,20 @@ export default class NoteActionsWidget extends TabAwareWidget {
|
||||
this.$showNoteInfoButton = this.$widget.find('.show-note-info-button');
|
||||
this.$showNoteInfoButton.on('click', e => this.triggerEvent(e, 'showNoteInfo'));
|
||||
|
||||
this.$printNoteButton = this.$widget.find('.print-note-button');
|
||||
this.$printNoteButton.on('click', e => this.triggerEvent(e, 'printActiveNote'));
|
||||
|
||||
this.$exportNoteButton = this.$widget.find('.export-note-button');
|
||||
this.$exportNoteButton.on("click", () => {
|
||||
if (this.$exportNoteButton.hasClass("disabled")) {
|
||||
return;
|
||||
}
|
||||
|
||||
import('../dialogs/export.js').then(d => d.showDialog(this.tabContext.notePath, 'single'));
|
||||
});
|
||||
|
||||
this.$importNoteButton = this.$widget.find('.import-files-button');
|
||||
this.$importNoteButton.on("click", () => import('../dialogs/import.js').then(d => d.showDialog(this.tabContext.note.noteId)));
|
||||
|
||||
return this.$widget;
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ import protectedSessionHolder from "../services/protected_session_holder.js";
|
||||
import appContext from "../services/app_context.js";
|
||||
import SpacedUpdate from "../services/spaced_update.js";
|
||||
import server from "../services/server.js";
|
||||
import libraryLoader from "../services/library_loader.js";
|
||||
|
||||
const TPL = `
|
||||
<div class="note-detail">
|
||||
@@ -182,4 +183,22 @@ export default class NoteDetailWidget extends TabAwareWidget {
|
||||
await this.spacedUpdate.updateNowIfNecessary();
|
||||
}
|
||||
}
|
||||
|
||||
async printActiveNoteListener() {
|
||||
if (!this.tabContext.isActive()) {
|
||||
return;
|
||||
}
|
||||
|
||||
await libraryLoader.requireLibrary(libraryLoader.PRINT_THIS);
|
||||
|
||||
this.$widget.find('.note-detail-printable:visible').printThis({
|
||||
header: $("<h2>").text(this.tabContext.note && this.tabContext.note.title).prop('outerHTML') ,
|
||||
importCSS: false,
|
||||
loadCSS: [
|
||||
"libraries/codemirror/codemirror.css",
|
||||
"libraries/ckeditor/ckeditor-content.css"
|
||||
],
|
||||
debug: true
|
||||
});
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user