File tree Expand file tree Collapse file tree 3 files changed +8
-16
lines changed
tiptap-extensions/KeyboardShortcuts
react/src/components/FilePanel Expand file tree Collapse file tree 3 files changed +8
-16
lines changed Original file line number Diff line number Diff line change @@ -4,14 +4,10 @@ import {
44} from "../../editor/BlockNoteExtension.js" ;
55
66export const FilePanelExtension = createExtension ( ( { editor } ) => {
7- const store = createStore ( {
8- blockId : undefined as string | undefined ,
9- } ) ;
7+ const store = createStore < string | undefined > ( undefined ) ;
108
119 function closeMenu ( ) {
12- store . setState ( {
13- blockId : undefined ,
14- } ) ;
10+ store . setState ( undefined ) ;
1511 }
1612
1713 return {
@@ -39,9 +35,7 @@ export const FilePanelExtension = createExtension(({ editor }) => {
3935 } ,
4036 closeMenu,
4137 showMenu ( blockId : string ) {
42- store . setState ( {
43- blockId,
44- } ) ;
38+ store . setState ( blockId ) ;
4539 } ,
4640 } as const ;
4741} ) ;
Original file line number Diff line number Diff line change @@ -493,8 +493,8 @@ export const KeyboardShortcutsExtension = Extension.create<{
493493 this . options . tabBehavior !== "prefer-indent" &&
494494 ( this . options . editor . getExtension ( FormattingToolbarExtension ) ?. store
495495 . state ||
496- this . options . editor . getExtension ( FilePanelExtension ) ?. store . state
497- . blockId )
496+ this . options . editor . getExtension ( FilePanelExtension ) ?. store
497+ . state !== undefined )
498498 // TODO need to check if the link toolbar is open or another alternative entirely
499499 ) {
500500 // don't handle tabs if a toolbar is shown, so we can tab into / out of it
@@ -507,8 +507,8 @@ export const KeyboardShortcutsExtension = Extension.create<{
507507 this . options . tabBehavior !== "prefer-indent" &&
508508 ( this . options . editor . getExtension ( FormattingToolbarExtension ) ?. store
509509 . state ||
510- this . options . editor . getExtension ( FilePanelExtension ) ?. store . state
511- . blockId )
510+ this . options . editor . getExtension ( FilePanelExtension ) ?. store
511+ . state !== undefined )
512512 // TODO need to check if the link toolbar is open or another alternative entirely
513513 // other menu types?
514514 ) {
Original file line number Diff line number Diff line change @@ -16,9 +16,7 @@ export const FilePanelController = (props: {
1616 const editor = useBlockNoteEditor < any , any , any > ( ) ;
1717
1818 const filePanel = useExtension ( FilePanelExtension ) ;
19- const blockId = useExtensionState ( FilePanelExtension , {
20- selector : ( state ) => state . blockId ,
21- } ) ;
19+ const blockId = useExtensionState ( FilePanelExtension ) ;
2220
2321 const floatingUIOptions = useMemo < FloatingUIOptions > (
2422 ( ) => ( {
You can’t perform that action at this time.
0 commit comments