Close Virtual Keyboard when Mathinput is closed

This commit is contained in:
Meinzzzz 2025-12-08 18:49:06 +01:00
parent 28dd85c1d1
commit 8a385972fc
3 changed files with 14 additions and 7 deletions

View File

@ -189,6 +189,9 @@ export default class MathUI extends Plugin {
private _removeFormView() {
if ( this._isFormInPanel && this.formView ) {
// Hide virtual keyboard before removing the form
this.formView.hideKeyboard();
this.formView.saveButtonView.focus();
this._balloon.remove( this.formView );

View File

@ -172,4 +172,8 @@ export default class MainFormView extends View {
} );
return btn;
}
public hideKeyboard(): void {
this.mathInputView.hideKeyboard();
}
}

View File

@ -36,13 +36,13 @@ export default class MathInputView extends View {
tag: 'div',
attributes: { class: ['ck-mathlive-container'] }
},
// LaTeX label (outside wrapper)
// LaTeX label
{
tag: 'label',
attributes: { class: ['ck-latex-label'] },
children: [t('LaTeX')]
},
// Raw LaTeX wrapper (just textarea now)
// Raw LaTeX wrapper
{
tag: 'div',
attributes: { class: ['ck-latex-wrapper'] },
@ -176,15 +176,15 @@ export default class MathInputView extends View {
}
public hideKeyboard(): void {
if (this.mathfield) {
try {
this.mathfield.blur();
(this.mathfield as any).executeCommand?.('hideVirtualKeyboard');
} catch { /* MathLive may already be disposed */ }
if (typeof window !== 'undefined' && window.mathVirtualKeyboard?.visible) {
window.mathVirtualKeyboard.hide();
}
}
public override destroy(): void {
// Hide keyboard before destroying
this.hideKeyboard();
if (this.mathfield) {
try {
this.mathfield.blur();