@instructure/quiz-core 17.48.1-rc.4 → 17.48.1-rc.5

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.
@@ -27,6 +27,28 @@ var setTimeoutPromise = function setTimeoutPromise(delay) {
27
27
  });
28
28
  };
29
29
 
30
+ var checkIfThereAreAnyUnrenderedLatexEquations = function checkIfThereAreAnyUnrenderedLatexEquations() {
31
+ return document.querySelectorAll('.equation_image').length === 0;
32
+ };
33
+
34
+ export var ensureAllMathEquationsAreRendered = function ensureAllMathEquationsAreRendered() {
35
+ return new Promise(function (resolve) {
36
+ if (checkIfThereAreAnyUnrenderedLatexEquations()) {
37
+ return resolve();
38
+ }
39
+
40
+ var observer = new MutationObserver(function () {
41
+ if (checkIfThereAreAnyUnrenderedLatexEquations()) {
42
+ resolve();
43
+ observer.disconnect();
44
+ }
45
+ });
46
+ observer.observe(document.body, {
47
+ childList: true,
48
+ subtree: true
49
+ });
50
+ });
51
+ };
30
52
  export var ensureImagesLoaded = function ensureImagesLoaded() {
31
53
  return new Promise(function (resolve) {
32
54
  setTimeoutPromise(0).then(function () {
package/es/index.js CHANGED
@@ -89,7 +89,7 @@ export { formatTime } from "./common/util/formatTimespan.js";
89
89
  export { connect } from "./common/react-redux.js";
90
90
  export { breakdownSeconds, HOUR_IN_SECONDS } from "./common/components/shared/FormattedDuration/index.js";
91
91
  export { sessionStore } from "./common/util/sessionStore.js";
92
- export { printWithCss, ensureImagesLoaded } from "./common/util/printUtils.js";
92
+ export { printWithCss, ensureImagesLoaded, ensureAllMathEquationsAreRendered } from "./common/util/printUtils.js";
93
93
  export { isNewRCEEnabled } from "./common/util/rceChecker.js"; // APIs
94
94
 
95
95
  export { createQuizEntryRegrade } from "./grading/api/quizEntryRegrades.js";
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.ensureImagesLoaded = exports.printWithCss = void 0;
6
+ exports.ensureImagesLoaded = exports.ensureAllMathEquationsAreRendered = exports.printWithCss = void 0;
7
7
 
8
8
  var printWithCss = function printWithCss(cssClass) {
9
9
  var timeout = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 0;
@@ -36,6 +36,31 @@ var setTimeoutPromise = function setTimeoutPromise(delay) {
36
36
  });
37
37
  };
38
38
 
39
+ var checkIfThereAreAnyUnrenderedLatexEquations = function checkIfThereAreAnyUnrenderedLatexEquations() {
40
+ return document.querySelectorAll('.equation_image').length === 0;
41
+ };
42
+
43
+ var ensureAllMathEquationsAreRendered = function ensureAllMathEquationsAreRendered() {
44
+ return new Promise(function (resolve) {
45
+ if (checkIfThereAreAnyUnrenderedLatexEquations()) {
46
+ return resolve();
47
+ }
48
+
49
+ var observer = new MutationObserver(function () {
50
+ if (checkIfThereAreAnyUnrenderedLatexEquations()) {
51
+ resolve();
52
+ observer.disconnect();
53
+ }
54
+ });
55
+ observer.observe(document.body, {
56
+ childList: true,
57
+ subtree: true
58
+ });
59
+ });
60
+ };
61
+
62
+ exports.ensureAllMathEquationsAreRendered = ensureAllMathEquationsAreRendered;
63
+
39
64
  var ensureImagesLoaded = function ensureImagesLoaded() {
40
65
  return new Promise(function (resolve) {
41
66
  setTimeoutPromise(0).then(function () {
package/lib/index.js CHANGED
@@ -103,6 +103,7 @@ var _exportNames = {
103
103
  sessionStore: true,
104
104
  printWithCss: true,
105
105
  ensureImagesLoaded: true,
106
+ ensureAllMathEquationsAreRendered: true,
106
107
  isNewRCEEnabled: true,
107
108
  createQuizEntryRegrade: true,
108
109
  getQuizEntry: true,
@@ -778,6 +779,12 @@ Object.defineProperty(exports, "ensureImagesLoaded", {
778
779
  return _printUtils.ensureImagesLoaded;
779
780
  }
780
781
  });
782
+ Object.defineProperty(exports, "ensureAllMathEquationsAreRendered", {
783
+ enumerable: true,
784
+ get: function get() {
785
+ return _printUtils.ensureAllMathEquationsAreRendered;
786
+ }
787
+ });
781
788
  Object.defineProperty(exports, "isNewRCEEnabled", {
782
789
  enumerable: true,
783
790
  get: function get() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@instructure/quiz-core",
3
- "version": "17.48.1-rc.4+a1a5f4bd4",
3
+ "version": "17.48.1-rc.5+0f9be3928",
4
4
  "license": "MIT",
5
5
  "description": "The Quiz React SDK by Instructure Inc.",
6
6
  "author": "Instructure, Inc. Engineering and Product Design",
@@ -41,11 +41,11 @@
41
41
  ],
42
42
  "dependencies": {
43
43
  "@instructure/outcomes-ui": "^2.1.2",
44
- "@instructure/quiz-common": "17.48.1-rc.4+a1a5f4bd4",
45
- "@instructure/quiz-i18n": "17.48.1-rc.4+a1a5f4bd4",
46
- "@instructure/quiz-interactions": "17.48.1-rc.4+a1a5f4bd4",
47
- "@instructure/quiz-number-input": "17.48.1-rc.4+a1a5f4bd4",
48
- "@instructure/quiz-rce": "17.48.1-rc.4+a1a5f4bd4",
44
+ "@instructure/quiz-common": "17.48.1-rc.5+0f9be3928",
45
+ "@instructure/quiz-i18n": "17.48.1-rc.5+0f9be3928",
46
+ "@instructure/quiz-interactions": "17.48.1-rc.5+0f9be3928",
47
+ "@instructure/quiz-number-input": "17.48.1-rc.5+0f9be3928",
48
+ "@instructure/quiz-rce": "17.48.1-rc.5+0f9be3928",
49
49
  "@instructure/ui-a11y-content": "^7.20.0",
50
50
  "@instructure/ui-alerts": "^7.20.0",
51
51
  "@instructure/ui-avatar": "^7.20.0",
@@ -106,7 +106,7 @@
106
106
  "eventemitter3": "^3.1.0",
107
107
  "humps": "^2.0.0",
108
108
  "immutable": "^3.8.1",
109
- "instructure-validations": "17.48.1-rc.4+a1a5f4bd4",
109
+ "instructure-validations": "17.48.1-rc.5+0f9be3928",
110
110
  "ipaddr.js": "^1.5.4",
111
111
  "isomorphic-fetch": "^2.2.0",
112
112
  "isuuid": "^0.1.0",
@@ -156,7 +156,7 @@
156
156
  "intl": "^1.2.4",
157
157
  "jquery": "^2.2.3",
158
158
  "most-subject": "^5.3.0",
159
- "quiz-presets": "17.48.1-rc.4+a1a5f4bd4",
159
+ "quiz-presets": "17.48.1-rc.5+0f9be3928",
160
160
  "react": "^16.8.6",
161
161
  "react-addons-test-utils": "^15.6.2",
162
162
  "react-dom": "^16.8.6",
@@ -172,5 +172,5 @@
172
172
  "publishConfig": {
173
173
  "access": "public"
174
174
  },
175
- "gitHead": "a1a5f4bd423c24d047e62909bc5c624172439856"
175
+ "gitHead": "0f9be3928b96cbb5a78ce7f8bbe765d62625a6fd"
176
176
  }