aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/nodes/formattedText/EquationView.tsx
diff options
context:
space:
mode:
authorbobzel <zzzman@gmail.com>2022-11-08 14:43:47 -0500
committerbobzel <zzzman@gmail.com>2022-11-08 14:43:47 -0500
commitb8d4b08716791246847d2a647a9df1f37508b87f (patch)
tree31a3ace00546a20111f66b07a122b15de0c1a946 /src/client/views/nodes/formattedText/EquationView.tsx
parent31a51e9dda07e48c88166bffbc8f1ad7166cd624 (diff)
making pasting form pdf work again with backlinks. text fixes for equationViews and dashField views -- trying to get docref linkAnchor to work.
Diffstat (limited to 'src/client/views/nodes/formattedText/EquationView.tsx')
-rw-r--r--src/client/views/nodes/formattedText/EquationView.tsx12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/client/views/nodes/formattedText/EquationView.tsx b/src/client/views/nodes/formattedText/EquationView.tsx
index 0fd2a7808..89f2a7c81 100644
--- a/src/client/views/nodes/formattedText/EquationView.tsx
+++ b/src/client/views/nodes/formattedText/EquationView.tsx
@@ -1,5 +1,5 @@
import EquationEditor from 'equation-editor-react';
-import { IReactionDisposer } from 'mobx';
+import { IReactionDisposer, trace } from 'mobx';
import { observer } from 'mobx-react';
import { TextSelection } from 'prosemirror-state';
import * as ReactDOM from 'react-dom/client';
@@ -12,7 +12,11 @@ import React = require('react');
export class EquationView {
dom: HTMLDivElement; // container for label and value
root: any;
+ tbox: FormattedTextBox;
+ view: any;
constructor(node: any, view: any, getPos: any, tbox: FormattedTextBox) {
+ this.tbox = tbox;
+ this.view = view;
this.dom = document.createElement('div');
this.dom.style.width = node.attrs.width;
this.dom.style.height = node.attrs.height;
@@ -34,7 +38,11 @@ export class EquationView {
this._editor?.mathField.focus();
}
selectNode() {
- this._editor?.mathField.focus();
+ this.tbox._applyingChange = this.tbox.fieldKey; // setting focus will make prosemirror lose focus, which will cause it to change its selection to a text selection, which causes this view to get rebuilt but it's no longer node selected, so the equationview won't have focus
+ setTimeout(() => {
+ this._editor?.mathField.focus();
+ setTimeout(() => (this.tbox._applyingChange = ''));
+ });
}
deselectNode() {}
}