本文整理匯總了TypeScript中vs/editor/standalone/common/standaloneThemeService.IStandaloneThemeService.setTheme方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript IStandaloneThemeService.setTheme方法的具體用法?TypeScript IStandaloneThemeService.setTheme怎麽用?TypeScript IStandaloneThemeService.setTheme使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類vs/editor/standalone/common/standaloneThemeService.IStandaloneThemeService
的用法示例。
在下文中一共展示了IStandaloneThemeService.setTheme方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: colorizeElement
public static colorizeElement(themeService: IStandaloneThemeService, modeService: IModeService, domNode: HTMLElement, options: IColorizerElementOptions): TPromise<void> {
options = options || {};
let theme = options.theme || 'vs';
let mimeType = options.mimeType || domNode.getAttribute('lang') || domNode.getAttribute('data-lang');
if (!mimeType) {
console.error('Mode not detected');
return undefined;
}
themeService.setTheme(theme);
let text = domNode.firstChild.nodeValue;
domNode.className += ' ' + theme;
let render = (str: string) => {
domNode.innerHTML = str;
};
return this.colorize(modeService, text, mimeType, options).then(render, (err) => console.error(err));
}