diff --git a/docs/src/demos/Examples/Focus/index.spec.js b/docs/src/demos/Examples/Focus/index.spec.js index f36629de..029eb69e 100644 --- a/docs/src/demos/Examples/Focus/index.spec.js +++ b/docs/src/demos/Examples/Focus/index.spec.js @@ -4,10 +4,6 @@ context('/examples/focus', () => { }) it('should have class', () => { - cy.get('.ProseMirror').then(([{ editor }]) => { - editor.focus('start') - - cy.get('.ProseMirror p:first').should('have.class', 'has-focus') - }) + cy.get('.ProseMirror p:first').should('have.class', 'has-focus') }) }) diff --git a/docs/src/demos/Examples/Focus/index.vue b/docs/src/demos/Examples/Focus/index.vue index 063f9212..033c14da 100644 --- a/docs/src/demos/Examples/Focus/index.vue +++ b/docs/src/demos/Examples/Focus/index.vue @@ -1,5 +1,5 @@ diff --git a/docs/src/links.yaml b/docs/src/links.yaml index 94e80146..fb415661 100644 --- a/docs/src/links.yaml +++ b/docs/src/links.yaml @@ -56,8 +56,8 @@ # - title: Placeholder # link: /examples/placeholder # draft: true - # - title: Focus - # link: /examples/focus + - title: Focus + link: /examples/focus # - title: Title # link: /examples/title # draft: true diff --git a/packages/core/src/Editor.ts b/packages/core/src/Editor.ts index 2be9f517..f935946e 100644 --- a/packages/core/src/Editor.ts +++ b/packages/core/src/Editor.ts @@ -122,7 +122,7 @@ export class Editor extends EventEmitter { this.registerCommands(coreCommands) this.injectCSS() - this.proxy.focus(this.options.autoFocus) + window.setTimeout(() => this.proxy.focus(this.options.autoFocus), 0) } /**