diff --git a/db/migrations/0157__fix_contentLength.sql b/db/migrations/0157__fix_contentLength.sql new file mode 100644 index 000000000..63bb6ad35 --- /dev/null +++ b/db/migrations/0157__fix_contentLength.sql @@ -0,0 +1 @@ +UPDATE notes SET contentLength = COALESCE((SELECT COALESCE(LENGTH(content), 0) FROM note_contents WHERE note_contents.noteId = notes.noteId), -1); \ No newline at end of file diff --git a/src/public/javascripts/services/entrypoints.js b/src/public/javascripts/services/entrypoints.js index 90323ddcf..6ab62328a 100644 --- a/src/public/javascripts/services/entrypoints.js +++ b/src/public/javascripts/services/entrypoints.js @@ -154,7 +154,7 @@ function registerEntrypoints() { d.showDialog(selectedOrActiveNodes); })); - + keyboardActionService.setGlobalActionHandler("CreateNoteIntoDayNote", async () => { const todayNote = await dateNoteService.getTodayNote(); @@ -203,6 +203,8 @@ function registerEntrypoints() { }); keyboardActionService.setGlobalActionHandler('CollapseTree', () => appContext.getMainNoteTree().collapseTree()); + + keyboardActionService.setGlobalActionHandler("CopyWithoutFormatting", utils.copySelectionToClipboard); } export default { diff --git a/src/public/javascripts/services/utils.js b/src/public/javascripts/services/utils.js index c64882fd7..2c6c0e9f1 100644 --- a/src/public/javascripts/services/utils.js +++ b/src/public/javascripts/services/utils.js @@ -241,6 +241,13 @@ function getUrlForDownload(url) { } } +function copySelectionToClipboard() { + const text = window.getSelection().toString(); + if (navigator.clipboard) { + navigator.clipboard.writeText(text); + } +} + export default { reloadApp, parseDate, @@ -273,5 +280,6 @@ export default { isHtmlEmpty, clearBrowserCache, getUrlForDownload, - normalizeShortcut + normalizeShortcut, + copySelectionToClipboard }; \ No newline at end of file diff --git a/src/services/app_info.js b/src/services/app_info.js index 587d11e62..0c30da676 100644 --- a/src/services/app_info.js +++ b/src/services/app_info.js @@ -4,7 +4,7 @@ const build = require('./build'); const packageJson = require('../../package'); const {TRILIUM_DATA_DIR} = require('./data_dir'); -const APP_DB_VERSION = 156; +const APP_DB_VERSION = 157; const SYNC_VERSION = 14; const CLIPPER_PROTOCOL_VERSION = "1.0"; diff --git a/src/services/keyboard_actions.js b/src/services/keyboard_actions.js index 3311f91d0..c8b1b7dd5 100644 --- a/src/services/keyboard_actions.js +++ b/src/services/keyboard_actions.js @@ -306,6 +306,10 @@ const DEFAULT_KEYBOARD_ACTIONS = [ { actionName: "ZoomIn", defaultShortcuts: ["CommandOrControl+="] + }, + { + actionName: "CopyWithoutFormatting", + defaultShortcuts: ["CommandOrControl+Alt+C"] } ];