本文整理汇总了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,
})
//.........这里部分代码省略.........