@instructure/quiz-core 20.25.0 → 20.26.1-snapshot.4
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.
- package/CHANGELOG.md +4643 -0
- package/es/banks/components/AddToBankModal/presenter.js +10 -11
- package/es/building/components/resources/ActionButtons/presenter.js +3 -2
- package/es/building/components/resources/quiz/instructions/Edit/presenter.js +5 -5
- package/es/building/components/resources/quizEntry/QuizEntryEdit/presenter.js +5 -7
- package/es/common/components/layout/sidebar/Sidebar/index.js +5 -3
- package/es/common/components/layout/sidebar/SidebarItem/presenter.js +5 -2
- package/es/common/components/layout/sidebar/Stimulus/presenter.js +3 -1
- package/es/common/components/resources/quiz/AddContent/Button/index.js +2 -0
- package/es/common/components/resources/stimulus/StimulusEdit/presenter.js +5 -7
- package/es/common/components/shared/overlay/index.js +3 -1
- package/es/common/util/clickHandlers.js +19 -0
- package/lib/banks/components/AddToBankModal/presenter.js +9 -10
- package/lib/building/components/resources/ActionButtons/presenter.js +2 -1
- package/lib/building/components/resources/quiz/instructions/Edit/presenter.js +5 -5
- package/lib/building/components/resources/quizEntry/QuizEntryEdit/presenter.js +5 -7
- package/lib/common/components/layout/sidebar/Sidebar/index.js +4 -2
- package/lib/common/components/layout/sidebar/SidebarItem/presenter.js +5 -2
- package/lib/common/components/layout/sidebar/Stimulus/presenter.js +3 -1
- package/lib/common/components/resources/quiz/AddContent/Button/index.js +2 -0
- package/lib/common/components/resources/stimulus/StimulusEdit/presenter.js +5 -7
- package/lib/common/components/shared/overlay/index.js +3 -1
- package/lib/common/util/clickHandlers.js +26 -0
- package/package.json +11 -10
|
@@ -16,25 +16,22 @@ import Bank from "../../../common/records/Bank.js";
|
|
|
16
16
|
import BankSelection from "../../../common/components/resources/BankSelection/index.js";
|
|
17
17
|
import { Spinner } from '@instructure/ui-spinner';
|
|
18
18
|
import { Text } from '@instructure/ui-text';
|
|
19
|
-
import {
|
|
19
|
+
import { IconNoLine, IconWarningLine } from '@instructure/ui-icons';
|
|
20
20
|
import { View } from '@instructure/ui-view';
|
|
21
21
|
import { Flex } from '@instructure/ui-flex';
|
|
22
22
|
import t from '@instructure/quiz-i18n/es/format-message';
|
|
23
23
|
import { Modal, ModalHeader, ModalBody, ModalFooter, ADD_TO_BANK_MODAL_BANK_SELECTION, XSMALL_SIDE_MARGIN } from '@instructure/quiz-common';
|
|
24
24
|
import { featureOn } from "../../../common/util/featureCheck.js";
|
|
25
|
-
var _ref2 = /*#__PURE__*/React.createElement(
|
|
26
|
-
color: "success"
|
|
27
|
-
});
|
|
28
|
-
var _ref3 = /*#__PURE__*/React.createElement(Flex.Item, {
|
|
25
|
+
var _ref2 = /*#__PURE__*/React.createElement(Flex.Item, {
|
|
29
26
|
padding: "0 small 0 0"
|
|
30
27
|
}, /*#__PURE__*/React.createElement(IconNoLine, {
|
|
31
28
|
color: "error",
|
|
32
29
|
size: "small"
|
|
33
30
|
}));
|
|
34
|
-
var
|
|
31
|
+
var _ref3 = /*#__PURE__*/React.createElement(IconWarningLine, {
|
|
35
32
|
color: "warning"
|
|
36
33
|
});
|
|
37
|
-
var
|
|
34
|
+
var _ref4 = /*#__PURE__*/React.createElement("br", null);
|
|
38
35
|
export var AddToBankModal = /*#__PURE__*/function (_Component) {
|
|
39
36
|
_inherits(AddToBankModal, _Component);
|
|
40
37
|
var _super = _createSuper(AddToBankModal);
|
|
@@ -211,9 +208,11 @@ export var AddToBankModal = /*#__PURE__*/function (_Component) {
|
|
|
211
208
|
renderTitle: t('Checking content shareability...')
|
|
212
209
|
}), "\xA0", t('Validating content...'));
|
|
213
210
|
} else if (this.state.contentShareable === 'true') {
|
|
214
|
-
|
|
211
|
+
// No message needed. The API call to check shareability is very fast in most cases,
|
|
212
|
+
// so the user may be distracted by a message here.
|
|
213
|
+
content = null;
|
|
215
214
|
} else if (this.state.contentShareable === 'false') {
|
|
216
|
-
content = /*#__PURE__*/React.createElement(Flex, null,
|
|
215
|
+
content = /*#__PURE__*/React.createElement(Flex, null, _ref2, /*#__PURE__*/React.createElement(Flex.Item, {
|
|
217
216
|
shouldShrink: true
|
|
218
217
|
}, /*#__PURE__*/React.createElement(Text, {
|
|
219
218
|
color: "danger"
|
|
@@ -221,7 +220,7 @@ export var AddToBankModal = /*#__PURE__*/function (_Component) {
|
|
|
221
220
|
} else {
|
|
222
221
|
content = /*#__PURE__*/React.createElement(Text, {
|
|
223
222
|
color: "warning"
|
|
224
|
-
},
|
|
223
|
+
}, _ref3, "\xA0", t('There was an error attempting to validate shareability.'));
|
|
225
224
|
}
|
|
226
225
|
return /*#__PURE__*/React.createElement(View, {
|
|
227
226
|
as: "div",
|
|
@@ -243,7 +242,7 @@ export var AddToBankModal = /*#__PURE__*/function (_Component) {
|
|
|
243
242
|
}), /*#__PURE__*/React.createElement(RadioInput, {
|
|
244
243
|
value: "new",
|
|
245
244
|
label: t('New item bank')
|
|
246
|
-
})),
|
|
245
|
+
})), _ref4, this.renderBankTypeContent(), this.renderContentShareabilityMessage());
|
|
247
246
|
}
|
|
248
247
|
}, {
|
|
249
248
|
key: "render",
|
|
@@ -13,7 +13,7 @@ import { withStyle, jsx, Global } from '@instructure/emotion';
|
|
|
13
13
|
import DragHandle from "../../../../common/components/shared/drag_and_drop/DragHandle/index.js";
|
|
14
14
|
import makeScrollable from "../../../../common/components/shared/functionality/makeScrollable.js";
|
|
15
15
|
import noop from "../../../../common/util/noop.js";
|
|
16
|
-
import { EDIT, REMOVE, COPY } from '@instructure/quiz-common';
|
|
16
|
+
import { EDIT, REMOVE, COPY, END_EDITING_TRIGGER_CLASSNAME } from '@instructure/quiz-common';
|
|
17
17
|
import generateStyle from "./styles.js";
|
|
18
18
|
import generateComponentTheme from "./theme.js";
|
|
19
19
|
var ScrollTargetButton = makeScrollable(IconButton);
|
|
@@ -71,8 +71,9 @@ export var ActionButtons = (_dec = withStyle(generateStyle, generateComponentThe
|
|
|
71
71
|
key: "render",
|
|
72
72
|
value: function render() {
|
|
73
73
|
var hideClass = !this.props.shouldRenderEdit ? 'hide' : '';
|
|
74
|
+
var parentDivClass = "buttons ".concat(END_EDITING_TRIGGER_CLASSNAME);
|
|
74
75
|
return jsx("div", {
|
|
75
|
-
className:
|
|
76
|
+
className: parentDivClass,
|
|
76
77
|
tabIndex: "-1",
|
|
77
78
|
onFocus: this.onButtonFocus,
|
|
78
79
|
css: this.props.styles.buttons
|
|
@@ -10,7 +10,7 @@ import { Button } from '@instructure/ui-buttons';
|
|
|
10
10
|
import { withStyle, jsx } from '@instructure/emotion';
|
|
11
11
|
import t from '@instructure/quiz-i18n/es/format-message';
|
|
12
12
|
import CustomPropTypes from "../../../../../../common/util/CustomPropTypes.js";
|
|
13
|
-
import
|
|
13
|
+
import { checkClickedNode } from "../../../../../../common/util/clickHandlers.js";
|
|
14
14
|
import { INSTRUCTIONS_EDIT_ID } from '@instructure/quiz-common';
|
|
15
15
|
import { RichContentInput } from '@instructure/quiz-rce';
|
|
16
16
|
import generateStyle from "./styles.js";
|
|
@@ -36,10 +36,10 @@ var QuizInstructionsEdit = (_dec = withStyle(generateStyle, generateComponentThe
|
|
|
36
36
|
}, {
|
|
37
37
|
key: "ignoreClickOutsideIf",
|
|
38
38
|
value: function ignoreClickOutsideIf(e) {
|
|
39
|
-
var
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
39
|
+
var _checkClickedNode = checkClickedNode(e, this.props.appContainer),
|
|
40
|
+
isEndEditingTrigger = _checkClickedNode.isEndEditingTrigger,
|
|
41
|
+
outsideApp = _checkClickedNode.outsideApp;
|
|
42
|
+
return outsideApp || !isEndEditingTrigger;
|
|
43
43
|
}
|
|
44
44
|
}, {
|
|
45
45
|
key: "render",
|
|
@@ -16,10 +16,10 @@ import first from 'lodash/first';
|
|
|
16
16
|
import { withStyle, jsx, Global } from '@instructure/emotion';
|
|
17
17
|
import t from '@instructure/quiz-i18n/es/format-message';
|
|
18
18
|
import CustomPropTypes from "../../../../../common/util/CustomPropTypes.js";
|
|
19
|
-
import elementsForSelectors from "../../../../../common/util/ElementsForSelectors.js";
|
|
20
19
|
import AddToBankModal from "../../../../../banks/components/AddToBankModal/index.js";
|
|
21
20
|
import DragAndDropZone from "../../../../../common/components/shared/drag_and_drop/DragAndDropZone/index.js";
|
|
22
21
|
import wrapWithOutsideClickEmotion from "../../../../../common/components/shared/functionality/componentWithOutsideClickEmotion.js";
|
|
22
|
+
import { checkClickedNode } from "../../../../../common/util/clickHandlers.js";
|
|
23
23
|
import QuizEntryEditHeader from "./Header/index.js";
|
|
24
24
|
import QuizEntryEditFooter from "./Footer/index.js";
|
|
25
25
|
import { SHOULD_CLONE_ITEM, TEMPORARY_ITEM_ID, DELETED_QUIZ_ENTRY, API_INPUT_VALIDATION_ERROR, CLEAR_ALL_INPUT_VALIDATION_ERRORS, PARENT_TYPE_ADDING_TO_BANK } from '@instructure/quiz-common';
|
|
@@ -294,12 +294,10 @@ var QuizEntryEdit = (_dec = withStyle(generateStyle, generateComponentTheme), _d
|
|
|
294
294
|
}, {
|
|
295
295
|
key: "ignoreClickOutsideIf",
|
|
296
296
|
value: function ignoreClickOutsideIf(e) {
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
});
|
|
302
|
-
return this.props.isOccluded || outsideApp;
|
|
297
|
+
var _checkClickedNode = checkClickedNode(e, this.props.appContainer),
|
|
298
|
+
isEndEditingTrigger = _checkClickedNode.isEndEditingTrigger,
|
|
299
|
+
outsideApp = _checkClickedNode.outsideApp;
|
|
300
|
+
return this.props.isOccluded || outsideApp || !isEndEditingTrigger;
|
|
303
301
|
}
|
|
304
302
|
}, {
|
|
305
303
|
key: "isValid",
|
|
@@ -19,7 +19,7 @@ import { View } from '@instructure/ui-view';
|
|
|
19
19
|
import { withStyle, jsx, Global } from '@instructure/emotion';
|
|
20
20
|
import { Heading } from '@instructure/ui-heading';
|
|
21
21
|
import t from '@instructure/quiz-i18n/es/format-message';
|
|
22
|
-
import { INSTRUCTIONS_SCROLL_KEY, RESULTS_SCROLL_KEY, SIDEBAR_NAV_ID, TITLE_SCROLL_KEY } from '@instructure/quiz-common';
|
|
22
|
+
import { INSTRUCTIONS_SCROLL_KEY, RESULTS_SCROLL_KEY, SIDEBAR_NAV_ID, TITLE_SCROLL_KEY, END_EDITING_TRIGGER_CLASSNAME } from '@instructure/quiz-common';
|
|
23
23
|
import { onPhone } from "../../../../util/windowChecks.js";
|
|
24
24
|
import CustomPropTypes from "../../../../util/CustomPropTypes.js";
|
|
25
25
|
import noop from "../../../../util/noop.js";
|
|
@@ -105,7 +105,8 @@ export var Sidebar = (_dec = withStyle(generateStyle, generateComponentTheme), _
|
|
|
105
105
|
return;
|
|
106
106
|
}
|
|
107
107
|
return jsx("div", {
|
|
108
|
-
css: this.props.styles.sidebar.actionableInfo
|
|
108
|
+
css: this.props.styles.sidebar.actionableInfo,
|
|
109
|
+
className: END_EDITING_TRIGGER_CLASSNAME
|
|
109
110
|
}, jsx(Link, {
|
|
110
111
|
href: "#",
|
|
111
112
|
margin: "small",
|
|
@@ -127,7 +128,8 @@ export var Sidebar = (_dec = withStyle(generateStyle, generateComponentTheme), _
|
|
|
127
128
|
return;
|
|
128
129
|
}
|
|
129
130
|
return jsx("div", {
|
|
130
|
-
css: this.props.styles.sidebar.actionableInfo
|
|
131
|
+
css: this.props.styles.sidebar.actionableInfo,
|
|
132
|
+
className: END_EDITING_TRIGGER_CLASSNAME
|
|
131
133
|
}, jsx(Link, {
|
|
132
134
|
href: "#",
|
|
133
135
|
margin: "small",
|
|
@@ -16,6 +16,7 @@ import t from '@instructure/quiz-i18n/es/format-message';
|
|
|
16
16
|
import { RichContentRenderer } from '@instructure/quiz-rce';
|
|
17
17
|
import generateStyle from "./styles.js";
|
|
18
18
|
import generateComponentTheme from "./theme.js";
|
|
19
|
+
import { END_EDITING_TRIGGER_CLASSNAME } from '@instructure/quiz-common';
|
|
19
20
|
export var SidebarItem = (_dec = withStyle(generateStyle, generateComponentTheme), _dec(_class = (_SidebarItem = /*#__PURE__*/function (_Component) {
|
|
20
21
|
_inherits(SidebarItem, _Component);
|
|
21
22
|
var _super = _createSuper(SidebarItem);
|
|
@@ -110,7 +111,8 @@ export var SidebarItem = (_dec = withStyle(generateStyle, generateComponentTheme
|
|
|
110
111
|
key: "renderClosed",
|
|
111
112
|
value: function renderClosed() {
|
|
112
113
|
return jsx("div", {
|
|
113
|
-
css: this.props.styles.sidebarItem
|
|
114
|
+
css: this.props.styles.sidebarItem,
|
|
115
|
+
className: END_EDITING_TRIGGER_CLASSNAME
|
|
114
116
|
}, this.renderButton());
|
|
115
117
|
}
|
|
116
118
|
}, {
|
|
@@ -121,8 +123,9 @@ export var SidebarItem = (_dec = withStyle(generateStyle, generateComponentTheme
|
|
|
121
123
|
itemName = _this$props3.itemName,
|
|
122
124
|
pointsPossible = _this$props3.pointsPossible,
|
|
123
125
|
styles = _this$props3.styles;
|
|
126
|
+
var parentDivClass = "sidebarIsOpen ".concat(END_EDITING_TRIGGER_CLASSNAME);
|
|
124
127
|
return jsx("div", {
|
|
125
|
-
className:
|
|
128
|
+
className: parentDivClass,
|
|
126
129
|
css: styles.sidebarItem
|
|
127
130
|
}, jsx(Flex, {
|
|
128
131
|
justifyItems: "space-between"
|
|
@@ -18,6 +18,7 @@ import Summary from "./Summary/index.js";
|
|
|
18
18
|
import generateStyle from "./styles.js";
|
|
19
19
|
import generateComponentTheme from "./theme.js";
|
|
20
20
|
import t from '@instructure/quiz-i18n/es/format-message';
|
|
21
|
+
import { END_EDITING_TRIGGER_CLASSNAME } from '@instructure/quiz-common';
|
|
21
22
|
export var DISPLAY_AS_SUMMARY_LIMIT = 5;
|
|
22
23
|
var _ref = jsx(IconTextLeftLine, {
|
|
23
24
|
color: "primary"
|
|
@@ -82,7 +83,8 @@ export var SidebarStimulus = (_dec = withStyle(generateStyle, generateComponentT
|
|
|
82
83
|
margin: "small",
|
|
83
84
|
forceButtonRole: false,
|
|
84
85
|
onClick: this.scrollToItem,
|
|
85
|
-
renderIcon: _ref
|
|
86
|
+
renderIcon: _ref,
|
|
87
|
+
className: END_EDITING_TRIGGER_CLASSNAME
|
|
86
88
|
}, jsx(ScreenReaderContent, null, t('Navigate to stimulus at position { displayPosition }', {
|
|
87
89
|
displayPosition: displayPosition
|
|
88
90
|
})));
|
|
@@ -13,6 +13,7 @@ import { withStyle, jsx } from '@instructure/emotion';
|
|
|
13
13
|
import t from '@instructure/quiz-i18n/es/format-message';
|
|
14
14
|
import generateStyle from "./styles.js";
|
|
15
15
|
import generateComponentTheme from "./theme.js";
|
|
16
|
+
import { END_EDITING_TRIGGER_CLASSNAME } from '@instructure/quiz-common';
|
|
16
17
|
export var AddContentButton = (_dec = withStyle(generateStyle, generateComponentTheme), _dec(_class = (_AddContentButton = /*#__PURE__*/function (_Component) {
|
|
17
18
|
_inherits(AddContentButton, _Component);
|
|
18
19
|
var _super = _createSuper(AddContentButton);
|
|
@@ -60,6 +61,7 @@ export var AddContentButton = (_dec = withStyle(generateStyle, generateComponent
|
|
|
60
61
|
key: "renderNonStimulus",
|
|
61
62
|
value: function renderNonStimulus() {
|
|
62
63
|
return jsx("div", {
|
|
64
|
+
className: END_EDITING_TRIGGER_CLASSNAME,
|
|
63
65
|
css: this.props.styles.newItemButtonHolder
|
|
64
66
|
}, jsx("button", {
|
|
65
67
|
ref: this.storeButtonElemRef,
|
|
@@ -21,7 +21,7 @@ import AddToBankModal from "../../../../../banks/components/AddToBankModal/index
|
|
|
21
21
|
import AddToBankOptions from "../../../../../building/components/resources/AddToBankOptions/index.js";
|
|
22
22
|
import WarningWrapper from "../../WarningWrapper/index.js";
|
|
23
23
|
import CustomPropTypes from "../../../../../common/util/CustomPropTypes.js";
|
|
24
|
-
import
|
|
24
|
+
import { checkClickedNode } from "../../../../../common/util/clickHandlers.js";
|
|
25
25
|
import StimulusShowInfo from "../StimulusShowInfo/index.js";
|
|
26
26
|
import StimulusEditInfo from "../StimulusEditInfo/index.js";
|
|
27
27
|
import wrapWithOutsideClickEmotion from "../../../shared/functionality/componentWithOutsideClickEmotion.js";
|
|
@@ -286,12 +286,10 @@ export var StimulusEdit = (_dec = withStyle(generateStyle, generateComponentThem
|
|
|
286
286
|
}, {
|
|
287
287
|
key: "ignoreClickOutsideIf",
|
|
288
288
|
value: function ignoreClickOutsideIf(e) {
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
});
|
|
294
|
-
return outsideApp;
|
|
289
|
+
var _checkClickedNode = checkClickedNode(e, this.props.appContainer),
|
|
290
|
+
isEndEditingTrigger = _checkClickedNode.isEndEditingTrigger,
|
|
291
|
+
outsideApp = _checkClickedNode.outsideApp;
|
|
292
|
+
return outsideApp || !isEndEditingTrigger;
|
|
295
293
|
}
|
|
296
294
|
}, {
|
|
297
295
|
key: "afterSubmit",
|
|
@@ -18,6 +18,7 @@ import PropTypes from 'prop-types';
|
|
|
18
18
|
import { withStyle, jsx, Global } from '@instructure/emotion';
|
|
19
19
|
import generateStyle from "./styles.js";
|
|
20
20
|
import generateComponentTheme from "./theme.js";
|
|
21
|
+
import { END_EDITING_TRIGGER_CLASSNAME } from '@instructure/quiz-common';
|
|
21
22
|
var Overlay = (_dec = withStyle(generateStyle, generateComponentTheme), _dec(_class = (_Overlay = /*#__PURE__*/function (_Component) {
|
|
22
23
|
_inherits(Overlay, _Component);
|
|
23
24
|
var _super = _createSuper(Overlay);
|
|
@@ -31,9 +32,10 @@ var Overlay = (_dec = withStyle(generateStyle, generateComponentTheme), _dec(_cl
|
|
|
31
32
|
if (this.props.hideOverlay) {
|
|
32
33
|
return null;
|
|
33
34
|
}
|
|
35
|
+
var overlayClass = "overlay ".concat(END_EDITING_TRIGGER_CLASSNAME);
|
|
34
36
|
return jsx("div", {
|
|
35
37
|
role: "presentation",
|
|
36
|
-
className:
|
|
38
|
+
className: overlayClass,
|
|
37
39
|
css: this.props.styles.overlay,
|
|
38
40
|
onClick: this.props.onClick,
|
|
39
41
|
"data-automation": "sdk-overlay"
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import elementsForSelectors from "./ElementsForSelectors.js";
|
|
2
|
+
import { END_EDITING_TRIGGER_CLASSNAME } from '@instructure/quiz-common';
|
|
3
|
+
export function checkClickedNode(e, appContainer) {
|
|
4
|
+
// Need to iterate over the appNodes since Gauge and lti have a different index for the sdk node
|
|
5
|
+
var appNodes = elementsForSelectors(appContainer);
|
|
6
|
+
var outsideApp = appNodes.every(function (node) {
|
|
7
|
+
return node && !node.contains(e.target);
|
|
8
|
+
});
|
|
9
|
+
|
|
10
|
+
// checking if the click was on an element that should end editing
|
|
11
|
+
var endEditingNodes = elementsForSelectors(".".concat(END_EDITING_TRIGGER_CLASSNAME));
|
|
12
|
+
var isEndEditingTrigger = endEditingNodes.some(function (node) {
|
|
13
|
+
return node && node.contains(e.target);
|
|
14
|
+
});
|
|
15
|
+
return {
|
|
16
|
+
isEndEditingTrigger: isEndEditingTrigger,
|
|
17
|
+
outsideApp: outsideApp
|
|
18
|
+
};
|
|
19
|
+
}
|
|
@@ -30,19 +30,16 @@ var _uiFlex = require("@instructure/ui-flex");
|
|
|
30
30
|
var _formatMessage = _interopRequireDefault(require("@instructure/quiz-i18n/es/format-message"));
|
|
31
31
|
var _quizCommon = require("@instructure/quiz-common");
|
|
32
32
|
var _featureCheck = require("../../../common/util/featureCheck.js");
|
|
33
|
-
var _ref2 = /*#__PURE__*/_react.default.createElement(
|
|
34
|
-
color: "success"
|
|
35
|
-
});
|
|
36
|
-
var _ref3 = /*#__PURE__*/_react.default.createElement(_uiFlex.Flex.Item, {
|
|
33
|
+
var _ref2 = /*#__PURE__*/_react.default.createElement(_uiFlex.Flex.Item, {
|
|
37
34
|
padding: "0 small 0 0"
|
|
38
35
|
}, /*#__PURE__*/_react.default.createElement(_uiIcons.IconNoLine, {
|
|
39
36
|
color: "error",
|
|
40
37
|
size: "small"
|
|
41
38
|
}));
|
|
42
|
-
var
|
|
39
|
+
var _ref3 = /*#__PURE__*/_react.default.createElement(_uiIcons.IconWarningLine, {
|
|
43
40
|
color: "warning"
|
|
44
41
|
});
|
|
45
|
-
var
|
|
42
|
+
var _ref4 = /*#__PURE__*/_react.default.createElement("br", null);
|
|
46
43
|
var AddToBankModal = /*#__PURE__*/function (_Component) {
|
|
47
44
|
(0, _inherits2.default)(AddToBankModal, _Component);
|
|
48
45
|
var _super = (0, _createSuper2.default)(AddToBankModal);
|
|
@@ -219,9 +216,11 @@ var AddToBankModal = /*#__PURE__*/function (_Component) {
|
|
|
219
216
|
renderTitle: (0, _formatMessage.default)('Checking content shareability...')
|
|
220
217
|
}), "\xA0", (0, _formatMessage.default)('Validating content...'));
|
|
221
218
|
} else if (this.state.contentShareable === 'true') {
|
|
222
|
-
|
|
219
|
+
// No message needed. The API call to check shareability is very fast in most cases,
|
|
220
|
+
// so the user may be distracted by a message here.
|
|
221
|
+
content = null;
|
|
223
222
|
} else if (this.state.contentShareable === 'false') {
|
|
224
|
-
content = /*#__PURE__*/_react.default.createElement(_uiFlex.Flex, null,
|
|
223
|
+
content = /*#__PURE__*/_react.default.createElement(_uiFlex.Flex, null, _ref2, /*#__PURE__*/_react.default.createElement(_uiFlex.Flex.Item, {
|
|
225
224
|
shouldShrink: true
|
|
226
225
|
}, /*#__PURE__*/_react.default.createElement(_uiText.Text, {
|
|
227
226
|
color: "danger"
|
|
@@ -229,7 +228,7 @@ var AddToBankModal = /*#__PURE__*/function (_Component) {
|
|
|
229
228
|
} else {
|
|
230
229
|
content = /*#__PURE__*/_react.default.createElement(_uiText.Text, {
|
|
231
230
|
color: "warning"
|
|
232
|
-
},
|
|
231
|
+
}, _ref3, "\xA0", (0, _formatMessage.default)('There was an error attempting to validate shareability.'));
|
|
233
232
|
}
|
|
234
233
|
return /*#__PURE__*/_react.default.createElement(_uiView.View, {
|
|
235
234
|
as: "div",
|
|
@@ -251,7 +250,7 @@ var AddToBankModal = /*#__PURE__*/function (_Component) {
|
|
|
251
250
|
}), /*#__PURE__*/_react.default.createElement(_uiRadioInput.RadioInput, {
|
|
252
251
|
value: "new",
|
|
253
252
|
label: (0, _formatMessage.default)('New item bank')
|
|
254
|
-
})),
|
|
253
|
+
})), _ref4, this.renderBankTypeContent(), this.renderContentShareabilityMessage());
|
|
255
254
|
}
|
|
256
255
|
}, {
|
|
257
256
|
key: "render",
|
|
@@ -78,8 +78,9 @@ var ActionButtons = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.defa
|
|
|
78
78
|
key: "render",
|
|
79
79
|
value: function render() {
|
|
80
80
|
var hideClass = !this.props.shouldRenderEdit ? 'hide' : '';
|
|
81
|
+
var parentDivClass = "buttons ".concat(_quizCommon.END_EDITING_TRIGGER_CLASSNAME);
|
|
81
82
|
return (0, _emotion.jsx)("div", {
|
|
82
|
-
className:
|
|
83
|
+
className: parentDivClass,
|
|
83
84
|
tabIndex: "-1",
|
|
84
85
|
onFocus: this.onButtonFocus,
|
|
85
86
|
css: this.props.styles.buttons
|
|
@@ -15,7 +15,7 @@ var _uiButtons = require("@instructure/ui-buttons");
|
|
|
15
15
|
var _emotion = require("@instructure/emotion");
|
|
16
16
|
var _formatMessage = _interopRequireDefault(require("@instructure/quiz-i18n/es/format-message"));
|
|
17
17
|
var _CustomPropTypes = _interopRequireDefault(require("../../../../../../common/util/CustomPropTypes.js"));
|
|
18
|
-
var
|
|
18
|
+
var _clickHandlers = require("../../../../../../common/util/clickHandlers.js");
|
|
19
19
|
var _quizCommon = require("@instructure/quiz-common");
|
|
20
20
|
var _quizRce = require("@instructure/quiz-rce");
|
|
21
21
|
var _styles = _interopRequireDefault(require("./styles.js"));
|
|
@@ -44,10 +44,10 @@ var QuizInstructionsEdit = (_dec = (0, _emotion.withStyle)(_styles.default, _the
|
|
|
44
44
|
}, {
|
|
45
45
|
key: "ignoreClickOutsideIf",
|
|
46
46
|
value: function ignoreClickOutsideIf(e) {
|
|
47
|
-
var
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
47
|
+
var _checkClickedNode = (0, _clickHandlers.checkClickedNode)(e, this.props.appContainer),
|
|
48
|
+
isEndEditingTrigger = _checkClickedNode.isEndEditingTrigger,
|
|
49
|
+
outsideApp = _checkClickedNode.outsideApp;
|
|
50
|
+
return outsideApp || !isEndEditingTrigger;
|
|
51
51
|
}
|
|
52
52
|
}, {
|
|
53
53
|
key: "render",
|
|
@@ -21,10 +21,10 @@ var _first = _interopRequireDefault(require("lodash/first"));
|
|
|
21
21
|
var _emotion = require("@instructure/emotion");
|
|
22
22
|
var _formatMessage = _interopRequireDefault(require("@instructure/quiz-i18n/es/format-message"));
|
|
23
23
|
var _CustomPropTypes = _interopRequireDefault(require("../../../../../common/util/CustomPropTypes.js"));
|
|
24
|
-
var _ElementsForSelectors = _interopRequireDefault(require("../../../../../common/util/ElementsForSelectors.js"));
|
|
25
24
|
var _index = _interopRequireDefault(require("../../../../../banks/components/AddToBankModal/index.js"));
|
|
26
25
|
var _index2 = _interopRequireDefault(require("../../../../../common/components/shared/drag_and_drop/DragAndDropZone/index.js"));
|
|
27
26
|
var _componentWithOutsideClickEmotion = _interopRequireDefault(require("../../../../../common/components/shared/functionality/componentWithOutsideClickEmotion.js"));
|
|
27
|
+
var _clickHandlers = require("../../../../../common/util/clickHandlers.js");
|
|
28
28
|
var _index3 = _interopRequireDefault(require("./Header/index.js"));
|
|
29
29
|
var _index4 = _interopRequireDefault(require("./Footer/index.js"));
|
|
30
30
|
var _quizCommon = require("@instructure/quiz-common");
|
|
@@ -302,12 +302,10 @@ var QuizEntryEdit = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.defa
|
|
|
302
302
|
}, {
|
|
303
303
|
key: "ignoreClickOutsideIf",
|
|
304
304
|
value: function ignoreClickOutsideIf(e) {
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
});
|
|
310
|
-
return this.props.isOccluded || outsideApp;
|
|
305
|
+
var _checkClickedNode = (0, _clickHandlers.checkClickedNode)(e, this.props.appContainer),
|
|
306
|
+
isEndEditingTrigger = _checkClickedNode.isEndEditingTrigger,
|
|
307
|
+
outsideApp = _checkClickedNode.outsideApp;
|
|
308
|
+
return this.props.isOccluded || outsideApp || !isEndEditingTrigger;
|
|
311
309
|
}
|
|
312
310
|
}, {
|
|
313
311
|
key: "isValid",
|
|
@@ -112,7 +112,8 @@ var Sidebar = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default),
|
|
|
112
112
|
return;
|
|
113
113
|
}
|
|
114
114
|
return (0, _emotion.jsx)("div", {
|
|
115
|
-
css: this.props.styles.sidebar.actionableInfo
|
|
115
|
+
css: this.props.styles.sidebar.actionableInfo,
|
|
116
|
+
className: _quizCommon.END_EDITING_TRIGGER_CLASSNAME
|
|
116
117
|
}, (0, _emotion.jsx)(_uiLink.Link, {
|
|
117
118
|
href: "#",
|
|
118
119
|
margin: "small",
|
|
@@ -134,7 +135,8 @@ var Sidebar = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default),
|
|
|
134
135
|
return;
|
|
135
136
|
}
|
|
136
137
|
return (0, _emotion.jsx)("div", {
|
|
137
|
-
css: this.props.styles.sidebar.actionableInfo
|
|
138
|
+
css: this.props.styles.sidebar.actionableInfo,
|
|
139
|
+
className: _quizCommon.END_EDITING_TRIGGER_CLASSNAME
|
|
138
140
|
}, (0, _emotion.jsx)(_uiLink.Link, {
|
|
139
141
|
href: "#",
|
|
140
142
|
margin: "small",
|
|
@@ -21,6 +21,7 @@ var _formatMessage = _interopRequireDefault(require("@instructure/quiz-i18n/es/f
|
|
|
21
21
|
var _quizRce = require("@instructure/quiz-rce");
|
|
22
22
|
var _styles = _interopRequireDefault(require("./styles.js"));
|
|
23
23
|
var _theme = _interopRequireDefault(require("./theme.js"));
|
|
24
|
+
var _quizCommon = require("@instructure/quiz-common");
|
|
24
25
|
var _dec, _class, _SidebarItem;
|
|
25
26
|
/** @jsx jsx */
|
|
26
27
|
var SidebarItem = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _dec(_class = (_SidebarItem = /*#__PURE__*/function (_Component) {
|
|
@@ -117,7 +118,8 @@ var SidebarItem = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.defaul
|
|
|
117
118
|
key: "renderClosed",
|
|
118
119
|
value: function renderClosed() {
|
|
119
120
|
return (0, _emotion.jsx)("div", {
|
|
120
|
-
css: this.props.styles.sidebarItem
|
|
121
|
+
css: this.props.styles.sidebarItem,
|
|
122
|
+
className: _quizCommon.END_EDITING_TRIGGER_CLASSNAME
|
|
121
123
|
}, this.renderButton());
|
|
122
124
|
}
|
|
123
125
|
}, {
|
|
@@ -128,8 +130,9 @@ var SidebarItem = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.defaul
|
|
|
128
130
|
itemName = _this$props3.itemName,
|
|
129
131
|
pointsPossible = _this$props3.pointsPossible,
|
|
130
132
|
styles = _this$props3.styles;
|
|
133
|
+
var parentDivClass = "sidebarIsOpen ".concat(_quizCommon.END_EDITING_TRIGGER_CLASSNAME);
|
|
131
134
|
return (0, _emotion.jsx)("div", {
|
|
132
|
-
className:
|
|
135
|
+
className: parentDivClass,
|
|
133
136
|
css: styles.sidebarItem
|
|
134
137
|
}, (0, _emotion.jsx)(_uiFlex.Flex, {
|
|
135
138
|
justifyItems: "space-between"
|
|
@@ -23,6 +23,7 @@ var _index3 = _interopRequireDefault(require("./Summary/index.js"));
|
|
|
23
23
|
var _styles = _interopRequireDefault(require("./styles.js"));
|
|
24
24
|
var _theme = _interopRequireDefault(require("./theme.js"));
|
|
25
25
|
var _formatMessage = _interopRequireDefault(require("@instructure/quiz-i18n/es/format-message"));
|
|
26
|
+
var _quizCommon = require("@instructure/quiz-common");
|
|
26
27
|
var _dec, _class, _SidebarStimulus;
|
|
27
28
|
/** @jsx jsx */
|
|
28
29
|
var DISPLAY_AS_SUMMARY_LIMIT = 5;
|
|
@@ -90,7 +91,8 @@ var SidebarStimulus = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.de
|
|
|
90
91
|
margin: "small",
|
|
91
92
|
forceButtonRole: false,
|
|
92
93
|
onClick: this.scrollToItem,
|
|
93
|
-
renderIcon: _ref
|
|
94
|
+
renderIcon: _ref,
|
|
95
|
+
className: _quizCommon.END_EDITING_TRIGGER_CLASSNAME
|
|
94
96
|
}, (0, _emotion.jsx)(_uiA11yContent.ScreenReaderContent, null, (0, _formatMessage.default)('Navigate to stimulus at position { displayPosition }', {
|
|
95
97
|
displayPosition: displayPosition
|
|
96
98
|
})));
|
|
@@ -18,6 +18,7 @@ var _emotion = require("@instructure/emotion");
|
|
|
18
18
|
var _formatMessage = _interopRequireDefault(require("@instructure/quiz-i18n/es/format-message"));
|
|
19
19
|
var _styles = _interopRequireDefault(require("./styles.js"));
|
|
20
20
|
var _theme = _interopRequireDefault(require("./theme.js"));
|
|
21
|
+
var _quizCommon = require("@instructure/quiz-common");
|
|
21
22
|
var _dec, _class, _AddContentButton;
|
|
22
23
|
/** @jsx jsx */
|
|
23
24
|
var AddContentButton = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _dec(_class = (_AddContentButton = /*#__PURE__*/function (_Component) {
|
|
@@ -67,6 +68,7 @@ var AddContentButton = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.d
|
|
|
67
68
|
key: "renderNonStimulus",
|
|
68
69
|
value: function renderNonStimulus() {
|
|
69
70
|
return (0, _emotion.jsx)("div", {
|
|
71
|
+
className: _quizCommon.END_EDITING_TRIGGER_CLASSNAME,
|
|
70
72
|
css: this.props.styles.newItemButtonHolder
|
|
71
73
|
}, (0, _emotion.jsx)("button", {
|
|
72
74
|
ref: this.storeButtonElemRef,
|
|
@@ -26,7 +26,7 @@ var _index = _interopRequireDefault(require("../../../../../banks/components/Add
|
|
|
26
26
|
var _index2 = _interopRequireDefault(require("../../../../../building/components/resources/AddToBankOptions/index.js"));
|
|
27
27
|
var _index3 = _interopRequireDefault(require("../../WarningWrapper/index.js"));
|
|
28
28
|
var _CustomPropTypes = _interopRequireDefault(require("../../../../../common/util/CustomPropTypes.js"));
|
|
29
|
-
var
|
|
29
|
+
var _clickHandlers = require("../../../../../common/util/clickHandlers.js");
|
|
30
30
|
var _index4 = _interopRequireDefault(require("../StimulusShowInfo/index.js"));
|
|
31
31
|
var _index5 = _interopRequireDefault(require("../StimulusEditInfo/index.js"));
|
|
32
32
|
var _componentWithOutsideClickEmotion = _interopRequireDefault(require("../../../shared/functionality/componentWithOutsideClickEmotion.js"));
|
|
@@ -293,12 +293,10 @@ var StimulusEdit = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.defau
|
|
|
293
293
|
}, {
|
|
294
294
|
key: "ignoreClickOutsideIf",
|
|
295
295
|
value: function ignoreClickOutsideIf(e) {
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
});
|
|
301
|
-
return outsideApp;
|
|
296
|
+
var _checkClickedNode = (0, _clickHandlers.checkClickedNode)(e, this.props.appContainer),
|
|
297
|
+
isEndEditingTrigger = _checkClickedNode.isEndEditingTrigger,
|
|
298
|
+
outsideApp = _checkClickedNode.outsideApp;
|
|
299
|
+
return outsideApp || !isEndEditingTrigger;
|
|
302
300
|
}
|
|
303
301
|
}, {
|
|
304
302
|
key: "afterSubmit",
|
|
@@ -15,6 +15,7 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
|
15
15
|
var _emotion = require("@instructure/emotion");
|
|
16
16
|
var _styles = _interopRequireDefault(require("./styles.js"));
|
|
17
17
|
var _theme = _interopRequireDefault(require("./theme.js"));
|
|
18
|
+
var _quizCommon = require("@instructure/quiz-common");
|
|
18
19
|
var _dec, _class, _Overlay;
|
|
19
20
|
/** @jsx jsx */
|
|
20
21
|
/* eslint "jsx-a11y/click-events-have-key-events": "warn" */
|
|
@@ -37,9 +38,10 @@ var Overlay = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default),
|
|
|
37
38
|
if (this.props.hideOverlay) {
|
|
38
39
|
return null;
|
|
39
40
|
}
|
|
41
|
+
var overlayClass = "overlay ".concat(_quizCommon.END_EDITING_TRIGGER_CLASSNAME);
|
|
40
42
|
return (0, _emotion.jsx)("div", {
|
|
41
43
|
role: "presentation",
|
|
42
|
-
className:
|
|
44
|
+
className: overlayClass,
|
|
43
45
|
css: this.props.styles.overlay,
|
|
44
46
|
onClick: this.props.onClick,
|
|
45
47
|
"data-automation": "sdk-overlay"
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.checkClickedNode = checkClickedNode;
|
|
8
|
+
var _ElementsForSelectors = _interopRequireDefault(require("./ElementsForSelectors.js"));
|
|
9
|
+
var _quizCommon = require("@instructure/quiz-common");
|
|
10
|
+
function checkClickedNode(e, appContainer) {
|
|
11
|
+
// Need to iterate over the appNodes since Gauge and lti have a different index for the sdk node
|
|
12
|
+
var appNodes = (0, _ElementsForSelectors.default)(appContainer);
|
|
13
|
+
var outsideApp = appNodes.every(function (node) {
|
|
14
|
+
return node && !node.contains(e.target);
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
// checking if the click was on an element that should end editing
|
|
18
|
+
var endEditingNodes = (0, _ElementsForSelectors.default)(".".concat(_quizCommon.END_EDITING_TRIGGER_CLASSNAME));
|
|
19
|
+
var isEndEditingTrigger = endEditingNodes.some(function (node) {
|
|
20
|
+
return node && node.contains(e.target);
|
|
21
|
+
});
|
|
22
|
+
return {
|
|
23
|
+
isEndEditingTrigger: isEndEditingTrigger,
|
|
24
|
+
outsideApp: outsideApp
|
|
25
|
+
};
|
|
26
|
+
}
|