diff --git a/models/attachment/package.json b/models/attachment/package.json index a742d03fde..d4be1b51a2 100644 --- a/models/attachment/package.json +++ b/models/attachment/package.json @@ -33,6 +33,7 @@ "@anticrm/platform": "~0.6.5", "@anticrm/model-core": "~0.6.0", "@anticrm/model-view": "~0.6.0", - "@anticrm/activity": "~0.6.0" + "@anticrm/activity": "~0.6.0", + "@anticrm/model-preference": "~0.6.0" } } diff --git a/models/attachment/src/index.ts b/models/attachment/src/index.ts index f121e3ca1a..a81b312ed0 100644 --- a/models/attachment/src/index.ts +++ b/models/attachment/src/index.ts @@ -14,11 +14,12 @@ // import activity from '@anticrm/activity' -import type { Attachment, Photo } from '@anticrm/attachment' -import { Domain, IndexKind } from '@anticrm/core' -import { Builder, Index, Model, Prop, TypeString, TypeTimestamp, UX } from '@anticrm/model' +import type { Attachment, Photo, SavedAttachments } from '@anticrm/attachment' +import { Domain, IndexKind, Ref } from '@anticrm/core' +import { Builder, Index, Model, Prop, TypeRef, TypeString, TypeTimestamp, UX } from '@anticrm/model' import core, { TAttachedDoc } from '@anticrm/model-core' import view from '@anticrm/model-view' +import preference, { TPreference } from '@anticrm/model-preference' import attachment from './plugin' export { attachmentOperation } from './migration' @@ -50,8 +51,14 @@ export class TAttachment extends TAttachedDoc implements Attachment { @UX(attachment.string.Photo) export class TPhoto extends TAttachment implements Photo {} +@Model(attachment.class.SavedAttachments, preference.class.Preference) +export class TSavedAttachments extends TPreference implements SavedAttachments { + @Prop(TypeRef(attachment.class.Attachment), attachment.string.SavedAttachments) + attachedTo!: Ref +} + export function createModel (builder: Builder): void { - builder.createModel(TAttachment, TPhoto) + builder.createModel(TAttachment, TPhoto, TSavedAttachments) builder.mixin(attachment.class.Attachment, core.class.Class, view.mixin.AttributePresenter, { presenter: attachment.component.AttachmentPresenter diff --git a/models/attachment/src/plugin.ts b/models/attachment/src/plugin.ts index f96cc3d466..804c972c84 100644 --- a/models/attachment/src/plugin.ts +++ b/models/attachment/src/plugin.ts @@ -33,7 +33,8 @@ export default mergeIds(attachmentId, attachment, { Size: '' as IntlString, Type: '' as IntlString, Photo: '' as IntlString, - Date: '' as IntlString + Date: '' as IntlString, + SavedAttachments: '' as IntlString }, ids: { TxAttachmentCreate: '' as Ref diff --git a/models/chunter/src/index.ts b/models/chunter/src/index.ts index f4962dd147..b537a86679 100644 --- a/models/chunter/src/index.ts +++ b/models/chunter/src/index.ts @@ -16,9 +16,9 @@ import activity from '@anticrm/activity' import type { Backlink, - ChunterSpace, Channel, ChunterMessage, + ChunterSpace, Comment, Message, SavedMessages, diff --git a/plugins/attachment-assets/lang/en.json b/plugins/attachment-assets/lang/en.json index 5e07c693c0..b76fe4e96d 100644 --- a/plugins/attachment-assets/lang/en.json +++ b/plugins/attachment-assets/lang/en.json @@ -36,6 +36,8 @@ "FileBrowserTypeFilterImages": "Images", "FileBrowserTypeFilterAudio": "Audio", "FileBrowserTypeFilterVideos": "Videos", - "FileBrowserTypeFilterPDFs": "PDFs" + "FileBrowserTypeFilterPDFs": "PDFs", + "AddAttachmentToSaved": "Add attachment to saved", + "RemoveAttachmentFromSaved": "Remove attachment from saved" } } \ No newline at end of file diff --git a/plugins/attachment-assets/lang/ru.json b/plugins/attachment-assets/lang/ru.json index b9d668462e..35fe1ffde8 100644 --- a/plugins/attachment-assets/lang/ru.json +++ b/plugins/attachment-assets/lang/ru.json @@ -36,6 +36,8 @@ "FileBrowserTypeFilterImages": "Изображения", "FileBrowserTypeFilterAudio": "Звук", "FileBrowserTypeFilterVideos": "Видео", - "FileBrowserTypeFilterPDFs": "PDF-файлы" + "FileBrowserTypeFilterPDFs": "PDF-файлы", + "AddAttachmentToSaved": "Добавить вложение в сохраненные", + "RemoveAttachmentFromSaved": "Удалить вложение из сохраненных" } } \ No newline at end of file diff --git a/plugins/attachment-resources/package.json b/plugins/attachment-resources/package.json index 34de309c04..1842dc46cd 100644 --- a/plugins/attachment-resources/package.json +++ b/plugins/attachment-resources/package.json @@ -43,6 +43,7 @@ "@anticrm/panel": "~0.6.0", "@anticrm/text-editor": "~0.6.0", "@anticrm/login": "~0.6.1", - "filesize": "^8.0.3" + "filesize": "^8.0.3", + "@anticrm/preference": "~0.6.0" } } diff --git a/plugins/attachment-resources/src/components/AttachmentList.svelte b/plugins/attachment-resources/src/components/AttachmentList.svelte index 109bed56f5..ab6ffbd6a3 100644 --- a/plugins/attachment-resources/src/components/AttachmentList.svelte +++ b/plugins/attachment-resources/src/components/AttachmentList.svelte @@ -14,16 +14,18 @@ --> {#if attachments.length}
{#each attachments as attachment}
- +
{/each}
diff --git a/plugins/attachment-resources/src/components/AttachmentPreview.svelte b/plugins/attachment-resources/src/components/AttachmentPreview.svelte index 684efb9a3d..268d337168 100644 --- a/plugins/attachment-resources/src/components/AttachmentPreview.svelte +++ b/plugins/attachment-resources/src/components/AttachmentPreview.svelte @@ -13,43 +13,116 @@ // See the License for the specific language governing permissions and // limitations under the License. --> -
{#if type === 'image'} -
{ - closeTooltip() - showPopup(PDFViewer, { file: value.file, name: value.name, contentType: value.type }, 'right') - }}> +
{ + closeTooltip() + showPopup(PDFViewer, { file: value.file, name: value.name, contentType: value.type }, 'right') + }} + > {value.name} +
+ { + showMenu(e) + }} + /> +
{:else if type === 'audio'} - +
+ +
+ { + showMenu(e) + }} + /> +
+
{:else if type === 'video'} -
+