@pie-element/inline-dropdown 10.1.2-next.1 → 10.1.2
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.json +1082 -0
- package/CHANGELOG.md +2192 -0
- package/LICENSE.md +5 -0
- package/README.md +1 -0
- package/configure/CHANGELOG.json +647 -0
- package/configure/CHANGELOG.md +1949 -0
- package/configure/lib/defaults.js +192 -0
- package/configure/lib/defaults.js.map +1 -0
- package/configure/lib/index.js +135 -0
- package/configure/lib/index.js.map +1 -0
- package/configure/lib/inline-dropdown-toolbar.js +456 -0
- package/configure/lib/inline-dropdown-toolbar.js.map +1 -0
- package/configure/lib/main.js +612 -0
- package/configure/lib/main.js.map +1 -0
- package/configure/lib/markupUtils.js +50 -0
- package/configure/lib/markupUtils.js.map +1 -0
- package/configure/lib/response-area.js +48 -0
- package/configure/lib/response-area.js.map +1 -0
- package/configure/lib/utils.js +22 -0
- package/configure/lib/utils.js.map +1 -0
- package/configure/package.json +24 -0
- package/controller/CHANGELOG.json +467 -0
- package/controller/CHANGELOG.md +1283 -0
- package/controller/lib/defaults.js +25 -0
- package/controller/lib/defaults.js.map +1 -0
- package/controller/lib/index.js +295 -0
- package/controller/lib/index.js.map +1 -0
- package/controller/lib/utils.js +32 -0
- package/controller/lib/utils.js.map +1 -0
- package/controller/package.json +16 -0
- package/docs/config-schema.json +2854 -0
- package/docs/config-schema.json.md +2106 -0
- package/docs/demo/config.js +8 -0
- package/docs/demo/generate.js +76 -0
- package/docs/demo/index.html +1 -0
- package/docs/demo/session.js +11 -0
- package/docs/pie-schema.json +1152 -0
- package/docs/pie-schema.json.md +814 -0
- package/lib/index.js +85 -0
- package/lib/index.js.map +1 -0
- package/lib/inline-dropdown.js +176 -0
- package/lib/inline-dropdown.js.map +1 -0
- package/package.json +21 -86
- package/configure.js +0 -2
- package/controller.js +0 -1
- package/dist/author/defaults.d.ts +0 -194
- package/dist/author/defaults.js +0 -130
- package/dist/author/index.d.ts +0 -43
- package/dist/author/index.js +0 -83
- package/dist/author/inline-dropdown-toolbar.d.ts +0 -48
- package/dist/author/inline-dropdown-toolbar.js +0 -268
- package/dist/author/main.d.ts +0 -49
- package/dist/author/main.js +0 -379
- package/dist/author/markupUtils.d.ts +0 -12
- package/dist/author/markupUtils.js +0 -23
- package/dist/author/response-area.d.ts +0 -20
- package/dist/author/response-area.js +0 -32
- package/dist/author/utils.d.ts +0 -10
- package/dist/author/utils.js +0 -10
- package/dist/browser/Close-CMvmRhfL.js +0 -9024
- package/dist/browser/Close-CMvmRhfL.js.map +0 -1
- package/dist/browser/author/index.js +0 -40578
- package/dist/browser/author/index.js.map +0 -1
- package/dist/browser/controller/index.js +0 -196
- package/dist/browser/controller/index.js.map +0 -1
- package/dist/browser/delivery/index.js +0 -2714
- package/dist/browser/delivery/index.js.map +0 -1
- package/dist/browser/dist-CAsDMEWi.js +0 -133
- package/dist/browser/dist-CAsDMEWi.js.map +0 -1
- package/dist/browser/inline-dropdown.css +0 -2
- package/dist/controller/defaults.d.ts +0 -27
- package/dist/controller/defaults.js +0 -21
- package/dist/controller/index.d.ts +0 -54
- package/dist/controller/index.js +0 -124
- package/dist/controller/utils.d.ts +0 -12
- package/dist/controller/utils.js +0 -13
- package/dist/delivery/index.d.ts +0 -20
- package/dist/delivery/index.js +0 -60
- package/dist/delivery/inline-dropdown.d.ts +0 -38
- package/dist/delivery/inline-dropdown.js +0 -109
- package/dist/index.d.ts +0 -1
- package/dist/index.iife.d.ts +0 -8
- package/dist/index.iife.js +0 -148
- package/dist/index.js +0 -2
- package/dist/runtime-support.d.ts +0 -12
- package/dist/runtime-support.js +0 -12
package/dist/author/defaults.js
DELETED
|
@@ -1,130 +0,0 @@
|
|
|
1
|
-
//#region src/author/defaults.ts
|
|
2
|
-
var e = {
|
|
3
|
-
model: {
|
|
4
|
-
alternateResponse: {},
|
|
5
|
-
choiceRationaleEnabled: !0,
|
|
6
|
-
choices: {},
|
|
7
|
-
disabled: !1,
|
|
8
|
-
displayType: "block",
|
|
9
|
-
markup: "",
|
|
10
|
-
mode: "gather",
|
|
11
|
-
prompt: "",
|
|
12
|
-
promptEnabled: !0,
|
|
13
|
-
rationale: "",
|
|
14
|
-
rationaleEnabled: !0,
|
|
15
|
-
shuffle: !0,
|
|
16
|
-
studentInstructionsEnabled: !0,
|
|
17
|
-
teacherInstructions: "",
|
|
18
|
-
teacherInstructionsEnabled: !0,
|
|
19
|
-
toolbarEditorPosition: "bottom"
|
|
20
|
-
},
|
|
21
|
-
configuration: {
|
|
22
|
-
baseInputConfiguration: {
|
|
23
|
-
audio: { disabled: !1 },
|
|
24
|
-
video: { disabled: !1 },
|
|
25
|
-
image: { disabled: !1 },
|
|
26
|
-
h3: { disabled: !0 },
|
|
27
|
-
blockquote: { disabled: !0 },
|
|
28
|
-
textAlign: { disabled: !0 },
|
|
29
|
-
showParagraphs: { disabled: !1 },
|
|
30
|
-
separateParagraphs: { disabled: !0 }
|
|
31
|
-
},
|
|
32
|
-
prompt: {
|
|
33
|
-
settings: !0,
|
|
34
|
-
label: "Prompt",
|
|
35
|
-
required: !1,
|
|
36
|
-
inputConfiguration: {
|
|
37
|
-
audio: { disabled: !1 },
|
|
38
|
-
video: { disabled: !1 },
|
|
39
|
-
image: { disabled: !1 }
|
|
40
|
-
}
|
|
41
|
-
},
|
|
42
|
-
responseAreaInputConfiguration: { inputConfiguration: {
|
|
43
|
-
audio: { disabled: !0 },
|
|
44
|
-
video: { disabled: !0 },
|
|
45
|
-
image: { disabled: !0 },
|
|
46
|
-
table: { disabled: !0 },
|
|
47
|
-
ul_list: { disabled: !0 },
|
|
48
|
-
ol_list: { disabled: !0 }
|
|
49
|
-
} },
|
|
50
|
-
settingsPanelDisabled: !1,
|
|
51
|
-
spellCheck: {
|
|
52
|
-
label: "Spellcheck",
|
|
53
|
-
settings: !1,
|
|
54
|
-
enabled: !0
|
|
55
|
-
},
|
|
56
|
-
lockChoiceOrder: {
|
|
57
|
-
settings: !0,
|
|
58
|
-
label: "Lock Choice Order"
|
|
59
|
-
},
|
|
60
|
-
partialScoring: {
|
|
61
|
-
settings: !1,
|
|
62
|
-
label: "Allow Partial Scoring"
|
|
63
|
-
},
|
|
64
|
-
rationale: {
|
|
65
|
-
settings: !0,
|
|
66
|
-
label: "Rationale",
|
|
67
|
-
required: !1,
|
|
68
|
-
inputConfiguration: {
|
|
69
|
-
audio: { disabled: !1 },
|
|
70
|
-
video: { disabled: !1 },
|
|
71
|
-
image: { disabled: !1 },
|
|
72
|
-
textAlign: { disabled: !0 }
|
|
73
|
-
}
|
|
74
|
-
},
|
|
75
|
-
teacherInstructions: {
|
|
76
|
-
settings: !0,
|
|
77
|
-
label: "Teacher Instructions",
|
|
78
|
-
required: !1,
|
|
79
|
-
inputConfiguration: {
|
|
80
|
-
audio: { disabled: !1 },
|
|
81
|
-
video: { disabled: !1 },
|
|
82
|
-
image: { disabled: !1 }
|
|
83
|
-
}
|
|
84
|
-
},
|
|
85
|
-
template: { inputConfiguration: {
|
|
86
|
-
audio: { disabled: !1 },
|
|
87
|
-
video: { disabled: !1 },
|
|
88
|
-
image: { disabled: !1 }
|
|
89
|
-
} },
|
|
90
|
-
choiceRationale: {
|
|
91
|
-
settings: !0,
|
|
92
|
-
label: "Choice Rationale"
|
|
93
|
-
},
|
|
94
|
-
toolbarEditorPosition: {
|
|
95
|
-
settings: !1,
|
|
96
|
-
label: "Toolbar Editor Position"
|
|
97
|
-
},
|
|
98
|
-
maxResponseAreas: 10,
|
|
99
|
-
maxResponseAreaChoices: 10,
|
|
100
|
-
maxImageWidth: {
|
|
101
|
-
teacherInstructions: 300,
|
|
102
|
-
prompt: 300,
|
|
103
|
-
rationale: 300
|
|
104
|
-
},
|
|
105
|
-
maxImageHeight: {
|
|
106
|
-
teacherInstructions: 300,
|
|
107
|
-
prompt: 300,
|
|
108
|
-
rationale: 300
|
|
109
|
-
},
|
|
110
|
-
withRubric: {
|
|
111
|
-
settings: !1,
|
|
112
|
-
label: "Add Rubric"
|
|
113
|
-
},
|
|
114
|
-
mathMlOptions: {
|
|
115
|
-
mmlOutput: !1,
|
|
116
|
-
mmlEditing: !1
|
|
117
|
-
},
|
|
118
|
-
language: {
|
|
119
|
-
settings: !1,
|
|
120
|
-
label: "Specify Language",
|
|
121
|
-
enabled: !1
|
|
122
|
-
},
|
|
123
|
-
languageChoices: {
|
|
124
|
-
label: "Language Choices",
|
|
125
|
-
options: []
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
};
|
|
129
|
-
//#endregion
|
|
130
|
-
export { e as default };
|
package/dist/author/index.d.ts
DELETED
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @synced-from pie-elements/packages/inline-dropdown/configure/src/index.js
|
|
3
|
-
* @auto-generated
|
|
4
|
-
*
|
|
5
|
-
* This file is automatically synced from pie-elements and converted to TypeScript.
|
|
6
|
-
* Manual edits will be overwritten on next sync.
|
|
7
|
-
* To make changes, edit the upstream JavaScript file and run sync again.
|
|
8
|
-
*/
|
|
9
|
-
export default class InlineDropdown extends HTMLElement {
|
|
10
|
-
static prepareModel: (model?: {}) => {
|
|
11
|
-
slateMarkup: any;
|
|
12
|
-
markup: string;
|
|
13
|
-
alternateResponse: {};
|
|
14
|
-
choiceRationaleEnabled: boolean;
|
|
15
|
-
choices: {};
|
|
16
|
-
disabled: boolean;
|
|
17
|
-
displayType: string;
|
|
18
|
-
mode: string;
|
|
19
|
-
prompt: string;
|
|
20
|
-
promptEnabled: boolean;
|
|
21
|
-
rationale: string;
|
|
22
|
-
rationaleEnabled: boolean;
|
|
23
|
-
shuffle: boolean;
|
|
24
|
-
studentInstructionsEnabled: boolean;
|
|
25
|
-
teacherInstructions: string;
|
|
26
|
-
teacherInstructionsEnabled: boolean;
|
|
27
|
-
toolbarEditorPosition: string;
|
|
28
|
-
};
|
|
29
|
-
constructor();
|
|
30
|
-
set model(s: any);
|
|
31
|
-
set configuration(c: any);
|
|
32
|
-
set disableSidePanel(s: any);
|
|
33
|
-
dispatchModelUpdated(reset: any): void;
|
|
34
|
-
onModelChanged(m: any, reset: any): void;
|
|
35
|
-
onConfigurationChanged(c: any): void;
|
|
36
|
-
/** @param {done, progress, file} handler */
|
|
37
|
-
insertImage(handler: any): void;
|
|
38
|
-
onDeleteImage(src: any, done: any): void;
|
|
39
|
-
insertSound(handler: any): void;
|
|
40
|
-
onDeleteSound(src: any, done: any): void;
|
|
41
|
-
_render(): void;
|
|
42
|
-
disconnectedCallback(): void;
|
|
43
|
-
}
|
package/dist/author/index.js
DELETED
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
import e from "./main.js";
|
|
2
|
-
import t from "./defaults.js";
|
|
3
|
-
import { createSlateMarkup as n, processMarkup as r } from "./markupUtils.js";
|
|
4
|
-
import i from "react";
|
|
5
|
-
import { createRoot as a } from "react-dom/client";
|
|
6
|
-
import { defaults as o } from "@pie-element/shared-lodash";
|
|
7
|
-
import { DeleteImageEvent as s, DeleteSoundEvent as c, InsertImageEvent as l, InsertSoundEvent as u, ModelUpdatedEvent as d } from "@pie-element/shared-configure-events";
|
|
8
|
-
import f from "debug";
|
|
9
|
-
//#region src/author/index.ts
|
|
10
|
-
var p = f("multiple-choice:configure"), m = class f extends HTMLElement {
|
|
11
|
-
static prepareModel = (e = {}) => {
|
|
12
|
-
let i = {
|
|
13
|
-
...t.model,
|
|
14
|
-
...e
|
|
15
|
-
}, a = e.slateMarkup || n(i.markup, i.choices), o = r(a);
|
|
16
|
-
return {
|
|
17
|
-
...i,
|
|
18
|
-
slateMarkup: a,
|
|
19
|
-
markup: o
|
|
20
|
-
};
|
|
21
|
-
};
|
|
22
|
-
constructor() {
|
|
23
|
-
super(), this._root = null, this._model = f.prepareModel(), this._configuration = t.configuration, this.onModelChanged = this.onModelChanged.bind(this), this.onConfigurationChanged = this.onConfigurationChanged.bind(this);
|
|
24
|
-
}
|
|
25
|
-
set model(e) {
|
|
26
|
-
this._model = f.prepareModel(e), this._render();
|
|
27
|
-
}
|
|
28
|
-
set configuration(e) {
|
|
29
|
-
this._configuration = o(e, t.configuration), e.language?.enabled ? e.languageChoices?.options?.length && (this._model.language = e.languageChoices.options[0].value) : e.language.settings && this._model.language ? (this._configuration.language.enabled = !0, (!this._configuration.languageChoices.options || !this._configuration.languageChoices.options.length) && (this._configuration.languageChoices.options = []), this._configuration.languageChoices.options.find((e) => e.value === this._model.language) || this._configuration.languageChoices.options.push({
|
|
30
|
-
value: this._model.language,
|
|
31
|
-
label: this._model.language
|
|
32
|
-
})) : delete this._model.language, this._render();
|
|
33
|
-
}
|
|
34
|
-
set disableSidePanel(e) {
|
|
35
|
-
this._disableSidePanel = e, this._render();
|
|
36
|
-
}
|
|
37
|
-
dispatchModelUpdated(e) {
|
|
38
|
-
let t = !!e;
|
|
39
|
-
this.dispatchEvent(new d(this._model, t));
|
|
40
|
-
}
|
|
41
|
-
onModelChanged(e, t) {
|
|
42
|
-
this._model = f.prepareModel(e), this._render(), this.dispatchModelUpdated(t);
|
|
43
|
-
}
|
|
44
|
-
onConfigurationChanged(e) {
|
|
45
|
-
this._configuration = e, this._render();
|
|
46
|
-
}
|
|
47
|
-
insertImage(e) {
|
|
48
|
-
this.dispatchEvent(new l(e));
|
|
49
|
-
}
|
|
50
|
-
onDeleteImage(e, t) {
|
|
51
|
-
this.dispatchEvent(new s(e, t));
|
|
52
|
-
}
|
|
53
|
-
insertSound(e) {
|
|
54
|
-
this.dispatchEvent(new u(e));
|
|
55
|
-
}
|
|
56
|
-
onDeleteSound(e, t) {
|
|
57
|
-
this.dispatchEvent(new c(e, t));
|
|
58
|
-
}
|
|
59
|
-
_render() {
|
|
60
|
-
p("_render");
|
|
61
|
-
let t = i.createElement(e, {
|
|
62
|
-
model: this._model,
|
|
63
|
-
configuration: this._configuration,
|
|
64
|
-
onModelChanged: this.onModelChanged,
|
|
65
|
-
onConfigurationChanged: this.onConfigurationChanged,
|
|
66
|
-
disableSidePanel: this._disableSidePanel,
|
|
67
|
-
imageSupport: {
|
|
68
|
-
add: this.insertImage.bind(this),
|
|
69
|
-
delete: this.onDeleteImage.bind(this)
|
|
70
|
-
},
|
|
71
|
-
uploadSoundSupport: {
|
|
72
|
-
add: this.insertSound.bind(this),
|
|
73
|
-
delete: this.onDeleteSound.bind(this)
|
|
74
|
-
}
|
|
75
|
-
});
|
|
76
|
-
this._root ||= a(this), this._root.render(t);
|
|
77
|
-
}
|
|
78
|
-
disconnectedCallback() {
|
|
79
|
-
this._root && this._root.unmount();
|
|
80
|
-
}
|
|
81
|
-
};
|
|
82
|
-
//#endregion
|
|
83
|
-
export { m as default };
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @synced-from pie-elements/packages/inline-dropdown/configure/src/inline-dropdown-toolbar.jsx
|
|
3
|
-
* @auto-generated
|
|
4
|
-
*
|
|
5
|
-
* This file is automatically synced from pie-elements and converted to TypeScript.
|
|
6
|
-
* Manual edits will be overwritten on next sync.
|
|
7
|
-
* To make changes, edit the upstream JavaScript file and run sync again.
|
|
8
|
-
*/
|
|
9
|
-
import React from 'react';
|
|
10
|
-
import PropTypes from 'prop-types';
|
|
11
|
-
declare class RespAreaToolbar extends React.Component {
|
|
12
|
-
static propTypes: {
|
|
13
|
-
node: PropTypes.Requireable<object>;
|
|
14
|
-
pos: PropTypes.Requireable<number>;
|
|
15
|
-
uploadSoundSupport: PropTypes.Requireable<object>;
|
|
16
|
-
onDone: PropTypes.Requireable<(...args: any[]) => any>;
|
|
17
|
-
choices: PropTypes.Requireable<any[]>;
|
|
18
|
-
onAddChoice: PropTypes.Validator<(...args: any[]) => any>;
|
|
19
|
-
editorCallback: PropTypes.Requireable<(...args: any[]) => any>;
|
|
20
|
-
onRemoveChoice: PropTypes.Validator<(...args: any[]) => any>;
|
|
21
|
-
onSelectChoice: PropTypes.Validator<(...args: any[]) => any>;
|
|
22
|
-
onToolbarDone: PropTypes.Validator<(...args: any[]) => any>;
|
|
23
|
-
editor: PropTypes.Requireable<object>;
|
|
24
|
-
spellCheck: PropTypes.Requireable<boolean>;
|
|
25
|
-
};
|
|
26
|
-
clickedInside: boolean;
|
|
27
|
-
preventDone: boolean;
|
|
28
|
-
state: {
|
|
29
|
-
respAreaMarkup: string;
|
|
30
|
-
editedChoiceIndex: number;
|
|
31
|
-
};
|
|
32
|
-
componentDidMount(): void;
|
|
33
|
-
componentDidUpdate(): void;
|
|
34
|
-
componentWillUnmount(): void;
|
|
35
|
-
commitPendingEdit: any;
|
|
36
|
-
onRespAreaChange: any;
|
|
37
|
-
onAddChoice: any;
|
|
38
|
-
onDone: any;
|
|
39
|
-
onSelectChoice: any;
|
|
40
|
-
onRemoveChoice: any;
|
|
41
|
-
onEditChoice: any;
|
|
42
|
-
onKeyDown: any;
|
|
43
|
-
onBlur: any;
|
|
44
|
-
onClickInside: any;
|
|
45
|
-
render(): React.JSX.Element | null;
|
|
46
|
-
}
|
|
47
|
-
declare const StyledRespAreaToolbar: typeof RespAreaToolbar;
|
|
48
|
-
export default StyledRespAreaToolbar;
|
|
@@ -1,268 +0,0 @@
|
|
|
1
|
-
import { getPluginProps as e } from "./utils.js";
|
|
2
|
-
import t from "react";
|
|
3
|
-
import { renderMath as n } from "@pie-element/shared-math-rendering-mathjax";
|
|
4
|
-
import r from "react-dom";
|
|
5
|
-
import i from "prop-types";
|
|
6
|
-
import { isEmpty as a, isEqual as o } from "@pie-element/shared-lodash";
|
|
7
|
-
import { color as s } from "@pie-lib/render-ui";
|
|
8
|
-
import { jsx as c, jsxs as l } from "react/jsx-runtime";
|
|
9
|
-
import { styled as u } from "@mui/material/styles";
|
|
10
|
-
import d from "@pie-lib/editable-html-tip-tap";
|
|
11
|
-
import f from "@mui/icons-material/Add";
|
|
12
|
-
import p from "@mui/icons-material/Check";
|
|
13
|
-
import m from "@mui/icons-material/Close";
|
|
14
|
-
import h from "@mui/icons-material/Edit";
|
|
15
|
-
import g from "@mui/material/IconButton";
|
|
16
|
-
//#region src/author/inline-dropdown-toolbar.tsx
|
|
17
|
-
var _ = u("div")(({ theme: e }) => ({
|
|
18
|
-
display: "flex",
|
|
19
|
-
alignItems: "flex-start",
|
|
20
|
-
position: "relative",
|
|
21
|
-
background: e.palette.common.white,
|
|
22
|
-
borderBottom: `1px solid ${e.palette.grey[400]}`,
|
|
23
|
-
"&:last-child": { borderRadius: "0 0 4px 4px" }
|
|
24
|
-
})), v = u("div")(({ theme: e }) => ({
|
|
25
|
-
display: "flex",
|
|
26
|
-
justifyContent: "center",
|
|
27
|
-
color: e.palette.common.white,
|
|
28
|
-
fontSize: e.typography.fontSize,
|
|
29
|
-
fontStyle: "normal",
|
|
30
|
-
position: "absolute",
|
|
31
|
-
transform: "translate(0, -50%)",
|
|
32
|
-
backgroundColor: s.correct(),
|
|
33
|
-
borderRadius: "50%",
|
|
34
|
-
top: e.spacing(2),
|
|
35
|
-
left: e.spacing(1),
|
|
36
|
-
zIndex: 3
|
|
37
|
-
})), y = u("div")(({ theme: e, correct: t }) => ({
|
|
38
|
-
flex: 1,
|
|
39
|
-
padding: e.spacing(.75),
|
|
40
|
-
paddingLeft: e.spacing(3.5),
|
|
41
|
-
...t && { background: s.correctSecondary() },
|
|
42
|
-
"& p": { margin: 0 }
|
|
43
|
-
})), b = u("div")(({ theme: e }) => ({
|
|
44
|
-
margin: e.spacing(.5),
|
|
45
|
-
display: "flex"
|
|
46
|
-
})), x = u(g)(({ theme: e }) => ({
|
|
47
|
-
fontSize: e.typography.fontSize,
|
|
48
|
-
padding: e.spacing(.5),
|
|
49
|
-
color: e.palette.common.black
|
|
50
|
-
})), S = class extends t.Component {
|
|
51
|
-
static propTypes = {
|
|
52
|
-
correct: i.bool.isRequired,
|
|
53
|
-
onClick: i.func.isRequired,
|
|
54
|
-
onRemoveChoice: i.func.isRequired,
|
|
55
|
-
onEditChoice: i.func.isRequired,
|
|
56
|
-
value: i.string.isRequired
|
|
57
|
-
};
|
|
58
|
-
onRemoveClick = (e) => {
|
|
59
|
-
let { onRemoveChoice: t } = this.props;
|
|
60
|
-
e.preventDefault(), e.stopPropagation(), t();
|
|
61
|
-
};
|
|
62
|
-
onEditClick = (e) => {
|
|
63
|
-
let { onEditChoice: t } = this.props;
|
|
64
|
-
e.preventDefault(), e.stopPropagation(), t();
|
|
65
|
-
};
|
|
66
|
-
render() {
|
|
67
|
-
let { correct: e, onClick: t, value: n } = this.props;
|
|
68
|
-
return /* @__PURE__ */ l(_, { children: [
|
|
69
|
-
e && /* @__PURE__ */ c(v, {
|
|
70
|
-
onClick: t,
|
|
71
|
-
children: /* @__PURE__ */ c(p, { fontSize: "inherit" })
|
|
72
|
-
}),
|
|
73
|
-
/* @__PURE__ */ c(y, {
|
|
74
|
-
correct: e,
|
|
75
|
-
onClick: t,
|
|
76
|
-
dangerouslySetInnerHTML: { __html: n }
|
|
77
|
-
}),
|
|
78
|
-
/* @__PURE__ */ l(b, { children: [/* @__PURE__ */ c(x, {
|
|
79
|
-
onClick: this.onEditClick,
|
|
80
|
-
size: "small",
|
|
81
|
-
"aria-label": "Edit",
|
|
82
|
-
children: /* @__PURE__ */ c(h, { fontSize: "inherit" })
|
|
83
|
-
}), /* @__PURE__ */ c(x, {
|
|
84
|
-
onClick: this.onRemoveClick,
|
|
85
|
-
size: "small",
|
|
86
|
-
"aria-label": "Remove",
|
|
87
|
-
children: /* @__PURE__ */ c(m, { fontSize: "inherit" })
|
|
88
|
-
})] })
|
|
89
|
-
] });
|
|
90
|
-
}
|
|
91
|
-
}, C = (e) => {
|
|
92
|
-
let t = document.createElement("div");
|
|
93
|
-
return t.innerHTML = (e || "").trim(), t;
|
|
94
|
-
}, w = u("div")(({ theme: e }) => ({
|
|
95
|
-
boxShadow: e.shadows[2],
|
|
96
|
-
borderRadius: "4px",
|
|
97
|
-
width: "400px"
|
|
98
|
-
})), T = u(d)(({ theme: e }) => ({
|
|
99
|
-
borderRadius: "4px",
|
|
100
|
-
backgroundColor: e.palette.common.white,
|
|
101
|
-
"& [data-slate-editor=\"true\"]": { minHeight: "initial !important" }
|
|
102
|
-
})), E = u(g)(({ theme: e }) => ({
|
|
103
|
-
fontSize: e.typography.fontSize + 2,
|
|
104
|
-
padding: e.spacing(.5),
|
|
105
|
-
color: e.palette.common.black,
|
|
106
|
-
position: "absolute",
|
|
107
|
-
top: "50%",
|
|
108
|
-
right: e.spacing(2),
|
|
109
|
-
transform: "translate(0, -50%)"
|
|
110
|
-
})), D = u("div")({
|
|
111
|
-
display: "flex",
|
|
112
|
-
flexDirection: "column",
|
|
113
|
-
"& > div:last-child": { border: "none" }
|
|
114
|
-
}), O = u("div")(({ theme: e }) => ({
|
|
115
|
-
padding: e.spacing(.5),
|
|
116
|
-
position: "relative"
|
|
117
|
-
})), k = class extends t.Component {
|
|
118
|
-
static propTypes = {
|
|
119
|
-
node: i.object,
|
|
120
|
-
pos: i.number,
|
|
121
|
-
uploadSoundSupport: i.object,
|
|
122
|
-
onDone: i.func,
|
|
123
|
-
choices: i.array,
|
|
124
|
-
onAddChoice: i.func.isRequired,
|
|
125
|
-
editorCallback: i.func,
|
|
126
|
-
onRemoveChoice: i.func.isRequired,
|
|
127
|
-
onSelectChoice: i.func.isRequired,
|
|
128
|
-
onToolbarDone: i.func.isRequired,
|
|
129
|
-
editor: i.object,
|
|
130
|
-
spellCheck: i.bool
|
|
131
|
-
};
|
|
132
|
-
clickedInside = !1;
|
|
133
|
-
preventDone = !1;
|
|
134
|
-
state = {
|
|
135
|
-
respAreaMarkup: "",
|
|
136
|
-
editedChoiceIndex: -1
|
|
137
|
-
};
|
|
138
|
-
componentDidMount() {
|
|
139
|
-
let { editor: e } = this.props, t = e.view.nodeDOM(e.state.selection.from);
|
|
140
|
-
if (t?.nodeType === 1) {
|
|
141
|
-
let e = t.getBoundingClientRect(), n = t.closest(".tiptap").getBoundingClientRect(), r = e.top - e.height, i = e.left - n.left;
|
|
142
|
-
this.setState({ toolbarStyle: {
|
|
143
|
-
position: "absolute",
|
|
144
|
-
top: `${r + e.height + 40}px`,
|
|
145
|
-
left: `${i + 25}px`
|
|
146
|
-
} });
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
componentDidUpdate() {
|
|
150
|
-
n(r.findDOMNode(this));
|
|
151
|
-
}
|
|
152
|
-
componentWillUnmount() {
|
|
153
|
-
this.commitPendingEdit();
|
|
154
|
-
}
|
|
155
|
-
commitPendingEdit = () => {
|
|
156
|
-
let { editedChoiceIndex: e } = this.state;
|
|
157
|
-
e < 0 || !this.editorRef?.getHTML || (this.preventDone = !1, this.onDone(this.editorRef.getHTML() || ""));
|
|
158
|
-
};
|
|
159
|
-
onRespAreaChange = (e) => {
|
|
160
|
-
this.setState({ respAreaMarkup: e });
|
|
161
|
-
};
|
|
162
|
-
onAddChoice = () => {
|
|
163
|
-
let { editor: e } = this.props, { tr: t } = e.state;
|
|
164
|
-
t.isDone = !0, e.view.dispatch(t);
|
|
165
|
-
};
|
|
166
|
-
onDone = (e) => {
|
|
167
|
-
let { choices: t, node: n, editor: r, onAddChoice: i, onToolbarDone: o } = this.props, { editedChoiceIndex: s } = this.state, c = C(e).textContent.trim();
|
|
168
|
-
s >= 0 && t?.[s]?.correct && r.commands.updateAttributes("inline_dropdown", { value: e }), a(c) || (i(n.attrs.index, e, s), r.commands.refreshResponseArea()), this.setState({ editedChoiceIndex: -1 });
|
|
169
|
-
};
|
|
170
|
-
onSelectChoice = (e, t) => {
|
|
171
|
-
let { node: n, editor: r, onToolbarDone: i, onSelectChoice: a } = this.props;
|
|
172
|
-
r.commands.updateAttributes("inline_dropdown", { value: e }), a(t), r.commands.refreshResponseArea();
|
|
173
|
-
};
|
|
174
|
-
onRemoveChoice = (e, t) => {
|
|
175
|
-
let { node: n, editor: r, onToolbarDone: i, onRemoveChoice: a } = this.props;
|
|
176
|
-
o(e, n.attrs.value) && r.commands.updateAttributes("inline_dropdown", { value: null }), a(t), r.commands.refreshResponseArea();
|
|
177
|
-
};
|
|
178
|
-
onEditChoice = (e, t) => {
|
|
179
|
-
let { editedChoiceIndex: n } = this.state;
|
|
180
|
-
if (this.clickedInside = !0, this.preventDone = !0, n >= 0) {
|
|
181
|
-
let e = this.editorRef.getHTML() || "";
|
|
182
|
-
this.onDone(e);
|
|
183
|
-
}
|
|
184
|
-
this.onRespAreaChange(e), this.setState({ editedChoiceIndex: t });
|
|
185
|
-
};
|
|
186
|
-
onKeyDown = (e) => {
|
|
187
|
-
if (e.key === "Enter") {
|
|
188
|
-
let e = this.editorRef.getHTML() || "";
|
|
189
|
-
return this.onDone(e), this.preventDone = !0, !0;
|
|
190
|
-
}
|
|
191
|
-
return !1;
|
|
192
|
-
};
|
|
193
|
-
onBlur = () => {
|
|
194
|
-
if (this.clickedInside) {
|
|
195
|
-
this.clickedInside = !1;
|
|
196
|
-
return;
|
|
197
|
-
}
|
|
198
|
-
let { editedChoiceIndex: e } = this.state;
|
|
199
|
-
if (e >= 0) {
|
|
200
|
-
this.commitPendingEdit();
|
|
201
|
-
return;
|
|
202
|
-
}
|
|
203
|
-
this.onAddChoice();
|
|
204
|
-
};
|
|
205
|
-
onClickInside = () => {
|
|
206
|
-
this.clickedInside = !0;
|
|
207
|
-
};
|
|
208
|
-
render() {
|
|
209
|
-
let { choices: t, spellCheck: n, uploadSoundSupport: r, mathMlOptions: i = {}, baseInputConfiguration: a = {}, responseAreaInputConfiguration: o = {} } = this.props, { respAreaMarkup: s, toolbarStyle: u } = this.state;
|
|
210
|
-
return u ? /* @__PURE__ */ l(w, {
|
|
211
|
-
"data-inline-dropdown-toolbar": "",
|
|
212
|
-
style: {
|
|
213
|
-
...u,
|
|
214
|
-
backgroundColor: "#E0E1E6",
|
|
215
|
-
zIndex: 1
|
|
216
|
-
},
|
|
217
|
-
onMouseDown: this.onClickInside,
|
|
218
|
-
children: [/* @__PURE__ */ l(O, { children: [/* @__PURE__ */ c(T, {
|
|
219
|
-
editorRef: (e) => {
|
|
220
|
-
e && (this.editorRef = e, this.props.editorCallback?.(e));
|
|
221
|
-
},
|
|
222
|
-
autoFocus: !0,
|
|
223
|
-
autoSave: !0,
|
|
224
|
-
toolbarOpts: {
|
|
225
|
-
position: "top",
|
|
226
|
-
alwaysVisible: !1,
|
|
227
|
-
showDone: !1,
|
|
228
|
-
doneOn: "blur"
|
|
229
|
-
},
|
|
230
|
-
markup: s,
|
|
231
|
-
onKeyDown: this.onKeyDown,
|
|
232
|
-
languageCharactersProps: [{ language: "spanish" }, { language: "special" }],
|
|
233
|
-
onChange: (e) => {
|
|
234
|
-
this.preventDone || this.onRespAreaChange(e);
|
|
235
|
-
},
|
|
236
|
-
onDone: (e) => {
|
|
237
|
-
if (this.preventDone) {
|
|
238
|
-
this.preventDone = !1;
|
|
239
|
-
return;
|
|
240
|
-
}
|
|
241
|
-
this.onDone(e);
|
|
242
|
-
},
|
|
243
|
-
onBlur: (e) => {
|
|
244
|
-
let t = !!(e.relatedTarget && e.relatedTarget.closest(".insert-character-dialog")), n = !!(e.relatedTarget && e.relatedTarget.closest("[aria-label=\"Done\"]"));
|
|
245
|
-
e.relatedTarget && (this.preventDone = t || n, (t || n) && (this.clickedInside = !0)), this.onBlur();
|
|
246
|
-
},
|
|
247
|
-
placeholder: "Add Choice",
|
|
248
|
-
pluginProps: e(o?.inputConfiguration, a),
|
|
249
|
-
spellCheck: n,
|
|
250
|
-
uploadSoundSupport: r,
|
|
251
|
-
mathMlOptions: i
|
|
252
|
-
}), /* @__PURE__ */ c(E, {
|
|
253
|
-
onClick: () => this.onAddChoice(),
|
|
254
|
-
size: "small",
|
|
255
|
-
"aria-label": "Add",
|
|
256
|
-
children: /* @__PURE__ */ c(f, { fontSize: "inherit" })
|
|
257
|
-
})] }), t && /* @__PURE__ */ c(D, { children: t.map(({ label: e, correct: t }, n) => /* @__PURE__ */ c(S, {
|
|
258
|
-
onClick: () => this.onSelectChoice(e, n),
|
|
259
|
-
onRemoveChoice: () => this.onRemoveChoice(e, n),
|
|
260
|
-
onEditChoice: () => this.onEditChoice(e, n),
|
|
261
|
-
value: e,
|
|
262
|
-
correct: t
|
|
263
|
-
}, n)) })]
|
|
264
|
-
}) : null;
|
|
265
|
-
}
|
|
266
|
-
};
|
|
267
|
-
//#endregion
|
|
268
|
-
export { k as default };
|
package/dist/author/main.d.ts
DELETED
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @synced-from pie-elements/packages/inline-dropdown/configure/src/main.jsx
|
|
3
|
-
* @auto-generated
|
|
4
|
-
*
|
|
5
|
-
* This file is automatically synced from pie-elements and converted to TypeScript.
|
|
6
|
-
* Manual edits will be overwritten on next sync.
|
|
7
|
-
* To make changes, edit the upstream JavaScript file and run sync again.
|
|
8
|
-
*/
|
|
9
|
-
import React from 'react';
|
|
10
|
-
import PropTypes from 'prop-types';
|
|
11
|
-
export declare class Main extends React.Component {
|
|
12
|
-
static propTypes: {
|
|
13
|
-
configuration: PropTypes.Validator<object>;
|
|
14
|
-
model: PropTypes.Validator<object>;
|
|
15
|
-
disableSidePanel: PropTypes.Requireable<boolean>;
|
|
16
|
-
onModelChanged: PropTypes.Validator<(...args: any[]) => any>;
|
|
17
|
-
onConfigurationChanged: PropTypes.Validator<(...args: any[]) => any>;
|
|
18
|
-
imageSupport: PropTypes.Requireable<PropTypes.InferProps<{
|
|
19
|
-
add: PropTypes.Validator<(...args: any[]) => any>;
|
|
20
|
-
delete: PropTypes.Validator<(...args: any[]) => any>;
|
|
21
|
-
}>>;
|
|
22
|
-
uploadSoundSupport: PropTypes.Requireable<PropTypes.InferProps<{
|
|
23
|
-
add: PropTypes.Validator<(...args: any[]) => any>;
|
|
24
|
-
delete: PropTypes.Validator<(...args: any[]) => any>;
|
|
25
|
-
}>>;
|
|
26
|
-
};
|
|
27
|
-
state: {
|
|
28
|
-
warning: {
|
|
29
|
-
open: boolean;
|
|
30
|
-
};
|
|
31
|
-
};
|
|
32
|
-
componentDidMount(): void;
|
|
33
|
-
UNSAFE_componentWillReceiveProps(nProps: any): void;
|
|
34
|
-
componentDidUpdate(): void;
|
|
35
|
-
onModelChange: any;
|
|
36
|
-
onPromptChanged: any;
|
|
37
|
-
onRationaleChanged: any;
|
|
38
|
-
onChoiceRationaleChanged: any;
|
|
39
|
-
onTeacherInstructionsChanged: any;
|
|
40
|
-
onMarkupChanged: any;
|
|
41
|
-
onCheck: any;
|
|
42
|
-
validateResponseAreaClose: any;
|
|
43
|
-
onChange: any;
|
|
44
|
-
onAddChoice: any;
|
|
45
|
-
onRemoveChoice: any;
|
|
46
|
-
onSelectChoice: any;
|
|
47
|
-
render(): React.JSX.Element;
|
|
48
|
-
}
|
|
49
|
-
export default Main;
|