Skip to content

TagSpaces is an offline, open source, document manager with tagging support

TS356-Add_new_keyboard_shortcuts

mladensapa76ddf2424a8
diff --git a/data/index.html b/data/index.html
index e8f6cc440..6dfb58d1a 100644
--- a/data/index.html
+++ b/data/index.html
@@ -419,6 +419,18 @@
<label class="col-sm-4 control-label" data-i18n="ns.dialogs:selectAllFiles"></label>
<div class="col-sm-7"><span class="shortcutKey" id='selectAllKeyBindingHelp'></span></div>
</div>
+ <div class='form-group'>
+ <label class="col-sm-4 control-label" data-i18n="ns.dialogs:openFileKeyBinding"></label>
+ <div class="col-sm-7"><span class="shortcutKey" id='openFileKeyBindingHelp'></span></div>
+ </div>
+ <div class='form-group'>
+ <label class="col-sm-4 control-label" data-i18n="ns.dialogs:openFileExternallyKeyBinding"></label>
+ <div class="col-sm-7"><span class="shortcutKey" id='openFileExternallyKeyBindingHelp'></span></div>
+ </div>
+ <div class='form-group'>
+ <label class="col-sm-4 control-label" data-i18n="ns.dialogs:deleteDocumentKeyBinding"></label>
+ <div class="col-sm-7"><span class="shortcutKey" id='deleteDocumentKeyBindingHelp'></span></div>
+ </div>
<div class='form-group'>
<label class="col-sm-4 control-label" data-i18n="ns.dialogs:reloadDocumentKeyBinding"></label>
<div class="col-sm-7"><span class="shortcutKey" id='reloadDocumentKeyBindingHelp'></span></div>
diff --git a/data/js/core.api.js b/data/js/core.api.js
index 26e09a866..276b6c571 100644
--- a/data/js/core.api.js
+++ b/data/js/core.api.js
@@ -236,6 +236,9 @@ define(function(require, exports, module) {
Mousetrap.bind(tsSettings.getOpenFileKeyBinding(), function() {
tsFileOpener.openFile(TSCORE.selectedFiles[0]);
});
+ Mousetrap.bind(tsSettings.getOpenFileExternallyKeyBinding(), function() {
+ TSCORE.IO.openFile(TSCORE.selectedFiles[0]);
+ });
}
function checkForNewVersion() {
diff --git a/data/js/core.ui.js b/data/js/core.ui.js
index a0e85a642..9a82fa22b 100644
--- a/data/js/core.ui.js
+++ b/data/js/core.ui.js
@@ -573,6 +573,9 @@ define(function(require, exports) {
$('#renamingFileKeyBindingHelp').html(formatShortcuts(TSCORE.Config.getRenamingFileKeyBinding()));
$('#selectAllKeyBindingHelp').html(formatShortcuts(TSCORE.Config.getSelectAllKeyBinding()));
$('#renamingFileKeyBindingHelp').html(formatShortcuts(TSCORE.Config.getRenamingFileKeyBinding()));
+ $('#openFileKeyBindingHelp').html(formatShortcuts(TSCORE.Config.getOpenFileKeyBinding()));
+ $('#openFileExternallyKeyBindingHelp').html(formatShortcuts(TSCORE.Config.getOpenFileExternallyKeyBinding()));
+ $('#deleteDocumentKeyBindingHelp').html(formatShortcuts(TSCORE.Config.getDeleteDocumentKeyBinding()));
}
function formatShortcuts(shortcut) {
diff --git a/data/js/options.ui.js b/data/js/options.ui.js
index 452f8c532..20406aec4 100644
--- a/data/js/options.ui.js
+++ b/data/js/options.ui.js
@@ -182,6 +182,7 @@ define(function(require, exports, module) {
$('#showSearchKeyBinding').val(TSCORE.Config.getSearchKeyBinding());
$('#deleteDocumentKeyBinding').val(TSCORE.Config.getDeleteDocumentKeyBinding());
$('#openFileKeyBinding').val(TSCORE.Config.getOpenFileKeyBinding());
+ $('#openFileExternallyKeyBinding').val(TSCORE.Config.getOpenFileExternallyKeyBinding());
$('#perspectiveList').empty();
$('#writeMetaToSidecarFile').attr('checked', TSCORE.Config.getWriteMetaToSidecarFile());
$('#useDefaultLocationCheckbox').attr('checked', TSCORE.Config.getUseDefaultLocation());
@@ -288,6 +289,7 @@ define(function(require, exports, module) {
TSCORE.Config.setRenamingFileKeyBinding(parseKeyBinding($('#renamingFileKeyBinding').val()));
TSCORE.Config.setDeleteDocumentKeyBinding(parseKeyBinding($('#deleteDocumentKeyBinding').val()));
TSCORE.Config.setOpenFileKeyBinding(parseKeyBinding($('#openFileKeyBinding').val()));
+ TSCORE.Config.setOpenFileExternallyKeyBinding(parseKeyBinding($('#openFileExternallyKeyBinding').val()));
TSCORE.Config.setDefaultTagColor($('#tagsBackgroundColor').val());
TSCORE.Config.setDefaultTagTextColor($('#tagsForegroundColor').val());
if (TSCORE.PRO) {
diff --git a/data/js/settings.api.js b/data/js/settings.api.js
index 608093be8..1ab767894 100644
--- a/data/js/settings.api.js
+++ b/data/js/settings.api.js
@@ -547,6 +547,20 @@ define(function(require, exports, module) {
exports.Settings.keyBindings.openFile = value;
}
+ function getOpenFileExternallyKeyBinding() {
+ updateKeyBindingsSetting();
+ if (exports.Settings.keyBindings.openFileExternally === undefined) {
+ exports.Settings.keyBindings.openFileExternally = exports.DefaultSettings.keyBindings.openFileExternally;
+ saveSettings();
+ }
+ return exports.Settings.keyBindings.openFileExternally;
+ }
+
+ function setOpenFileExternallyKeyBinding(value) {
+
+ exports.Settings.keyBindings.openFileExternally = value;
+ }
+
function getPropertiesDocumentKeyBinding() {
updateKeyBindingsSetting();
if (exports.Settings.keyBindings.propertiesDocument === undefined) {
@@ -1438,6 +1452,8 @@ define(function(require, exports, module) {
exports.setDeleteDocumentKeyBinding = setDeleteDocumentKeyBinding;
exports.getOpenFileKeyBinding = getOpenFileKeyBinding;
exports.setOpenFileKeyBinding = setOpenFileKeyBinding;
+ exports.getOpenFileExternallyKeyBinding = getOpenFileExternallyKeyBinding;
+ exports.setOpenFileExternallyKeyBinding = setOpenFileExternallyKeyBinding;
exports.getPropertiesDocumentKeyBinding = getPropertiesDocumentKeyBinding;
exports.setPropertiesDocumentKeyBinding = setPropertiesDocumentKeyBinding;
exports.getNextDocumentKeyBinding = getNextDocumentKeyBinding;
diff --git a/data/js/settings.default.js b/data/js/settings.default.js
index 253f77a02..8b18b1b49 100644
--- a/data/js/settings.default.js
+++ b/data/js/settings.default.js
@@ -101,7 +101,8 @@ define(function (require, exports, module) {
"toggleFullScreen": "f11",
"openDevTools": "f12",
"openSearch": "mod+f",
- "openFile": "enter"
+ "openFile": "enter",
+ "openFileExternally": "ctrl+enter"
},
"supportedFileTypes": [
{ "type": "jpg", "viewer": "viewerImage", "editor": "false" },
diff --git a/data/locales/en_US/ns.dialogs.json b/data/locales/en_US/ns.dialogs.json
index 5adc2fbe0..befae14b2 100644
--- a/data/locales/en_US/ns.dialogs.json
+++ b/data/locales/en_US/ns.dialogs.json
@@ -138,6 +138,7 @@
"showSearchKeyBinding": "Show Search",
"deleteDocumentKeyBinding": "Delete Document",
"openFileKeyBinding": "Open File",
+ "openFileExternallyKeyBinding": "Open File Externally",
"perspectivesHelp": "The changes made in this tab will take effect after restarting the application.",
"addPerspectiveButton": "Add new perspective",
"addNewFileExtensionButton": "Add new file extension",
diff --git a/data/templates/OptionsDialog.html b/data/templates/OptionsDialog.html
index bdefea6e4..e06a150cd 100644
--- a/data/templates/OptionsDialog.html
+++ b/data/templates/OptionsDialog.html
@@ -328,7 +328,14 @@
<label class="col-sm-4 control-label" data-i18n="ns.dialogs:openFileKeyBinding"></label>
<div class="col-sm-7">
- <input type='text' class='form-control' id='openFileKeyBinding' placeholder='esc'/>
+ <input type='text' class='form-control' id='openFileKeyBinding' placeholder='esc'/>
+ </div>
+ </div>
+ <div class='form-group'>
+ <label class="col-sm-4 control-label" data-i18n="ns.dialogs:openFileExternallyKeyBinding"></label>
+
+ <div class="col-sm-7">
+ <input type='text' class='form-control' id='openFileExternallyKeyBinding' placeholder='esc'/>
</div>
</div>
<div class='form-group'>
diff --git a/default.settings.tmpl.js b/default.settings.tmpl.js
index 5b3351916..15bed382a 100644
--- a/default.settings.tmpl.js
+++ b/default.settings.tmpl.js
@@ -101,7 +101,8 @@ define(function (require, exports, module) {
"toggleFullScreen": "f11",
"openDevTools": "f12",
"openSearch": "mod+f",
- "openFile": "enter"
+ "openFile": "enter",
+ "openFileExternally": "ctrl+enter"
},
"supportedFileTypes": [
{ "type": "jpg", "viewer": "viewerImage", "editor": "false" },