Skip to content

Commit

Permalink
use UUID instead of field name for editor field
Browse files Browse the repository at this point in the history
  • Loading branch information
formfcw committed Jan 5, 2025
1 parent e82e436 commit 0897efa
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/interface/composables/use-m2a-store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import type { Ref } from "vue";
import type { UUID, RelationReference } from "../types";
import type { Item, PrimaryKey } from "@directus/types";

type EditorField = string | null;
type EditorField = UUID | null;

export type M2AStoreItem = {
nodeId: UUID;
Expand Down
6 changes: 4 additions & 2 deletions src/interface/interface.vue
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
// Imports
import { ref, toRef, watch, provide, computed } from "vue";
import { useEditor, EditorContent, type JSONContent } from "@tiptap/vue-3";
import { v4 as uuidv4 } from "uuid";
import Toolbar from "./components/Toolbar.vue";
import Document from "@tiptap/extension-document";
import Text from "@tiptap/extension-text";
Expand Down Expand Up @@ -174,9 +175,10 @@
const errors = ref<string[]>([]);
if (props.m2aField) {
const uniqueEditorField = ref(uuidv4());
const m2aRelation = useRelationReference({
m2aField: toRef(props, "m2aField"),
editorField: toRef(props, "field"),
editorField: uniqueEditorField,
itemCollection: toRef(props, "collection"),
itemPrimaryKey: toRef(props, "primaryKey"),
updateM2aField: (value) =>
Expand All @@ -198,7 +200,7 @@
} = useSyncRelationNodes({
m2aRelation,
editor,
editorField: props.field,
editorField: uniqueEditorField.value,
});
resetRelationNodes = _resetRelationNodes;
syncRelationNodes = _syncRelationNodes;
Expand Down

0 comments on commit 0897efa

Please sign in to comment.