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} onExtensions={handleExtensions}
on:update on:update
on:open-document on:open-document
on:loaded
bind:this={collabEditor} bind:this={collabEditor}
/> />

View File

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

View File

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

View File

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