本文整理汇总了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);
}
}
示例2: showErrorDialog
function showErrorDialog(errorMsg) {
dialog.modal({
title : 'Gist publication error',
body : `Uploading gist failed: ${errorMsg}`,
buttons: {
'OK': {
'class' : 'btn-primary'
}
}
});
}
示例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,
});
}
}
示例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
}
}