@instructure/quiz-core 17.22.2-rc.0 → 17.22.2-rc.1

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.
@@ -22,23 +22,23 @@ import { ItemTypes, dragSource, collectDrag } from "../../../../../common/compon
22
22
  import PositionBox from "../../../../../common/components/resources/positionBox/PositionBox.js";
23
23
  import DragAndDropZone from "../../../../../common/components/shared/drag_and_drop/DragAndDropZone/index.js";
24
24
  var styles = {
25
- componentId: 'fohHO',
25
+ componentId: 'cjiDL',
26
26
  template: function template(theme) {
27
- return "\n\n.fohHO_eLmg{transform:translateZ(0)}\n\n.fohHO_TMNr{background-color:".concat(theme.quizEntryShowBackgroundColor || 'inherit', ";padding:").concat(theme.quizEntryShowPadding || 'inherit', "}\n\n.fohHO_fsuY{align-items:stretch;display:flex;flex-direction:row;flex-wrap:nowrap;height:").concat(theme.headerHeight || 'inherit', ";padding-right:").concat(theme.headerRightPadding || 'inherit', "}\n\n.fohHO_bscQ{border:").concat(theme.dndBorder || 'inherit', "}\n\n.fohHO_cKlw{align-items:center;display:inline-flex;flex:8 0 0;overflow:hidden}\n\n.fohHO_eGWt{border-bottom:").concat(theme.phoneConnectingLinesBorderWidth || 'inherit', " dotted;border-color:").concat(theme.phoneConnectingLinesBorderColor || 'inherit', ";border-left:").concat(theme.phoneConnectingLinesBorderWidth || 'inherit', " dotted;height:2rem;margin-right:1.2rem;margin-top:-0.8rem;width:1.2rem}\n\n.fohHO_eGWt,.fohHO_IoDT{display:inline-flex;flex:0 0 auto}\n\n.fohHO_IoDT{color:").concat(theme.rightHeaderColor || 'inherit', ";text-align:right;z-index:").concat(theme.rightHeaderZIndex || 'inherit', "}\n\n[dir=ltr] .fohHO_IoDT,[dir=rtl] .fohHO_IoDT{text-align:right}\n\n.fohHO_IoDT button{background-color:transparent;background-color:initial}\n\n.fohHO_eCZW,.fohHO_cwte,.fohHO_nvdO{color:").concat(theme.titleInteractionTypeNamePointsColor || 'inherit', ";font-size:").concat(theme.titleInteractionTypeNamePointsFontSize || 'inherit', ";margin-left:").concat(theme.titleInteractionTypeNamePointsLeftMargin || 'inherit', ";margin-right:").concat(theme.titleInteractionTypeNamePointsRightMargin || 'inherit', ";overflow:hidden;text-overflow:ellipsis;white-space:nowrap}\n\n.fohHO_csjx{margin:").concat(theme.itemHolderMargin || 'inherit', "}\n\n.fohHO_fPOQ,.fohHO_gaTA{background-color:transparent;border:none;color:inherit;font-size:").concat(theme.optionsButtonDragDropHandleFontSize || 'inherit', ";margin:").concat(theme.optionsButtonDragDropHandleMargin || 'inherit', "}\n\n.fohHO_gaTA{cursor:pointer}\n\n@media print{.fohHO_eLmg{page-break-inside:avoid}}");
27
+ return "\n\n.cjiDL_eLmg{transform:translateZ(0)}\n\n.cjiDL_TMNr{background-color:".concat(theme.quizEntryShowBackgroundColor || 'inherit', ";padding:").concat(theme.quizEntryShowPadding || 'inherit', "}\n\n.cjiDL_fsuY{align-items:stretch;display:flex;flex-direction:row;flex-wrap:nowrap;height:").concat(theme.headerHeight || 'inherit', ";padding-right:").concat(theme.headerRightPadding || 'inherit', "}\n\n.cjiDL_bscQ{border:").concat(theme.dndBorder || 'inherit', "}\n\n.cjiDL_cKlw{align-items:center;display:inline-flex;flex:8 0 0;overflow:hidden}\n\n.cjiDL_eGWt{border-bottom:").concat(theme.phoneConnectingLinesBorderWidth || 'inherit', " dotted;border-color:").concat(theme.phoneConnectingLinesBorderColor || 'inherit', ";border-left:").concat(theme.phoneConnectingLinesBorderWidth || 'inherit', " dotted;height:2rem;margin-right:1.2rem;margin-top:-0.8rem;width:1.2rem}\n\n.cjiDL_eGWt,.cjiDL_IoDT{display:inline-flex;flex:0 0 auto}\n\n.cjiDL_IoDT{color:").concat(theme.rightHeaderColor || 'inherit', ";text-align:right;z-index:").concat(theme.rightHeaderZIndex || 'inherit', "}\n\n[dir=ltr] .cjiDL_IoDT,[dir=rtl] .cjiDL_IoDT{text-align:right}\n\n.cjiDL_IoDT button{background-color:transparent;background-color:initial}\n\n.cjiDL_eCZW,.cjiDL_cwte,.cjiDL_nvdO{color:").concat(theme.titleInteractionTypeNamePointsColor || 'inherit', ";font-size:").concat(theme.titleInteractionTypeNamePointsFontSize || 'inherit', ";margin-left:").concat(theme.titleInteractionTypeNamePointsLeftMargin || 'inherit', ";margin-right:").concat(theme.titleInteractionTypeNamePointsRightMargin || 'inherit', ";overflow:hidden;text-overflow:ellipsis;white-space:nowrap}\n\n.cjiDL_csjx{margin:").concat(theme.itemHolderMargin || 'inherit', "}\n\n.cjiDL_fPOQ,.cjiDL_gaTA{background-color:transparent;border:none;color:inherit;font-size:").concat(theme.optionsButtonDragDropHandleFontSize || 'inherit', ";margin:").concat(theme.optionsButtonDragDropHandleMargin || 'inherit', "}\n\n.cjiDL_gaTA{cursor:pointer}\n\n@media print{.cjiDL_eLmg{break-inside:avoid}}");
28
28
  },
29
- 'quizEntryWrapper': 'fohHO_eLmg',
30
- 'quizEntryShow': 'fohHO_TMNr',
31
- 'header': 'fohHO_fsuY',
32
- 'dndBorder': 'fohHO_bscQ',
33
- 'leftHeader': 'fohHO_cKlw',
34
- 'connectingLines': 'fohHO_eGWt',
35
- 'rightHeader': 'fohHO_IoDT',
36
- 'interactionTypeName': 'fohHO_eCZW',
37
- 'points': 'fohHO_cwte',
38
- 'title': 'fohHO_nvdO',
39
- 'itemHolder': 'fohHO_csjx',
40
- 'dragAndDropHandle': 'fohHO_fPOQ',
41
- 'optionsButton': 'fohHO_gaTA'
29
+ 'quizEntryWrapper': 'cjiDL_eLmg',
30
+ 'quizEntryShow': 'cjiDL_TMNr',
31
+ 'header': 'cjiDL_fsuY',
32
+ 'dndBorder': 'cjiDL_bscQ',
33
+ 'leftHeader': 'cjiDL_cKlw',
34
+ 'connectingLines': 'cjiDL_eGWt',
35
+ 'rightHeader': 'cjiDL_IoDT',
36
+ 'interactionTypeName': 'cjiDL_eCZW',
37
+ 'points': 'cjiDL_cwte',
38
+ 'title': 'cjiDL_nvdO',
39
+ 'itemHolder': 'cjiDL_csjx',
40
+ 'dragAndDropHandle': 'cjiDL_fPOQ',
41
+ 'optionsButton': 'cjiDL_gaTA'
42
42
  };
43
43
  import theme from "./theme.js";
44
44
 
@@ -112,6 +112,7 @@ export var PrintFontSizeModal = (_dec = themeable(theme, styles), _dec(_class =
112
112
  return /*#__PURE__*/React.createElement(Modal, {
113
113
  open: this.props.isOpen,
114
114
  onDismiss: this.props.onCancel,
115
+ onExited: this.props.onExited,
115
116
  size: "small",
116
117
  label: this.text.printQuiz
117
118
  }, /*#__PURE__*/React.createElement(ModalHeader, null, /*#__PURE__*/React.createElement(Heading, null, this.text.printQuiz), /*#__PURE__*/React.createElement(CloseButton, {
@@ -170,7 +171,8 @@ export var PrintFontSizeModal = (_dec = themeable(theme, styles), _dec(_class =
170
171
  isOpen: PropTypes.bool,
171
172
  persistedPrintFontSize: PropTypes.string,
172
173
  onSubmit: PropTypes.func.isRequired,
173
- onCancel: PropTypes.func.isRequired
174
+ onCancel: PropTypes.func.isRequired,
175
+ onExited: PropTypes.func.isRequired
174
176
  }, _class2.defaultProps = {
175
177
  isOpen: false,
176
178
  persistedPrintFontSize: 'medium'
@@ -11,13 +11,13 @@ import PropTypes from 'prop-types';
11
11
  import classnames from 'classnames';
12
12
  import { themeable } from '@instructure/ui-themeable';
13
13
  var styles = {
14
- componentId: 'bwvTI',
14
+ componentId: 'KVDkV',
15
15
  template: function template(theme) {
16
- return "\n\n.bwvTI_gasz{display:flex;font-family:".concat(theme.fontFamily || 'inherit', ";height:100%;margin:0}\n\n@media screen and (--phoneBreakPoint){.bwvTI_caGd{-webkit-overflow-scrolling:touch}}\n\n.bwvTI_caGd{transition:").concat(theme.contentTransition || 'inherit', ";width:100%}\n\n.bwvTI_dxaC{overflow-x:hidden;overflow-y:auto}");
16
+ return "\n\n.KVDkV_gasz{display:flex;font-family:".concat(theme.fontFamily || 'inherit', ";height:100%;margin:0}\n\n@media screen and (--phoneBreakPoint){.KVDkV_caGd{-webkit-overflow-scrolling:touch}}\n\n.KVDkV_caGd{transition:").concat(theme.contentTransition || 'inherit', ";width:100%}\n\n.KVDkV_dxaC{overflow-x:hidden;overflow-y:auto}\n\n@media print{.KVDkV_gasz{display:block}}");
17
17
  },
18
- 'wrapper': 'bwvTI_gasz',
19
- 'content': 'bwvTI_caGd',
20
- 'scrollable': 'bwvTI_dxaC'
18
+ 'wrapper': 'KVDkV_gasz',
19
+ 'content': 'KVDkV_caGd',
20
+ 'scrollable': 'KVDkV_dxaC'
21
21
  };
22
22
  import theme from "./theme.js";
23
23
  export var Page = (_dec = themeable(theme, styles), _dec(_class = (_temp = _class2 = /*#__PURE__*/function (_Component) {
@@ -17,36 +17,42 @@ export var PrintTrigger = /*#__PURE__*/function (_Component) {
17
17
 
18
18
  var _super = _createSuper(PrintTrigger);
19
19
 
20
- function PrintTrigger() {
20
+ function PrintTrigger(props) {
21
21
  var _this;
22
22
 
23
23
  _classCallCheck(this, PrintTrigger);
24
24
 
25
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
26
- args[_key] = arguments[_key];
27
- }
28
-
29
- _this = _super.call.apply(_super, [this].concat(args));
25
+ _this = _super.call(this, props);
30
26
  _this.state = {
31
- waitingForImages: false,
27
+ waitingForPrintingToBeReady: false,
32
28
  printType: PRINT_CURRENT_PAGE,
33
29
  // quiz key or blank quiz
34
30
  shouldPrint: false
35
31
  };
36
32
 
37
- _this.ensureImagesLoaded = function (cb) {
33
+ _this.print = function () {
34
+ printWithCss(_this.fontSize, 100);
35
+ };
36
+
37
+ _this.ensurePrintingIsReady = function (printFontSizeModalClose) {
38
38
  _this.setState({
39
- waitingForImages: true
39
+ waitingForPrintingToBeReady: true
40
40
  });
41
41
 
42
- ensureImagesLoaded().then(function () {
43
- return _this.setState({
44
- waitingForImages: false
45
- }, cb);
42
+ Promise.all([ensureImagesLoaded(), printFontSizeModalClose]).then(function () {
43
+ _this.setState({
44
+ waitingForPrintingToBeReady: false
45
+ });
46
+
47
+ _this.onExited = function () {};
46
48
  });
47
49
  };
48
50
 
49
51
  _this.handlePrintModalSubmit = function (fontSize, shouldPersist) {
52
+ var printFontSizeModalClose = new Promise(function (resolve) {
53
+ _this.onExited = resolve;
54
+ });
55
+
50
56
  _this.props.closePrintFontSizeModal();
51
57
 
52
58
  if (shouldPersist) {
@@ -58,12 +64,9 @@ export var PrintTrigger = /*#__PURE__*/function (_Component) {
58
64
  if (_this.state.printType === PRINT_BLANK) {
59
65
  _this.props.navigateToPreviewPrint();
60
66
  } else {
61
- // default to printing the current page
62
- // 400ms timeout because default transition (for print modal
63
- // to exit) is 300ms
64
- _this.ensureImagesLoaded(function () {
65
- return printWithCss(fontSize, 400);
66
- });
67
+ _this.fontSize = fontSize;
68
+
69
+ _this.ensurePrintingIsReady(printFontSizeModalClose);
67
70
  }
68
71
  };
69
72
 
@@ -79,6 +82,9 @@ export var PrintTrigger = /*#__PURE__*/function (_Component) {
79
82
  return elementsForSelectors(_this.props.appContainer);
80
83
  };
81
84
 
85
+ _this.onExited = function () {};
86
+
87
+ _this.fontSize = '';
82
88
  return _this;
83
89
  }
84
90
 
@@ -87,9 +93,10 @@ export var PrintTrigger = /*#__PURE__*/function (_Component) {
87
93
  value: function render() {
88
94
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Overlay, {
89
95
  applicationElement: this.applicationElement,
90
- open: this.state.waitingForImages,
96
+ open: this.state.waitingForPrintingToBeReady,
91
97
  shouldContainFocus: true,
92
98
  transition: "fade",
99
+ onExited: this.print,
93
100
  label: t('Preparing Print Preview')
94
101
  }, /*#__PURE__*/React.createElement(Mask, null, /*#__PURE__*/React.createElement(Spinner, {
95
102
  mainText: t('Preparing Print Preview')
@@ -97,6 +104,7 @@ export var PrintTrigger = /*#__PURE__*/function (_Component) {
97
104
  isOpen: this.props.printFontSizeModalOpen,
98
105
  onSubmit: this.handlePrintModalSubmit,
99
106
  onCancel: this.props.closePrintFontSizeModal,
107
+ onExited: this.onExited,
100
108
  persistedPrintFontSize: this.props.persistedPrintFontSize
101
109
  }), this.props.render(this.handlePrint));
102
110
  }
@@ -54,23 +54,23 @@ var _theme = _interopRequireDefault(require("./theme.js"));
54
54
  var _dec, _class, _class2, _temp;
55
55
 
56
56
  var styles = {
57
- componentId: 'fohHO',
57
+ componentId: 'cjiDL',
58
58
  template: function template(theme) {
59
- return "\n\n.fohHO_eLmg{transform:translateZ(0)}\n\n.fohHO_TMNr{background-color:".concat(theme.quizEntryShowBackgroundColor || 'inherit', ";padding:").concat(theme.quizEntryShowPadding || 'inherit', "}\n\n.fohHO_fsuY{align-items:stretch;display:flex;flex-direction:row;flex-wrap:nowrap;height:").concat(theme.headerHeight || 'inherit', ";padding-right:").concat(theme.headerRightPadding || 'inherit', "}\n\n.fohHO_bscQ{border:").concat(theme.dndBorder || 'inherit', "}\n\n.fohHO_cKlw{align-items:center;display:inline-flex;flex:8 0 0;overflow:hidden}\n\n.fohHO_eGWt{border-bottom:").concat(theme.phoneConnectingLinesBorderWidth || 'inherit', " dotted;border-color:").concat(theme.phoneConnectingLinesBorderColor || 'inherit', ";border-left:").concat(theme.phoneConnectingLinesBorderWidth || 'inherit', " dotted;height:2rem;margin-right:1.2rem;margin-top:-0.8rem;width:1.2rem}\n\n.fohHO_eGWt,.fohHO_IoDT{display:inline-flex;flex:0 0 auto}\n\n.fohHO_IoDT{color:").concat(theme.rightHeaderColor || 'inherit', ";text-align:right;z-index:").concat(theme.rightHeaderZIndex || 'inherit', "}\n\n[dir=ltr] .fohHO_IoDT,[dir=rtl] .fohHO_IoDT{text-align:right}\n\n.fohHO_IoDT button{background-color:transparent;background-color:initial}\n\n.fohHO_eCZW,.fohHO_cwte,.fohHO_nvdO{color:").concat(theme.titleInteractionTypeNamePointsColor || 'inherit', ";font-size:").concat(theme.titleInteractionTypeNamePointsFontSize || 'inherit', ";margin-left:").concat(theme.titleInteractionTypeNamePointsLeftMargin || 'inherit', ";margin-right:").concat(theme.titleInteractionTypeNamePointsRightMargin || 'inherit', ";overflow:hidden;text-overflow:ellipsis;white-space:nowrap}\n\n.fohHO_csjx{margin:").concat(theme.itemHolderMargin || 'inherit', "}\n\n.fohHO_fPOQ,.fohHO_gaTA{background-color:transparent;border:none;color:inherit;font-size:").concat(theme.optionsButtonDragDropHandleFontSize || 'inherit', ";margin:").concat(theme.optionsButtonDragDropHandleMargin || 'inherit', "}\n\n.fohHO_gaTA{cursor:pointer}\n\n@media print{.fohHO_eLmg{page-break-inside:avoid}}");
59
+ return "\n\n.cjiDL_eLmg{transform:translateZ(0)}\n\n.cjiDL_TMNr{background-color:".concat(theme.quizEntryShowBackgroundColor || 'inherit', ";padding:").concat(theme.quizEntryShowPadding || 'inherit', "}\n\n.cjiDL_fsuY{align-items:stretch;display:flex;flex-direction:row;flex-wrap:nowrap;height:").concat(theme.headerHeight || 'inherit', ";padding-right:").concat(theme.headerRightPadding || 'inherit', "}\n\n.cjiDL_bscQ{border:").concat(theme.dndBorder || 'inherit', "}\n\n.cjiDL_cKlw{align-items:center;display:inline-flex;flex:8 0 0;overflow:hidden}\n\n.cjiDL_eGWt{border-bottom:").concat(theme.phoneConnectingLinesBorderWidth || 'inherit', " dotted;border-color:").concat(theme.phoneConnectingLinesBorderColor || 'inherit', ";border-left:").concat(theme.phoneConnectingLinesBorderWidth || 'inherit', " dotted;height:2rem;margin-right:1.2rem;margin-top:-0.8rem;width:1.2rem}\n\n.cjiDL_eGWt,.cjiDL_IoDT{display:inline-flex;flex:0 0 auto}\n\n.cjiDL_IoDT{color:").concat(theme.rightHeaderColor || 'inherit', ";text-align:right;z-index:").concat(theme.rightHeaderZIndex || 'inherit', "}\n\n[dir=ltr] .cjiDL_IoDT,[dir=rtl] .cjiDL_IoDT{text-align:right}\n\n.cjiDL_IoDT button{background-color:transparent;background-color:initial}\n\n.cjiDL_eCZW,.cjiDL_cwte,.cjiDL_nvdO{color:").concat(theme.titleInteractionTypeNamePointsColor || 'inherit', ";font-size:").concat(theme.titleInteractionTypeNamePointsFontSize || 'inherit', ";margin-left:").concat(theme.titleInteractionTypeNamePointsLeftMargin || 'inherit', ";margin-right:").concat(theme.titleInteractionTypeNamePointsRightMargin || 'inherit', ";overflow:hidden;text-overflow:ellipsis;white-space:nowrap}\n\n.cjiDL_csjx{margin:").concat(theme.itemHolderMargin || 'inherit', "}\n\n.cjiDL_fPOQ,.cjiDL_gaTA{background-color:transparent;border:none;color:inherit;font-size:").concat(theme.optionsButtonDragDropHandleFontSize || 'inherit', ";margin:").concat(theme.optionsButtonDragDropHandleMargin || 'inherit', "}\n\n.cjiDL_gaTA{cursor:pointer}\n\n@media print{.cjiDL_eLmg{break-inside:avoid}}");
60
60
  },
61
- 'quizEntryWrapper': 'fohHO_eLmg',
62
- 'quizEntryShow': 'fohHO_TMNr',
63
- 'header': 'fohHO_fsuY',
64
- 'dndBorder': 'fohHO_bscQ',
65
- 'leftHeader': 'fohHO_cKlw',
66
- 'connectingLines': 'fohHO_eGWt',
67
- 'rightHeader': 'fohHO_IoDT',
68
- 'interactionTypeName': 'fohHO_eCZW',
69
- 'points': 'fohHO_cwte',
70
- 'title': 'fohHO_nvdO',
71
- 'itemHolder': 'fohHO_csjx',
72
- 'dragAndDropHandle': 'fohHO_fPOQ',
73
- 'optionsButton': 'fohHO_gaTA'
61
+ 'quizEntryWrapper': 'cjiDL_eLmg',
62
+ 'quizEntryShow': 'cjiDL_TMNr',
63
+ 'header': 'cjiDL_fsuY',
64
+ 'dndBorder': 'cjiDL_bscQ',
65
+ 'leftHeader': 'cjiDL_cKlw',
66
+ 'connectingLines': 'cjiDL_eGWt',
67
+ 'rightHeader': 'cjiDL_IoDT',
68
+ 'interactionTypeName': 'cjiDL_eCZW',
69
+ 'points': 'cjiDL_cwte',
70
+ 'title': 'cjiDL_nvdO',
71
+ 'itemHolder': 'cjiDL_csjx',
72
+ 'dragAndDropHandle': 'cjiDL_fPOQ',
73
+ 'optionsButton': 'cjiDL_gaTA'
74
74
  };
75
75
 
76
76
  var _ref = /*#__PURE__*/_react.default.createElement(_uiIcons.IconBankLine, null);
@@ -136,6 +136,7 @@ var PrintFontSizeModal = (_dec = (0, _uiThemeable.themeable)(_theme.default, sty
136
136
  return /*#__PURE__*/_react.default.createElement(_quizCommon.Modal, {
137
137
  open: this.props.isOpen,
138
138
  onDismiss: this.props.onCancel,
139
+ onExited: this.props.onExited,
139
140
  size: "small",
140
141
  label: this.text.printQuiz
141
142
  }, /*#__PURE__*/_react.default.createElement(_quizCommon.ModalHeader, null, /*#__PURE__*/_react.default.createElement(_uiHeading.Heading, null, this.text.printQuiz), /*#__PURE__*/_react.default.createElement(_uiButtons.CloseButton, {
@@ -194,7 +195,8 @@ var PrintFontSizeModal = (_dec = (0, _uiThemeable.themeable)(_theme.default, sty
194
195
  isOpen: _propTypes.default.bool,
195
196
  persistedPrintFontSize: _propTypes.default.string,
196
197
  onSubmit: _propTypes.default.func.isRequired,
197
- onCancel: _propTypes.default.func.isRequired
198
+ onCancel: _propTypes.default.func.isRequired,
199
+ onExited: _propTypes.default.func.isRequired
198
200
  }, _class2.defaultProps = {
199
201
  isOpen: false,
200
202
  persistedPrintFontSize: 'medium'
@@ -32,13 +32,13 @@ var _theme = _interopRequireDefault(require("./theme.js"));
32
32
  var _dec, _class, _class2, _temp;
33
33
 
34
34
  var styles = {
35
- componentId: 'bwvTI',
35
+ componentId: 'KVDkV',
36
36
  template: function template(theme) {
37
- return "\n\n.bwvTI_gasz{display:flex;font-family:".concat(theme.fontFamily || 'inherit', ";height:100%;margin:0}\n\n@media screen and (--phoneBreakPoint){.bwvTI_caGd{-webkit-overflow-scrolling:touch}}\n\n.bwvTI_caGd{transition:").concat(theme.contentTransition || 'inherit', ";width:100%}\n\n.bwvTI_dxaC{overflow-x:hidden;overflow-y:auto}");
37
+ return "\n\n.KVDkV_gasz{display:flex;font-family:".concat(theme.fontFamily || 'inherit', ";height:100%;margin:0}\n\n@media screen and (--phoneBreakPoint){.KVDkV_caGd{-webkit-overflow-scrolling:touch}}\n\n.KVDkV_caGd{transition:").concat(theme.contentTransition || 'inherit', ";width:100%}\n\n.KVDkV_dxaC{overflow-x:hidden;overflow-y:auto}\n\n@media print{.KVDkV_gasz{display:block}}");
38
38
  },
39
- 'wrapper': 'bwvTI_gasz',
40
- 'content': 'bwvTI_caGd',
41
- 'scrollable': 'bwvTI_dxaC'
39
+ 'wrapper': 'KVDkV_gasz',
40
+ 'content': 'KVDkV_caGd',
41
+ 'scrollable': 'KVDkV_dxaC'
42
42
  };
43
43
  var Page = (_dec = (0, _uiThemeable.themeable)(_theme.default, styles), _dec(_class = (_temp = _class2 = /*#__PURE__*/function (_Component) {
44
44
  (0, _inherits2.default)(Page, _Component);
@@ -42,36 +42,41 @@ var PrintTrigger = /*#__PURE__*/function (_Component) {
42
42
 
43
43
  var _super = (0, _createSuper2.default)(PrintTrigger);
44
44
 
45
- function PrintTrigger() {
45
+ function PrintTrigger(props) {
46
46
  var _this;
47
47
 
48
48
  (0, _classCallCheck2.default)(this, PrintTrigger);
49
-
50
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
51
- args[_key] = arguments[_key];
52
- }
53
-
54
- _this = _super.call.apply(_super, [this].concat(args));
49
+ _this = _super.call(this, props);
55
50
  _this.state = {
56
- waitingForImages: false,
51
+ waitingForPrintingToBeReady: false,
57
52
  printType: _quizCommon.PRINT_CURRENT_PAGE,
58
53
  // quiz key or blank quiz
59
54
  shouldPrint: false
60
55
  };
61
56
 
62
- _this.ensureImagesLoaded = function (cb) {
57
+ _this.print = function () {
58
+ (0, _printUtils.printWithCss)(_this.fontSize, 100);
59
+ };
60
+
61
+ _this.ensurePrintingIsReady = function (printFontSizeModalClose) {
63
62
  _this.setState({
64
- waitingForImages: true
63
+ waitingForPrintingToBeReady: true
65
64
  });
66
65
 
67
- (0, _printUtils.ensureImagesLoaded)().then(function () {
68
- return _this.setState({
69
- waitingForImages: false
70
- }, cb);
66
+ Promise.all([(0, _printUtils.ensureImagesLoaded)(), printFontSizeModalClose]).then(function () {
67
+ _this.setState({
68
+ waitingForPrintingToBeReady: false
69
+ });
70
+
71
+ _this.onExited = function () {};
71
72
  });
72
73
  };
73
74
 
74
75
  _this.handlePrintModalSubmit = function (fontSize, shouldPersist) {
76
+ var printFontSizeModalClose = new Promise(function (resolve) {
77
+ _this.onExited = resolve;
78
+ });
79
+
75
80
  _this.props.closePrintFontSizeModal();
76
81
 
77
82
  if (shouldPersist) {
@@ -83,12 +88,9 @@ var PrintTrigger = /*#__PURE__*/function (_Component) {
83
88
  if (_this.state.printType === _quizCommon.PRINT_BLANK) {
84
89
  _this.props.navigateToPreviewPrint();
85
90
  } else {
86
- // default to printing the current page
87
- // 400ms timeout because default transition (for print modal
88
- // to exit) is 300ms
89
- _this.ensureImagesLoaded(function () {
90
- return (0, _printUtils.printWithCss)(fontSize, 400);
91
- });
91
+ _this.fontSize = fontSize;
92
+
93
+ _this.ensurePrintingIsReady(printFontSizeModalClose);
92
94
  }
93
95
  };
94
96
 
@@ -104,6 +106,9 @@ var PrintTrigger = /*#__PURE__*/function (_Component) {
104
106
  return (0, _ElementsForSelectors.default)(_this.props.appContainer);
105
107
  };
106
108
 
109
+ _this.onExited = function () {};
110
+
111
+ _this.fontSize = '';
107
112
  return _this;
108
113
  }
109
114
 
@@ -112,9 +117,10 @@ var PrintTrigger = /*#__PURE__*/function (_Component) {
112
117
  value: function render() {
113
118
  return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_uiOverlays.Overlay, {
114
119
  applicationElement: this.applicationElement,
115
- open: this.state.waitingForImages,
120
+ open: this.state.waitingForPrintingToBeReady,
116
121
  shouldContainFocus: true,
117
122
  transition: "fade",
123
+ onExited: this.print,
118
124
  label: (0, _formatMessage.default)('Preparing Print Preview')
119
125
  }, /*#__PURE__*/_react.default.createElement(_uiOverlays.Mask, null, /*#__PURE__*/_react.default.createElement(_Spinner.QuizzesSpinner, {
120
126
  mainText: (0, _formatMessage.default)('Preparing Print Preview')
@@ -122,6 +128,7 @@ var PrintTrigger = /*#__PURE__*/function (_Component) {
122
128
  isOpen: this.props.printFontSizeModalOpen,
123
129
  onSubmit: this.handlePrintModalSubmit,
124
130
  onCancel: this.props.closePrintFontSizeModal,
131
+ onExited: this.onExited,
125
132
  persistedPrintFontSize: this.props.persistedPrintFontSize
126
133
  }), this.props.render(this.handlePrint));
127
134
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@instructure/quiz-core",
3
- "version": "17.22.2-rc.0+0021bbab6",
3
+ "version": "17.22.2-rc.1+e111d87ac",
4
4
  "license": "MIT",
5
5
  "description": "The Quiz React SDK by Instructure Inc.",
6
6
  "author": "Instructure, Inc. Engineering and Product Design",
@@ -41,11 +41,11 @@
41
41
  ],
42
42
  "dependencies": {
43
43
  "@instructure/outcomes-ui": "^2.1.2",
44
- "@instructure/quiz-common": "17.22.2-rc.0+0021bbab6",
45
- "@instructure/quiz-i18n": "17.22.2-rc.0+0021bbab6",
46
- "@instructure/quiz-interactions": "17.22.2-rc.0+0021bbab6",
47
- "@instructure/quiz-number-input": "17.22.2-rc.0+0021bbab6",
48
- "@instructure/quiz-rce": "17.22.2-rc.0+0021bbab6",
44
+ "@instructure/quiz-common": "17.22.2-rc.1+e111d87ac",
45
+ "@instructure/quiz-i18n": "17.22.2-rc.1+e111d87ac",
46
+ "@instructure/quiz-interactions": "17.22.2-rc.1+e111d87ac",
47
+ "@instructure/quiz-number-input": "17.22.2-rc.1+e111d87ac",
48
+ "@instructure/quiz-rce": "17.22.2-rc.1+e111d87ac",
49
49
  "@instructure/ui-a11y-content": "^7.11.0",
50
50
  "@instructure/ui-alerts": "^7.11.0",
51
51
  "@instructure/ui-avatar": "^7.11.0",
@@ -106,7 +106,7 @@
106
106
  "eventemitter3": "^3.1.0",
107
107
  "humps": "^2.0.0",
108
108
  "immutable": "^3.8.1",
109
- "instructure-validations": "17.22.2-rc.0+0021bbab6",
109
+ "instructure-validations": "17.22.2-rc.1+e111d87ac",
110
110
  "ipaddr.js": "^1.5.4",
111
111
  "isomorphic-fetch": "^2.2.0",
112
112
  "isuuid": "^0.1.0",
@@ -137,7 +137,7 @@
137
137
  "uuid": "^3.2.1"
138
138
  },
139
139
  "devDependencies": {
140
- "@instructure/quiz-scripts": "17.22.2-rc.0+0021bbab6",
140
+ "@instructure/quiz-scripts": "17.22.2-rc.1+e111d87ac",
141
141
  "@instructure/ui-axe-check": "^7.11.0",
142
142
  "@instructure/ui-babel-preset": "^7.11.0",
143
143
  "@instructure/ui-karma-config": "^7.11.0",
@@ -156,7 +156,7 @@
156
156
  "intl": "^1.2.4",
157
157
  "jquery": "^2.2.3",
158
158
  "most-subject": "^5.3.0",
159
- "quiz-presets": "17.22.2-rc.0+0021bbab6",
159
+ "quiz-presets": "17.22.2-rc.1+e111d87ac",
160
160
  "react": "^16.8.6",
161
161
  "react-addons-test-utils": "^15.6.2",
162
162
  "react-dom": "^16.8.6",
@@ -172,5 +172,5 @@
172
172
  "publishConfig": {
173
173
  "access": "public"
174
174
  },
175
- "gitHead": "0021bbab61162ff6f16f1ba58a910a1cdd28b72b"
175
+ "gitHead": "e111d87ac50f9213db4232c74b1f3c638b0494e7"
176
176
  }