diff --git a/docs/installation/php.md b/docs/installation/php.md index 2e373ffaa6f..8c0957055fe 100644 --- a/docs/installation/php.md +++ b/docs/installation/php.md @@ -45,12 +45,13 @@ import { Editor } from '@tiptap/core' import StarterKit from '@tiptap/starter-kit' window.setupEditor = function (content) { + let editor + return { - editor: null, content: content, init(element) { - this.editor = new Editor({ + editor = new Editor({ element: element, extensions: [ StarterKit, @@ -63,7 +64,7 @@ window.setupEditor = function (content) { this.$watch('content', (content) => { // If the new content matches TipTap's then we just skip. - if (content === this.editor.getHTML()) return + if (content === editor.getHTML()) return /* Otherwise, it means that a force external to TipTap @@ -74,7 +75,7 @@ window.setupEditor = function (content) { For more information on the `setContent()` method, see: https://www.tiptap.dev/api/commands/set-content */ - this.editor.commands.setContent(content, false) + editor.commands.setContent(content, false) }) } }