fix: revert document content field rename (#6955)

Signed-off-by: Alexander Onnikov <Alexander.Onnikov@xored.com>
This commit is contained in:
Alexander Onnikov
2024-10-16 22:52:46 +07:00
committed by GitHub
parent d1bf10b1d9
commit dea31012b5
10 changed files with 136 additions and 53 deletions
@@ -56,12 +56,12 @@
</script>
<CollaboratorEditor
collaborativeDoc={object.description}
collaborativeDoc={object.content}
objectClass={object._class}
objectId={object._id}
objectSpace={object.space}
objectAttr="description"
field="description"
objectAttr="content"
field="content"
{user}
{userComponent}
{focusIndex}
+1 -1
View File
@@ -79,7 +79,7 @@ export async function createEmptyDocument (
const object: Data<Document> = {
title,
description: makeCollaborativeDoc(id, 'description'),
content: makeCollaborativeDoc(id, 'content'),
attachments: 0,
embeddings: 0,
labels: 0,
+7 -8
View File
@@ -14,7 +14,7 @@
//
import { Attachment } from '@hcengineering/attachment'
import { Account, Card, Class, CollaborativeDoc, Rank, Ref, TypedSpace } from '@hcengineering/core'
import { Account, Class, CollaborativeDoc, Doc, Rank, Ref, TypedSpace } from '@hcengineering/core'
import { Preference } from '@hcengineering/preference'
import { IconProps } from '@hcengineering/view'
@@ -22,11 +22,10 @@ import { IconProps } from '@hcengineering/view'
export interface Teamspace extends TypedSpace, IconProps {}
/** @public */
export interface Document extends Card, IconProps {
export interface Document extends Doc, IconProps {
title: string
content: CollaborativeDoc
parent: Ref<Document>
description: CollaborativeDoc
space: Ref<Teamspace>
lockedBy?: Ref<Account> | null
@@ -42,10 +41,10 @@ export interface Document extends Card, IconProps {
}
/** @public */
export interface DocumentSnapshot extends Card {
parent: Ref<Document>
export interface DocumentSnapshot extends Doc {
title: string
description: CollaborativeDoc
content: CollaborativeDoc
parent: Ref<Document>
}
/** @public */
@@ -365,15 +365,7 @@
remoteProvider.awareness?.setLocalStateField('lastUpdate', Date.now())
}
function parseField (collaborativeDoc: CollaborativeDoc): string | undefined {
if (collaborativeDoc === undefined) return undefined
const _id = collaborativeDoc.split(':')
if (_id === undefined) return undefined
return _id[0]?.split('%')?.[1]
}
onMount(async () => {
const _field = parseField(collaborativeDoc) ?? field
await ph
editor = new Editor({
@@ -406,7 +398,7 @@
Placeholder.configure({ placeholder: placeHolderStr }),
Collaboration.configure({
document: ydoc,
field: _field
field
}),
CollaborationCursor.configure({
provider: remoteProvider,