Skip to content

Commit b158c1d

Browse files
committed
fix(editor): should udpate icon status when formatting the entire block text
1 parent 9835944 commit b158c1d

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

blocksuite/affine/widget-toolbar/src/toolbar.ts

+13
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,19 @@ export class AffineToolbarWidget extends WidgetComponent {
256256
})
257257
);
258258

259+
disposables.add(
260+
std.store.slots.blockUpdated.on(record => {
261+
if (
262+
flags.isBlock() &&
263+
record.type === 'update' &&
264+
record.props.key === 'text'
265+
) {
266+
flags.refresh(Flag.Block);
267+
return;
268+
}
269+
})
270+
);
271+
259272
// Handles `drag and drop`
260273
const dragStart = () => flags.toggle(Flag.Hiding, true);
261274
const dragEnd = () => flags.toggle(Flag.Hiding, false);

blocksuite/tests-legacy/e2e/format-bar.spec.ts

-2
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ import {
2727
selectAllBlocksByKeyboard,
2828
selectAllByKeyboard,
2929
setInlineRangeInInlineEditor,
30-
setSelection,
3130
switchReadonly,
3231
type,
3332
undoByKeyboard,
@@ -338,7 +337,6 @@ test('should format quick bar be able to link text', async ({
338337
`${testInfo.title}_init.json`
339338
);
340339

341-
await setSelection(page, 3, 0, 3, 3);
342340
// The link button should be active after click
343341
await expect(linkBtn).toHaveAttribute('active', '');
344342
await linkBtn.click();

0 commit comments

Comments
 (0)