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
// URL of the route to show on initial load of the preview frames.
54
55
previewURL: string;
55
56
};
@@ -82,14 +83,16 @@ class EditorPage extends React.Component<Props, State> {
82
83
super(props);
83
84
84
85
this.state={
85
-
// @ts-expect-error - TS2322 - Type 'Pick<Readonly<Props> & Readonly<{ children?: ReactNode; }>, "hints" | "question" | "answerArea" | "itemDataVersion">' is not assignable to type 'PerseusJson'.
86
-
json: _.pick(
87
-
this.props,
88
-
"question",
89
-
"answerArea",
90
-
"hints",
91
-
"itemDataVersion",
92
-
),
86
+
json: {
87
+
question: this.props.question,
88
+
answerArea: this.props.answerArea,
89
+
hints: this.props.hints,
90
+
itemDataVersion: this.props.itemDataVersion,
91
+
92
+
// Deprecated keys
93
+
_multi: null,
94
+
answer: null,
95
+
},
93
96
gradeMessage: "",
94
97
wasAnswered: false,
95
98
highlightLint: true,
@@ -102,21 +105,6 @@ class EditorPage extends React.Component<Props, State> {
102
105
// TODO(scottgrant): This is a hack to remove the deprecated call to
103
106
// this.isMounted() but is still considered an anti-pattern.
104
107
this._isMounted=true;
105
-
106
-
this.updateRenderer();
107
-
}
108
-
109
-
componentDidUpdate(){
110
-
// NOTE: It is required to delay the preview update until after the
111
-
// current frame, to allow for ItemEditor to render its widgets.
112
-
// This then enables to serialize the widgets properties correctly,
113
-
// in order to send data to the preview iframe (IframeContentRenderer).
114
-
// Otherwise, widgets will render in an "empty" state in the preview.
115
-
// TODO(jeff, CP-3128): Use Wonder Blocks Timing API
116
-
// eslint-disable-next-line no-restricted-syntax
117
-
setTimeout(()=>{
118
-
this.updateRenderer();
119
-
});
120
108
}
121
109
122
110
componentWillUnmount(){
@@ -136,50 +124,6 @@ class EditorPage extends React.Component<Props, State> {
136
124
);
137
125
};
138
126
139
-
updateRenderer(){
140
-
// Some widgets (namely the image widget) like to call onChange before
141
-
// anything has actually been mounted, which causes problems here. We
@@ -262,12 +233,9 @@ class CombinedHintEditor extends React.Component<CombinedHintEditorProps> {
262
233
deviceType={this.props.deviceType}
263
234
nochrome={true}
264
235
>
265
-
<IframeContentRenderer
266
-
ref={this.frame}
267
-
datasetKey="mobile"
268
-
datasetValue={isMobile}
269
-
seamless={true}
270
-
url={this.props.previewURL}
236
+
<ContentRenderer
237
+
question={this.props.hint}
238
+
apiOptions={{isMobile}}
271
239
/>
272
240
</DeviceFramer>
273
241
</div>
@@ -409,7 +377,7 @@ class CombinedHintsEditor extends React.Component<CombinedHintsEditorProps> {
409
377
const{itemId, hints}=this.props;
410
378
consthintElems=_.map(
411
379
hints,
412
-
function(hint,i){
380
+
(hint,i)=>{
413
381
return(
414
382
<CombinedHintEditor
415
383
ref={"hintEditor"+i}
@@ -419,24 +387,16 @@ class CombinedHintsEditor extends React.Component<CombinedHintsEditorProps> {
419
387
itemId={itemId}
420
388
hint={hint}
421
389
pos={i}
422
-
// @ts-expect-error - TS2683 - 'this' implicitly has type 'any' because it does not have a type annotation.
423
390
imageUploader={this.props.imageUploader}
424
391
// eslint-disable-next-line react/jsx-no-bind
425
-
// @ts-expect-error - TS2683 - 'this' implicitly has type 'any' because it does not have a type annotation. | TS2683 - 'this' implicitly has type 'any' because it does not have a type annotation.
426
392
onChange={this.handleHintChange.bind(this,i)}
427
393
// eslint-disable-next-line react/jsx-no-bind
428
-
// @ts-expect-error - TS2683 - 'this' implicitly has type 'any' because it does not have a type annotation. | TS2683 - 'this' implicitly has type 'any' because it does not have a type annotation.
429
394
onRemove={this.handleHintRemove.bind(this,i)}
430
395
// eslint-disable-next-line react/jsx-no-bind
431
-
// @ts-expect-error - TS2683 - 'this' implicitly has type 'any' because it does not have a type annotation. | TS2683 - 'this' implicitly has type 'any' because it does not have a type annotation.
432
396
onMove={this.handleHintMove.bind(this,i)}
433
-
// @ts-expect-error - TS2683 - 'this' implicitly has type 'any' because it does not have a type annotation.
434
397
deviceType={this.props.deviceType}
435
-
// @ts-expect-error - TS2683 - 'this' implicitly has type 'any' because it does not have a type annotation.
436
398
apiOptions={this.props.apiOptions}
437
-
// @ts-expect-error - TS2683 - 'this' implicitly has type 'any' because it does not have a type annotation.
438
399
highlightLint={this.props.highlightLint}
439
-
// @ts-expect-error - TS2683 - 'this' implicitly has type 'any' because it does not have a type annotation.
0 commit comments