From b7f8fb68ba1a8b98007432fcd78f3e6965d8ee28 Mon Sep 17 00:00:00 2001 From: Denis Maslennikov <41147528+disant1@users.noreply.github.com> Date: Wed, 29 Mar 2023 11:25:26 +0700 Subject: [PATCH] TSK-976: Hide preview action (#2847) Signed-off-by: Denis Maslennikov --- models/view/src/index.ts | 37 ++++++++++--------- models/view/src/plugin.ts | 1 + .../view-resources/src/components/Menu.svelte | 4 +- plugins/view/src/index.ts | 1 + 4 files changed, 25 insertions(+), 18 deletions(-) diff --git a/models/view/src/index.ts b/models/view/src/index.ts index e65bdcc549..a4e90d3ae5 100644 --- a/models/view/src/index.ts +++ b/models/view/src/index.ts @@ -18,7 +18,6 @@ import { DOMAIN_MODEL } from '@hcengineering/core' import { Builder, Mixin, Model } from '@hcengineering/model' import core, { TClass, TDoc } from '@hcengineering/model-core' import preference, { TPreference } from '@hcengineering/model-preference' -import presenation from '@hcengineering/model-presentation' import type { Asset, IntlString, Resource, Status } from '@hcengineering/platform' import { DOMAIN_PREFERENCE } from '@hcengineering/preference' import type { AnyComponent, Location } from '@hcengineering/ui' @@ -744,22 +743,26 @@ 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'] } - }) + // 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/models/view/src/plugin.ts b/models/view/src/plugin.ts index eb0b236071..b9553ff0be 100644 --- a/models/view/src/plugin.ts +++ b/models/view/src/plugin.ts @@ -35,6 +35,7 @@ export default mergeIds(viewId, view, { ShowPreview: '' as ViewAction, ShowActions: '' as ViewAction, + Preview: '' as ViewAction, Open: '' as ViewAction }, diff --git a/plugins/view-resources/src/components/Menu.svelte b/plugins/view-resources/src/components/Menu.svelte index 543cb0cc8b..c664d9e085 100644 --- a/plugins/view-resources/src/components/Menu.svelte +++ b/plugins/view-resources/src/components/Menu.svelte @@ -54,7 +54,9 @@ resActions = [...newActions, ...actions].sort( (a, b) => (order as any)[a.group ?? 'other'] - (order as any)[b.group ?? 'other'] ) - loaded = true + if (resActions.length > 0) { + loaded = true + } }) diff --git a/plugins/view/src/index.ts b/plugins/view/src/index.ts index be880e56a9..7853eef54e 100644 --- a/plugins/view/src/index.ts +++ b/plugins/view/src/index.ts @@ -629,6 +629,7 @@ const view = plugin(viewId, { ShowPreview: '' as Ref, ShowActions: '' as Ref, + Preview: '' as Ref, // Edit document Open: '' as Ref