本文整理匯總了TypeScript中@jupyterlab/editorwidget.IEditorTracker類的典型用法代碼示例。如果您正苦於以下問題:TypeScript IEditorTracker類的具體用法?TypeScript IEditorTracker怎麽用?TypeScript IEditorTracker使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了IEditorTracker類的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();
}