diff --git a/webapp/components/Editor/nodes/Embed.js b/webapp/components/Editor/nodes/Embed.js index 72c59c32b..1275fe3d2 100644 --- a/webapp/components/Editor/nodes/Embed.js +++ b/webapp/components/Editor/nodes/Embed.js @@ -17,11 +17,11 @@ const template = `

Achte auf deine Daten!

Deine Daten sind noch nicht weitergegeben. Wenn Du die das jetzt ansiehst dann werden auch Daten mit dem Anbieter ({{embedPublisher}}) ausgetauscht!
- jetzt ansehen + jetzt ansehen Abbrechen
@@ -85,13 +85,16 @@ export default class Embed extends Node { props: ['node', 'updateAttrs', 'options'], data: () => ({ embedData: {}, - showEmbed: null, + checkedAlwaysAllowEmbeds: false, + showEmbed: false, showOverlay: false, }), async created() { - if (!this.options) return {} - this.embedData = await this.options.onEmbed({ url: this.dataEmbedUrl }) - this.showEmbed = this.currentUser.allowEmbedIframes + if (this.options) { + this.embedData = await this.options.onEmbed({ url: this.dataEmbedUrl }) + this.showEmbed = this.currentUser.allowEmbedIframes + this.checkedAlwaysAllowEmbeds = this.currentUser.allowEmbedIframes + } }, computed: { ...mapGetters({ @@ -142,18 +145,15 @@ export default class Embed extends Node { closeOverlay() { this.showOverlay = false }, - check(e) { - if (e.target.checked) { - this.submit(true) - } else { - this.submit(false) - } - }, - allowEmbedTemporarily() { + allowEmbed() { this.showEmbed = true this.closeOverlay() + + if (this.checkedAlwaysAllowEmbeds !== this.currentUser.allowEmbedIframes) { + this.updateEmbedSettings(this.checkedAlwaysAllowEmbeds) + } }, - async submit(allowEmbedIframes) { + async updateEmbedSettings(allowEmbedIframes) { try { await this.$apollo.mutate({ mutation: allowEmbedIframesMutation(),