@doenet/doenetml-iframe 0.7.27-dev.816 → 0.7.27-dev.819
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/README.md +57 -2
- package/index.js +1 -1
- package/index.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -303,6 +303,59 @@ Notes:
|
|
|
303
303
|
viewers cheaper.
|
|
304
304
|
- `mountPolicy` is read at mount; changing it afterwards is not supported.
|
|
305
305
|
|
|
306
|
+
### Host integration
|
|
307
|
+
|
|
308
|
+
A summary of what a host page can rely on; the subsections below give each
|
|
309
|
+
message in full.
|
|
310
|
+
|
|
311
|
+
**Commands in** (post on your own window; the wrapper forwards them into the
|
|
312
|
+
iframe):
|
|
313
|
+
|
|
314
|
+
- `SPLICE.getState.response`: the saved state the viewer asked for at boot.
|
|
315
|
+
- `SPLICE.requestSolutionView.response`: allow or refuse a solution view.
|
|
316
|
+
- `SPLICE.submitAllAnswers`: submit every answer; answered by
|
|
317
|
+
`SPLICE.submitAllAnswers.response`.
|
|
318
|
+
- `SPLICE.flushState`: push out any state the save throttle is holding
|
|
319
|
+
back; answered by `SPLICE.flushState.response`.
|
|
320
|
+
|
|
321
|
+
**Events out** (arrive on your window):
|
|
322
|
+
|
|
323
|
+
- `SPLICE.reportScoreAndState`: score and serialized state, at most one
|
|
324
|
+
report per 60 seconds per viewer unless a flush or a page hide pushes one
|
|
325
|
+
out sooner.
|
|
326
|
+
- `SPLICE.getState`: the request for saved state at boot (with
|
|
327
|
+
`flags.allowLoadState` and no `initialState`).
|
|
328
|
+
- `SPLICE.requestSolutionView`: the permission request (with
|
|
329
|
+
`flags.solutionDisplayMode: "buttonRequirePermission"`).
|
|
330
|
+
- `SPLICE.sendEvent`: the event stream (with `flags.allowSaveEvents`).
|
|
331
|
+
|
|
332
|
+
`iframeReady`, `scrollTo` and `lti.frameResize` also cross the frame
|
|
333
|
+
boundary, but the wrapper consumes them itself: `iframeReady` starts the
|
|
334
|
+
connection to the viewer inside, `scrollTo` scrolls your window to an
|
|
335
|
+
in-document link target (unless you pass `requestScrollTo`), and
|
|
336
|
+
`lti.frameResize` sizes the iframe to its content. A host does not need to
|
|
337
|
+
handle them.
|
|
338
|
+
|
|
339
|
+
**Capping submissions (`flags.maxNumAttempts`).** A host can limit how many
|
|
340
|
+
times each answer can be submitted without editing the document:
|
|
341
|
+
|
|
342
|
+
```tsx
|
|
343
|
+
<DoenetViewer doenetML={doenetML} flags={{ maxNumAttempts: 3 }} />
|
|
344
|
+
```
|
|
345
|
+
|
|
346
|
+
The cap combines with the author's own `maxNumAttempts`: an answer gets the
|
|
347
|
+
smaller of the two, so an author's stricter limit still holds and a larger
|
|
348
|
+
cap never raises it. Inside a container with `sectionWideCheckWork`, the cap
|
|
349
|
+
applies to the container's check-work button, which is what submits its
|
|
350
|
+
answers. `null`, the default, means no cap; `0` allows no submissions. The
|
|
351
|
+
remaining count shows beside each check-work button, and saved state keeps
|
|
352
|
+
the number already used, so a reload does not reset it. `$answer.maxNumAttempts` (and a section-wide container's) reports the limit
|
|
353
|
+
that applies, so text such as "You have $ans.maxNumAttempts attempts" matches
|
|
354
|
+
the count beside the button. The flag is read when the document's core
|
|
355
|
+
starts: changing it on a mounted viewer takes effect only at the next core
|
|
356
|
+
start (a change of `doenetML`, `docId`, `attemptNumber` or the other props
|
|
357
|
+
that re-initialize the document, or a remount).
|
|
358
|
+
|
|
306
359
|
### Host message protocol (SPLICE)
|
|
307
360
|
|
|
308
361
|
The viewer exchanges JSON messages with the host page via `postMessage`.
|
|
@@ -572,8 +625,10 @@ section-wide check work, `result` also counts attempts, so a host can count
|
|
|
572
625
|
and cap them without reading the document:
|
|
573
626
|
|
|
574
627
|
- `numSubmissions`: submissions so far, including this one.
|
|
575
|
-
- `maxNumAttempts`: the
|
|
576
|
-
are unlimited.
|
|
628
|
+
- `maxNumAttempts`: the component's `maxNumAttempts`, or `null` when
|
|
629
|
+
attempts are unlimited. That is the author's limit, lowered by
|
|
630
|
+
`flags.maxNumAttempts` where the flag applies (see "Capping submissions"
|
|
631
|
+
above).
|
|
577
632
|
- `numAttemptsLeft`: attempts left after this submission, or `null` when
|
|
578
633
|
unlimited.
|
|
579
634
|
|
package/index.js
CHANGED
|
@@ -76353,7 +76353,7 @@ function ExternalVirtualKeyboard({
|
|
|
76353
76353
|
}
|
|
76354
76354
|
);
|
|
76355
76355
|
}
|
|
76356
|
-
const version = "0.7.27-dev.
|
|
76356
|
+
const version = "0.7.27-dev.819";
|
|
76357
76357
|
const latestDoenetmlVersion = version;
|
|
76358
76358
|
function versionLabel(doenetmlVersion) {
|
|
76359
76359
|
return /^\d/.test(doenetmlVersion) ? `v${doenetmlVersion}` : doenetmlVersion;
|