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

TypeScript phosphor-panel.PanelLayout类代码示例

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

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



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

示例1: updateTextEditor

 /**
  * Update the text editor model, creating a new text editor
  * widget and detaching the old one.
  */
 updateTextEditor(editor: IEditorModel) {
   let layout = this.layout as PanelLayout;
   if (layout.childCount() > 0) {
     layout.childAt(0).dispose();
   }
   layout.addChild(new CodeMirrorWidget(editor));
 }
开发者ID:sccolbert,项目名称:jupyter-js-notebook,代码行数:11,代码来源:widget.ts


示例2: list

 /**
  * Get an ordered list the toolbar item names.
  *
  * @returns A new array of the current toolbar item names.
  */
 list(): string[] {
   let names: string[] = [];
   let layout = this.layout as PanelLayout;
   for (let i = 0; i < layout.childCount(); i++) {
     let widget = layout.childAt(i);
     names.push(Private.nameProperty.get(widget));
   }
   return names;
 }
开发者ID:munshkr,项目名称:gakuon-editor,代码行数:14,代码来源:index.ts


示例3: add

 /**
  * Add an item to the toolbar.
  *
  * @param name - The name of the widget to add to the toolbar.
  *
  * @param widget - The widget to add to the toolbar.
  *
  * @param after - The optional name of the item to insert after.
  *
  * #### Notes
  * An error is thrown if a widget of the same name is already given.
  * If `after` is not given, or the named widget is not in the toolbar,
  * the widget will be added to the end of the toolbar.
  */
 add(name: string, widget: Widget, after?: string): void {
   let names = this.list();
   if (names.indexOf(name) !== -1) {
     throw new Error(`A button named "${name}" was already added`);
   }
   widget.addClass(TOOLBAR_ITEM);
   let layout = this.layout as PanelLayout;
   let index = names.indexOf(after);
   if (index === -1) {
     layout.addChild(widget);
   } else {
     layout.insertChild(index + 1, widget);
   }
   Private.nameProperty.set(widget, name);
 }
开发者ID:munshkr,项目名称:gakuon-editor,代码行数:29,代码来源:index.ts


示例4: constructor

 /**
  * Construct a new editor widget.
  */
 constructor(context: IDocumentContext<IDocumentModel>) {
   super();
   this.layout = new PanelLayout();
   this.addClass(EDITOR_CLASS);
   var codeMirror = new CodeMirrorWidget();
   var layout = this.layout as PanelLayout;
   let editor = codeMirror.editor;
   let model = context.model;
   this.createMenu(layout);
   layout.addChild(codeMirror);
   editor.setOption('lineNumbers', true);
   editor.setOption('theme', "material");
   let doc = editor.getDoc();
   doc.setValue(model.toString());
   this.title.text = context.path.split('/').pop();
   loadModeByFileName(editor, context.path);
   model.stateChanged.connect((m, args) => {
     if (args.name === 'dirty') {
       if (args.newValue) {
         this.title.className += ` ${DIRTY_CLASS}`;
       } else {
         this.title.className = this.title.className.replace(DIRTY_CLASS, '');
       }
     }
   });
   context.pathChanged.connect((c, path) => {
     loadModeByFileName(editor, path);
     this.title.text = path.split('/').pop();
   });
   model.contentChanged.connect(() => {
     let old = doc.getValue();
     let text = model.toString();
     if (old !== text) {
       doc.setValue(text);
     }
   });
   CodeMirror.on(doc, 'change', (instance, change) => {
     if (change.origin !== 'setValue') {
       model.fromString(instance.getValue());
     }
   });
 }
开发者ID:rnetro,项目名称:editor_changes,代码行数:45,代码来源:widget.ts


示例5: createMenu

  createMenu(layout : PanelLayout) {
    let menuOne = new Menu([
      new MenuItem({
        text: 'Match Brackets'
      }),
      new MenuItem({
        text: 'Line Numbers'
      }),
      new MenuItem({
        text: 'Line Wrapping'
      }),
      new MenuItem({
        text: 'Syntax Highlighting'
      })
      ]);

    let menuTwo = new Menu([
      new MenuItem({
        text: 'abcdef'
      }),
      new MenuItem({
        text: 'base16-dark'
      }),
      new MenuItem({
        text: 'base16-light'
      }),
      new MenuItem({
        text: 'hopscotch'
      }),
      new MenuItem({
        text: 'material'
      }),
      new MenuItem({
        text: 'mbo'
      }),
      new MenuItem({
        text: 'mdn-like'
      }),
      new MenuItem({
        text: 'seti'
      }),      
      new MenuItem({
        text: 'the-matrix'
      }),
      new MenuItem({
        text: 'xq-light'
      }),
      new MenuItem({
        text: 'zenburn'
      })
      ]);

    let menuThree = new Menu([
      new MenuItem({
        text: 'Vim Mode'
      }),
      new MenuItem({
        text: 'EMacs Mode'
      })
      ]);

    let menuBar = new MenuBar([
      new MenuItem({
        text: 'Settings',
        submenu: menuOne,
        shortcut: 'Ctrl-S'
      }),
      new MenuItem({
        text: 'Themes',
        submenu: menuTwo,
        shortcut: 'Ctrl+T'
      }),
      new MenuItem({
        text: 'Modes',
        submenu: menuThree,
        shortcut: 'Ctrl+M'
      })
      ])

    layout.addChild(menuBar);
  }
开发者ID:rnetro,项目名称:editor_changes,代码行数:81,代码来源:widget.ts


示例6:

 model.contentChanged.connect(() => {
   let widget = renderer.render('text/markdown', model.toString());
   if (layout.childCount()) {
     layout.childAt(0).dispose();
   }
   layout.addChild(widget);
 });
开发者ID:ChinaQuants,项目名称:jupyterlab,代码行数:7,代码来源:widget.ts



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
TypeScript phosphor-splitpanel.SplitPanel类代码示例发布时间:2022-05-25
下一篇:
TypeScript phosphor-keymap.KeymapManager类代码示例发布时间: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