PreTeXtBook / pretext

PreTeXt: an authoring and publishing system for scholarly documents
https://pretextbook.org
Other
264 stars 206 forks source link

React / Runestone issues #1991

Open bnmnetp opened 1 year ago

bnmnetp commented 1 year ago

Tagging: @rbeezer @siefkenj

rbeezer commented 1 year ago

Videos are visible, as of d18da94eb8a11d32b1591875567ac75e42087853. Needs work on sizing (it appears). Thanks to @bnmnetp for rapid testing ont his one.

bnmnetp commented 1 year ago

Parsons and MathJax

@siefkenj -- I see the problem.

  startup: {
    /* Mathjax typesetting operation is under the control of React */
    typeset: false,

In a non react build we have this block

startup: {
    pageReady() {
      return MathJax.startup.defaultPageReady().then(function () {
      console.log("in ready function");
      rsMathReady();
      }
    )}
  },

If rsMathReady() is not called then my system to queue up and handle all of the different blocks does not work because I'm waiting on a promise that ensures that MathJax is both loaded and ready to handle additional requests for rendering.

siefkenj commented 1 year ago

@bnmnetp As of https://github.com/siefkenj/pretext-react/pull/39 rsMathReady should now be called.

I also added the pencil icon and the Runestone menu.

At the moment the scratchpad is very much a hack and I expect it's quite fragile. I mirrored the code in https://github.com/RunestoneInteractive/RunestoneComponents/blob/229cbf85e6fbda03adaf487397aef25b944d00d8/webpack.index.js#L157 but that code seems to reference global variables and whatnot. Also, I don't have access to runestone_import, so I cannot wait like your code can...

You can see what I did here: https://github.com/siefkenj/pretext-react/blob/4565b374666014e3458eed938f07365deb0eb529/src/state-management/redux-slices/runestone/runestone-slice.ts#L96

bnmnetp commented 1 year ago

@siefkenj -- Very cool! You can see that build on a runestone server here: http://dev.runestone.academy

bnmnetp commented 1 year ago

For decorating the TOC

The endpoint is /ns/logging/getAllCompletionStatus

This will return JSON which is an array of objects

[
   { chapterName: chapter_id,
      subChapterName, sub_chapter_id,
      completionStatus: intstatus
      endDate: adate
    },
   .....
]

I think the main thing for you is that the subChapterName key will match the html file in the a tag sans the .html

This should only be called when the user is logged in eBookConfig.isLoggedIn === true If the user is not logged in it will return a 401.

siefkenj commented 1 year ago

corrections: /ns/logger/getAllCompletionStatus subChapterName is the page id. chapterName can be ignored. completionStatus = -1 if unstarted, 0 if uncomplete, and 1 if complete