Want to have the Post editor remembering the last editing position

As you probably know the WordPress theme editor remembers its last editing position, but I want my post editor to do the same (it jumps to the top if you save a post/page)…. Any tips/hacks how to resolve this ? Help with this is very much appreciated !!

Related posts

Leave a Reply

1 comment

  1. Are you referring to the Visual or the HTML editor or both?

    According to jQuery Set Cursor Position in Text Area it is possible to set the cursor position for a textarea element. That is good news, as AFAIK the WordPress HTML editor is using a textarea element.

    The WordPress Visual editor in difference is based on TinyMCE. TinyMCE does not support a cursor position natively (I assume this only, and it’s only backed this up by a first, quick googling ). So this is not possible out of the box.

    But there are some resources that offer a method of how to do that with TinyMCE.

    I think you could add a javascript that does the following:

    1. On loading of the post editor, check if a cookie exists for the postId.
    2. If so, set the cursor position. If not, do nothing.
    3. Then set a flag that cursor capturing is enabled.
    4. While cursor capturing is enabled, On each keypress set a cookie for the postId and the cursor position.

    Done.

    See also: