rename some commands
This commit is contained in:
@@ -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()
|
||||
},
|
||||
},
|
||||
|
||||
|
||||
@@ -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()
|
||||
},
|
||||
},
|
||||
|
||||
|
||||
@@ -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. Let’s say you want to make text bold when a user clicks on a button. That’s how that would look like:
|
||||
|
||||
```js
|
||||
editor.commands.addBold()
|
||||
editor.commands.setBold()
|
||||
```
|
||||
|
||||
While that’s perfectly fine and does make the selected bold, you’d likely want to change multiple commands in one run. Let’s have a look at how that works.
|
||||
|
||||
Reference in New Issue
Block a user