diff --git a/models/attachment/package.json b/models/attachment/package.json index 7d94445a8d..ec30d84bfa 100644 --- a/models/attachment/package.json +++ b/models/attachment/package.json @@ -40,6 +40,7 @@ "@hcengineering/ui": "^0.6.15", "@hcengineering/view": "^0.6.13", "@hcengineering/model-presentation": "^0.6.0", - "@hcengineering/model-uploader": "^0.6.0" + "@hcengineering/model-uploader": "^0.6.0", + "@hcengineering/workbench": "^0.6.16" } } diff --git a/models/attachment/src/index.ts b/models/attachment/src/index.ts index fa062aeb06..f7bf8cf1a4 100644 --- a/models/attachment/src/index.ts +++ b/models/attachment/src/index.ts @@ -31,6 +31,8 @@ import { import core, { TAttachedDoc } from '@hcengineering/model-core' import preference, { TPreference } from '@hcengineering/model-preference' import view, { createAction } from '@hcengineering/model-view' +import workbench, { WidgetType } from '@hcengineering/workbench' +import presentation from '@hcengineering/model-presentation' import attachment from './plugin' @@ -97,6 +99,24 @@ export function createModel (builder: Builder): void { editor: attachment.component.Photos }) + builder.createDoc( + workbench.class.Widget, + core.space.Model, + { + label: attachment.string.Files, + type: WidgetType.Flexible, + icon: attachment.icon.Attachment, + component: attachment.component.PreviewWidget, + closeIfNoTabs: true + }, + attachment.ids.PreviewWidget + ) + + builder.createDoc(presentation.class.ComponentPointExtension, core.space.Model, { + extension: presentation.extension.FilePreviewPopupActions, + component: attachment.component.PreviewPopupActions + }) + builder.createDoc( activity.class.DocUpdateMessageViewlet, core.space.Model, diff --git a/models/attachment/src/plugin.ts b/models/attachment/src/plugin.ts index f62c50a8ab..d8bcdad4f9 100644 --- a/models/attachment/src/plugin.ts +++ b/models/attachment/src/plugin.ts @@ -24,7 +24,9 @@ import type { ActionCategory } from '@hcengineering/view' export default mergeIds(attachmentId, attachment, { component: { - AttachmentPresenter: '' as AnyComponent + AttachmentPresenter: '' as AnyComponent, + PreviewWidget: '' as AnyComponent, + PreviewPopupActions: '' as AnyComponent }, string: { AddAttachment: '' as IntlString, diff --git a/packages/presentation/src/components/DownloadFileButton.svelte b/packages/presentation/src/components/DownloadFileButton.svelte new file mode 100644 index 0000000000..9275126a08 --- /dev/null +++ b/packages/presentation/src/components/DownloadFileButton.svelte @@ -0,0 +1,43 @@ + + + +{#await srcRef then src} + {#if src !== ''} + +