当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript dom.createStyleSheet函数代码示例

本文整理汇总了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);
	});
开发者ID:StateFarmIns,项目名称:vscode,代码行数:32,代码来源:decorationRenderOptions.test.ts

示例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);
	}
开发者ID:yuit,项目名称:vscode,代码行数:9,代码来源:standaloneColorServiceImpl.ts

示例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);
	}
开发者ID:AllureFer,项目名称:vscode,代码行数:11,代码来源:standaloneThemeServiceImpl.ts


注:本文中的vs/base/browser/dom.createStyleSheet函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。