Skip to content

Build your personal knowledge base with Trilium Notes

Merge branch 'stable' into next61

zadam995f1c9fc48c
diff --cc src/etapi/etapi.openapi.yaml
index ee40a0cc2c,c510fa0d27..2c6ca0d0d9
--- a/src/etapi/etapi.openapi.yaml
+++ b/src/etapi/etapi.openapi.yaml
@@@ -291,7 -285,30 +285,30 @@@ paths
application/json; charset=utf-8:
schema:
$ref: '#/components/schemas/Error'
+ /notes/{noteId}/import:
+ parameters:
+ - name: noteId
+ in: path
+ required: true
+ schema:
+ $ref: '#/components/schemas/EntityId'
+ post:
+ description: Imports ZIP file into a given note.
+ operationId: importZip
+ responses:
+ '201':
+ description: note created
+ content:
+ application/json; charset=utf-8:
+ schema:
+ $ref: '#/components/schemas/NoteWithBranch'
+ default:
+ description: unexpected error
+ content:
+ application/json; charset=utf-8:
+ schema:
+ $ref: '#/components/schemas/Error'
- /notes/{noteId}/note-revision:
+ /notes/{noteId}/revision:
parameters:
- name: noteId
in: path
diff --cc src/etapi/notes.js
index 1d49891142,9d56cb966c..f78bd55a9f
--- a/src/etapi/notes.js
+++ b/src/etapi/notes.js
@@@ -151,10 -145,22 +152,22 @@@ function register(router)
zipExportService.exportToZip(taskContext, branch, format, res);
});
+ eu.route(router, 'post' ,'/etapi/notes/:noteId/import', (req, res, next) => {
+ const note = eu.getAndCheckNote(req.params.noteId);
+ const taskContext = new TaskContext('no-progress-reporting');
+
+ zipImportService.importZip(taskContext, req.body, note).then(importedNote => {
+ res.status(201).json({
+ note: mappers.mapNoteToPojo(importedNote),
+ branch: mappers.mapBranchToPojo(importedNote.getBranches()[0]),
+ });
+ }); // we need better error handling here, async errors won't be properly processed.
+ });
+
- eu.route(router, 'post' ,'/etapi/notes/:noteId/note-revision', (req, res, next) => {
+ eu.route(router, 'post' ,'/etapi/notes/:noteId/revision', (req, res, next) => {
const note = eu.getAndCheckNote(req.params.noteId);
- note.saveNoteRevision();
+ note.saveRevision();
return res.sendStatus(204);
});
diff --cc src/public/app/widgets/type_widgets/editable_text.js
index 460f14dde1,06178c3d7c..4eb3d7483a
--- a/src/public/app/widgets/type_widgets/editable_text.js
+++ b/src/public/app/widgets/type_widgets/editable_text.js
@@@ -183,16 -183,10 +183,10 @@@ export default class EditableTextTypeWi
}
async doRefresh(note) {
- const noteComplement = await froca.getNoteComplement(note.noteId);
+ const blob = await note.getBlob();
- await this.spacedUpdate.allowUpdateWithoutChange(() => {
- // https://github.com/zadam/trilium/issues/3914
- // todo: quite hacky, but it works. remove it if ckeditor has fixed it.
- this.$editor.trigger('focus');
- this.$editor.trigger('blur');
-
- this.watchdog.editor.setData(blob.content || "");
- });
+ await this.spacedUpdate.allowUpdateWithoutChange(() =>
- this.watchdog.editor.setData(noteComplement.content || ""));
++ this.watchdog.editor.setData(blob.content || ""));
}
getData() {
diff --cc src/services/app_info.js
index 6139bd6d99,88338defe3..1217758c4a
--- a/src/services/app_info.js
+++ b/src/services/app_info.js
@@@ -4,8 -4,8 +4,8 @@@ const build = require('./build')
const packageJson = require('../../package');
const {TRILIUM_DATA_DIR} = require('./data_dir');
- const APP_DB_VERSION = 221;
-const APP_DB_VERSION = 214;
-const SYNC_VERSION = 29;
++const APP_DB_VERSION = 222;
+const SYNC_VERSION = 30;
const CLIPPER_PROTOCOL_VERSION = "1.0";
module.exports = {