@doenet/doenetml-iframe 0.7.0-alpha27 → 0.7.0-alpha28

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.js CHANGED
@@ -26878,7 +26878,7 @@ const mathjaxConfig = {
26878
26878
  load: ["[tex]/noerrors"]
26879
26879
  }
26880
26880
  };
26881
- const viewerIframeJsSource = '(function() {\n "use strict";\n document.addEventListener("DOMContentLoaded", () => {\n if (typeof window.renderDoenetViewerToContainer !== "function") {\n return messageParentFromViewer({\n error: "Invalid DoenetML version or DoenetML package not found"\n });\n }\n window.renderDoenetViewerToContainer(\n document.getElementById("root"),\n void 0,\n {\n ...doenetViewerProps,\n externalVirtualKeyboardProvided: true,\n // Callbacks have to be explicitly overridden here so that they\n // can message the parent React component (outside the iframe).\n updateCreditAchievedCallback: (args) => {\n messageParentFromViewer({\n callback: "updateCreditAchievedCallback",\n args\n });\n },\n setIsInErrorState: (args) => {\n messageParentFromViewer({\n callback: "setIsInErrorState",\n args\n });\n },\n generatedVariantCallback: (args) => {\n messageParentFromViewer({\n callback: "generatedVariantCallback",\n args\n });\n },\n setErrorsAndWarningsCallback: (args) => {\n messageParentFromViewer({\n callback: "setErrorsAndWarningsCallback",\n args\n });\n }\n }\n );\n });\n window.addEventListener("message", (e) => {\n if (e.data.subject.startsWith("SPLICE") && !e.data.subject.endsWith("response")) {\n window.parent.postMessage(e.data);\n }\n });\n function messageParentFromViewer(data) {\n window.parent.postMessage(\n {\n origin: viewerId,\n data\n },\n window.parent.origin\n );\n }\n})();\n';
26881
+ const viewerIframeJsSource = '(function() {\n "use strict";\n document.addEventListener("DOMContentLoaded", () => {\n if (typeof window.renderDoenetViewerToContainer !== "function") {\n return messageParentFromViewer({\n error: "Invalid DoenetML version or DoenetML package not found"\n });\n }\n window.renderDoenetViewerToContainer(\n document.getElementById("root"),\n void 0,\n {\n ...doenetViewerProps,\n externalVirtualKeyboardProvided: true,\n // Callbacks have to be explicitly overridden here so that they\n // can message the parent React component (outside the iframe).\n updateCreditAchievedCallback: (args) => {\n messageParentFromViewer({\n callback: "updateCreditAchievedCallback",\n args\n });\n },\n setIsInErrorState: (args) => {\n messageParentFromViewer({\n callback: "setIsInErrorState",\n args\n });\n },\n generatedVariantCallback: (args) => {\n messageParentFromViewer({\n callback: "generatedVariantCallback",\n args\n });\n },\n setErrorsAndWarningsCallback: (args) => {\n messageParentFromViewer({\n callback: "setErrorsAndWarningsCallback",\n args\n });\n }\n }\n );\n });\n window.addEventListener("message", (e) => {\n if (e.origin !== window.parent.location.origin) {\n return;\n }\n if (e.data.subject.startsWith("SPLICE") && !e.data.subject.endsWith("response")) {\n window.parent.postMessage(e.data);\n }\n });\n function messageParentFromViewer(data) {\n window.parent.postMessage(\n {\n origin: viewerId,\n data\n },\n window.parent.origin\n );\n }\n})();\n';
26882
26882
  const editorIframeJsSource = '(function() {\n "use strict";\n document.addEventListener("DOMContentLoaded", () => {\n if (typeof window.renderDoenetEditorToContainer !== "function") {\n return messageParentFromEditor({\n error: "Invalid DoenetML version or DoenetML package not found"\n });\n }\n window.renderDoenetEditorToContainer(\n document.getElementById("root"),\n void 0,\n {\n ...doenetEditorProps,\n externalVirtualKeyboardProvided: true,\n // Callbacks have to be explicitly overridden here so that they\n // can message the parent React component (outside the iframe).\n doenetmlChangeCallback: (args) => {\n messageParentFromEditor({\n callback: "doenetmlChangeCallback",\n args\n });\n },\n immediateDoenetmlChangeCallback: (args) => {\n messageParentFromEditor({\n callback: "immediateDoenetmlChangeCallback",\n args\n });\n }\n }\n );\n });\n function messageParentFromEditor(data) {\n window.parent.postMessage(\n {\n origin: editorId,\n data\n },\n window.parent.origin\n );\n }\n})();\n';
26883
26883
  var __defProp$2 = Object.defineProperty;
26884
26884
  var __defNormalProp$2 = (obj, key, value) => key in obj ? __defProp$2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
@@ -49561,7 +49561,7 @@ function ExternalVirtualKeyboard() {
49561
49561
  }
49562
49562
  );
49563
49563
  }
49564
- const version = "0.7.0-alpha27";
49564
+ const version = "0.7.0-alpha28";
49565
49565
  const latestDoenetmlVersion = version;
49566
49566
  function DoenetViewer({
49567
49567
  doenetML,
@@ -49601,11 +49601,14 @@ function DoenetViewer({
49601
49601
  React__default__default.useEffect(() => {
49602
49602
  const listener3 = (event) => {
49603
49603
  var _a, _b, _c, _d, _e2, _f, _g;
49604
+ if (event.origin !== window.location.origin) {
49605
+ return;
49606
+ }
49604
49607
  if (event.data.subject === "SPLICE.getState.response") {
49605
49608
  (_b = (_a = ref.current) == null ? void 0 : _a.contentWindow) == null ? void 0 : _b.postMessage(event.data);
49606
49609
  return;
49607
49610
  }
49608
- if (event.origin !== window.location.origin || ((_c = event.data) == null ? void 0 : _c.origin) !== id2) {
49611
+ if (((_c = event.data) == null ? void 0 : _c.origin) !== id2) {
49609
49612
  return;
49610
49613
  }
49611
49614
  const data = event.data.data;