@team-monolith/cds 1.48.3 → 1.48.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.
|
@@ -22,7 +22,7 @@ export type ProblemSelectPayload = {
|
|
|
22
22
|
selections: Selection[];
|
|
23
23
|
} | {
|
|
24
24
|
selections: SelectionWithoutSolution[];
|
|
25
|
-
hasMultipleSolutions
|
|
25
|
+
hasMultipleSolutions: boolean;
|
|
26
26
|
});
|
|
27
27
|
export type SerializedProblemSelectNode = Spread<ProblemSelectPayload, SerializedLexicalNode>;
|
|
28
28
|
/**
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { DecoratorNode, } from "lexical";
|
|
2
|
+
import { $applyNodeReplacement, DecoratorNode, } from "lexical";
|
|
3
3
|
import { addClassNamesToElement } from "@lexical/utils";
|
|
4
4
|
import { SelectComponent } from "./SelectComponent";
|
|
5
5
|
/**
|
|
@@ -77,11 +77,11 @@ export class ProblemSelectNode extends DecoratorNode {
|
|
|
77
77
|
export function $createProblemSelectNode(payload) {
|
|
78
78
|
if ("hasMultipleSolutions" in payload) {
|
|
79
79
|
const { selections, selected, key, hasMultipleSolutions } = payload;
|
|
80
|
-
return new ProblemSelectNode(selections, selected, hasMultipleSolutions, key);
|
|
80
|
+
return $applyNodeReplacement(new ProblemSelectNode(selections, selected, hasMultipleSolutions, key));
|
|
81
81
|
}
|
|
82
82
|
else {
|
|
83
83
|
const { selections, selected, key } = payload;
|
|
84
|
-
return new ProblemSelectNode(selections, selected, undefined, key);
|
|
84
|
+
return $applyNodeReplacement(new ProblemSelectNode(selections, selected, undefined, key));
|
|
85
85
|
}
|
|
86
86
|
}
|
|
87
87
|
export function $isProblemSelectNode(node) {
|
|
@@ -19,12 +19,8 @@ export function SelectComponent(props) {
|
|
|
19
19
|
const isEditable = useLexicalEditable();
|
|
20
20
|
const { freezeProblemNode, showQuizSolution } = useContext(LexicalCustomConfigContext);
|
|
21
21
|
const showMultipleSolutions = hasMultipleSolutions ||
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
return [s.isAnswer];
|
|
25
|
-
}
|
|
26
|
-
return [];
|
|
27
|
-
}).length > 1;
|
|
22
|
+
(hasMultipleSolutions === undefined &&
|
|
23
|
+
selections.filter((s) => "isAnswer" in s && s.isAnswer).length > 1);
|
|
28
24
|
// view
|
|
29
25
|
if (!isEditable) {
|
|
30
26
|
return (_jsxs(_Fragment, { children: [showMultipleSolutions && (_jsxs(Alert, { children: [_jsx(AlarmWarningFillIcon, { css: css `
|