本文整理匯總了TypeScript中electron.clipboard.writeBookmark方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript clipboard.writeBookmark方法的具體用法?TypeScript clipboard.writeBookmark怎麽用?TypeScript clipboard.writeBookmark使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類electron.clipboard
的用法示例。
在下文中一共展示了clipboard.writeBookmark方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1:
socket.on('clipboard-writeBookmark', (title, url, type) => {
clipboard.writeBookmark(title, url, type);
});
示例2: t
wc.on("context-menu", (e, props) => {
const { i18n } = store.getState();
const editFlags = props.editFlags;
const hasText = props.selectionText.trim().length > 0;
const can = (type: string) =>
((editFlags as any)[`can${type}`] as boolean) && hasText;
let menuTpl: Electron.MenuItemConstructorOptions[] = [
{
type: "separator",
},
{
id: "cut",
label: t(i18n, _("web.context_menu.cut")),
// needed because of macOS limitation:
// https://github.com/electron/electron/issues/5860
role: can("Cut") ? "cut" : null,
enabled: can("Cut"),
visible: props.isEditable,
},
{
id: "copy",
label: t(i18n, _("web.context_menu.copy")),
role: can("Copy") ? "copy" : null,
enabled: can("Copy"),
visible: props.isEditable || hasText,
},
{
id: "paste",
label: t(i18n, _("web.context_menu.paste")),
role: editFlags.canPaste ? "paste" : null,
enabled: editFlags.canPaste,
visible: props.isEditable,
},
{
type: "separator",
},
];
if (props.linkURL && props.mediaType === "none") {
menuTpl = [];
if (store.getState().preferences.enableTabs) {
menuTpl = [
...menuTpl,
{
type: "separator",
},
{
id: "openInNewTab",
label: t(i18n, _("web.context_menu.open_in_new_tab")),
click() {
store.dispatch(
actions.navigate({
wind,
url: props.linkURL,
background: true,
})
);
},
},
];
}
menuTpl = [
...menuTpl,
{
type: "separator",
},
{
id: "copyLink",
label: t(i18n, _("web.context_menu.copy_link")),
click() {
if (process.platform === "darwin") {
electron.clipboard.writeBookmark(props.linkText, props.linkURL);
} else {
electron.clipboard.writeText(props.linkURL);
}
},
},
{
type: "separator",
},
];
}
// filter out leading/trailing separators
// TODO: https://github.com/electron/electron/issues/5869
menuTpl = delUnusedElements(menuTpl);
if (env.development) {
menuTpl.push({
id: "inspect",
label: t(i18n, _("web.context_menu.inspect")),
click() {
store.dispatch(
actions.inspect({
webContentsId: wc.id,
x: props.x,
y: props.y,
})
//.........這裏部分代碼省略.........