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

[SuperEditor] - Create a request for typing text #2451

Open
matthew-carroll opened this issue Dec 10, 2024 · 0 comments
Open

[SuperEditor] - Create a request for typing text #2451

matthew-carroll opened this issue Dec 10, 2024 · 0 comments
Labels
area_supereditor Pertains to SuperEditor bounty_junior lead Waiting for attention from the Lead time:2

Comments

@matthew-carroll
Copy link
Contributor

Typing text involves (maybe) deleting an expanded selection, inserting the text, and then updating the selection position.

Create a request that does all of these things.

Example of what is currently required to do this:

  editor.execute([
      if (!selection.isCollapsed) //
        DeleteContentRequest(
          documentRange: selection.normalize(widget.editor.context.document),
        ),
      InsertAttributedTextRequest(
        selection.base,
        text,
      ),
      ChangeSelectionRequest(
        DocumentSelection.collapsed(
          position: selection.base.copyWith(
            nodePosition: TextNodePosition(offset: (selection.base.nodePosition as TextNodePosition).offset + 1),
          ),
        ),
        SelectionChangeType.alteredContent,
        SelectionReason.userInteraction,
      ),
    ]);
  }
@matthew-carroll matthew-carroll added the lead Waiting for attention from the Lead label Jan 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area_supereditor Pertains to SuperEditor bounty_junior lead Waiting for attention from the Lead time:2
Projects
None yet
Development

No branches or pull requests

1 participant