feat(math): support multi-line formula editing

This commit is contained in:
SiriusXT
2025-05-23 17:03:07 +08:00
parent ac1d56b1d6
commit 262ec45fe0
4 changed files with 25 additions and 48 deletions

View File

@@ -110,6 +110,26 @@ export default class MathUI extends Plugin {
cancel();
} );
// Allow pressing Enter to submit changes, and use Shift+Enter to insert a new line
formView.keystrokes.set('enter', (data, cancel) => {
if (!data.shiftKey) {
formView.fire('submit');
cancel();
}
});
// Allow the textarea to be resizable
formView.mathInputView.fieldView.once('render', () => {
const textarea = formView.mathInputView.fieldView.element;
if (!textarea) return;
textarea.focus();
Object.assign(textarea.style, {
resize: 'both',
height: '100px',
minWidth: '100%',
});
});
return formView;
}