@@ -6,7 +6,22 @@ import { isFunction, isTextareaOrInput, mergePlugins, uuid, configHandlers, isBe
6
6
import { EditorPropTypes , IEditorPropTypes } from './EditorPropTypes' ;
7
7
import { Bookmark , Editor as TinyMCEEditor , EditorEvent , TinyMCE } from 'tinymce' ;
8
8
9
- type EditorOptions = Parameters < TinyMCE [ 'init' ] > [ 0 ] ;
9
+ type OmitStringIndexSignature < T > = { [ K in keyof T as string extends K ? never : K ] : T [ K ] } ;
10
+
11
+ interface DoNotUse < T extends string > {
12
+ __brand : T ;
13
+ }
14
+
15
+ type OmittedInitProps = 'selector' | 'target' | 'readonly' | 'license_key' ;
16
+
17
+ export type EditorOptions = Parameters < TinyMCE [ 'init' ] > [ 0 ] ;
18
+
19
+ export type InitOptions = Omit < OmitStringIndexSignature < EditorOptions > , OmittedInitProps > & {
20
+ selector ?: DoNotUse < 'selector prop is handled internally by the component' > ;
21
+ target ?: DoNotUse < 'target prop is handled internally by the component' > ;
22
+ readonly ?: DoNotUse < 'readonly prop is overridden by the component, use the `disabled` prop instead' > ;
23
+ license_key ?: DoNotUse < 'license_key prop is overridden by the integration, use the `licenseKey` prop instead' > ;
24
+ } ;
10
25
11
26
export type Version = `${'4' | '5' | '6' | '7' } ${'' | '-dev' | '-testing' | `.${number } ` | `.${number } .${number } `} `;
12
27
@@ -17,7 +32,7 @@ export interface IProps {
17
32
initialValue : string ;
18
33
onEditorChange : ( a : string , editor : TinyMCEEditor ) => void ;
19
34
value : string ;
20
- init : EditorOptions & Partial < Record < 'selector' | 'target' | 'readonly' | 'license_key' , undefined > > ;
35
+ init : InitOptions ;
21
36
tagName : string ;
22
37
tabIndex : number ;
23
38
cloudChannel : Version ;
@@ -348,7 +363,7 @@ export class Editor extends React.Component<IAllProps> {
348
363
}
349
364
350
365
const finalInit : EditorOptions = {
351
- ...this . props . init ,
366
+ ...this . props . init as Omit < InitOptions , OmittedInitProps > ,
352
367
selector : undefined ,
353
368
target,
354
369
readonly : this . props . disabled ,
0 commit comments