Tiptap: Auto focus not working properly, focuses to starting of the content

Created on 6 Jun 2019  Â·  8Comments  Â·  Source: ueberdosis/tiptap

Autofocus not working properly. it autofocuses the cursor to the starting of the content.
is there a way to set the cursor position to end of the content?
please watch the gif for better understanding

Minimal code

      const initialContent = `<p>Hi rameez,</p><p>second line</p>`
      this.editor = new Editor({
        content: initialContent,
        autoFocus: true,
        extensions: [
          new Blockquote(),
          new BulletList(),
          new CodeBlock(),
          new HardBreak(),
          new Heading({ levels: [1, 2] }),
          new ListItem(),
          new OrderedList(),
          new TodoItem(),
          new TodoList(),
          new Bold(),
          new Code(),
          new Italic(),
          new Link(),
          new Strike(),
          new Underline(),
          new History(),
          new Placeholder({
            emptyClass: 'is-empty',
            emptyNodeText: 'Write something…',
            showOnlyWhenEditable: true
          })
        ]
      })

issue-tiptap

bug

All 8 comments

Ah, good point! For now you can use editor.focus('end'). But it would make sense to allow this option for autofocus too.

tried using

this.editor.focus('end')

after the plugin inited but same behaviour. ie focusing on start.

working with "tiptap": "^1.14.0",

In the lastest release you can set autofocus: 'end'.

I tried updating to "tiptap": "^1.22.2" now my vue-nuxt-app crashes, no matter I set autofocus or not.

For the moment I have reverted my version back to "tiptap": "^1.14.0" and all are back to normal(autofocus missing).

I have added screencast below

tiptap

@rameezcubet see #305

Got it.. it's working now.

Step 1

    "tiptap": "^1.22.2",
    "tiptap-extensions": "^1.22.2",

Step 2

and removed package-lock.json file and node_modules folder

Step 3

npm install

Does autofocus take a 'start' option? I checked the docs but couldn't find any reference to the string arguments.

I'm running into a scenario where, when an editor loads with a partial mention at the end, the search popup is triggered automatically because of the cursor focus event.

image

@jeremyphillipsfti this forked project of tip-tap seems to be a better version https://www.npmjs.com/package/tiptap-vuetify . it works in rapo with vuetify but you can style it for your needs without using vuetify. it also has v-model support by default.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ageeye-cn picture ageeye-cn  Â·  3Comments

unikitty37 picture unikitty37  Â·  3Comments

bernhardh picture bernhardh  Â·  3Comments

afwn90cj93201nixr2e1re picture afwn90cj93201nixr2e1re  Â·  3Comments

glavdir picture glavdir  Â·  3Comments