Skip to content

Commit f35497d

Browse files
authored
INT-3308_2: Put back support for any unknown key to be assigned as an init prop (#532)
* INT-3308_2: Any other string key is typed as any again and don't export EditorOptions * INT-3308_2: Added a test for unknown other `init` props
1 parent d822088 commit f35497d

File tree

2 files changed

+24
-2
lines changed

2 files changed

+24
-2
lines changed

src/main/ts/components/Editor.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,14 @@ interface DoNotUse<T extends string> {
1414

1515
type OmittedInitProps = 'selector' | 'target' | 'readonly' | 'license_key';
1616

17-
export type EditorOptions = Parameters<TinyMCE['init']>[0];
17+
type EditorOptions = Parameters<TinyMCE['init']>[0];
1818

1919
export type InitOptions = Omit<OmitStringIndexSignature<EditorOptions>, OmittedInitProps> & {
2020
selector?: DoNotUse<'selector prop is handled internally by the component'>;
2121
target?: DoNotUse<'target prop is handled internally by the component'>;
2222
readonly?: DoNotUse<'readonly prop is overridden by the component, use the `disabled` prop instead'>;
2323
license_key?: DoNotUse<'license_key prop is overridden by the integration, use the `licenseKey` prop instead'>;
24-
};
24+
} & { [key: string]: unknown };
2525

2626
export type Version = `${'4' | '5' | '6' | '7'}${'' | '-dev' | '-testing' | `.${number}` | `.${number}.${number}`}`;
2727

src/test/ts/browser/EditorInitTest.ts

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,28 @@ describe('EditorInitTest', () => {
8585
}
8686
});
8787
});
88+
89+
it('Assigning other unknown props to the editor is allowed', async () => {
90+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
91+
using _ = await render({
92+
init: {
93+
mergetags_list: [{
94+
title: 'Client',
95+
menu: [
96+
{
97+
value: 'Client.LastCallDate',
98+
title: 'Call date'
99+
},
100+
{
101+
value: 'Client.Name',
102+
title: 'Client name'
103+
}
104+
]
105+
}],
106+
something_else: 'value'
107+
}
108+
});
109+
});
88110
})
89111
);
90112
});

0 commit comments

Comments
 (0)