diff --git a/common/config/rush/pnpm-lock.yaml b/common/config/rush/pnpm-lock.yaml
index 71709607f4..5a5de3ac26 100644
--- a/common/config/rush/pnpm-lock.yaml
+++ b/common/config/rush/pnpm-lock.yaml
@@ -20650,7 +20650,7 @@ packages:
dev: false
file:projects/panel.tgz(@types/node@20.11.19)(esbuild@0.20.1)(postcss-load-config@4.0.2)(postcss@8.4.35)(ts-node@10.9.2):
- resolution: {integrity: sha512-P4H97igqWddz9UBNpLY742cNaADue6UfT+1y00SNB/MmJE7qop/lttaCMAvFXgZJ4HvlN7d18II/AHpMZAnABg==, tarball: file:projects/panel.tgz}
+ resolution: {integrity: sha512-cFoTjnZ6mHJtNSppmfDuDx2wE5B4xGLxee96kAfHWSufWMYuHF69977P0VSlDEen1iXSNu2jQAWUux7wiEaKQQ==, tarball: file:projects/panel.tgz}
id: file:projects/panel.tgz
name: '@rush-temp/panel'
version: 0.0.0
diff --git a/packages/panel/package.json b/packages/panel/package.json
index ef81d544e9..18f5ba963f 100644
--- a/packages/panel/package.json
+++ b/packages/panel/package.json
@@ -39,7 +39,6 @@
},
"dependencies": {
"@hcengineering/ui": "^0.6.11",
- "@hcengineering/text-editor": "^0.6.0",
"svelte": "^4.2.12",
"@hcengineering/platform": "^0.6.9",
"@hcengineering/core": "^0.6.28",
diff --git a/packages/text-editor/package.json b/packages/text-editor/package.json
index f5e3beab9b..6adab64652 100644
--- a/packages/text-editor/package.json
+++ b/packages/text-editor/package.json
@@ -41,7 +41,6 @@
"@hcengineering/presentation": "^0.6.2",
"@hcengineering/platform": "^0.6.9",
"@hcengineering/core": "^0.6.28",
- "@hcengineering/contact": "^0.6.20",
"@hcengineering/ui": "^0.6.11",
"@hcengineering/view": "^0.6.9",
"@hcengineering/text": "^0.6.1",
diff --git a/packages/text-editor/src/components/CollaborationUserPopup.svelte b/packages/text-editor/src/components/CollaborationUserPopup.svelte
index 87574b8c5b..f1d3c2753b 100644
--- a/packages/text-editor/src/components/CollaborationUserPopup.svelte
+++ b/packages/text-editor/src/components/CollaborationUserPopup.svelte
@@ -15,7 +15,7 @@
//
-->
+
+{#if states.length > 0}
+
+ {#each states as state}
+
+ {/each}
+
+{/if}
+
+
diff --git a/packages/text-editor/src/components/CollaborativeAttributeBox.svelte b/packages/text-editor/src/components/CollaborativeAttributeBox.svelte
index 4ff86576ab..e184433fdc 100644
--- a/packages/text-editor/src/components/CollaborativeAttributeBox.svelte
+++ b/packages/text-editor/src/components/CollaborativeAttributeBox.svelte
@@ -16,12 +16,12 @@
import core, { CollaborativeDoc, Doc, getCollaborativeDoc, getCollaborativeDocId } from '@hcengineering/core'
import { IntlString } from '@hcengineering/platform'
import { KeyedAttribute, getAttribute, getClient } from '@hcengineering/presentation'
- import { registerFocus } from '@hcengineering/ui'
+ import { AnySvelteComponent, registerFocus } from '@hcengineering/ui'
import CollaborativeTextEditor from './CollaborativeTextEditor.svelte'
import { FocusExtension } from './extension/focus'
import { type FileAttachFunction } from './extension/types'
import textEditorPlugin from '../plugin'
- import { RefAction, TextNodeAction } from '../types'
+ import { CollaborationUser, RefAction, TextNodeAction } from '../types'
export let object: Doc
export let key: KeyedAttribute
@@ -29,6 +29,9 @@
export let textNodeActions: TextNodeAction[] = []
export let refActions: RefAction[] = []
+ export let user: CollaborationUser
+ export let userComponent: AnySvelteComponent | undefined = undefined
+
export let placeholder: IntlString = textEditorPlugin.string.EditorPlaceholder
export let attachFile: FileAttachFunction | undefined = undefined
export let boundary: HTMLElement | undefined = undefined
@@ -105,6 +108,8 @@
objectClass={object._class}
objectId={object._id}
objectAttr={key.key}
+ {user}
+ {userComponent}
{textNodeActions}
{refActions}
{extensions}
diff --git a/packages/text-editor/src/components/CollaborativeAttributeSectionBox.svelte b/packages/text-editor/src/components/CollaborativeAttributeSectionBox.svelte
index be8733485a..835a5c0c01 100644
--- a/packages/text-editor/src/components/CollaborativeAttributeSectionBox.svelte
+++ b/packages/text-editor/src/components/CollaborativeAttributeSectionBox.svelte
@@ -19,12 +19,16 @@
import { Label, Icon } from '@hcengineering/ui'
import type { AnySvelteComponent } from '@hcengineering/ui'
import textEditorPlugin from '../plugin'
+ import { CollaborationUser } from '../types'
import CollaborativeAttributeBox from './CollaborativeAttributeBox.svelte'
import IconDescription from './icons/Description.svelte'
export let object: Doc
export let key: KeyedAttribute
+ export let user: CollaborationUser
+ export let userComponent: AnySvelteComponent | undefined = undefined
+
export let label: IntlString = textEditorPlugin.string.FullDescription
export let icon: Asset | AnySvelteComponent = IconDescription
@@ -40,5 +44,14 @@
-
+
diff --git a/packages/text-editor/src/components/CollaborativeTextEditor.svelte b/packages/text-editor/src/components/CollaborativeTextEditor.svelte
index 053809e18b..78ce8a9b95 100644
--- a/packages/text-editor/src/components/CollaborativeTextEditor.svelte
+++ b/packages/text-editor/src/components/CollaborativeTextEditor.svelte
@@ -20,7 +20,7 @@
import { IntlString, getMetadata, translate } from '@hcengineering/platform'
import presentation from '@hcengineering/presentation'
import { markupToJSON } from '@hcengineering/text'
- import { Button, IconSize, Loading, themeStore } from '@hcengineering/ui'
+ import { AnySvelteComponent, Button, IconSize, Loading, ThrottledCaller, themeStore } from '@hcengineering/ui'
import { AnyExtension, Editor, FocusPosition, mergeAttributes } from '@tiptap/core'
import Collaboration, { isChangeOrigin } from '@tiptap/extension-collaboration'
import CollaborationCursor from '@tiptap/extension-collaboration-cursor'
@@ -38,14 +38,15 @@
import { formatCollaborativeDocumentId, formatPlatformDocumentId } from '../provider/utils'
import {
CollaborationIds,
+ CollaborationUser,
RefAction,
TextEditorCommandHandler,
TextEditorHandler,
TextFormatCategory,
TextNodeAction
} from '../types'
- import { getCollaborationUser } from '../utils'
+ import CollaborationUsers from './CollaborationUsers.svelte'
import ImageStyleToolbar from './ImageStyleToolbar.svelte'
import TextEditorStyleToolbar from './TextEditorStyleToolbar.svelte'
import { noSelectionRender, renderCursor } from './editor/collaboration'
@@ -66,6 +67,9 @@
export let objectId: Ref | undefined
export let objectAttr: string | undefined
+ export let user: CollaborationUser
+ export let userComponent: AnySvelteComponent | undefined = undefined
+
export let readonly = false
export let buttonSize: IconSize = 'small'
@@ -256,9 +260,13 @@
}
}
+ const throttle = new ThrottledCaller(100)
+ const updateLastUpdateTime = (): void => {
+ remoteProvider.awareness?.setLocalStateField('lastUpdate', Date.now())
+ }
+
onMount(async () => {
await ph
- const user = await getCollaborationUser()
editor = new Editor({
element,
@@ -326,6 +334,7 @@
// ignore non-local changes
if (isChangeOrigin(transaction)) return
+ throttle.call(updateLastUpdateTime)
dispatch('update')
}
})
@@ -384,6 +393,9 @@
+ {#if remoteProvider && editor && userComponent}
+
+ {/if}
{#if refActions.length > 0}
@@ -430,7 +442,7 @@
flex-grow: 1;
display: flex;
justify-content: space-between;
- align-items: flex-end;
+ align-items: flex-start;
min-height: 1.25rem;
background-color: transparent;
}
diff --git a/packages/text-editor/src/components/CollaboratorEditor.svelte b/packages/text-editor/src/components/CollaboratorEditor.svelte
index e49deae9ec..9b396a33ae 100644
--- a/packages/text-editor/src/components/CollaboratorEditor.svelte
+++ b/packages/text-editor/src/components/CollaboratorEditor.svelte
@@ -17,12 +17,12 @@
+
+{#if person}
+
+{/if}
diff --git a/plugins/contact-resources/src/index.ts b/plugins/contact-resources/src/index.ts
index 39ed17cd5b..7e68413035 100644
--- a/plugins/contact-resources/src/index.ts
+++ b/plugins/contact-resources/src/index.ts
@@ -57,6 +57,7 @@ import ContactsTabs from './components/ContactsTabs.svelte'
import CreateEmployee from './components/CreateEmployee.svelte'
import CreateOrganization from './components/CreateOrganization.svelte'
import CreatePerson from './components/CreatePerson.svelte'
+import CollaborationUserAvatar from './components/CollaborationUserAvatar.svelte'
import DeleteConfirmationPopup from './components/DeleteConfirmationPopup.svelte'
import EditEmployee from './components/EditEmployee.svelte'
import EditMember from './components/EditMember.svelte'
@@ -303,6 +304,7 @@ export default async (): Promise => ({
OrganizationPresenter,
ChannelsPresenter,
CreatePerson,
+ CollaborationUserAvatar,
CreateOrganization,
EditPerson,
EditEmployee,
diff --git a/plugins/contact/src/index.ts b/plugins/contact/src/index.ts
index 9d5f3529c5..671e545e99 100644
--- a/plugins/contact/src/index.ts
+++ b/plugins/contact/src/index.ts
@@ -198,7 +198,8 @@ export const contactPlugin = plugin(contactId, {
DeleteConfirmationPopup: '' as AnyComponent,
AccountArrayEditor: '' as AnyComponent,
PersonIcon: '' as AnyComponent,
- EditOrganizationPanel: '' as AnyComponent
+ EditOrganizationPanel: '' as AnyComponent,
+ CollaborationUserAvatar: '' as AnyComponent
},
channelProvider: {
Email: '' as Ref,
diff --git a/plugins/document-resources/src/components/DocumentEditor.svelte b/plugins/document-resources/src/components/DocumentEditor.svelte
index 2b9aca7509..1c1c74b365 100644
--- a/plugins/document-resources/src/components/DocumentEditor.svelte
+++ b/plugins/document-resources/src/components/DocumentEditor.svelte
@@ -15,8 +15,9 @@
//
-->
{#key object._id}
{#key key.key}
-
+
{/key}
{/key}
diff --git a/plugins/view-resources/src/components/CollaborativeHTMLEditor.svelte b/plugins/view-resources/src/components/CollaborativeHTMLEditor.svelte
index 8f518a5b6e..aed35b5e97 100644
--- a/plugins/view-resources/src/components/CollaborativeHTMLEditor.svelte
+++ b/plugins/view-resources/src/components/CollaborativeHTMLEditor.svelte
@@ -13,15 +13,24 @@
// limitations under the License.
-->
{#key object._id}
-
+
{/key}
diff --git a/plugins/view-resources/src/utils.ts b/plugins/view-resources/src/utils.ts
index 4bc525959d..fe3a3e6006 100644
--- a/plugins/view-resources/src/utils.ts
+++ b/plugins/view-resources/src/utils.ts
@@ -1,6 +1,6 @@
//
// Copyright © 2020, 2021 Anticrm Platform Contributors.
-// Copyright © 2021 Hardcore Engineering Inc.
+// Copyright © 2021, 2024 Hardcore Engineering Inc.
//
// Licensed under the Eclipse Public License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License. You may
@@ -65,8 +65,10 @@ import {
isAdminUser,
createQuery
} from '@hcengineering/presentation'
+import { type CollaborationUser } from '@hcengineering/text-editor'
import {
ErrorPresenter,
+ getColorNumberByText,
getCurrentResolvedLocation,
getPanelURI,
getPlatformColorForText,
@@ -1402,3 +1404,15 @@ permissionsQuery.query(core.class.Space, {}, (res) => {
whitelist: whitelistedSpaces
})
})
+
+export function getCollaborationUser (): CollaborationUser {
+ const me = getCurrentAccount() as PersonAccount
+ const color = getColorNumberByText(me.email)
+
+ return {
+ id: me._id,
+ name: me.email,
+ email: me.email,
+ color
+ }
+}