Skip to content

[Bug] Async onPaste handlers not recognized #1803

@polyrainbow

Description

@polyrainbow

When using an async function as an onPaste handler in a tool, the tool's pasteConfig is not recognized by editor.js. The problem is this check here. The function isFunction returns false for async functions. And this is because the function typeof returns the string asyncfunction instead of function. In my opinion, the implementation of isFunction is wrong. It should return true for async functions, because async functions are functions, too.

Steps to reproduce:

  1. Import a tool whose onPaste handler is an async function
  2. Paste something that matches the tool's pasteConfig

Behavior: The pasted content is pasted inside a new default block.

Expected behavior: The pasted content should be pasted inside a new block of the imported tool.

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