docs: add figure button

This commit is contained in:
Philipp Kühn
2021-06-03 15:10:27 +02:00
parent 6be2c38692
commit d21d556150
2 changed files with 42 additions and 6 deletions

View File

@@ -1,5 +1,8 @@
<template>
<div v-if="editor">
<button @click="addFigure">
figure
</button>
<editor-content :editor="editor" />
<h2>HTML</h2>
@@ -23,6 +26,21 @@ export default {
}
},
methods: {
addFigure() {
const url = window.prompt('URL')
const caption = window.prompt('caption')
if (url) {
this.editor
.chain()
.focus()
.setFigure({ src: url, caption })
.run()
}
},
},
mounted() {
this.editor = new Editor({
extensions: [