update doc pages
This commit is contained in:
@@ -69,7 +69,7 @@ export default {
|
|||||||
methods: {
|
methods: {
|
||||||
setContent() {
|
setContent() {
|
||||||
// You can pass a JSON document …
|
// You can pass a JSON document …
|
||||||
this.editor.setContent({
|
this.editor.commands.setContent({
|
||||||
type: 'document',
|
type: 'document',
|
||||||
content: [{
|
content: [{
|
||||||
type: 'paragraph',
|
type: 'paragraph',
|
||||||
@@ -86,12 +86,15 @@ export default {
|
|||||||
// this.editor.setContent('<p>This is some inserted text. 👋</p>')
|
// this.editor.setContent('<p>This is some inserted text. 👋</p>')
|
||||||
|
|
||||||
// It’s likely that you’d like to focus the Editor after most commands.
|
// It’s likely that you’d like to focus the Editor after most commands.
|
||||||
this.editor.focus()
|
this.editor.commands.focus()
|
||||||
},
|
},
|
||||||
|
|
||||||
clearContent() {
|
clearContent() {
|
||||||
this.editor.clearContent(true)
|
this.editor
|
||||||
this.editor.focus()
|
.chain()
|
||||||
|
.clearContent(true)
|
||||||
|
.focus()
|
||||||
|
.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:
|
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
|
```js
|
||||||
editor.bold()
|
editor.commands.bold()
|
||||||
```
|
```
|
||||||
|
|
||||||
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.
|
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.
|
||||||
|
|||||||
@@ -104,7 +104,7 @@ const CustomBulletList = BulletList.extend({
|
|||||||
addKeyboardShortcuts() {
|
addKeyboardShortcuts() {
|
||||||
return {
|
return {
|
||||||
// ↓ your new keyboard shortcut
|
// ↓ your new keyboard shortcut
|
||||||
'Mod-l': () => this.editor.bulletList(),
|
'Mod-l': () => this.editor.commands.bulletList(),
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ import BulletList from '@tiptap/extension-bullet-list'
|
|||||||
const CustomBulletList = BulletList.extend({
|
const CustomBulletList = BulletList.extend({
|
||||||
addKeyboardShortcuts() {
|
addKeyboardShortcuts() {
|
||||||
return {
|
return {
|
||||||
'Mod-l': () => this.editor.bulletList(),
|
'Mod-l': () => this.editor.commands.bulletList(),
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
@@ -292,7 +292,7 @@ import BulletList from '@tiptap/extension-bullet-list'
|
|||||||
const CustomBulletList = BulletList.extend({
|
const CustomBulletList = BulletList.extend({
|
||||||
addKeyboardShortcuts() {
|
addKeyboardShortcuts() {
|
||||||
return {
|
return {
|
||||||
'Mod-l': () => this.editor.bulletList(),
|
'Mod-l': () => this.editor.commands.bulletList(),
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -73,7 +73,7 @@ new Editor({
|
|||||||
|
|
||||||
Or if you want to restore the content later (e. g. after an API call has finished), you can do that too:
|
Or if you want to restore the content later (e. g. after an API call has finished), you can do that too:
|
||||||
```js
|
```js
|
||||||
editor.setContent(`<p>Example Text</p>`)
|
editor.commands.setContent(`<p>Example Text</p>`)
|
||||||
```
|
```
|
||||||
|
|
||||||
## Not an option: Markdown
|
## Not an option: Markdown
|
||||||
|
|||||||
Reference in New Issue
Block a user