Skip to content

Commit 6d36958

Browse files
committed
INT-3336: Fix tests failing for TinyMCE 4
1 parent f41769b commit 6d36958

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

src/test/ts/alien/Loader.tsx

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -80,13 +80,19 @@ export const render = async (props: Partial<IAllProps> = {}, container: HTMLElem
8080
/** By rendering the Editor into the same root, React will perform a diff and update. */
8181
reRender: (newProps: IAllProps) => new Promise<void>((resolve) => {
8282
root.render(<div><Editor apiKey='no-api-key' ref={ctx.ref} {...newProps} /></div>);
83-
if ('value' in newProps) {
84-
ctx.editor.once('change', () => {
85-
resolve();
86-
});
87-
} else {
88-
resolve();
83+
84+
if (newProps.disabled) {
85+
if (ctx.editor.editorManager.majorVersion === '4') {
86+
/** This should be `setMode` from TinyMCE v4 but we can't access it here. */
87+
ctx.editor.readonly = true;
88+
} else {
89+
ctx.editor.mode.set('readonly');
90+
}
8991
}
92+
93+
newProps.value
94+
? ctx.editor.once('change', () => resolve())
95+
: resolve();
9096
}),
9197
remove,
9298
[Symbol.dispose]: remove

0 commit comments

Comments
 (0)