canvas-lms/spec/coffeescripts/views/tinymce
Ed Schiebel 2a277632c2 Make typeset math and math image match
at least get them much closer.
1. typeset math using svg by default, which is how the image is generated
2. size the image so it matches the surrounding font-size

Also, still typeset math from images even if the image fails to load.

closes MAT-501
flag=new_math_equation_handling

SIZING MATH REQUIRES A COMPANION CHANGE TO MATHMAN (the other stuff doesn't)
  - clone git clone ssh://<yourid>@gerrit.instructure.com:29418/mathman
    and follow the instructions for building.
  - checkout https://gerrit.instructure.com/c/mathman/+/277389
  - build it (once built, you don't have to run in in docker)
  - in a canvas rails console:
    Setting.set(
      'equation_image_url,
      'http://localhost:8000/svg?tex='
    )
    http://localhost:8000 is where mathman is via `node app.js`
    it's at http://mathman.docker if in docker (at least that's
    what the README says, I don't really know)
  - test mathman by requesting `http://<mathman-url>/svg?tex=17`
    and expect an image of "17". now try with `request /svg?tex=17&scale=2`
    and your "17" shoul be twice as large.
  - restart your canvas server

test plan:
  Updated typesetting:
  - have a question_bank quetsion with math and answers with math
  - include the question in a quiz
  > verify that the question looks the same in the question bank
    as it does when previewing/taking the quiz
    - if your math includes a "g", it should look the same
    - the size of the equation should be pretty close
  Sizing to match:
  - turn on scale_math_equations site admin feature
  - put an equation w/in a paragraph with a large font, or
    add an equation to the rce, select it, and change the font size
  - click on the equation, edit equation, click insert equation
    w/o changing anything
  > expect the equation to match the larger font.

  - extra credit: DO THIS WITH AND WITHOUT MATHMAN PLUGIN ENABLED
    (yes, there are 2 paths canvas takes to mathman)
    make sure to update dyanmic-settings.yml's math-man entry
    math-man:
      base_url: 'http://localhost:8000'
      use_for_svg: 'true'
      use_for_mml: 'false'
  - at /plugins, enable mathman plugin and ensure use_for_svg istrue

  Error handling:
  - change the URL to mathman to a dead end
  - load a page with math equation images
  > expect the math to be typeset by mathjax

Change-Id: I354e98a0a0256740ce5b4937f5b4e3adc690fe51
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/277245
Reviewed-by: Weston Dransfield <wdransfield@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
QA-Review: Weston Dransfield <wdransfield@instructure.com>
Product-Review: David Lyons <lyons@instructure.com>
2021-11-09 19:28:42 +00:00
..
EquationEditorViewSpec.js Make typeset math and math image match 2021-11-09 19:28:42 +00:00
EquationToolbarViewSpec.js rename some things 2021-04-06 01:12:49 +00:00