Source

externalCode/QuestionApiHooks.js

import * as React from "react";

/**
 * @typedef {Function} OverrideQuestionImageSizeCallback
 * @param {isPopup} Boolean Returns `true` if component is intended to be displayed in a modal
 * @param {value} Number Current image max width
 * @returns {number}
 */

/**
 * @class
 * Question Screen Hooks.
 * Instance name: questionApiHooks
  
   If you have courses in your app, you can use this hook to customize the way the questions are displayed. For example, you can change the image width in LearnDash questions and more.
 * @example
 * externalCodeSetup.questionApiHooks.METHOD_NAME
 */
export class QuestionApiHooks {
	// Determine maximum width given to image
	imageSize = (isPopup, value) => value;

	/**
	 * It is used to set the maximum width of images that are displayed in the LearnDash LMS questions.
	 * @method
	 * @param {OverrideQuestionImageSizeCallback} imageSizeFunction
	 * @example
	 * externalCodeSetup.questionApiHooks.setImageSizeForMaxWidth( (isPopup, defaultMaxWidth) => {
	 *  return defaultMaxWidth + 100;
	 * })
	 */
	setImageSizeForMaxWidth = imageSize => {
		this.imageSize = imageSize;
	};
}