Attach actor to pictures entity
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
<template>
|
||||
<div>
|
||||
<div class="editor">
|
||||
<div class="editor" id="tiptab-editor" :data-actor-id="loggedPerson && loggedPerson.id">
|
||||
<editor-menu-bar :editor="editor" v-slot="{ commands, isActive, focused }">
|
||||
<div class="menubar bar-is-hidden" :class="{ 'is-focused': focused }">
|
||||
|
||||
@@ -172,16 +172,25 @@ import {
|
||||
} from 'tiptap-extensions';
|
||||
import tippy, { Instance } from 'tippy.js';
|
||||
import { SEARCH_PERSONS } from '@/graphql/search';
|
||||
import { IActor } from '@/types/actor';
|
||||
import { IActor, IPerson } from '@/types/actor';
|
||||
import Image from '@/components/Editor/Image';
|
||||
import { UPLOAD_PICTURE } from '@/graphql/upload';
|
||||
import { listenFileUpload } from '@/utils/upload';
|
||||
import { LOGGED_PERSON } from '@/graphql/actor';
|
||||
|
||||
@Component({
|
||||
components: { EditorContent, EditorMenuBar, EditorMenuBubble },
|
||||
apollo: {
|
||||
loggedPerson: {
|
||||
query: LOGGED_PERSON,
|
||||
},
|
||||
},
|
||||
})
|
||||
export default class CreateEvent extends Vue {
|
||||
@Prop({ required: true }) value!: String;
|
||||
|
||||
loggedPerson!: IPerson;
|
||||
|
||||
editor: Editor = null;
|
||||
|
||||
/**
|
||||
@@ -429,6 +438,7 @@ export default class CreateEvent extends Vue {
|
||||
variables: {
|
||||
file: image,
|
||||
name: image.name,
|
||||
actorId: this.loggedPerson.id,
|
||||
},
|
||||
});
|
||||
if (data.uploadPicture && data.uploadPicture.url) {
|
||||
|
||||
@@ -71,11 +71,14 @@ export default class Image extends Node {
|
||||
const { schema } = view.state;
|
||||
const coordinates = view.posAtCoords({ left: event.clientX, top: event.clientY });
|
||||
const client = apolloProvider.defaultClient as ApolloClient<InMemoryCache>;
|
||||
const editorElem = document.getElementById('tiptab-editor');
|
||||
const actorId = editorElem && editorElem.dataset.actorId;
|
||||
|
||||
for (const image of images) {
|
||||
const { data } = await client.mutate({
|
||||
mutation: UPLOAD_PICTURE,
|
||||
variables: {
|
||||
actorId,
|
||||
file: image,
|
||||
name: image.name,
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user