@24i/bigscreen-sdk 1.0.12-alpha.2260 → 1.0.13-alpha.2266
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/package.json
CHANGED
|
@@ -126,12 +126,14 @@ export class Input extends Component<Props> implements IFocusable {
|
|
|
126
126
|
const range = new Range();
|
|
127
127
|
range.selectNode(textNode);
|
|
128
128
|
const wholeText = range.getBoundingClientRect();
|
|
129
|
-
range.setStart(textNode,
|
|
129
|
+
range.setStart(textNode, 0);
|
|
130
130
|
range.setEnd(textNode, position);
|
|
131
131
|
const caretText = range.getBoundingClientRect();
|
|
132
|
-
const
|
|
133
|
-
? wholeText.
|
|
134
|
-
: wholeText.left
|
|
132
|
+
const [initialCaretPosition, currentCarretPosition, offsetBase] = isRtl()
|
|
133
|
+
? [wholeText.right, caretText.left, wholeText.left]
|
|
134
|
+
: [wholeText.left, caretText.right, wholeText.right];
|
|
135
|
+
const caretPos = position === 0 ? initialCaretPosition : currentCarretPosition;
|
|
136
|
+
const offset = offsetBase - caretPos;
|
|
135
137
|
offsetPosition(this.caret, { x: -offset }, false);
|
|
136
138
|
}
|
|
137
139
|
|
|
@@ -220,7 +222,7 @@ export class Input extends Component<Props> implements IFocusable {
|
|
|
220
222
|
>
|
|
221
223
|
{placeholder}
|
|
222
224
|
</div>
|
|
223
|
-
<div ref={this.text} className="text"
|
|
225
|
+
<div ref={this.text} className="text">
|
|
224
226
|
{this.filterText(value)}
|
|
225
227
|
</div>
|
|
226
228
|
<div ref={this.caret} className="caret" />
|