UNPKG

@wordpress/edit-post

Version:
8 lines (7 loc) 1.68 kB
{ "version": 3, "sources": ["../../../src/components/keyboard-shortcuts/index.js"], "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { useEffect } from '@wordpress/element';\nimport { useDispatch } from '@wordpress/data';\nimport {\n\tuseShortcut,\n\tstore as keyboardShortcutsStore,\n} from '@wordpress/keyboard-shortcuts';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { store as editPostStore } from '../../store';\n\nfunction KeyboardShortcuts() {\n\tconst { toggleFullscreenMode } = useDispatch( editPostStore );\n\tconst { registerShortcut } = useDispatch( keyboardShortcutsStore );\n\n\tuseEffect( () => {\n\t\tregisterShortcut( {\n\t\t\tname: 'core/edit-post/toggle-fullscreen',\n\t\t\tcategory: 'global',\n\t\t\tdescription: __( 'Enable or disable fullscreen mode.' ),\n\t\t\tkeyCombination: {\n\t\t\t\tmodifier: 'secondary',\n\t\t\t\tcharacter: 'f',\n\t\t\t},\n\t\t} );\n\t}, [] );\n\n\tuseShortcut( 'core/edit-post/toggle-fullscreen', () => {\n\t\ttoggleFullscreenMode();\n\t} );\n\n\treturn null;\n}\n\nexport default KeyboardShortcuts;\n"], "mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,qBAA0B;AAC1B,kBAA4B;AAC5B,gCAGO;AACP,kBAAmB;AAKnB,mBAAuC;AAEvC,SAAS,oBAAoB;AAC5B,QAAM,EAAE,qBAAqB,QAAI,yBAAa,aAAAA,KAAc;AAC5D,QAAM,EAAE,iBAAiB,QAAI,yBAAa,0BAAAC,KAAuB;AAEjE,gCAAW,MAAM;AAChB,qBAAkB;AAAA,MACjB,MAAM;AAAA,MACN,UAAU;AAAA,MACV,iBAAa,gBAAI,oCAAqC;AAAA,MACtD,gBAAgB;AAAA,QACf,UAAU;AAAA,QACV,WAAW;AAAA,MACZ;AAAA,IACD,CAAE;AAAA,EACH,GAAG,CAAC,CAAE;AAEN,6CAAa,oCAAoC,MAAM;AACtD,yBAAqB;AAAA,EACtB,CAAE;AAEF,SAAO;AACR;AAEA,IAAO,6BAAQ;", "names": ["editPostStore", "keyboardShortcutsStore"] }