Enable default activity in documents (#7401)

Signed-off-by: Victor Ilyushchenko <alt13ri@gmail.com>
This commit is contained in:
Victor Ilyushchenko 2024-12-09 19:32:03 +03:00 committed by GitHub
parent 48bd3ef050
commit 71a306e705
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 14 additions and 11 deletions

View File

@ -77,5 +77,6 @@
onExtensions={handleExtensions}
on:update
on:open-document
on:loaded
bind:this={collabEditor}
/>

View File

@ -15,7 +15,6 @@
//
-->
<script lang="ts">
import activity from '@hcengineering/activity'
import attachment, { Attachment } from '@hcengineering/attachment'
import core, { Doc, Ref, WithLookup, generateId, type Blob } from '@hcengineering/core'
import { Document, DocumentEvents } from '@hcengineering/document'
@ -59,7 +58,6 @@
import DocumentEditor from './DocumentEditor.svelte'
import DocumentPresenter from './DocumentPresenter.svelte'
import DocumentTitle from './DocumentTitle.svelte'
import Activity from './sidebar/Activity.svelte'
import History from './sidebar/History.svelte'
import References from './sidebar/References.svelte'
@ -88,11 +86,14 @@
let headings: Heading[] = []
let loadedDocumentContent = false
const notificationClient = getResource(notification.function.GetInboxNotificationsClient).then((res) => res())
$: read(_id)
function read (_id: Ref<Doc>): void {
if (lastId !== _id) {
loadedDocumentContent = false
const prev = lastId
lastId = _id
void notificationClient.then((client) => client.readDoc(prev))
@ -200,11 +201,6 @@
id: 'references',
icon: document.icon.References,
showTooltip: { label: document.string.Backlinks, direction: 'bottom' }
},
{
id: 'activity',
icon: activity.icon.Activity,
showTooltip: { label: activity.string.Activity, direction: 'bottom' }
}
]
let selectedAside: string | boolean = false
@ -248,8 +244,8 @@
{#if doc !== undefined}
<Panel
withoutActivity={!loadedDocumentContent}
object={doc}
withoutActivity
allowClose={!embedded}
isAside={true}
customAside={aside}
@ -367,7 +363,7 @@
{readonly}
boundary={content}
overflow={'none'}
editorAttributes={{ style: 'padding: 0 2em 30vh; margin: 0 -2em;' }}
editorAttributes={{ style: 'padding: 0 2em 2em; margin: 0 -2em; min-height: 30vh' }}
attachFile={async (file) => {
return await createEmbedding(file)
}}
@ -381,6 +377,9 @@
navigate(location)
}
}}
on:loaded={() => {
loadedDocumentContent = true
}}
bind:this={editor}
/>
{/key}
@ -390,8 +389,6 @@
<svelte:fragment slot="aside">
{#if selectedAside === 'references'}
<References doc={doc._id} />
{:else if selectedAside === 'activity'}
<Activity value={doc} />
{:else if selectedAside === 'history'}
<History value={doc} {readonly} />
{/if}

View File

@ -140,6 +140,10 @@
void localProvider.loaded.then(() => (localSynced = true))
void remoteProvider.loaded.then(() => (remoteSynced = true))
void Promise.all([localProvider.loaded, remoteProvider.loaded]).then(() => {
dispatch('loaded')
})
let editor: Editor
let element: HTMLElement
let textToolbarElement: HTMLElement

View File

@ -103,6 +103,7 @@
on:update
on:open-document
on:blur
on:loaded
on:focus={handleFocus}
/>
</div>