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
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
-
I have a test as such:
I am getting an error that
isInline
is expectingElementNode
:However, my plugin is extending the
isInline
check.It seems like I either need to type cast
ElementNode
toElement
or 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.0
and0.90.0
.Beta Was this translation helpful? Give feedback.
All reactions