@khanacademy/perseus-editor 2.17.0 → 3.0.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.
- package/CHANGELOG.md +19 -0
- package/dist/components/widget-editor.d.ts +4 -4
- package/dist/editor.d.ts +5 -5
- package/dist/es/index.js +32 -38
- package/dist/es/index.js.map +1 -1
- package/dist/index.js +19 -25
- package/dist/index.js.map +1 -1
- package/dist/widgets/deprecated-standin-editor.d.ts +10 -0
- package/package.json +3 -3
- package/src/all-editors.ts +2 -0
- package/src/components/widget-editor.tsx +10 -22
- package/src/editor.tsx +28 -31
- package/src/index.ts +4 -0
- package/src/util/register-all-widgets-and-editors-for-testing.ts +4 -0
- package/src/widgets/deprecated-standin-editor.tsx +29 -0
- package/tsconfig-build.tsbuildinfo +1 -1
package/dist/index.js
CHANGED
|
@@ -64,7 +64,7 @@ var i18n__namespace = /*#__PURE__*/_interopNamespace(i18n$1);
|
|
|
64
64
|
|
|
65
65
|
// This file is processed by a Rollup plugin (replace) to inject the production
|
|
66
66
|
const libName = "@khanacademy/perseus-editor";
|
|
67
|
-
const libVersion = "
|
|
67
|
+
const libVersion = "3.0.1";
|
|
68
68
|
perseusCore.addLibraryVersionToPerseusDebug(libName, libVersion);
|
|
69
69
|
|
|
70
70
|
function _extends() {
|
|
@@ -20587,8 +20587,7 @@ const DragTarget = createReactClass__default["default"]({
|
|
|
20587
20587
|
});
|
|
20588
20588
|
|
|
20589
20589
|
const {
|
|
20590
|
-
InlineIcon: InlineIcon$b
|
|
20591
|
-
PropCheckBox: PropCheckBox$e
|
|
20590
|
+
InlineIcon: InlineIcon$b
|
|
20592
20591
|
} = perseus.components;
|
|
20593
20592
|
const {
|
|
20594
20593
|
iconChevronDown: iconChevronDown$1,
|
|
@@ -20599,7 +20598,7 @@ const _upgradeWidgetInfo = props => {
|
|
|
20599
20598
|
// We can't call serialize here because this.refs.widget
|
|
20600
20599
|
// doesn't exist before this component is mounted.
|
|
20601
20600
|
const filteredProps = ___default["default"].omit(props, perseus.WIDGET_PROP_DENYLIST);
|
|
20602
|
-
// @ts-expect-error
|
|
20601
|
+
// @ts-expect-error TS(2345) Type '"categorizer" | undefined' is not assignable to type '"deprecated-standin"'.
|
|
20603
20602
|
return perseus.Widgets.upgradeWidgetInfoToLatestVersion(filteredProps);
|
|
20604
20603
|
};
|
|
20605
20604
|
|
|
@@ -20613,14 +20612,12 @@ class WidgetEditor extends React__namespace.Component {
|
|
|
20613
20612
|
super(props);
|
|
20614
20613
|
this.state = {
|
|
20615
20614
|
showWidget: false,
|
|
20616
|
-
// @ts-expect-error - TS2322 - Type 'ReactElement<any, any> | null' is not assignable to type 'PerseusWidget'.
|
|
20617
20615
|
widgetInfo: _upgradeWidgetInfo(props)
|
|
20618
20616
|
};
|
|
20619
20617
|
}
|
|
20620
20618
|
|
|
20621
20619
|
// eslint-disable-next-line react/no-unsafe
|
|
20622
20620
|
UNSAFE_componentWillReceiveProps(nextProps) {
|
|
20623
|
-
// @ts-expect-error - TS2322 - Type 'ReactElement<any, any> | null' is not assignable to type 'PerseusWidget'.
|
|
20624
20621
|
this.setState({
|
|
20625
20622
|
widgetInfo: _upgradeWidgetInfo(nextProps)
|
|
20626
20623
|
});
|
|
@@ -20685,12 +20682,6 @@ class WidgetEditor extends React__namespace.Component {
|
|
|
20685
20682
|
supportedAlignments = ["default"];
|
|
20686
20683
|
}
|
|
20687
20684
|
const supportsStaticMode = perseus.Widgets.supportsStaticMode(widgetInfo.type);
|
|
20688
|
-
const isUngradedEnabled = widgetInfo.type === "transformer";
|
|
20689
|
-
const gradedPropBox = /*#__PURE__*/React__namespace.createElement(PropCheckBox$e, {
|
|
20690
|
-
label: "Graded:",
|
|
20691
|
-
graded: widgetInfo.graded,
|
|
20692
|
-
onChange: this.props.onChange
|
|
20693
|
-
});
|
|
20694
20685
|
return /*#__PURE__*/React__namespace.createElement("div", {
|
|
20695
20686
|
className: "perseus-widget-editor"
|
|
20696
20687
|
}, /*#__PURE__*/React__namespace.createElement("div", {
|
|
@@ -20720,7 +20711,7 @@ class WidgetEditor extends React__namespace.Component {
|
|
|
20720
20711
|
title: "Remove image widget"
|
|
20721
20712
|
})), /*#__PURE__*/React__namespace.createElement("div", {
|
|
20722
20713
|
className: "perseus-widget-editor-content " + (this.state.showWidget ? "enter" : "leave")
|
|
20723
|
-
},
|
|
20714
|
+
}, Ed && /*#__PURE__*/React__namespace.createElement(Ed
|
|
20724
20715
|
// eslint-disable-next-line react/no-string-refs
|
|
20725
20716
|
, _extends({
|
|
20726
20717
|
ref: "widget",
|
|
@@ -20994,19 +20985,13 @@ class Editor extends React__namespace.Component {
|
|
|
20994
20985
|
// eslint-disable-next-line no-restricted-syntax
|
|
20995
20986
|
clearTimeout(this.deferredChange);
|
|
20996
20987
|
}
|
|
20997
|
-
getWidgetEditor
|
|
20988
|
+
getWidgetEditor(id, type) {
|
|
20998
20989
|
if (!perseus.Widgets.getEditor(type)) {
|
|
20999
20990
|
return;
|
|
21000
20991
|
}
|
|
21001
|
-
return /*#__PURE__*/React__namespace.createElement(WidgetEditor
|
|
21002
|
-
// @ts-expect-error - TS2322 - Type 'string' is not assignable to type 'number | undefined'.
|
|
21003
|
-
, _extends({
|
|
21004
|
-
key: id,
|
|
20992
|
+
return /*#__PURE__*/React__namespace.createElement(WidgetEditor, _extends({
|
|
21005
20993
|
ref: id,
|
|
21006
20994
|
id: id
|
|
21007
|
-
// @ts-expect-error - TS2783 - 'type' is specified more than once, so this usage will be overwritten.
|
|
21008
|
-
,
|
|
21009
|
-
type: type
|
|
21010
20995
|
// eslint-disable-next-line react/jsx-no-bind
|
|
21011
20996
|
,
|
|
21012
20997
|
onChange: this._handleWidgetEditorChange.bind(this, id)
|
|
@@ -21015,7 +21000,7 @@ class Editor extends React__namespace.Component {
|
|
|
21015
21000
|
onRemove: this._handleWidgetEditorRemove.bind(this, id),
|
|
21016
21001
|
apiOptions: this.props.apiOptions
|
|
21017
21002
|
}, this.props.widgets[id]));
|
|
21018
|
-
}
|
|
21003
|
+
}
|
|
21019
21004
|
_handleWidgetEditorChange = (id, newWidgetInfo, cb, silent) => {
|
|
21020
21005
|
const widgets = Object.assign({}, this.props.widgets);
|
|
21021
21006
|
widgets[id] = Object.assign({}, widgets[id], newWidgetInfo);
|
|
@@ -21346,14 +21331,13 @@ class Editor extends React__namespace.Component {
|
|
|
21346
21331
|
const newPostlude = isBlock ? makeStartWithAParagraphAlways(postlude) : postlude;
|
|
21347
21332
|
const newContent = newPrelude + widgetContent + newPostlude;
|
|
21348
21333
|
const newWidgets = ___default["default"].clone(this.props.widgets);
|
|
21334
|
+
// @ts-expect-error TS(2345) Type '"categorizer" | undefined' is not assignable to type '"deprecated-standin"'.
|
|
21349
21335
|
newWidgets[id] = {
|
|
21350
21336
|
options: perseus.Widgets.getEditor(widgetType)?.defaultProps,
|
|
21351
|
-
// @ts-expect-error - TS2322 - Type 'string' is not assignable to type '"video" | "image" | "iframe" | "table" | "radio" | "definition" | "group" | "matrix" | "categorizer" | "cs-program" | "dropdown" | "example-graphie-widget" | "example-widget" | ... 26 more ... | "unit-input"'.
|
|
21352
21337
|
type: widgetType,
|
|
21353
21338
|
// Track widget version on creation, so that a widget editor
|
|
21354
21339
|
// without a valid version prop can only possibly refer to a
|
|
21355
21340
|
// pre-versioning creation time.
|
|
21356
|
-
// @ts-expect-error - TS2322 - Type 'Version | null | undefined' is not assignable to type 'Version | undefined'.
|
|
21357
21341
|
version: perseus.Widgets.getVersion(widgetType)
|
|
21358
21342
|
};
|
|
21359
21343
|
|
|
@@ -26137,6 +26121,16 @@ class DefinitionEditor extends React__namespace.Component {
|
|
|
26137
26121
|
}
|
|
26138
26122
|
}
|
|
26139
26123
|
|
|
26124
|
+
class DeprecatedStandinEditor extends React__namespace.Component {
|
|
26125
|
+
static widgetName = "deprecated-standin";
|
|
26126
|
+
serialize() {
|
|
26127
|
+
return perseus.EditorJsonify.serialize.call(this);
|
|
26128
|
+
}
|
|
26129
|
+
render() {
|
|
26130
|
+
return /*#__PURE__*/React__namespace.createElement("div", null, /*#__PURE__*/React__namespace.createElement("p", null, "This widget has been deprecated and removed"), /*#__PURE__*/React__namespace.createElement("p", null, "Learners will see a message and they will not be graded on this part. Please replace this widget with a supported one."));
|
|
26131
|
+
}
|
|
26132
|
+
}
|
|
26133
|
+
|
|
26140
26134
|
/* eslint-disable @khanacademy/ts-no-error-suppressions */
|
|
26141
26135
|
const {
|
|
26142
26136
|
InfoTip: InfoTip$k,
|
|
@@ -35359,7 +35353,7 @@ class VideoEditor extends React__namespace.Component {
|
|
|
35359
35353
|
}
|
|
35360
35354
|
}
|
|
35361
35355
|
|
|
35362
|
-
var AllEditors = [CategorizerEditor, CSProgramEditor, DefinitionEditor, DropdownEditor, ExampleGraphieWidgetEditor, ExampleWidgetEditor, ExplanationEditor, ExpressionEditor, GradedGroupEditor, GradedGroupSetEditor, GrapherEditor, GroupEditor, IframeEditor, ImageEditor, InputNumberEditor, InteractionEditor, InteractiveGraphEditor, LabelImageEditor, LightsPuzzleEditor, MatcherEditor, MatrixEditor, MeasurerEditor, MoleculeWidgetEditor, NumberLineEditor, NumericInputEditor, OrdererEditor, PassageEditor, PassageRefEditor, PassageRefTargetEditor, PlotterEditor, ReactionDiagramWidgetEditor, SequenceEditor, SimpleMarkdownTesterEditor, SimulatorEditor, SorterEditor, TableEditor, TransformerEditor, UnitInputEditor, VideoEditor, RadioEditor];
|
|
35356
|
+
var AllEditors = [CategorizerEditor, CSProgramEditor, DefinitionEditor, DropdownEditor, ExampleGraphieWidgetEditor, ExampleWidgetEditor, ExplanationEditor, ExpressionEditor, GradedGroupEditor, GradedGroupSetEditor, GrapherEditor, GroupEditor, IframeEditor, ImageEditor, InputNumberEditor, InteractionEditor, InteractiveGraphEditor, LabelImageEditor, LightsPuzzleEditor, MatcherEditor, MatrixEditor, MeasurerEditor, MoleculeWidgetEditor, NumberLineEditor, NumericInputEditor, OrdererEditor, PassageEditor, PassageRefEditor, PassageRefTargetEditor, PlotterEditor, ReactionDiagramWidgetEditor, SequenceEditor, SimpleMarkdownTesterEditor, SimulatorEditor, SorterEditor, TableEditor, TransformerEditor, UnitInputEditor, VideoEditor, RadioEditor, DeprecatedStandinEditor];
|
|
35363
35357
|
|
|
35364
35358
|
/* eslint-disable @khanacademy/ts-no-error-suppressions */
|
|
35365
35359
|
class TextInput extends React__namespace.Component {
|