fix(editor): should update icon status when formatting the entire block text (#10508)

Closes: [BS-2718](https://linear.app/affine-design/issue/BS-2718/当处于-block-selection-状态且对整段进行-formatting-时,应该更新对应图标状态)
This commit is contained in:
fundon
2025-03-07 03:22:00 +00:00
parent 98d44d5be5
commit 916134b1da
2 changed files with 13 additions and 2 deletions

View File

@@ -257,6 +257,19 @@ export class AffineToolbarWidget extends WidgetComponent {
}) })
); );
disposables.add(
std.store.slots.blockUpdated.on(record => {
if (
flags.isBlock() &&
record.type === 'update' &&
record.props.key === 'text'
) {
flags.refresh(Flag.Block);
return;
}
})
);
// Handles `drag and drop` // Handles `drag and drop`
const dragStart = () => flags.toggle(Flag.Hiding, true); const dragStart = () => flags.toggle(Flag.Hiding, true);
const dragEnd = () => flags.toggle(Flag.Hiding, false); const dragEnd = () => flags.toggle(Flag.Hiding, false);

View File

@@ -27,7 +27,6 @@ import {
selectAllBlocksByKeyboard, selectAllBlocksByKeyboard,
selectAllByKeyboard, selectAllByKeyboard,
setInlineRangeInInlineEditor, setInlineRangeInInlineEditor,
setSelection,
switchReadonly, switchReadonly,
type, type,
undoByKeyboard, undoByKeyboard,
@@ -338,7 +337,6 @@ test('should format quick bar be able to link text', async ({
`${testInfo.title}_init.json` `${testInfo.title}_init.json`
); );
await setSelection(page, 3, 0, 3, 3);
// The link button should be active after click // The link button should be active after click
await expect(linkBtn).toHaveAttribute('active', ''); await expect(linkBtn).toHaveAttribute('active', '');
await linkBtn.click(); await linkBtn.click();