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


TypeScript clipboard.writeText方法代碼示例

本文整理匯總了TypeScript中electron.clipboard.writeText方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript clipboard.writeText方法的具體用法?TypeScript clipboard.writeText怎麽用?TypeScript clipboard.writeText使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在electron.clipboard的用法示例。


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

示例1: showContextMenu

function showContextMenu(e) {
	e.preventDefault();

	const items: IContextMenuItem[] = [];

	const pid = parseInt(e.currentTarget.id);
	if (pid && typeof pid === 'number') {
		items.push({
			label: localize('killProcess', "Kill Process"),
			click() {
				process.kill(pid, 'SIGTERM');
			}
		});

		items.push({
			label: localize('forceKillProcess', "Force Kill Process"),
			click() {
				process.kill(pid, 'SIGKILL');
			}
		});

		items.push({
			type: 'separator'
		});

		items.push({
			label: localize('copy', "Copy"),
			click() {
				const row = document.getElementById(pid.toString());
				if (row) {
					clipboard.writeText(row.innerText);
				}
			}
		});

		items.push({
			label: localize('copyAll', "Copy All"),
			click() {
				const processList = document.getElementById('process-list');
				if (processList) {
					clipboard.writeText(processList.innerText);
				}
			}
		});
	} else {
		items.push({
			label: localize('copyAll', "Copy All"),
			click() {
				const processList = document.getElementById('process-list');
				if (processList) {
					clipboard.writeText(processList.innerText);
				}
			}
		});
	}

	popup(items);
}
開發者ID:KTXSoftware,項目名稱:KodeStudio,代碼行數:58,代碼來源:processExplorerMain.ts

示例2: showContextMenu

function showContextMenu(e) {
	e.preventDefault();

	const menu = new remote.Menu();

	const pid = parseInt(e.currentTarget.id);
	if (pid && typeof pid === 'number') {
		menu.append(new remote.MenuItem({
			label: localize('killProcess', "Kill Process"),
			click() {
				process.kill(pid, 'SIGTERM');
			}
		}));

		menu.append(new remote.MenuItem({
			label: localize('forceKillProcess', "Force Kill Process"),
			click() {
				process.kill(pid, 'SIGKILL');
			}
		}));

		menu.append(new remote.MenuItem({
			type: 'separator'
		}));

		menu.append(new remote.MenuItem({
			label: localize('copy', "Copy"),
			click() {
				const row = document.getElementById(pid.toString());
				if (row) {
					clipboard.writeText(row.innerText);
				}
			}
		}));

		menu.append(new remote.MenuItem({
			label: localize('copyAll', "Copy All"),
			click() {
				const processList = document.getElementById('process-list');
				if (processList) {
					clipboard.writeText(processList.innerText);
				}
			}
		}));
	} else {
		menu.append(new remote.MenuItem({
			label: localize('copyAll', "Copy All"),
			click() {
				const processList = document.getElementById('process-list');
				if (processList) {
					clipboard.writeText(processList.innerText);
				}
			}
		}));
	}

	menu.popup({ window: remote.getCurrentWindow() });
}
開發者ID:burhandodhy,項目名稱:azuredatastudio,代碼行數:58,代碼來源:processExplorerMain.ts

示例3: async

 watcher.on(actions.copyToClipboard, async (store, action) => {
   const text: string = action.payload.text;
   clipboard.writeText(text);
   store.dispatch(
     actions.statusMessage({
       message: ["status.copied_to_clipboard"],
     })
   );
 });
開發者ID:HorrerGames,項目名稱:itch,代碼行數:9,代碼來源:clipboard.ts

示例4: function

 copyOutlineToClipboard: function() {
     if (this.currentItems.length > 0) {
         const headings: string[] = [];
         for (const h of this.currentOutline) {
             headings.push(`${' '.repeat(h.level)}- [${h.title}](#${h.hash})`);
         }
         clipboard.writeText(headings.join('\n'));
     }
     this.close();
 },
開發者ID:WondermSwift,項目名稱:Shiba,代碼行數:10,代碼來源:toc-dialog.ts

示例5: writeText

	public writeText(text: string): void {
		clipboard.writeText(text);
	}
開發者ID:Chan-PH,項目名稱:vscode,代碼行數:3,代碼來源:clipboardService.ts

示例6:

	supportFetchAPI: true,
});

webFrame.insertText('text');

webFrame.executeJavaScript('JSON.stringify({})', false, (result) => {
    console.log(result);
}).then((result: string) => console.log('OK:' + result));

console.log(webFrame.getResourceUsage());
webFrame.clearCache();

// clipboard
// https://github.com/atom/electron/blob/master/docs/api/clipboard.md

clipboard.writeText('Example String');
clipboard.writeText('Example String', 'selection');
console.log(clipboard.readText('selection'));
console.log(clipboard.availableFormats());
clipboard.clear();

clipboard.write({
	html: '<html></html>',
	text: 'Hello World!',
	image: clipboard.readImage()
});

// crash-reporter
// https://github.com/atom/electron/blob/master/docs/api/crash-reporter.md

crashReporter.start({
開發者ID:longlho,項目名稱:DefinitelyTyped,代碼行數:31,代碼來源:github-electron-renderer-tests.ts

示例7: showContextMenu

function showContextMenu(e: MouseEvent, item: FormattedProcessItem, isLocal: boolean) {
	e.preventDefault();

	const items: IContextMenuItem[] = [];
	const pid = Number(item.pid);

	if (isLocal) {
		items.push({
			label: localize('killProcess', "Kill Process"),
			click() {
				process.kill(pid, 'SIGTERM');
			}
		});

		items.push({
			label: localize('forceKillProcess', "Force Kill Process"),
			click() {
				process.kill(pid, 'SIGKILL');
			}
		});

		items.push({
			type: 'separator'
		});
	}

	items.push({
		label: localize('copy', "Copy"),
		click() {
			const row = document.getElementById(pid.toString());
			if (row) {
				clipboard.writeText(row.innerText);
			}
		}
	});

	items.push({
		label: localize('copyAll', "Copy All"),
		click() {
			const processList = document.getElementById('process-list');
			if (processList) {
				clipboard.writeText(processList.innerText);
			}
		}
	});

	if (item && isLocal && isDebuggable(item.cmd)) {
		items.push({
			type: 'separator'
		});

		items.push({
			label: localize('debug', "Debug"),
			click() {
				attachTo(item);
			}
		});
	}

	popup(items);
}
開發者ID:PKRoma,項目名稱:vscode,代碼行數:61,代碼來源:processExplorerMain.ts

示例8:

 socket.on('clipboard-writeText', (text, type) => {
     clipboard.writeText(text, type);
 });
開發者ID:E024,項目名稱:Electron.NET,代碼行數:3,代碼來源:clipboard.ts

示例9:

 click: () => clipboard.writeText(copyContext),
開發者ID:wireapp,項目名稱:wire-desktop,代碼行數:1,代碼來源:context.ts

示例10:

	$writeText(value: string): Promise<void> {
		clipboard.writeText(value);
		return undefined;
	}
開發者ID:VishalMadhvani,項目名稱:vscode,代碼行數:4,代碼來源:mainThreadClipboard.ts


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