diff --git a/plugins/document-resources/src/components/DocumentEditor.svelte b/plugins/document-resources/src/components/DocumentEditor.svelte index 547023115e..8c5766c6e7 100644 --- a/plugins/document-resources/src/components/DocumentEditor.svelte +++ b/plugins/document-resources/src/components/DocumentEditor.svelte @@ -77,5 +77,6 @@ onExtensions={handleExtensions} on:update on:open-document + on:loaded bind:this={collabEditor} /> diff --git a/plugins/document-resources/src/components/EditDoc.svelte b/plugins/document-resources/src/components/EditDoc.svelte index b1814d3a60..8bdd24d4ef 100644 --- a/plugins/document-resources/src/components/EditDoc.svelte +++ b/plugins/document-resources/src/components/EditDoc.svelte @@ -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} diff --git a/plugins/text-editor-resources/src/components/CollaborativeTextEditor.svelte b/plugins/text-editor-resources/src/components/CollaborativeTextEditor.svelte index cb43f5641e..b8650476f0 100644 --- a/plugins/text-editor-resources/src/components/CollaborativeTextEditor.svelte +++ b/plugins/text-editor-resources/src/components/CollaborativeTextEditor.svelte @@ -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 diff --git a/plugins/text-editor-resources/src/components/CollaboratorEditor.svelte b/plugins/text-editor-resources/src/components/CollaboratorEditor.svelte index ef86f08098..fc969bef1a 100644 --- a/plugins/text-editor-resources/src/components/CollaboratorEditor.svelte +++ b/plugins/text-editor-resources/src/components/CollaboratorEditor.svelte @@ -103,6 +103,7 @@ on:update on:open-document on:blur + on:loaded on:focus={handleFocus} /> </div>