canvas-lms/app/jsx
Chris Hart c9c41c89b9 Fix for new UI breaking printing to PDF in Firefox
Fixes: CNVS-26160

Note for reviewer: In addition to fixing the bug, I
also fixed some small issues with the print styles
and the new UI:
- Hamburger button and header no longer print
- Margins for the primary nav and the context
  nav have been removed, so the printing can cover
  the whole width of the page.

Test plan:

- Create a very long page in a course. Print it to
  PDF/Preview in Chrome or another unaffected browser
  to confirm it prints over more than one page.
- Open the same page in Firefox. Go to Print >
  PDF > Open PDF in Preview (see bug report in
  JIRA for a video)
- Confirm that the page prints to PDF/Preview
  successfully. There should be no more cutoff,
  as reported in the bug.

Change-Id: Ibed9f83af1fddaea20524fa552539ce337b5f204
Reviewed-on: https://gerrit.instructure.com/71378
Tested-by: Jenkins
Reviewed-by: Jennifer Stern <jstern@instructure.com>
Product-Review: Jennifer Stern <jstern@instructure.com>
QA-Review: Myller de Araujo <myller@instructure.com>
2016-02-05 18:25:51 +00:00
..
account_course_user_search add links to avatar and groups management 2016-01-08 21:00:38 +00:00
assignments direct to new mark when following link moderation page 2015-12-16 14:02:19 +00:00
authentication_providers Update AuthenticationTypePicker to work with React 0.13.3 2015-11-19 00:32:45 +00:00
context_modules Start using Babel to compile files in the JSX folder 2015-10-23 20:54:35 +00:00
course_link_validator more course link validator improvements 2015-12-11 14:20:25 +00:00
course_wizard Merge branch 'ckhatri/master' 2015-12-15 11:42:48 -07:00
dashboard_card Add href to Dashboard Card links 2016-02-02 19:25:36 +00:00
discussion_topics Reactify discussion keyboard shortcut modal 2016-01-12 17:41:26 +00:00
due_dates DA - fetch adhoc override students once data is ready 2016-02-04 17:20:55 +00:00
epub_exports Update FriendlyDatetime component to work with React 0.13.3 2015-11-19 00:33:37 +00:00
external_apps A11y: Added titles to all visible iframes 2016-01-05 17:49:02 +00:00
files Fix for new UI breaking printing to PDF in Firefox 2016-02-05 18:25:51 +00:00
gradebook Fixes over 30 character error for assignment names with symbols 2016-02-04 00:07:54 +00:00
grading grading schemes page: fix a11y issues 2016-02-01 18:29:56 +00:00
groups Update Groups to work with React 0.13.3 2015-11-19 00:34:42 +00:00
navigation_header Add class for groups subpanel so spacing is better 2015-11-04 20:39:13 +00:00
outcomes Start using Babel to compile files in the JSX folder 2015-10-23 20:54:35 +00:00
shared Add automated a11y testing helper for qunit tests 2016-02-02 17:39:11 +00:00
styleguide Update react-modals in Canvas 2015-12-15 13:52:34 +00:00
theme_editor load custom css/js for high contrast in newUI 2016-01-20 20:56:39 +00:00
README.md Start using Babel to compile files in the JSX folder 2015-10-23 20:54:35 +00:00

README.md

This directory is temporary until we rework the front-end build This is where we are headed.

Stuff you can do in Canvas JSX files

BUT WAIT!

Your file needs to:

  1. Have a file name with the .jsx extension.

JSX

function foo(paths) {
  return <svg>{paths}</svg>;
}

Arrow Functions

Arrow Function Reference

var arr = ['hydrogen', 'helium', 'lithium'];

// es5
var a = arr.map(function(s){ return s.length });

// es6
var b = arr.map( s => s.length );

// with curlies requires normal return
var b = arr.map( (s) => {
  return s.length
});

// lexical `this`
var obj = {
  multiplier: 3,

  multiplyStuff (stuff) {
    return stuff.map((x) =>
      // no bind!
      return this.multiplier * x;
    )
  }
};

Classes

Class Reference

class EventEmitter {
  constructor() {
    // called when created
  }
  emit() {
    // ...
  }
  on() {
    // ...
  }
  once() {
    // ...
  }
  removeListener() {
    // ...
  }
  removeAllListeners() {
    // ...
  }
}

Extending and calling super.

class Domain extends EventEmitter {
  constructor() {
    super();
    this.members = [];
  }
}

Creating instances

var domain = new Domain();

Destructuring

// es5
var map = _.map;
var each = _.each;

// es6
var {map, each} = _;

Concise Object Methods

// es5
var obj = {
  foo: function() {}
  bar: function() {}
};

// es6
var obj = {
  foo() {}
  bar() {}
};

Object Short Notation

// es5
function() {
  // ...
  return {foo: foo, bar: bar, x: 10};
}

// es6
function() {
  // ...
  return {foo, bar, x: 10};
}

Rest Parameters

Rest Parameters Reference

// es5
function multiply(multiplier) {
  var numbers = Array.prototype.slice.call(arguments, 0);
  return number.map(function(n) { return multiplier * n; });
}

// es6
function multiply(multiplier, ...numbers) {
  return numbers.map( n => multiplier * n);
}

String Templates

String Template Reference

Multiline strings:

// es5
console.log("string text line 1" +
"string text line 2");

// es6
console.log(`string text line 1
string text line 2`);

Interpolated strings

var a = 5;
var b = 10;

// es5
console.log("Fifteen is " + (a + b) + " and not " + (2 * a + b) + ".");

// es6
console.log(`Fifteen is ${a + b} and not ${2 * a + b}.`);