本文整理匯總了TypeScript中vs/base/browser/dom.createStyleSheet函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript createStyleSheet函數的具體用法?TypeScript createStyleSheet怎麽用?TypeScript createStyleSheet使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了createStyleSheet函數的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: test
test('css properties, gutterIconPaths', () => {
var styleSheet = dom.createStyleSheet();
// unix file path (used as string)
var s = new CodeEditorServiceImpl(styleSheet);
s.registerDecorationType('example', { gutterIconPath: '/Users/foo/bar.png' });
var sheet = styleSheet.sheet.toString();
assert(sheet.indexOf('background: url(\'file:///Users/foo/bar.png\') center center no-repeat;') > 0);
// windows file path (used as string)
s = new CodeEditorServiceImpl(styleSheet);
s.registerDecorationType('example', { gutterIconPath: 'c:\\files\\miles\\more.png' });
sheet = styleSheet.sheet.toString();
assert(sheet.indexOf('background: url(\'file:///c%3A/files/miles/more.png\') center center no-repeat;') > 0);
// URI, only minimal encoding
s = new CodeEditorServiceImpl(styleSheet);
s.registerDecorationType('example', { gutterIconPath: URI.parse('data:image/svg+xml;base64,PHN2ZyB4b+') });
sheet = styleSheet.sheet.toString();
assert(sheet.indexOf('background: url(\'data:image/svg+xml;base64,PHN2ZyB4b+\') center center no-repeat;') > 0);
// single quote must always be escaped/encoded
s = new CodeEditorServiceImpl(styleSheet);
s.registerDecorationType('example', { gutterIconPath: '/Users/foo/b\'ar.png' });
sheet = styleSheet.sheet.toString();
assert(sheet.indexOf('background: url(\'file:///Users/foo/b%27ar.png\') center center no-repeat;') > 0, sheet);
s = new CodeEditorServiceImpl(styleSheet);
s.registerDecorationType('example', { gutterIconPath: URI.parse('http://test/pa\'th') });
sheet = styleSheet.sheet.toString();
assert(sheet.indexOf('background: url(\'http://test/pa%27th\') center center no-repeat;') > 0, sheet);
});
示例2: constructor
constructor() {
this._knownThemes = new Map<string, KnownTheme>();
this._knownThemes.set(VS_THEME_NAME, new KnownTheme(VS_THEME_NAME, getBuiltinRules(VS_THEME_NAME)));
this._knownThemes.set(VS_DARK_THEME_NAME, new KnownTheme(VS_DARK_THEME_NAME, getBuiltinRules(VS_DARK_THEME_NAME)));
this._knownThemes.set(HC_BLACK_THEME_NAME, new KnownTheme(HC_BLACK_THEME_NAME, getBuiltinRules(HC_BLACK_THEME_NAME)));
this._styleElement = dom.createStyleSheet();
this._styleElement.className = 'monaco-tokens-styles';
this.setTheme(VS_THEME_NAME);
}
示例3: constructor
constructor() {
this._onThemeChange = new Emitter<IStandaloneTheme>();
this._knownThemes = new Map<string, StandaloneTheme>();
this._knownThemes.set(VS_THEME_NAME, newBuiltInTheme(VS_THEME_NAME));
this._knownThemes.set(VS_DARK_THEME_NAME, newBuiltInTheme(VS_DARK_THEME_NAME));
this._knownThemes.set(HC_BLACK_THEME_NAME, newBuiltInTheme(HC_BLACK_THEME_NAME));
this._styleElement = dom.createStyleSheet();
this._styleElement.className = 'monaco-colors';
this.setTheme(VS_THEME_NAME);
}