本文整理汇总了TypeScript中@jupyterlab/filebrowser.FileBrowser类的典型用法代码示例。如果您正苦于以下问题:TypeScript FileBrowser类的具体用法?TypeScript FileBrowser怎么用?TypeScript FileBrowser使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了FileBrowser类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: FileBrowserModel
const createFileBrowser = (
id: string,
options: IFileBrowserFactory.IOptions = {}
) => {
const model = new FileBrowserModel({
manager: docManager,
driveName: options.driveName || '',
state: options.state === null ? null : options.state || state
});
const widget = new FileBrowser({
id,
model,
commands: options.commands || commands
});
const { registry } = docManager;
// Add a launcher toolbar item.
let launcher = new ToolbarButton({
className: 'jp-AddIcon',
onClick: () => {
return createLauncher(commands, widget);
},
tooltip: 'New Launcher'
});
launcher.addClass('jp-MaterialIcon');
widget.toolbar.insertItem(0, 'launch', launcher);
// Add a context menu handler to the file browser's directory listing.
let node = widget.node.getElementsByClassName('jp-DirListing-content')[0];
node.addEventListener('contextmenu', (event: MouseEvent) => {
event.preventDefault();
const model = widget.modelForClick(event);
const menu = createContextMenu(model, commands, registry);
menu.open(event.clientX, event.clientY);
});
// Track the newly created file browser.
tracker.add(widget);
return widget;
};
示例2: createContextMenu
node.addEventListener('contextmenu', (event: MouseEvent) => {
event.preventDefault();
const model = widget.modelForClick(event);
if (model) {
const menu = createContextMenu(model, commands, registry);
menu.open(event.clientX, event.clientY);
}
});
示例3:
execute: () => {
const item = browser.selectedItems().next();
if (!item) {
return;
}
Clipboard.copyToSystem(item.path);
},
示例4:
execute: () => {
const widget = tracker.currentWidget;
if (!widget) {
return;
}
return browser.model.manager.services.contents
.getDownloadUrl(browser.selectedItems().next().path)
.then(url => {
Clipboard.copyToSystem(url);
});
},
示例5: createContextMenu
node.addEventListener('contextmenu', (event: MouseEvent) => {
event.preventDefault();
const path = widget.pathForClick(event) || '';
const menu = createContextMenu(path, commands, registry);
menu.open(event.clientX, event.clientY);
});