Cursor always goes to the start of the live edit area on initialise.

Created on 30 January 2025, 2 months ago

Problem/Motivation

When users click to edit text they are normally clicking at the postion they would like to start making changes, especially on large text blocks. When clicking on a live edit enabled text area the live edit initialises but the cursor is always placed right at the beginning of the text block. If this is a large text block this is quite disorienting for the user.

Steps to reproduce

Add a text block with live edit enabled.
Add a large amount of text to this area.
With the text area not initialised with live edit, click on a section mid way through the text to start editing it.
Note that you are now right at the start of the text block and have to navigate back to the bit you want to make your edits.

Proposed resolution

I presume CKEditor has some way of positioning the cursor. Is there perhaps a way to find where the click occured on initial activation of live edit and send that into the ckeditor initialisation to postion the cursor on load?

✨ Feature request
Status

Active

Version

1.0

Component

Code

Created by

πŸ‡¬πŸ‡§United Kingdom johntarling

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

  • Issue created by @johntarling
  • First commit to issue fork.
  • First commit to issue fork.
  • πŸ‡ΊπŸ‡ΈUnited States pixelwhip

    This solution isn't perfect as the specific character or element that is clicked on may move slightly due to minor style changes between the preview content and content in an active editor, but it does get much closer.

  • πŸ‡ΊπŸ‡ΈUnited States philip_stier Denver, Colorado

    @pixelwhip – Just tested this out and I think it works great! I was even able to directly select embedded elements like images too! Neat!

  • πŸ‡¬πŸ‡§United Kingdom johntarling

    @pixelwhip Thanks for this! The cursor positioning works pretty well but occasionally it is slightly offset which i think is either the padding applied from the mercury editor to the area when editing or perhaps the ckeditor toolbar initialising and taking up some space.

    This is a big improvement overall though, marking as reviewed and tested.

Production build 0.71.5 2024