diff --git a/app/javascript/vue/shared/inline_edit.vue b/app/javascript/vue/shared/inline_edit.vue index df998ee8d..ca0dc2508 100644 --- a/app/javascript/vue/shared/inline_edit.vue +++ b/app/javascript/vue/shared/inline_edit.vue @@ -34,7 +34,7 @@ v-else ref="view" class="grid sci-cursor-edit leading-5 border-0 py-1 outline-none inline-block border-solid border-y border-transparent" - :class="{ 'text-sn-grey font-normal': isBlank, 'whitespace-pre': !singleLine }" + :class="{ 'text-sn-grey font-normal': isBlank, 'whitespace-pre-line': !singleLine }" @click="enableEdit($event)" > diff --git a/app/javascript/vue/shared/menu_dropdown.vue b/app/javascript/vue/shared/menu_dropdown.vue index f0f2bbc29..e2d683481 100644 --- a/app/javascript/vue/shared/menu_dropdown.vue +++ b/app/javascript/vue/shared/menu_dropdown.vue @@ -7,32 +7,39 @@
- + +
{{ item.text }} - - {{ item.text }} - -
+ + {{ item.text }} + + + - +
@@ -64,13 +71,28 @@ export default { data() { return { showMenu: false, - showSubmenu: null, + openUp: false } }, + watch: { + showMenu() { + if (this.showMenu) { + this.$nextTick(() => { + this.$refs.flyout.style.marginBottom = `${this.$refs.openBtn.offsetHeight}px`; + this.verticalPositionFlyout(); + }) + } + } + }, + mounted() { + document.addEventListener('scroll', this.verticalPositionFlyout); + }, + unmounted() { + document.removeEventListener('scroll', this.verticalPositionFlyout); + }, methods: { closeMenu() { this.showMenu = false; - this.showSubmenu = null; }, handleClick(event, item) { if (!item.url) { @@ -82,7 +104,21 @@ export default { } this.closeMenu(); + }, + verticalPositionFlyout() { + if (!this.showMenu) return; + + const btn = this.$refs.openBtn; + const screenHeight = window.innerHeight; + const btnBottom = btn.getBoundingClientRect().bottom; + + if (screenHeight / 2 < btnBottom) { + this.openUp = true; + } else { + this.openUp = false; + } } + } } diff --git a/config/locales/en.yml b/config/locales/en.yml index 1e094ea7e..abfce7411 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -388,7 +388,7 @@ en: chemical_drawing: "New chemical drawing" file_from_pc: "File from your PC" modified_label: "Modified:" - preview_menu: "Preview size" + preview_menu: "View" add: "ADD" sort_by: "SORT BY" attachments_view_mode: "ALL ATTACHMENTS VIEW SIZE" @@ -412,7 +412,7 @@ en: ztoa_html: "Name ↑" view_mode: inline_html: "Large" - thumbnail_html: "Medium" + thumbnail_html: "Thumbnail" list_html: "List" search: @@ -3402,7 +3402,7 @@ en: delete: "Delete" move: "Move" inline_html: "Large" - thumbnail_html: "Medium" + thumbnail_html: "Thumbnail" list_html: "List" delete_file_modal: title: "Delete attachment"