mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-07-11 07:06:28 +08:00
fix(editor): auto focus after add inline latex (#10309)
https://github.com/user-attachments/assets/09e713ee-e600-464c-8614-d874d343cfb0 Close #10208
This commit is contained in:
+4
@@ -229,6 +229,10 @@ export class AffineLatexNode extends SignalWatcher(
|
||||
latex,
|
||||
}
|
||||
);
|
||||
this.editor.setInlineRange({
|
||||
index: this.endOffset,
|
||||
length: 0,
|
||||
});
|
||||
}
|
||||
},
|
||||
{ once: true }
|
||||
|
||||
@@ -335,3 +335,55 @@ test('undo-redo when add inline latex using markdown shortcut', async ({
|
||||
]);
|
||||
await assertRichTextInlineRange(page, 0, 3, 0);
|
||||
});
|
||||
|
||||
test('auto focus after add inline latex using markdown shortcut', async ({
|
||||
page,
|
||||
}) => {
|
||||
await enterPlaygroundRoom(page);
|
||||
await initEmptyParagraphState(page);
|
||||
await focusRichText(page);
|
||||
|
||||
await type(page, 'aa$$ bbb\ncc');
|
||||
await assertRichTextInlineDeltas(page, [
|
||||
{
|
||||
insert: 'aa',
|
||||
},
|
||||
{
|
||||
insert: ' ',
|
||||
attributes: {
|
||||
latex: 'bbb',
|
||||
},
|
||||
},
|
||||
{
|
||||
insert: 'cc',
|
||||
},
|
||||
]);
|
||||
|
||||
await undoByKeyboard(page);
|
||||
await assertRichTextInlineDeltas(page, [
|
||||
{
|
||||
insert: 'aa',
|
||||
},
|
||||
{
|
||||
insert: ' ',
|
||||
attributes: {
|
||||
latex: 'bbb',
|
||||
},
|
||||
},
|
||||
]);
|
||||
await redoByKeyboard(page);
|
||||
await assertRichTextInlineDeltas(page, [
|
||||
{
|
||||
insert: 'aa',
|
||||
},
|
||||
{
|
||||
insert: ' ',
|
||||
attributes: {
|
||||
latex: 'bbb',
|
||||
},
|
||||
},
|
||||
{
|
||||
insert: 'cc',
|
||||
},
|
||||
]);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user