• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

TypeScript vscode.WebviewPanel类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了TypeScript中vscode.WebviewPanel的典型用法代码示例。如果您正苦于以下问题:TypeScript WebviewPanel类的具体用法?TypeScript WebviewPanel怎么用?TypeScript WebviewPanel使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了WebviewPanel类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。

示例1: show

    async show(): Promise<void> {
        const html = await this.getHtml();

        if (this._panel === undefined) {
            this._panel = window.createWebviewPanel(
                this.id,
                this.title,
                { viewColumn: ViewColumn.Active, preserveFocus: false },
                {
                    retainContextWhenHidden: true,
                    enableFindWidget: true,
                    enableCommandUris: true,
                    enableScripts: true
                }
            );

            this._panel.iconPath = Uri.file(Container.context.asAbsolutePath('images/gitlens-icon.png'));
            this._disposablePanel = Disposable.from(
                this._panel,
                this._panel.onDidDispose(this.onPanelDisposed, this),
                this._panel.onDidChangeViewState(this.onViewStateChanged, this),
                this._panel.webview.onDidReceiveMessage(this.onMessageReceivedCore, this)
            );

            this._panel.webview.html = html;
        }
        else {
            // Reset the html to get the webview to reload
            this._panel.webview.html = '';
            this._panel.webview.html = html;
            this._panel.reveal(ViewColumn.Active, false);
        }
    }
开发者ID:eamodio,项目名称:vscode-git-codelens,代码行数:33,代码来源:webviewBase.ts


示例2: show

  async show(): Promise<void> {
    const html = await this.getHtml();

    const rootPath = Uri
      .file(this.context.asAbsolutePath('.'))
      .with({scheme: 'vscode-resource'}).toString();

    // Replace placeholders in html content for assets and adding configurations as `window.bootstrap`
    const fullHtml = html
      .replace(/{{root}}/g, rootPath)
      .replace('\'{{bootstrap}}\'', JSON.stringify(this.getBootstrap()));

    // If panel already opened just reveal
    if (this.panel !== undefined) {
      this.panel.webview.html = fullHtml;
      return this.panel.reveal(ViewColumn.Active);
    }

    this.panel = window.createWebviewPanel(
      this.id,
      this.title,
      ViewColumn.Active,
      {
        retainContextWhenHidden: true,
        enableFindWidget: true,
        enableCommandUris: true,
        enableScripts: true
      }
    );

    // Applying listeners
    this.disposablePanel = Disposable.from(
      this.panel,
      this.panel.onDidDispose(this.onPanelDisposed, this),
      this.panel.onDidChangeViewState(this.onViewStateChanged, this),
      this.panel.webview.onDidReceiveMessage(this.onMessageReceived, this)
    );

    this.panel.webview.html = fullHtml;
  }
开发者ID:Manu-sh,项目名称:dotfiles,代码行数:40,代码来源:Webview.ts


示例3: show

  public async show(): Promise<void> {
    if (!this.panel) {
      this.panel = window.createWebviewPanel(
        'requirementsPage',
        'Azure Blockchain Development Kit - Preview',
        ViewColumn.One,
        {
          enableCommandUris: true,
          enableScripts: true,
          retainContextWhenHidden: true,
        },
      );

      const rootPath = Uri.file(this.context.asAbsolutePath('.')).with({scheme: 'vscode-resource'}).toString();
      this.panel.webview.html = fs.readFileSync(Constants.requirementsPagePath, 'utf8').replace(/{{root}}/g, rootPath);
      this.panel.onDidDispose(() => {
        this.dispose();
      });
    } else {
      this.panel.reveal(ViewColumn.One);
    }

    this.context.subscriptions.push(
      this.panel.webview.onDidReceiveMessage(
        async (message) => {
          switch (message.command) {
            case 'documentready':
              if (this.panel) {
                this.panel.webview.postMessage({ versions: await required.getAllVersions() });
              }
              return;
          }
        },
        undefined,
        this.context.subscriptions),
    );
  }
开发者ID:chrisseg,项目名称:vscode-azure-blockchain-ethereum,代码行数:37,代码来源:RequirementsPage.ts


示例4: dispose

 private dispose(): void {
   if (this.panel) {
     this.panel.dispose();
   }
   this.panel = undefined;
 }
开发者ID:chrisseg,项目名称:vscode-azure-blockchain-ethereum,代码行数:6,代码来源:RequirementsPage.ts


示例5: hide

    hide() {
        if (this._panel === undefined) return;

        this._panel.dispose();
    }
开发者ID:chrisleaman,项目名称:vscode-gitlens,代码行数:5,代码来源:webviewBase.ts



注:本文中的vscode.WebviewPanel类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
TypeScript vscode.WorkspaceConfiguration类代码示例发布时间:2022-05-25
下一篇:
TypeScript vscode.Uri类代码示例发布时间:2022-05-25
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap