(e: React.MouseEvent<HTMLDivElement>)
| 102 | } |
| 103 | |
| 104 | async function handleContextMenu(e: React.MouseEvent<HTMLDivElement>) { |
| 105 | e.preventDefault(); |
| 106 | const canPaste = canEnablePaste(); |
| 107 | const canCopy = canEnableCopy(); |
| 108 | const canCut = canEnableCut(); |
| 109 | const clipboardURL = await getClipboardURL(); |
| 110 | if (!canPaste && !canCopy && !canCut && !clipboardURL) { |
| 111 | return; |
| 112 | } |
| 113 | const menu: ContextMenuItem[] = []; |
| 114 | if (canCut) { |
| 115 | menu.push({ label: "Cut", role: "cut" }); |
| 116 | } |
| 117 | if (canCopy) { |
| 118 | menu.push({ label: "Copy", role: "copy" }); |
| 119 | } |
| 120 | if (canPaste) { |
| 121 | menu.push({ label: "Paste", role: "paste" }); |
| 122 | } |
| 123 | if (clipboardURL) { |
| 124 | menu.push({ type: "separator" }); |
| 125 | menu.push({ |
| 126 | label: "Open Clipboard URL (" + clipboardURL.hostname + ")", |
| 127 | click: () => { |
| 128 | createBlock({ |
| 129 | meta: { |
| 130 | view: "web", |
| 131 | url: clipboardURL.toString(), |
| 132 | }, |
| 133 | }); |
| 134 | }, |
| 135 | }); |
| 136 | } |
| 137 | ContextMenuModel.getInstance().showContextMenu(menu, e); |
| 138 | } |
| 139 | |
| 140 | function AppSettingsUpdater() { |
| 141 | const windowSettingsAtom = getSettingsPrefixAtom("window"); |
nothing calls this directly
no test coverage detected