diff --git a/src/public/app/layouts/desktop_layout.js b/src/public/app/layouts/desktop_layout.js
index a6be0959e..257432374 100644
--- a/src/public/app/layouts/desktop_layout.js
+++ b/src/public/app/layouts/desktop_layout.js
@@ -36,6 +36,7 @@ import SearchResultWidget from "../widgets/search_result.js";
import SyncStatusWidget from "../widgets/sync_status.js";
import ScrollingContainer from "../widgets/containers/scrolling_container.js";
import RootContainer from "../widgets/containers/root_container.js";
+import NoteUpdateStatusWidget from "../widgets/note_update_status.js";
const RIGHT_PANE_CSS = `
+
+
+
+
@@ -59,6 +61,9 @@ export default class ImagePropertiesWidget extends TabAwareWidget {
this.$fileType = this.$widget.find(".image-filetype");
this.$fileSize = this.$widget.find(".image-filesize");
+ this.$openButton = this.$widget.find(".image-open");
+ this.$openButton.on('click', () => openService.openNoteExternally(this.noteId));
+
this.$imageDownloadButton = this.$widget.find(".image-download");
this.$imageDownloadButton.on('click', () => openService.downloadFileNote(this.noteId));
diff --git a/src/public/app/widgets/type_widgets/file.js b/src/public/app/widgets/type_widgets/file.js
index a5e7410bd..a87a21b69 100644
--- a/src/public/app/widgets/type_widgets/file.js
+++ b/src/public/app/widgets/type_widgets/file.js
@@ -24,12 +24,6 @@ const TPL = `
}
-
-
File
has been last modified on .
-
-
-
-
@@ -54,22 +48,6 @@ export default class FileTypeWidget extends TypeWidget {
this.$pdfPreview = this.$widget.find(".pdf-preview");
this.$videoPreview = this.$widget.find(".video-preview");
this.$audioPreview = this.$widget.find(".audio-preview");
-
- this.$fileWatcherWrapper = this.$widget.find(".file-watcher-wrapper");
- this.$fileWatcherWrapper.hide();
-
- this.$fileWatcherPath = this.$widget.find(".file-watcher-path");
- this.$fileWatcherLastModified = this.$widget.find(".file-watcher-last-modified");
- this.$fileWatcherUploadButton = this.$widget.find(".file-watcher-upload-button");
-
- this.$fileWatcherUploadButton.on("click", async () => {
- await server.post(`notes/${this.noteId}/upload-modified-file`, {
- filePath: this.$fileWatcherPath.text()
- });
-
- fileWatcher.fileModificationUploaded(this.noteId);
- this.refreshFileWatchingStatus();
- });
}
async doRefresh(note) {
@@ -107,22 +85,5 @@ export default class FileTypeWidget extends TypeWidget {
else {
this.$previewNotAvailable.show();
}
-
- this.refreshFileWatchingStatus();
- }
-
- refreshFileWatchingStatus() {
- const status = fileWatcher.getFileModificationStatus(this.noteId);
-
- this.$fileWatcherWrapper.toggle(!!status);
-
- if (status) {
- this.$fileWatcherPath.text(status.filePath);
- this.$fileWatcherLastModified.text(dayjs.unix(status.lastModifiedMs / 1000).format("HH:mm:ss"));
- }
- }
-
- openedFileUpdatedEvent(data) {
- this.refreshFileWatchingStatus();
}
}
diff --git a/src/routes/api/files.js b/src/routes/api/files.js
index 7a4a10251..2a9f90e83 100644
--- a/src/routes/api/files.js
+++ b/src/routes/api/files.js
@@ -3,6 +3,7 @@
const protectedSessionService = require('../../services/protected_session');
const repository = require('../../services/repository');
const utils = require('../../services/utils');
+const log = require('../../services/log');
const noteRevisionService = require('../../services/note_revisions');
const tmp = require('tmp');
const fs = require('fs');
@@ -122,6 +123,8 @@ function saveToTmpDir(req) {
fs.writeSync(tmpObj.fd, note.getContent());
fs.closeSync(tmpObj.fd);
+ log.info(`Saved temporary file for note ${noteId} into ${tmpObj.name}`);
+
if (utils.isElectron()) {
chokidar.watch(tmpObj.name).on('change', (path, stats) => {
ws.sendMessageToAllClients({
@@ -130,8 +133,6 @@ function saveToTmpDir(req) {
lastModifiedMs: stats.atimeMs,
filePath: tmpObj.name
});
-
- console.log(stats, path);
});
}
diff --git a/src/routes/api/notes.js b/src/routes/api/notes.js
index a8df5b166..b8710ae7b 100644
--- a/src/routes/api/notes.js
+++ b/src/routes/api/notes.js
@@ -285,6 +285,8 @@ function uploadModifiedFile(req) {
return [404, `Note ${noteId} has not been found`];
}
+ log.info(`Updating note ${noteId} with content from ${filePath}`);
+
noteRevisionService.createNoteRevision(note);
const fileContent = fs.readFileSync(filePath);
diff --git a/src/routes/routes.js b/src/routes/routes.js
index 681c6afe5..d12f1b003 100644
--- a/src/routes/routes.js
+++ b/src/routes/routes.js
@@ -186,7 +186,7 @@ function register(app) {
route(GET, '/api/notes/:noteId/download', [auth.checkApiAuthOrElectron], filesRoute.downloadFile);
// this "hacky" path is used for easier referencing of CSS resources
route(GET, '/api/notes/download/:noteId', [auth.checkApiAuthOrElectron], filesRoute.downloadFile);
- apiRoute(POST, '/api/notes/:noteId/saveToTmpDir', filesRoute.saveToTmpDir);
+ apiRoute(POST, '/api/notes/:noteId/save-to-tmp-dir', filesRoute.saveToTmpDir);
apiRoute(GET, '/api/notes/:noteId/attributes', attributesRoute.getEffectiveNoteAttributes);
apiRoute(POST, '/api/notes/:noteId/attributes', attributesRoute.addNoteAttribute);
diff --git a/src/services/keyboard_actions.js b/src/services/keyboard_actions.js
index c9c61dcad..5c3d46ed5 100644
--- a/src/services/keyboard_actions.js
+++ b/src/services/keyboard_actions.js
@@ -352,6 +352,12 @@ const DEFAULT_KEYBOARD_ACTIONS = [
defaultShortcuts: [],
scope: "window"
},
+ {
+ actionName: "openNoteExternally",
+ defaultShortcuts: [],
+ description: "Open note as a file with default application",
+ scope: "window"
+ },
{
actionName: "renderActiveNote",
defaultShortcuts: [],