本文整理汇总了TypeScript中@jupyterlab/editorwidget.IEditorTracker.forEach方法的典型用法代码示例。如果您正苦于以下问题:TypeScript IEditorTracker.forEach方法的具体用法?TypeScript IEditorTracker.forEach怎么用?TypeScript IEditorTracker.forEach使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类@jupyterlab/editorwidget.IEditorTracker
的用法示例。
在下文中一共展示了IEditorTracker.forEach方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1:
execute: args => {
let name = args['theme'] as string || CodeMirrorEditor.DEFAULT_THEME;
tracker.forEach(widget => {
if (widget.editor instanceof CodeMirrorEditor) {
let cm = widget.editor.editor;
cm.setOption('theme', name);
}
});
}
示例2: saveState
execute: args => {
keyMap = args['keyMap'] as string || 'default';
tracker.forEach(widget => {
if (widget.editor instanceof CodeMirrorEditor) {
let cm = widget.editor.editor;
cm.setOption('keyMap', keyMap);
}
});
return saveState();
},
示例3: toggleVim
/**
* Toggle the editor's vim mode
*/
function toggleVim(): void {
tracker.forEach(widget => {
if (widget.editor instanceof CodeMirrorEditor) {
let cm = widget.editor.editor;
let keymap = cm.getOption('keyMap') === 'vim' ? 'default'
: 'vim';
cm.setOption('keyMap', keymap);
}
});
}
示例4: toggleMatchBrackets
/**
* Toggle editor matching brackets
*/
function toggleMatchBrackets(): Promise<void> {
matchBrackets = !matchBrackets;
tracker.forEach(widget => {
let editor = widget.editor;
if (editor instanceof CodeMirrorEditor) {
let cm = editor.editor;
cm.setOption('matchBrackets', matchBrackets);
}
});
return saveState();
}