From 17323aeb258f01e59dcf8fe720c45dcfd2cd50c8 Mon Sep 17 00:00:00 2001 From: ogerly Date: Tue, 1 Oct 2019 11:00:14 +0200 Subject: [PATCH] logic ok --- webapp/components/Editor/nodes/Embed.js | 83 ++++++++++++++----------- 1 file changed, 47 insertions(+), 36 deletions(-) diff --git a/webapp/components/Editor/nodes/Embed.js b/webapp/components/Editor/nodes/Embed.js index 8a9343311..4be49ee0c 100644 --- a/webapp/components/Editor/nodes/Embed.js +++ b/webapp/components/Editor/nodes/Embed.js @@ -4,28 +4,31 @@ import { compileToFunctions } from 'vue-template-compiler' import { mapGetters, mapMutations } from 'vuex' import { allowEmbedIframesMutation } from '~/graphql/User.js' -const template = ` - - - - - Deine Daten sind noch nicht weitergegeben. Wenn Du die das jetzt ansiehst dann werden auch Daten mit dem Anbieter ({{embedPublisher}}) ausgetauscht! - jetzt ansehen - - automatisches Einbinden zulassen? | - - - automatisches Einbinden zugelassen | - - +const template = ` + + + + Deine Daten sind noch nicht weitergegeben. Wenn Du die das jetzt ansiehst dann werden auch Daten mit dem Anbieter ({{embedPublisher}}) ausgetauscht! + Du verlässt jetzt Human Connection! Du wirst zu ({{embedPublisher}}) weitergeleitet! + jetzt ansehen + Webseite aufrufen +

+ + + + automatisches Einbinden zulassen? | + + + automatisches Einbinden zugelassen | + +

-

- dataEmbedUrl -

+ dataEmbedUrl +

-

{{ embedTitle }}
-
{{ embedDescription }}
- +
{{ embedTitle }}
+
{{ embedDescription }}
+
{{ dataEmbedUrl }} @@ -89,9 +92,10 @@ export default class Embed extends Node { props: ['node', 'updateAttrs', 'options'], data: () => ({ embedData: {}, - showEmbed: true, - showOverlay: false, - linkOnly: false, + showPreviewImage: true, + showEmbed: null, + showOverlay: null, + isOnlyLink: false, }), async created() { if (!this.options) return {} @@ -104,11 +108,18 @@ export default class Embed extends Node { }), embedHtml() { const { html = '' } = this.embedData - if (html === '') { - this.linkOnly = true - } else { - this.linkOnly = false + if (this.embedData.html === null) { + this.isOnlyLink = true } + + if (this.showEmbed && !this.isOnlyLink) { + this.showPreviewImage = false + } + + if (!this.showEmbed && this.isOnlyLink) { + this.showPreviewImage = true + } + return html }, embedImage() { @@ -149,15 +160,6 @@ export default class Embed extends Node { clickPreview() { this.showOverlay = true }, - allowEmbedTemporar(xx) { - if (xx === 'openIframe') { - this.showEmbed = true - this.showOverlay = false - } else { - this.showEmbed = false - this.showOverlay = true - } - }, check(e) { if (e.target.checked) { this.submit(true) @@ -166,6 +168,15 @@ export default class Embed extends Node { } this.showOverlay = false }, + allowEmbedTemporar(xx) { + if (!this.isOnlyLink) { + this.showEmbed = true + this.showOverlay = false + } else { + this.showEmbed = false + this.showOverlay = false + } + }, async submit(allowEmbedIframes) { try { await this.$apollo.mutate({