aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/nodes/EquationBox.tsx
diff options
context:
space:
mode:
Diffstat (limited to 'src/client/views/nodes/EquationBox.tsx')
-rw-r--r--src/client/views/nodes/EquationBox.tsx7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/client/views/nodes/EquationBox.tsx b/src/client/views/nodes/EquationBox.tsx
index 8d45c5724..a77e4bdd1 100644
--- a/src/client/views/nodes/EquationBox.tsx
+++ b/src/client/views/nodes/EquationBox.tsx
@@ -26,7 +26,8 @@ export class EquationBox extends ViewBoxBaseComponent<FieldViewProps>() {
this.props.select(false);
this._ref.current!.mathField.focus();
- this._ref.current!.mathField.select();
+ this.rootDoc.text === 'x' && this._ref.current!.mathField.select();
+ EquationBox.SelectOnLoad = '';
}
reaction(
() => StrCast(this.dataDoc.text),
@@ -35,6 +36,7 @@ export class EquationBox extends ViewBoxBaseComponent<FieldViewProps>() {
this._ref.current!.mathField.latex(text);
}
}
+ //{ fireImmediately: true }
);
reaction(
() => this.props.isSelected(),
@@ -53,9 +55,8 @@ export class EquationBox extends ViewBoxBaseComponent<FieldViewProps>() {
const _height = Number(getComputedStyle(this._ref.current!.element.current).height.replace('px', ''));
const _width = Number(getComputedStyle(this._ref.current!.element.current).width.replace('px', ''));
if (e.key === 'Enter') {
- const nextEq = Docs.Create.EquationDocument({
+ const nextEq = Docs.Create.EquationDocument(e.shiftKey ? StrCast(this.dataDoc.text) : 'x', {
title: '# math',
- text: StrCast(this.dataDoc.text),
_width,
_height: 25,
x: NumCast(this.layoutDoc.x),