@team-monolith/cds 1.79.6 → 1.79.7
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/dist/patterns/LexicalEditor/nodes/ProblemInputNode/InputControlledSelectionRange.d.ts +1 -1
- package/dist/patterns/LexicalEditor/nodes/ProblemInputNode/InputControlledSelectionRange.js +2 -2
- package/dist/patterns/LexicalEditor/nodes/ProblemInputNode/SegmentedInput.js +1 -1
- package/package.json +1 -1
package/dist/patterns/LexicalEditor/nodes/ProblemInputNode/InputControlledSelectionRange.d.ts
CHANGED
|
@@ -9,5 +9,5 @@ export interface SelectionRange {
|
|
|
9
9
|
export declare const InputControlledSelectionRange: React.ForwardRefExoticComponent<{
|
|
10
10
|
value: string;
|
|
11
11
|
selectionRange: SelectionRange | null;
|
|
12
|
-
|
|
12
|
+
onSelectionRangeChange: (selectionRange: SelectionRange | null) => void;
|
|
13
13
|
} & Omit<React.InputHTMLAttributes<HTMLInputElement>, "value"> & React.RefAttributes<HTMLInputElement>>;
|
|
@@ -16,7 +16,7 @@ import { useEffect } from "react";
|
|
|
16
16
|
* 입력값과, 선택 범위에 대한 state, setState를 props로 받아 사용합니다.
|
|
17
17
|
*/
|
|
18
18
|
export const InputControlledSelectionRange = React.forwardRef(function InputControlledSelectionRange(props, ref) {
|
|
19
|
-
const { value, selectionRange,
|
|
19
|
+
const { value, selectionRange, onSelectionRangeChange } = props, inputProps = __rest(props, ["value", "selectionRange", "onSelectionRangeChange"]);
|
|
20
20
|
// value 또는 selectionRange가 바뀔 때마다,
|
|
21
21
|
// 실제 DOM input의 selection range를 동기화
|
|
22
22
|
useEffect(() => {
|
|
@@ -35,7 +35,7 @@ export const InputControlledSelectionRange = React.forwardRef(function InputCont
|
|
|
35
35
|
const handleSelect = (e) => {
|
|
36
36
|
const { selectionStart, selectionEnd } = e.currentTarget;
|
|
37
37
|
if (selectionStart != null && selectionEnd != null) {
|
|
38
|
-
|
|
38
|
+
onSelectionRangeChange({
|
|
39
39
|
start: selectionStart,
|
|
40
40
|
end: selectionEnd,
|
|
41
41
|
});
|
|
@@ -49,7 +49,7 @@ export function SegmentedInput(props) {
|
|
|
49
49
|
}
|
|
50
50
|
}, "");
|
|
51
51
|
};
|
|
52
|
-
return (_jsxs(Container, { children: [_jsx(InputControlledSelectionRange, { type: "input", ref: hiddenRef, value: splitedValues.join(""), readOnly: readOnly, selectionRange: selectionRange,
|
|
52
|
+
return (_jsxs(Container, { children: [_jsx(InputControlledSelectionRange, { type: "input", ref: hiddenRef, value: splitedValues.join(""), readOnly: readOnly, selectionRange: selectionRange, onSelectionRangeChange: setSelectionRange, onKeyDown: (e) => {
|
|
53
53
|
var _a;
|
|
54
54
|
if (e.key === "ArrowLeft") {
|
|
55
55
|
e.preventDefault();
|