desktop: show Open in browser menu item when a link is selected

This commit is contained in:
Abdullah Atta
2023-02-14 11:43:49 +05:00
committed by Abdullah Atta
parent 6b3c628e6b
commit 6fa82bbe2e

View File

@@ -17,7 +17,7 @@ You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import { Menu, MenuItem, clipboard } from "electron";
import { Menu, MenuItem, clipboard, shell } from "electron";
function setupMenu() {
globalThis.window.webContents.on("context-menu", (_event, params) => {
@@ -54,6 +54,15 @@ function setupMenu() {
})
);
if (params.linkURL.length) {
menu.append(
new MenuItem({
label: "Open in browser",
click: () => shell.openExternal(params.linkURL)
})
);
}
if (params.isEditable) {
menu.append(
new MenuItem({