本文整理汇总了TypeScript中base/js/dialog.modal函数的典型用法代码示例。如果您正苦于以下问题:TypeScript modal函数的具体用法?TypeScript modal怎么用?TypeScript modal使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了modal函数的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1:
[BEAKER_TAG_RUN]: (msg) => {
if (!msg.content.data.state || !msg.content.data.state.runByTag) {
return;
}
const notebook = Jupyter.notebook;
const cells = Jupyter.notebook.get_cells();
const indexList = cells.reduce((acc, cell, index) => {
if (cell._metadata.tags && cell._metadata.tags.includes(msg.content.data.state.runByTag)) {
acc.push(index);
}
return acc;
}, []);
if (indexList.length === 0) {
dialog.modal({
title: 'No cell with the tag !',
body: 'Tag: ' + msg.content.data.state.runByTag,
buttons: {'OK': {'class': 'btn-primary'}},
notebook: Jupyter.notebook,
keyboard_manager: Jupyter.keyboard_manager,
});
} else {
notebook.execute_cells(indexList);
}
}
开发者ID:twosigma,项目名称:beaker-notebook,代码行数:27,代码来源:comm.ts
示例2: showErrorDialog
function showErrorDialog(errorMsg) {
dialog.modal({
title : 'Gist publication error',
body : `Uploading gist failed: ${errorMsg}`,
buttons: {
'OK': {
'class' : 'btn-primary'
}
}
});
}
开发者ID:twosigma,项目名称:beaker-notebook,代码行数:11,代码来源:index.ts
示例3: handleUntrustedKernelInitCells
function handleUntrustedKernelInitCells(cells, options) {
if (!Jupyter.notebook.trusted && !options.run_untrusted && cells.length) {
dialog.modal({
title : 'Initialization cells in untrusted notebook',
body : 'This notebook is not trusted, so initialization cells will not be automatically run on kernel load. You can still run them manually, though.',
buttons: {'OK': {'class' : 'btn-primary'}},
notebook: Jupyter.notebook,
keyboard_manager: Jupyter.keyboard_manager,
});
}
}
开发者ID:twosigma,项目名称:beaker-notebook,代码行数:11,代码来源:initializationCells.ts
示例4: create
create(submitCallback, personalAccessToken = ''): Promise<any> {
const modalContent = this.createModalContent();
const personalAccessTokenInput = modalContent.querySelector('input');
const form = modalContent.querySelector('form');
const formGroup = modalContent.querySelector('.form-group');
const errorNode = this.createErrorIconNode();
const submitHandler = (event) => {
const personalAccessToken = personalAccessTokenInput ? personalAccessTokenInput.value : '';
event.preventDefault();
if (!personalAccessToken || !personalAccessTokenInput.checkValidity()) {
personalAccessTokenInput.focus();
formGroup.classList.add('has-error');
formGroup.appendChild(errorNode);
return false;
}
submitCallback(personalAccessToken);
formGroup.contains(errorNode) && formGroup.removeChild(errorNode);
formGroup.classList.remove('has-error');
this.storePersonalAccessToken(personalAccessToken);
modal.modal('hide');
};
if (personalAccessTokenInput && form) {
personalAccessTokenInput.value = personalAccessToken;
}
const modal = dialog.modal({
keyboard_manager: Jupyter.notebook.keyboard_manager,
title : 'Publish to a GitHub Gist',
body : modalContent,
default_button: 'Publish',
buttons: {
'Publish': {
'class' : 'btn-primary',
'click': submitHandler
},
'Cancel': {}
}
});
if (form) {
form.onsubmit = submitHandler
}
}
开发者ID:twosigma,项目名称:beaker-notebook,代码行数:49,代码来源:gistPublishModal.ts
注:本文中的base/js/dialog.modal函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论