From 7c48095b7529d3e600b28e42adf4e59aa9fdacf6 Mon Sep 17 00:00:00 2001 From: Ruslan Bayandinov <45530296+wazsone@users.noreply.github.com> Date: Tue, 6 Jun 2023 12:03:33 +0700 Subject: [PATCH] Remove 'Open' from context menu's (#3350) Signed-off-by: Ruslan Bayandinov --- models/view/src/index.ts | 21 ---------- .../src/components/EditDoc.svelte | 7 +++- .../src/components/EditVacancy.svelte | 3 +- .../components/issues/edit/EditIssue.svelte | 7 +++- .../templates/EditIssueTemplate.svelte | 41 ++++--------------- .../src/components/EditDoc.svelte | 2 +- .../view-resources/src/components/Menu.svelte | 18 ++++++-- 7 files changed, 36 insertions(+), 63 deletions(-) diff --git a/models/view/src/index.ts b/models/view/src/index.ts index 0c313a5888..4d44c339a7 100644 --- a/models/view/src/index.ts +++ b/models/view/src/index.ts @@ -968,27 +968,6 @@ export function createModel (builder: Builder): void { classPresenter(builder, core.class.EnumOf, view.component.EnumPresenter, view.component.EnumEditor) - // createAction( - // builder, - // { - // action: view.actionImpl.ShowPopup, - // actionProps: { - // component: view.component.IndexedDocumentPreview, - // fillProps: { - // _id: 'objectId' - // } - // }, - // label: presenation.string.DocumentPreview, - // keyBinding: [''], - // input: 'focus', - // icon: view.icon.Open, - // category: view.category.GeneralNavigation, - // target: core.class.Doc, - // context: { mode: ['context', 'browser', 'editor'] } - // }, - // view.action.Preview - // ) - createAction( builder, { diff --git a/plugins/document-resources/src/components/EditDoc.svelte b/plugins/document-resources/src/components/EditDoc.svelte index a427aaaa4a..5d87a3811f 100644 --- a/plugins/document-resources/src/components/EditDoc.svelte +++ b/plugins/document-resources/src/components/EditDoc.svelte @@ -32,6 +32,7 @@ import { createQuery, getClient } from '@hcengineering/presentation' import tags from '@hcengineering/tags' import { CollaborationDiffViewer } from '@hcengineering/text-editor' + import view from '@hcengineering/view' import { Button, @@ -136,7 +137,11 @@ function showMenu (ev?: Event): void { if (documentObject) { - showPopup(ContextMenu, { object: documentObject }, (ev as MouseEvent).target as HTMLElement) + showPopup( + ContextMenu, + { object: documentObject, excludedActions: [view.action.Open] }, + (ev as MouseEvent).target as HTMLElement + ) } } diff --git a/plugins/recruit-resources/src/components/EditVacancy.svelte b/plugins/recruit-resources/src/components/EditVacancy.svelte index 49b61f72e5..5e268caf03 100644 --- a/plugins/recruit-resources/src/components/EditVacancy.svelte +++ b/plugins/recruit-resources/src/components/EditVacancy.svelte @@ -23,6 +23,7 @@ import presentation, { createQuery, getClient } from '@hcengineering/presentation' import { Vacancy } from '@hcengineering/recruit' import tracker from '@hcengineering/tracker' + import view from '@hcengineering/view' import { Button, Component, EditBox, IconMixin, IconMoreH, Label, LinkWrapper, showPopup } from '@hcengineering/ui' import { ContextMenu, DocAttributeBar } from '@hcengineering/view-resources' import { createEventDispatcher, onDestroy } from 'svelte' @@ -72,7 +73,7 @@ function showMenu (ev?: Event): void { if (object !== undefined) { - showPopup(ContextMenu, { object }, (ev as MouseEvent).target as HTMLElement) + showPopup(ContextMenu, { object, excludedActions: [view.action.Open] }, (ev as MouseEvent).target as HTMLElement) } } diff --git a/plugins/tracker-resources/src/components/issues/edit/EditIssue.svelte b/plugins/tracker-resources/src/components/issues/edit/EditIssue.svelte index 14f48714fa..dcc635db43 100644 --- a/plugins/tracker-resources/src/components/issues/edit/EditIssue.svelte +++ b/plugins/tracker-resources/src/components/issues/edit/EditIssue.svelte @@ -35,6 +35,7 @@ showPopup } from '@hcengineering/ui' import { ContextMenu, DocNavLink, ParentsNavigator, UpDownNavigator } from '@hcengineering/view-resources' + import view from '@hcengineering/view' import { createEventDispatcher, onDestroy } from 'svelte' import { generateIssueShortLink, getIssueId } from '../../../issues' import tracker from '../../../plugin' @@ -115,7 +116,11 @@ function showMenu (ev?: Event): void { if (issue) { - showPopup(ContextMenu, { object: issue }, (ev as MouseEvent).target as HTMLElement) + showPopup( + ContextMenu, + { object: issue, excludedActions: [view.action.Open] }, + (ev as MouseEvent).target as HTMLElement + ) } } diff --git a/plugins/tracker-resources/src/components/templates/EditIssueTemplate.svelte b/plugins/tracker-resources/src/components/templates/EditIssueTemplate.svelte index e58e5c7c14..da2b2837b4 100644 --- a/plugins/tracker-resources/src/components/templates/EditIssueTemplate.svelte +++ b/plugins/tracker-resources/src/components/templates/EditIssueTemplate.svelte @@ -21,7 +21,7 @@ import { createQuery, getClient } from '@hcengineering/presentation' import setting, { settingId } from '@hcengineering/setting' import tags from '@hcengineering/tags' - import type { IssueTemplate, IssueTemplateChild, Project } from '@hcengineering/tracker' + import { IssueTemplate, IssueTemplateChild, Project } from '@hcengineering/tracker' import { Button, EditBox, @@ -33,6 +33,7 @@ showPopup } from '@hcengineering/ui' import { ContextMenu, ParentsNavigator, UpDownNavigator } from '@hcengineering/view-resources' + import view from '@hcengineering/view' import { createEventDispatcher, onDestroy, onMount } from 'svelte' import tracker from '../../plugin' @@ -104,7 +105,11 @@ function showMenu (ev?: Event): void { if (template) { - showPopup(ContextMenu, { object: template }, (ev as MouseEvent).target as HTMLElement) + showPopup( + ContextMenu, + { object: template, excludedActions: [view.action.Open] }, + (ev as MouseEvent).target as HTMLElement + ) } } @@ -232,35 +237,3 @@ {/if} - - diff --git a/plugins/view-resources/src/components/EditDoc.svelte b/plugins/view-resources/src/components/EditDoc.svelte index 8c7a39aed9..85c900602a 100644 --- a/plugins/view-resources/src/components/EditDoc.svelte +++ b/plugins/view-resources/src/components/EditDoc.svelte @@ -258,7 +258,7 @@ function showMenu (ev?: Event): void { if (object !== undefined) { - showPopup(ContextMenu, { object }, (ev as MouseEvent).target as HTMLElement) + showPopup(ContextMenu, { object, excludedActions: [view.action.Open] }, (ev as MouseEvent).target as HTMLElement) } } function handleOpen (ev: CustomEvent): void { diff --git a/plugins/view-resources/src/components/Menu.svelte b/plugins/view-resources/src/components/Menu.svelte index c664d9e085..c9cc768df5 100644 --- a/plugins/view-resources/src/components/Menu.svelte +++ b/plugins/view-resources/src/components/Menu.svelte @@ -13,16 +13,17 @@ // limitations under the License. -->