Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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 !!

share|improve this question
add comment

1 Answer

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:

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.