當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。