diff --git a/webapp/components/Editor/Editor.story.js b/webapp/components/Editor/Editor.story.js
index aaaa0eb58..7a69b347f 100644
--- a/webapp/components/Editor/Editor.story.js
+++ b/webapp/components/Editor/Editor.story.js
@@ -5,8 +5,12 @@ import helpers from '~/storybook/helpers'
import Vue from 'vue'
const embed = {
+ image: 'https://i.ytimg.com/vi/ptCcgLM-p8k/maxresdefault_live.jpg',
+ title: 'Video Titel',
+ // html: null,
+ description: 'Video Description',
html:
- '',
+ '',
}
const plugins = [
@@ -114,15 +118,12 @@ storiesOf('Editor', module)
}),
template: ``,
}))
- .add('Embeds', () => ({
+ .add('Embeds with iframe', () => ({
components: { HcEditor },
store: helpers.store,
data: () => ({
users,
content: `
-
- The following link should render a youtube video in addition to the link.
-
https://www.youtube.com/watch?v=qkdXAtO40Fo
@@ -130,3 +131,16 @@ storiesOf('Editor', module)
}),
template: ``,
}))
+ .add('Embeds with plain link', () => ({
+ components: { HcEditor },
+ store: helpers.store,
+ data: () => ({
+ users,
+ content: `
+
+ https://telegram.org/
+
+ `,
+ }),
+ template: ``,
+ }))
diff --git a/webapp/components/Editor/nodes/Embed.js b/webapp/components/Editor/nodes/Embed.js
index 60f5eab76..7e63f2170 100644
--- a/webapp/components/Editor/nodes/Embed.js
+++ b/webapp/components/Editor/nodes/Embed.js
@@ -5,67 +5,38 @@ import { mapGetters, mapMutations } from 'vuex'
import { allowEmbedIframesMutation } from '~/graphql/User.js'
const template = `
-
-
- {{ dataEmbedUrl }}
-
-`
-
-const templateVideoPreview = `
-
-
-
-
- {{embedPublisher}} - @{{ embedAuthor }}
-
-
- {{ embedTitle }}
- {{ embedDescription }}
-
-
- automatisches Einbinden abgestellt | ändern
-
- automatisches Einbinden zugelassen | ändern
-
-
-
+
+
+
+
+
{{ embedTitle }}
+ {{ embedDescription }}
+
+ {{ dataEmbedUrl }}
+
+
+
`
const compiledTemplate = compileToFunctions(template)
-const compiledTemplateVideoPreview = compileToFunctions(templateVideoPreview)
export default class Embed extends Node {
get name() {
- return 'embed'
+ return 'embedUrl'
}
get defaultOptions() {
@@ -120,10 +91,6 @@ export default class Embed extends Node {
embedData: {},
showEmbed: true,
showOverlay: false,
- embedcode: null,
- isOpen: false,
- showchangeEmbedStatus: false,
- // allowEmbedIframes: this.currentUser.allowEmbedIframes
}),
async created() {
if (!this.options) return {}
@@ -134,9 +101,6 @@ export default class Embed extends Node {
...mapGetters({
currentUser: 'auth/user',
}),
- embedClass() {
- return this.embedHtml ? 'embed' : ''
- },
embedHtml() {
const { html = '' } = this.embedData
return html
@@ -176,32 +140,26 @@ export default class Embed extends Node {
...mapMutations({
setCurrentUser: 'auth/SET_USER',
}),
- clickPreview: function(xx, html) {
+ clickPreview() {
this.showOverlay = true
},
- allowEmbedTemporar: function(xx, html) {
+ allowEmbedTemporar(xx) {
if (xx === 'openIframe') {
- this.embedcode = html
this.showEmbed = true
+ this.showOverlay = false
} else {
- this.embedcode = null
this.showEmbed = false
+ this.showOverlay = true
+ }
+ },
+ check(e) {
+ if (e.target.checked) {
+ this.submit(true)
+ } else {
+ this.submit(false)
}
this.showOverlay = false
},
- modalOpen: function() {
- this.showOverlay = false
- this.showchangeEmbedStatus = true
- },
- setConfirm: function() {
- this.submit(true)
- this.showOverlay = false
- this.showchangeEmbedStatus = false
- },
- setCancel: function() {
- this.submit(false)
- this.showchangeEmbedStatus = false
- },
async submit(allowEmbedIframes) {
try {
await this.$apollo.mutate({
@@ -226,9 +184,7 @@ export default class Embed extends Node {
},
},
render(createElement) {
- if (this.embedHtml !== '')
- return compiledTemplateVideoPreview.render.call(this, createElement)
- if (this.embedHtml === '') return compiledTemplate.render.call(this, createElement)
+ return compiledTemplate.render.call(this, createElement)
},
}
}
diff --git a/webapp/components/Editor/plugins/eventHandler.js b/webapp/components/Editor/plugins/eventHandler.js
index c390a066d..807949aa8 100644
--- a/webapp/components/Editor/plugins/eventHandler.js
+++ b/webapp/components/Editor/plugins/eventHandler.js
@@ -10,7 +10,6 @@ export default class EventHandler extends Extension {
new Plugin({
props: {
transformPastedText(text) {
- // console.log('#### transformPastedText', text)
return text.trim()
},
transformPastedHTML(html) {
@@ -33,7 +32,6 @@ export default class EventHandler extends Extension {
.replace(/(\s*
\s*)+/gim, '
')
// remove additional linebreaks when last child inside p tags
.replace(/(\s*
\s*)+<\/p>/gim, '
')
- // console.log('#### transformPastedHTML', html)
return html
},
// transformPasted(slice) {
diff --git a/webapp/package.json b/webapp/package.json
index 656d94e80..6195654c3 100644
--- a/webapp/package.json
+++ b/webapp/package.json
@@ -129,4 +129,4 @@
"vue-svg-loader": "~0.12.0",
"vue-template-compiler": "^2.6.10"
}
-}
+}
\ No newline at end of file