add content to the link extension page

This commit is contained in:
Hans Pagel
2020-09-25 19:05:21 +02:00
parent c4d9bf9b41
commit 304504da73
6 changed files with 45 additions and 36 deletions

View File

@@ -1,8 +1,11 @@
<template>
<div v-if="editor">
<button @click="addLink">
<button @click="addLink" :class="{ 'is-active': editor.isActive('link') }">
link
</button>
<button @click="editor.chain().focus().removeMark('link').run()" v-if="editor.isActive('link')">
remove
</button>
<editor-content :editor="editor" />
</div>
</template>
@@ -36,7 +39,7 @@ export default {
],
content: `
<p>
Try to add some links to the <a href="https://en.wikipedia.org/wiki/World_Wide_Web">world wide web</a>. By default every link will get a <code>rel="noopener noreferrer nofollow"</code> attribute.
Try to add some links to the <a href="https://en.wikipedia.org/wiki/World_Wide_Web" target="_self">world wide web</a>. By default every link will get a <code>rel="noopener noreferrer nofollow"</code> attribute.
</p>
`,
})
@@ -44,9 +47,9 @@ export default {
methods: {
addLink() {
const url = window.prompt('Link:')
const url = window.prompt('URL')
this.editor.link(url)
this.editor.chain().focus().link({ href: url }).run()
},
},