aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/nodes/formattedText/FormattedTextBox.tsx
diff options
context:
space:
mode:
Diffstat (limited to 'src/client/views/nodes/formattedText/FormattedTextBox.tsx')
-rw-r--r--src/client/views/nodes/formattedText/FormattedTextBox.tsx13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/client/views/nodes/formattedText/FormattedTextBox.tsx b/src/client/views/nodes/formattedText/FormattedTextBox.tsx
index 55ad543ca..a6870d65b 100644
--- a/src/client/views/nodes/formattedText/FormattedTextBox.tsx
+++ b/src/client/views/nodes/formattedText/FormattedTextBox.tsx
@@ -1694,8 +1694,11 @@ export class FormattedTextBox extends ViewBoxAnnotatableComponent<FormattedTextB
setTimeout(() => this.EditorView?.dispatch(this.EditorView.state.tr.setSelection(TextSelection.near(this.EditorView.state.doc.resolve(pos)))), 100);
setTimeout(() => (this.ProseRef?.children?.[0] as HTMLElement).focus(), 200);
};
+
+ IsFocused = false;
@action
onFocused = (e: React.FocusEvent): void => {
+ this.IsFocused = true;
// applyDevTools.applyDevTools(this.EditorView);
e.stopPropagation();
};
@@ -1779,6 +1782,16 @@ export class FormattedTextBox extends ViewBoxAnnotatableComponent<FormattedTextB
@action
onBlur = (e: React.FocusEvent) => {
+ let ele: HTMLElement | null = e.relatedTarget instanceof HTMLElement ? e.relatedTarget : null;
+ if (ele?.tabIndex === -1) {
+ for (; ele; ele = ele?.parentElement) {
+ if (ele?.className === 'fonticonbox') {
+ setTimeout(() => this._ref.current?.focus());
+ break;
+ }
+ }
+ }
+ if (ele?.className !== 'fonticonbox') this.IsFocused = false;
if (this.ProseRef?.children[0] !== e.nativeEvent.target) return;
if (!(this.EditorView?.state.selection instanceof NodeSelection) || this.EditorView.state.selection.node.type !== this.EditorView.state.schema.nodes.footnote) {
const stordMarks = this.EditorView?.state.storedMarks?.slice();