Giter VIP home page Giter VIP logo

common-cartridge-viewer's Introduction

Common Cartridge Viewer

View Common Cartridges in the browser. Methods:

  • Load a CORS-enabled remote .imscc or .zip cartridge
  • Load a CORS-enabled exracted cartridge by pointing to its imsmanifest.xml
  • Drop and drop a cartridge into the viewer

Demo

https://common-cartridge-viewer.netlify.com

Quick start

git clone https://github.com/instructure/common-cartridge-viewer.git
cd common-cartridge-viewer
yarn
yarn run build # populates locale data
yarn start

Usage examples

Load an extracted cartridge

<iframe
  sandbox="allow-scripts allow-same-origin"
  src="https://common-cartridge-viewer.netlify.com/?manifest=https://common-cartridge-viewer.netlify.com/test-cartridges/course-1/imsmanifest.xml"
></iframe>

Load a compressed cartridge

<iframe
  sandbox="allow-scripts allow-same-origin"
  src="https://common-cartridge-viewer.netlify.com/?cartridge=https://s3.amazonaws.com/public-imscc/facc0607309246638c298c6a1b01abcf.imscc"
></iframe>

common-cartridge-viewer's People

Contributors

aaronshaf avatar rodohanna avatar pjata avatar cguanzon avatar woodie avatar jozomby avatar jor3l avatar subpardaemon avatar ptircsiinst avatar akozma89 avatar mauriciozaffari avatar petertircsi avatar mmagyar avatar dnehring avatar judikdavid avatar eschiebel avatar dependabot[bot] avatar

Stargazers

Sergey Latkin avatar

Watchers

Sergey Latkin avatar

common-cartridge-viewer's Issues

LaTeX support with MathJax

We see a single-page cartridge can be patched, but we need to identifying the appropriate place to call MathJax.startup.defaultReady() so that we only load MathJax once, but then typeset 0each fragment as additional pages are selected in the viewer.

https://github.com/instructure/common-cartridge-viewer/pull/201/files

# src/Resource.js
+ const script = document.createElement("script");
+ script.src = "https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js";
+ script.async = true;
+ document.body.appendChild(script);

LaTeX support with better-react-mathjax

I'm not sure how to properly configure "better-react-mathjax in this React App.

Error: Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:
1. You might have mismatching versions of React and the renderer (such as React DOM)
2. You might be breaking the Rules of Hooks
3. You might have more than one copy of React in the same app
See https://fb.me/react-invalid-hook-call for tips about how to debug and fix this problem.
▶ 19 stack frames were collapsed.
CommonCartridge._callee8$
src/CommonCartridge.js:351
  348 |     ? this.state.showcaseResources[0]
  349 |     : null;
  350 | 
> 351 | this.setState({
      | ^  352 |   ...result,
  353 |   externalViewers,
  354 |   isLoaded: true,
@@ -453,6 +454,8 @@ export default class CommonCartridge extends Component {
   return (
     <I18n>
       {({ i18n }) => (
+          <MathJaxContext>
+          <MathJax>
         <React.Fragment>
           {this.props.compact !== true && (
             <View
@@ -864,6 +867,8 @@ export default class CommonCartridge extends Component {
             </div>
           </div>
         </React.Fragment>
+          </MathJax>
+          </MathJaxContext>
       )}
     </I18n>
   );

LaTeX support with mathjax3-react

It looks like this package requires a newer version of React.

$ npm install mathjax3-react --save
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: [email protected]
npm ERR! Found: [email protected]
npm ERR! node_modules/react
npm ERR!   react@"^16.7.0" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer react@"18.x" from [email protected]
npm ERR! node_modules/mathjax3-react
npm ERR!   mathjax3-react@"*" from the root project
npm ERR!
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.