diff --git a/packages/filebrowser-extension/schema/browser.json b/packages/filebrowser-extension/schema/browser.json index 129d525ab0e2..06425be45278 100644 --- a/packages/filebrowser-extension/schema/browser.json +++ b/packages/filebrowser-extension/schema/browser.json @@ -148,6 +148,36 @@ "command": "filebrowser:go-up", "keys": ["Backspace"], "selector": ".jp-DirListing-content .jp-DirListing-itemText" + }, + { + "command": "filebrowser:delete", + "keys": ["Delete"], + "selector": ".jp-DirListing-content .jp-DirListing-itemText" + }, + { + "command": "filebrowser:cut", + "keys": ["Accel X"], + "selector": ".jp-DirListing-content .jp-DirListing-itemText" + }, + { + "command": "filebrowser:copy", + "keys": ["Accel C"], + "selector": ".jp-DirListing-content .jp-DirListing-itemText" + }, + { + "command": "filebrowser:paste", + "keys": ["Accel V"], + "selector": ".jp-DirListing-content .jp-DirListing-itemText" + }, + { + "command": "filebrowser:rename", + "keys": ["F2"], + "selector": ".jp-DirListing-content .jp-DirListing-itemText" + }, + { + "command": "filebrowser:duplicate", + "keys": ["Accel D"], + "selector": ".jp-DirListing-content .jp-DirListing-itemText" } ], "properties": { diff --git a/packages/filebrowser-extension/src/index.ts b/packages/filebrowser-extension/src/index.ts index 1360b1388508..25cafe930ff7 100644 --- a/packages/filebrowser-extension/src/index.ts +++ b/packages/filebrowser-extension/src/index.ts @@ -120,21 +120,6 @@ namespace CommandIDs { export const search = 'filebrowser:search'; } -namespace Selectors { - // matches the text in the filebrowser; relies on an implementation detail - // being the text of the listing element being substituted with input - // area to deactivate shortcuts when the file name is being edited. - export const selectorBrowser = - '.jp-DirListing-content .jp-DirListing-itemText'; - // matches anywhere on filebrowser - export const selectorContent = '.jp-DirListing-content'; - // matches all filebrowser items - export const selectorItem = '.jp-DirListing-item[data-isdir]'; - // matches only non-directory items - export const selectorNotDir = '.jp-DirListing-item[data-isdir="false"]'; - export const selectorHeader = '.jp-DirListing-header'; -} - /** * The file browser namespace token. */ @@ -1047,37 +1032,6 @@ function addCommands( category: trans.__('File Operations') }); } - - app.commands.addKeyBinding({ - command: CommandIDs.del, - selector: Selectors.selectorBrowser, - keys: ['Delete'] - }); - app.commands.addKeyBinding({ - command: CommandIDs.cut, - selector: Selectors.selectorBrowser, - keys: ['Ctrl X'] - }); - app.commands.addKeyBinding({ - command: CommandIDs.copy, - selector: Selectors.selectorBrowser, - keys: ['Ctrl C'] - }); - app.commands.addKeyBinding({ - command: CommandIDs.paste, - selector: Selectors.selectorBrowser, - keys: ['Ctrl V'] - }); - app.commands.addKeyBinding({ - command: CommandIDs.rename, - selector: Selectors.selectorBrowser, - keys: ['F2'] - }); - app.commands.addKeyBinding({ - command: CommandIDs.duplicate, - selector: Selectors.selectorBrowser, - keys: ['Ctrl D'] - }); } /**