Skip to content

Updating content externally causes cursor to jump to beginning #321

Closed as not planned

Description

@andyrue

What is the current behavior?

I'm updating an editor linked to a formControl through external means, and the cursor jumps to the beginning when an update is triggered. I don't experience this behavior using something like a basic textarea, or other directives like an Angular Material matInput on a textarea.

Please provide the steps to reproduce and if possible a minimal demo of the problem via [codesandbox.io]

This example shows the problem. I understand the example is unorthodox, but in my case patchValue is being triggered from a websocket, so it makes more sense.
https://codesandbox.io/s/tinymce-angular-forked-sdwgoj

What is the expected behavior?

The cursor should stay where it was.

Which versions of TinyMCE/TinyMCE-Angular, and which browser / OS are affected by this issue? Did this work in previous versions of TinyMCE or TinyMCE-Angular?

Seems to affect all browsers.
tinymce-angular@7.0.0
tinymce@6.2.0

Activity

  1. exalate-issue-sync commented on Oct 20, 2022

    @exalate-issue-sync

    Ref: INT-3036

  2. jscasca commented on Oct 21, 2022

    @jscasca
    Contributor

    The problem with situations like this is that completely different content might be coming from the pipeline and it is wild to magically place the caret where a user think it should be. So, of course every time the content changes is a clear slate and start from the beginning. At best, the component could do a best effort to place it in the same position if the content has not changed at all.

  3. andyrue commented on Oct 21, 2022

    @andyrue
    Author

    Thanks for looking. That does make sense, but how come something like a textarea works as expected? This example has both.
    https://codesandbox.io/s/tinymce-angular-forked-96s50w

  4. ferlimputra commented on Jun 30, 2023

    @ferlimputra

    I have the same issue.

    In my case it's because I have an autosave mechanism that saves every x seconds. The saving is done in the server and the saved content is sent back to the formControl which resets the cursor everytime.

    I was upgrading from a simple textarea to tinymce and this is the main reason that I can't continue working on the tinymce integration. Would be nice to have a solution or workaround for this.

  5. davidediak commented on Feb 7, 2024

    @davidediak

    This bug is annoying also me: opened a PR.

  6. tiny-stale-bot commented on Jul 9, 2024

    @tiny-stale-bot

    This issue is stale because it has been open 30 days with no activity. Please comment if you wish to keep this issue open or it will be closed in 7 days.

  7. removed
    status:staleAn issue that has been left with no response for an extended period of time.
    on Jul 10, 2024
  8. tiny-stale-bot commented on Aug 9, 2024

    @tiny-stale-bot

    This issue is stale because it has been open 30 days with no activity. Please comment if you wish to keep this issue open or it will be closed in 7 days.

  9. tiny-stale-bot commented on Aug 16, 2024

    @tiny-stale-bot

    This issue was closed because it has been stalled for 7 days with no activity.

  10. ZeroRex0126 commented on Aug 27, 2025

    @ZeroRex0126

    Can we please revisit this issue, as it gets annoying when used with DynamicFormControlComponent. It looks like TinyMCE already handles the update of the values, so there is a line of code that actually causes this issue, and it's not needed. I will be creating a pull request

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions