You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I want to check if the editor should offer to insert a youtube video. For this, I call commands.addYouTubeVideo.isEnabled(). Doing so, throws this errors:
TypeError: Cannot read property 'video' of undefined
at createYouTubeUrl (https://qmuwc.csb.app/node_modules/@remirror/preset-embed/dist/preset-embed.browser.esm.js:162:25)
at IframeExtension.eval [as addYouTubeVideo] (https://qmuwc.csb.app/node_modules/@remirror/preset-embed/dist/preset-embed.browser.esm.js:52:14)
at addYouTubeVideo (https://qmuwc.csb.app/node_modules/@remirror/preset-embed/dist/preset-embed.browser.esm.js:139:42)
at Function.eval [as isEnabled] (https://qmuwc.csb.app/node_modules/@remirror/core/dist/core.browser.esm.js:1406:14)
Interestingly, this issue raises a much-needed enhancement.
The reason this is failing is that the addYoutubeVideo command expected an object with the video property. There are two ways of dealing with this. Either require the same arguments for the isEnabled function as the actual command, or, make sure the function can handle isEnabled without requiring access to the first parameter.
Either way, I'll need to improve the types that are generated.
Summary
I want to check if the editor should offer to insert a youtube video. For this, I call
commands.addYouTubeVideo.isEnabled()
. Doing so, throws this errors:Steps to reproduce
Expected results
isEnabled()
returns boolean.Actual results
Throws error
The text was updated successfully, but these errors were encountered: