diff --git a/src/public/app/services/keyboard_actions.js b/src/public/app/services/keyboard_actions.js
index 2eebf152c..ab7fffbfc 100644
--- a/src/public/app/services/keyboard_actions.js
+++ b/src/public/app/services/keyboard_actions.js
@@ -27,7 +27,7 @@ async function setupActionsForElement(scope, $el, component) {
for (const action of actions) {
for (const shortcut of action.effectiveShortcuts) {
- utils.bindElShortcut($el, shortcut, () => component.triggerCommand(action.actionName));
+ utils.bindElShortcut($el, shortcut, () => component.triggerCommand(action.actionName, {tabId: appContext.tabManager.activeTabId}));
}
}
}
@@ -35,7 +35,7 @@ async function setupActionsForElement(scope, $el, component) {
getActionsForScope("window").then(actions => {
for (const action of actions) {
for (const shortcut of action.effectiveShortcuts) {
- utils.bindGlobalShortcut(shortcut, () => appContext.triggerCommand(action.actionName));
+ utils.bindGlobalShortcut(shortcut, () => appContext.triggerCommand(action.actionName, {tabId: appContext.tabManager.activeTabId}));
}
}
});
@@ -112,4 +112,4 @@ export default {
updateDisplayedShortcuts,
setupActionsForElement,
getActionsForScope
-};
\ No newline at end of file
+};
diff --git a/src/public/app/widgets/attribute_detail.js b/src/public/app/widgets/attribute_detail.js
index b67576a69..d018d500c 100644
--- a/src/public/app/widgets/attribute_detail.js
+++ b/src/public/app/widgets/attribute_detail.js
@@ -330,6 +330,8 @@ export default class AttributeDetailWidget extends TabAwareWidget {
await this.triggerCommand('saveAttributes');
this.hide();
+
+ this.triggerCommand('focusOnAttributes', {tabId: this.tabContext.tabId});
}
userEditedAttribute() {
diff --git a/src/public/app/widgets/attribute_editor.js b/src/public/app/widgets/attribute_editor.js
index f579a22f1..9d231f59b 100644
--- a/src/public/app/widgets/attribute_editor.js
+++ b/src/public/app/widgets/attribute_editor.js
@@ -221,8 +221,8 @@ export default class AttributeEditorWidget extends TabAwareWidget {
y: e.pageY,
orientation: 'left',
items: [
- {title: "Add new label", command: "addNewLabel", uiIcon: "hash"},
- {title: "Add new relation", command: "addNewRelation", uiIcon: "transfer"},
+ {title: `Add new label `, command: "addNewLabel", uiIcon: "hash"},
+ {title: `Add new relation `, command: "addNewRelation", uiIcon: "transfer"},
{title: "----"},
{title: "Add new label definition", command: "addNewLabelDefinition", uiIcon: "empty"},
{title: "Add new relation definition", command: "addNewRelationDefinition", uiIcon: "empty"},
@@ -231,6 +231,16 @@ export default class AttributeEditorWidget extends TabAwareWidget {
});
}
+ // triggered from keyboard shortcut
+ addNewLabelEvent() {
+ this.handleAddNewAttributeCommand('addNewLabel');
+ }
+
+ // triggered from keyboard shortcut
+ addNewRelationEvent() {
+ this.handleAddNewAttributeCommand('addNewRelation');
+ }
+
async handleAddNewAttributeCommand(command) {
const attrs = this.parseAttributes();
@@ -466,6 +476,10 @@ export default class AttributeEditorWidget extends TabAwareWidget {
if (this.tabContext.tabId === tabId) {
if (this.$editor.is(":visible")) {
this.$editor.trigger('focus');
+
+ this.textEditor.model.change(writer => { // put focus to the end of the content
+ writer.setSelection(writer.createPositionAt(this.textEditor.model.document.getRoot(), 'end'));
+ });
}
else {
this.triggerCommand('focusOnDetail', {tabId: this.tabContext.tabId});
diff --git a/src/services/keyboard_actions.js b/src/services/keyboard_actions.js
index cbbd06474..82c9104e1 100644
--- a/src/services/keyboard_actions.js
+++ b/src/services/keyboard_actions.js
@@ -224,12 +224,6 @@ const DEFAULT_KEYBOARD_ACTIONS = [
{
separator: "Dialogs"
},
- { // FIXME
- actionName: "showAttributes",
- defaultShortcuts: ["Alt+A"],
- description: "Shows Attributes",
- scope: "window"
- },
{
actionName: "showNoteInfo",
defaultShortcuts: [],
@@ -314,6 +308,29 @@ const DEFAULT_KEYBOARD_ACTIONS = [
scope: "text-detail"
},
+ {
+ separator: "Attributes (labels & relations)"
+ },
+
+ {
+ actionName: "focusOnAttributes",
+ defaultShortcuts: ["Alt+A"],
+ description: "Put focus into attribute editor",
+ scope: "window"
+ },
+ {
+ actionName: "addNewLabel",
+ defaultShortcuts: ["Alt+L"],
+ description: "Create new label",
+ scope: "window"
+ },
+ {
+ actionName: "addNewRelation",
+ defaultShortcuts: ["Alt+R"],
+ description: "Create new relation",
+ scope: "window"
+ },
+
{
separator: "Other"
},