diff --git a/package.json b/package.json index bf134ad96..025ee9fea 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "trilium", "productName": "Trilium Notes", "description": "Trilium Notes", - "version": "0.58.3-beta", + "version": "0.58.4", "license": "AGPL-3.0-only", "main": "electron.js", "bin": { diff --git a/src/etapi/etapi.openapi.yaml b/src/etapi/etapi.openapi.yaml index 2928ffcb1..b8f0b5382 100644 --- a/src/etapi/etapi.openapi.yaml +++ b/src/etapi/etapi.openapi.yaml @@ -291,6 +291,33 @@ paths: application/json: schema: $ref: '#/components/schemas/Error' + /notes/{noteId}/note-revision: + parameters: + - name: noteId + in: path + required: true + schema: + $ref: '#/components/schemas/EntityId' + - name: format + in: query + required: false + schema: + enum: + - html + - markdown + default: html + post: + description: Create a note revision for the given note + operationId: createNoteRevision + responses: + '204': + description: revision has been created + default: + description: unexpected error + content: + application/json: + schema: + $ref: '#/components/schemas/Error' /branches/{branchId}: parameters: - name: branchId diff --git a/src/etapi/notes.js b/src/etapi/notes.js index 34fdd5bdd..24fe43078 100644 --- a/src/etapi/notes.js +++ b/src/etapi/notes.js @@ -8,6 +8,7 @@ const v = require("./validators"); const searchService = require("../services/search/services/search"); const SearchContext = require("../services/search/search_context"); const zipExportService = require("../services/export/zip"); +const noteRevisionService = require("../services/note_revisions.js"); function register(router) { eu.route(router, 'get', '/etapi/notes', (req, res, next) => { @@ -122,6 +123,8 @@ function register(router) { note.setContent(req.body); + noteService.scanForLinks(note); + return res.sendStatus(204); }); @@ -143,18 +146,26 @@ function register(router) { zipExportService.exportToZip(taskContext, branch, format, res); }); + + eu.route(router, 'post' ,'/etapi/notes/:noteId/note-revision', (req, res, next) => { + const note = eu.getAndCheckNote(req.params.noteId); + + note.saveNoteRevision(); + + return res.sendStatus(204); + }); } function parseSearchParams(req) { const rawSearchParams = { - 'fastSearch': parseBoolean(req.query, 'fastSearch'), - 'includeArchivedNotes': parseBoolean(req.query, 'includeArchivedNotes'), - 'ancestorNoteId': req.query['ancestorNoteId'], - 'ancestorDepth': parseInteger(req.query, 'ancestorDepth'), - 'orderBy': req.query['orderBy'], - 'orderDirection': parseOrderDirection(req.query, 'orderDirection'), - 'limit': parseInteger(req.query, 'limit'), - 'debug': parseBoolean(req.query, 'debug') + fastSearch: parseBoolean(req.query, 'fastSearch'), + includeArchivedNotes: parseBoolean(req.query, 'includeArchivedNotes'), + ancestorNoteId: req.query['ancestorNoteId'], + ancestorDepth: req.query['ancestorDepth'], // e.g. "eq5" + orderBy: req.query['orderBy'], + orderDirection: parseOrderDirection(req.query, 'orderDirection'), + limit: parseInteger(req.query, 'limit'), + debug: parseBoolean(req.query, 'debug') }; const searchParams = {}; diff --git a/src/public/app/components/zoom.js b/src/public/app/components/zoom.js index 89ffdf965..d3f70a077 100644 --- a/src/public/app/components/zoom.js +++ b/src/public/app/components/zoom.js @@ -31,7 +31,7 @@ class ZoomComponent extends Component { async setZoomFactorAndSave(zoomFactor) { if (zoomFactor >= MIN_ZOOM && zoomFactor <= MAX_ZOOM) { - zoomFactor = Math.round(zoomFactor * 1000) / 1000; + zoomFactor = Math.round(zoomFactor * 10) / 10; this.setZoomFactor(zoomFactor); diff --git a/src/services/build.js b/src/services/build.js index 76698bb1a..f3031a049 100644 --- a/src/services/build.js +++ b/src/services/build.js @@ -1 +1 @@ -module.exports = { buildDate:"2023-01-04T22:36:31+01:00", buildRevision: "3a5fa2954dea0ff2ecdce9a28b3bb01f039d314d" }; +module.exports = { buildDate:"2023-01-11T23:44:33+01:00", buildRevision: "bdfdc0402ddb23e9af002580f368bc52e4268b3a" }; diff --git a/test-etapi/post-note-revision.http b/test-etapi/post-note-revision.http new file mode 100644 index 000000000..74b9f7152 --- /dev/null +++ b/test-etapi/post-note-revision.http @@ -0,0 +1,23 @@ +POST {{triliumHost}}/etapi/create-note +Authorization: {{authToken}} +Content-Type: application/json + +{ + "parentNoteId": "root", + "title": "Hello", + "type": "code", + "mime": "text/plain", + "content": "Hi there!" +} + +> {% client.global.set("createdNoteId", response.body.note.noteId); %} + +### + +POST {{triliumHost}}/etapi/notes/{{createdNoteId}}/note-revision +Authorization: {{authToken}} +Content-Type: text/plain + +Changed content + +> {% client.assert(response.status === 204); %} diff --git a/test-etapi/put-note-content.http b/test-etapi/put-note-content.http index 66797c0dc..670195ac2 100644 --- a/test-etapi/put-note-content.http +++ b/test-etapi/put-note-content.http @@ -20,7 +20,7 @@ Content-Type: text/plain Changed content -> {% client.assert(response.status === 200); %} +> {% client.assert(response.status === 204); %} ###