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


TypeScript IRenderMimeRegistry.createRenderer方法代碼示例

本文整理匯總了TypeScript中@jupyterlab/rendermime.IRenderMimeRegistry.createRenderer方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript IRenderMimeRegistry.createRenderer方法的具體用法?TypeScript IRenderMimeRegistry.createRenderer怎麽用?TypeScript IRenderMimeRegistry.createRenderer使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在@jupyterlab/rendermime.IRenderMimeRegistry的用法示例。


在下文中一共展示了IRenderMimeRegistry.createRenderer方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: FAQWidget

 let createWidget = () => {
   let content = rendermime.createRenderer('text/markdown');
   const model = rendermime.createModel({
     data: { 'text/markdown': SOURCE }
   });
   content.renderModel(model);
   content.addClass('jp-FAQ-content');
   return new FAQWidget(content);
 };
開發者ID:7125messi,項目名稱:jupyterlab,代碼行數:9,代碼來源:index.ts

示例2: MainAreaWidget

 let createWidget = () => {
   let content = rendermime.createRenderer('text/markdown');
   const model = rendermime.createModel({
     data: { 'text/markdown': SOURCE }
   });
   void content.renderModel(model);
   content.addClass('jp-FAQ-content');
   let widget = new MainAreaWidget({ content });
   widget.addClass('jp-FAQ');
   widget.title.label = 'FAQ';
   return widget;
 };
開發者ID:afshin,項目名稱:jupyterlab,代碼行數:12,代碼來源:index.ts

示例3: createView

 /**
  * Create a new sub-view.
  */
 static
 createView(model: IDiffModel, parent: CellDiffModel,
            editorClasses: string[], rendermime: IRenderMimeRegistry): Panel {
   let view: Panel;
   if (model instanceof StringDiffModel) {
     let inner: Widget | null = null;
     if (model.unchanged && parent.cellType === 'markdown') {
       let mimeModel = new MimeModel({ data: {'text/markdown': model.base!} });
       let mimeType = rendermime.preferredMimeType(mimeModel.data, 'ensure');
       if (!mimeType) {
         throw new Error('No renderer for output');
       }
       let renderer = rendermime.createRenderer(mimeType);
       renderer.renderModel(mimeModel);
       inner = renderer;
     } else {
       inner = createNbdimeMergeView(model);
     }
     if (model.collapsible) {
       view = new CollapsiblePanel(
           inner, model.collapsibleHeader, model.startCollapsed);
     } else {
       view = new Panel();
       view.addWidget(inner);
     }
   } else if (model instanceof OutputDiffModel) {
     view = new OutputPanel(model, parent, editorClasses, rendermime);
     if (model.added) {
       view.addClass(ADDED_DIFF_CLASS);
     } else if (model.deleted) {
       view.addClass(DELETED_DIFF_CLASS);
     } else if (model.unchanged) {
       view.addClass(UNCHANGED_DIFF_CLASS);
     } else {
       view.addClass(TWOWAY_DIFF_CLASS);
     }
   } else {
     throw new Error('Unrecognized model type.');
   }
   return view;
 }
開發者ID:vidartf,項目名稱:nbdime,代碼行數:44,代碼來源:cell.ts


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