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
{{ message }}
Repository navigation
What's the correct way to either adjust ElementNode type to Element or allow isInline to check ElementNode?
#5547
it('should run an extensions inline check',()=>{// eslint-disable-next-line unicorn/consistent-function-scopingconstgetExtensions: GetExtensions=()=>{return[{id: 'inline-test',// We are testing something we know is not normally "inline" to verify functionality.isInline: isDividerNode,},];};consteditor=jsxElementToEditor(<editorwithPlugins={[withInlineVoid(getExtensions)]}><h:paragraph><h:text/></h:paragraph></editor>,);constresult=Editor.isInline(editor,<h:divider/>);expect(result).toBe(true);});
I am getting an error that isInline is expecting ElementNode:
However, my plugin is extending the isInline check.
import{typeExtensionPlugin}from'../types.js';/** * Handles getting all the extensions with `isInline` and/or `isVoid` function * configurations and adds them to the editor. */exportconstwithInlineVoid: ExtensionPlugin=(getExtensions)=>{return(editor)=>{const{ isInline, isVoid }=editor;constextensions=getExtensions();editor.isInline=(element)=>{for(constextensionofextensions){if(extension.isInline?.(element)){returntrue;}}returnisInline(element);};editor.isVoid=(element)=>{for(constextensionofextensions){if(extension.isVoid?.(element)){returntrue;}}returnisVoid(element);};returneditor;};};
It seems like I either need to type cast ElementNode to Element or add interface that extends isInine – although I am not clear if this is what I should be doing this or why it broke between versions 0.88.0 and 0.90.0.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
I have a test as such:
I am getting an error that
isInlineis expectingElementNode:However, my plugin is extending the
isInlinecheck.It seems like I either need to type cast
ElementNodetoElementor add interface that extendsisInine– although I am not clear if this is what I should be doing this or why it broke between versions0.88.0and0.90.0.All reactions