Skip to content

Commit f44cd8c

Browse files
committed
INT-3336: Fix tests failing for TinyMCE 4
1 parent 9953188 commit f44cd8c

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
@@ -81,13 +81,19 @@ export const render = async (props: Partial<IAllProps> = {}, container: HTMLElem
8181
/** By rendering the Editor into the same root, React will perform a diff and update. */
8282
reRender: (newProps: IAllProps) => new Promise<void>((resolve) => {
8383
root.render(<div><Editor apiKey='no-api-key' ref={ctx.ref} {...newProps} /></div>);
84-
if ('value' in newProps) {
85-
ctx.editor.once('change', () => {
86-
resolve();
87-
});
88-
} else {
89-
resolve();
84+
85+
if (newProps.disabled) {
86+
if (ctx.editor.editorManager.majorVersion === '4') {
87+
/** This should be `setMode` from TinyMCE v4 but we can't access it here. */
88+
ctx.editor.readonly = true;
89+
} else {
90+
ctx.editor.mode.set('readonly');
91+
}
9092
}
93+
94+
newProps.value
95+
? ctx.editor.once('change', () => resolve())
96+
: resolve();
9197
}),
9298
remove,
9399
[Symbol.dispose]: remove

0 commit comments

Comments
 (0)