當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript filebrowser.FileBrowser類代碼示例

本文整理匯總了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;
  };
開發者ID:dalejung,項目名稱:jupyterlab,代碼行數:41,代碼來源:index.ts

示例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);
   }
 });
開發者ID:7125messi,項目名稱:jupyterlab,代碼行數:8,代碼來源:index.ts

示例3:

    execute: () => {
      const item = browser.selectedItems().next();
      if (!item) {
        return;
      }

      Clipboard.copyToSystem(item.path);
    },
開發者ID:dalejung,項目名稱:jupyterlab,代碼行數:8,代碼來源:index.ts

示例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);
        });
    },
開發者ID:willingc,項目名稱:jupyterlab,代碼行數:12,代碼來源:index.ts

示例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);
 });
開發者ID:sccolbert,項目名稱:jupyterlab,代碼行數:6,代碼來源:index.ts

示例6:

 execute: () => { fbWidget.download(); },
開發者ID:samvasko,項目名稱:jupyterlab,代碼行數:1,代碼來源:index.ts


注:本文中的@jupyterlab/filebrowser.FileBrowser類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。