diff --git a/src/public/app/services/context_menu.js b/src/public/app/services/context_menu.js index 5789b0819..fde332b0e 100644 --- a/src/public/app/services/context_menu.js +++ b/src/public/app/services/context_menu.js @@ -7,10 +7,10 @@ class ContextMenu { $(document).on('click', () => this.hide()); } - + async show(options) { this.options = options; - + this.$widget.empty(); this.addItems(this.$widget, options.items); @@ -27,7 +27,7 @@ class ContextMenu { // in such case we'll position it above click coordinates so it will fit into client const clientHeight = document.documentElement.clientHeight; const contextMenuHeight = this.$widget.outerHeight() + 30; - let top; + let top, left; if (this.options.y + contextMenuHeight > clientHeight) { top = clientHeight - contextMenuHeight - 10; @@ -35,10 +35,17 @@ class ContextMenu { top = this.options.y - 10; } + if (this.options.orientation === 'left') { + left = this.options.x - this.$widget.outerWidth() + 20; + } + else { + left = this.options.x - 20; + } + this.$widget.css({ display: "block", top: top, - left: this.options.x - 20 + left: left }).addClass("show"); } @@ -113,4 +120,4 @@ class ContextMenu { const contextMenu = new ContextMenu(); -export default contextMenu; \ No newline at end of file +export default contextMenu; diff --git a/src/public/app/widgets/attribute_detail.js b/src/public/app/widgets/attribute_detail.js index 7167ac660..cf190f76e 100644 --- a/src/public/app/widgets/attribute_detail.js +++ b/src/public/app/widgets/attribute_detail.js @@ -6,7 +6,7 @@ import BasicWidget from "./basic_widget.js"; import noteAutocompleteService from "../services/note_autocomplete.js"; const TPL = ` -