diff --git a/docs/src/demos/Examples/ExportHtmlOrJson/index.vue b/docs/src/demos/Examples/ExportHtmlOrJson/index.vue index 98cbe592..d5a53f87 100644 --- a/docs/src/demos/Examples/ExportHtmlOrJson/index.vue +++ b/docs/src/demos/Examples/ExportHtmlOrJson/index.vue @@ -69,7 +69,7 @@ export default { methods: { setContent() { // You can pass a JSON document … - this.editor.setContent({ + this.editor.commands.setContent({ type: 'document', content: [{ type: 'paragraph', @@ -86,12 +86,15 @@ export default { // this.editor.setContent('
This is some inserted text. đź‘‹
') // It’s likely that you’d like to focus the Editor after most commands. - this.editor.focus() + this.editor.commands.focus() }, clearContent() { - this.editor.clearContent(true) - this.editor.focus() + this.editor + .chain() + .clearContent(true) + .focus() + .run() }, }, diff --git a/docs/src/docPages/api/commands.md b/docs/src/docPages/api/commands.md index 49787cec..703cae7a 100644 --- a/docs/src/docPages/api/commands.md +++ b/docs/src/docPages/api/commands.md @@ -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.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. diff --git a/docs/src/docPages/api/keyboard-shortcuts.md b/docs/src/docPages/api/keyboard-shortcuts.md index 923e509c..5f009cc7 100644 --- a/docs/src/docPages/api/keyboard-shortcuts.md +++ b/docs/src/docPages/api/keyboard-shortcuts.md @@ -104,7 +104,7 @@ const CustomBulletList = BulletList.extend({ addKeyboardShortcuts() { return { // ↓ your new keyboard shortcut - 'Mod-l': () => this.editor.bulletList(), + 'Mod-l': () => this.editor.commands.bulletList(), } }, }) diff --git a/docs/src/docPages/guide/build-custom-extensions.md b/docs/src/docPages/guide/build-custom-extensions.md index 0699265e..d5a371d1 100644 --- a/docs/src/docPages/guide/build-custom-extensions.md +++ b/docs/src/docPages/guide/build-custom-extensions.md @@ -25,7 +25,7 @@ import BulletList from '@tiptap/extension-bullet-list' const CustomBulletList = BulletList.extend({ addKeyboardShortcuts() { 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({ addKeyboardShortcuts() { return { - 'Mod-l': () => this.editor.bulletList(), + 'Mod-l': () => this.editor.commands.bulletList(), } }, }) diff --git a/docs/src/docPages/guide/store-content.md b/docs/src/docPages/guide/store-content.md index 784ae3a5..1f34ff27 100644 --- a/docs/src/docPages/guide/store-content.md +++ b/docs/src/docPages/guide/store-content.md @@ -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: ```js -editor.setContent(`Example Text
`) +editor.commands.setContent(`Example Text
`) ``` ## Not an option: Markdown