Skip to content

Build your personal knowledge base with Trilium Notes

fix(math-edit): Set focus to input field when inserting math formula

SiriusXT3b09147e52f5
diff --git a/packages/ckeditor5-math/src/mathui.ts b/packages/ckeditor5-math/src/mathui.ts
index 851c86e63c..a4efff4738 100644
--- a/packages/ckeditor5-math/src/mathui.ts
+++ b/packages/ckeditor5-math/src/mathui.ts
@@ -54,6 +54,10 @@ export default class MathUI extends Plugin {
this._addFormView();
this._balloon.showStack( 'main' );
+
+ requestAnimationFrame(() => {
+ this.formView?.mathInputView.fieldView.element?.focus();
+ });
}
private _createFormView() {
@@ -122,7 +126,6 @@ export default class MathUI extends Plugin {
formView.mathInputView.fieldView.once('render', () => {
const textarea = formView.mathInputView.fieldView.element;
if (!textarea) return;
- textarea.focus();
Object.assign(textarea.style, {
resize: 'both',
height: '100px',