add read only example

This commit is contained in:
Philipp Kühn
2018-08-22 19:28:57 +02:00
parent c6fb4ce8a3
commit ff8b138a3c
9 changed files with 266 additions and 222 deletions

View File

@@ -41,36 +41,36 @@ import Icon from 'Components/Icon'
import { Editor } from 'tiptap'
export default {
components: {
Editor,
Icon,
components: {
Editor,
Icon,
},
data() {
return {
linkUrl: null,
return {
linkUrl: null,
linkMenuIsActive: false,
}
},
methods: {
showLinkMenu(type) {
this.linkUrl = type.attrs.href
this.linkMenuIsActive = true
this.$nextTick(() => {
this.$refs.linkInput.focus()
})
},
hideLinkMenu() {
this.linkUrl = null
this.linkMenuIsActive = false
},
setLinkUrl(url, type, focus) {
type.command({ href: url })
this.hideLinkMenu()
focus()
},
onUpdate(state) {
// console.log(state.doc.toJSON())
},
},
methods: {
showLinkMenu(type) {
this.linkUrl = type.attrs.href
this.linkMenuIsActive = true
this.$nextTick(() => {
this.$refs.linkInput.focus()
})
},
hideLinkMenu() {
this.linkUrl = null
this.linkMenuIsActive = false
},
setLinkUrl(url, type, focus) {
type.command({ href: url })
this.hideLinkMenu()
focus()
},
onUpdate(state) {
// console.log(state.doc.toJSON())
},
},
}
</script>