當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript dom.createCSSRule函數代碼示例

本文整理匯總了TypeScript中vs/base/browser/dom.createCSSRule函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript createCSSRule函數的具體用法?TypeScript createCSSRule怎麽用?TypeScript createCSSRule使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了createCSSRule函數的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: handleCommand

	function handleCommand(userFriendlyCommand: schema.IUserFriendlyCommand , extension: IExtensionPointUser<any>) {

		if (!schema.isValidCommand(userFriendlyCommand, extension.collector)) {
			return;
		}

		let {icon, category, title, command} = userFriendlyCommand;
		let iconClass: string;
		if (icon) {
			iconClass = ids.nextId();
			if (typeof icon === 'string') {
				const path = join(extension.description.extensionFolderPath, icon);
				createCSSRule(`.icon.${iconClass}`, `background-image: url("${path}")`);
			} else {
				const light = join(extension.description.extensionFolderPath, icon.light);
				const dark = join(extension.description.extensionFolderPath, icon.dark);
				createCSSRule(`.icon.${iconClass}`, `background-image: url("${light}")`);
				createCSSRule(`.vs-dark .icon.${iconClass}, hc-black .icon.${iconClass}`, `background-image: url("${dark}")`);
			}
		}

		if (MenuRegistry.addCommand({ id: command, title, category, iconClass })) {
			extension.collector.info(localize('dup', "Command `{0}` appears multiple times in the `commands` section.", userFriendlyCommand.command));
		}
	}
開發者ID:baltth,項目名稱:vscode,代碼行數:25,代碼來源:menusExtensionPoint.ts

示例2: getIconClass

export function getIconClass(iconPath: { dark: URI; light?: URI; }) {
	let iconClass: string;

	const key = iconPath.dark.toString();
	if (iconPathToClass[key]) {
		iconClass = iconPathToClass[key];
	} else {
		iconClass = iconClassGenerator.nextId();
		dom.createCSSRule(`.${iconClass}`, `background-image: url("${(iconPath.light || iconPath.dark).toString()}")`);
		dom.createCSSRule(`.vs-dark .${iconClass}, .hc-black .${iconClass}`, `background-image: url("${iconPath.dark.toString()}")`);
		iconPathToClass[key] = iconClass;
	}

	return iconClass;
}
開發者ID:DonJayamanne,項目名稱:vscode,代碼行數:15,代碼來源:quickInputUtils.ts

示例3: createCSSRuleForIcon

function createCSSRuleForIcon(icon: IUserFriendlyIcon, extension: IExtensionPointUser<any>): string {
	let iconClass: string;
	if (icon) {
		iconClass = ids.nextId();
		if (typeof icon === 'string') {
			const path = join(extension.description.extensionLocation.fsPath, icon);
			createCSSRule(`.icon.${iconClass}`, `background-image: url("${URI.file(path).toString()}")`);
		} else {
			const light = join(extension.description.extensionLocation.fsPath, icon.light);
			const dark = join(extension.description.extensionLocation.fsPath, icon.dark);
			createCSSRule(`.icon.${iconClass}`, `background-image: url("${URI.file(light).toString()}")`);
			createCSSRule(`.vs-dark .icon.${iconClass}, .hc-black .icon.${iconClass}`, `background-image: url("${URI.file(dark).toString()}")`);
		}
	}
	return iconClass;
}
開發者ID:burhandodhy,項目名稱:azuredatastudio,代碼行數:16,代碼來源:dashboardNavSection.contribution.ts


注:本文中的vs/base/browser/dom.createCSSRule函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。