mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-08-01 17:39:55 +08:00
fix(editor): prevent Tab key propagation outside editor (#11531)
Closes: BS-2964
This commit is contained in:
@@ -42,6 +42,7 @@ import type { ExtensionType } from '@blocksuite/store';
|
||||
import { RootBlockAdapterExtensions } from '../adapters/extension';
|
||||
import { clipboardConfigs } from '../clipboard';
|
||||
import { builtinToolbarConfig } from '../configs/toolbar';
|
||||
import { fallbackKeymap } from '../keyboard/keymap';
|
||||
import {
|
||||
innerModalWidget,
|
||||
linkedDocWidget,
|
||||
@@ -94,6 +95,7 @@ export const CommonSpecs: ExtensionType[] = [
|
||||
viewportOverlayWidget,
|
||||
scrollAnchoringWidget,
|
||||
toolbarWidget,
|
||||
fallbackKeymap,
|
||||
|
||||
ToolbarModuleExtension({
|
||||
id: BlockFlavourIdentifier(NoteBlockSchema.model.flavour),
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
import { KeymapExtension } from '@blocksuite/std';
|
||||
|
||||
export const fallbackKeymap = KeymapExtension(() => {
|
||||
return {
|
||||
Tab: ctx => {
|
||||
const event = ctx.get('defaultState').event;
|
||||
event.stopPropagation();
|
||||
event.preventDefault();
|
||||
},
|
||||
'Shift-Tab': ctx => {
|
||||
const event = ctx.get('defaultState').event;
|
||||
event.stopPropagation();
|
||||
event.preventDefault();
|
||||
},
|
||||
};
|
||||
});
|
||||
Reference in New Issue
Block a user