Skip to content

How to Detect Paste and Insert Plain Text in editor? #91

@Olzzonne

Description

@Olzzonne

I'm trying to implement a feature where users can paste content as plain text, effectively stripping any formatting from the pasted content.

My goal is to:

  1. Detect when a paste event occurs within the editor.
  2. Prevent the default paste behavior that includes formatting.
  3. Retrieve the plain text content from the clipboard.
  4. Insert this plain text into the editor at the current selected component.

I've been looking into the paste event and the clipboardData object, specifically the getData('text/plain') method. I've tried but not working.

Could anyone provide guidance or examples on how to properly detect the paste event and insert the plain text content into ?

Any help or pointers in the right direction would be greatly appreciated!

Thank you.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions