From cda2cd08b992793cbd48aa3b4bdf55a30f381471 Mon Sep 17 00:00:00 2001 From: vmonakhov Date: Mon, 16 Dec 2024 19:53:34 +0300 Subject: [PATCH] fixed dnd metadata --- src/components/JoinMarkupsModal/index.js | 3 ++- src/components/LexicalEntryCorp/Text.js | 2 +- src/components/LexicalEntryCorp/index.js | 8 +++++--- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/components/JoinMarkupsModal/index.js b/src/components/JoinMarkupsModal/index.js index a965daba..aa0d932a 100644 --- a/src/components/JoinMarkupsModal/index.js +++ b/src/components/JoinMarkupsModal/index.js @@ -43,8 +43,9 @@ const createMarkupGroupMutation = gql` // 'markups' has the following format: [[ ], ... ] export const deleteMarkupGroupMutation = gql` - mutation deleteMarkupGroup($groupIds: [LingvodocID]!, $markups: [[Int]], $perspectiveId: LingvodocID) { + mutation deleteMarkupGroup($groupIds: [[Int]]!, $markups: [[Int]], $perspectiveId: LingvodocID) { delete_markup_group(group_ids: $groupIds, markups: $markups, perspective_id: $perspectiveId) { + entry_ids triumph } } diff --git a/src/components/LexicalEntryCorp/Text.js b/src/components/LexicalEntryCorp/Text.js index 5b41545b..875879ad 100644 --- a/src/components/LexicalEntryCorp/Text.js +++ b/src/components/LexicalEntryCorp/Text.js @@ -247,7 +247,7 @@ const TextEntityContent = ({ // useDrag - the list item is draggable const [{ isDragging }, dragRef, preview] = useDrag({ type: "entity", - item: { id, content }, + item: { id, content, metadata: entity.additional_metadata }, collect: monitor => ({ isDragging: monitor.isDragging() }), diff --git a/src/components/LexicalEntryCorp/index.js b/src/components/LexicalEntryCorp/index.js index 296d9570..d603d337 100644 --- a/src/components/LexicalEntryCorp/index.js +++ b/src/components/LexicalEntryCorp/index.js @@ -28,6 +28,7 @@ const createEntityMutation = gql` $self_id: LingvodocID $content: String $file_content: Upload + $metadata: ObjectVal ) { create_entity( parent_id: $parent_id @@ -35,6 +36,7 @@ const createEntityMutation = gql` self_id: $self_id content: $content file_content: $file_content + additional_metadata: $metadata ) { triumph } @@ -179,7 +181,7 @@ const Entities = ({ const [{ isOver }, dropRef] = useDrop({ accept: 'entity', drop: (item) => { - create(item.content, parentEntity == null ? null : parentEntity.id); + create(item.content, parentEntity == null ? null : parentEntity.id, item.metadata); }, collect: (monitor) => ({ isOver: monitor.isOver() @@ -259,11 +261,11 @@ const Entities = ({ }, [edit]); - const create = useCallback((content, self_id) => { + const create = useCallback((content, self_id, metadata=null) => { setIsBeingCreated(true); - const variables = { parent_id: entry.id, field_id: column.id }; + const variables = { parent_id: entry.id, field_id: column.id, metadata }; if (content instanceof File) { variables.content = null; variables.file_content = content;