Skip to content

Commit

Permalink
Move filebrowser shortcuts to settings (#10466)
Browse files Browse the repository at this point in the history
* Move filebrowser shortcuts to settings
Fixes #10465

* Remove unused `Selectors`
  • Loading branch information
fcollonval committed Jun 24, 2021
1 parent 0e4cc1a commit 29aa914
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 46 deletions.
30 changes: 30 additions & 0 deletions packages/filebrowser-extension/schema/browser.json
Expand Up @@ -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": {
Expand Down
46 changes: 0 additions & 46 deletions packages/filebrowser-extension/src/index.ts
Expand Up @@ -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.
*/
Expand Down Expand Up @@ -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']
});
}

/**
Expand Down

0 comments on commit 29aa914

Please sign in to comment.