Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Preserve cursor position in editors #3485

Closed
wants to merge 12 commits into from

Commits on May 18, 2024

  1. Create setter and getter methods for cursor position

    Setter takes a 'view', grabs the current cursor position, and dumps it into localStorage with a related key.
    
    Getter takes a 'view', loads the related localStorage key, and *if* an editor instance is focused, sets the cursor position in it.  The CM instance must have focus on it already-- related code is in next commit.
    Gazook89 committed May 18, 2024
    Configuration menu
    Copy the full SHA
    5053e64 View commit details
    Browse the repository at this point in the history
  2. add getter & setters into lifecycle

    When the component is mounted, it focuses the editor and the getter method to set the cursor.  It checks for a CM instance first, to avoid issues with properties editor.
    
    When component is unmounted, it saves the cursor position.
    Gazook89 committed May 18, 2024
    Configuration menu
    Copy the full SHA
    78cde85 View commit details
    Browse the repository at this point in the history
  3. set and get cursor position on view change

    When the view/editor changes (text to style etc), the current view cursor is saved, and the new view cursor is loaded.
    Gazook89 committed May 18, 2024
    Configuration menu
    Copy the full SHA
    a3f5a09 View commit details
    Browse the repository at this point in the history

Commits on May 19, 2024

  1. Configuration menu
    Copy the full SHA
    b743a54 View commit details
    Browse the repository at this point in the history

Commits on May 20, 2024

  1. Configuration menu
    Copy the full SHA
    c9b8ac2 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    b0a3584 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    3ad1193 View commit details
    Browse the repository at this point in the history

Commits on Sep 2, 2024

  1. setCursor beforeunload to save pos before leaving

    Add a 'beforeunload' event listener to watch for the user leaving the page so that the cursor position can be saved between page reloads.  For reliability, the setStoredCursorPosition method now returns null, which when run through the beforeunload listener triggers it, without opening a window prompt.
    Gazook89 committed Sep 2, 2024
    Configuration menu
    Copy the full SHA
    3232db6 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    4ecc587 View commit details
    Browse the repository at this point in the history
  3. update refs to modern refs

    Just updating the old ref syntax to thew newer createRef syntax.
    Gazook89 committed Sep 2, 2024
    Configuration menu
    Copy the full SHA
    a34e743 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    0c609c0 View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    38b711c View commit details
    Browse the repository at this point in the history