当前位置: 首页>>代码示例>>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;未经允许,请勿转载。