diff --git a/models/attachment/src/index.ts b/models/attachment/src/index.ts index f7bf8cf1a4..163ce99ac9 100644 --- a/models/attachment/src/index.ts +++ b/models/attachment/src/index.ts @@ -14,9 +14,10 @@ // import activity from '@hcengineering/activity' -import type { Attachment, AttachmentMetadata, Photo, SavedAttachments } from '@hcengineering/attachment' -import { IndexKind, type Blob, type Domain, type Ref } from '@hcengineering/core' +import type { Attachment, AttachmentMetadata, Drawing, Photo, SavedAttachments } from '@hcengineering/attachment' +import { IndexKind, type Blob, type Class, type Doc, type Domain, type Ref } from '@hcengineering/core' import { + Hidden, Index, Model, Prop, @@ -28,10 +29,11 @@ import { UX, type Builder } from '@hcengineering/model' -import core, { TAttachedDoc } from '@hcengineering/model-core' +import core, { TAttachedDoc, TDoc } 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 { getEmbeddedLabel } from '@hcengineering/platform' import presentation from '@hcengineering/model-presentation' import attachment from './plugin' @@ -80,8 +82,24 @@ export class TSavedAttachments extends TPreference implements SavedAttachments { declare attachedTo: Ref } +@Model(attachment.class.Drawing, core.class.Doc, DOMAIN_ATTACHMENT) +export class TDrawing extends TDoc implements Drawing { + @Prop(TypeRef(core.class.Doc), getEmbeddedLabel('Parent')) + @Index(IndexKind.Indexed) + @Hidden() + parent!: Ref + + @Prop(TypeRef(core.class.Class), getEmbeddedLabel('Parent class')) + @Index(IndexKind.Indexed) + @Hidden() + parentClass!: Ref> + + @Prop(TypeString(), getEmbeddedLabel('Content')) + content?: string +} + export function createModel (builder: Builder): void { - builder.createModel(TAttachment, TPhoto, TSavedAttachments) + builder.createModel(TAttachment, TDrawing, TPhoto, TSavedAttachments) builder.mixin(attachment.class.Attachment, core.class.Class, view.mixin.ObjectPresenter, { presenter: attachment.component.AttachmentPresenter diff --git a/packages/presentation/lang/cs.json b/packages/presentation/lang/cs.json index 166afee3a5..bfdee2bce8 100644 --- a/packages/presentation/lang/cs.json +++ b/packages/presentation/lang/cs.json @@ -33,7 +33,8 @@ "Next": "Další", "FailedToPreview": "Náhled se nezdařil", "ContentType": "Typ obsahu", - "ContentTypeNotSupported": "Náhled není dostupný pro tento typ obsahu" + "ContentTypeNotSupported": "Náhled není dostupný pro tento typ obsahu", + "StartDrawing": "Načmárejte" }, "status": { "FileTooLarge": "Soubor je příliš velký" diff --git a/packages/presentation/lang/en.json b/packages/presentation/lang/en.json index 6af5a21dd6..3bf9c961cd 100644 --- a/packages/presentation/lang/en.json +++ b/packages/presentation/lang/en.json @@ -33,7 +33,8 @@ "Next": "Next", "FailedToPreview": "Failed to preview", "ContentType": "Content type", - "ContentTypeNotSupported": "Preview is not available for this content type" + "ContentTypeNotSupported": "Preview is not available for this content type", + "StartDrawing": "Scribble over" }, "status": { "FileTooLarge": "File too large" diff --git a/packages/presentation/lang/es.json b/packages/presentation/lang/es.json index d313b42ced..3f22269188 100644 --- a/packages/presentation/lang/es.json +++ b/packages/presentation/lang/es.json @@ -33,7 +33,8 @@ "Next": "Siguiente", "FailedToPreview": "Error al previsualizar", "ContentType": "Tipo de contenido", - "ContentTypeNotSupported": "La vista previa no está disponible para este tipo de contenido" + "ContentTypeNotSupported": "La vista previa no está disponible para este tipo de contenido", + "StartDrawing": "Garabatear encima" }, "status": { "FileTooLarge": "Archivo demasiado grande" diff --git a/packages/presentation/lang/fr.json b/packages/presentation/lang/fr.json index 2db2936ecd..0d450533f9 100644 --- a/packages/presentation/lang/fr.json +++ b/packages/presentation/lang/fr.json @@ -33,7 +33,8 @@ "Next": "Suivant", "FailedToPreview": "Échec de l'aperçu", "ContentType": "Type de contenu", - "ContentTypeNotSupported": "L'aperçu n'est pas disponible pour ce type de contenu" + "ContentTypeNotSupported": "L'aperçu n'est pas disponible pour ce type de contenu", + "StartDrawing": "Gribouiller dessus" }, "status": { "FileTooLarge": "Fichier trop volumineux" diff --git a/packages/presentation/lang/it.json b/packages/presentation/lang/it.json index 2adafe0098..9c761f9d0b 100644 --- a/packages/presentation/lang/it.json +++ b/packages/presentation/lang/it.json @@ -33,7 +33,8 @@ "Next": "Successivo", "FailedToPreview": "Impossibile mostrare l'anteprima", "ContentType": "Tipo di contenuto", - "ContentTypeNotSupported": "Anteprima non disponibile per questo tipo di contenuto" + "ContentTypeNotSupported": "Anteprima non disponibile per questo tipo di contenuto", + "StartDrawing": "Scarabocchiare sopra" }, "status": { "FileTooLarge": "File troppo grande" diff --git a/packages/presentation/lang/pt.json b/packages/presentation/lang/pt.json index 3a9a13c216..be2daa978f 100644 --- a/packages/presentation/lang/pt.json +++ b/packages/presentation/lang/pt.json @@ -33,7 +33,8 @@ "Next": "Seguinte", "FailedToPreview": "Falha ao pré-visualizar", "ContentType": "Tipo de conteúdo", - "ContentTypeNotSupported": "A visualização não está disponível para este tipo de conteúdo" + "ContentTypeNotSupported": "A visualização não está disponível para este tipo de conteúdo", + "StartDrawing": "Scarabocchiare sopra" }, "status": { "FileTooLarge": "Ficheiro demasiado grande" diff --git a/packages/presentation/lang/ru.json b/packages/presentation/lang/ru.json index cd4d67aa8c..d34ca683a2 100644 --- a/packages/presentation/lang/ru.json +++ b/packages/presentation/lang/ru.json @@ -33,7 +33,8 @@ "Next": "Далее", "FailedToPreview": "Ошибка предпросмотра", "ContentType": "Тип контента", - "ContentTypeNotSupported": "Предварительный просмотр недоступен для этого типа контента" + "ContentTypeNotSupported": "Предварительный просмотр недоступен для этого типа контента", + "StartDrawing": "Сделать набросок" }, "status": { "FileTooLarge": "Файл слишком большой" diff --git a/packages/presentation/lang/zh.json b/packages/presentation/lang/zh.json index 1ebf4c7ffb..37e2d021f2 100644 --- a/packages/presentation/lang/zh.json +++ b/packages/presentation/lang/zh.json @@ -33,7 +33,8 @@ "Next": "下一步", "FailedToPreview": "预览失败", "ContentType": "内容类型", - "ContentTypeNotSupported": "此內容類型無法預覽" + "ContentTypeNotSupported": "此內容類型無法預覽", + "StartDrawing": "随意涂鸦" }, "status": { "FileTooLarge": "文件太大" diff --git a/packages/presentation/src/components/DrawingBoard.svelte b/packages/presentation/src/components/DrawingBoard.svelte new file mode 100644 index 0000000000..73692de942 --- /dev/null +++ b/packages/presentation/src/components/DrawingBoard.svelte @@ -0,0 +1,147 @@ + + + +{#if active} +
{ + updateToolbarPosition(readonly, board, toolbar) + }} + use:drawing={{ + readonly, + imageWidth, + imageHeight, + drawingData, + saveDrawing, + drawingTool, + penColor + }} + > + {#if !readonly} +
+ + {/each} +
+ {/if} + +
+{:else} + +{/if} + + diff --git a/packages/presentation/src/components/FilePreviewPopup.svelte b/packages/presentation/src/components/FilePreviewPopup.svelte index 4c0bc95191..5dfb00a309 100644 --- a/packages/presentation/src/components/FilePreviewPopup.svelte +++ b/packages/presentation/src/components/FilePreviewPopup.svelte @@ -15,7 +15,7 @@ @@ -65,6 +90,15 @@ + {#if props.drawingAvailable === true} +