rename some commands

This commit is contained in:
Philipp Kühn
2020-11-18 16:59:58 +01:00
parent 91297d29fb
commit 1b45acd5d5
10 changed files with 35 additions and 35 deletions

View File

@@ -1,9 +1,9 @@
<template>
<div v-if="editor">
<button @click="addLink" :class="{ 'is-active': editor.isActive('link') }">
<button @click="setLink" :class="{ 'is-active': editor.isActive('link') }">
link
</button>
<button @click="editor.chain().focus().removeLink().run()" v-if="editor.isActive('link')">
<button @click="editor.chain().focus().unsetLink().run()" v-if="editor.isActive('link')">
remove
</button>
<editor-content :editor="editor" />
@@ -52,10 +52,10 @@ export default {
},
methods: {
addLink() {
setLink() {
const url = window.prompt('URL')
this.editor.chain().focus().addLink({ href: url }).run()
this.editor.chain().focus().setLink({ href: url }).run()
},
},

View File

@@ -1,9 +1,9 @@
<template>
<div v-if="editor">
<button @click="addLink" :class="{ 'is-active': editor.isActive('link') }">
<button @click="setLink" :class="{ 'is-active': editor.isActive('link') }">
link
</button>
<button @click="editor.chain().focus().removeLink().run()" v-if="editor.isActive('link')">
<button @click="editor.chain().focus().unsetLink().run()" v-if="editor.isActive('link')">
remove
</button>
<editor-content :editor="editor" />
@@ -49,10 +49,10 @@ export default {
},
methods: {
addLink() {
setLink() {
const url = window.prompt('URL')
this.editor.chain().focus().addLink({ href: url }).run()
this.editor.chain().focus().setLink({ href: url }).run()
},
},

View File

@@ -9,7 +9,7 @@ The editor provides a ton of commands to programmtically add or change content o
All available commands are accessible through an editor instance. Lets say you want to make text bold when a user clicks on a button. Thats how that would look like:
```js
editor.commands.addBold()
editor.commands.setBold()
```
While thats perfectly fine and does make the selected bold, youd likely want to change multiple commands in one run. Lets have a look at how that works.