Make WordPress Core

Opened 12 years ago

Closed 12 years ago

#29954 closed defect (bug) (fixed)

Improve calculation of the caret position in editor-expand

Reported by: azaozz Owned by: azaozz
Priority: normal Milestone: 4.1
Component: Editor Version: 4.0
Severity: normal Keywords: has-patch needs-testing
Cc: Focuses:

Description

Currently we use node.getBoundingClientRect() to get the approximate position of the caret in TinyMCE. This works well except it gets the position of the parent block. We should use range.getClientRects() when available to get the exact position of the caret.

This will fix scrolling into view when the current block element is taller than the visible part of the editor.

Attachments (2)

29954.patch​ (2.8 KB ) - added by azaozz 12 years ago.
29954.2.patch​ (2.4 KB ) - added by iseulde 12 years ago.

Download all attachments as: .zip

Change History (6)

#1 @azaozz
12 years ago

In 29954.patch:

  • Use range.getClientRects() when available.
  • Keep the caret visible after undo/redo.

#2 @azaozz
12 years ago

  • Keywords has-patch needs-testing added

#3 @iseulde
12 years ago

Fixed the buffer. Looks good to me otherwise. :)

#4 @azaozz
12 years ago

  • Owner set to azaozz
  • Resolution → fixed
  • Status new → closed

In 29929:

Editor-expand:

  • Better calculation for the caret position when auto-scrolling while typing.
  • Fix auto-scrolling for non-WebKit browsers when the caret is above the top of the editor.

Fixes #29954

Note: See TracTickets for help on using tickets.