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

[Bug] Async onPaste handlers not recognized #1803

Closed
polyrainbow opened this issue Nov 1, 2021 · 0 comments · Fixed by #1857
Closed

[Bug] Async onPaste handlers not recognized #1803

polyrainbow opened this issue Nov 1, 2021 · 0 comments · Fixed by #1857
Labels

Comments

@polyrainbow
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant